From 80bbbaff7fe69fa1e7b7ef0f26fa9eee9d91a534 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Wed, 28 Oct 2026 11:28:03 -0700 Subject: [PATCH] refactor: give native chat readability one concrete owner (#35231) --- config/scripts/ci-shard-timings.json | 2 +- .../session/native-chat/mobile-native-chat-eligibility.test.ts | 2 +- .../src/session/native-chat/mobile-native-chat-eligibility.ts | 2 +- mobile/src/session/use-mobile-native-chat-readability.ts | 2 +- .../use-native-chat-toggle-shortcut.keybindings.test.ts | 2 +- .../use-native-chat-toggle-shortcut.surface-owner.test.ts | 2 +- .../components/native-chat/use-native-chat-toggle-shortcut.ts | 2 +- .../src/components/tab-bar/TabBar.os-file-drop.test.tsx | 2 +- .../src/components/tab-bar/TabBar.worktree-write-gate.test.tsx | 2 +- .../tab-bar/TabBar.worktree-write-gate.windows.test.tsx | 2 +- .../src/components/tab-bar/use-tab-bar-runtime-model.ts | 2 +- .../src/components/terminal-pane/terminal-pane-host-state.ts | 2 +- src/renderer/src/lib/agent-launch-caller-permissions.test.ts | 2 +- .../src/lib/agent-launch-caller-prompt-transport.test.ts | 2 +- src/renderer/src/lib/agent-launch-caller-routing.test.ts | 2 +- src/renderer/src/lib/agent-launch-route-input.ts | 2 +- src/renderer/src/lib/launch-agent-in-new-tab-placement.test.ts | 2 +- src/renderer/src/lib/native-chat-transcript-readability.ts | 1 - .../transcript}/native-chat-transcript-readability.test.ts | 0 .../transcript}/native-chat-transcript-readability.ts | 2 +- 20 files changed, 18 insertions(+), 19 deletions(-) delete mode 100644 src/renderer/src/lib/native-chat-transcript-readability.ts rename src/{renderer/src/lib => shared/native-chat/transcript}/native-chat-transcript-readability.test.ts (100%) rename src/shared/{ => native-chat/transcript}/native-chat-transcript-readability.ts (80%) diff --git a/config/scripts/ci-shard-timings.json b/config/scripts/ci-shard-timings.json index 82e17cd905e..5cc632315a7 100644 --- a/config/scripts/ci-shard-timings.json +++ b/config/scripts/ci-shard-timings.json @@ -10657,7 +10657,7 @@ "src/renderer/src/lib/monaco-languages/zig-highlighting.test.ts": 4871, "src/renderer/src/lib/monaco-setup-steps.test.ts": 48, "src/renderer/src/lib/native-chat-cli-fork-preparation.test.ts": 2392, - "src/renderer/src/lib/native-chat-transcript-readability.test.ts": 35, + "src/shared/native-chat/transcript/native-chat-transcript-readability.test.ts": 35, "src/renderer/src/lib/nested-repo-selected-paths.test.ts": 24, "src/renderer/src/lib/new-agent-prompt-outcome.test.ts": 744, "src/renderer/src/lib/new-tab-agent-menu-rows.test.ts": 362, diff --git a/mobile/src/session/native-chat/mobile-native-chat-eligibility.test.ts b/mobile/src/session/native-chat/mobile-native-chat-eligibility.test.ts index 31715b772e6..4539c681062 100644 --- a/mobile/src/session/native-chat/mobile-native-chat-eligibility.test.ts +++ b/mobile/src/session/native-chat/mobile-native-chat-eligibility.test.ts @@ -8,7 +8,7 @@ import { withRememberedNativeChatIdentity } from './mobile-native-chat-eligibility' import type { MobileSessionTab } from '../mobile-session-route-types' -import { isNativeChatTranscriptLocalReadable } from '../../../../src/shared/native-chat-transcript-readability' +import { isNativeChatTranscriptLocalReadable } from '../../../../src/shared/native-chat/transcript/native-chat-transcript-readability' function status(overrides: Partial = {}): AgentStatusEntry { return { diff --git a/mobile/src/session/native-chat/mobile-native-chat-eligibility.ts b/mobile/src/session/native-chat/mobile-native-chat-eligibility.ts index 6312ab5d13e..0e88f71455f 100644 --- a/mobile/src/session/native-chat/mobile-native-chat-eligibility.ts +++ b/mobile/src/session/native-chat/mobile-native-chat-eligibility.ts @@ -4,7 +4,7 @@ import { isNativeChatAgentAvailable, nativeChatAvailabilityAgent } from '../../../../src/shared/native-chat-availability' -import { isNativeChatTranscriptLocalReadable } from '../../../../src/shared/native-chat-transcript-readability' +import { isNativeChatTranscriptLocalReadable } from '../../../../src/shared/native-chat/transcript/native-chat-transcript-readability' export type MobileNativeChatResolution = { agent: string diff --git a/mobile/src/session/use-mobile-native-chat-readability.ts b/mobile/src/session/use-mobile-native-chat-readability.ts index 5a447ea924c..0ca6fdab907 100644 --- a/mobile/src/session/use-mobile-native-chat-readability.ts +++ b/mobile/src/session/use-mobile-native-chat-readability.ts @@ -8,7 +8,7 @@ import { import { isFloatingWorkspaceWorktreeId } from './floating-workspace' import { resumeFolderWorkspaceListRead } from '../agent-history/mobile-agent-history-operations' import { isMobileFolderNativeChatReadable } from './native-chat/mobile-native-chat-eligibility' -import { isNativeChatTranscriptLocalReadable } from '../../../src/shared/native-chat-transcript-readability' +import { isNativeChatTranscriptLocalReadable } from '../../../src/shared/native-chat/transcript/native-chat-transcript-readability' type ReadabilityState = { client: RpcClient | null diff --git a/src/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.keybindings.test.ts b/src/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.keybindings.test.ts index d90681d0d08..0036c794adc 100644 --- a/src/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.keybindings.test.ts +++ b/src/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.keybindings.test.ts @@ -14,7 +14,7 @@ vi.mock('@/store/plugin-panels', () => ({ usePluginCommands: () => plugins.comma vi.mock('@/lib/plugin-command-execution', () => ({ executePluginCommand: vi.fn(async () => {}) })) vi.mock('@/lib/shortcut-platform', () => ({ getShortcutPlatform: () => 'win32' })) vi.mock('@/app-shell/app-window-chrome', () => ({ shortcutPlatform: 'win32' })) -vi.mock('@/lib/native-chat-transcript-readability', () => ({ +vi.mock('../../../../shared/native-chat/transcript/native-chat-transcript-readability', () => ({ isNativeChatTranscriptLocalReadable: () => true })) import { executePluginCommand } from '@/lib/plugin-command-execution' diff --git a/src/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.surface-owner.test.ts b/src/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.surface-owner.test.ts index 085d0e6f771..a9a67af726a 100644 --- a/src/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.surface-owner.test.ts +++ b/src/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.surface-owner.test.ts @@ -52,7 +52,7 @@ vi.mock('./native-chat-shortcut', () => ({ matchesNativeChatToggleShortcut: () => true })) vi.mock('../../../../shared/native-chat-availability', () => ({ canToggleNativeChat: () => true })) -vi.mock('@/lib/native-chat-transcript-readability', () => ({ +vi.mock('../../../../shared/native-chat/transcript/native-chat-transcript-readability', () => ({ isNativeChatTranscriptLocalReadable: () => true })) vi.mock('@/lib/connection-context', () => ({ getConnectionIdFromState: () => null })) diff --git a/src/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.ts b/src/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.ts index df296b07741..106c3bcd8f5 100644 --- a/src/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.ts +++ b/src/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.ts @@ -15,7 +15,7 @@ import type { AgentType } from '../../../../shared/agent-status-types' import type { TerminalLayoutSnapshot } from '../../../../shared/terminal-tab-types' import { resolveNativeChatTabAgentEvidence } from '../tab-bar/native-chat-tab-agent-evidence' import { canToggleNativeChat } from '../../../../shared/native-chat-availability' -import { isNativeChatTranscriptLocalReadable } from '@/lib/native-chat-transcript-readability' +import { isNativeChatTranscriptLocalReadable } from '../../../../shared/native-chat/transcript/native-chat-transcript-readability' import { matchesNativeChatToggleShortcut } from './native-chat-shortcut' import { getShortcutPlatform } from '@/lib/shortcut-platform' import { getConnectionIdFromState } from '@/lib/connection-context' diff --git a/src/renderer/src/components/tab-bar/TabBar.os-file-drop.test.tsx b/src/renderer/src/components/tab-bar/TabBar.os-file-drop.test.tsx index 80edf646625..b5210a26495 100644 --- a/src/renderer/src/components/tab-bar/TabBar.os-file-drop.test.tsx +++ b/src/renderer/src/components/tab-bar/TabBar.os-file-drop.test.tsx @@ -18,7 +18,7 @@ vi.mock('@/hooks/useDetectedAgents', () => tabBarRuntimeModelStubs().detectedAge vi.mock('@/hooks/useAgentDetectionTarget', () => tabBarRuntimeModelStubs().detectionTarget()) vi.mock('@/lib/connection-context', () => tabBarRuntimeModelStubs().connectionContext()) vi.mock('@/lib/worktree-runtime-owner', () => tabBarRuntimeModelStubs().runtimeOwner()) -vi.mock('@/lib/native-chat-transcript-readability', () => +vi.mock('../../../../shared/native-chat/transcript/native-chat-transcript-readability', () => tabBarRuntimeModelStubs().nativeChatReadability() ) vi.mock('@/lib/client-creation-action-policy', () => tabBarRuntimeModelStubs().creationPolicy()) diff --git a/src/renderer/src/components/tab-bar/TabBar.worktree-write-gate.test.tsx b/src/renderer/src/components/tab-bar/TabBar.worktree-write-gate.test.tsx index e0aced6d566..87199c24edc 100644 --- a/src/renderer/src/components/tab-bar/TabBar.worktree-write-gate.test.tsx +++ b/src/renderer/src/components/tab-bar/TabBar.worktree-write-gate.test.tsx @@ -23,7 +23,7 @@ vi.mock('@/hooks/useDetectedAgents', () => tabBarRuntimeModelStubs().detectedAge vi.mock('@/hooks/useAgentDetectionTarget', () => tabBarRuntimeModelStubs().detectionTarget()) vi.mock('@/lib/connection-context', () => tabBarRuntimeModelStubs().connectionContext()) vi.mock('@/lib/worktree-runtime-owner', () => tabBarRuntimeModelStubs().runtimeOwner()) -vi.mock('@/lib/native-chat-transcript-readability', () => +vi.mock('../../../../shared/native-chat/transcript/native-chat-transcript-readability', () => tabBarRuntimeModelStubs().nativeChatReadability() ) vi.mock('@/lib/client-creation-action-policy', () => tabBarRuntimeModelStubs().creationPolicy()) diff --git a/src/renderer/src/components/tab-bar/TabBar.worktree-write-gate.windows.test.tsx b/src/renderer/src/components/tab-bar/TabBar.worktree-write-gate.windows.test.tsx index 7cdecadb4cf..a0b3bfcee5c 100644 --- a/src/renderer/src/components/tab-bar/TabBar.worktree-write-gate.windows.test.tsx +++ b/src/renderer/src/components/tab-bar/TabBar.worktree-write-gate.windows.test.tsx @@ -22,7 +22,7 @@ vi.mock('@/hooks/useDetectedAgents', () => tabBarRuntimeModelStubs().detectedAge vi.mock('@/hooks/useAgentDetectionTarget', () => tabBarRuntimeModelStubs().detectionTarget()) vi.mock('@/lib/connection-context', () => tabBarRuntimeModelStubs().connectionContext()) vi.mock('@/lib/worktree-runtime-owner', () => tabBarRuntimeModelStubs().runtimeOwner()) -vi.mock('@/lib/native-chat-transcript-readability', () => +vi.mock('../../../../shared/native-chat/transcript/native-chat-transcript-readability', () => tabBarRuntimeModelStubs().nativeChatReadability() ) vi.mock('@/lib/client-creation-action-policy', () => tabBarRuntimeModelStubs().creationPolicy()) diff --git a/src/renderer/src/components/tab-bar/use-tab-bar-runtime-model.ts b/src/renderer/src/components/tab-bar/use-tab-bar-runtime-model.ts index 0cefa057b60..f97b9ce9af8 100644 --- a/src/renderer/src/components/tab-bar/use-tab-bar-runtime-model.ts +++ b/src/renderer/src/components/tab-bar/use-tab-bar-runtime-model.ts @@ -10,7 +10,7 @@ import type { AgentDetectionTarget } from '@/hooks/useDetectedAgents' import { useAgentDetectionTargetForWorktree } from '@/hooks/useAgentDetectionTarget' import { getConnectionIdFromState } from '@/lib/connection-context' import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' -import { isNativeChatTranscriptLocalReadable } from '@/lib/native-chat-transcript-readability' +import { isNativeChatTranscriptLocalReadable } from '../../../../shared/native-chat/transcript/native-chat-transcript-readability' import { runtimeEnvironmentIdOrLocalUnlessTwin } from '@/lib/worktree-runtime-owner' import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target' import { useOptionalShortcutLabel, useShortcutLabel } from '@/hooks/useShortcutLabel' diff --git a/src/renderer/src/components/terminal-pane/terminal-pane-host-state.ts b/src/renderer/src/components/terminal-pane/terminal-pane-host-state.ts index eb347a63078..dace8264d77 100644 --- a/src/renderer/src/components/terminal-pane/terminal-pane-host-state.ts +++ b/src/renderer/src/components/terminal-pane/terminal-pane-host-state.ts @@ -5,7 +5,7 @@ import { resolveWorktreeHostConnection, type WorktreeHostConnection } from '@/lib/worktree-host-connection-phase' -import { isNativeChatTranscriptLocalReadable } from '@/lib/native-chat-transcript-readability' +import { isNativeChatTranscriptLocalReadable } from '../../../../shared/native-chat/transcript/native-chat-transcript-readability' import { selectRuntimeAwareSshError, selectRuntimeAwareSshTargetLabel, diff --git a/src/renderer/src/lib/agent-launch-caller-permissions.test.ts b/src/renderer/src/lib/agent-launch-caller-permissions.test.ts index cb8da84be24..df1e186077c 100644 --- a/src/renderer/src/lib/agent-launch-caller-permissions.test.ts +++ b/src/renderer/src/lib/agent-launch-caller-permissions.test.ts @@ -15,7 +15,7 @@ const store = createLaunchFunnelStore() vi.mock('@/store', () => ({ useAppStore: { getState: () => store } })) vi.mock('@/lib/new-workspace', () => ({ CLIENT_PLATFORM: 'darwin' })) vi.mock('@/lib/connection-context', () => ({ getConnectionIdFromState: () => null })) -vi.mock('@/lib/native-chat-transcript-readability', () => ({ +vi.mock('../../../shared/native-chat/transcript/native-chat-transcript-readability', () => ({ isNativeChatTranscriptLocalReadable: () => true })) vi.mock('@/runtime/web-runtime-session-environment', () => ({ diff --git a/src/renderer/src/lib/agent-launch-caller-prompt-transport.test.ts b/src/renderer/src/lib/agent-launch-caller-prompt-transport.test.ts index 2477ac7e0cb..10eb0c4257f 100644 --- a/src/renderer/src/lib/agent-launch-caller-prompt-transport.test.ts +++ b/src/renderer/src/lib/agent-launch-caller-prompt-transport.test.ts @@ -19,7 +19,7 @@ const mockPasteDraftWhenAgentReady = vi.fn<(request: Record) => vi.mock('@/store', () => ({ useAppStore: { getState: () => store } })) vi.mock('@/lib/new-workspace', () => ({ CLIENT_PLATFORM: 'darwin' })) vi.mock('@/lib/connection-context', () => ({ getConnectionIdFromState: () => null })) -vi.mock('@/lib/native-chat-transcript-readability', () => ({ +vi.mock('../../../shared/native-chat/transcript/native-chat-transcript-readability', () => ({ isNativeChatTranscriptLocalReadable: () => true })) vi.mock('@/runtime/web-runtime-session-environment', () => ({ diff --git a/src/renderer/src/lib/agent-launch-caller-routing.test.ts b/src/renderer/src/lib/agent-launch-caller-routing.test.ts index 9b981fb1aea..ee459abcf23 100644 --- a/src/renderer/src/lib/agent-launch-caller-routing.test.ts +++ b/src/renderer/src/lib/agent-launch-caller-routing.test.ts @@ -25,7 +25,7 @@ const mockExecutionHostId = vi.fn(() => 'local') vi.mock('@/store', () => ({ useAppStore: { getState: () => store } })) vi.mock('@/lib/new-workspace', () => ({ CLIENT_PLATFORM: 'darwin' })) vi.mock('@/lib/connection-context', () => ({ getConnectionIdFromState: () => null })) -vi.mock('@/lib/native-chat-transcript-readability', () => ({ +vi.mock('../../../shared/native-chat/transcript/native-chat-transcript-readability', () => ({ isNativeChatTranscriptLocalReadable: () => true })) vi.mock('@/runtime/web-runtime-session-environment', () => ({ diff --git a/src/renderer/src/lib/agent-launch-route-input.ts b/src/renderer/src/lib/agent-launch-route-input.ts index 4b91ba97de3..a1f9de5e37c 100644 --- a/src/renderer/src/lib/agent-launch-route-input.ts +++ b/src/renderer/src/lib/agent-launch-route-input.ts @@ -20,7 +20,7 @@ import { getLocalRepoProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' import type { NativeChatLaunchPromptDelivery } from '@/lib/native-chat-launch-prompt-delivery' -import { isNativeChatTranscriptLocalReadable } from '@/lib/native-chat-transcript-readability' +import { isNativeChatTranscriptLocalReadable } from '../../../shared/native-chat/transcript/native-chat-transcript-readability' import { getExecutionHostIdForWorktree } from '@/lib/worktree-runtime-owner' import { readLocalRuntimeCapabilitiesOrUnknown } from '@/runtime/local-runtime-capabilities' import { resolveStructuredAgentSessionOwner } from '@/runtime/structured-agent-session-owner' diff --git a/src/renderer/src/lib/launch-agent-in-new-tab-placement.test.ts b/src/renderer/src/lib/launch-agent-in-new-tab-placement.test.ts index 8edae8c67fe..fe1782b79d1 100644 --- a/src/renderer/src/lib/launch-agent-in-new-tab-placement.test.ts +++ b/src/renderer/src/lib/launch-agent-in-new-tab-placement.test.ts @@ -59,7 +59,7 @@ vi.mock('@/lib/connection-context', () => ({ getConnectionIdFromState: () => null })) -vi.mock('@/lib/native-chat-transcript-readability', () => ({ +vi.mock('../../../shared/native-chat/transcript/native-chat-transcript-readability', () => ({ isNativeChatTranscriptLocalReadable: () => true })) diff --git a/src/renderer/src/lib/native-chat-transcript-readability.ts b/src/renderer/src/lib/native-chat-transcript-readability.ts deleted file mode 100644 index 046e0a2e086..00000000000 --- a/src/renderer/src/lib/native-chat-transcript-readability.ts +++ /dev/null @@ -1 +0,0 @@ -export { isNativeChatTranscriptLocalReadable } from '../../../shared/native-chat-transcript-readability' diff --git a/src/renderer/src/lib/native-chat-transcript-readability.test.ts b/src/shared/native-chat/transcript/native-chat-transcript-readability.test.ts similarity index 100% rename from src/renderer/src/lib/native-chat-transcript-readability.test.ts rename to src/shared/native-chat/transcript/native-chat-transcript-readability.test.ts diff --git a/src/shared/native-chat-transcript-readability.ts b/src/shared/native-chat/transcript/native-chat-transcript-readability.ts similarity index 80% rename from src/shared/native-chat-transcript-readability.ts rename to src/shared/native-chat/transcript/native-chat-transcript-readability.ts index 60ef9f06ed4..7b04bc2e98c 100644 --- a/src/shared/native-chat-transcript-readability.ts +++ b/src/shared/native-chat/transcript/native-chat-transcript-readability.ts @@ -1,4 +1,4 @@ -import { isRuntimeOwnedSshTargetId } from './execution-host' +import { isRuntimeOwnedSshTargetId } from '../../execution-host' /** Model-A SSH stores Grok transcripts on a host this renderer cannot read. */ export function isNativeChatTranscriptLocalReadable(