From de2700d0fbb9d00a45ad3f3e6f79c9d46c65d081 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Thu, 22 Oct 2026 08:55:53 -0700 Subject: [PATCH] refactor: colocate native-chat command envelopes (#32055) --- config/scripts/native-chat-live-session-benchmark.ts | 2 +- .../native-chat/native-chat-preassembled-session-parity.test.ts | 2 +- src/shared/native-chat-command-output.ts | 2 +- src/shared/native-chat-message-preparation.ts | 2 +- src/shared/native-chat-transcript-contracts.test.ts | 2 +- .../{ => native-chat}/native-chat-command-envelope.spec.ts | 2 +- src/shared/{ => native-chat}/native-chat-command-envelope.ts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) rename src/shared/{ => native-chat}/native-chat-command-envelope.spec.ts (98%) rename src/shared/{ => native-chat}/native-chat-command-envelope.ts (97%) diff --git a/config/scripts/native-chat-live-session-benchmark.ts b/config/scripts/native-chat-live-session-benchmark.ts index 5983dc2f4e7..bc852a84b85 100644 --- a/config/scripts/native-chat-live-session-benchmark.ts +++ b/config/scripts/native-chat-live-session-benchmark.ts @@ -11,7 +11,7 @@ import { deepStrictEqual, strictEqual } from 'node:assert' import { performance } from 'node:perf_hooks' import type { NativeChatMessage, NativeChatSession } from '../../src/shared/native-chat-types' import { getVerifiedNativeChatCommands } from '../../src/shared/native-chat-agent-profiles' -import { surfaceSkillInvocationUserTurns } from '../../src/shared/native-chat-command-envelope' +import { surfaceSkillInvocationUserTurns } from '../../src/shared/native-chat/native-chat-command-envelope' import { prepareNativeChatLiveMessages } from '../../src/renderer/src/components/native-chat/native-chat-live-message-preparation' import { mergeNativeChatLiveSession } from '../../src/renderer/src/components/native-chat/native-chat-live-status' import { diff --git a/src/renderer/src/components/native-chat/native-chat-preassembled-session-parity.test.ts b/src/renderer/src/components/native-chat/native-chat-preassembled-session-parity.test.ts index eb7f2f0d617..5f43c148591 100644 --- a/src/renderer/src/components/native-chat/native-chat-preassembled-session-parity.test.ts +++ b/src/renderer/src/components/native-chat/native-chat-preassembled-session-parity.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import type { NativeChatMessage } from '../../../../shared/native-chat-types' import { getVerifiedNativeChatCommands } from '../../../../shared/native-chat-agent-profiles' -import { surfaceSkillInvocationUserTurns } from '../../../../shared/native-chat-command-envelope' +import { surfaceSkillInvocationUserTurns } from '../../../../shared/native-chat/native-chat-command-envelope' import { createIncrementalAssembler, reset as resetAssembler diff --git a/src/shared/native-chat-command-output.ts b/src/shared/native-chat-command-output.ts index 2f38890df8a..a36aff7a98f 100644 --- a/src/shared/native-chat-command-output.ts +++ b/src/shared/native-chat-command-output.ts @@ -7,7 +7,7 @@ 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 { parseNativeChatCommandEnvelope } from './native-chat/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-message-preparation.ts b/src/shared/native-chat-message-preparation.ts index c61350a305c..cbab83f4227 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-command-envelope' +import { surfaceSkillInvocationUserTurns } from './native-chat/native-chat-command-envelope' import { surfaceNativeChatCommandOutputs } from './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 aca4b3d1020..b0dadf70549 100644 --- a/src/shared/native-chat-transcript-contracts.test.ts +++ b/src/shared/native-chat-transcript-contracts.test.ts @@ -8,7 +8,7 @@ import './native-chat-ask-row.spec' import './native-chat-tool-pairing.spec' import './native-chat-live-line.spec' import './native-chat-merge-pairs.spec' -import './native-chat-command-envelope.spec' +import './native-chat/native-chat-command-envelope.spec' import './native-chat-streaming.spec' import './native-chat-subagent-group-header.spec' import './native-chat-tool-result-orphans.spec' diff --git a/src/shared/native-chat-command-envelope.spec.ts b/src/shared/native-chat/native-chat-command-envelope.spec.ts similarity index 98% rename from src/shared/native-chat-command-envelope.spec.ts rename to src/shared/native-chat/native-chat-command-envelope.spec.ts index 6f878e90903..48e52b1ba24 100644 --- a/src/shared/native-chat-command-envelope.spec.ts +++ b/src/shared/native-chat/native-chat-command-envelope.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { NativeChatMessage } from './native-chat-types' +import type { NativeChatMessage } from '../native-chat-types' import { parseNativeChatCommandEnvelope, surfaceSkillInvocationUserTurns diff --git a/src/shared/native-chat-command-envelope.ts b/src/shared/native-chat/native-chat-command-envelope.ts similarity index 97% rename from src/shared/native-chat-command-envelope.ts rename to src/shared/native-chat/native-chat-command-envelope.ts index 1ac398d58f1..c3e64cab062 100644 --- a/src/shared/native-chat-command-envelope.ts +++ b/src/shared/native-chat/native-chat-command-envelope.ts @@ -5,7 +5,7 @@ // dropping its envelope makes the assistant appear to answer an empty // conversation. Surface non-catalog envelopes back as plain user text. -import { isTextBlock, type NativeChatMessage } from './native-chat-types' +import { isTextBlock, type NativeChatMessage } from '../native-chat-types' const COMMAND_NAME = /([\s\S]*?)<\/command-name>/ const COMMAND_ARGS = /([\s\S]*?)<\/command-args>/