From 61aaa98eb35623257fe535c7b97fabcdfd8d557b Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Mon, 12 Oct 2026 07:02:24 -0700 Subject: [PATCH] refactor(renderer): remove the keyboard-handlers barrel and partial re-exports (#27986) Co-authored-by: m4air --- .../src/components/TerminalSearch.tsx | 2 +- .../preview-terminal-paste.ts | 6 +-- ...emote-runtime-terminal-preview-api.test.ts | 2 +- .../remote-runtime-terminal-preview-api.ts | 10 ++-- ...ession-status-bridge-failed-start.test.tsx | 2 +- ...n-status-bridge-unconfirmed-start.test.tsx | 2 +- ...se-native-chat-provisional-launch.test.tsx | 2 +- .../TerminalPaneHeaderOverlay.test.tsx | 2 +- .../TerminalPaneHeaderOverlay.tsx | 2 +- .../expand-collapse-render-stability.test.ts | 4 +- ...de-middle-click-double-paste.repro.test.ts | 6 +-- ...oard-handlers-ime-composing-chord.test.tsx | 4 +- ...keyboard-handlers-ime-enter-keyup.test.tsx | 4 +- .../keyboard-handlers-ime.test.tsx | 4 +- .../terminal-pane/keyboard-handlers.test.ts | 2 +- .../terminal-pane/keyboard-handlers.ts | 13 ------ .../parked-terminal-byte-watcher.ts | 2 +- ...onnection-startup-command-delivery.test.ts | 2 +- .../terminal-pane/pty-connection-types.ts | 3 +- .../deferred-cold-restore-and-snapshot.ts | 2 +- .../e2e-terminal-pty-harness.ts | 2 +- .../hidden-output-snapshot-serialize.ts | 4 +- .../park-reveal-snapshot-verdict.ts | 2 +- .../reattach-payload-context.ts | 2 +- .../pty-connection/reattach-result-handler.ts | 2 +- .../pty-connection/sleeping-record-access.ts | 2 +- .../transport-output-callbacks.ts | 3 +- .../pty-side-effect-pending-census.test.ts | 4 +- .../pty-transport-eager-buffer-replay.test.ts | 46 +++++++++++-------- .../pty-transport-handler-suspension.test.ts | 30 ++++++------ .../pty-transport-output-side-effects.test.ts | 34 +++++++------- .../terminal-pane/pty-transport-types.ts | 2 +- .../components/terminal-pane/pty-transport.ts | 24 ---------- ...ote-park-reveal-unverifiable-retry.test.ts | 4 +- .../remote-runtime-input-journal.ts | 2 +- ...ntime-pty-transport-input-fallback.test.ts | 1 - .../remote-runtime-pty-transport.ts | 14 +++--- ...subscribe-failure-recovery-routing.test.ts | 2 +- .../terminal-agent-paste-bracketing.test.ts | 9 ++-- .../terminal-pane/terminal-appearance.ts | 2 +- .../terminal-captured-input-dispatch.test.ts | 2 +- .../terminal-captured-input-dispatch.ts | 2 +- .../terminal-pane/terminal-clipboard-paste.ts | 6 +-- .../terminal-drop-path-writer.ts | 2 +- .../terminal-pane/terminal-drop-target.ts | 2 +- .../terminal-drop-transport-owner.ts | 2 +- .../terminal-ime-composition-route.test.ts | 2 +- .../terminal-ime-composition-route.ts | 2 +- .../terminal-ime-deferred-newline.test.ts | 2 +- ...terminal-ime-user-input-provenance.test.ts | 2 +- .../terminal-keyboard-action-dispatch.ts | 2 +- .../terminal-keyboard-dependencies.ts | 2 +- .../terminal-keyboard-runtime.ts | 2 +- .../terminal-mode-2031-replies.ts | 2 +- .../terminal-native-file-drop-destination.ts | 2 +- .../terminal-native-file-drop.ts | 2 +- .../terminal-pane-element-file-drop.test.tsx | 2 +- .../terminal-pane-lifecycle-primitives.ts | 2 +- .../terminal-pane-lifecycle-types.ts | 3 +- .../terminal-pane/terminal-pane-menu-paste.ts | 4 +- .../terminal-pane-paste-dispatch.ts | 16 +++---- .../terminal-pane-paste-execution.ts | 4 +- ...inal-pane-split-with-inherited-cwd.test.ts | 2 +- .../terminal-pane-split-with-inherited-cwd.ts | 2 +- .../terminal-pane-split-writer-paths.test.ts | 4 +- .../terminal-pane/terminal-paste-chunks.ts | 2 +- .../terminal-paste-coordinator.test.ts | 20 ++++---- .../terminal-paste-coordinator.ts | 21 --------- ...minal-paste-executor-default-yield.test.ts | 3 +- .../terminal-paste-multiline-policy.test.ts | 8 ++-- .../terminal-paste-operation-order.test.ts | 3 +- .../terminal-programmatic-text-paste.test.ts | 2 +- .../terminal-programmatic-text-paste.ts | 2 +- .../terminal-pty-paste-writer.ts | 2 +- .../terminal-shutdown-layout-capture.ts | 2 +- .../terminal-startup-command-paste.ts | 7 +-- .../terminal-title-tracker-parity.test.ts | 2 +- .../use-mobile-overlay-ticks.perf.test.tsx | 2 +- .../terminal-pane/use-mobile-overlay-ticks.ts | 2 +- .../use-terminal-context-menu-trigger.ts | 2 +- .../use-terminal-pane-context-menu.ts | 4 +- .../use-terminal-pane-file-drop-owner.ts | 2 +- .../use-terminal-pane-foundation.ts | 4 +- ...l-pane-global-effects-paste-events.test.ts | 2 +- .../use-terminal-pane-global-effects.ts | 2 +- .../use-terminal-pane-global-listeners.ts | 2 +- .../use-terminal-pane-lifecycle.test.ts | 10 ++-- .../use-terminal-pane-lifecycle.ts | 24 ---------- .../use-terminal-pane-split-actions.ts | 2 +- ...e-ai-vault-structured-session-host.test.ts | 2 +- .../activate-ai-vault-structured-session.ts | 2 +- src/renderer/src/lib/agent-status.test.ts | 2 +- ...launch-agent-structured-chat-guard.test.ts | 6 ++- .../src/lib/new-agent-prompt-outcome.test.ts | 4 +- ...agent-session-launch-after-failure.test.ts | 4 +- ...-agent-session-launch-cancellation.test.ts | 2 +- ...ed-agent-session-launch-close-race.test.ts | 4 +- ...t-session-launch-different-request.test.ts | 4 +- ...-agent-session-launch-exited-owner.test.ts | 2 +- ...agent-session-launch-join-delivery.test.ts | 4 +- ...tured-agent-session-launch-options.test.ts | 4 +- ...nt-session-launch-registered-agent.test.ts | 3 +- ...ctured-agent-session-launch-reload.test.ts | 2 +- ...ent-session-launch-resume-identity.test.ts | 3 +- ...sion-launch-unconfirmed-or-retried.test.ts | 4 +- .../structured-agent-session-launch.test.ts | 4 +- ...-agent-session-new-chat-own-launch.test.ts | 2 +- ...-session-empty-worktree-visibility.test.ts | 2 +- ...tured-session-retired-epoch-repair.test.ts | 8 ++-- ...ructured-session-reveal-visibility.test.ts | 6 +-- ...ctured-session-tabs-host-isolation.test.ts | 6 +-- ...local-structured-session-tabs-sync.test.ts | 12 ++--- .../local-structured-session-tabs-sync.ts | 18 -------- ...red-session-unverifiable-inventory.test.ts | 6 +-- .../remote-runtime-snapshot-outcome.test.ts | 4 +- ...runtime-terminal-frame-drop-resync.test.ts | 4 +- .../remote-runtime-terminal-multiplexer.ts | 17 ------- ...time-terminal-snapshot-kitty-flags.test.ts | 4 +- ...ntime-terminal-stale-stream-frames.test.ts | 4 +- ...te-runtime-terminal-stall-recovery.test.ts | 4 +- .../structured-session-tab-inventory.test.ts | 4 +- .../structured-session-tab-inventory.ts | 2 +- .../runtime-pane-title-sort-epoch.test.ts | 2 +- .../store-session-terminal-reconnect.test.ts | 2 +- .../slices/terminal-tab-id-hydration.test.ts | 2 +- .../slices/terminal-tab-title-batch.test.ts | 2 +- ...terminals-explicit-empty-hydration.test.ts | 2 +- ...ls-hydration-canonical-pty-overlap.test.ts | 2 +- ...terminals-hydration-canonical-rows.test.ts | 2 +- .../store/slices/terminals-hydration.test.ts | 2 +- .../terminals/terminal-pane-hibernation.ts | 2 +- .../terminal-shutdown-guards-identity.test.ts | 2 +- .../terminals/terminal-shutdown-guards.ts | 2 +- ...ed-session-reopened-tab-close.unit.test.ts | 2 +- ...session-tab-close-stale-frame.unit.test.ts | 2 +- ...minal-binding-crash-hydration.unit.test.ts | 2 +- 136 files changed, 264 insertions(+), 397 deletions(-) delete mode 100644 src/renderer/src/components/terminal-pane/keyboard-handlers.ts diff --git a/src/renderer/src/components/TerminalSearch.tsx b/src/renderer/src/components/TerminalSearch.tsx index 47db8092ef1..f385155abea 100644 --- a/src/renderer/src/components/TerminalSearch.tsx +++ b/src/renderer/src/components/TerminalSearch.tsx @@ -3,7 +3,7 @@ import { useEffect, useState, useCallback } from 'react' import { ChevronUp, ChevronDown, X, CaseSensitive, Regex } from 'lucide-react' import type { SearchAddon } from '@xterm/addon-search' import { Button } from '@/components/ui/button' -import type { SearchState } from '@/components/terminal-pane/keyboard-handlers' +import type { SearchState } from '@/components/terminal-pane/terminal-keyboard-shortcut-matching' import { translate } from '@/i18n/i18n' import { getFindRequestQuery } from '@/lib/find-query-bounds' import { safeFind } from './terminal-search-safe-find' diff --git a/src/renderer/src/components/dashboard-popout/preview-terminal-paste.ts b/src/renderer/src/components/dashboard-popout/preview-terminal-paste.ts index 8511810bb6f..4ff536910e7 100644 --- a/src/renderer/src/components/dashboard-popout/preview-terminal-paste.ts +++ b/src/renderer/src/components/dashboard-popout/preview-terminal-paste.ts @@ -1,9 +1,7 @@ import type { Terminal } from '@xterm/xterm' import { getShortcutPlatform } from '@/lib/shortcut-platform' -import { - executeTerminalPastePlan, - planTerminalPasteWithYield -} from '@/components/terminal-pane/terminal-paste-coordinator' +import { executeTerminalPastePlan } from '@/components/terminal-pane/terminal-paste-executor' +import { planTerminalPasteWithYield } from '@/components/terminal-pane/terminal-paste-coordinator' import { resolveTerminalPasteRuntime } from '@/components/terminal-pane/terminal-paste-runtime' import { TERMINAL_PASTE_MAX_BYTES } from '@/components/terminal-pane/terminal-paste-limits' import { pasteTerminalText } from '@/components/terminal-pane/terminal-bracketed-paste' diff --git a/src/renderer/src/components/dashboard-popout/remote-runtime-terminal-preview-api.test.ts b/src/renderer/src/components/dashboard-popout/remote-runtime-terminal-preview-api.test.ts index ec40efce3b3..973715a5c61 100644 --- a/src/renderer/src/components/dashboard-popout/remote-runtime-terminal-preview-api.test.ts +++ b/src/renderer/src/components/dashboard-popout/remote-runtime-terminal-preview-api.test.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it, vi } from 'vitest' -import type { RemoteRuntimeMultiplexedTerminalCallbacks } from '@/runtime/remote-runtime-terminal-multiplexer' +import type { RemoteRuntimeMultiplexedTerminalCallbacks } from '@/runtime/remote-runtime-terminal-multiplexer-types' import type { TerminalPreviewDataPayload } from '../../../../shared/terminal-preview' type Subscription = { diff --git a/src/renderer/src/components/dashboard-popout/remote-runtime-terminal-preview-api.ts b/src/renderer/src/components/dashboard-popout/remote-runtime-terminal-preview-api.ts index 7009e01214d..d7529d8fce8 100644 --- a/src/renderer/src/components/dashboard-popout/remote-runtime-terminal-preview-api.ts +++ b/src/renderer/src/components/dashboard-popout/remote-runtime-terminal-preview-api.ts @@ -1,10 +1,10 @@ import { createBrowserUuid } from '@/lib/browser-uuid' import { takeCurrentTerminalDeliveryCredit } from '@/lib/pane-manager/terminal-delivery-credit' -import { - getRemoteRuntimeTerminalMultiplexer, - type RemoteRuntimeMultiplexedTerminal, - type RemoteRuntimeMultiplexedTerminalCallbacks -} from '@/runtime/remote-runtime-terminal-multiplexer' +import { getRemoteRuntimeTerminalMultiplexer } from '@/runtime/remote-runtime-terminal-multiplexer' +import type { + RemoteRuntimeMultiplexedTerminal, + RemoteRuntimeMultiplexedTerminalCallbacks +} from '@/runtime/remote-runtime-terminal-multiplexer-types' import { parseRemoteRuntimePtyId } from '../../../../shared/remote-runtime-pty-id' import type { TerminalPreviewConnectResult, diff --git a/src/renderer/src/components/native-chat/structured-agent-session-status-bridge-failed-start.test.tsx b/src/renderer/src/components/native-chat/structured-agent-session-status-bridge-failed-start.test.tsx index f647ed24415..1f25263f53a 100644 --- a/src/renderer/src/components/native-chat/structured-agent-session-status-bridge-failed-start.test.tsx +++ b/src/renderer/src/components/native-chat/structured-agent-session-status-bridge-failed-start.test.tsx @@ -62,7 +62,7 @@ vi.mock('@/runtime/structured-agent-session-client', () => ({ subscribeStructuredAgentSessionStatus: mocks.subscribeStatus })) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: vi.fn(async () => []) })) diff --git a/src/renderer/src/components/native-chat/structured-agent-session-status-bridge-unconfirmed-start.test.tsx b/src/renderer/src/components/native-chat/structured-agent-session-status-bridge-unconfirmed-start.test.tsx index ff0775ee511..3318059ce0e 100644 --- a/src/renderer/src/components/native-chat/structured-agent-session-status-bridge-unconfirmed-start.test.tsx +++ b/src/renderer/src/components/native-chat/structured-agent-session-status-bridge-unconfirmed-start.test.tsx @@ -63,7 +63,7 @@ vi.mock('@/runtime/structured-agent-session-client', () => ({ subscribeStructuredAgentSessionStatus: mocks.subscribeStatus })) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: mocks.refresh })) diff --git a/src/renderer/src/components/native-chat/use-native-chat-provisional-launch.test.tsx b/src/renderer/src/components/native-chat/use-native-chat-provisional-launch.test.tsx index 62bad6316a9..0d39b2f1198 100644 --- a/src/renderer/src/components/native-chat/use-native-chat-provisional-launch.test.tsx +++ b/src/renderer/src/components/native-chat/use-native-chat-provisional-launch.test.tsx @@ -27,7 +27,7 @@ vi.mock('@/lib/launch-structured-agent-session', async () => { return { ...actual, launchStructuredAgentSession: mocks.launch } }) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: () => Promise.resolve(publishedTabs) })) diff --git a/src/renderer/src/components/terminal-pane/TerminalPaneHeaderOverlay.test.tsx b/src/renderer/src/components/terminal-pane/TerminalPaneHeaderOverlay.test.tsx index af0094d6b8e..cb693a3c4e5 100644 --- a/src/renderer/src/components/terminal-pane/TerminalPaneHeaderOverlay.test.tsx +++ b/src/renderer/src/components/terminal-pane/TerminalPaneHeaderOverlay.test.tsx @@ -7,7 +7,7 @@ import path from 'node:path' import { isTerminalLeafId } from '../../../../shared/stable-pane-id' import { afterEach, describe, expect, it, vi } from 'vitest' import type { ManagedPane, PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import TerminalPaneHeaderOverlay from './TerminalPaneHeaderOverlay' import { encodeWorkspaceFilePaths, diff --git a/src/renderer/src/components/terminal-pane/TerminalPaneHeaderOverlay.tsx b/src/renderer/src/components/terminal-pane/TerminalPaneHeaderOverlay.tsx index f15f6954822..7c73ed4ff3a 100644 --- a/src/renderer/src/components/terminal-pane/TerminalPaneHeaderOverlay.tsx +++ b/src/renderer/src/components/terminal-pane/TerminalPaneHeaderOverlay.tsx @@ -12,7 +12,7 @@ import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { translate } from '@/i18n/i18n' import { isImeCompositionKeyDown } from '@/lib/ime-composition-keyboard-event' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { TerminalPaneHeaderDropSurface } from './TerminalPaneHeaderDropSurface' import { makePaneKey } from '../../../../shared/stable-pane-id' diff --git a/src/renderer/src/components/terminal-pane/expand-collapse-render-stability.test.ts b/src/renderer/src/components/terminal-pane/expand-collapse-render-stability.test.ts index bb31983db25..e07accd06eb 100644 --- a/src/renderer/src/components/terminal-pane/expand-collapse-render-stability.test.ts +++ b/src/renderer/src/components/terminal-pane/expand-collapse-render-stability.test.ts @@ -2,9 +2,9 @@ import { cleanup, renderHook } from '@testing-library/react' import { afterEach, describe, expect, it, vi } from 'vitest' import type { PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { useExpandCollapseActions } from './expand-collapse' -import { useTerminalKeyboardShortcuts } from './keyboard-handlers' +import { useTerminalKeyboardShortcuts } from './terminal-keyboard-hook' type ExpandCollapseHookState = Parameters[0] type KeyboardHandlersDeps = Parameters[0] diff --git a/src/renderer/src/components/terminal-pane/issue-21762-tracking-mode-middle-click-double-paste.repro.test.ts b/src/renderer/src/components/terminal-pane/issue-21762-tracking-mode-middle-click-double-paste.repro.test.ts index 7b0225092da..ae85266b7b8 100644 --- a/src/renderer/src/components/terminal-pane/issue-21762-tracking-mode-middle-click-double-paste.repro.test.ts +++ b/src/renderer/src/components/terminal-pane/issue-21762-tracking-mode-middle-click-double-paste.repro.test.ts @@ -38,10 +38,8 @@ vi.mock('./terminal-pane-split-with-inherited-cwd', () => ({ splitTerminalPaneWithInheritedCwd: vi.fn() })) vi.mock('@/lib/connection-context', () => ({ getConnectionId: () => null })) -vi.mock('./terminal-paste-coordinator', () => ({ - planTerminalPasteWithYield: vi.fn(), - executeTerminalPastePlan: vi.fn() -})) +vi.mock('./terminal-paste-coordinator', () => ({ planTerminalPasteWithYield: vi.fn() })) +vi.mock('./terminal-paste-executor', () => ({ executeTerminalPastePlan: vi.fn() })) vi.mock('./terminal-paste-runtime', () => ({ resolveTerminalPasteRuntime: vi.fn() })) vi.mock('./terminal-bracketed-paste', () => ({ pasteTerminalText: vi.fn() })) vi.mock('./terminal-pty-paste-writer', () => ({ writeTerminalPastePtyInput: vi.fn() })) diff --git a/src/renderer/src/components/terminal-pane/keyboard-handlers-ime-composing-chord.test.tsx b/src/renderer/src/components/terminal-pane/keyboard-handlers-ime-composing-chord.test.tsx index b6fe8de3001..62cb395e5cf 100644 --- a/src/renderer/src/components/terminal-pane/keyboard-handlers-ime-composing-chord.test.tsx +++ b/src/renderer/src/components/terminal-pane/keyboard-handlers-ime-composing-chord.test.tsx @@ -8,14 +8,14 @@ import { cleanup, renderHook } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { installTerminalImeCompositionRoute, XTERM_COMPOSITION_SESSION_END_EVENT, XTERM_COMPOSITION_SESSION_START_EVENT } from './terminal-ime-composition-route' import { TERMINAL_IME_DEFERRED_CHORD_ABANDON_MS } from './terminal-ime-deferred-chord' -import { useTerminalKeyboardShortcuts } from './keyboard-handlers' +import { useTerminalKeyboardShortcuts } from './terminal-keyboard-hook' type KeyboardHandlersDeps = Parameters[0] diff --git a/src/renderer/src/components/terminal-pane/keyboard-handlers-ime-enter-keyup.test.tsx b/src/renderer/src/components/terminal-pane/keyboard-handlers-ime-enter-keyup.test.tsx index 8a84eddbcef..892d1ddd71d 100644 --- a/src/renderer/src/components/terminal-pane/keyboard-handlers-ime-enter-keyup.test.tsx +++ b/src/renderer/src/components/terminal-pane/keyboard-handlers-ime-enter-keyup.test.tsx @@ -2,8 +2,8 @@ import { cleanup, renderHook } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' -import { useTerminalKeyboardShortcuts } from './keyboard-handlers' +import type { PtyTransport } from './pty-transport-types' +import { useTerminalKeyboardShortcuts } from './terminal-keyboard-hook' import { installTerminalImeCompositionRoute, XTERM_COMPOSITION_SESSION_START_EVENT diff --git a/src/renderer/src/components/terminal-pane/keyboard-handlers-ime.test.tsx b/src/renderer/src/components/terminal-pane/keyboard-handlers-ime.test.tsx index 3e1e6f89459..4107bf1d0bc 100644 --- a/src/renderer/src/components/terminal-pane/keyboard-handlers-ime.test.tsx +++ b/src/renderer/src/components/terminal-pane/keyboard-handlers-ime.test.tsx @@ -2,9 +2,9 @@ import { cleanup, renderHook } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { useExpandCollapseActions } from './expand-collapse' -import { useTerminalKeyboardShortcuts } from './keyboard-handlers' +import { useTerminalKeyboardShortcuts } from './terminal-keyboard-hook' import { installTerminalImeCompositionRoute, XTERM_COMPOSITION_SESSION_START_EVENT diff --git a/src/renderer/src/components/terminal-pane/keyboard-handlers.test.ts b/src/renderer/src/components/terminal-pane/keyboard-handlers.test.ts index 67b6cd035ce..309fa567a46 100644 --- a/src/renderer/src/components/terminal-pane/keyboard-handlers.test.ts +++ b/src/renderer/src/components/terminal-pane/keyboard-handlers.test.ts @@ -6,7 +6,7 @@ import { matchSearchNavigate, resolveTerminalKeyboardShortcutAction, runTerminalSearchNavigation -} from './keyboard-handlers' +} from './terminal-keyboard-shortcut-matching' function makeKeyEvent( overrides: Partial<{ diff --git a/src/renderer/src/components/terminal-pane/keyboard-handlers.ts b/src/renderer/src/components/terminal-pane/keyboard-handlers.ts deleted file mode 100644 index 8496d20f352..00000000000 --- a/src/renderer/src/components/terminal-pane/keyboard-handlers.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { useTerminalKeyboardShortcuts } from './terminal-keyboard-hook' - -export type { SearchState, SearchNavigationDirection } from './terminal-keyboard-shortcut-matching' - -export { - resolveTerminalKeyboardShortcutAction, - recordKeyboardCreatedTerminalPaneSplit, - matchSearchNavigate, - runTerminalSearchNavigation, - matchFileSearchShortcut -} from './terminal-keyboard-shortcut-matching' - -export { useTerminalKeyboardShortcuts } diff --git a/src/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.ts b/src/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.ts index 7ea538bfd56..5b507ca3866 100644 --- a/src/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.ts +++ b/src/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.ts @@ -20,7 +20,7 @@ import { readInFlightCommandCodeTurn } from './parked-terminal-command-status' import { subscribeToPtyData } from './pty-data-sidecar-subscriptions' -import { createPtyOutputProcessor } from './pty-transport' +import { createPtyOutputProcessor } from './pty-output-processor' import { isRendererHiddenPtyDeliveryGateEnabled } from './terminal-hidden-delivery-gate' import { isMainTerminalSideEffectAuthorityForPty, diff --git a/src/renderer/src/components/terminal-pane/pty-connection-startup-command-delivery.test.ts b/src/renderer/src/components/terminal-pane/pty-connection-startup-command-delivery.test.ts index 4a03a0ae6b2..65c1bfe9863 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection-startup-command-delivery.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection-startup-command-delivery.test.ts @@ -1,6 +1,6 @@ import type * as React from 'react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { TERMINAL_PASTE_DIRECT_MAX_BYTES } from './terminal-paste-coordinator' +import { TERMINAL_PASTE_DIRECT_MAX_BYTES } from './terminal-paste-limits' import { makePaneKey } from '../../../../shared/stable-pane-id' import { toAppSshPtyId } from '../../../../shared/ssh-pty-id' import { flushAsyncTicks, drainPendingTimeouts } from './pty-connection-test-async' diff --git a/src/renderer/src/components/terminal-pane/pty-connection-types.ts b/src/renderer/src/components/terminal-pane/pty-connection-types.ts index 1b4e693c948..2dc70000e29 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection-types.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection-types.ts @@ -1,6 +1,6 @@ import type { NotificationWorkspaceOwner } from '../../../../shared/notification-source' import type { AgentAttentionUnreadReason } from '@/attention/agent-attention-contract' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport, PtyTransportRecoveryState } from './pty-transport-types' import type { SessionRestoredBannerReason } from './session-restored-banner-pane-state' import type { ReplayingPanesRef } from './replay-guard' import type { RestoredViewportBlankingPanesRef } from './terminal-restored-viewport' @@ -16,7 +16,6 @@ import type { SleepingAgentLaunchConfig } from '../../../../shared/agent-session-resume' import type { TerminalKittyKeyboardModeTracker } from '../../../../shared/terminal-kitty-keyboard-mode-tracker' -import type { PtyTransportRecoveryState } from './pty-transport-types' import type { SessionOptionValue } from '../../../../shared/native-chat-session-options' import type { PtyPreconnectInputEntry } from './pty-preconnect-input-buffer' diff --git a/src/renderer/src/components/terminal-pane/pty-connection/deferred-cold-restore-and-snapshot.ts b/src/renderer/src/components/terminal-pane/pty-connection/deferred-cold-restore-and-snapshot.ts index d6ee5a49dc6..0aa9ddaaf4b 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/deferred-cold-restore-and-snapshot.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/deferred-cold-restore-and-snapshot.ts @@ -1,5 +1,5 @@ import { useAppStore } from '@/store' -import type { PtyReplayDataMeta } from '../pty-transport' +import type { PtyReplayDataMeta } from '../pty-transport-types' import { INITIAL_MODE_2031_REPLY_SCAN_STATE } from '../../../../../shared/terminal-color-scheme-protocol' import { waitForTerminalOutputParsed } from '@/lib/pane-manager/pane-terminal-output-scheduler' import { executeTerminalStartupCommandPaste } from '../terminal-startup-command-paste' diff --git a/src/renderer/src/components/terminal-pane/pty-connection/e2e-terminal-pty-harness.ts b/src/renderer/src/components/terminal-pane/pty-connection/e2e-terminal-pty-harness.ts index 8939a63b6c1..d01f8078597 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/e2e-terminal-pty-harness.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/e2e-terminal-pty-harness.ts @@ -1,5 +1,5 @@ import { e2eConfig } from '@/lib/e2e-config' -import type { PtyBufferSnapshot } from '../pty-transport' +import type { PtyBufferSnapshot } from '../pty-transport-types' import type { PtyDataMeta } from '../pty-dispatcher' type E2eTerminalPtyDataInjectionApi = { diff --git a/src/renderer/src/components/terminal-pane/pty-connection/hidden-output-snapshot-serialize.ts b/src/renderer/src/components/terminal-pane/pty-connection/hidden-output-snapshot-serialize.ts index 7f880916de7..16050e74100 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/hidden-output-snapshot-serialize.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/hidden-output-snapshot-serialize.ts @@ -1,11 +1,11 @@ import { isRemoteRuntimePtyId } from '../../../../../shared/remote-runtime-pty-id' -import { isHostAnsweredSnapshotRetryCause } from '@/runtime/remote-runtime-terminal-multiplexer' +import { isHostAnsweredSnapshotRetryCause } from '@/runtime/remote-runtime-terminal-multiplexer-types' import { onTerminalScrollIntentFollowOutput } from '@/lib/pane-manager/terminal-scroll-intent' import { shouldWritePtyOutputForeground } from './foreground-output-scan' import { readE2eHiddenSnapshotOverride } from './e2e-terminal-pty-harness' -import type { PtyBufferSnapshot } from '../pty-transport' +import type { PtyBufferSnapshot } from '../pty-transport-types' import type { ConnectPanePtySession } from './connect-pane-pty-session' export type HiddenOutputSnapshotResult = diff --git a/src/renderer/src/components/terminal-pane/pty-connection/park-reveal-snapshot-verdict.ts b/src/renderer/src/components/terminal-pane/pty-connection/park-reveal-snapshot-verdict.ts index c6aa5ea7455..f6532a55b69 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/park-reveal-snapshot-verdict.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/park-reveal-snapshot-verdict.ts @@ -3,7 +3,7 @@ import { RESET_GRAPHIC_RENDITION } from '../../../../../shared/terminal-mode-res import { redactPtyIdForDiagnostics } from '../../../../../shared/pty-delivery-diagnostics' import { writeTerminalOutput } from '@/lib/pane-manager/pane-terminal-output-scheduler' import { recordTerminalFreezeBreadcrumb } from '../terminal-freeze-breadcrumbs' -import type { PtyBufferSnapshot } from '../pty-transport' +import type { PtyBufferSnapshot } from '../pty-transport-types' import type { ConnectPanePtySession } from './connect-pane-pty-session' import { PARK_REVEAL_NO_HOST_IMAGE_WARNING } from './hidden-output-restore-limits' diff --git a/src/renderer/src/components/terminal-pane/pty-connection/reattach-payload-context.ts b/src/renderer/src/components/terminal-pane/pty-connection/reattach-payload-context.ts index da10330affb..fb21e2e390f 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/reattach-payload-context.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/reattach-payload-context.ts @@ -1,4 +1,4 @@ -import type { PtyBufferSnapshot, PtyConnectResult } from '../pty-transport' +import type { PtyBufferSnapshot, PtyConnectResult } from '../pty-transport-types' import type { ColdRestoreAgentResumeStartup } from './fresh-spawn-types' // Per-call locals for applyReattachPayload so overlapping reattaches stay isolated. diff --git a/src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts b/src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts index 83e6a1039fd..8dc18c453af 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts @@ -1,6 +1,6 @@ import { isRemoteRuntimePtyId } from '../../../../../shared/remote-runtime-pty-id' import { scheduleRuntimeGraphSync } from '@/runtime/sync-runtime-graph' -import type { PtyBufferSnapshot, PtyConnectResult } from '../pty-transport' +import type { PtyBufferSnapshot, PtyConnectResult } from '../pty-transport-types' import { warnTerminalLifecycleAnomaly } from '../terminal-lifecycle-diagnostics' // Why: a restored pane's stale-account prompt can only be raised once a PTY is // actually attached — nothing is inspectable while the session hydrates. diff --git a/src/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.ts b/src/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.ts index e6d2187f5dd..094dd825afc 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/sleeping-record-access.ts @@ -1,5 +1,5 @@ import { useAppStore } from '@/store' -import type { PtyConnectResult } from '../pty-transport' +import type { PtyConnectResult } from '../pty-transport-types' import { createBrowserUuid } from '@/lib/browser-uuid' import { parseLegacyNumericPaneKey } from '../../../../../shared/stable-pane-id' import { neutralTerminalTitle } from '../../../../../shared/terminal-pane-title-reset' diff --git a/src/renderer/src/components/terminal-pane/pty-connection/transport-output-callbacks.ts b/src/renderer/src/components/terminal-pane/pty-connection/transport-output-callbacks.ts index e304e377efb..46598014fc8 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/transport-output-callbacks.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/transport-output-callbacks.ts @@ -1,7 +1,6 @@ import type { SpawnDeferralReason } from '../../../../../shared/host-spawn-admission' import { createTerminalStartupTiming } from '../terminal-startup-timing' -import type { PtyReplayDataMeta } from '../pty-transport' -import type { PtyTransportRecoveryState } from '../pty-transport-types' +import type { PtyReplayDataMeta, PtyTransportRecoveryState } from '../pty-transport-types' import type { PtyDataMeta } from '../pty-dispatcher' import type { PtyPaneStartup } from '../pty-connection-types' diff --git a/src/renderer/src/components/terminal-pane/pty-side-effect-pending-census.test.ts b/src/renderer/src/components/terminal-pane/pty-side-effect-pending-census.test.ts index eb32488da4c..2a5f1ce247f 100644 --- a/src/renderer/src/components/terminal-pane/pty-side-effect-pending-census.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-side-effect-pending-census.test.ts @@ -70,7 +70,7 @@ describe('pty side-effect pending census', () => { it('tracks a live output processor queue through enqueue, drain, and dispose', async () => { vi.useFakeTimers() - const { createPtyOutputProcessor } = await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') const before = ptySideEffectCounts() const processor = createPtyOutputProcessor({ onTitleChange: vi.fn() }) @@ -97,7 +97,7 @@ describe('pty side-effect pending census', () => { it('excludes cleared consumed entries from retention after a bounded drain', async () => { vi.useFakeTimers() - const { createPtyOutputProcessor } = await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') const before = ptySideEffectCounts() const processor = createPtyOutputProcessor({ onTitleChange: vi.fn() }) diff --git a/src/renderer/src/components/terminal-pane/pty-transport-eager-buffer-replay.test.ts b/src/renderer/src/components/terminal-pane/pty-transport-eager-buffer-replay.test.ts index 436e0dde0ec..59bf169babe 100644 --- a/src/renderer/src/components/terminal-pane/pty-transport-eager-buffer-replay.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-transport-eager-buffer-replay.test.ts @@ -32,7 +32,8 @@ describe('createIpcPtyTransport', () => { it('suppresses attention side effects when replaying eager-buffered data during attach', async () => { // Why: replayed eager output must not raise fresh alerts — bell/idle suppressed, title still restores. - const { createIpcPtyTransport, registerEagerPtyBuffer } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') const onTitleChange = vi.fn() const onBell = vi.fn() const onAgentBecameIdle = vi.fn() @@ -63,7 +64,8 @@ describe('createIpcPtyTransport', () => { it('resets replay parser state after deferred side effects drain', async () => { // Why: cleanup must await deferred replay side effects, else a partial OSC makes the first live BEL look like an OSC terminator. - const { createIpcPtyTransport, registerEagerPtyBuffer } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') const onBell = vi.fn() registerEagerPtyBuffer('pty-restored', vi.fn()) @@ -86,8 +88,8 @@ describe('createIpcPtyTransport', () => { }) it('keeps exit sidecars after eager-buffered PTYs attach to a terminal', async () => { - const { createIpcPtyTransport, registerEagerPtyBuffer, subscribeToPtyExit } = - await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { registerEagerPtyBuffer, subscribeToPtyExit } = await import('./pty-dispatcher') const eagerExit = vi.fn() const sidecarExit = vi.fn() @@ -105,7 +107,7 @@ describe('createIpcPtyTransport', () => { }) it('bounds the eager buffer to its cap and keeps the most recent output', async () => { - const { registerEagerPtyBuffer } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') const cap = 512 * 1024 const handle = registerEagerPtyBuffer('pty-restored', vi.fn()) @@ -122,7 +124,7 @@ describe('createIpcPtyTransport', () => { }) it('caps a single oversized eager chunk to its most-recent tail', async () => { - const { registerEagerPtyBuffer } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') const cap = 512 * 1024 const handle = registerEagerPtyBuffer('pty-restored', vi.fn()) @@ -135,7 +137,7 @@ describe('createIpcPtyTransport', () => { }) it('drains pre-handler data and exit into eager buffers for fast background PTYs', async () => { - const { ensurePtyDispatcher, registerEagerPtyBuffer } = await import('./pty-transport') + const { ensurePtyDispatcher, registerEagerPtyBuffer } = await import('./pty-dispatcher') const onEagerExit = vi.fn() ensurePtyDispatcher() @@ -150,7 +152,7 @@ describe('createIpcPtyTransport', () => { }) it('enforces the eager buffer cap in UTF-8 bytes for multi-byte output', async () => { - const { registerEagerPtyBuffer } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') const cap = 512 * 1024 const handle = registerEagerPtyBuffer('pty-restored', vi.fn()) const output = `${'界'.repeat(cap)}PROMPT$` @@ -166,7 +168,7 @@ describe('createIpcPtyTransport', () => { }) it('preserves a BOM when it starts the retained oversized eager-buffer tail', async () => { - const { registerEagerPtyBuffer } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') const cap = 512 * 1024 const handle = registerEagerPtyBuffer('pty-restored', vi.fn()) @@ -178,7 +180,7 @@ describe('createIpcPtyTransport', () => { }) it('does not use Array.shift while trimming many eager chunks', async () => { - const { registerEagerPtyBuffer } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') const handle = registerEagerPtyBuffer('pty-restored', vi.fn()) const originalShift = Array.prototype.shift @@ -206,7 +208,8 @@ describe('createIpcPtyTransport', () => { }) it('routes eager-buffered bytes through onReplayData so the renderer can engage the replay guard', async () => { - const { createIpcPtyTransport, registerEagerPtyBuffer } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') // Why: eager bytes carry DA1-style query sequences; onData bypasses the replay guard so xterm auto-replies, leaking input. const bufferedPayload = 'hello\x1b[cworld' @@ -235,7 +238,8 @@ describe('createIpcPtyTransport', () => { }) it('replays display-bearing eager-buffered output with default clear semantics', async () => { - const { createIpcPtyTransport, registerEagerPtyBuffer } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') const bufferedPayload = '\x1b[?1049hAutomation agent is running' registerEagerPtyBuffer('pty-automation', vi.fn()) @@ -258,7 +262,8 @@ describe('createIpcPtyTransport', () => { }) it('does not clear before replaying title-only eager-buffered output', async () => { - const { createIpcPtyTransport, registerEagerPtyBuffer } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') const bufferedPayload = '\x1b]0;Restored title\x07' registerEagerPtyBuffer('pty-title-only', vi.fn()) @@ -286,7 +291,8 @@ describe('createIpcPtyTransport', () => { }) it('does not write an unterminated title-only eager buffer into replay', async () => { - const { createIpcPtyTransport, registerEagerPtyBuffer } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') const bufferedPayload = '\x1b]0;partial restored title' registerEagerPtyBuffer('pty-partial-title', vi.fn()) @@ -311,7 +317,8 @@ describe('createIpcPtyTransport', () => { }) it('does not let an unterminated OSC 9999 eager buffer swallow live output', async () => { - const { createIpcPtyTransport, registerEagerPtyBuffer } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') registerEagerPtyBuffer('pty-partial-status', vi.fn()) onData?.({ @@ -342,7 +349,8 @@ describe('createIpcPtyTransport', () => { }) it('does not clear before replaying OSC 9999-only eager-buffered output', async () => { - const { createIpcPtyTransport, registerEagerPtyBuffer } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') registerEagerPtyBuffer('pty-status-only', vi.fn()) onData?.({ @@ -387,7 +395,8 @@ describe('createIpcPtyTransport', () => { }) it('does not clear on attach when the eager buffer is empty', async () => { - const { createIpcPtyTransport, registerEagerPtyBuffer } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') registerEagerPtyBuffer('pty-attached', vi.fn()) const transport = createIpcPtyTransport() @@ -408,7 +417,8 @@ describe('createIpcPtyTransport', () => { }) it('skips the attach-time clear sequence for alternate-screen sessions', async () => { - const { createIpcPtyTransport, registerEagerPtyBuffer } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { registerEagerPtyBuffer } = await import('./pty-dispatcher') const bufferedPayload = '\x1b[?1049hAlternate screen is already restored' registerEagerPtyBuffer('pty-alt-screen', vi.fn()) diff --git a/src/renderer/src/components/terminal-pane/pty-transport-handler-suspension.test.ts b/src/renderer/src/components/terminal-pane/pty-transport-handler-suspension.test.ts index 9823d5b5282..bd7a7b99c3c 100644 --- a/src/renderer/src/components/terminal-pane/pty-transport-handler-suspension.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-transport-handler-suspension.test.ts @@ -91,7 +91,8 @@ describe('createIpcPtyTransport', () => { }) it('unregisterPtyDataHandlers prevents final data burst from triggering notifications', async () => { - const { createIpcPtyTransport, unregisterPtyDataHandlers } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { unregisterPtyDataHandlers } = await import('./pty-dispatcher') const onTitleChange = vi.fn() const onBell = vi.fn() const onAgentBecameIdle = vi.fn() @@ -142,11 +143,9 @@ describe('createIpcPtyTransport', () => { }) it('restores data handlers when an intentional shutdown fails before exit', async () => { - const { - createIpcPtyTransport, - restorePtyDataHandlersAfterFailedShutdown, - unregisterPtyDataHandlers - } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { restorePtyDataHandlersAfterFailedShutdown, unregisterPtyDataHandlers } = + await import('./pty-dispatcher') const onDataCallback = vi.fn() const transport = createIpcPtyTransport() @@ -164,11 +163,9 @@ describe('createIpcPtyTransport', () => { }) it('retains rollback replay until a pane detached during sleep registers again', async () => { - const { - createIpcPtyTransport, - restorePtyDataHandlersAfterFailedShutdown, - unregisterPtyDataHandlers - } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { restorePtyDataHandlersAfterFailedShutdown, unregisterPtyDataHandlers } = + await import('./pty-dispatcher') const first = createIpcPtyTransport() await first.connect({ url: '', callbacks: { onReplayData: vi.fn() } }) @@ -188,11 +185,9 @@ describe('createIpcPtyTransport', () => { }) it('keeps handlers suspended until every overlapping shutdown owner rolls back', async () => { - const { - createIpcPtyTransport, - restorePtyDataHandlersAfterFailedShutdown, - unregisterPtyDataHandlers - } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { restorePtyDataHandlersAfterFailedShutdown, unregisterPtyDataHandlers } = + await import('./pty-dispatcher') const { ptyDataSidecars } = await import('./pty-dispatcher') const onDataCallback = vi.fn() const sidecar = vi.fn() @@ -218,7 +213,8 @@ describe('createIpcPtyTransport', () => { it('unregisterPtyDataHandlers cancels staleTitleTimer so it cannot fire stale idle transition', async () => { vi.useFakeTimers() try { - const { createIpcPtyTransport, unregisterPtyDataHandlers } = await import('./pty-transport') + const { createIpcPtyTransport } = await import('./pty-transport') + const { unregisterPtyDataHandlers } = await import('./pty-dispatcher') const onTitleChange = vi.fn() const onAgentBecameIdle = vi.fn() const onAgentBecameWorking = vi.fn() diff --git a/src/renderer/src/components/terminal-pane/pty-transport-output-side-effects.test.ts b/src/renderer/src/components/terminal-pane/pty-transport-output-side-effects.test.ts index e7818c52135..1135a4b31d1 100644 --- a/src/renderer/src/components/terminal-pane/pty-transport-output-side-effects.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-transport-output-side-effects.test.ts @@ -65,7 +65,7 @@ describe('createIpcPtyTransport', () => { it('drops the OSC-9999 cross-chunk carry on resetAgentStatusCarry', async () => { // Why: a restore marker means bytes dropped, so a carried partial OSC-9999 prefix would eat the next chunk's head. - const { createPtyOutputProcessor } = await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') const processor = createPtyOutputProcessor({}) const callbacks = { onData: vi.fn() } @@ -81,7 +81,7 @@ describe('createIpcPtyTransport', () => { it('does not schedule PTY side-effect drains for ordinary output with no working title', async () => { vi.useFakeTimers() try { - const { createPtyOutputProcessor } = await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') const onTitleChange = vi.fn() const onBell = vi.fn() const processor = createPtyOutputProcessor({ onTitleChange, onBell }) @@ -101,7 +101,7 @@ describe('createIpcPtyTransport', () => { it('compacts ignored Cursor native titles into one deferred drain', async () => { vi.useFakeTimers() try { - const { createPtyOutputProcessor } = await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') const onTitleChange = vi.fn() const processor = createPtyOutputProcessor({ onTitleChange }) const callbacks = { onData: vi.fn() } @@ -123,7 +123,7 @@ describe('createIpcPtyTransport', () => { it('lets an ignored Cursor native title clear a pending stale-title fallback', async () => { vi.useFakeTimers() try { - const { createPtyOutputProcessor } = await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') const onAgentBecameIdle = vi.fn() const processor = createPtyOutputProcessor({ onTitleChange: vi.fn(), @@ -150,7 +150,7 @@ describe('createIpcPtyTransport', () => { it('re-arms stale-title fallback after a later title-free output scan', async () => { vi.useFakeTimers() try { - const { createPtyOutputProcessor } = await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') const onTitleChange = vi.fn() const processor = createPtyOutputProcessor({ onTitleChange, @@ -176,7 +176,7 @@ describe('createIpcPtyTransport', () => { it('preserves stale-title detection after compacting deferred side effects', async () => { vi.useFakeTimers() try { - const { createPtyOutputProcessor } = await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') const onTitleChange = vi.fn() const onAgentBecameWorking = vi.fn() const onAgentBecameIdle = vi.fn() @@ -207,7 +207,7 @@ describe('createIpcPtyTransport', () => { it('limits deferred PTY side-effect work per timer tick', async () => { vi.useFakeTimers() try { - const { createPtyOutputProcessor } = await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') const onTitleChange = vi.fn() const processor = createPtyOutputProcessor({ onTitleChange }) const callbacks = { onData: vi.fn() } @@ -233,7 +233,7 @@ describe('createIpcPtyTransport', () => { it('limits coalesced OSC titles in one PTY chunk per timer tick', async () => { vi.useFakeTimers() try { - const { createPtyOutputProcessor } = await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') const onTitleChange = vi.fn() const processor = createPtyOutputProcessor({ onTitleChange }) const callbacks = { onData: vi.fn() } @@ -256,7 +256,7 @@ describe('createIpcPtyTransport', () => { it('flushes all remaining PTY side effects after a partial bounded drain', async () => { vi.useFakeTimers() try { - const { createPtyOutputProcessor } = await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') const onTitleChange = vi.fn() const processor = createPtyOutputProcessor({ onTitleChange }) const callbacks = { onData: vi.fn() } @@ -280,8 +280,8 @@ describe('createIpcPtyTransport', () => { it('bounds the deferred side-effect queue under a stalled drain, keeping the newest title and a pending bell', async () => { vi.useFakeTimers() try { - const { createPtyOutputProcessor, MAX_PENDING_PTY_SIDE_EFFECTS } = - await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') + const { MAX_PENDING_PTY_SIDE_EFFECTS } = await import('./pty-output-side-effect-queue') const onTitleChange = vi.fn() const onBell = vi.fn() const processor = createPtyOutputProcessor({ onTitleChange, onBell }) @@ -317,11 +317,9 @@ describe('createIpcPtyTransport', () => { it('collapses evicted agent-status payloads onto the survivor, keeping the newest', async () => { vi.useFakeTimers() try { - const { - createPtyOutputProcessor, - MAX_PENDING_PTY_SIDE_EFFECTS, - MAX_EVICTED_AGENT_STATUS_PAYLOAD_CARRY - } = await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') + const { MAX_PENDING_PTY_SIDE_EFFECTS, MAX_EVICTED_AGENT_STATUS_PAYLOAD_CARRY } = + await import('./pty-output-side-effect-queue') const onAgentStatus = vi.fn() const processor = createPtyOutputProcessor({ onAgentStatus }) const callbacks = { onData: vi.fn() } @@ -352,7 +350,7 @@ describe('createIpcPtyTransport', () => { it('delivers every side effect in order when the queue stays below the cap', async () => { vi.useFakeTimers() try { - const { createPtyOutputProcessor } = await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') const onTitleChange = vi.fn() const onBell = vi.fn() const onAgentStatus = vi.fn() @@ -378,7 +376,7 @@ describe('createIpcPtyTransport', () => { it('still runs stale-title detection when an OSC status chunk has no title', async () => { vi.useFakeTimers() try { - const { createPtyOutputProcessor } = await import('./pty-transport') + const { createPtyOutputProcessor } = await import('./pty-output-processor') const onTitleChange = vi.fn() const onAgentStatus = vi.fn() const onAgentBecameIdle = vi.fn() diff --git a/src/renderer/src/components/terminal-pane/pty-transport-types.ts b/src/renderer/src/components/terminal-pane/pty-transport-types.ts index 3b37103cb6a..0ff00c5a167 100644 --- a/src/renderer/src/components/terminal-pane/pty-transport-types.ts +++ b/src/renderer/src/components/terminal-pane/pty-transport-types.ts @@ -20,7 +20,7 @@ import type { TuiAgent } from '../../../../shared/tui-agent' import type { TerminalPanePlacement } from '../../../../shared/terminal-pane-placement' import type { ExecutionHostId } from '../../../../shared/execution-host' import type { PtyDataMeta } from './pty-dispatcher' -import type { RemoteRuntimeSnapshotOutcome } from '../../runtime/remote-runtime-terminal-multiplexer' +import type { RemoteRuntimeSnapshotOutcome } from '../../runtime/remote-runtime-terminal-multiplexer-types' import type { AcceptedInputOptions, PtyPreconnectInputEntry } from './pty-preconnect-input-buffer' export type PtyBufferSnapshot = { diff --git a/src/renderer/src/components/terminal-pane/pty-transport.ts b/src/renderer/src/components/terminal-pane/pty-transport.ts index 49f0613df64..0e213f1f26d 100644 --- a/src/renderer/src/components/terminal-pane/pty-transport.ts +++ b/src/renderer/src/components/terminal-pane/pty-transport.ts @@ -8,30 +8,6 @@ import { createPtyPreconnectInputBuffer } from './pty-preconnect-input-buffer' import type { IpcPtyTransportOptions, PtyTransport } from './pty-transport-types' import type { TerminalInputKind } from '../../../../shared/terminal-input-kind' -export { - ensurePtyDispatcher, - getEagerPtyBufferHandle, - registerEagerPtyBuffer, - restorePtyDataHandlersAfterFailedShutdown, - subscribeToPtyExit, - unregisterPtyDataHandlers -} from './pty-dispatcher' -export type { EagerPtyHandle } from './pty-dispatcher' -export { extractLastOscTitle } from '../../../../shared/agent-detection' -export { createPtyOutputProcessor } from './pty-output-processor' -export { - MAX_EVICTED_AGENT_STATUS_PAYLOAD_CARRY, - MAX_PENDING_PTY_SIDE_EFFECTS -} from './pty-output-side-effect-queue' -export type { - IpcPtyTransportOptions, - LocalPtySessionMetadata, - PtyBufferSnapshot, - PtyConnectResult, - PtyReplayDataMeta, - PtyTransport -} from './pty-transport-types' - export function createIpcPtyTransport(opts: IpcPtyTransportOptions = {}): PtyTransport { const { connectionId, diff --git a/src/renderer/src/components/terminal-pane/remote-park-reveal-unverifiable-retry.test.ts b/src/renderer/src/components/terminal-pane/remote-park-reveal-unverifiable-retry.test.ts index 3f7630ec9e8..7c5711870df 100644 --- a/src/renderer/src/components/terminal-pane/remote-park-reveal-unverifiable-retry.test.ts +++ b/src/renderer/src/components/terminal-pane/remote-park-reveal-unverifiable-retry.test.ts @@ -114,9 +114,7 @@ function nextQueuedTransport(): MockTransport { return nextTransport } -vi.mock('./pty-transport', () => ({ - createIpcPtyTransport: vi.fn(() => nextQueuedTransport()) -})) +vi.mock('./pty-transport', () => ({ createIpcPtyTransport: vi.fn(() => nextQueuedTransport()) })) vi.mock('./remote-runtime-pty-transport', () => ({ createRemoteRuntimePtyTransport: vi.fn(() => nextQueuedTransport()) diff --git a/src/renderer/src/components/terminal-pane/remote-runtime-input-journal.ts b/src/renderer/src/components/terminal-pane/remote-runtime-input-journal.ts index 93981680e15..2dcb408611b 100644 --- a/src/renderer/src/components/terminal-pane/remote-runtime-input-journal.ts +++ b/src/renderer/src/components/terminal-pane/remote-runtime-input-journal.ts @@ -1,6 +1,6 @@ import { createBrowserUuid } from '@/lib/browser-uuid' import type { TerminalInputAckKind } from '../../../../shared/terminal-stream-protocol' -import type { RemoteRuntimeMultiplexedTerminal } from '../../runtime/remote-runtime-terminal-multiplexer' +import type { RemoteRuntimeMultiplexedTerminal } from '../../runtime/remote-runtime-terminal-multiplexer-types' import { isSameRemoteRuntimeInputEndpoint, type RemoteRuntimeInputEndpoint diff --git a/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-input-fallback.test.ts b/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-input-fallback.test.ts index 690a80db78c..b567c0f16dc 100644 --- a/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-input-fallback.test.ts +++ b/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-input-fallback.test.ts @@ -254,7 +254,6 @@ describe('createRemoteRuntimePtyTransport', () => { return newStream }) vi.doMock('../../runtime/remote-runtime-terminal-multiplexer', () => ({ - REMOTE_TERMINAL_SNAPSHOT_TOO_LARGE: 'remote_terminal_snapshot_too_large', getRemoteRuntimeTerminalMultiplexer: vi.fn(() => ({ subscribeTerminal })) })) const { createRemoteRuntimePtyTransport } = await import('./remote-runtime-pty-transport') diff --git a/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts b/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts index b949ad8bd89..b5d21bfd26a 100644 --- a/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts +++ b/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts @@ -45,7 +45,7 @@ import type { PtyTransport, PtyTransportRecoveryState } from './pty-transport-types' -import { createPtyOutputProcessor } from './pty-transport' +import { createPtyOutputProcessor } from './pty-output-processor' import { isSshSessionGoneError } from './pty-connection/pty-connect-limits' import { RuntimeRpcCallError, unwrapRuntimeRpcResult } from '../../runtime/runtime-rpc-client' import { @@ -54,12 +54,12 @@ import { runtimeTerminalErrorMessage, toRemoteRuntimePtyId } from '../../runtime/runtime-terminal-stream' -import { - getRemoteRuntimeTerminalMultiplexer, - REMOTE_TERMINAL_SNAPSHOT_TOO_LARGE, - type RemoteRuntimeMultiplexedTerminal, - type RemoteRuntimeSnapshotOutcome -} from '../../runtime/remote-runtime-terminal-multiplexer' +import { getRemoteRuntimeTerminalMultiplexer } from '../../runtime/remote-runtime-terminal-multiplexer' +import { REMOTE_TERMINAL_SNAPSHOT_TOO_LARGE } from '../../runtime/remote-runtime-terminal-snapshot-state' +import type { + RemoteRuntimeMultiplexedTerminal, + RemoteRuntimeSnapshotOutcome +} from '../../runtime/remote-runtime-terminal-multiplexer-types' import { toRuntimeTerminalWorktreeSelector, toRuntimeWorktreeSelector diff --git a/src/renderer/src/components/terminal-pane/remote-runtime-resubscribe-failure-recovery-routing.test.ts b/src/renderer/src/components/terminal-pane/remote-runtime-resubscribe-failure-recovery-routing.test.ts index 033590bc807..298128a2343 100644 --- a/src/renderer/src/components/terminal-pane/remote-runtime-resubscribe-failure-recovery-routing.test.ts +++ b/src/renderer/src/components/terminal-pane/remote-runtime-resubscribe-failure-recovery-routing.test.ts @@ -330,7 +330,7 @@ describe('remote runtime resubscribe failure: recovery routing', () => { it('keeps an oversized-snapshot resubscribe failure informational', async () => { const { REMOTE_TERMINAL_SNAPSHOT_TOO_LARGE } = - await import('../../runtime/remote-runtime-terminal-multiplexer') + await import('../../runtime/remote-runtime-terminal-snapshot-state') const onError = vi.fn() const onPtyExit = vi.fn() const transport = await attachLivePane({ onError, onPtyExit }) diff --git a/src/renderer/src/components/terminal-pane/terminal-agent-paste-bracketing.test.ts b/src/renderer/src/components/terminal-pane/terminal-agent-paste-bracketing.test.ts index 986121934ed..dcb85343082 100644 --- a/src/renderer/src/components/terminal-pane/terminal-agent-paste-bracketing.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-agent-paste-bracketing.test.ts @@ -4,12 +4,9 @@ import type { AgentStatusEntry } from '../../../../shared/agent-status-types' import type { PaneForegroundAgentEntry } from '../../store/slices/pane-foreground-agent' import { resolveProtectedMultilinePasteOptionsForPane } from './terminal-agent-paste-bracketing' import { pasteTerminalText } from './terminal-bracketed-paste' -import { - executeTerminalPastePlan, - planTerminalPaste, - type TerminalPasteTarget, - type TerminalPasteTextOptions -} from './terminal-paste-coordinator' +import { executeTerminalPastePlan } from './terminal-paste-executor' +import { planTerminalPaste } from './terminal-paste-coordinator' +import type { TerminalPasteTarget, TerminalPasteTextOptions } from './terminal-paste-model' import { resolveTerminalPasteRuntime } from './terminal-paste-runtime' const TAB_ID = 'tab-1' diff --git a/src/renderer/src/components/terminal-pane/terminal-appearance.ts b/src/renderer/src/components/terminal-pane/terminal-appearance.ts index 942e876f696..9ff0eaa4e32 100644 --- a/src/renderer/src/components/terminal-pane/terminal-appearance.ts +++ b/src/renderer/src/components/terminal-pane/terminal-appearance.ts @@ -22,7 +22,7 @@ import { } from '@/lib/pane-manager/pane-terminal-options' import { getFitOverrideForPty } from '@/lib/pane-manager/mobile-fit-overrides' import { setTerminalCursorBlinkOption } from '@/lib/pane-manager/pane-cursor-blink-suspension' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import type { EffectiveMacOptionAsAlt } from '@/lib/keyboard-layout/detect-option-as-alt' import { HEX_COLOR_RE } from '../../../../shared/color-validation' import type { TerminalViewAttributes } from '../../../../shared/terminal-view-attributes' diff --git a/src/renderer/src/components/terminal-pane/terminal-captured-input-dispatch.test.ts b/src/renderer/src/components/terminal-pane/terminal-captured-input-dispatch.test.ts index b31cb1287e1..4dbd2eec471 100644 --- a/src/renderer/src/components/terminal-pane/terminal-captured-input-dispatch.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-captured-input-dispatch.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { requestCapturedTerminalReconfirmation, sendCapturedTerminalInput diff --git a/src/renderer/src/components/terminal-pane/terminal-captured-input-dispatch.ts b/src/renderer/src/components/terminal-pane/terminal-captured-input-dispatch.ts index 5409d5420de..5f3bc29b4bc 100644 --- a/src/renderer/src/components/terminal-pane/terminal-captured-input-dispatch.ts +++ b/src/renderer/src/components/terminal-pane/terminal-captured-input-dispatch.ts @@ -1,5 +1,5 @@ import type { IDisposable } from '@xterm/xterm' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' type CapturedTerminalInputDispatch = { targetPaneMounted: boolean diff --git a/src/renderer/src/components/terminal-pane/terminal-clipboard-paste.ts b/src/renderer/src/components/terminal-pane/terminal-clipboard-paste.ts index abd0fb95b97..5464555d6b4 100644 --- a/src/renderer/src/components/terminal-pane/terminal-clipboard-paste.ts +++ b/src/renderer/src/components/terminal-pane/terminal-clipboard-paste.ts @@ -2,10 +2,8 @@ import { isClipboardTextTooLargeError, type ReadClipboardTextOptions } from '../../../../shared/clipboard-text' -import { - TERMINAL_PASTE_MAX_BYTES, - type TerminalPasteTextOptions -} from './terminal-paste-coordinator' +import { TERMINAL_PASTE_MAX_BYTES } from './terminal-paste-limits' +import type { TerminalPasteTextOptions } from './terminal-paste-model' type SaveClipboardImageAsTempFile = (args?: { connectionId?: string | null diff --git a/src/renderer/src/components/terminal-pane/terminal-drop-path-writer.ts b/src/renderer/src/components/terminal-pane/terminal-drop-path-writer.ts index 9031e3aa408..974363da50a 100644 --- a/src/renderer/src/components/terminal-pane/terminal-drop-path-writer.ts +++ b/src/renderer/src/components/terminal-pane/terminal-drop-path-writer.ts @@ -1,7 +1,7 @@ import type { PaneManager } from '@/lib/pane-manager/pane-manager' import { separateImagePasteFromFollowingText } from '../../../../shared/image-paste-following-text' import { shellEscapePath } from './pane-helpers' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { wrapTerminalBracketedPasteText } from './terminal-bracketed-paste' import { canPasteImageDropPathRaw, diff --git a/src/renderer/src/components/terminal-pane/terminal-drop-target.ts b/src/renderer/src/components/terminal-pane/terminal-drop-target.ts index fc9464aaf55..98f5af6cd77 100644 --- a/src/renderer/src/components/terminal-pane/terminal-drop-target.ts +++ b/src/renderer/src/components/terminal-pane/terminal-drop-target.ts @@ -1,5 +1,5 @@ import type { PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' export type CapturedTerminalDropTarget = { paneId: number diff --git a/src/renderer/src/components/terminal-pane/terminal-drop-transport-owner.ts b/src/renderer/src/components/terminal-pane/terminal-drop-transport-owner.ts index 57bab077d90..15afe46b2ab 100644 --- a/src/renderer/src/components/terminal-pane/terminal-drop-transport-owner.ts +++ b/src/renderer/src/components/terminal-pane/terminal-drop-transport-owner.ts @@ -1,7 +1,7 @@ import { parseExecutionHostId } from '../../../../shared/execution-host' import { captureDirectSshMutationExpectation } from '@/lib/ssh-mutation-expectation' import { useAppStore } from '@/store' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' export function captureTerminalDropTransportOwner( transport: Pick diff --git a/src/renderer/src/components/terminal-pane/terminal-ime-composition-route.test.ts b/src/renderer/src/components/terminal-pane/terminal-ime-composition-route.test.ts index 43561a5c557..e6643b1be79 100644 --- a/src/renderer/src/components/terminal-pane/terminal-ime-composition-route.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-ime-composition-route.test.ts @@ -1,6 +1,6 @@ // @vitest-environment happy-dom import { describe, expect, it, vi } from 'vitest' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { hasPendingTerminalImeComposition, installTerminalImeCompositionRoute, diff --git a/src/renderer/src/components/terminal-pane/terminal-ime-composition-route.ts b/src/renderer/src/components/terminal-pane/terminal-ime-composition-route.ts index 45fe1ee23ab..bf8b82b95bb 100644 --- a/src/renderer/src/components/terminal-pane/terminal-ime-composition-route.ts +++ b/src/renderer/src/components/terminal-pane/terminal-ime-composition-route.ts @@ -1,5 +1,5 @@ import type { IDisposable, Terminal } from '@xterm/xterm' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' export const XTERM_COMPOSITION_SESSION_START_EVENT = 'xterm-composition-session-start' export const XTERM_COMPOSITION_SESSION_END_EVENT = 'xterm-composition-session-end' diff --git a/src/renderer/src/components/terminal-pane/terminal-ime-deferred-newline.test.ts b/src/renderer/src/components/terminal-pane/terminal-ime-deferred-newline.test.ts index 5508565e7f6..6807c4b2525 100644 --- a/src/renderer/src/components/terminal-pane/terminal-ime-deferred-newline.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-ime-deferred-newline.test.ts @@ -1,6 +1,6 @@ // @vitest-environment happy-dom import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { createTerminalImeDeferredNewlineSender, createTerminalImeModifiedEnterChordOwner, diff --git a/src/renderer/src/components/terminal-pane/terminal-ime-user-input-provenance.test.ts b/src/renderer/src/components/terminal-pane/terminal-ime-user-input-provenance.test.ts index 5b0accad22c..53573264b83 100644 --- a/src/renderer/src/components/terminal-pane/terminal-ime-user-input-provenance.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-ime-user-input-provenance.test.ts @@ -4,7 +4,7 @@ import { Terminal } from '@xterm/xterm' import { afterEach, beforeEach, describe, expect, it } from 'vitest' import type { IDisposable } from '@xterm/xterm' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { installTerminalImeCompositionRoute, XTERM_COMPOSITION_SESSION_END_EVENT, diff --git a/src/renderer/src/components/terminal-pane/terminal-keyboard-action-dispatch.ts b/src/renderer/src/components/terminal-pane/terminal-keyboard-action-dispatch.ts index ce0c10694f3..b6d1244210f 100644 --- a/src/renderer/src/components/terminal-pane/terminal-keyboard-action-dispatch.ts +++ b/src/renderer/src/components/terminal-pane/terminal-keyboard-action-dispatch.ts @@ -1,6 +1,6 @@ import type { ManagedPane, PaneManager } from '@/lib/pane-manager/pane-manager' import type { PaneCwdMap } from './resolve-split-cwd' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { copyTerminalSelection } from './terminal-selection-copy' import { splitTerminalPaneWithInheritedCwd } from './terminal-pane-split-with-inherited-cwd' import { diff --git a/src/renderer/src/components/terminal-pane/terminal-keyboard-dependencies.ts b/src/renderer/src/components/terminal-pane/terminal-keyboard-dependencies.ts index 7f4df330dc5..b0a62ba56c7 100644 --- a/src/renderer/src/components/terminal-pane/terminal-keyboard-dependencies.ts +++ b/src/renderer/src/components/terminal-pane/terminal-keyboard-dependencies.ts @@ -1,6 +1,6 @@ import type { IDisposable } from '@xterm/xterm' import type { ManagedPane, PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import type { MacOptionAsAlt } from './terminal-shortcut-policy' import type { KeybindingOverrides, TerminalShortcutPolicy } from '../../../../shared/keybindings' import type { PaneCwdMap } from './resolve-split-cwd' diff --git a/src/renderer/src/components/terminal-pane/terminal-keyboard-runtime.ts b/src/renderer/src/components/terminal-pane/terminal-keyboard-runtime.ts index 39936a1dd07..d84fd7456fa 100644 --- a/src/renderer/src/components/terminal-pane/terminal-keyboard-runtime.ts +++ b/src/renderer/src/components/terminal-pane/terminal-keyboard-runtime.ts @@ -1,6 +1,6 @@ import type { IDisposable } from '@xterm/xterm' import type { PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import type { PaneCwdMap } from './resolve-split-cwd' import type { MacOptionAsAlt } from './terminal-shortcut-policy' import type { diff --git a/src/renderer/src/components/terminal-pane/terminal-mode-2031-replies.ts b/src/renderer/src/components/terminal-pane/terminal-mode-2031-replies.ts index 7e709dc51e9..be0b7a03785 100644 --- a/src/renderer/src/components/terminal-pane/terminal-mode-2031-replies.ts +++ b/src/renderer/src/components/terminal-pane/terminal-mode-2031-replies.ts @@ -1,6 +1,6 @@ import { mode2031SequenceFor } from '../../../../shared/terminal-color-scheme-protocol' import type { TerminalColorSchemeMode } from '../../../../shared/terminal-color-scheme-protocol' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' type Mode2031ReplyTransport = Pick diff --git a/src/renderer/src/components/terminal-pane/terminal-native-file-drop-destination.ts b/src/renderer/src/components/terminal-pane/terminal-native-file-drop-destination.ts index 8a99b9ada71..16864bcc79e 100644 --- a/src/renderer/src/components/terminal-pane/terminal-native-file-drop-destination.ts +++ b/src/renderer/src/components/terminal-pane/terminal-native-file-drop-destination.ts @@ -3,7 +3,7 @@ import { extractIpcErrorMessage } from '@/lib/ipc-error' import type { PaneManager } from '@/lib/pane-manager/pane-manager' import { useAppStore } from '@/store' import { translate } from '@/i18n/i18n' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { captureTerminalDropTarget, getCurrentTerminalDropTransport } from './terminal-drop-target' import { captureTerminalDropTransportOwner } from './terminal-drop-transport-owner' import { resolveTerminalDropWorktreePath } from './terminal-drop-worktree-path' diff --git a/src/renderer/src/components/terminal-pane/terminal-native-file-drop.ts b/src/renderer/src/components/terminal-pane/terminal-native-file-drop.ts index 8892b0b36b2..cb9432bca01 100644 --- a/src/renderer/src/components/terminal-pane/terminal-native-file-drop.ts +++ b/src/renderer/src/components/terminal-pane/terminal-native-file-drop.ts @@ -4,7 +4,7 @@ import type { PaneManager } from '@/lib/pane-manager/pane-manager' import { importExternalPathsToRuntime } from '@/runtime/runtime-file-import-client' import { translate } from '@/i18n/i18n' import { isWslUncPath } from '../../../../shared/wsl-paths' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { recordTerminalUserInputForLeaf } from './terminal-input-activity' import { reportTerminalDropUploadSkipsAndFailures } from './terminal-drop-upload-report' import { diff --git a/src/renderer/src/components/terminal-pane/terminal-pane-element-file-drop.test.tsx b/src/renderer/src/components/terminal-pane/terminal-pane-element-file-drop.test.tsx index b2592e6d74e..5c7a28e1b6f 100644 --- a/src/renderer/src/components/terminal-pane/terminal-pane-element-file-drop.test.tsx +++ b/src/renderer/src/components/terminal-pane/terminal-pane-element-file-drop.test.tsx @@ -8,7 +8,7 @@ import type { PreparedDroppedPaths } from '../../../../shared/native-file-drop-p import type { PaneManager } from '@/lib/pane-manager/pane-manager' import type { ManagedPaneInternal } from '@/lib/pane-manager/pane-manager-types' import { collectPublicPanes, toPublicPane } from '@/lib/pane-manager/pane-public-view' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import type { TerminalPaneController } from './use-terminal-pane-controller' import { NativeChatPaneFileDropSurface, diff --git a/src/renderer/src/components/terminal-pane/terminal-pane-lifecycle-primitives.ts b/src/renderer/src/components/terminal-pane/terminal-pane-lifecycle-primitives.ts index 645a81a64ce..ccb00b02cd5 100644 --- a/src/renderer/src/components/terminal-pane/terminal-pane-lifecycle-primitives.ts +++ b/src/renderer/src/components/terminal-pane/terminal-pane-lifecycle-primitives.ts @@ -2,7 +2,7 @@ import { isRemoteRuntimePtyId } from '../../../../shared/remote-runtime-pty-id' import type { Terminal } from '@xterm/xterm' import type { TerminalLayoutSnapshot, TerminalTab } from '../../../../shared/terminal-tab-types' import type { PtyPaneStartup } from './pty-connection-types' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import type { PaneCwdMap } from './resolve-split-cwd' import type { TerminalPaneSplitSource } from '../../../../shared/feature-education-telemetry' import type { HttpLinkSourceOwner } from '@/lib/http-link-routing' diff --git a/src/renderer/src/components/terminal-pane/terminal-pane-lifecycle-types.ts b/src/renderer/src/components/terminal-pane/terminal-pane-lifecycle-types.ts index af7df5df283..38df99ce8a3 100644 --- a/src/renderer/src/components/terminal-pane/terminal-pane-lifecycle-types.ts +++ b/src/renderer/src/components/terminal-pane/terminal-pane-lifecycle-types.ts @@ -14,8 +14,7 @@ import type { import type { EffectiveMacOptionAsAlt } from '@/lib/keyboard-layout/detect-option-as-alt' import type { PaneCwdMap } from './resolve-split-cwd' import type { PaneProcessExit, PtyPaneStartup } from './pty-connection-types' -import type { PtyTransport } from './pty-transport' -import type { PtyTransportRecoveryState } from './pty-transport-types' +import type { PtyTransport, PtyTransportRecoveryState } from './pty-transport-types' import type { ReplayingPanesRef } from './replay-guard' import type { TerminalLinkActionRequester } from './terminal-link-action-request' import type { TerminalLinkRoutingPreferenceRequester } from './terminal-url-link-hit-testing' diff --git a/src/renderer/src/components/terminal-pane/terminal-pane-menu-paste.ts b/src/renderer/src/components/terminal-pane/terminal-pane-menu-paste.ts index 90471a90565..6436c684ea8 100644 --- a/src/renderer/src/components/terminal-pane/terminal-pane-menu-paste.ts +++ b/src/renderer/src/components/terminal-pane/terminal-pane-menu-paste.ts @@ -1,11 +1,11 @@ import type { ManagedPane, PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { requestNativeChatCoverPaste } from './native-chat-cover-paste' import { getConnectionId } from '@/lib/connection-context' import { getRuntimeEnvironmentIdForWorktree } from '@/lib/worktree-runtime-owner' import { getShortcutPlatform } from '@/lib/shortcut-platform' import { pasteTerminalClipboard } from './terminal-clipboard-paste' -import type { TerminalPasteSource, TerminalPasteTextOptions } from './terminal-paste-coordinator' +import type { TerminalPasteSource, TerminalPasteTextOptions } from './terminal-paste-model' import { formatTerminalPasteExecutionError } from './terminal-paste-errors' import { resolveTerminalPasteRuntime } from './terminal-paste-runtime' import { isTerminalPanePasteTargetCurrent } from './terminal-paste-target-state' diff --git a/src/renderer/src/components/terminal-pane/terminal-pane-paste-dispatch.ts b/src/renderer/src/components/terminal-pane/terminal-pane-paste-dispatch.ts index 275315fdbe6..3b2115f2ff5 100644 --- a/src/renderer/src/components/terminal-pane/terminal-pane-paste-dispatch.ts +++ b/src/renderer/src/components/terminal-pane/terminal-pane-paste-dispatch.ts @@ -1,12 +1,12 @@ import { pasteTerminalText } from './terminal-bracketed-paste' -import { - executeTerminalPastePlan, - planTerminalPasteWithYield, - type TerminalPasteExecutionResult, - type TerminalPasteRuntime, - type TerminalPasteSource, - type TerminalPasteTextOptions -} from './terminal-paste-coordinator' +import { executeTerminalPastePlan } from './terminal-paste-executor' +import { planTerminalPasteWithYield } from './terminal-paste-coordinator' +import type { + TerminalPasteExecutionResult, + TerminalPasteRuntime, + TerminalPasteSource, + TerminalPasteTextOptions +} from './terminal-paste-model' import { writeTerminalPastePtyInput } from './terminal-pty-paste-writer' type PasteTextIntoTerminalPaneArgs = { diff --git a/src/renderer/src/components/terminal-pane/terminal-pane-paste-execution.ts b/src/renderer/src/components/terminal-pane/terminal-pane-paste-execution.ts index f959c928435..91ecd379854 100644 --- a/src/renderer/src/components/terminal-pane/terminal-pane-paste-execution.ts +++ b/src/renderer/src/components/terminal-pane/terminal-pane-paste-execution.ts @@ -1,9 +1,9 @@ import { useAppStore } from '../../store' import type { ManagedPane } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { getConnectionId } from '@/lib/connection-context' import { getRuntimeEnvironmentIdForWorktree } from '@/lib/worktree-runtime-owner' -import type { TerminalPasteSource, TerminalPasteTextOptions } from './terminal-paste-coordinator' +import type { TerminalPasteSource, TerminalPasteTextOptions } from './terminal-paste-model' import { resolveTerminalPasteRuntime } from './terminal-paste-runtime' import { isTerminalPanePasteFocusCurrent, diff --git a/src/renderer/src/components/terminal-pane/terminal-pane-split-with-inherited-cwd.test.ts b/src/renderer/src/components/terminal-pane/terminal-pane-split-with-inherited-cwd.test.ts index bfb93b28273..c887bf9da43 100644 --- a/src/renderer/src/components/terminal-pane/terminal-pane-split-with-inherited-cwd.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-pane-split-with-inherited-cwd.test.ts @@ -1,6 +1,6 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import type { ManagedPane, PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import type { PaneCwdMap } from './resolve-split-cwd' import { splitTerminalPaneWithInheritedCwd } from './terminal-pane-split-with-inherited-cwd' import { createDeferred } from './pty-connection-test-async' diff --git a/src/renderer/src/components/terminal-pane/terminal-pane-split-with-inherited-cwd.ts b/src/renderer/src/components/terminal-pane/terminal-pane-split-with-inherited-cwd.ts index 401f038c157..2e087f2bd22 100644 --- a/src/renderer/src/components/terminal-pane/terminal-pane-split-with-inherited-cwd.ts +++ b/src/renderer/src/components/terminal-pane/terminal-pane-split-with-inherited-cwd.ts @@ -1,7 +1,7 @@ import type { TerminalPaneSplitSource } from '../../../../shared/feature-education-telemetry' import type { ManagedPane, PaneManager } from '@/lib/pane-manager/pane-manager' import { splitWebRuntimeTerminal } from '@/runtime/web-runtime-terminal-actions' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { resolveSplitCwd, type PaneCwdMap } from './resolve-split-cwd' import { recordCreatedTerminalPaneSplit } from './terminal-pane-split-completion' diff --git a/src/renderer/src/components/terminal-pane/terminal-pane-split-writer-paths.test.ts b/src/renderer/src/components/terminal-pane/terminal-pane-split-writer-paths.test.ts index 35303c42190..d60ab412d19 100644 --- a/src/renderer/src/components/terminal-pane/terminal-pane-split-writer-paths.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-pane-split-writer-paths.test.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' -import { recordKeyboardCreatedTerminalPaneSplit } from './keyboard-handlers' +import { recordKeyboardCreatedTerminalPaneSplit } from './terminal-keyboard-shortcut-matching' import { recordContextMenuCreatedTerminalPaneSplit } from './use-terminal-pane-split-actions' -import { recordRuntimeCreatedTerminalPaneSplit } from './use-terminal-pane-lifecycle' +import { recordRuntimeCreatedTerminalPaneSplit } from './terminal-pane-lifecycle-primitives' const mocks = vi.hoisted(() => ({ recordFeatureInteraction: vi.fn(), diff --git a/src/renderer/src/components/terminal-pane/terminal-paste-chunks.ts b/src/renderer/src/components/terminal-pane/terminal-paste-chunks.ts index 499571189e0..0f6572aedcf 100644 --- a/src/renderer/src/components/terminal-pane/terminal-paste-chunks.ts +++ b/src/renderer/src/components/terminal-pane/terminal-paste-chunks.ts @@ -1,6 +1,6 @@ import { BRACKETED_PASTE_END, BRACKETED_PASTE_START } from './terminal-bracketed-paste' import { TERMINAL_PASTE_CHUNK_MAX_BYTES } from './terminal-paste-limits' -import type { TerminalPastePlan } from './terminal-paste-coordinator' +import type { TerminalPastePlan } from './terminal-paste-model' import { getUtf8ByteLengthForCodePoint, readUtf8CodePointAt diff --git a/src/renderer/src/components/terminal-pane/terminal-paste-coordinator.test.ts b/src/renderer/src/components/terminal-pane/terminal-paste-coordinator.test.ts index 1ed983db37e..18a7abf7188 100644 --- a/src/renderer/src/components/terminal-pane/terminal-paste-coordinator.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-paste-coordinator.test.ts @@ -8,19 +8,21 @@ import { } from './terminal-bracketed-paste' import { createRedactedPasteExecutionDiagnostic } from './terminal-paste-diagnostics' import { formatTerminalPasteExecutionError } from './terminal-paste-errors' +import { chunkTerminalPastePlan, iterateTerminalPastePlanChunks } from './terminal-paste-chunks' import { - chunkTerminalPastePlan, createTerminalPastePayload, - executeTerminalPastePlan, - getTerminalPasteOperationTimeoutMs, - iterateTerminalPastePlanChunks, planTerminalPaste, - planTerminalPasteWithYield, - TERMINAL_PASTE_OPERATION_TIMEOUT_MS, - TERMINAL_REMOTE_PASTE_OPERATION_TIMEOUT_MS, - type TerminalPasteRuntime, - type TerminalPasteTarget + planTerminalPasteWithYield } from './terminal-paste-coordinator' +import { + executeTerminalPastePlan, + getTerminalPasteOperationTimeoutMs +} from './terminal-paste-executor' +import { + TERMINAL_PASTE_OPERATION_TIMEOUT_MS, + TERMINAL_REMOTE_PASTE_OPERATION_TIMEOUT_MS +} from './terminal-paste-limits' +import type { TerminalPasteRuntime, TerminalPasteTarget } from './terminal-paste-model' const textEncoder = new TextEncoder() diff --git a/src/renderer/src/components/terminal-pane/terminal-paste-coordinator.ts b/src/renderer/src/components/terminal-pane/terminal-paste-coordinator.ts index a6aa23cc262..9fbe4e262a7 100644 --- a/src/renderer/src/components/terminal-pane/terminal-paste-coordinator.ts +++ b/src/renderer/src/components/terminal-pane/terminal-paste-coordinator.ts @@ -16,27 +16,6 @@ import type { WindowsInputRecordNewline } from './terminal-paste-model' -export { - TERMINAL_PASTE_CHUNK_MAX_BYTES, - TERMINAL_PASTE_DIRECT_MAX_BYTES, - TERMINAL_PASTE_MAX_BYTES, - TERMINAL_PASTE_OPERATION_TIMEOUT_MS, - TERMINAL_REMOTE_PASTE_OPERATION_TIMEOUT_MS -} from './terminal-paste-limits' -export { executeTerminalPastePlan } from './terminal-paste-executor' -export { getTerminalPasteOperationTimeoutMs } from './terminal-paste-executor' -export { chunkTerminalPastePlan, iterateTerminalPastePlanChunks } from './terminal-paste-chunks' -export { createRedactedPasteDiagnostic } from './terminal-paste-diagnostics' -export type { - TerminalPasteExecutionResult, - TerminalPastePayload, - TerminalPastePlan, - TerminalPasteRuntime, - TerminalPasteSource, - TerminalPasteTarget, - TerminalPasteTextOptions -} from './terminal-paste-model' - type PlanTerminalPasteArgs = { text: string source: TerminalPasteSource diff --git a/src/renderer/src/components/terminal-pane/terminal-paste-executor-default-yield.test.ts b/src/renderer/src/components/terminal-pane/terminal-paste-executor-default-yield.test.ts index 4adc98a585b..a024000b428 100644 --- a/src/renderer/src/components/terminal-pane/terminal-paste-executor-default-yield.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-paste-executor-default-yield.test.ts @@ -15,7 +15,8 @@ const { events, yieldToEventLoop } = vi.hoisted(() => { vi.mock('../../../../shared/event-loop-yield', () => ({ yieldToEventLoop })) -import { planTerminalPaste, type TerminalPasteTarget } from './terminal-paste-coordinator' +import { planTerminalPaste } from './terminal-paste-coordinator' +import type { TerminalPasteTarget } from './terminal-paste-model' import { executeTerminalPastePlan } from './terminal-paste-executor' const target: TerminalPasteTarget = { diff --git a/src/renderer/src/components/terminal-pane/terminal-paste-multiline-policy.test.ts b/src/renderer/src/components/terminal-pane/terminal-paste-multiline-policy.test.ts index e9e2c69d95e..662711151cf 100644 --- a/src/renderer/src/components/terminal-pane/terminal-paste-multiline-policy.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-paste-multiline-policy.test.ts @@ -1,10 +1,8 @@ import { describe, expect, it, vi } from 'vitest' -import { - executeTerminalPastePlan, - planTerminalPaste, - type TerminalPasteTarget -} from './terminal-paste-coordinator' +import { executeTerminalPastePlan } from './terminal-paste-executor' +import { planTerminalPaste } from './terminal-paste-coordinator' +import type { TerminalPasteTarget } from './terminal-paste-model' function terminalTarget(): TerminalPasteTarget { return { diff --git a/src/renderer/src/components/terminal-pane/terminal-paste-operation-order.test.ts b/src/renderer/src/components/terminal-pane/terminal-paste-operation-order.test.ts index 21cf0e902d8..5b0a9f0d60c 100644 --- a/src/renderer/src/components/terminal-pane/terminal-paste-operation-order.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-paste-operation-order.test.ts @@ -6,7 +6,8 @@ import { BRACKETED_PASTE_START, wrapTerminalBracketedPasteText } from './terminal-bracketed-paste' -import { executeTerminalPastePlan, planTerminalPaste } from './terminal-paste-coordinator' +import { executeTerminalPastePlan } from './terminal-paste-executor' +import { planTerminalPaste } from './terminal-paste-coordinator' import { runTerminalPtyInputTransaction } from './terminal-pty-input-transaction' function chunkedWindowsPaste() { diff --git a/src/renderer/src/components/terminal-pane/terminal-programmatic-text-paste.test.ts b/src/renderer/src/components/terminal-pane/terminal-programmatic-text-paste.test.ts index 49f288df5af..ffc7655d729 100644 --- a/src/renderer/src/components/terminal-pane/terminal-programmatic-text-paste.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-programmatic-text-paste.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import { TERMINAL_PASTE_DIRECT_MAX_BYTES } from './terminal-paste-coordinator' +import { TERMINAL_PASTE_DIRECT_MAX_BYTES } from './terminal-paste-limits' const mocks = vi.hoisted(() => ({ pasteTerminalText: vi.fn(), diff --git a/src/renderer/src/components/terminal-pane/terminal-programmatic-text-paste.ts b/src/renderer/src/components/terminal-pane/terminal-programmatic-text-paste.ts index 1a7a4fade4d..60be4bb2ffa 100644 --- a/src/renderer/src/components/terminal-pane/terminal-programmatic-text-paste.ts +++ b/src/renderer/src/components/terminal-pane/terminal-programmatic-text-paste.ts @@ -1,6 +1,6 @@ import type { PasteTerminalTextDetail } from '@/constants/terminal' import type { PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { getShortcutPlatform } from '@/lib/shortcut-platform' import { recordTerminalUserInputForLeaf } from './terminal-input-activity' import { pasteTextIntoTerminalPane } from './terminal-pane-paste-dispatch' diff --git a/src/renderer/src/components/terminal-pane/terminal-pty-paste-writer.ts b/src/renderer/src/components/terminal-pane/terminal-pty-paste-writer.ts index 7998ffe6bb3..cdf0a899fba 100644 --- a/src/renderer/src/components/terminal-pane/terminal-pty-paste-writer.ts +++ b/src/renderer/src/components/terminal-pane/terminal-pty-paste-writer.ts @@ -1,4 +1,4 @@ -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import type { TerminalInputKind } from '../../../../shared/terminal-input-kind' type TerminalPastePtyWriter = Pick diff --git a/src/renderer/src/components/terminal-pane/terminal-shutdown-layout-capture.ts b/src/renderer/src/components/terminal-pane/terminal-shutdown-layout-capture.ts index f53c96347d8..a16e2434b4b 100644 --- a/src/renderer/src/components/terminal-pane/terminal-shutdown-layout-capture.ts +++ b/src/renderer/src/components/terminal-pane/terminal-shutdown-layout-capture.ts @@ -1,6 +1,6 @@ import type { TerminalLayoutSnapshot } from '../../../../shared/terminal-tab-types' import type { ManagedPane } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { flushTerminalOutput } from '@/lib/pane-manager/pane-terminal-output-scheduler' import { serializeTerminalLayout } from './layout-serialization' import { mergeCapturedLeafState } from './merge-captured-leaf-state' diff --git a/src/renderer/src/components/terminal-pane/terminal-startup-command-paste.ts b/src/renderer/src/components/terminal-pane/terminal-startup-command-paste.ts index 240c619ad99..0a6b800be10 100644 --- a/src/renderer/src/components/terminal-pane/terminal-startup-command-paste.ts +++ b/src/renderer/src/components/terminal-pane/terminal-startup-command-paste.ts @@ -1,9 +1,6 @@ -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import type { pasteTerminalText } from './terminal-bracketed-paste' -import type { - TerminalPasteExecutionResult, - TerminalPasteRuntime -} from './terminal-paste-coordinator' +import type { TerminalPasteExecutionResult, TerminalPasteRuntime } from './terminal-paste-model' import { pasteTextIntoTerminalPane } from './terminal-pane-paste-dispatch' type StartupCommandPane = { diff --git a/src/renderer/src/components/terminal-pane/terminal-title-tracker-parity.test.ts b/src/renderer/src/components/terminal-pane/terminal-title-tracker-parity.test.ts index dac6bbaf326..adc33b2410a 100644 --- a/src/renderer/src/components/terminal-pane/terminal-title-tracker-parity.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-title-tracker-parity.test.ts @@ -12,7 +12,7 @@ import { createAgentStatusOscProcessor } from '../../../../shared/agent-status-o import { createCommandCodeOutputStatusDetector } from '../../../../shared/command-code-output-status' import { createTerminalGitHubPRLinkDetector } from '../../../../shared/terminal-github-pr-link-detector' import { createTerminalTitleTracker } from '../../../../shared/terminal-output-side-effects' -import { createPtyOutputProcessor } from './pty-transport' +import { createPtyOutputProcessor } from './pty-output-processor' import { createTerminalCommandLifecycle } from './terminal-command-lifecycle' const ESC = '\x1b' diff --git a/src/renderer/src/components/terminal-pane/use-mobile-overlay-ticks.perf.test.tsx b/src/renderer/src/components/terminal-pane/use-mobile-overlay-ticks.perf.test.tsx index 67e03f47312..d1c9fbca0de 100644 --- a/src/renderer/src/components/terminal-pane/use-mobile-overlay-ticks.perf.test.tsx +++ b/src/renderer/src/components/terminal-pane/use-mobile-overlay-ticks.perf.test.tsx @@ -4,7 +4,7 @@ import { act, cleanup, render } from '@testing-library/react' import { hydrateDrivers, setDriverForPty } from '@/lib/pane-manager/mobile-driver-state' import { hydrateOverrides, setFitOverride } from '@/lib/pane-manager/mobile-fit-overrides' import type { PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { useMobileOverlayTicks } from './use-mobile-overlay-ticks' // Why: the emitters are plain module listener Sets, so N mounted subscribers diff --git a/src/renderer/src/components/terminal-pane/use-mobile-overlay-ticks.ts b/src/renderer/src/components/terminal-pane/use-mobile-overlay-ticks.ts index 824bc322d56..49b24e15682 100644 --- a/src/renderer/src/components/terminal-pane/use-mobile-overlay-ticks.ts +++ b/src/renderer/src/components/terminal-pane/use-mobile-overlay-ticks.ts @@ -5,7 +5,7 @@ import type { ManagedPane, PaneManager } from '@/lib/pane-manager/pane-manager' import { safeFit } from '@/lib/pane-manager/pane-tree-ops' import { applyDesktopFitFallbackAfterReplay } from './desktop-fit-fallback' import { getOverrideAffectedPanes, getPanesNeedingOverrideFit } from './override-affected-panes' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' export type MobileOverlayTickDeps = { managerRef: { current: PaneManager | null } diff --git a/src/renderer/src/components/terminal-pane/use-terminal-context-menu-trigger.ts b/src/renderer/src/components/terminal-pane/use-terminal-context-menu-trigger.ts index 5dc11f15cd9..c28194f8fbf 100644 --- a/src/renderer/src/components/terminal-pane/use-terminal-context-menu-trigger.ts +++ b/src/renderer/src/components/terminal-pane/use-terminal-context-menu-trigger.ts @@ -1,6 +1,6 @@ import { useEffect, useRef, useState } from 'react' import type { PaneManager } from '@/lib/pane-manager/pane-manager' -import type { TerminalPasteSource } from './terminal-paste-coordinator' +import type { TerminalPasteSource } from './terminal-paste-model' import { copyTerminalSelection } from './terminal-selection-copy' import { CLOSE_ALL_CONTEXT_MENUS_EVENT } from '@/lib/close-all-context-menus' diff --git a/src/renderer/src/components/terminal-pane/use-terminal-pane-context-menu.ts b/src/renderer/src/components/terminal-pane/use-terminal-pane-context-menu.ts index 623dbba05b1..7d086992e21 100644 --- a/src/renderer/src/components/terminal-pane/use-terminal-pane-context-menu.ts +++ b/src/renderer/src/components/terminal-pane/use-terminal-pane-context-menu.ts @@ -1,11 +1,11 @@ import { useCallback, useRef } from 'react' import type { ManagedPane, PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import type { PaneCwdMap } from './resolve-split-cwd' import type { TerminalQuickCommand } from '../../../../shared/terminal-quick-command-types' import { isTerminalAgentQuickCommand } from '../../../../shared/terminal-quick-commands' import { sendTerminalQuickCommandToPane } from './terminal-quick-command-dispatch' -import type { TerminalPasteSource } from './terminal-paste-coordinator' +import type { TerminalPasteSource } from './terminal-paste-model' import { runQuickCommandInNewTab } from '@/lib/run-quick-command-in-new-tab' import type { PreparedAgentSessionFork } from './terminal-agent-session-fork' import type { AgentSessionContinuationRequest } from '@/lib/agent-session-continuation' diff --git a/src/renderer/src/components/terminal-pane/use-terminal-pane-file-drop-owner.ts b/src/renderer/src/components/terminal-pane/use-terminal-pane-file-drop-owner.ts index 1c76473d100..fbb9373a5dc 100644 --- a/src/renderer/src/components/terminal-pane/use-terminal-pane-file-drop-owner.ts +++ b/src/renderer/src/components/terminal-pane/use-terminal-pane-file-drop-owner.ts @@ -9,7 +9,7 @@ import { } from '@/hooks/use-os-file-drop-owner' import { getNativeFileDropRejectionMessage } from '@/lib/native-file-drop-rejection-message' import { makePaneKey, type PaneKey } from '../../../../shared/stable-pane-id' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import { captureNativeTerminalFileDrop } from './terminal-native-file-drop-destination' export type TerminalPaneFileDropOwnerArgs = { diff --git a/src/renderer/src/components/terminal-pane/use-terminal-pane-foundation.ts b/src/renderer/src/components/terminal-pane/use-terminal-pane-foundation.ts index fe75fee6c38..21abef1c6c0 100644 --- a/src/renderer/src/components/terminal-pane/use-terminal-pane-foundation.ts +++ b/src/renderer/src/components/terminal-pane/use-terminal-pane-foundation.ts @@ -6,8 +6,8 @@ import { hydrateRuntimeEnvironmentSshState } from '@/runtime/runtime-environment import { LOCAL_EXECUTION_HOST_ID, type ExecutionHostId } from '../../../../shared/execution-host' import type { TerminalKittyKeyboardModeTracker } from '../../../../shared/terminal-kitty-keyboard-mode-tracker' import type { PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' -import type { SearchState } from './keyboard-handlers' +import type { PtyTransport } from './pty-transport-types' +import type { SearchState } from './terminal-keyboard-shortcut-matching' import type { CloseTerminalDialogCopyKind } from './CloseTerminalDialog' import type { TerminalLinkActionRequest } from './terminal-link-action-request' import { closeTerminalLinkActionRequest } from './terminal-link-action-request' diff --git a/src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-paste-events.test.ts b/src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-paste-events.test.ts index 033c407cc42..ffd72f739bb 100644 --- a/src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-paste-events.test.ts +++ b/src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-paste-events.test.ts @@ -3,7 +3,7 @@ import type * as StoreModule from '@/store' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { PASTE_TERMINAL_TEXT_EVENT } from '@/constants/terminal' import { useTerminalPaneGlobalEffects } from './use-terminal-pane-global-effects' -import { TERMINAL_PASTE_DIRECT_MAX_BYTES } from './terminal-paste-coordinator' +import { TERMINAL_PASTE_DIRECT_MAX_BYTES } from './terminal-paste-limits' import { cleanupGlobalEffectsTestWindow, installGlobalEffectsTestWindow diff --git a/src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects.ts b/src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects.ts index 5aa59f319c1..4f4057f9b31 100644 --- a/src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects.ts +++ b/src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects.ts @@ -8,7 +8,7 @@ import { type PasteTerminalTextDetail } from '@/constants/terminal' import type { PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import type { IDisposable } from '@xterm/xterm' import { handleFocusTerminalPaneDetail } from './focus-terminal-pane-event' import { surfaceStaleAgentRow } from './stale-agent-row' diff --git a/src/renderer/src/components/terminal-pane/use-terminal-pane-global-listeners.ts b/src/renderer/src/components/terminal-pane/use-terminal-pane-global-listeners.ts index a3e8e3880f2..a46027b67b9 100644 --- a/src/renderer/src/components/terminal-pane/use-terminal-pane-global-listeners.ts +++ b/src/renderer/src/components/terminal-pane/use-terminal-pane-global-listeners.ts @@ -1,6 +1,6 @@ import { useEffect } from 'react' import { useTerminalFontZoom } from './useTerminalFontZoom' -import { useTerminalKeyboardShortcuts } from './keyboard-handlers' +import { useTerminalKeyboardShortcuts } from './terminal-keyboard-hook' import { useTerminalPaneGlobalEffects } from './use-terminal-pane-global-effects' import { safeFitAndThen } from '@/lib/pane-manager/pane-tree-ops' import { getFitOverrideForPty } from '@/lib/pane-manager/mobile-fit-overrides' diff --git a/src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.test.ts b/src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.test.ts index 7e9e1e42b93..62faf7f08d5 100644 --- a/src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.test.ts +++ b/src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.test.ts @@ -1,6 +1,10 @@ import { describe, expect, it, vi } from 'vitest' import { applyTerminalPaneCloseRequest, + retireMountedTerminalPaneSurface, + suppressIntentionalPaneCloseExit +} from './terminal-pane-lifecycle-close' +import { applyTerminalScrollbackRowsToMountedPanes, clearQueuedInitialCwdAfterFirstPane, createQueuedStartupConsumer, @@ -12,11 +16,9 @@ import { resolvePaneSeedCwd, resolveQueuedInitialCwd, replayLayoutWithOneShotParkIntent, - retireMountedTerminalPaneSurface, shouldDetachPaneTransportOnUnmount, - splitPaneWithOneShotStartup, - suppressIntentionalPaneCloseExit -} from './use-terminal-pane-lifecycle' + splitPaneWithOneShotStartup +} from './terminal-pane-lifecycle-primitives' describe('applyTerminalPaneCloseRequest', () => { it('detaches a rolled-back split surface without closing its PTY', () => { diff --git a/src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts b/src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts index e8eae7e7e47..4c11183f4ff 100644 --- a/src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts +++ b/src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts @@ -17,30 +17,6 @@ import { useTerminalPaneMountLifecycle } from './use-terminal-pane-mount-lifecyc import { useTerminalPaneLifecycleRefs } from './use-terminal-pane-lifecycle-refs' import { listenForHibernatedAgentWake } from './hibernated-agent-wake-listener' -export { - applyTerminalScrollbackRowsToMountedPanes, - clearQueuedInitialCwdAfterFirstPane, - createQueuedStartupConsumer, - getPreviousVisibleForTerminalPane, - isTerminalPaneVisibilityResume, - mapRestoredPaneTitlesByPaneId, - paneOwnsQueuedStartup, - replayLayoutWithOneShotParkIntent, - resolvePaneLinkCwd, - resolvePaneSeedCwd, - resolveQueuedInitialCwd, - recordRuntimeCreatedTerminalPaneSplit, - shouldDetachPaneTransportOnUnmount, - terminalSelectionExceedsPrimaryLimit, - splitPaneWithOneShotStartup -} from './terminal-pane-lifecycle-primitives' -export { - applyTerminalPaneCloseRequest, - retireMountedTerminalPaneSurface, - suppressIntentionalPaneCloseExit -} from './terminal-pane-lifecycle-close' -export type { UseTerminalPaneLifecycleDeps } from './terminal-pane-lifecycle-types' - /** Coordinates mount, visibility, and live appearance effects for terminal panes. */ export function useTerminalPaneLifecycle(deps: UseTerminalPaneLifecycleDeps): void { const refs = useTerminalPaneLifecycleRefs() diff --git a/src/renderer/src/components/terminal-pane/use-terminal-pane-split-actions.ts b/src/renderer/src/components/terminal-pane/use-terminal-pane-split-actions.ts index 742b57cc074..484756a37f0 100644 --- a/src/renderer/src/components/terminal-pane/use-terminal-pane-split-actions.ts +++ b/src/renderer/src/components/terminal-pane/use-terminal-pane-split-actions.ts @@ -1,6 +1,6 @@ import { useCallback, useEffect } from 'react' import type { ManagedPane, PaneManager } from '@/lib/pane-manager/pane-manager' -import type { PtyTransport } from './pty-transport' +import type { PtyTransport } from './pty-transport-types' import type { PaneCwdMap } from './resolve-split-cwd' import { REQUEST_ACTIVE_TERMINAL_PANE_SPLIT_EVENT, diff --git a/src/renderer/src/lib/activate-ai-vault-structured-session-host.test.ts b/src/renderer/src/lib/activate-ai-vault-structured-session-host.test.ts index 4a71275c39b..27b001732e4 100644 --- a/src/renderer/src/lib/activate-ai-vault-structured-session-host.test.ts +++ b/src/renderer/src/lib/activate-ai-vault-structured-session-host.test.ts @@ -32,7 +32,7 @@ vi.mock('@/runtime/runtime-rpc-client', async (original) => ({ callRuntimeRpc: mocks.call, runtimeEnvironmentSupportsCapability: mocks.supports })) -vi.mock('@/runtime/local-structured-session-tabs-sync', async (original) => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/snapshot-apply', async (original) => ({ ...(await original>()), applyStructuredSessionTabSnapshots: mocks.apply })) diff --git a/src/renderer/src/lib/activate-ai-vault-structured-session.ts b/src/renderer/src/lib/activate-ai-vault-structured-session.ts index f64b410adb4..d33614b8c21 100644 --- a/src/renderer/src/lib/activate-ai-vault-structured-session.ts +++ b/src/renderer/src/lib/activate-ai-vault-structured-session.ts @@ -12,7 +12,7 @@ import { } from '@/runtime/runtime-rpc-client' import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target' import { toRuntimeWorktreeSelector } from '@/runtime/runtime-worktree-selector' -import { refreshLocalStructuredSessionWorktreeTabs } from '@/runtime/local-structured-session-tabs-sync' +import { refreshLocalStructuredSessionWorktreeTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' import { STRUCTURED_AGENT_SESSION_REVEAL_RUNTIME_CAPABILITY } from '../../../shared/protocol-version' import { isRuntimeCompatBlockError } from '@/runtime/runtime-protocol-compat' import { executionHostIdForStructuredTarget } from '@/runtime/structured-agent-session-owner' diff --git a/src/renderer/src/lib/agent-status.test.ts b/src/renderer/src/lib/agent-status.test.ts index bccf03832e1..533a7cf73b9 100644 --- a/src/renderer/src/lib/agent-status.test.ts +++ b/src/renderer/src/lib/agent-status.test.ts @@ -12,7 +12,7 @@ import { formatAgentTypeLabel, agentTypeToIconAgent } from './agent-status' -import { extractLastOscTitle } from '../components/terminal-pane/pty-transport' +import { extractLastOscTitle } from '../../../shared/agent-detection' describe('detectAgentStatusFromTitle', () => { it('returns null for empty string', () => { diff --git a/src/renderer/src/lib/launch-agent-structured-chat-guard.test.ts b/src/renderer/src/lib/launch-agent-structured-chat-guard.test.ts index 855f8062152..34fe80efc42 100644 --- a/src/renderer/src/lib/launch-agent-structured-chat-guard.test.ts +++ b/src/renderer/src/lib/launch-agent-structured-chat-guard.test.ts @@ -163,8 +163,10 @@ vi.mock('@/lib/launch-structured-agent-session', () => { StructuredAgentSessionOwnerUnresolvedError } }) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ - refreshLocalStructuredSessionTabs: mockRefreshLocalStructuredSessionTabs, +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ + refreshLocalStructuredSessionTabs: mockRefreshLocalStructuredSessionTabs +})) +vi.mock('@/runtime/local-structured-session-owner', () => ({ LOCAL_STRUCTURED_SESSION_OWNER: 'local-structured-session' })) vi.mock('@/runtime/local-runtime-capabilities', () => ({ diff --git a/src/renderer/src/lib/new-agent-prompt-outcome.test.ts b/src/renderer/src/lib/new-agent-prompt-outcome.test.ts index 15c64725ddf..23b3fe03979 100644 --- a/src/renderer/src/lib/new-agent-prompt-outcome.test.ts +++ b/src/renderer/src/lib/new-agent-prompt-outcome.test.ts @@ -24,7 +24,7 @@ vi.mock('@/lib/launch-structured-agent-session', () => { } }) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: vi.fn() })) @@ -58,7 +58,7 @@ vi.mock('@/lib/agent-catalog', () => ({ })) import { StructuredAgentSessionCreateRefusalError } from '@/lib/launch-structured-agent-session' -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync' +import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' import { resetStructuredAgentSessionSendsForTests } from '@/components/native-chat/structured-agent-session-message-sender' import { clearNativeChatDraftCacheForTests, diff --git a/src/renderer/src/lib/structured-agent-session-launch-after-failure.test.ts b/src/renderer/src/lib/structured-agent-session-launch-after-failure.test.ts index 5452dccfa10..12c8bf1f975 100644 --- a/src/renderer/src/lib/structured-agent-session-launch-after-failure.test.ts +++ b/src/renderer/src/lib/structured-agent-session-launch-after-failure.test.ts @@ -30,7 +30,7 @@ vi.mock('@/lib/launch-structured-agent-session', () => { } }) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: vi.fn() })) @@ -68,7 +68,7 @@ vi.mock('@/lib/agent-catalog', () => ({ })) import { StructuredAgentSessionCreateRefusalError } from '@/lib/launch-structured-agent-session' -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync' +import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' import { cancelStructuredAgentLaunch, getStructuredAgentLaunchStatus, diff --git a/src/renderer/src/lib/structured-agent-session-launch-cancellation.test.ts b/src/renderer/src/lib/structured-agent-session-launch-cancellation.test.ts index 5d9672129a4..3b1a190ab0c 100644 --- a/src/renderer/src/lib/structured-agent-session-launch-cancellation.test.ts +++ b/src/renderer/src/lib/structured-agent-session-launch-cancellation.test.ts @@ -13,7 +13,7 @@ import { } from './structured-agent-session-launch-registry' import { beginStructuredAgentSessionAuthoritativeInventory } from './structured-agent-session-launch-cancellation' import { resetStructuredAgentLaunchPersistenceForTests } from './structured-agent-session-launch-persistence' -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync' +import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' const WORKTREE_ID = 'repo-1::worktree-1' const SESSION_ID = 'session-close-race' diff --git a/src/renderer/src/lib/structured-agent-session-launch-close-race.test.ts b/src/renderer/src/lib/structured-agent-session-launch-close-race.test.ts index acd00b82cab..5eef23f445f 100644 --- a/src/renderer/src/lib/structured-agent-session-launch-close-race.test.ts +++ b/src/renderer/src/lib/structured-agent-session-launch-close-race.test.ts @@ -46,7 +46,7 @@ vi.mock('@/lib/structured-agent-session-launch-recovery', async () => { return { ...actual, launchAndReconcile: vi.fn(actual.launchAndReconcile) } }) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: vi.fn() })) @@ -88,7 +88,7 @@ vi.mock('@/lib/agent-catalog', () => ({ ] })) -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync' +import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' import { cancelStructuredAgentLaunch, hasStructuredAgentSessionLaunchCancellationTombstone, diff --git a/src/renderer/src/lib/structured-agent-session-launch-different-request.test.ts b/src/renderer/src/lib/structured-agent-session-launch-different-request.test.ts index d43e1615f99..c814ff1b861 100644 --- a/src/renderer/src/lib/structured-agent-session-launch-different-request.test.ts +++ b/src/renderer/src/lib/structured-agent-session-launch-different-request.test.ts @@ -29,7 +29,7 @@ vi.mock('@/lib/launch-structured-agent-session', () => { } }) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: vi.fn() })) @@ -64,7 +64,7 @@ vi.mock('@/lib/agent-catalog', () => ({ getAgentCatalog: () => [{ id: 'codex', label: 'Codex' }] })) -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync' +import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' import { resetStructuredAgentSessionSendsForTests } from '@/components/native-chat/structured-agent-session-message-sender' import { clearNativeChatDraftCacheForTests, diff --git a/src/renderer/src/lib/structured-agent-session-launch-exited-owner.test.ts b/src/renderer/src/lib/structured-agent-session-launch-exited-owner.test.ts index 5ba2668962d..7ef9e0f9ac2 100644 --- a/src/renderer/src/lib/structured-agent-session-launch-exited-owner.test.ts +++ b/src/renderer/src/lib/structured-agent-session-launch-exited-owner.test.ts @@ -24,7 +24,7 @@ vi.mock('sonner', () => ({ toast: { error: vi.fn(), message: vi.fn() } })) vi.mock('@/runtime/structured-agent-session-client', () => ({ callStructuredAgentSession: mocks.call })) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: mocks.refresh })) vi.mock('@/runtime/web-session-focus-intent', () => ({ diff --git a/src/renderer/src/lib/structured-agent-session-launch-join-delivery.test.ts b/src/renderer/src/lib/structured-agent-session-launch-join-delivery.test.ts index 4b8cff4a0f7..ac1a5bb8f9d 100644 --- a/src/renderer/src/lib/structured-agent-session-launch-join-delivery.test.ts +++ b/src/renderer/src/lib/structured-agent-session-launch-join-delivery.test.ts @@ -35,7 +35,7 @@ vi.mock('@/lib/structured-agent-session-launch-recovery', async () => { return { ...actual, launchAndReconcile: vi.fn(actual.launchAndReconcile) } }) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: vi.fn() })) @@ -74,7 +74,7 @@ vi.mock('@/lib/agent-catalog', () => ({ })) import type { StructuredAgentSessionLaunchIntent } from '@/lib/launch-structured-agent-session' -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync' +import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' import { startStructuredAgentLaunch, type StructuredAgentLaunchOptions diff --git a/src/renderer/src/lib/structured-agent-session-launch-options.test.ts b/src/renderer/src/lib/structured-agent-session-launch-options.test.ts index 2d7e6e418ad..8d700ba9227 100644 --- a/src/renderer/src/lib/structured-agent-session-launch-options.test.ts +++ b/src/renderer/src/lib/structured-agent-session-launch-options.test.ts @@ -32,7 +32,7 @@ vi.mock('@/lib/launch-structured-agent-session', () => { } }) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: vi.fn() })) @@ -61,7 +61,7 @@ vi.mock('@/lib/agent-catalog', () => ({ })) import { StructuredAgentSessionCreateRefusalError } from '@/lib/launch-structured-agent-session' -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync' +import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' import { cancelStructuredAgentLaunch, getStructuredAgentSessionLaunchLifecycle, diff --git a/src/renderer/src/lib/structured-agent-session-launch-registered-agent.test.ts b/src/renderer/src/lib/structured-agent-session-launch-registered-agent.test.ts index 772a501f64a..2728cb08f18 100644 --- a/src/renderer/src/lib/structured-agent-session-launch-registered-agent.test.ts +++ b/src/renderer/src/lib/structured-agent-session-launch-registered-agent.test.ts @@ -10,8 +10,7 @@ vi.mock('@/lib/agent-catalog', () => ({ getAgentCatalog: () => [{ id: 'grok', la vi.mock('@/runtime/structured-agent-session-client', () => ({ callStructuredAgentSession: mocks.call })) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ - LOCAL_STRUCTURED_SESSION_OWNER: 'local', +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: vi.fn(async () => []) })) vi.mock('@/store', () => ({ diff --git a/src/renderer/src/lib/structured-agent-session-launch-reload.test.ts b/src/renderer/src/lib/structured-agent-session-launch-reload.test.ts index 108be779f5d..8922deabfe1 100644 --- a/src/renderer/src/lib/structured-agent-session-launch-reload.test.ts +++ b/src/renderer/src/lib/structured-agent-session-launch-reload.test.ts @@ -35,7 +35,7 @@ vi.mock('@/lib/structured-agent-session-launch-recovery', async () => { return { ...actual, launchAndReconcile: vi.fn(actual.launchAndReconcile) } }) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: mocks.refresh })) diff --git a/src/renderer/src/lib/structured-agent-session-launch-resume-identity.test.ts b/src/renderer/src/lib/structured-agent-session-launch-resume-identity.test.ts index ac634b4eac1..12cc3c06c5e 100644 --- a/src/renderer/src/lib/structured-agent-session-launch-resume-identity.test.ts +++ b/src/renderer/src/lib/structured-agent-session-launch-resume-identity.test.ts @@ -27,8 +27,7 @@ vi.mock('@/runtime/structured-agent-session-client', () => ({ callStructuredAgentSession: mocks.call })) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ - LOCAL_STRUCTURED_SESSION_OWNER: 'local', +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: mocks.refresh })) diff --git a/src/renderer/src/lib/structured-agent-session-launch-unconfirmed-or-retried.test.ts b/src/renderer/src/lib/structured-agent-session-launch-unconfirmed-or-retried.test.ts index 96b3b3f53ff..2066ee816e8 100644 --- a/src/renderer/src/lib/structured-agent-session-launch-unconfirmed-or-retried.test.ts +++ b/src/renderer/src/lib/structured-agent-session-launch-unconfirmed-or-retried.test.ts @@ -30,7 +30,7 @@ vi.mock('@/lib/launch-structured-agent-session', () => { } }) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: vi.fn() })) @@ -86,7 +86,7 @@ vi.mock('@/lib/launch-agent-in-new-tab', async () => { }) import { StructuredAgentSessionCreateRefusalError } from '@/lib/launch-structured-agent-session' -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync' +import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' import { runSourceControlAgentActionStart } from '@/components/right-sidebar/runSourceControlAgentActionStart' import { getStructuredAgentLaunchStatus, diff --git a/src/renderer/src/lib/structured-agent-session-launch.test.ts b/src/renderer/src/lib/structured-agent-session-launch.test.ts index db0905cef9c..ba0fdc02950 100644 --- a/src/renderer/src/lib/structured-agent-session-launch.test.ts +++ b/src/renderer/src/lib/structured-agent-session-launch.test.ts @@ -46,7 +46,7 @@ vi.mock('@/lib/structured-agent-session-launch-recovery', async () => { return { ...actual, launchAndReconcile: vi.fn(actual.launchAndReconcile) } }) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: vi.fn() })) @@ -93,7 +93,7 @@ vi.mock('@/lib/agent-catalog', () => ({ })) import { StructuredAgentSessionCreateRefusalError } from '@/lib/launch-structured-agent-session' -import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync' +import { refreshLocalStructuredSessionTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh' import { launchAndReconcile } from '@/lib/structured-agent-session-launch-recovery' import { cancelStructuredAgentLaunch, diff --git a/src/renderer/src/lib/structured-agent-session-new-chat-own-launch.test.ts b/src/renderer/src/lib/structured-agent-session-new-chat-own-launch.test.ts index df46eba6dcc..5a6c8690fb0 100644 --- a/src/renderer/src/lib/structured-agent-session-new-chat-own-launch.test.ts +++ b/src/renderer/src/lib/structured-agent-session-new-chat-own-launch.test.ts @@ -64,7 +64,7 @@ vi.mock('@/lib/structured-agent-session-launch-admission', async (importOriginal ...(await importOriginal()), beginHostAdmittedStructuredLaunch: (args: { openAdmitted: () => unknown }) => args.openAdmitted() })) -vi.mock('@/runtime/local-structured-session-tabs-sync', () => ({ +vi.mock('@/runtime/local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: mocks.refreshTabs })) vi.mock('@/runtime/structured-agent-session-client', () => ({ diff --git a/src/renderer/src/runtime/local-structured-session-empty-worktree-visibility.test.ts b/src/renderer/src/runtime/local-structured-session-empty-worktree-visibility.test.ts index f3fca9cb707..ad856fbdad8 100644 --- a/src/renderer/src/runtime/local-structured-session-empty-worktree-visibility.test.ts +++ b/src/renderer/src/runtime/local-structured-session-empty-worktree-visibility.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it } from 'vitest' import type { RuntimeMobileSessionTabsResult } from '../../../shared/runtime-types' import type { Tab } from '../../../shared/tab-types' -import { projectLocalStructuredSessionTabs } from './local-structured-session-tabs-sync' +import { projectLocalStructuredSessionTabs } from './local-structured-session-tabs-sync/snapshot-projection' import { applyWebSessionTabsSnapshot } from './web-session-tabs-sync/snapshot-api' import type { WebSessionTabsSyncState } from './web-session-tabs-sync/state' import { collectClientLayoutGroupIds } from './web-session-client-owned-tab-placement' diff --git a/src/renderer/src/runtime/local-structured-session-retired-epoch-repair.test.ts b/src/renderer/src/runtime/local-structured-session-retired-epoch-repair.test.ts index 88974375907..7f4f93878f3 100644 --- a/src/renderer/src/runtime/local-structured-session-retired-epoch-repair.test.ts +++ b/src/renderer/src/runtime/local-structured-session-retired-epoch-repair.test.ts @@ -12,11 +12,11 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import type { RuntimeMobileSessionTabsResult } from '../../../shared/runtime-types' import type { Tab } from '../../../shared/tab-types' +import { applyLocalStructuredSessionTabSnapshots } from './local-structured-session-tabs-sync/snapshot-apply' import { - applyLocalStructuredSessionTabSnapshots, - resetLocalStructuredSessionVersionForTests -} from './local-structured-session-tabs-sync' -import { localStructuredSessionEpochHistoryByWorktree } from './local-structured-session-tabs-sync/inventory-generation-fence' + resetLocalStructuredSessionVersionForTests, + localStructuredSessionEpochHistoryByWorktree +} from './local-structured-session-tabs-sync/inventory-generation-fence' import type { WebSessionTabsSyncState } from './web-session-tabs-sync/state' import { resetWebSessionFocusIntentForTests } from './web-session-focus-intent' diff --git a/src/renderer/src/runtime/local-structured-session-reveal-visibility.test.ts b/src/renderer/src/runtime/local-structured-session-reveal-visibility.test.ts index 6df5e16a869..ab0e1d4a1c3 100644 --- a/src/renderer/src/runtime/local-structured-session-reveal-visibility.test.ts +++ b/src/renderer/src/runtime/local-structured-session-reveal-visibility.test.ts @@ -14,10 +14,8 @@ import { afterEach, describe, expect, it } from 'vitest' import { UNPUBLISHED_WORKTREE_PUBLICATION_EPOCH } from '../../../shared/runtime-types' import type { RuntimeMobileSessionTabsResult } from '../../../shared/runtime-types' import type { WorktreeRuntimeOwnerState } from '../lib/worktree-runtime-owner' -import { - applyLocalStructuredSessionTabSnapshots, - resetLocalStructuredSessionVersionForTests -} from './local-structured-session-tabs-sync' +import { applyLocalStructuredSessionTabSnapshots } from './local-structured-session-tabs-sync/snapshot-apply' +import { resetLocalStructuredSessionVersionForTests } from './local-structured-session-tabs-sync/inventory-generation-fence' import type { WebSessionTabsSyncState } from './web-session-tabs-sync/state' import { resetWebSessionTabsSnapshotFreshnessForTests } from './web-session-tabs-sync/tracking-lifecycle' diff --git a/src/renderer/src/runtime/local-structured-session-tabs-host-isolation.test.ts b/src/renderer/src/runtime/local-structured-session-tabs-host-isolation.test.ts index 9bcf8091cb3..ae783d8c5d2 100644 --- a/src/renderer/src/runtime/local-structured-session-tabs-host-isolation.test.ts +++ b/src/renderer/src/runtime/local-structured-session-tabs-host-isolation.test.ts @@ -2,10 +2,8 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import type { RuntimeMobileSessionTabsResult } from '../../../shared/runtime-types' import { toRuntimeExecutionHostId, toSshExecutionHostId } from '../../../shared/execution-host' import { toWebTerminalSurfaceTabId } from '../../../shared/terminal-surface-id' -import { - applyLocalStructuredSessionTabSnapshots, - projectLocalStructuredSessionTabs -} from './local-structured-session-tabs-sync' +import { applyLocalStructuredSessionTabSnapshots } from './local-structured-session-tabs-sync/snapshot-apply' +import { projectLocalStructuredSessionTabs } from './local-structured-session-tabs-sync/snapshot-projection' import { applyWebSessionTabsSnapshot } from './web-session-tabs-sync/snapshot-api' import type { WebSessionTabsSyncState } from './web-session-tabs-sync/state' import { diff --git a/src/renderer/src/runtime/local-structured-session-tabs-sync.test.ts b/src/renderer/src/runtime/local-structured-session-tabs-sync.test.ts index c9a01f3acc7..2b143051e2b 100644 --- a/src/renderer/src/runtime/local-structured-session-tabs-sync.test.ts +++ b/src/renderer/src/runtime/local-structured-session-tabs-sync.test.ts @@ -8,12 +8,10 @@ import type { WorkspaceSessionState } from '../../../shared/workspace-session-st import type { WorktreeRuntimeOwnerState } from '../lib/worktree-runtime-owner' import { buildPersistedUnifiedTabSessionData } from '../lib/workspace-session-unified-tabs' import { buildHydratedTabState } from '../store/slices/tabs-hydration' -import { - applyLocalStructuredSessionTabSnapshots, - projectLocalStructuredSessionTabs, - resetLocalStructuredSessionVersionForTests, - startLocalStructuredSessionTabsSync -} from './local-structured-session-tabs-sync' +import { applyLocalStructuredSessionTabSnapshots } from './local-structured-session-tabs-sync/snapshot-apply' +import { projectLocalStructuredSessionTabs } from './local-structured-session-tabs-sync/snapshot-projection' +import { resetLocalStructuredSessionVersionForTests } from './local-structured-session-tabs-sync/inventory-generation-fence' +import { startLocalStructuredSessionTabsSync } from './local-structured-session-tabs-sync/subscription' import { applyWebSessionTabsSnapshot } from './web-session-tabs-sync/snapshot-api' import { resetWebSessionTabsSnapshotFreshnessForTests } from './web-session-tabs-sync/tracking-lifecycle' import type { WebSessionTabsSyncState } from './web-session-tabs-sync/state' @@ -314,7 +312,7 @@ describe('local structured session tab projection', () => { try { vi.resetModules() const { restoreLocalStructuredSessionTabsOnce } = - await import('./local-structured-session-tabs-sync') + await import('./local-structured-session-tabs-sync/inventory-refresh') let settled = false const restored = restoreLocalStructuredSessionTabsOnce().finally(() => { settled = true diff --git a/src/renderer/src/runtime/local-structured-session-tabs-sync.ts b/src/renderer/src/runtime/local-structured-session-tabs-sync.ts index be52f217f54..ac5feeb72df 100644 --- a/src/renderer/src/runtime/local-structured-session-tabs-sync.ts +++ b/src/renderer/src/runtime/local-structured-session-tabs-sync.ts @@ -3,24 +3,6 @@ import { useAppStore } from '../store' import { startLocalStructuredSessionTabsSync } from './local-structured-session-tabs-sync/subscription' import { useLocalStructuredChatsInUse } from './local-structured-chats' -export { - isCurrentLocalStructuredSessionGeneration, - localStructuredSessionGeneration, - resetLocalStructuredSessionVersionForTests -} from './local-structured-session-tabs-sync/inventory-generation-fence' -export { - refreshLocalStructuredSessionTabs, - refreshLocalStructuredSessionWorktreeTabs, - restoreLocalStructuredSessionTabsOnce -} from './local-structured-session-tabs-sync/inventory-refresh' -export { - applyLocalStructuredSessionTabSnapshots, - applyStructuredSessionTabSnapshots -} from './local-structured-session-tabs-sync/snapshot-apply' -export { LOCAL_STRUCTURED_SESSION_OWNER } from './local-structured-session-owner' -export { projectLocalStructuredSessionTabs } from './local-structured-session-tabs-sync/snapshot-projection' -export { startLocalStructuredSessionTabsSync } from './local-structured-session-tabs-sync/subscription' - /** Mirrors this machine's structured chats whenever they can exist, whatever the chat setting says: * the setting picks what new agents open as, and chats that already exist keep showing. */ export function useLocalStructuredSessionTabsSync(): void { diff --git a/src/renderer/src/runtime/local-structured-session-unverifiable-inventory.test.ts b/src/renderer/src/runtime/local-structured-session-unverifiable-inventory.test.ts index 4817e9d3379..cc0cfa9d890 100644 --- a/src/renderer/src/runtime/local-structured-session-unverifiable-inventory.test.ts +++ b/src/renderer/src/runtime/local-structured-session-unverifiable-inventory.test.ts @@ -9,10 +9,8 @@ import type { RuntimeMobileSessionTabsResult } from '../../../shared/runtime-typ import type { Tab } from '../../../shared/tab-types' import type { WorkspaceSessionState } from '../../../shared/workspace-session-state-types' import { buildPersistedUnifiedTabSessionData } from '../lib/workspace-session-unified-tabs' -import { - applyLocalStructuredSessionTabSnapshots, - resetLocalStructuredSessionVersionForTests -} from './local-structured-session-tabs-sync' +import { applyLocalStructuredSessionTabSnapshots } from './local-structured-session-tabs-sync/snapshot-apply' +import { resetLocalStructuredSessionVersionForTests } from './local-structured-session-tabs-sync/inventory-generation-fence' import { applyWebSessionTabsSnapshot } from './web-session-tabs-sync/snapshot-api' import { resetWebSessionTabsSnapshotFreshnessForTests } from './web-session-tabs-sync/tracking-lifecycle' import type { WebSessionTabsSyncState } from './web-session-tabs-sync/state' diff --git a/src/renderer/src/runtime/remote-runtime-snapshot-outcome.test.ts b/src/renderer/src/runtime/remote-runtime-snapshot-outcome.test.ts index f7dc304e5b9..d46c18d70d7 100644 --- a/src/renderer/src/runtime/remote-runtime-snapshot-outcome.test.ts +++ b/src/renderer/src/runtime/remote-runtime-snapshot-outcome.test.ts @@ -9,9 +9,9 @@ import { } from '../../../shared/terminal-stream-protocol' import { getRemoteRuntimeTerminalMultiplexer, - resetRemoteRuntimeTerminalMultiplexersForTests, - type RemoteRuntimeMultiplexedTerminal + resetRemoteRuntimeTerminalMultiplexersForTests } from './remote-runtime-terminal-multiplexer' +import type { RemoteRuntimeMultiplexedTerminal } from './remote-runtime-terminal-multiplexer-types' import { replaceRuntimeEnvironmentRevisions } from './runtime-environment-revision' import { stubRuntimeEnvironmentBridge } from './runtime-environment-bridge-fixture' diff --git a/src/renderer/src/runtime/remote-runtime-terminal-frame-drop-resync.test.ts b/src/renderer/src/runtime/remote-runtime-terminal-frame-drop-resync.test.ts index 0bc2636414a..3d71ef1b5fe 100644 --- a/src/renderer/src/runtime/remote-runtime-terminal-frame-drop-resync.test.ts +++ b/src/renderer/src/runtime/remote-runtime-terminal-frame-drop-resync.test.ts @@ -9,9 +9,9 @@ import { } from '../../../shared/terminal-stream-protocol' import { getRemoteRuntimeTerminalMultiplexer, - resetRemoteRuntimeTerminalMultiplexersForTests, - type RemoteRuntimeMultiplexedTerminal + resetRemoteRuntimeTerminalMultiplexersForTests } from './remote-runtime-terminal-multiplexer' +import type { RemoteRuntimeMultiplexedTerminal } from './remote-runtime-terminal-multiplexer-types' import { replaceRuntimeEnvironmentRevisions } from './runtime-environment-revision' import { stubRuntimeEnvironmentBridge } from './runtime-environment-bridge-fixture' diff --git a/src/renderer/src/runtime/remote-runtime-terminal-multiplexer.ts b/src/renderer/src/runtime/remote-runtime-terminal-multiplexer.ts index c106da12ce4..970394ab798 100644 --- a/src/renderer/src/runtime/remote-runtime-terminal-multiplexer.ts +++ b/src/renderer/src/runtime/remote-runtime-terminal-multiplexer.ts @@ -10,23 +10,6 @@ import { onRuntimeEnvironmentsRetired } from './runtime-environment-revision' -export { - REMOTE_TERMINAL_SNAPSHOT_REQUEST_TIMEOUT_MS, - REMOTE_TERMINAL_SNAPSHOT_TOO_LARGE -} from './remote-runtime-terminal-snapshot-state' -export { isHostAnsweredSnapshotRetryCause } from './remote-runtime-terminal-multiplexer-types' -export type { - RemoteRuntimeMultiplexedTerminal, - RemoteRuntimeMultiplexedTerminalCallbacks, - RemoteRuntimeSnapshotAvailability, - RemoteRuntimeSnapshotHostRetryCause, - RemoteRuntimeSnapshotImage, - RemoteRuntimeSnapshotLocalRetryCause, - RemoteRuntimeSnapshotOutcome, - RemoteRuntimeSnapshotPermanentReason, - RemoteRuntimeSnapshotRetryCause -} from './remote-runtime-terminal-multiplexer-types' - const multiplexers = new Map() // Why: a removed or replaced machine's streams end for good, before its new revision is published. diff --git a/src/renderer/src/runtime/remote-runtime-terminal-snapshot-kitty-flags.test.ts b/src/renderer/src/runtime/remote-runtime-terminal-snapshot-kitty-flags.test.ts index a2feafaa1ef..4985aeed978 100644 --- a/src/renderer/src/runtime/remote-runtime-terminal-snapshot-kitty-flags.test.ts +++ b/src/renderer/src/runtime/remote-runtime-terminal-snapshot-kitty-flags.test.ts @@ -9,9 +9,9 @@ import { } from '../../../shared/terminal-stream-protocol' import { getRemoteRuntimeTerminalMultiplexer, - resetRemoteRuntimeTerminalMultiplexersForTests, - type RemoteRuntimeMultiplexedTerminal + resetRemoteRuntimeTerminalMultiplexersForTests } from './remote-runtime-terminal-multiplexer' +import type { RemoteRuntimeMultiplexedTerminal } from './remote-runtime-terminal-multiplexer-types' import { replaceRuntimeEnvironmentRevisions } from './runtime-environment-revision' import { stubRuntimeEnvironmentBridge } from './runtime-environment-bridge-fixture' diff --git a/src/renderer/src/runtime/remote-runtime-terminal-stale-stream-frames.test.ts b/src/renderer/src/runtime/remote-runtime-terminal-stale-stream-frames.test.ts index 811ecafd060..494b3aacc4a 100644 --- a/src/renderer/src/runtime/remote-runtime-terminal-stale-stream-frames.test.ts +++ b/src/renderer/src/runtime/remote-runtime-terminal-stale-stream-frames.test.ts @@ -6,9 +6,9 @@ import { } from '../../../shared/terminal-stream-protocol' import { getRemoteRuntimeTerminalMultiplexer, - resetRemoteRuntimeTerminalMultiplexersForTests, - type RemoteRuntimeMultiplexedTerminal + resetRemoteRuntimeTerminalMultiplexersForTests } from './remote-runtime-terminal-multiplexer' +import type { RemoteRuntimeMultiplexedTerminal } from './remote-runtime-terminal-multiplexer-types' import { replaceRuntimeEnvironmentRevisions } from './runtime-environment-revision' import { stubRuntimeEnvironmentBridge } from './runtime-environment-bridge-fixture' diff --git a/src/renderer/src/runtime/remote-runtime-terminal-stall-recovery.test.ts b/src/renderer/src/runtime/remote-runtime-terminal-stall-recovery.test.ts index b28d6507de1..7ba6f3711b9 100644 --- a/src/renderer/src/runtime/remote-runtime-terminal-stall-recovery.test.ts +++ b/src/renderer/src/runtime/remote-runtime-terminal-stall-recovery.test.ts @@ -174,8 +174,10 @@ describe('remote terminal stalled stream recovery', () => { }) it('probes then restarts a stream when an entered command receives no frames', async () => { - const { getRemoteRuntimeTerminalMultiplexer, REMOTE_TERMINAL_SNAPSHOT_REQUEST_TIMEOUT_MS } = + const { getRemoteRuntimeTerminalMultiplexer } = await import('./remote-runtime-terminal-multiplexer') + const { REMOTE_TERMINAL_SNAPSHOT_REQUEST_TIMEOUT_MS } = + await import('./remote-runtime-terminal-snapshot-state') const onTransportClose = vi.fn() const stream = await getRemoteRuntimeTerminalMultiplexer('windows-test').subscribeTerminal({ terminal: 'term-silent', diff --git a/src/renderer/src/runtime/structured-session-tab-inventory.test.ts b/src/renderer/src/runtime/structured-session-tab-inventory.test.ts index f0c53477c53..dc313093f06 100644 --- a/src/renderer/src/runtime/structured-session-tab-inventory.test.ts +++ b/src/renderer/src/runtime/structured-session-tab-inventory.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' -import { refreshLocalStructuredSessionTabs } from './local-structured-session-tabs-sync' +import { refreshLocalStructuredSessionTabs } from './local-structured-session-tabs-sync/inventory-refresh' import { callRuntimeRpc } from './runtime-rpc-client' import { readStructuredSessionTabInventory } from './structured-session-tab-inventory' -vi.mock('./local-structured-session-tabs-sync', () => ({ +vi.mock('./local-structured-session-tabs-sync/inventory-refresh', () => ({ refreshLocalStructuredSessionTabs: vi.fn() })) vi.mock('./runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() })) diff --git a/src/renderer/src/runtime/structured-session-tab-inventory.ts b/src/renderer/src/runtime/structured-session-tab-inventory.ts index a418e11751e..30e0aad531c 100644 --- a/src/renderer/src/runtime/structured-session-tab-inventory.ts +++ b/src/renderer/src/runtime/structured-session-tab-inventory.ts @@ -1,5 +1,5 @@ import type { RuntimeMobileSessionTabsResult } from '../../../shared/runtime-types' -import { refreshLocalStructuredSessionTabs } from './local-structured-session-tabs-sync' +import { refreshLocalStructuredSessionTabs } from './local-structured-session-tabs-sync/inventory-refresh' import type { RuntimeClientTarget } from './runtime-client-target' import { callRuntimeRpc } from './runtime-rpc-client' import { isSessionTabsListAllResult } from './web-session-tabs-sync/tracking' diff --git a/src/renderer/src/store/slices/runtime-pane-title-sort-epoch.test.ts b/src/renderer/src/store/slices/runtime-pane-title-sort-epoch.test.ts index 4c917c15a27..9e8e43943e6 100644 --- a/src/renderer/src/store/slices/runtime-pane-title-sort-epoch.test.ts +++ b/src/renderer/src/store/slices/runtime-pane-title-sort-epoch.test.ts @@ -4,7 +4,7 @@ vi.mock('sonner', () => ({ toast: { info: vi.fn(), success: vi.fn(), error: vi.f vi.mock('@/runtime/sync-runtime-graph', () => ({ scheduleRuntimeGraphSync: vi.fn() })) -vi.mock('@/components/terminal-pane/pty-transport', () => ({ +vi.mock('@/components/terminal-pane/pty-dispatcher', () => ({ registerEagerPtyBuffer: vi.fn(), ensurePtyDispatcher: vi.fn(), unregisterPtyDataHandlers: vi.fn() diff --git a/src/renderer/src/store/slices/store-session-terminal-reconnect.test.ts b/src/renderer/src/store/slices/store-session-terminal-reconnect.test.ts index 44a71a64730..e266c8099c5 100644 --- a/src/renderer/src/store/slices/store-session-terminal-reconnect.test.ts +++ b/src/renderer/src/store/slices/store-session-terminal-reconnect.test.ts @@ -19,7 +19,7 @@ vi.mock('@/lib/agent-status', async (importOriginal) => { }) // Mock pty-transport's eager buffer registration -vi.mock('@/components/terminal-pane/pty-transport', () => ({ +vi.mock('@/components/terminal-pane/pty-dispatcher', () => ({ registerEagerPtyBuffer: vi.fn().mockReturnValue({ flush: () => '', dispose: () => {} }), ensurePtyDispatcher: vi.fn() })) diff --git a/src/renderer/src/store/slices/terminal-tab-id-hydration.test.ts b/src/renderer/src/store/slices/terminal-tab-id-hydration.test.ts index 85370dca9c7..ea6d91cdcbc 100644 --- a/src/renderer/src/store/slices/terminal-tab-id-hydration.test.ts +++ b/src/renderer/src/store/slices/terminal-tab-id-hydration.test.ts @@ -6,7 +6,7 @@ vi.mock('sonner', () => ({ toast: { info: vi.fn(), success: vi.fn(), error: vi.f vi.mock('@/runtime/sync-runtime-graph', () => ({ scheduleRuntimeGraphSync: vi.fn() })) -vi.mock('@/components/terminal-pane/pty-transport', () => ({ +vi.mock('@/components/terminal-pane/pty-dispatcher', () => ({ registerEagerPtyBuffer: vi.fn(), ensurePtyDispatcher: vi.fn() })) diff --git a/src/renderer/src/store/slices/terminal-tab-title-batch.test.ts b/src/renderer/src/store/slices/terminal-tab-title-batch.test.ts index 5fa1700357e..1570879f082 100644 --- a/src/renderer/src/store/slices/terminal-tab-title-batch.test.ts +++ b/src/renderer/src/store/slices/terminal-tab-title-batch.test.ts @@ -4,7 +4,7 @@ import { makePaneKey } from '../../../../shared/stable-pane-id' vi.mock('sonner', () => ({ toast: { info: vi.fn(), success: vi.fn(), error: vi.fn() } })) vi.mock('@/runtime/sync-runtime-graph', () => ({ scheduleRuntimeGraphSync: vi.fn() })) -vi.mock('@/components/terminal-pane/pty-transport', () => ({ +vi.mock('@/components/terminal-pane/pty-dispatcher', () => ({ registerEagerPtyBuffer: vi.fn(), ensurePtyDispatcher: vi.fn(), unregisterPtyDataHandlers: vi.fn() diff --git a/src/renderer/src/store/slices/terminals-explicit-empty-hydration.test.ts b/src/renderer/src/store/slices/terminals-explicit-empty-hydration.test.ts index 698b950f1f2..4e0aa6d980b 100644 --- a/src/renderer/src/store/slices/terminals-explicit-empty-hydration.test.ts +++ b/src/renderer/src/store/slices/terminals-explicit-empty-hydration.test.ts @@ -6,7 +6,7 @@ import { shouldAutoCreateInitialTerminal } from '@/components/terminal/initial-t vi.mock('sonner', () => ({ toast: { info: vi.fn(), success: vi.fn(), error: vi.fn() } })) vi.mock('@/runtime/sync-runtime-graph', () => ({ scheduleRuntimeGraphSync: vi.fn() })) -vi.mock('@/components/terminal-pane/pty-transport', () => ({ +vi.mock('@/components/terminal-pane/pty-dispatcher', () => ({ registerEagerPtyBuffer: vi.fn(), ensurePtyDispatcher: vi.fn() })) diff --git a/src/renderer/src/store/slices/terminals-hydration-canonical-pty-overlap.test.ts b/src/renderer/src/store/slices/terminals-hydration-canonical-pty-overlap.test.ts index f5a908633d6..45a1cc3cb93 100644 --- a/src/renderer/src/store/slices/terminals-hydration-canonical-pty-overlap.test.ts +++ b/src/renderer/src/store/slices/terminals-hydration-canonical-pty-overlap.test.ts @@ -14,7 +14,7 @@ vi.mock('sonner', () => ({ toast: { info: vi.fn(), success: vi.fn(), error: vi.f vi.mock('@/runtime/sync-runtime-graph', () => ({ scheduleRuntimeGraphSync: vi.fn() })) -vi.mock('@/components/terminal-pane/pty-transport', () => ({ +vi.mock('@/components/terminal-pane/pty-dispatcher', () => ({ registerEagerPtyBuffer: vi.fn(), ensurePtyDispatcher: vi.fn() })) diff --git a/src/renderer/src/store/slices/terminals-hydration-canonical-rows.test.ts b/src/renderer/src/store/slices/terminals-hydration-canonical-rows.test.ts index 81362f8d50f..1db15ea6575 100644 --- a/src/renderer/src/store/slices/terminals-hydration-canonical-rows.test.ts +++ b/src/renderer/src/store/slices/terminals-hydration-canonical-rows.test.ts @@ -10,7 +10,7 @@ vi.mock('sonner', () => ({ toast: { info: vi.fn(), success: vi.fn(), error: vi.f vi.mock('@/runtime/sync-runtime-graph', () => ({ scheduleRuntimeGraphSync: vi.fn() })) -vi.mock('@/components/terminal-pane/pty-transport', () => ({ +vi.mock('@/components/terminal-pane/pty-dispatcher', () => ({ registerEagerPtyBuffer: vi.fn(), ensurePtyDispatcher: vi.fn() })) diff --git a/src/renderer/src/store/slices/terminals-hydration.test.ts b/src/renderer/src/store/slices/terminals-hydration.test.ts index 46b39f2f6df..81a03446523 100644 --- a/src/renderer/src/store/slices/terminals-hydration.test.ts +++ b/src/renderer/src/store/slices/terminals-hydration.test.ts @@ -4,7 +4,7 @@ vi.mock('sonner', () => ({ toast: { info: vi.fn(), success: vi.fn(), error: vi.f vi.mock('@/runtime/sync-runtime-graph', () => ({ scheduleRuntimeGraphSync: vi.fn() })) -vi.mock('@/components/terminal-pane/pty-transport', () => ({ +vi.mock('@/components/terminal-pane/pty-dispatcher', () => ({ registerEagerPtyBuffer: vi.fn(), ensurePtyDispatcher: vi.fn() })) diff --git a/src/renderer/src/store/terminals/terminal-pane-hibernation.ts b/src/renderer/src/store/terminals/terminal-pane-hibernation.ts index beccf4cd049..44cb03c5c91 100644 --- a/src/renderer/src/store/terminals/terminal-pane-hibernation.ts +++ b/src/renderer/src/store/terminals/terminal-pane-hibernation.ts @@ -3,7 +3,7 @@ import { parsePaneKey } from '../../../../shared/stable-pane-id' import { restorePtyDataHandlersAfterFailedShutdown, unregisterPtyDataHandlers -} from '@/components/terminal-pane/pty-transport' +} from '@/components/terminal-pane/pty-dispatcher' import { shutdownBufferCaptures } from '@/components/terminal-pane/shutdown-buffer-captures' import { callRuntimeRpc } from '@/runtime/runtime-rpc-client' import { toRuntimeWorktreeSelector } from '@/runtime/runtime-worktree-selector' diff --git a/src/renderer/src/store/terminals/terminal-shutdown-guards-identity.test.ts b/src/renderer/src/store/terminals/terminal-shutdown-guards-identity.test.ts index c353991c2c1..b3f5a7ff04a 100644 --- a/src/renderer/src/store/terminals/terminal-shutdown-guards-identity.test.ts +++ b/src/renderer/src/store/terminals/terminal-shutdown-guards-identity.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest' import type { AppState } from '../types' import { createTerminalShutdownGuardController } from './terminal-shutdown-guards' -vi.mock('@/components/terminal-pane/pty-transport', () => ({ +vi.mock('@/components/terminal-pane/pty-dispatcher', () => ({ restorePtyDataHandlersAfterFailedShutdown: vi.fn(), unregisterPtyDataHandlers: vi.fn(() => []) })) diff --git a/src/renderer/src/store/terminals/terminal-shutdown-guards.ts b/src/renderer/src/store/terminals/terminal-shutdown-guards.ts index 2f89610b45b..85804916f5f 100644 --- a/src/renderer/src/store/terminals/terminal-shutdown-guards.ts +++ b/src/renderer/src/store/terminals/terminal-shutdown-guards.ts @@ -3,7 +3,7 @@ import type { TerminalTab } from '../../../../shared/terminal-tab-types' import { restorePtyDataHandlersAfterFailedShutdown, unregisterPtyDataHandlers -} from '@/components/terminal-pane/pty-transport' +} from '@/components/terminal-pane/pty-dispatcher' import type { PtyDataHandlerShutdownSnapshot } from '@/components/terminal-pane/pty-shutdown-data-suspension' import { disposeParkedTerminalWatchersForPtyIds } from '@/components/terminal-pane/terminal-parked-watcher-registry' import { diff --git a/tests/e2e/structured-session-reopened-tab-close.unit.test.ts b/tests/e2e/structured-session-reopened-tab-close.unit.test.ts index 79e63d5df25..972369558ae 100644 --- a/tests/e2e/structured-session-reopened-tab-close.unit.test.ts +++ b/tests/e2e/structured-session-reopened-tab-close.unit.test.ts @@ -14,7 +14,7 @@ import { OrcaRuntimeService } from '../../src/main/runtime/orca-runtime' import { setStructuredAgentSessionHost } from '../../src/main/native-chat/agent-session-wire/structured-agent-session-registry' import { useAppStore } from '../../src/renderer/src/store' import { applyStructuredSessionTabSnapshots } from '../../src/renderer/src/runtime/local-structured-session-tabs-sync/snapshot-apply' -import { resetLocalStructuredSessionVersionForTests } from '../../src/renderer/src/runtime/local-structured-session-tabs-sync' +import { resetLocalStructuredSessionVersionForTests } from '../../src/renderer/src/runtime/local-structured-session-tabs-sync/inventory-generation-fence' import { resetWebSessionTabsSnapshotFreshnessForTests } from '../../src/renderer/src/runtime/web-session-tabs-sync/tracking-lifecycle' import { registerSessionTabIpcBridge } from '../../src/renderer/src/hooks/ipc-events/session-tab-ipc-bridge' import { registerTerminalUiRoutingIpcBridge } from '../../src/renderer/src/hooks/ipc-events/terminal-ui-routing-ipc-bridge' diff --git a/tests/e2e/structured-session-tab-close-stale-frame.unit.test.ts b/tests/e2e/structured-session-tab-close-stale-frame.unit.test.ts index 478ba69e302..9c7973b1a54 100644 --- a/tests/e2e/structured-session-tab-close-stale-frame.unit.test.ts +++ b/tests/e2e/structured-session-tab-close-stale-frame.unit.test.ts @@ -15,7 +15,7 @@ import { OrcaRuntimeService } from '../../src/main/runtime/orca-runtime' import { setStructuredAgentSessionHost } from '../../src/main/native-chat/agent-session-wire/structured-agent-session-registry' import { useAppStore } from '../../src/renderer/src/store' import { applyStructuredSessionTabSnapshots } from '../../src/renderer/src/runtime/local-structured-session-tabs-sync/snapshot-apply' -import { resetLocalStructuredSessionVersionForTests } from '../../src/renderer/src/runtime/local-structured-session-tabs-sync' +import { resetLocalStructuredSessionVersionForTests } from '../../src/renderer/src/runtime/local-structured-session-tabs-sync/inventory-generation-fence' import { applyWebSessionTabsSnapshot } from '../../src/renderer/src/runtime/web-session-tabs-sync/snapshot-api' import { resetWebSessionTabsSnapshotFreshnessForTests } from '../../src/renderer/src/runtime/web-session-tabs-sync/tracking-lifecycle' import { acceptPairedHostStructuredSessions } from '../../src/renderer/src/runtime/structured-agent-session-tab-retirement' diff --git a/tests/e2e/terminal-binding-crash-hydration.unit.test.ts b/tests/e2e/terminal-binding-crash-hydration.unit.test.ts index ec83a396e38..83b35abe8d6 100644 --- a/tests/e2e/terminal-binding-crash-hydration.unit.test.ts +++ b/tests/e2e/terminal-binding-crash-hydration.unit.test.ts @@ -14,7 +14,7 @@ import { vi.mock('sonner', () => ({ toast: { info: vi.fn(), success: vi.fn(), error: vi.fn() } })) vi.mock('@/runtime/sync-runtime-graph', () => ({ scheduleRuntimeGraphSync: vi.fn() })) -vi.mock('@/components/terminal-pane/pty-transport', () => ({ +vi.mock('@/components/terminal-pane/pty-dispatcher', () => ({ registerEagerPtyBuffer: vi.fn(), ensurePtyDispatcher: vi.fn() }))