refactor: give native chat readability one concrete owner (#35231)

This commit is contained in:
Neil
2026-10-28 11:28:03 -07:00
committed by GitHub
parent 28d6883756
commit 80bbbaff7f
20 changed files with 18 additions and 19 deletions
+1 -1
View File
@@ -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,
@@ -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> = {}): AgentStatusEntry {
return {
@@ -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
@@ -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
@@ -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'
@@ -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 }))
@@ -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'
@@ -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())
@@ -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())
@@ -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())
@@ -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'
@@ -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,
@@ -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', () => ({
@@ -19,7 +19,7 @@ const mockPasteDraftWhenAgentReady = vi.fn<(request: Record<string, unknown>) =>
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', () => ({
@@ -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', () => ({
@@ -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'
@@ -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
}))
@@ -1 +0,0 @@
export { isNativeChatTranscriptLocalReadable } from '../../../shared/native-chat-transcript-readability'
@@ -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(