mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 08:37:49 +00:00
refactor(renderer): remove the keyboard-handlers barrel and partial re-exports (#27986)
Co-authored-by: m4air <m4air@Mac.localdomain>
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
+1
-1
@@ -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 = {
|
||||
|
||||
@@ -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,
|
||||
|
||||
+1
-1
@@ -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 () => [])
|
||||
}))
|
||||
|
||||
|
||||
+1
-1
@@ -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
|
||||
}))
|
||||
|
||||
|
||||
@@ -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)
|
||||
}))
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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<typeof useExpandCollapseActions>[0]
|
||||
type KeyboardHandlersDeps = Parameters<typeof useTerminalKeyboardShortcuts>[0]
|
||||
|
||||
+2
-4
@@ -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() }))
|
||||
|
||||
+2
-2
@@ -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<typeof useTerminalKeyboardShortcuts>[0]
|
||||
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
matchSearchNavigate,
|
||||
resolveTerminalKeyboardShortcutAction,
|
||||
runTerminalSearchNavigation
|
||||
} from './keyboard-handlers'
|
||||
} from './terminal-keyboard-shortcut-matching'
|
||||
|
||||
function makeKeyEvent(
|
||||
overrides: Partial<{
|
||||
|
||||
@@ -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 }
|
||||
@@ -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,
|
||||
|
||||
+1
-1
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
+1
-1
@@ -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'
|
||||
|
||||
+1
-1
@@ -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 = {
|
||||
|
||||
+2
-2
@@ -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 =
|
||||
|
||||
+1
-1
@@ -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'
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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'
|
||||
|
||||
+1
-2
@@ -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'
|
||||
|
||||
|
||||
@@ -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() })
|
||||
|
||||
|
||||
+28
-18
@@ -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())
|
||||
|
||||
+13
-17
@@ -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()
|
||||
|
||||
+16
-18
@@ -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()
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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,
|
||||
|
||||
+1
-3
@@ -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())
|
||||
|
||||
@@ -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
|
||||
|
||||
-1
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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 })
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<PtyTransport, 'getExecutionHostId' | 'getRuntimeEnvironmentId'>
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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,
|
||||
|
||||
+1
-1
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<PtyTransport, 'isConnected' | 'sendInputImmediate'>
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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,
|
||||
|
||||
+1
-1
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-1
@@ -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 = {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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<PtyTransport, 'sendInput' | 'sendInputAccepted'>
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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'
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<Record<string, unknown>>()),
|
||||
applyStructuredSessionTabSnapshots: mocks.apply
|
||||
}))
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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', () => ({
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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', () => ({
|
||||
|
||||
@@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user