From 4e3014a70ea9e452dd7883cc1119ba2e9df24a02 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sun, 25 Oct 2026 08:29:47 -0700 Subject: [PATCH] refactor: group native chat tool presentation modules (#33515) --- config/scripts/ci-shard-timings.json | 18 ++++++------ config/scripts/ci-unit-input-ownership.json | 6 ++-- .../tool-preview-whitespace-benchmark.mjs | 28 +++++++++++++++---- .../src/session/MobileNativeChatDiffCard.tsx | 2 +- .../session/MobileNativeChatFullContent.tsx | 2 +- .../src/session/MobileNativeChatMessage.tsx | 2 +- .../src/session/MobileNativeChatToolIcon.tsx | 2 +- .../src/session/MobileNativeChatToolLine.tsx | 6 ++-- .../session/MobileNativeChatToolRun.test.tsx | 2 +- .../src/session/MobileNativeChatToolRun.tsx | 12 ++++---- .../mobile-native-chat-tool-summary.test.ts | 5 +++- .../claude-structured-prompt-items.test.ts | 2 +- .../claude/claude-structured-prompt-items.ts | 5 +++- .../codex/codex-collab-agent-tool-call.ts | 2 +- .../codex-structured-item-stream-bounds.ts | 2 +- .../codex-structured-item-translation.test.ts | 2 +- .../codex-structured-item-translation.ts | 5 +++- ...ine-decoders-claude-command-output.test.ts | 2 +- .../src/components/editor/IpynbCellRun.tsx | 2 +- .../native-chat/NativeChatToolAnnotations.tsx | 2 +- .../native-chat/NativeChatToolIcon.tsx | 4 +-- .../native-chat/NativeChatToolOutput.tsx | 6 ++-- .../native-chat/NativeChatToolRun.tsx | 8 +++--- .../NativeChatToolRunCallCounts.tsx | 2 +- .../NativeChatToolRunMemberList.tsx | 2 +- ...e-chat-shared-copy-matches-catalog.test.ts | 6 ++-- .../native-chat-tool-line-label.ts | 2 +- .../native-chat/native-chat-tool-run-label.ts | 4 +-- .../native-chat-tool-summary.test.ts | 2 +- .../native-chat/native-chat-tool-summary.ts | 10 ------- src/shared/agent-session-journal-types.ts | 2 +- .../ansi-escape-sequences-consumers.test.ts | 2 +- src/shared/native-chat-message-preparation.ts | 2 +- .../native-chat-transcript-contracts.test.ts | 2 +- src/shared/native-chat-turn-activity.ts | 5 +++- src/shared/native-chat-types.ts | 2 +- .../native-chat-command-language.ts | 2 +- .../tools}/native-chat-command-output.test.ts | 4 +-- .../tools}/native-chat-command-output.ts | 10 +++---- .../tools}/native-chat-tool-activity.spec.ts | 2 +- .../tools}/native-chat-tool-activity.ts | 2 +- .../tools}/native-chat-tool-icon.test.ts | 0 .../tools}/native-chat-tool-icon.ts | 2 +- .../tools}/native-chat-tool-identity.test.ts | 0 .../tools}/native-chat-tool-identity.ts | 2 +- .../tools}/native-chat-tool-input-text.ts | 0 .../native-chat-tool-line-identity.test.ts | 2 +- .../tools}/native-chat-tool-line-identity.ts | 2 +- .../native-chat-tool-line-label.test.ts | 0 .../tools}/native-chat-tool-line-label.ts | 6 ++-- .../native-chat-tool-preview-prefix.test.ts | 0 .../tools}/native-chat-tool-preview-prefix.ts | 0 .../native-chat-tool-preview-scan.test.ts | 0 .../native-chat-tool-result-orphans.spec.ts | 2 +- .../native-chat-tool-run-outcome.test.ts | 2 +- .../tools}/native-chat-tool-run-outcome.ts | 4 +-- .../native-chat-tool-run-sentence.test.ts | 0 .../tools}/native-chat-tool-run-sentence.ts | 2 +- .../tools}/native-chat-tool-summary.test.ts | 2 +- .../tools}/native-chat-tool-summary.ts | 2 +- .../structured-agent-session-projection.ts | 2 +- ...red-agent-session-status-tool-line.test.ts | 2 +- 62 files changed, 122 insertions(+), 100 deletions(-) delete mode 100644 src/renderer/src/components/native-chat/native-chat-tool-summary.ts rename src/shared/{ => native-chat/tools}/native-chat-command-output.test.ts (98%) rename src/shared/{ => native-chat/tools}/native-chat-command-output.ts (86%) rename src/shared/{ => native-chat/tools}/native-chat-tool-activity.spec.ts (98%) rename src/shared/{ => native-chat/tools}/native-chat-tool-activity.ts (97%) rename src/shared/{ => native-chat/tools}/native-chat-tool-icon.test.ts (100%) rename src/shared/{ => native-chat/tools}/native-chat-tool-icon.ts (98%) rename src/shared/{ => native-chat/tools}/native-chat-tool-identity.test.ts (100%) rename src/shared/{ => native-chat/tools}/native-chat-tool-identity.ts (97%) rename src/shared/{ => native-chat/tools}/native-chat-tool-input-text.ts (100%) rename src/shared/{ => native-chat/tools}/native-chat-tool-line-identity.test.ts (98%) rename src/shared/{ => native-chat/tools}/native-chat-tool-line-identity.ts (96%) rename src/shared/{ => native-chat/tools}/native-chat-tool-line-label.test.ts (100%) rename src/shared/{ => native-chat/tools}/native-chat-tool-line-label.ts (96%) rename src/shared/{ => native-chat/tools}/native-chat-tool-preview-prefix.test.ts (100%) rename src/shared/{ => native-chat/tools}/native-chat-tool-preview-prefix.ts (100%) rename src/shared/{ => native-chat/tools}/native-chat-tool-preview-scan.test.ts (100%) rename src/shared/{ => native-chat/tools}/native-chat-tool-run-outcome.test.ts (98%) rename src/shared/{ => native-chat/tools}/native-chat-tool-run-outcome.ts (92%) rename src/shared/{ => native-chat/tools}/native-chat-tool-run-sentence.test.ts (100%) rename src/shared/{ => native-chat/tools}/native-chat-tool-run-sentence.ts (98%) rename src/shared/{ => native-chat/tools}/native-chat-tool-summary.test.ts (99%) rename src/shared/{ => native-chat/tools}/native-chat-tool-summary.ts (99%) diff --git a/config/scripts/ci-shard-timings.json b/config/scripts/ci-shard-timings.json index 3f728784e1a..bac5801f3b0 100644 --- a/config/scripts/ci-shard-timings.json +++ b/config/scripts/ci-shard-timings.json @@ -11556,7 +11556,7 @@ "src/shared/native-chat-ask.test.ts": 51, "src/shared/native-chat-background-task-row.test.ts": 45, "src/shared/native-chat-command-envelope.test.ts": 37, - "src/shared/native-chat-command-output.test.ts": 47, + "src/shared/native-chat/tools/native-chat-command-output.test.ts": 47, "src/shared/native-chat-context-usage.test.ts": 35, "src/shared/native-chat-cut-turn-notice.test.ts": 364, "src/shared/native-chat/tools/native-chat-edit-normalize.test.ts": 419, @@ -11587,18 +11587,18 @@ "src/shared/native-chat-tool-activity.test.ts": 49, "src/shared/native-chat/tools/native-chat-tool-attribution-allocation.test.ts": 112, "src/shared/native-chat-tool-fold-attribution.test.ts": 39, - "src/shared/native-chat-tool-icon.test.ts": 83, - "src/shared/native-chat-tool-identity.test.ts": 64, - "src/shared/native-chat-tool-line-identity.test.ts": 33, + "src/shared/native-chat/tools/native-chat-tool-icon.test.ts": 83, + "src/shared/native-chat/tools/native-chat-tool-identity.test.ts": 64, + "src/shared/native-chat/tools/native-chat-tool-line-identity.test.ts": 33, "src/shared/native-chat-tool-pair-limit.test.ts": 75, "src/shared/native-chat/tools/native-chat-tool-pairing.performance.test.ts": 463, "src/shared/native-chat-tool-pairing.test.ts": 41, - "src/shared/native-chat-tool-preview-prefix.test.ts": 31, - "src/shared/native-chat-tool-preview-scan.test.ts": 37, + "src/shared/native-chat/tools/native-chat-tool-preview-prefix.test.ts": 31, + "src/shared/native-chat/tools/native-chat-tool-preview-scan.test.ts": 37, "src/shared/native-chat-tool-result-orphans.test.ts": 294, - "src/shared/native-chat-tool-run-outcome.test.ts": 58, - "src/shared/native-chat-tool-run-sentence.test.ts": 52, - "src/shared/native-chat-tool-summary.test.ts": 61, + "src/shared/native-chat/tools/native-chat-tool-run-outcome.test.ts": 58, + "src/shared/native-chat/tools/native-chat-tool-run-sentence.test.ts": 52, + "src/shared/native-chat/tools/native-chat-tool-summary.test.ts": 61, "src/shared/native-chat-transcript-projection.test.ts": 250, "src/shared/native-chat-transcript-retention.test.ts": 56, "src/shared/native-chat-turn-activity.test.ts": 216, diff --git a/config/scripts/ci-unit-input-ownership.json b/config/scripts/ci-unit-input-ownership.json index c5e838dfa1f..a06ad7f95ae 100644 --- a/config/scripts/ci-unit-input-ownership.json +++ b/config/scripts/ci-unit-input-ownership.json @@ -34,12 +34,12 @@ "contextSha256": "747ec5af67a0b60890da900a83fa255d3b96e2fa17d9199f8e483ef5051b213c" }, { - "file": "src/shared/native-chat-tool-identity.ts", + "file": "src/shared/native-chat/tools/native-chat-tool-identity.ts", "inputs": [], "emptyEnv": [], - "sourceClosureSha256": "08558478f5a5a6c0aa2e4e4d92d609ff55c11564d04a957f999f2302c478ae80", + "sourceClosureSha256": "1e813201b2fb133e5166c14223d6d04bca99c2946c8dca5db155420a2b41d36c", "reason": "Reviewed data/URL parsing only; no indirect repository input. Imported source dependencies remain graph edges.", - "contextSha256": "747ec5af67a0b60890da900a83fa255d3b96e2fa17d9199f8e483ef5051b213c" + "contextSha256": "030c2dd077f6b9d453554d2bb85b9a3362ef3d7c8f3f5def5c3821112f6c0632" }, { "file": "src/shared/pairing.ts", diff --git a/config/scripts/tool-preview-whitespace-benchmark.mjs b/config/scripts/tool-preview-whitespace-benchmark.mjs index a98fdef7f8b..2d3a973fe41 100644 --- a/config/scripts/tool-preview-whitespace-benchmark.mjs +++ b/config/scripts/tool-preview-whitespace-benchmark.mjs @@ -4,26 +4,44 @@ import { dirname, resolve } from 'node:path' import assert from 'node:assert/strict' import { build } from 'esbuild' const file = 'src/shared/native-chat-tool-summary.ts' +const currentFile = 'src/shared/native-chat/tools/native-chat-tool-summary.ts' const baseline = process.argv[2] ?? '20ab9950654' const beforeSource = execFileSync('git', ['show', `${baseline}:${file}`], { encoding: 'utf8', windowsHide: true }) -const afterSource = fs.readFileSync(file, 'utf8') -async function load(contents) { +const afterSource = fs.readFileSync(currentFile, 'utf8') +async function load(contents, sourceFile = file) { const { outputFiles } = await build({ - stdin: { contents, loader: 'ts', resolveDir: dirname(resolve(file)) }, + stdin: { contents, loader: 'ts', resolveDir: dirname(resolve(sourceFile)) }, bundle: true, platform: 'node', format: 'esm', - write: false + write: false, + plugins: [ + { + name: 'relocated-current-preview-dependencies', + setup(builder) { + builder.onResolve({ filter: /^\./ }, (args) => { + const target = resolve(args.resolveDir, args.path) + for (const name of ['native-chat-tool-preview-prefix', 'native-chat-tool-identity']) { + const previous = resolve('src/shared', name) + if (target === previous || target === `${previous}.ts`) { + return { path: resolve('src/shared/native-chat/tools', `${name}.ts`) } + } + } + return undefined + }) + } + } + ] }) return import( `data:text/javascript;base64,${Buffer.from(outputFiles[0].text).toString('base64')}` ) } const before = await load(beforeSource), - after = await load(afterSource) + after = await load(afterSource, currentFile) const display = (m, input) => { const d = m.createToolInputDisplay(input) return { ...d, formatDetail: d.formatDetail() } diff --git a/mobile/src/session/MobileNativeChatDiffCard.tsx b/mobile/src/session/MobileNativeChatDiffCard.tsx index a5440ab9bc9..2009a63e983 100644 --- a/mobile/src/session/MobileNativeChatDiffCard.tsx +++ b/mobile/src/session/MobileNativeChatDiffCard.tsx @@ -11,7 +11,7 @@ import { type NativeChatEditFile, type NativeChatEditLine } from '../../../src/shared/native-chat/tools/native-chat-edit-model' -import { NATIVE_CHAT_TOOL_ROW_VERB_COPY } from '../../../src/shared/native-chat-tool-line-label' +import { NATIVE_CHAT_TOOL_ROW_VERB_COPY } from '../../../src/shared/native-chat/tools/native-chat-tool-line-label' import { MobileSourceCopyButton } from '../components/MobileSourceCopyButton' import { colors } from '../theme/mobile-theme' import { useMobileNativeChatOpenedDetail } from './mobile-native-chat-opened-detail' diff --git a/mobile/src/session/MobileNativeChatFullContent.tsx b/mobile/src/session/MobileNativeChatFullContent.tsx index e670260f6d6..3defffb5224 100644 --- a/mobile/src/session/MobileNativeChatFullContent.tsx +++ b/mobile/src/session/MobileNativeChatFullContent.tsx @@ -3,7 +3,7 @@ import { Pressable, Text, View, type TextStyle } from 'react-native' import { truncateToolDetail, MAX_TOOL_DETAIL_LENGTH -} from '../../../src/shared/native-chat-tool-summary' +} from '../../../src/shared/native-chat/tools/native-chat-tool-summary' import type { NativeChatMessage, NativeChatToolResultBlock diff --git a/mobile/src/session/MobileNativeChatMessage.tsx b/mobile/src/session/MobileNativeChatMessage.tsx index 3a51ed5abf6..d5d79b31658 100644 --- a/mobile/src/session/MobileNativeChatMessage.tsx +++ b/mobile/src/session/MobileNativeChatMessage.tsx @@ -3,7 +3,7 @@ import { Text, View } from 'react-native' import { INLINE_TEXT_SELECTION } from '../components/inline-text-selection' import { MobileNativeChatLongPressContent as Content } from './MobileNativeChatLongPressContent' import { splitNativeChatBlocks } from '../../../src/shared/native-chat/tools/native-chat-tool-fold' -import { selectActiveToolCall } from '../../../src/shared/native-chat-tool-activity' +import { selectActiveToolCall } from '../../../src/shared/native-chat/tools/native-chat-tool-activity' import { isImageRefBlock, isSubagentGroupBlock, diff --git a/mobile/src/session/MobileNativeChatToolIcon.tsx b/mobile/src/session/MobileNativeChatToolIcon.tsx index cb88a19f4df..b3777bba739 100644 --- a/mobile/src/session/MobileNativeChatToolIcon.tsx +++ b/mobile/src/session/MobileNativeChatToolIcon.tsx @@ -13,7 +13,7 @@ import { Wrench, type LucideIcon } from 'lucide-react-native' -import type { NativeChatToolIconName } from '../../../src/shared/native-chat-tool-icon' +import type { NativeChatToolIconName } from '../../../src/shared/native-chat/tools/native-chat-tool-icon' const GLYPHS: Record = { eye: Eye, diff --git a/mobile/src/session/MobileNativeChatToolLine.tsx b/mobile/src/session/MobileNativeChatToolLine.tsx index 235002c5d5d..a38554af761 100644 --- a/mobile/src/session/MobileNativeChatToolLine.tsx +++ b/mobile/src/session/MobileNativeChatToolLine.tsx @@ -13,12 +13,12 @@ import { mcpToolIdentity, toolWebSearchResults, type NativeChatWebSearchResult -} from '../../../src/shared/native-chat-tool-identity' -import { nativeChatToolIconName } from '../../../src/shared/native-chat-tool-icon' +} from '../../../src/shared/native-chat/tools/native-chat-tool-identity' +import { nativeChatToolIconName } from '../../../src/shared/native-chat/tools/native-chat-tool-icon' import { NATIVE_CHAT_TOOL_ROW_VERB_COPY, nativeChatToolLineLabel -} from '../../../src/shared/native-chat-tool-line-label' +} from '../../../src/shared/native-chat/tools/native-chat-tool-line-label' import { isToolCallBlock, type NativeChatToolCallBlock, diff --git a/mobile/src/session/MobileNativeChatToolRun.test.tsx b/mobile/src/session/MobileNativeChatToolRun.test.tsx index 68647cf772b..b04b17bb99b 100644 --- a/mobile/src/session/MobileNativeChatToolRun.test.tsx +++ b/mobile/src/session/MobileNativeChatToolRun.test.tsx @@ -2,7 +2,7 @@ import { createElement, type ReactNode } from 'react' import { act, create, type ReactTestInstance, type ReactTestRenderer } from 'react-test-renderer' import { afterEach, describe, expect, it, vi } from 'vitest' import type { AgentJournalToolCallItem } from '../../../src/shared/agent-session-journal-types' -import { MAX_TOOL_DETAIL_LENGTH } from '../../../src/shared/native-chat-tool-summary' +import { MAX_TOOL_DETAIL_LENGTH } from '../../../src/shared/native-chat/tools/native-chat-tool-summary' import { projectStructuredItemToNativeChat } from '../../../src/shared/structured-agent-session-projection' import type { NativeChatBlock, diff --git a/mobile/src/session/MobileNativeChatToolRun.tsx b/mobile/src/session/MobileNativeChatToolRun.tsx index 84ce185590e..821ada734d0 100644 --- a/mobile/src/session/MobileNativeChatToolRun.tsx +++ b/mobile/src/session/MobileNativeChatToolRun.tsx @@ -23,16 +23,16 @@ import { describeLatestToolCall, NATIVE_CHAT_TOOL_ACTIVITY_COPY, selectActiveToolCall -} from '../../../src/shared/native-chat-tool-activity' -import { nativeChatToolRunIconName } from '../../../src/shared/native-chat-tool-icon' -import { nativeChatToolLineIdentity } from '../../../src/shared/native-chat-tool-line-identity' +} from '../../../src/shared/native-chat/tools/native-chat-tool-activity' +import { nativeChatToolRunIconName } from '../../../src/shared/native-chat/tools/native-chat-tool-icon' +import { nativeChatToolLineIdentity } from '../../../src/shared/native-chat/tools/native-chat-tool-line-identity' import { pairNativeChatToolResults } from '../../../src/shared/native-chat/tools/native-chat-tool-pairing' -import { nativeChatToolRunOutcome } from '../../../src/shared/native-chat-tool-run-outcome' +import { nativeChatToolRunOutcome } from '../../../src/shared/native-chat/tools/native-chat-tool-run-outcome' import { NATIVE_CHAT_TOOL_RUN_SENTENCE_ENGLISH, nativeChatToolRunSentence -} from '../../../src/shared/native-chat-tool-run-sentence' -import { countToolCalls } from '../../../src/shared/native-chat-tool-summary' +} from '../../../src/shared/native-chat/tools/native-chat-tool-run-sentence' +import { countToolCalls } from '../../../src/shared/native-chat/tools/native-chat-tool-summary' import { buildEditCards } from '../../../src/shared/native-chat/tools/native-chat-edit-cards' import { isToolCallBlock, diff --git a/mobile/src/session/mobile-native-chat-tool-summary.test.ts b/mobile/src/session/mobile-native-chat-tool-summary.test.ts index 81069545ae4..7fa212b3218 100644 --- a/mobile/src/session/mobile-native-chat-tool-summary.test.ts +++ b/mobile/src/session/mobile-native-chat-tool-summary.test.ts @@ -1,5 +1,8 @@ import { describe, expect, it, vi } from 'vitest' -import { summarizeToolInput, toolFilePath } from '../../../src/shared/native-chat-tool-summary' +import { + summarizeToolInput, + toolFilePath +} from '../../../src/shared/native-chat/tools/native-chat-tool-summary' describe('summarizeToolInput', () => { it('passes short strings through, collapsing whitespace', () => { diff --git a/src/main/claude/claude-structured-prompt-items.test.ts b/src/main/claude/claude-structured-prompt-items.test.ts index 56d55a7e236..6228691e69a 100644 --- a/src/main/claude/claude-structured-prompt-items.test.ts +++ b/src/main/claude/claude-structured-prompt-items.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest' import { agentJournalItemKey } from '../../shared/agent-session-journal-item-key' import { cancelledJournalPromptBody } from '../native-chat/agent-session-journal/journal-prompt-body-bounds' import { MAX_JOURNAL_LIFECYCLE_BATCH_BYTES } from '../native-chat/agent-session-journal/journal-row-schema' -import { MAX_TOOL_DETAIL_LENGTH } from '../../shared/native-chat-tool-summary' +import { MAX_TOOL_DETAIL_LENGTH } from '../../shared/native-chat/tools/native-chat-tool-summary' import { claudeApprovalItem, claudeQuestionItems } from './claude-structured-prompt-items' import { buildClaudePromptReply, diff --git a/src/main/claude/claude-structured-prompt-items.ts b/src/main/claude/claude-structured-prompt-items.ts index cfb30d7363a..251b22ee3cd 100644 --- a/src/main/claude/claude-structured-prompt-items.ts +++ b/src/main/claude/claude-structured-prompt-items.ts @@ -5,7 +5,10 @@ import type { AgentJournalQuestion, AgentJournalQuestionItem } from '../../shared/agent-session-journal-types' -import { formatToolInput, truncateToolDetail } from '../../shared/native-chat-tool-summary' +import { + formatToolInput, + truncateToolDetail +} from '../../shared/native-chat/tools/native-chat-tool-summary' import { isPlanApprovalSubject } from '../../shared/agent-session-approval-subject' import { boundJournalPromptBody } from '../native-chat/agent-session-journal/journal-prompt-body-bounds' import { claudeRecord, claudeText } from './claude-structured-item-translation' diff --git a/src/main/codex/codex-collab-agent-tool-call.ts b/src/main/codex/codex-collab-agent-tool-call.ts index 99231c5c9e5..128c995b123 100644 --- a/src/main/codex/codex-collab-agent-tool-call.ts +++ b/src/main/codex/codex-collab-agent-tool-call.ts @@ -3,7 +3,7 @@ // agentsStates holds caller snapshots; child turn frames determine execution state. import { codexCollabToolRowName } from '../../shared/codex-collab-agent-tools' -import { collapsedToolInputPrefix } from '../../shared/native-chat-tool-preview-prefix' +import { collapsedToolInputPrefix } from '../../shared/native-chat/tools/native-chat-tool-preview-prefix' import { readRecord, readString } from './codex-item-field-readers' import type { CodexThreadItem } from './codex-thread-item-identity' diff --git a/src/main/codex/codex-structured-item-stream-bounds.ts b/src/main/codex/codex-structured-item-stream-bounds.ts index d9fd9787035..856deb5ee8b 100644 --- a/src/main/codex/codex-structured-item-stream-bounds.ts +++ b/src/main/codex/codex-structured-item-stream-bounds.ts @@ -1,5 +1,5 @@ import type { AgentJournalItemIdentity } from '../../shared/agent-session-journal-types' -import { toolExecutionMetadata } from '../../shared/native-chat-tool-identity' +import { toolExecutionMetadata } from '../../shared/native-chat/tools/native-chat-tool-identity' import type { CodexItemStreamState } from './codex-structured-item-stream-contracts' import type { CodexThreadItem } from './codex-thread-item-identity' diff --git a/src/main/codex/codex-structured-item-translation.test.ts b/src/main/codex/codex-structured-item-translation.test.ts index 77be093e1a6..dca79ccb5b7 100644 --- a/src/main/codex/codex-structured-item-translation.test.ts +++ b/src/main/codex/codex-structured-item-translation.test.ts @@ -4,7 +4,7 @@ import { briefToolArg, createToolInputDisplay, describeToolInput -} from '../../shared/native-chat-tool-summary' +} from '../../shared/native-chat/tools/native-chat-tool-summary' import { codexItemBody, codexItemIdentity, diff --git a/src/main/codex/codex-structured-item-translation.ts b/src/main/codex/codex-structured-item-translation.ts index 6814bc3f2af..666e557ef09 100644 --- a/src/main/codex/codex-structured-item-translation.ts +++ b/src/main/codex/codex-structured-item-translation.ts @@ -1,4 +1,7 @@ -import { toolExecutionMetadata, toolWebSearchResults } from '../../shared/native-chat-tool-identity' +import { + toolExecutionMetadata, + toolWebSearchResults +} from '../../shared/native-chat/tools/native-chat-tool-identity' import type { AgentJournalItemBody } from '../../shared/agent-session-journal-types' import type { NativeChatBlock } from '../../shared/native-chat-types' import { CODEX_ASYNC_QUESTION_TOOL } from '../../shared/codex-async-question-input' diff --git a/src/main/native-chat/transcript-line-decoders-claude-command-output.test.ts b/src/main/native-chat/transcript-line-decoders-claude-command-output.test.ts index 06864bd2afa..3ee23d09f1d 100644 --- a/src/main/native-chat/transcript-line-decoders-claude-command-output.test.ts +++ b/src/main/native-chat/transcript-line-decoders-claude-command-output.test.ts @@ -1,7 +1,7 @@ import { readFileSync } from 'node:fs' import { join } from 'node:path' import { describe, expect, it } from 'vitest' -import { surfaceNativeChatCommandOutputs } from '../../shared/native-chat-command-output' +import { surfaceNativeChatCommandOutputs } from '../../shared/native-chat/tools/native-chat-command-output' import { stripNoiseMessages } from '../../shared/native-chat-noise' import type { NativeChatMessage } from '../../shared/native-chat-types' import { decodeClaudeTranscriptLine } from './transcript-line-decoders-claude' diff --git a/src/renderer/src/components/editor/IpynbCellRun.tsx b/src/renderer/src/components/editor/IpynbCellRun.tsx index 2295c9f931d..370588d6b52 100644 --- a/src/renderer/src/components/editor/IpynbCellRun.tsx +++ b/src/renderer/src/components/editor/IpynbCellRun.tsx @@ -1,5 +1,5 @@ import { useMemo } from 'react' -import { formatToolDuration } from '../../../../shared/native-chat-tool-identity' +import { formatToolDuration } from '../../../../shared/native-chat/tools/native-chat-tool-identity' import { IpynbCellOutputs } from './IpynbCellOutputs' import { IpynbRunPrompt } from './IpynbCellToolbar' import { useCellRun } from './ipynb-kernel-store' diff --git a/src/renderer/src/components/native-chat/NativeChatToolAnnotations.tsx b/src/renderer/src/components/native-chat/NativeChatToolAnnotations.tsx index bb4e04d539d..a79582f6a97 100644 --- a/src/renderer/src/components/native-chat/NativeChatToolAnnotations.tsx +++ b/src/renderer/src/components/native-chat/NativeChatToolAnnotations.tsx @@ -7,7 +7,7 @@ import { formatToolDuration, mcpToolIdentity, toolWebSearchResults -} from '../../../../shared/native-chat-tool-identity' +} from '../../../../shared/native-chat/tools/native-chat-tool-identity' export function NativeChatToolName({ name, diff --git a/src/renderer/src/components/native-chat/NativeChatToolIcon.tsx b/src/renderer/src/components/native-chat/NativeChatToolIcon.tsx index dbf446dad59..71be55b8a38 100644 --- a/src/renderer/src/components/native-chat/NativeChatToolIcon.tsx +++ b/src/renderer/src/components/native-chat/NativeChatToolIcon.tsx @@ -12,13 +12,13 @@ import { SquareTerminal, Wrench } from 'lucide-react' -import type { NativeChatMcpIdentity } from '../../../../shared/native-chat-tool-identity' +import type { NativeChatMcpIdentity } from '../../../../shared/native-chat/tools/native-chat-tool-identity' import type { LucideIcon } from 'lucide-react' import { cn } from '@/lib/utils' import { nativeChatToolIconName, type NativeChatToolIconName -} from '../../../../shared/native-chat-tool-icon' +} from '../../../../shared/native-chat/tools/native-chat-tool-icon' const NATIVE_CHAT_TOOL_GLYPHS: Record = { eye: Eye, diff --git a/src/renderer/src/components/native-chat/NativeChatToolOutput.tsx b/src/renderer/src/components/native-chat/NativeChatToolOutput.tsx index d4eb8d911ff..d90c77b2d7c 100644 --- a/src/renderer/src/components/native-chat/NativeChatToolOutput.tsx +++ b/src/renderer/src/components/native-chat/NativeChatToolOutput.tsx @@ -12,9 +12,11 @@ import type { AgentJournalItemBody } from '../../../../shared/agent-session-journal-types' import type { NativeChatToolResultBlock } from '../../../../shared/native-chat-types' -import { MAX_TOOL_DETAIL_LENGTH } from '../../../../shared/native-chat-tool-summary' +import { + MAX_TOOL_DETAIL_LENGTH, + truncateToolDetail +} from '../../../../shared/native-chat/tools/native-chat-tool-summary' import { useNativeChatVisualOwner } from './native-chat-visual-owner' -import { truncateToolDetail } from './native-chat-tool-summary' /** A partial detail response retains its original byte count. */ type FullOutput = { text: string; partial: { shown: number; total: number } | null } diff --git a/src/renderer/src/components/native-chat/NativeChatToolRun.tsx b/src/renderer/src/components/native-chat/NativeChatToolRun.tsx index 1452d9434d8..e7f4ad8f9c8 100644 --- a/src/renderer/src/components/native-chat/NativeChatToolRun.tsx +++ b/src/renderer/src/components/native-chat/NativeChatToolRun.tsx @@ -15,15 +15,15 @@ import { } from '../../../../shared/native-chat-types' import { isRenderableSubagentGroup } from '../../../../shared/native-chat-subagent-summary' import type { NativeChatDiffReveal } from './native-chat-turn-diffs' -import { countToolCalls } from './native-chat-tool-summary' +import { countToolCalls } from '../../../../shared/native-chat/tools/native-chat-tool-summary' import { nativeChatToolRunSentence } from './native-chat-tool-run-label' import { describeLatestToolCall, NATIVE_CHAT_TOOL_ACTIVITY_COPY, selectActiveToolCall -} from '../../../../shared/native-chat-tool-activity' -import { nativeChatToolRunIconName } from '../../../../shared/native-chat-tool-icon' -import { nativeChatToolRunOutcome } from '../../../../shared/native-chat-tool-run-outcome' +} from '../../../../shared/native-chat/tools/native-chat-tool-activity' +import { nativeChatToolRunIconName } from '../../../../shared/native-chat/tools/native-chat-tool-icon' +import { nativeChatToolRunOutcome } from '../../../../shared/native-chat/tools/native-chat-tool-run-outcome' import { nativeChatAskRunBlocks, nativeChatAskRunSubject diff --git a/src/renderer/src/components/native-chat/NativeChatToolRunCallCounts.tsx b/src/renderer/src/components/native-chat/NativeChatToolRunCallCounts.tsx index 831c03ec43b..5269891afcb 100644 --- a/src/renderer/src/components/native-chat/NativeChatToolRunCallCounts.tsx +++ b/src/renderer/src/components/native-chat/NativeChatToolRunCallCounts.tsx @@ -1,5 +1,5 @@ import { translate } from '@/i18n/i18n' -import { NATIVE_CHAT_TOOL_ACTIVITY_COPY } from '../../../../shared/native-chat-tool-activity' +import { NATIVE_CHAT_TOOL_ACTIVITY_COPY } from '../../../../shared/native-chat/tools/native-chat-tool-activity' /** Count failures separately from calls interrupted by Stop. */ export function NativeChatToolRunCallCounts({ diff --git a/src/renderer/src/components/native-chat/NativeChatToolRunMemberList.tsx b/src/renderer/src/components/native-chat/NativeChatToolRunMemberList.tsx index 4acdad7e3b7..4a74a717034 100644 --- a/src/renderer/src/components/native-chat/NativeChatToolRunMemberList.tsx +++ b/src/renderer/src/components/native-chat/NativeChatToolRunMemberList.tsx @@ -2,7 +2,7 @@ import { useMemo } from 'react' import type { CommentMarkdownLinkClickHandler } from '@/components/sidebar/CommentMarkdown' import type { NativeChatBlock, NativeChatToolCallBlock } from '../../../../shared/native-chat-types' import { pairNativeChatToolResults } from '../../../../shared/native-chat/tools/native-chat-tool-pairing' -import { nativeChatToolLineIdentity } from '../../../../shared/native-chat-tool-line-identity' +import { nativeChatToolLineIdentity } from '../../../../shared/native-chat/tools/native-chat-tool-line-identity' import { NativeChatDiffCard } from './NativeChatDiffCard' import { NativeChatTaskList } from './NativeChatTaskList' import { NativeChatToolLine } from './NativeChatToolLine' diff --git a/src/renderer/src/components/native-chat/native-chat-shared-copy-matches-catalog.test.ts b/src/renderer/src/components/native-chat/native-chat-shared-copy-matches-catalog.test.ts index f34e465f635..6f3eacff0ae 100644 --- a/src/renderer/src/components/native-chat/native-chat-shared-copy-matches-catalog.test.ts +++ b/src/renderer/src/components/native-chat/native-chat-shared-copy-matches-catalog.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' import en from '@/i18n/locales/en.json' -import { NATIVE_CHAT_TOOL_ACTIVITY_COPY } from '../../../../shared/native-chat-tool-activity' +import { NATIVE_CHAT_TOOL_ACTIVITY_COPY } from '../../../../shared/native-chat/tools/native-chat-tool-activity' import { NATIVE_CHAT_COMPOSER_PLACEHOLDER, NATIVE_CHAT_TURN_STATUS_COPY @@ -9,8 +9,8 @@ import { NATIVE_CHAT_TOOL_RUN_LIVE_SENTENCE_COPY, NATIVE_CHAT_TOOL_RUN_SENTENCE_COPY, NATIVE_CHAT_TOOL_RUN_SENTENCE_JOINERS -} from '../../../../shared/native-chat-tool-run-sentence' -import { NATIVE_CHAT_TOOL_ROW_VERB_COPY } from '../../../../shared/native-chat-tool-line-label' +} from '../../../../shared/native-chat/tools/native-chat-tool-run-sentence' +import { NATIVE_CHAT_TOOL_ROW_VERB_COPY } from '../../../../shared/native-chat/tools/native-chat-tool-line-label' import { NATIVE_CHAT_DIFF_CARD_COPY } from '../../../../shared/native-chat/tools/native-chat-edit-cards' import { NATIVE_CHAT_TASK_LIST_COPY } from '../../../../shared/native-chat-task-list' diff --git a/src/renderer/src/components/native-chat/native-chat-tool-line-label.ts b/src/renderer/src/components/native-chat/native-chat-tool-line-label.ts index 9ba50c82cac..fae4f3f544c 100644 --- a/src/renderer/src/components/native-chat/native-chat-tool-line-label.ts +++ b/src/renderer/src/components/native-chat/native-chat-tool-line-label.ts @@ -3,7 +3,7 @@ import { nativeChatToolLineLabel as sharedToolLineLabel, type NativeChatToolLineLabel, type NativeChatToolRowVerb -} from '../../../../shared/native-chat-tool-line-label' +} from '../../../../shared/native-chat/tools/native-chat-tool-line-label' import type { NativeChatToolCallBlock, NativeChatToolResultBlock diff --git a/src/renderer/src/components/native-chat/native-chat-tool-run-label.ts b/src/renderer/src/components/native-chat/native-chat-tool-run-label.ts index 716982248ce..9b1afb00fbe 100644 --- a/src/renderer/src/components/native-chat/native-chat-tool-run-label.ts +++ b/src/renderer/src/components/native-chat/native-chat-tool-run-label.ts @@ -2,8 +2,8 @@ import { translate } from '@/i18n/i18n' import { nativeChatToolRunSentence as sharedRunSentence, type NativeChatToolRunSentenceWords -} from '../../../../shared/native-chat-tool-run-sentence' -import type { NativeChatToolCategory } from '../../../../shared/native-chat-tool-icon' +} from '../../../../shared/native-chat/tools/native-chat-tool-run-sentence' +import type { NativeChatToolCategory } from '../../../../shared/native-chat/tools/native-chat-tool-icon' import type { NativeChatBlock } from '../../../../shared/native-chat-types' /** Extraction requires literal keys/fallbacks; parity tests keep these clauses aligned with mobile’s shared record. */ diff --git a/src/renderer/src/components/native-chat/native-chat-tool-summary.test.ts b/src/renderer/src/components/native-chat/native-chat-tool-summary.test.ts index e2ff5170f28..fde71fd4be0 100644 --- a/src/renderer/src/components/native-chat/native-chat-tool-summary.test.ts +++ b/src/renderer/src/components/native-chat/native-chat-tool-summary.test.ts @@ -5,7 +5,7 @@ import { countToolCalls, summarizeToolInput, summarizeToolRun -} from './native-chat-tool-summary' +} from '../../../../shared/native-chat/tools/native-chat-tool-summary' describe('summarizeToolInput', () => { it('passes short strings through and collapses whitespace', () => { diff --git a/src/renderer/src/components/native-chat/native-chat-tool-summary.ts b/src/renderer/src/components/native-chat/native-chat-tool-summary.ts deleted file mode 100644 index f786de33fff..00000000000 --- a/src/renderer/src/components/native-chat/native-chat-tool-summary.ts +++ /dev/null @@ -1,10 +0,0 @@ -export { - briefToolArg, - countToolCalls, - createToolInputDisplay, - formatToolInput, - summarizeToolInput, - summarizeToolRun, - toolFilePath, - truncateToolDetail -} from '../../../../shared/native-chat-tool-summary' diff --git a/src/shared/agent-session-journal-types.ts b/src/shared/agent-session-journal-types.ts index c9b697b79e6..4358a77325c 100644 --- a/src/shared/agent-session-journal-types.ts +++ b/src/shared/agent-session-journal-types.ts @@ -9,7 +9,7 @@ import type { AgentSessionFailureRowWords } from './agent-session-failure-words' import type { AgentType } from './agent-status-types' import type { AgentSessionQuestionAnswer } from './agent-session-question-answer' import type { AgentJournalTurnOutcome } from './agent-turn-outcome' -import type { NativeChatToolMetadata } from './native-chat-tool-identity' +import type { NativeChatToolMetadata } from './native-chat/tools/native-chat-tool-identity' import type { AgentSessionContextUsage } from './agent-session-context-usage' import type { AgentSessionProviderHandle } from './agent-session-provider-handle' import type { NativeChatBlock, NativeChatRole } from './native-chat-types' diff --git a/src/shared/ansi-escape-sequences-consumers.test.ts b/src/shared/ansi-escape-sequences-consumers.test.ts index 54fe2b05315..868232c7cf7 100644 --- a/src/shared/ansi-escape-sequences-consumers.test.ts +++ b/src/shared/ansi-escape-sequences-consumers.test.ts @@ -1,7 +1,7 @@ import { beforeAll, describe, expect, it } from 'vitest' import { loadAnsiConsumers } from '../../config/scripts/check-job-log-consumer-oracles.mjs' import { gitLabJobTraceToLogExcerpt } from './gitlab-job-log-excerpt' -import { surfaceNativeChatCommandOutputs } from './native-chat-command-output' +import { surfaceNativeChatCommandOutputs } from './native-chat/tools/native-chat-command-output' import type { NativeChatMessage } from './native-chat-types' import { normalizeNativeChatUserText } from './native-chat-image-transcript-markers' diff --git a/src/shared/native-chat-message-preparation.ts b/src/shared/native-chat-message-preparation.ts index 722130ca78e..12ff50e1eb9 100644 --- a/src/shared/native-chat-message-preparation.ts +++ b/src/shared/native-chat-message-preparation.ts @@ -3,7 +3,7 @@ import type { AgentType } from './agent-status-types' import { getVerifiedNativeChatCommands } from './native-chat-agent-profiles' import { surfaceSkillInvocationUserTurns } from './native-chat/native-chat-command-envelope' -import { surfaceNativeChatCommandOutputs } from './native-chat-command-output' +import { surfaceNativeChatCommandOutputs } from './native-chat/tools/native-chat-command-output' import { normalizeImageTranscriptMessages } from './native-chat-image-transcript-markers' import type { NativeChatMessage } from './native-chat-types' diff --git a/src/shared/native-chat-transcript-contracts.test.ts b/src/shared/native-chat-transcript-contracts.test.ts index 08ef1b1d528..0a09b67d1a3 100644 --- a/src/shared/native-chat-transcript-contracts.test.ts +++ b/src/shared/native-chat-transcript-contracts.test.ts @@ -1,6 +1,6 @@ import './native-chat-reasoning-row.spec' import './native-chat-reasoning-order.spec' -import './native-chat-tool-activity.spec' +import './native-chat/tools/native-chat-tool-activity.spec' import './native-chat/tools/native-chat-tool-pair-limit.spec' import './native-chat/tools/native-chat-tool-fold-attribution.spec' import './native-chat-turn-grouping.spec' diff --git a/src/shared/native-chat-turn-activity.ts b/src/shared/native-chat-turn-activity.ts index 1ea643881d0..794663c6f43 100644 --- a/src/shared/native-chat-turn-activity.ts +++ b/src/shared/native-chat-turn-activity.ts @@ -3,7 +3,10 @@ import type { AgentJournalRenderItem } from './agent-session-journal-types' import type { AgentSessionTurnActivity } from './agent-session-wire' import { isRootAgentJournalItem } from './agent-session-journal-producer' import { normalizePromptField } from './agent-status-field-normalization' -import { describeActiveToolCall, formatActiveToolLabel } from './native-chat-tool-activity' +import { + describeActiveToolCall, + formatActiveToolLabel +} from './native-chat/tools/native-chat-tool-activity' export type NativeChatTurnActivity = { kind: 'description'; text: string } diff --git a/src/shared/native-chat-types.ts b/src/shared/native-chat-types.ts index d172cc4abdb..f6b29555def 100644 --- a/src/shared/native-chat-types.ts +++ b/src/shared/native-chat-types.ts @@ -18,7 +18,7 @@ import type { AgentJournalToolCallState } from './agent-session-journal-types' import type { AgentType } from './agent-status-types' -import type { NativeChatToolMetadata } from './native-chat-tool-identity' +import type { NativeChatToolMetadata } from './native-chat/tools/native-chat-tool-identity' import type { AgentMessageSource } from './agent-session/agent-session-message-source' export type { AgentType } diff --git a/src/shared/native-chat/native-chat-command-language.ts b/src/shared/native-chat/native-chat-command-language.ts index eb97f3a6f4c..dce301b45db 100644 --- a/src/shared/native-chat/native-chat-command-language.ts +++ b/src/shared/native-chat/native-chat-command-language.ts @@ -1,4 +1,4 @@ -import { nativeChatToolInputText } from '../native-chat-tool-input-text' +import { nativeChatToolInputText } from './tools/native-chat-tool-input-text' // A tool named after its shell ran there, whatever the host's own shell is. const LANGUAGE_BY_TOOL_NAME: ReadonlyMap = new Map([ diff --git a/src/shared/native-chat-command-output.test.ts b/src/shared/native-chat/tools/native-chat-command-output.test.ts similarity index 98% rename from src/shared/native-chat-command-output.test.ts rename to src/shared/native-chat/tools/native-chat-command-output.test.ts index df2396770f1..b65bd223e17 100644 --- a/src/shared/native-chat-command-output.test.ts +++ b/src/shared/native-chat/tools/native-chat-command-output.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import { surfaceNativeChatCommandOutputs } from './native-chat-command-output' -import { stripNoiseMessages } from './native-chat-noise' -import type { NativeChatMessage } from './native-chat-types' +import { stripNoiseMessages } from '../../native-chat-noise' +import type { NativeChatMessage } from '../../native-chat-types' // The two user rows OpenClaude 0.31.0 writes for `/context` (its caveat row is // `isMeta` and never decoded), as the transcript decoder emits them. diff --git a/src/shared/native-chat-command-output.ts b/src/shared/native-chat/tools/native-chat-command-output.ts similarity index 86% rename from src/shared/native-chat-command-output.ts rename to src/shared/native-chat/tools/native-chat-command-output.ts index c8605a2e9a2..2ad35759662 100644 --- a/src/shared/native-chat-command-output.ts +++ b/src/shared/native-chat/tools/native-chat-command-output.ts @@ -1,11 +1,11 @@ // Claude-family local-command-stdout user turns link to command envelopes. Hide effect-only feedback (/model, /compact); // surface reporting-command replies as their answer. -import type { AgentType } from './agent-status-types' -import { stripAnsiEscapeSequences } from './ansi-escape-sequences' -import { getVerifiedNativeChatCommands } from './native-chat-agent-profiles' -import { parseNativeChatCommandEnvelope } from './native-chat/native-chat-command-envelope' -import { isTextBlock, type NativeChatMessage } from './native-chat-types' +import type { AgentType } from '../../agent-status-types' +import { stripAnsiEscapeSequences } from '../../ansi-escape-sequences' +import { getVerifiedNativeChatCommands } from '../../native-chat-agent-profiles' +import { parseNativeChatCommandEnvelope } from '../native-chat-command-envelope' +import { isTextBlock, type NativeChatMessage } from '../../native-chat-types' const LOCAL_COMMAND_STDOUT = /^\s*([\s\S]*?)<\/local-command-stdout>\s*$/ diff --git a/src/shared/native-chat-tool-activity.spec.ts b/src/shared/native-chat/tools/native-chat-tool-activity.spec.ts similarity index 98% rename from src/shared/native-chat-tool-activity.spec.ts rename to src/shared/native-chat/tools/native-chat-tool-activity.spec.ts index 915e2b69729..7d52723449a 100644 --- a/src/shared/native-chat-tool-activity.spec.ts +++ b/src/shared/native-chat/tools/native-chat-tool-activity.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { NativeChatBlock } from './native-chat-types' +import type { NativeChatBlock } from '../../native-chat-types' import { describeActiveToolCall, formatActiveToolLabel, diff --git a/src/shared/native-chat-tool-activity.ts b/src/shared/native-chat/tools/native-chat-tool-activity.ts similarity index 97% rename from src/shared/native-chat-tool-activity.ts rename to src/shared/native-chat/tools/native-chat-tool-activity.ts index 6829a025798..e91bfe5a0d9 100644 --- a/src/shared/native-chat-tool-activity.ts +++ b/src/shared/native-chat/tools/native-chat-tool-activity.ts @@ -1,7 +1,7 @@ // Shared tool activity/copy for direct English mobile rows and desktop i18n fallbacks. import { createToolInputDisplay } from './native-chat-tool-summary' -import { isToolCallBlock, type NativeChatBlock } from './native-chat-types' +import { isToolCallBlock, type NativeChatBlock } from '../../native-chat-types' type NativeChatToolCallBlock = Extract diff --git a/src/shared/native-chat-tool-icon.test.ts b/src/shared/native-chat/tools/native-chat-tool-icon.test.ts similarity index 100% rename from src/shared/native-chat-tool-icon.test.ts rename to src/shared/native-chat/tools/native-chat-tool-icon.test.ts diff --git a/src/shared/native-chat-tool-icon.ts b/src/shared/native-chat/tools/native-chat-tool-icon.ts similarity index 98% rename from src/shared/native-chat-tool-icon.ts rename to src/shared/native-chat/tools/native-chat-tool-icon.ts index e1ef605dac0..14122ae2182 100644 --- a/src/shared/native-chat-tool-icon.ts +++ b/src/shared/native-chat/tools/native-chat-tool-icon.ts @@ -1,7 +1,7 @@ import { mcpToolIdentity, type NativeChatMcpIdentity } from './native-chat-tool-identity' /** Share category glyphs across lifecycle states; change tone/failure marks only, preserving identity. * Glyphs are decorative: render the identifying tool word alongside them, never alone. */ -import { EDIT_TOOL_NAMES } from './native-chat/tools/native-chat-diff' +import { EDIT_TOOL_NAMES } from './native-chat-diff' import { isCommandToolName } from './native-chat-tool-activity' import { toolInputCommand } from './native-chat-tool-summary' diff --git a/src/shared/native-chat-tool-identity.test.ts b/src/shared/native-chat/tools/native-chat-tool-identity.test.ts similarity index 100% rename from src/shared/native-chat-tool-identity.test.ts rename to src/shared/native-chat/tools/native-chat-tool-identity.test.ts diff --git a/src/shared/native-chat-tool-identity.ts b/src/shared/native-chat/tools/native-chat-tool-identity.ts similarity index 97% rename from src/shared/native-chat-tool-identity.ts rename to src/shared/native-chat/tools/native-chat-tool-identity.ts index 9c3c684acdd..96642da49ca 100644 --- a/src/shared/native-chat-tool-identity.ts +++ b/src/shared/native-chat/tools/native-chat-tool-identity.ts @@ -1,4 +1,4 @@ -import { formatNativeChatDuration } from './native-chat-turn-status' +import { formatNativeChatDuration } from '../../native-chat-turn-status' export type NativeChatWebSearchResult = { title: string; url: string } diff --git a/src/shared/native-chat-tool-input-text.ts b/src/shared/native-chat/tools/native-chat-tool-input-text.ts similarity index 100% rename from src/shared/native-chat-tool-input-text.ts rename to src/shared/native-chat/tools/native-chat-tool-input-text.ts diff --git a/src/shared/native-chat-tool-line-identity.test.ts b/src/shared/native-chat/tools/native-chat-tool-line-identity.test.ts similarity index 98% rename from src/shared/native-chat-tool-line-identity.test.ts rename to src/shared/native-chat/tools/native-chat-tool-line-identity.test.ts index 614c26d4cf9..384d0e9492f 100644 --- a/src/shared/native-chat-tool-line-identity.test.ts +++ b/src/shared/native-chat/tools/native-chat-tool-line-identity.test.ts @@ -1,5 +1,5 @@ import { expect, it } from 'vitest' -import type { NativeChatToolCallBlock, NativeChatToolResultBlock } from './native-chat-types' +import type { NativeChatToolCallBlock, NativeChatToolResultBlock } from '../../native-chat-types' import { nativeChatToolLineIdentity } from './native-chat-tool-line-identity' it('keys an anonymous mobile row by a bounded summary, so a refetched copy keeps it', () => { diff --git a/src/shared/native-chat-tool-line-identity.ts b/src/shared/native-chat/tools/native-chat-tool-line-identity.ts similarity index 96% rename from src/shared/native-chat-tool-line-identity.ts rename to src/shared/native-chat/tools/native-chat-tool-line-identity.ts index e0552ea8665..e458187dbec 100644 --- a/src/shared/native-chat-tool-line-identity.ts +++ b/src/shared/native-chat/tools/native-chat-tool-line-identity.ts @@ -1,4 +1,4 @@ -import type { NativeChatBlock } from './native-chat-types' +import type { NativeChatBlock } from '../../native-chat-types' import { summarizeToolInput } from './native-chat-tool-summary' /** How much of an anonymous result's output identifies it, so a long log is never hashed whole. */ diff --git a/src/shared/native-chat-tool-line-label.test.ts b/src/shared/native-chat/tools/native-chat-tool-line-label.test.ts similarity index 100% rename from src/shared/native-chat-tool-line-label.test.ts rename to src/shared/native-chat/tools/native-chat-tool-line-label.test.ts diff --git a/src/shared/native-chat-tool-line-label.ts b/src/shared/native-chat/tools/native-chat-tool-line-label.ts similarity index 96% rename from src/shared/native-chat-tool-line-label.ts rename to src/shared/native-chat/tools/native-chat-tool-line-label.ts index 442b986ac12..6ba358e4d6e 100644 --- a/src/shared/native-chat-tool-line-label.ts +++ b/src/shared/native-chat/tools/native-chat-tool-line-label.ts @@ -1,5 +1,5 @@ -import { nativeChatCommandLanguage } from './native-chat/native-chat-command-language' -import { isNativeChatFileCountPath } from './native-chat/tools/native-chat-edit-patch-files' +import { nativeChatCommandLanguage } from '../native-chat-command-language' +import { isNativeChatFileCountPath } from './native-chat-edit-patch-files' import { nativeChatToolCategory } from './native-chat-tool-icon' import { nativeChatFullCommand, @@ -7,7 +7,7 @@ import { nativeChatToolInputText } from './native-chat-tool-input-text' import { createToolInputDisplay, summarizeToolInput } from './native-chat-tool-summary' -import type { NativeChatToolCallBlock, NativeChatToolResultBlock } from './native-chat-types' +import type { NativeChatToolCallBlock, NativeChatToolResultBlock } from '../../native-chat-types' /** Shared desktop/mobile tool verbs; desktop translates the English record. */ export const NATIVE_CHAT_TOOL_ROW_VERB_COPY = { diff --git a/src/shared/native-chat-tool-preview-prefix.test.ts b/src/shared/native-chat/tools/native-chat-tool-preview-prefix.test.ts similarity index 100% rename from src/shared/native-chat-tool-preview-prefix.test.ts rename to src/shared/native-chat/tools/native-chat-tool-preview-prefix.test.ts diff --git a/src/shared/native-chat-tool-preview-prefix.ts b/src/shared/native-chat/tools/native-chat-tool-preview-prefix.ts similarity index 100% rename from src/shared/native-chat-tool-preview-prefix.ts rename to src/shared/native-chat/tools/native-chat-tool-preview-prefix.ts diff --git a/src/shared/native-chat-tool-preview-scan.test.ts b/src/shared/native-chat/tools/native-chat-tool-preview-scan.test.ts similarity index 100% rename from src/shared/native-chat-tool-preview-scan.test.ts rename to src/shared/native-chat/tools/native-chat-tool-preview-scan.test.ts diff --git a/src/shared/native-chat/tools/native-chat-tool-result-orphans.spec.ts b/src/shared/native-chat/tools/native-chat-tool-result-orphans.spec.ts index 66745f598ac..b71b7227197 100644 --- a/src/shared/native-chat/tools/native-chat-tool-result-orphans.spec.ts +++ b/src/shared/native-chat/tools/native-chat-tool-result-orphans.spec.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import { foldToolMessages } from './native-chat-tool-fold' import { pairToolBlocks } from './native-chat-tool-pairs' -import { nativeChatToolRunOutcome } from '../../native-chat-tool-run-outcome' +import { nativeChatToolRunOutcome } from './native-chat-tool-run-outcome' import { nativeChatWorkRunMember } from '../../native-chat-work-run' import { nativeChatMessagesShareTranscriptRow } from '../../native-chat-types' import type { diff --git a/src/shared/native-chat-tool-run-outcome.test.ts b/src/shared/native-chat/tools/native-chat-tool-run-outcome.test.ts similarity index 98% rename from src/shared/native-chat-tool-run-outcome.test.ts rename to src/shared/native-chat/tools/native-chat-tool-run-outcome.test.ts index cb91bef09d3..9872cc04c6b 100644 --- a/src/shared/native-chat-tool-run-outcome.test.ts +++ b/src/shared/native-chat/tools/native-chat-tool-run-outcome.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' import { nativeChatToolRunOutcome } from './native-chat-tool-run-outcome' -import type { NativeChatBlock } from './native-chat-types' +import type { NativeChatBlock } from '../../native-chat-types' function call(command: string, state?: 'running' | 'completed' | 'failed'): NativeChatBlock { return { type: 'tool-call', name: 'shell', input: { command }, state } diff --git a/src/shared/native-chat-tool-run-outcome.ts b/src/shared/native-chat/tools/native-chat-tool-run-outcome.ts similarity index 92% rename from src/shared/native-chat-tool-run-outcome.ts rename to src/shared/native-chat/tools/native-chat-tool-run-outcome.ts index 99f604fab4e..8209be0afd9 100644 --- a/src/shared/native-chat-tool-run-outcome.ts +++ b/src/shared/native-chat/tools/native-chat-tool-run-outcome.ts @@ -1,8 +1,8 @@ // Derive success independently of live activity: no active call does not prove success, and collapsed headers must expose failures. -import { agentJournalToolCallLifecycle } from './agent-journal-tool-call-lifecycle' +import { agentJournalToolCallLifecycle } from '../../agent-journal-tool-call-lifecycle' import { selectActiveToolCall } from './native-chat-tool-activity' -import type { NativeChatBlock } from './native-chat-types' +import type { NativeChatBlock } from '../../native-chat-types' export type NativeChatToolRunOutcome = { failedCallCount: number diff --git a/src/shared/native-chat-tool-run-sentence.test.ts b/src/shared/native-chat/tools/native-chat-tool-run-sentence.test.ts similarity index 100% rename from src/shared/native-chat-tool-run-sentence.test.ts rename to src/shared/native-chat/tools/native-chat-tool-run-sentence.test.ts diff --git a/src/shared/native-chat-tool-run-sentence.ts b/src/shared/native-chat/tools/native-chat-tool-run-sentence.ts similarity index 98% rename from src/shared/native-chat-tool-run-sentence.ts rename to src/shared/native-chat/tools/native-chat-tool-run-sentence.ts index 756d0bb8fa5..cb6fc48a2e9 100644 --- a/src/shared/native-chat-tool-run-sentence.ts +++ b/src/shared/native-chat/tools/native-chat-tool-run-sentence.ts @@ -3,7 +3,7 @@ import { nativeChatToolCategory, type NativeChatToolCategory } from './native-chat-tool-icon' import type { NativeChatMcpIdentity } from './native-chat-tool-identity' import { toolInputCommand } from './native-chat-tool-summary' -import { isToolCallBlock, type NativeChatBlock } from './native-chat-types' +import { isToolCallBlock, type NativeChatBlock } from '../../native-chat-types' /** Shared singular/plural category copy; desktop translates and mobile formats directly. */ export const NATIVE_CHAT_TOOL_RUN_SENTENCE_COPY: Record< diff --git a/src/shared/native-chat-tool-summary.test.ts b/src/shared/native-chat/tools/native-chat-tool-summary.test.ts similarity index 99% rename from src/shared/native-chat-tool-summary.test.ts rename to src/shared/native-chat/tools/native-chat-tool-summary.test.ts index 7685b522058..d551fd8a8fb 100644 --- a/src/shared/native-chat-tool-summary.test.ts +++ b/src/shared/native-chat/tools/native-chat-tool-summary.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import type { NativeChatBlock } from './native-chat-types' +import type { NativeChatBlock } from '../../native-chat-types' import { briefToolArg, createToolInputDisplay, diff --git a/src/shared/native-chat-tool-summary.ts b/src/shared/native-chat/tools/native-chat-tool-summary.ts similarity index 99% rename from src/shared/native-chat-tool-summary.ts rename to src/shared/native-chat/tools/native-chat-tool-summary.ts index 1240a66d528..9b18cfdc8a6 100644 --- a/src/shared/native-chat-tool-summary.ts +++ b/src/shared/native-chat/tools/native-chat-tool-summary.ts @@ -4,7 +4,7 @@ import { MAX_TOOL_PREVIEW_LENGTH } from './native-chat-tool-preview-prefix' import type { NativeChatMcpIdentity } from './native-chat-tool-identity' -import { isToolCallBlock, type NativeChatBlock } from './native-chat-types' +import { isToolCallBlock, type NativeChatBlock } from '../../native-chat-types' const MAX_PREVIEW_STRING_INPUT = 160 const MAX_PREVIEW_COLLECTION_ITEMS = 8 diff --git a/src/shared/structured-agent-session-projection.ts b/src/shared/structured-agent-session-projection.ts index e1e5cc10b47..2350626d1b7 100644 --- a/src/shared/structured-agent-session-projection.ts +++ b/src/shared/structured-agent-session-projection.ts @@ -20,7 +20,7 @@ import { AGENT_STATUS_TOOL_INPUT_MAX_LENGTH, AGENT_STATUS_TOOL_NAME_MAX_LENGTH } from './agent-status-types' -import { describeToolInput } from './native-chat-tool-summary' +import { describeToolInput } from './native-chat/tools/native-chat-tool-summary' import { statusStructuredAgentSessionToolCall } from './structured-agent-session-live-turn' import { hasStructuredAgentSessionRequest, diff --git a/src/shared/structured-agent-session-status-tool-line.test.ts b/src/shared/structured-agent-session-status-tool-line.test.ts index c970637088f..b5dc99a0479 100644 --- a/src/shared/structured-agent-session-status-tool-line.test.ts +++ b/src/shared/structured-agent-session-status-tool-line.test.ts @@ -4,7 +4,7 @@ import type { AgentJournalSubmission, AgentJournalToolCallState } from './agent-session-journal-types' -import { describeToolInput } from './native-chat-tool-summary' +import { describeToolInput } from './native-chat/tools/native-chat-tool-summary' import { projectStructuredAgentSessionStatusSummary, projectStructuredItemsToNativeChat