From 3e950ca049f65091aefd8e8961ad132517649641 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sun, 25 Oct 2026 02:45:52 -0700 Subject: [PATCH] refactor(native-chat): group tool attribution modules (#33482) --- .github/workflows/performance-contracts.yml | 4 +- config/scripts/ci-shard-timings.json | 6 +-- config/scripts/native-chat-fold-benchmark.mjs | 49 +++++++++++++++++-- .../native-chat-tool-pairing-benchmark.mjs | 30 ++++++++++-- config/vitest.performance.config.ts | 4 +- ...tMessage.tool-result-availability.test.tsx | 2 +- .../src/session/MobileNativeChatMessage.tsx | 2 +- .../src/session/MobileNativeChatToolRun.tsx | 2 +- .../session/mobile-native-chat-blocks.test.ts | 3 +- .../mobile-native-chat-reading-place.test.tsx | 2 +- .../session/mobile-native-chat-render-data.ts | 2 +- .../mobile-native-chat-run-descriptors.ts | 2 +- ...bile-native-chat-scroll-ownership.test.tsx | 2 +- ...e-chat-session-tool-result-paging.test.tsx | 2 +- ...ab-call-rows-on-positional-clients.test.ts | 4 +- ...journal-legacy-import-tool-pairing.test.ts | 3 +- .../transcript-tool-result-identity.test.ts | 3 +- ...transcript-window-tool-attribution.test.ts | 3 +- .../structured-worker-journal-archive.test.ts | 3 +- .../NativeChatToolRunMemberList.tsx | 2 +- ...ative-chat-message-list-projection.test.ts | 4 +- .../native-chat-task-list-state.test.ts | 2 +- .../native-chat-task-list-state.ts | 2 +- .../native-chat/native-chat-tool-fold.test.ts | 5 +- .../native-chat/native-chat-tool-fold.ts | 6 --- .../native-chat-turn-diffs.test.ts | 2 +- .../native-chat-work-run-pairing.test.ts | 3 +- src/shared/native-chat-ask-row.ts | 2 +- src/shared/native-chat-edit-cards.ts | 2 +- src/shared/native-chat-row-content.ts | 2 +- src/shared/native-chat-task-list-history.ts | 2 +- .../native-chat-transcript-contracts.test.ts | 8 +-- .../native-chat-transcript-projection.ts | 2 +- src/shared/native-chat-work-run.ts | 2 +- .../tools}/native-chat-folded-tool-results.ts | 2 +- ...e-chat-tool-attribution-allocation.test.ts | 2 +- .../native-chat-tool-fold-attribution.spec.ts | 5 +- .../tools}/native-chat-tool-fold.ts | 10 ++-- .../native-chat-tool-pair-limit.spec.ts | 4 +- ...tive-chat-tool-pairing.performance.test.ts | 4 +- .../tools}/native-chat-tool-pairing.spec.ts | 2 +- .../tools}/native-chat-tool-pairing.ts | 4 +- .../tools}/native-chat-tool-pairs.ts | 2 +- .../native-chat-tool-result-orphans.spec.ts | 11 +++-- ...t-turn-membership-derived-tool-row.test.ts | 14 +++--- 45 files changed, 149 insertions(+), 85 deletions(-) delete mode 100644 src/renderer/src/components/native-chat/native-chat-tool-fold.ts rename src/shared/{ => native-chat/tools}/native-chat-folded-tool-results.ts (98%) rename src/shared/{ => native-chat/tools}/native-chat-tool-attribution-allocation.test.ts (99%) rename src/shared/{ => native-chat/tools}/native-chat-tool-fold-attribution.spec.ts (93%) rename src/shared/{ => native-chat/tools}/native-chat-tool-fold.ts (94%) rename src/shared/{ => native-chat/tools}/native-chat-tool-pair-limit.spec.ts (98%) rename src/shared/{ => native-chat/tools}/native-chat-tool-pairing.performance.test.ts (99%) rename src/shared/{ => native-chat/tools}/native-chat-tool-pairing.spec.ts (98%) rename src/shared/{ => native-chat/tools}/native-chat-tool-pairing.ts (95%) rename src/shared/{ => native-chat/tools}/native-chat-tool-pairs.ts (99%) rename src/shared/{ => native-chat/tools}/native-chat-tool-result-orphans.spec.ts (94%) rename src/shared/{ => native-chat/tools}/native-chat-turn-membership-derived-tool-row.test.ts (94%) diff --git a/.github/workflows/performance-contracts.yml b/.github/workflows/performance-contracts.yml index 16b84f2910e..72946ababa2 100644 --- a/.github/workflows/performance-contracts.yml +++ b/.github/workflows/performance-contracts.yml @@ -18,8 +18,8 @@ on: # without these a rename lands green and only breaks the next nightly. - 'src/main/sqlite/sync-database.test.ts' - 'src/main/runtime/orchestration/db/row-column-lists.test.ts' - - 'src/shared/native-chat-tool-attribution-allocation.test.ts' - - 'src/shared/native-chat-tool-pairing.performance.test.ts' + - 'src/shared/native-chat/tools/native-chat-tool-attribution-allocation.test.ts' + - 'src/shared/native-chat/tools/native-chat-tool-pairing.performance.test.ts' - 'src/main/codex-usage/codex-rollout-file-lifetime.test.ts' - 'src/main/codex-usage/scanner-incremental-append.test.ts' - 'src/main/usage/jsonl-file-reader.test.ts' diff --git a/config/scripts/ci-shard-timings.json b/config/scripts/ci-shard-timings.json index f5815cc86ab..719c5b82bd1 100644 --- a/config/scripts/ci-shard-timings.json +++ b/config/scripts/ci-shard-timings.json @@ -11585,13 +11585,13 @@ "src/shared/native-chat-subagent-summary.test.ts": 54, "src/shared/native-chat-task-list.test.ts": 45, "src/shared/native-chat-tool-activity.test.ts": 49, - "src/shared/native-chat-tool-attribution-allocation.test.ts": 112, + "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-tool-pair-limit.test.ts": 75, - "src/shared/native-chat-tool-pairing.performance.test.ts": 463, + "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, @@ -11604,7 +11604,7 @@ "src/shared/native-chat-turn-activity.test.ts": 216, "src/shared/native-chat-turn-fold.test.ts": 42, "src/shared/native-chat-turn-grouping.test.ts": 212, - "src/shared/native-chat-turn-membership-derived-tool-row.test.ts": 328, + "src/shared/native-chat/tools/native-chat-turn-membership-derived-tool-row.test.ts": 328, "src/shared/native-chat-turn-membership.test.ts": 253, "src/shared/native-chat-turn-status.test.ts": 69, "src/shared/native-chat-unverifiable-turn-status.test.ts": 245, diff --git a/config/scripts/native-chat-fold-benchmark.mjs b/config/scripts/native-chat-fold-benchmark.mjs index 6dcc743f305..c1a05cbedfb 100644 --- a/config/scripts/native-chat-fold-benchmark.mjs +++ b/config/scripts/native-chat-fold-benchmark.mjs @@ -22,11 +22,11 @@ const refs = { published: 'b1e44269d655608447dc535f0a4d7d05c37c80b7', current: null } -const entry = ` - export { foldToolMessages as fold } from './src/shared/native-chat-tool-fold' +const entry = (ref) => ` + export { foldToolMessages as fold } from '${ref ? './src/shared/native-chat-tool-fold' : './src/shared/native-chat/tools/native-chat-tool-fold'}' import { createNativeChatMessageListProjection } from './src/renderer/src/components/native-chat/native-chat-message-list-projection' import { deriveNativeChatRowContent } from './src/shared/native-chat-row-content' - import { pairNativeChatToolResults } from './src/shared/native-chat-tool-pairing' + import { pairNativeChatToolResults } from '${ref ? './src/shared/native-chat-tool-pairing' : './src/shared/native-chat/tools/native-chat-tool-pairing'}' export function createPipeline() { const project = createNativeChatMessageListProjection() return (messages) => { @@ -74,10 +74,25 @@ if (process.argv.includes('--memory-control')) { } async function load(ref) { + let snapshotFiles + if (ref) { + const listed = runProcessSync({ + program: 'git', + args: ['ls-tree', '-r', '--name-only', ref, '--', 'src'], + cwd: root, + env: { ...process.env, ORCA_BACKGROUND_LAUNCH: '1' }, + timeoutMs: 30_000, + maxOutputBytes: 2 * 1024 * 1024 + }) + if (listed.code !== 0 || listed.timedOut || listed.outputTruncated) { + throw new Error(describeProcessFailure(listed)) + } + snapshotFiles = new Set(listed.stdout.trim().split('\n')) + } const modules = new Map() const built = await build({ stdin: { - contents: entry, + contents: entry(ref), resolveDir: root, sourcefile: 'fold-benchmark-entry.ts', loader: 'ts' @@ -90,6 +105,32 @@ async function load(ref) { { name: 'exact-chat-source-snapshot', setup(builder) { + builder.onResolve({ filter: /^\./ }, (args) => { + if (!ref) { + return undefined + } + const target = path + .relative(root, path.resolve(args.resolveDir, args.path)) + .split(path.sep) + .join('/') + if (!target.startsWith('src/')) { + return undefined + } + const candidates = [ + target, + ...['.tsx', '.ts', '.jsx', '.js', '.css', '.json'].map( + (extension) => target + extension + ), + ...['.tsx', '.ts', '.jsx', '.js', '.css', '.json'].map( + (extension) => `${target}/index${extension}` + ) + ] + const file = candidates.find((candidate) => snapshotFiles.has(candidate)) + if (!file) { + throw new Error(`Missing snapshot source: ${ref}:${target}`) + } + return { path: path.join(root, file) } + }) builder.onLoad({ filter: /\.[cm]?[jt]sx?$/ }, ({ path: file }) => { const relative = path.relative(root, file).split(path.sep).join('/') if (!relative.startsWith('src/')) { diff --git a/config/scripts/native-chat-tool-pairing-benchmark.mjs b/config/scripts/native-chat-tool-pairing-benchmark.mjs index 5dae5c3f3b3..cc6479bfe61 100644 --- a/config/scripts/native-chat-tool-pairing-benchmark.mjs +++ b/config/scripts/native-chat-tool-pairing-benchmark.mjs @@ -9,18 +9,35 @@ import { summarizeBenchmarkSamples } from './benchmark-sample-summary.mjs' // git show :src/shared/native-chat-tool-fold.ts | node config/scripts/native-chat-tool-pairing-benchmark.mjs const root = path.resolve(import.meta.dirname, '../..') -async function load(source) { +async function load(source, sourcefile = 'src/shared/native-chat-tool-fold.ts') { const built = await build({ stdin: { contents: source, - sourcefile: 'native-chat-tool-fold.ts', - resolveDir: path.join(root, 'src/shared'), + sourcefile: path.basename(sourcefile), + resolveDir: path.dirname(path.join(root, sourcefile)), loader: 'ts' }, bundle: true, write: false, platform: 'node', - format: 'esm' + format: 'esm', + plugins: [ + { + name: 'relocated-current-pairing-dependencies', + setup(builder) { + builder.onResolve({ filter: /^\./ }, (args) => { + const target = path.resolve(args.resolveDir, args.path) + for (const name of ['native-chat-tool-pairs', 'native-chat-folded-tool-results']) { + const previous = path.join(root, 'src/shared', name) + if (target === previous || target === `${previous}.ts`) { + return { path: path.join(root, 'src/shared/native-chat/tools', `${name}.ts`) } + } + } + return undefined + }) + } + } + ] }) const code = built.outputFiles[0].text return { @@ -32,7 +49,10 @@ async function load(source) { const loaded = { before: await load(readFileSync(0, 'utf8')), - after: await load(readFileSync(path.join(root, 'src/shared/native-chat-tool-fold.ts'), 'utf8')) + after: await load( + readFileSync(path.join(root, 'src/shared/native-chat/tools/native-chat-tool-pairs.ts'), 'utf8'), + 'src/shared/native-chat/tools/native-chat-tool-pairs.ts' + ) } const call = (callId) => ({ type: 'tool-call', name: 'Bash', input: {}, callId }) const result = (callId) => ({ type: 'tool-result', output: 'done', callId }) diff --git a/config/vitest.performance.config.ts b/config/vitest.performance.config.ts index 0922d28a917..df26313b144 100644 --- a/config/vitest.performance.config.ts +++ b/config/vitest.performance.config.ts @@ -11,8 +11,8 @@ const contracts = [ 'src/renderer/src/components/tab-bar/use-new-tab-agent-menu-host-preferences.test.tsx', 'src/main/sqlite/sync-database.test.ts', 'src/main/runtime/orchestration/db/row-column-lists.test.ts', - 'src/shared/native-chat-tool-attribution-allocation.test.ts', - 'src/shared/native-chat-tool-pairing.performance.test.ts', + 'src/shared/native-chat/tools/native-chat-tool-attribution-allocation.test.ts', + 'src/shared/native-chat/tools/native-chat-tool-pairing.performance.test.ts', 'src/main/codex-usage/codex-rollout-file-lifetime.test.ts', 'src/main/codex-usage/scanner-incremental-append.test.ts', 'src/main/usage/jsonl-file-reader.test.ts', diff --git a/mobile/src/session/MobileNativeChatMessage.tool-result-availability.test.tsx b/mobile/src/session/MobileNativeChatMessage.tool-result-availability.test.tsx index c3d7a3b92be..02e4fd96201 100644 --- a/mobile/src/session/MobileNativeChatMessage.tool-result-availability.test.tsx +++ b/mobile/src/session/MobileNativeChatMessage.tool-result-availability.test.tsx @@ -6,7 +6,7 @@ import type { AgentJournalItemBody, AgentJournalRenderItem } from '../../../src/shared/agent-session-journal-types' -import * as toolFold from '../../../src/shared/native-chat-tool-fold' +import * as toolFold from '../../../src/shared/native-chat/tools/native-chat-tool-pairs' import { projectStructuredItemsToNativeChat } from '../../../src/shared/structured-agent-session-projection' import { foldMobileNativeChatMessages } from './mobile-native-chat-render-data' import { useMobileNativeChatTurnDisclosure } from './use-mobile-native-chat-turn-disclosure' diff --git a/mobile/src/session/MobileNativeChatMessage.tsx b/mobile/src/session/MobileNativeChatMessage.tsx index d240eeccb4a..177a47c3189 100644 --- a/mobile/src/session/MobileNativeChatMessage.tsx +++ b/mobile/src/session/MobileNativeChatMessage.tsx @@ -2,7 +2,7 @@ import { memo, useCallback, useContext, useLayoutEffect, useMemo, useRef } from 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-tool-fold' +import { splitNativeChatBlocks } from '../../../src/shared/native-chat/tools/native-chat-tool-fold' import { selectActiveToolCall } from '../../../src/shared/native-chat-tool-activity' import { isImageRefBlock, diff --git a/mobile/src/session/MobileNativeChatToolRun.tsx b/mobile/src/session/MobileNativeChatToolRun.tsx index cd59281c968..646a7bd5c8f 100644 --- a/mobile/src/session/MobileNativeChatToolRun.tsx +++ b/mobile/src/session/MobileNativeChatToolRun.tsx @@ -26,7 +26,7 @@ import { } 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' -import { pairNativeChatToolResults } from '../../../src/shared/native-chat-tool-pairing' +import { pairNativeChatToolResults } from '../../../src/shared/native-chat/tools/native-chat-tool-pairing' import { nativeChatToolRunOutcome } from '../../../src/shared/native-chat-tool-run-outcome' import { NATIVE_CHAT_TOOL_RUN_SENTENCE_ENGLISH, diff --git a/mobile/src/session/mobile-native-chat-blocks.test.ts b/mobile/src/session/mobile-native-chat-blocks.test.ts index 54fca957d17..5d8fe46e41b 100644 --- a/mobile/src/session/mobile-native-chat-blocks.test.ts +++ b/mobile/src/session/mobile-native-chat-blocks.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from 'vitest' -import { foldToolMessages, pairToolBlocks } from '../../../src/shared/native-chat-tool-fold' +import { foldToolMessages } from '../../../src/shared/native-chat/tools/native-chat-tool-fold' +import { pairToolBlocks } from '../../../src/shared/native-chat/tools/native-chat-tool-pairs' import type { NativeChatMessage } from '../../../src/shared/native-chat-types' function msg( diff --git a/mobile/src/session/mobile-native-chat-reading-place.test.tsx b/mobile/src/session/mobile-native-chat-reading-place.test.tsx index 9c31b3ad31f..f50f05c6a66 100644 --- a/mobile/src/session/mobile-native-chat-reading-place.test.tsx +++ b/mobile/src/session/mobile-native-chat-reading-place.test.tsx @@ -6,7 +6,7 @@ import { type ReactTestRendererJSON as Node } from 'react-test-renderer' import { afterEach, expect, it, vi } from 'vitest' -import { splitNativeChatBlocks } from '../../../src/shared/native-chat-tool-fold' +import { splitNativeChatBlocks } from '../../../src/shared/native-chat/tools/native-chat-tool-fold' import type { NativeChatBlock, NativeChatMessage } from '../../../src/shared/native-chat-types' import { foldMobileNativeChatMessages } from './mobile-native-chat-render-data' import { diff --git a/mobile/src/session/mobile-native-chat-render-data.ts b/mobile/src/session/mobile-native-chat-render-data.ts index edca0c8fe81..d68f40cca89 100644 --- a/mobile/src/session/mobile-native-chat-render-data.ts +++ b/mobile/src/session/mobile-native-chat-render-data.ts @@ -10,7 +10,7 @@ import { isWordlessProviderFrameMessage } from '../../../src/shared/native-chat/ import { foldToolMessages, isUndrawnProviderFrameMessage -} from '../../../src/shared/native-chat-tool-fold' +} from '../../../src/shared/native-chat/tools/native-chat-tool-fold' import { projectNativeChatTaskListFrames } from '../../../src/shared/native-chat-task-list-frames' import { foldSubagentItems } from '../../../src/shared/native-chat-subagent-items' import { prepareNativeChatMessages } from '../../../src/shared/native-chat-message-preparation' diff --git a/mobile/src/session/mobile-native-chat-run-descriptors.ts b/mobile/src/session/mobile-native-chat-run-descriptors.ts index 743cbb6087d..b73a997b661 100644 --- a/mobile/src/session/mobile-native-chat-run-descriptors.ts +++ b/mobile/src/session/mobile-native-chat-run-descriptors.ts @@ -1,6 +1,6 @@ import type { NativeChatMessage } from '../../../src/shared/native-chat-types' import type { NativeChatResolvedPrompt } from '../../../src/shared/native-chat-resolution-receipt' -import { splitNativeChatBlocks } from '../../../src/shared/native-chat-tool-fold' +import { splitNativeChatBlocks } from '../../../src/shared/native-chat/tools/native-chat-tool-fold' import { nativeChatWorkRunEntries } from '../../../src/shared/native-chat-work-run' import { nativeChatAskRunBlocks } from '../../../src/shared/native-chat-ask-row' import type { MobileNativeChatWorkRuns } from './use-mobile-native-chat-transcript-rows' diff --git a/mobile/src/session/mobile-native-chat-scroll-ownership.test.tsx b/mobile/src/session/mobile-native-chat-scroll-ownership.test.tsx index fa2a135ab6f..27bc20eecfc 100644 --- a/mobile/src/session/mobile-native-chat-scroll-ownership.test.tsx +++ b/mobile/src/session/mobile-native-chat-scroll-ownership.test.tsx @@ -12,7 +12,7 @@ import { import { createRoot, type Root } from 'react-dom/client' import { afterEach, expect, it, vi } from 'vitest' import type { NativeChatMessage } from '../../../src/shared/native-chat-types' -import { foldToolMessages } from '../../../src/shared/native-chat-tool-fold' +import { foldToolMessages } from '../../../src/shared/native-chat/tools/native-chat-tool-fold' import { MobileNativeChatMessage } from './MobileNativeChatMessage' import { MobileNativeChatScrollRootsBoundary } from './MobileNativeChatScrollRootsBoundary' import { MobileNativeChatScrollMotion } from './mobile-native-chat-scroll-motion' diff --git a/mobile/src/session/use-mobile-native-chat-session-tool-result-paging.test.tsx b/mobile/src/session/use-mobile-native-chat-session-tool-result-paging.test.tsx index 5392718155d..c561592a031 100644 --- a/mobile/src/session/use-mobile-native-chat-session-tool-result-paging.test.tsx +++ b/mobile/src/session/use-mobile-native-chat-session-tool-result-paging.test.tsx @@ -1,7 +1,7 @@ import { createElement } from 'react' import { act, create, type ReactTestRenderer } from 'react-test-renderer' import { afterEach, describe, expect, it, vi } from 'vitest' -import { pairToolBlocks } from '../../../src/shared/native-chat-tool-fold' +import { pairToolBlocks } from '../../../src/shared/native-chat/tools/native-chat-tool-pairs' import { nativeChatTurnMembership } from '../../../src/shared/native-chat-turn-membership' import type { NativeChatMessage } from '../../../src/shared/native-chat-types' import type { RpcClient } from '../transport/rpc-client' diff --git a/src/main/codex/codex-collab-call-rows-on-positional-clients.test.ts b/src/main/codex/codex-collab-call-rows-on-positional-clients.test.ts index d0bfd337b71..20a790cf6b2 100644 --- a/src/main/codex/codex-collab-call-rows-on-positional-clients.test.ts +++ b/src/main/codex/codex-collab-call-rows-on-positional-clients.test.ts @@ -5,8 +5,8 @@ import type { AgentJournalItemBody, AgentJournalRenderItem } from '../../shared/agent-session-journal-types' -import { pairToolBlocks } from '../../shared/native-chat-tool-fold' -import { pairNativeChatToolResults } from '../../shared/native-chat-tool-pairing' +import { pairToolBlocks } from '../../shared/native-chat/tools/native-chat-tool-pairs' +import { pairNativeChatToolResults } from '../../shared/native-chat/tools/native-chat-tool-pairing' import { projectNativeChatTranscript } from '../../shared/native-chat-transcript-projection' import type { NativeChatBlock, NativeChatMessage } from '../../shared/native-chat-types' import { projectStructuredAgentSessionMessages } from '../../shared/structured-agent-session-message-projection' diff --git a/src/main/native-chat/agent-session-journal/journal-legacy-import-tool-pairing.test.ts b/src/main/native-chat/agent-session-journal/journal-legacy-import-tool-pairing.test.ts index 52ed9b810aa..ac5eb4363fb 100644 --- a/src/main/native-chat/agent-session-journal/journal-legacy-import-tool-pairing.test.ts +++ b/src/main/native-chat/agent-session-journal/journal-legacy-import-tool-pairing.test.ts @@ -4,7 +4,8 @@ import { join } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' import { agentJournalItemKey } from '../../../shared/agent-session-journal-item-key' import type { AgentJournalRenderItem } from '../../../shared/agent-session-journal-types' -import { foldToolMessages, pairToolBlocks } from '../../../shared/native-chat-tool-fold' +import { foldToolMessages } from '../../../shared/native-chat/tools/native-chat-tool-fold' +import { pairToolBlocks } from '../../../shared/native-chat/tools/native-chat-tool-pairs' import { projectNativeChatTranscriptMessages } from '../../../shared/native-chat-transcript-projection' import { projectStructuredItemsToNativeChat } from '../../../shared/structured-agent-session-projection' import { prepareLegacyTranscriptImport } from './journal-legacy-import' diff --git a/src/main/native-chat/transcript-tool-result-identity.test.ts b/src/main/native-chat/transcript-tool-result-identity.test.ts index 1eeb3e74520..0a32eaf027e 100644 --- a/src/main/native-chat/transcript-tool-result-identity.test.ts +++ b/src/main/native-chat/transcript-tool-result-identity.test.ts @@ -2,7 +2,8 @@ import { mkdtemp, rm, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import { foldToolMessages, pairToolBlocks } from '../../shared/native-chat-tool-fold' +import { foldToolMessages } from '../../shared/native-chat/tools/native-chat-tool-fold' +import { pairToolBlocks } from '../../shared/native-chat/tools/native-chat-tool-pairs' import type { NativeChatMessage } from '../../shared/native-chat-types' import { decodeClaudeTranscriptLine } from './transcript-line-decoders-claude' import { decodeCodexTranscriptLine } from './transcript-line-decoders-codex' diff --git a/src/main/native-chat/transcript-window-tool-attribution.test.ts b/src/main/native-chat/transcript-window-tool-attribution.test.ts index 306101853cb..d43a1c10186 100644 --- a/src/main/native-chat/transcript-window-tool-attribution.test.ts +++ b/src/main/native-chat/transcript-window-tool-attribution.test.ts @@ -4,7 +4,8 @@ import { join } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' import { stripNoiseMessages } from '../../shared/native-chat-noise' import { mergeNativeChatMessages } from '../../shared/native-chat-merge' -import { foldToolMessages, pairToolBlocks } from '../../shared/native-chat-tool-fold' +import { foldToolMessages } from '../../shared/native-chat/tools/native-chat-tool-fold' +import { pairToolBlocks } from '../../shared/native-chat/tools/native-chat-tool-pairs' import { isToolCallBlock, isToolResultBlock } from '../../shared/native-chat-types' import type { NativeChatMessage } from '../../shared/native-chat-types' import { decodeClaudeTranscriptLine } from './transcript-line-decoders-claude' diff --git a/src/main/runtime/orchestration/structured-worker-journal-archive.test.ts b/src/main/runtime/orchestration/structured-worker-journal-archive.test.ts index 7c263efc1d1..f35544bf681 100644 --- a/src/main/runtime/orchestration/structured-worker-journal-archive.test.ts +++ b/src/main/runtime/orchestration/structured-worker-journal-archive.test.ts @@ -2,7 +2,8 @@ import { describe, expect, it } from 'vitest' import type { AgentJournalRenderItem } from '../../../shared/agent-session-journal-types' import type { NativeChatMessage } from '../../../shared/native-chat-types' import { buildStructuredJournalArchive } from './structured-worker-journal-archive' -import { foldToolMessages, pairToolBlocks } from '../../../shared/native-chat-tool-fold' +import { foldToolMessages } from '../../../shared/native-chat/tools/native-chat-tool-fold' +import { pairToolBlocks } from '../../../shared/native-chat/tools/native-chat-tool-pairs' const STRUCTURED_ARCHIVE_MAX_BYTES = 262_144 diff --git a/src/renderer/src/components/native-chat/NativeChatToolRunMemberList.tsx b/src/renderer/src/components/native-chat/NativeChatToolRunMemberList.tsx index a79472e5f1c..be21bdb71ec 100644 --- a/src/renderer/src/components/native-chat/NativeChatToolRunMemberList.tsx +++ b/src/renderer/src/components/native-chat/NativeChatToolRunMemberList.tsx @@ -1,7 +1,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-tool-pairing' +import { pairNativeChatToolResults } from '../../../../shared/native-chat/tools/native-chat-tool-pairing' import { nativeChatToolLineIdentity } from '../../../../shared/native-chat-tool-line-identity' import { NativeChatDiffCard } from './NativeChatDiffCard' import { NativeChatTaskList } from './NativeChatTaskList' diff --git a/src/renderer/src/components/native-chat/native-chat-message-list-projection.test.ts b/src/renderer/src/components/native-chat/native-chat-message-list-projection.test.ts index 662d1028b74..7f849b4f456 100644 --- a/src/renderer/src/components/native-chat/native-chat-message-list-projection.test.ts +++ b/src/renderer/src/components/native-chat/native-chat-message-list-projection.test.ts @@ -3,8 +3,8 @@ import type { NativeChatMessage } from '../../../../shared/native-chat-types' import { createNativeChatMessageListProjection } from './native-chat-message-list-projection' import { orderNativeChatMessages } from './native-chat-message-grouping' import { stripNoiseMessages } from './native-chat-noise' -import { foldToolMessages } from './native-chat-tool-fold' -import { pairToolBlocks } from '../../../../shared/native-chat-tool-pairs' +import { foldToolMessages } from '../../../../shared/native-chat/tools/native-chat-tool-fold' +import { pairToolBlocks } from '../../../../shared/native-chat/tools/native-chat-tool-pairs' function message( id: string, diff --git a/src/renderer/src/components/native-chat/native-chat-task-list-state.test.ts b/src/renderer/src/components/native-chat/native-chat-task-list-state.test.ts index 5a321d191af..36eedff0a90 100644 --- a/src/renderer/src/components/native-chat/native-chat-task-list-state.test.ts +++ b/src/renderer/src/components/native-chat/native-chat-task-list-state.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' import type { NativeChatBlock, NativeChatMessage } from '../../../../shared/native-chat-types' -import { foldToolMessages } from './native-chat-tool-fold' +import { foldToolMessages } from '../../../../shared/native-chat/tools/native-chat-tool-fold' import { nativeChatTaskListState } from './native-chat-task-list-state' function message(id: string, blocks: NativeChatBlock[]): NativeChatMessage { diff --git a/src/renderer/src/components/native-chat/native-chat-task-list-state.ts b/src/renderer/src/components/native-chat/native-chat-task-list-state.ts index f45d6531600..1dfa9e31f21 100644 --- a/src/renderer/src/components/native-chat/native-chat-task-list-state.ts +++ b/src/renderer/src/components/native-chat/native-chat-task-list-state.ts @@ -3,7 +3,7 @@ import { type NativeChatTaskList } from '../../../../shared/native-chat-task-list' import type { NativeChatMessage } from '../../../../shared/native-chat-types' -import { pairToolBlocks } from './native-chat-tool-fold' +import { pairToolBlocks } from '../../../../shared/native-chat/tools/native-chat-tool-pairs' const snapshots = new WeakMap() diff --git a/src/renderer/src/components/native-chat/native-chat-tool-fold.test.ts b/src/renderer/src/components/native-chat/native-chat-tool-fold.test.ts index a4a8bf63a6a..0ea1602ae20 100644 --- a/src/renderer/src/components/native-chat/native-chat-tool-fold.test.ts +++ b/src/renderer/src/components/native-chat/native-chat-tool-fold.test.ts @@ -1,7 +1,10 @@ import { describe, it, expect } from 'vitest' import type { NativeChatMessage } from '../../../../shared/native-chat-types' import { stripNoiseMessages } from './native-chat-noise' -import { foldToolMessages, splitNativeChatBlocks } from './native-chat-tool-fold' +import { + foldToolMessages, + splitNativeChatBlocks +} from '../../../../shared/native-chat/tools/native-chat-tool-fold' function msg( overrides: Partial & Pick diff --git a/src/renderer/src/components/native-chat/native-chat-tool-fold.ts b/src/renderer/src/components/native-chat/native-chat-tool-fold.ts deleted file mode 100644 index e18bf8f4764..00000000000 --- a/src/renderer/src/components/native-chat/native-chat-tool-fold.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { - foldToolMessages, - pairToolBlocks, - splitNativeChatBlocks, - type NativeChatToolPair -} from '../../../../shared/native-chat-tool-fold' diff --git a/src/renderer/src/components/native-chat/native-chat-turn-diffs.test.ts b/src/renderer/src/components/native-chat/native-chat-turn-diffs.test.ts index b18d78f8917..c6ae2329374 100644 --- a/src/renderer/src/components/native-chat/native-chat-turn-diffs.test.ts +++ b/src/renderer/src/components/native-chat/native-chat-turn-diffs.test.ts @@ -1,7 +1,7 @@ import { MAX_EDIT_LINES } from '../../../../shared/native-chat-edit-model' import { describe, expect, it } from 'vitest' import type { NativeChatBlock, NativeChatMessage } from '../../../../shared/native-chat-types' -import { foldToolMessages } from './native-chat-tool-fold' +import { foldToolMessages } from '../../../../shared/native-chat/tools/native-chat-tool-fold' import { buildDiffSummaries, buildEditCards } from '../../../../shared/native-chat-edit-cards' import { nativeChatTurnDiffEditFile, nativeChatTurnDiffs } from './native-chat-turn-diffs' diff --git a/src/renderer/src/components/native-chat/native-chat-work-run-pairing.test.ts b/src/renderer/src/components/native-chat/native-chat-work-run-pairing.test.ts index c906aadb415..072d5142def 100644 --- a/src/renderer/src/components/native-chat/native-chat-work-run-pairing.test.ts +++ b/src/renderer/src/components/native-chat/native-chat-work-run-pairing.test.ts @@ -1,7 +1,8 @@ import { describe, expect, it } from 'vitest' import type { AgentJournalRenderItem } from '../../../../shared/agent-session-journal-types' import type { NativeChatMessage } from '../../../../shared/native-chat-types' -import { foldToolMessages, pairToolBlocks } from '../../../../shared/native-chat-tool-fold' +import { foldToolMessages } from '../../../../shared/native-chat/tools/native-chat-tool-fold' +import { pairToolBlocks } from '../../../../shared/native-chat/tools/native-chat-tool-pairs' import { nativeChatWorkRunEditKey, nativeChatWorkRunEntries diff --git a/src/shared/native-chat-ask-row.ts b/src/shared/native-chat-ask-row.ts index b5255fdee17..e1fc2544efe 100644 --- a/src/shared/native-chat-ask-row.ts +++ b/src/shared/native-chat-ask-row.ts @@ -6,7 +6,7 @@ import { isAskUserQuestionTool } from './agent-question-answered-intent' import { CODEX_ASYNC_QUESTION_TOOL } from './codex-async-question-input' import { parseAskFromToolInput } from './native-chat-ask' import { isToolCallBlock, type NativeChatBlock } from './native-chat-types' -import { pairToolBlocks } from './native-chat-tool-fold' +import { pairToolBlocks } from './native-chat/tools/native-chat-tool-pairs' export const NATIVE_CHAT_ASK_ROW_COPY = { awaiting: 'Awaiting user input:', diff --git a/src/shared/native-chat-edit-cards.ts b/src/shared/native-chat-edit-cards.ts index 7afd4f59816..9e880e87013 100644 --- a/src/shared/native-chat-edit-cards.ts +++ b/src/shared/native-chat-edit-cards.ts @@ -9,7 +9,7 @@ import { editFilesFromPatchText, type NativeChatEditFileSummary } from './native-chat-edit-patch-files' -import { pairToolBlocks } from './native-chat-tool-fold' +import { pairToolBlocks } from './native-chat/tools/native-chat-tool-pairs' /** A diff card's own words. Desktop maps these onto `translate`; mobile renders them. */ export const NATIVE_CHAT_DIFF_CARD_COPY = { diff --git a/src/shared/native-chat-row-content.ts b/src/shared/native-chat-row-content.ts index 4c59cfdbe46..2a8f7120566 100644 --- a/src/shared/native-chat-row-content.ts +++ b/src/shared/native-chat-row-content.ts @@ -14,7 +14,7 @@ import { isSubagentGroupBlock, type NativeChatBlock } from './native-chat-types' -import { splitNativeChatBlocks } from './native-chat-tool-fold' +import { splitNativeChatBlocks } from './native-chat/tools/native-chat-tool-fold' import { nativeChatProseToMarkdown } from './native-chat-prose' /** Inferred from `derive` so the shape cannot drift from what it returns. */ diff --git a/src/shared/native-chat-task-list-history.ts b/src/shared/native-chat-task-list-history.ts index 0cec64dc85f..881e12194a6 100644 --- a/src/shared/native-chat-task-list-history.ts +++ b/src/shared/native-chat-task-list-history.ts @@ -9,7 +9,7 @@ import type { NativeChatMessage, NativeChatToolCallBlock } from './native-chat-types' -import { pairToolBlocks } from './native-chat-tool-fold' +import { pairToolBlocks } from './native-chat/tools/native-chat-tool-pairs' export type NativeChatTaskListPredecessors = Partial< Record diff --git a/src/shared/native-chat-transcript-contracts.test.ts b/src/shared/native-chat-transcript-contracts.test.ts index 1395566848a..08ef1b1d528 100644 --- a/src/shared/native-chat-transcript-contracts.test.ts +++ b/src/shared/native-chat-transcript-contracts.test.ts @@ -1,14 +1,14 @@ import './native-chat-reasoning-row.spec' import './native-chat-reasoning-order.spec' import './native-chat-tool-activity.spec' -import './native-chat-tool-pair-limit.spec' -import './native-chat-tool-fold-attribution.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' import './native-chat-ask-row.spec' -import './native-chat-tool-pairing.spec' +import './native-chat/tools/native-chat-tool-pairing.spec' import './native-chat-live-line.spec' import './native-chat-merge-pairs.spec' import './native-chat/native-chat-command-envelope.spec' import './native-chat/native-chat-streaming.spec' import './native-chat-subagent-group-header.spec' -import './native-chat-tool-result-orphans.spec' +import './native-chat/tools/native-chat-tool-result-orphans.spec' diff --git a/src/shared/native-chat-transcript-projection.ts b/src/shared/native-chat-transcript-projection.ts index 97278ffc4e8..7c6e219f991 100644 --- a/src/shared/native-chat-transcript-projection.ts +++ b/src/shared/native-chat-transcript-projection.ts @@ -11,7 +11,7 @@ import { nativeChatSemanticRowId, type NativeChatMessage } from './native-chat-t import { compareAgentJournalPositions } from './agent-session-journal-position' import { agentJournalItemSubagentId } from './agent-session-journal-producer' import { stripNoiseMessages } from './native-chat-noise' -import { foldToolMessages } from './native-chat-tool-fold' +import { foldToolMessages } from './native-chat/tools/native-chat-tool-fold' import { foldSubagentItems } from './native-chat-subagent-items' import { nativeChatTurnMembership, type NativeChatTurnJournal } from './native-chat-turn-membership' diff --git a/src/shared/native-chat-work-run.ts b/src/shared/native-chat-work-run.ts index 48988a7e00e..0743370817f 100644 --- a/src/shared/native-chat-work-run.ts +++ b/src/shared/native-chat-work-run.ts @@ -5,7 +5,7 @@ import { isNativeChatAskCall } from './native-chat-ask-row' import { deriveNativeChatRowContent } from './native-chat-row-content' import { isStoppedBeforeStartBlock } from './native-chat-stopped-before-start' -import { pairToolBlocks } from './native-chat-tool-fold' +import { pairToolBlocks } from './native-chat/tools/native-chat-tool-pairs' import type { NativeChatBlock, NativeChatMessage } from './native-chat-types' /** `lead`: the agent's words with calls already folded under them, which may head a run but diff --git a/src/shared/native-chat-folded-tool-results.ts b/src/shared/native-chat/tools/native-chat-folded-tool-results.ts similarity index 98% rename from src/shared/native-chat-folded-tool-results.ts rename to src/shared/native-chat/tools/native-chat-folded-tool-results.ts index f6b5c3b81a7..926a5ab6746 100644 --- a/src/shared/native-chat-folded-tool-results.ts +++ b/src/shared/native-chat/tools/native-chat-folded-tool-results.ts @@ -1,5 +1,5 @@ import { unpairedToolResultIndices } from './native-chat-tool-pairs' -import type { NativeChatBlock, NativeChatMessage } from './native-chat-types' +import type { NativeChatBlock, NativeChatMessage } from '../../native-chat-types' type ToolContribution = { source: NativeChatMessage diff --git a/src/shared/native-chat-tool-attribution-allocation.test.ts b/src/shared/native-chat/tools/native-chat-tool-attribution-allocation.test.ts similarity index 99% rename from src/shared/native-chat-tool-attribution-allocation.test.ts rename to src/shared/native-chat/tools/native-chat-tool-attribution-allocation.test.ts index aadfcac8bc6..e663365f840 100644 --- a/src/shared/native-chat-tool-attribution-allocation.test.ts +++ b/src/shared/native-chat/tools/native-chat-tool-attribution-allocation.test.ts @@ -5,7 +5,7 @@ import type { NativeChatBackgroundTaskBlock, NativeChatBlock, NativeChatMessage -} from './native-chat-types' +} from '../../native-chat-types' function message(id: string, blocks: NativeChatBlock[]): NativeChatMessage { return { diff --git a/src/shared/native-chat-tool-fold-attribution.spec.ts b/src/shared/native-chat/tools/native-chat-tool-fold-attribution.spec.ts similarity index 93% rename from src/shared/native-chat-tool-fold-attribution.spec.ts rename to src/shared/native-chat/tools/native-chat-tool-fold-attribution.spec.ts index 89b9772206e..9d0afe54e5f 100644 --- a/src/shared/native-chat-tool-fold-attribution.spec.ts +++ b/src/shared/native-chat/tools/native-chat-tool-fold-attribution.spec.ts @@ -1,6 +1,7 @@ import { expect, it } from 'vitest' -import { foldToolMessages, pairToolBlocks } from './native-chat-tool-fold' -import type { NativeChatBlock, NativeChatMessage } from './native-chat-types' +import { foldToolMessages } from './native-chat-tool-fold' +import { pairToolBlocks } from './native-chat-tool-pairs' +import type { NativeChatBlock, NativeChatMessage } from '../../native-chat-types' function message(id: string, blocks: NativeChatBlock[]): NativeChatMessage { return { id, role: 'assistant', source: 'transcript', timestamp: 1, blocks } diff --git a/src/shared/native-chat-tool-fold.ts b/src/shared/native-chat/tools/native-chat-tool-fold.ts similarity index 94% rename from src/shared/native-chat-tool-fold.ts rename to src/shared/native-chat/tools/native-chat-tool-fold.ts index b9a6f1bfa1a..d0b5569bdc4 100644 --- a/src/shared/native-chat-tool-fold.ts +++ b/src/shared/native-chat/tools/native-chat-tool-fold.ts @@ -5,17 +5,15 @@ import { isToolResultBlock, type NativeChatBlock, type NativeChatMessage -} from './native-chat-types' -import { isKnownHarnessInjectedUserTurnText } from './harness-injected-user-turns' -import { isNoiseMessage } from './native-chat-noise' +} from '../../native-chat-types' +import { isKnownHarnessInjectedUserTurnText } from '../../harness-injected-user-turns' +import { isNoiseMessage } from '../../native-chat-noise' import { CODEX_PLAN_UPDATED_FRAME_KIND, isWordlessProviderFrameMessage -} from './native-chat/native-chat-provider-frame-summary' +} from '../native-chat-provider-frame-summary' import { FoldedToolResultSources } from './native-chat-folded-tool-results' -export { pairToolBlocks, type NativeChatToolPair } from './native-chat-tool-pairs' - function isToolOnlyMessage(message: NativeChatMessage): boolean { return ( message.blocks.length > 0 && diff --git a/src/shared/native-chat-tool-pair-limit.spec.ts b/src/shared/native-chat/tools/native-chat-tool-pair-limit.spec.ts similarity index 98% rename from src/shared/native-chat-tool-pair-limit.spec.ts rename to src/shared/native-chat/tools/native-chat-tool-pair-limit.spec.ts index d54bfc9b89b..749cab49d90 100644 --- a/src/shared/native-chat-tool-pair-limit.spec.ts +++ b/src/shared/native-chat/tools/native-chat-tool-pair-limit.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import { pairToolBlocks, type NativeChatToolPair } from './native-chat-tool-fold' -import type { NativeChatBlock } from './native-chat-types' +import { pairToolBlocks, type NativeChatToolPair } from './native-chat-tool-pairs' +import type { NativeChatBlock } from '../../native-chat-types' function original(blocks: readonly NativeChatBlock[], limit: number): NativeChatToolPair[] { const pairs: NativeChatToolPair[] = [] diff --git a/src/shared/native-chat-tool-pairing.performance.test.ts b/src/shared/native-chat/tools/native-chat-tool-pairing.performance.test.ts similarity index 99% rename from src/shared/native-chat-tool-pairing.performance.test.ts rename to src/shared/native-chat/tools/native-chat-tool-pairing.performance.test.ts index aef416f5239..86e970cf2e0 100644 --- a/src/shared/native-chat-tool-pairing.performance.test.ts +++ b/src/shared/native-chat/tools/native-chat-tool-pairing.performance.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from 'vitest' -import { pairToolBlocks, type NativeChatToolPair } from './native-chat-tool-fold' +import { pairToolBlocks, type NativeChatToolPair } from './native-chat-tool-pairs' import type { NativeChatBlock, NativeChatToolCallBlock, NativeChatToolResultBlock -} from './native-chat-types' +} from '../../native-chat-types' function call(callId?: string): NativeChatToolCallBlock { return { type: 'tool-call', name: 'Bash', input: {}, ...(callId !== undefined ? { callId } : {}) } diff --git a/src/shared/native-chat-tool-pairing.spec.ts b/src/shared/native-chat/tools/native-chat-tool-pairing.spec.ts similarity index 98% rename from src/shared/native-chat-tool-pairing.spec.ts rename to src/shared/native-chat/tools/native-chat-tool-pairing.spec.ts index 72d7c46d656..eaae410abf9 100644 --- a/src/shared/native-chat-tool-pairing.spec.ts +++ b/src/shared/native-chat/tools/native-chat-tool-pairing.spec.ts @@ -4,7 +4,7 @@ import type { NativeChatBlock, NativeChatToolCallBlock, NativeChatToolResultBlock -} from './native-chat-types' +} from '../../native-chat-types' const call = (name: string): NativeChatToolCallBlock => ({ type: 'tool-call', name, input: {} }) const result = (output: string): NativeChatToolResultBlock => ({ type: 'tool-result', output }) diff --git a/src/shared/native-chat-tool-pairing.ts b/src/shared/native-chat/tools/native-chat-tool-pairing.ts similarity index 95% rename from src/shared/native-chat-tool-pairing.ts rename to src/shared/native-chat/tools/native-chat-tool-pairing.ts index 5db9e30fa24..472f4a6cc2a 100644 --- a/src/shared/native-chat-tool-pairing.ts +++ b/src/shared/native-chat/tools/native-chat-tool-pairing.ts @@ -14,12 +14,12 @@ // that has not been answered yet. Position alone misattributes every later result once // one call finishes with no output, which is why a producer that knows the call names it. -import { pairToolBlocks } from './native-chat-tool-fold' +import { pairToolBlocks } from './native-chat-tool-pairs' import type { NativeChatBlock, NativeChatToolCallBlock, NativeChatToolResultBlock -} from './native-chat-types' +} from '../../native-chat-types' export type NativeChatToolPairing = { /** The result each call owns. A call still running has none. */ diff --git a/src/shared/native-chat-tool-pairs.ts b/src/shared/native-chat/tools/native-chat-tool-pairs.ts similarity index 99% rename from src/shared/native-chat-tool-pairs.ts rename to src/shared/native-chat/tools/native-chat-tool-pairs.ts index 3adea0a6586..0a0adca41bb 100644 --- a/src/shared/native-chat-tool-pairs.ts +++ b/src/shared/native-chat/tools/native-chat-tool-pairs.ts @@ -2,7 +2,7 @@ import type { NativeChatBlock, NativeChatToolCallBlock, NativeChatToolResultBlock -} from './native-chat-types' +} from '../../native-chat-types' export type NativeChatToolPair = { call?: NativeChatToolCallBlock diff --git a/src/shared/native-chat-tool-result-orphans.spec.ts b/src/shared/native-chat/tools/native-chat-tool-result-orphans.spec.ts similarity index 94% rename from src/shared/native-chat-tool-result-orphans.spec.ts rename to src/shared/native-chat/tools/native-chat-tool-result-orphans.spec.ts index 8d0c3724870..66745f598ac 100644 --- a/src/shared/native-chat-tool-result-orphans.spec.ts +++ b/src/shared/native-chat/tools/native-chat-tool-result-orphans.spec.ts @@ -1,14 +1,15 @@ import { describe, expect, it } from 'vitest' -import { foldToolMessages, pairToolBlocks } from './native-chat-tool-fold' -import { nativeChatToolRunOutcome } from './native-chat-tool-run-outcome' -import { nativeChatWorkRunMember } from './native-chat-work-run' -import { nativeChatMessagesShareTranscriptRow } from './native-chat-types' +import { foldToolMessages } from './native-chat-tool-fold' +import { pairToolBlocks } from './native-chat-tool-pairs' +import { nativeChatToolRunOutcome } from '../../native-chat-tool-run-outcome' +import { nativeChatWorkRunMember } from '../../native-chat-work-run' +import { nativeChatMessagesShareTranscriptRow } from '../../native-chat-types' import type { NativeChatBlock, NativeChatMessage, NativeChatToolCallBlock, NativeChatToolResultBlock -} from './native-chat-types' +} from '../../native-chat-types' function row( id: string, diff --git a/src/shared/native-chat-turn-membership-derived-tool-row.test.ts b/src/shared/native-chat/tools/native-chat-turn-membership-derived-tool-row.test.ts similarity index 94% rename from src/shared/native-chat-turn-membership-derived-tool-row.test.ts rename to src/shared/native-chat/tools/native-chat-turn-membership-derived-tool-row.test.ts index 4252a92ea82..779c05d2126 100644 --- a/src/shared/native-chat-turn-membership-derived-tool-row.test.ts +++ b/src/shared/native-chat/tools/native-chat-turn-membership-derived-tool-row.test.ts @@ -1,14 +1,14 @@ import { describe, expect, it } from 'vitest' import type { AgentJournalItemBody, - AgentJournalRenderItem, - AgentJournalTurnScope -} from './agent-session-journal-types' + AgentJournalRenderItem +} from '../../agent-session-journal-types' +import type { AgentJournalTurnScope } from '../../agent-session-journal-turn-scope' import { foldToolMessages } from './native-chat-tool-fold' -import { nativeChatRowsInDrawOrder } from './native-chat-turn-grouping' -import { nativeChatTurnMembership } from './native-chat-turn-membership' -import type { NativeChatMessage, NativeChatRole } from './native-chat-types' -import { projectStructuredItemsToNativeChat } from './structured-agent-session-projection' +import { nativeChatRowsInDrawOrder } from '../../native-chat-turn-grouping' +import { nativeChatTurnMembership } from '../../native-chat-turn-membership' +import type { NativeChatMessage, NativeChatRole } from '../../native-chat-types' +import { projectStructuredItemsToNativeChat } from '../../structured-agent-session-projection' const THREAD: AgentJournalTurnScope = { kind: 'thread' } const inTurn = (turnItemId: string): AgentJournalTurnScope => ({ kind: 'turn', turnItemId })