From f1315ae91e60cffc0310eb92cdd6f57492aa3dc2 Mon Sep 17 00:00:00 2001 From: nousbot-eng Date: Thu, 16 Jul 2026 18:26:09 -0400 Subject: [PATCH] fmt(js): `npm run fix` on merge (#65971) Co-authored-by: github-actions[bot] --- .../hooks/use-session-actions/utils.test.ts | 90 ++++++++++++++++--- .../hooks/use-session-actions/utils.ts | 6 +- .../components/assistant-ui/thread/list.tsx | 1 + 3 files changed, 81 insertions(+), 16 deletions(-) diff --git a/apps/desktop/src/app/session/hooks/use-session-actions/utils.test.ts b/apps/desktop/src/app/session/hooks/use-session-actions/utils.test.ts index d2e20871c38f..12a30b16e4f0 100644 --- a/apps/desktop/src/app/session/hooks/use-session-actions/utils.test.ts +++ b/apps/desktop/src/app/session/hooks/use-session-actions/utils.test.ts @@ -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 + } ] } diff --git a/apps/desktop/src/app/session/hooks/use-session-actions/utils.ts b/apps/desktop/src/app/session/hooks/use-session-actions/utils.ts index a9826b7a97d0..e7a7ec1ad71d 100644 --- a/apps/desktop/src/app/session/hooks/use-session-actions/utils.ts +++ b/apps/desktop/src/app/session/hooks/use-session-actions/utils.ts @@ -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]: never + [K in Exclude]: 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]: never + [T in Exclude]: never } = {} const HANDLED_PART_TYPES = [ diff --git a/apps/desktop/src/components/assistant-ui/thread/list.tsx b/apps/desktop/src/components/assistant-ui/thread/list.tsx index b8879433080c..c6e47c544d19 100644 --- a/apps/desktop/src/components/assistant-ui/thread/list.tsx +++ b/apps/desktop/src/components/assistant-ui/thread/list.tsx @@ -237,6 +237,7 @@ const ThreadMessageListInner: FC = ({ } 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.