fmt(js): npm run fix on merge (#65971)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
nousbot-eng 2026-07-16 18:26:09 -04:00 committed by GitHub
parent 0f05aaa2bf
commit f1315ae91e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 81 additions and 16 deletions

View file

@ -98,22 +98,64 @@ describe('chatPartsEquivalent', () => {
})
it('returns true for tool-call parts with same identity and both have no result', () => {
const partA = { type: 'tool-call' as const, toolCallId: 'tc-1', toolName: 'read_file', args: {} as never, argsText: '{}' }
const partB = { type: 'tool-call' as const, toolCallId: 'tc-1', toolName: 'read_file', args: {} as never, argsText: '{}' }
const partA = {
type: 'tool-call' as const,
toolCallId: 'tc-1',
toolName: 'read_file',
args: {} as never,
argsText: '{}'
}
const partB = {
type: 'tool-call' as const,
toolCallId: 'tc-1',
toolName: 'read_file',
args: {} as never,
argsText: '{}'
}
expect(chatPartsEquivalent(partA, partB)).toBe(true)
})
it('returns true for tool-call parts with same identity and both have results', () => {
const partA = { type: 'tool-call' as const, toolCallId: 'tc-1', toolName: 'read_file', args: {} as never, argsText: '{}', result: { content: 'file data' }, isError: false }
const partB = { type: 'tool-call' as const, toolCallId: 'tc-1', toolName: 'read_file', args: {} as never, argsText: '{}', result: { content: 'file data' }, isError: false }
const partA = {
type: 'tool-call' as const,
toolCallId: 'tc-1',
toolName: 'read_file',
args: {} as never,
argsText: '{}',
result: { content: 'file data' },
isError: false
}
const partB = {
type: 'tool-call' as const,
toolCallId: 'tc-1',
toolName: 'read_file',
args: {} as never,
argsText: '{}',
result: { content: 'file data' },
isError: false
}
expect(chatPartsEquivalent(partA, partB)).toBe(true)
})
it('returns false when only one tool-call part has a result', () => {
const partA = { type: 'tool-call' as const, toolCallId: 'tc-1', toolName: 'read_file', args: {} as never, argsText: '{}' }
const partB = { type: 'tool-call' as const, toolCallId: 'tc-1', toolName: 'read_file', args: {} as never, argsText: '{}', result: { content: 'file data' }, isError: false }
const partA = {
type: 'tool-call' as const,
toolCallId: 'tc-1',
toolName: 'read_file',
args: {} as never,
argsText: '{}'
}
const partB = {
type: 'tool-call' as const,
toolCallId: 'tc-1',
toolName: 'read_file',
args: {} as never,
argsText: '{}',
result: { content: 'file data' },
isError: false
}
expect(chatPartsEquivalent(partA, partB)).toBe(false)
})
@ -138,15 +180,22 @@ describe('chatMessagesEquivalent', () => {
const messageA: ChatMessage = {
id: 'msg-1',
role: 'assistant',
parts: [
{ type: 'tool-call', toolCallId: 'tc-1', toolName: 'read_file', args: {} as never, argsText: '{}' }
]
parts: [{ type: 'tool-call', toolCallId: 'tc-1', toolName: 'read_file', args: {} as never, argsText: '{}' }]
}
const messageB: ChatMessage = {
id: 'msg-1',
role: 'assistant',
parts: [
{ type: 'tool-call', toolCallId: 'tc-1', toolName: 'read_file', args: {} as never, argsText: '{}', result: { content: 'data' }, isError: false }
{
type: 'tool-call',
toolCallId: 'tc-1',
toolName: 'read_file',
args: {} as never,
argsText: '{}',
result: { content: 'data' },
isError: false
}
]
}
@ -165,15 +214,32 @@ describe('chatMessagesEquivalent', () => {
role: 'assistant',
parts: [
{ type: 'text', text: 'Here are the images:' },
{ type: 'tool-call', toolCallId: 'img-1', toolName: 'image_generate', args: { prompt: 'a cat' } as never, argsText: '{"prompt":"a cat"}', result: { image: 'data:image/png;base64,iVBORw0KG...(large base64)' }, isError: false }
{
type: 'tool-call',
toolCallId: 'img-1',
toolName: 'image_generate',
args: { prompt: 'a cat' } as never,
argsText: '{"prompt":"a cat"}',
result: { image: 'data:image/png;base64,iVBORw0KG...(large base64)' },
isError: false
}
]
}
const messageB: ChatMessage = {
id: 'msg-1',
role: 'assistant',
parts: [
{ type: 'text', text: 'Here are the images:' },
{ type: 'tool-call', toolCallId: 'img-1', toolName: 'image_generate', args: { prompt: 'a cat' } as never, argsText: '{"prompt":"a cat"}', result: { image: 'data:image/png;base64,iVBORw0KG...(large base64)' }, isError: false }
{
type: 'tool-call',
toolCallId: 'img-1',
toolName: 'image_generate',
args: { prompt: 'a cat' } as never,
argsText: '{"prompt":"a cat"}',
result: { image: 'data:image/png;base64,iVBORw0KG...(large base64)' },
isError: false
}
]
}

View file

@ -70,8 +70,7 @@ function preserveReasoningParts(message: ChatMessage, previous: ChatMessage): Ch
// COMPARED. If it's metadata that shouldn't trigger a re-render, add it to
// IGNORED.
const _chatMessageFieldsExhaustive: {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[K in Exclude<keyof ChatMessage, typeof COMPARED_FIELDS[number] | typeof IGNORED_FIELDS[number]>]: never
[K in Exclude<keyof ChatMessage, (typeof COMPARED_FIELDS)[number] | (typeof IGNORED_FIELDS)[number]>]: never
} = {}
const COMPARED_FIELDS = ['id', 'role', 'pending', 'error', 'hidden', 'branchGroupId'] as const
@ -83,8 +82,7 @@ const IGNORED_FIELDS = ['timestamp', 'attachmentRefs', 'parts'] as const
// tool-call → compared by toolCallId/toolName + result presence
// source, image, file, data, generative-ui, audio, data-* → shallow primitive compare
const _chatMessagePartTypesExhaustive: {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[T in Exclude<ChatMessage['parts'][number]['type'], typeof HANDLED_PART_TYPES[number]>]: never
[T in Exclude<ChatMessage['parts'][number]['type'], (typeof HANDLED_PART_TYPES)[number]>]: never
} = {}
const HANDLED_PART_TYPES = [

View file

@ -237,6 +237,7 @@ const ThreadMessageListInner: FC<ThreadMessageListProps> = ({
}
let rafId = requestAnimationFrame(settle)
// After the settle loop starts, bump the render budget to the full value
// in a subsequent rAF so the full transcript becomes available after the
// first paint.