refactor(pty): no ipc/pty.ts barrel (#27798)

* refactor(pty): no ipc/pty.ts barrel

* test(orcad): clarify preflight-order comment

---------

Co-authored-by: m4air <m4air@Mac.localdomain>
This commit is contained in:
OrcaWin
2026-10-11 23:45:07 -07:00
committed by GitHub
co-authored by m4air
parent 8a1c63b381
commit aeffeb4cfb
168 changed files with 397 additions and 299 deletions
+1 -1
View File
@@ -187,7 +187,7 @@ describe('PR E2E gate contract', () => {
'src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-test-harness.ts'
])
).not.toContain('tests/e2e/paired-remote-terminal-materialization-reconnect.spec.ts')
expect(selectPrE2eSpecs(['src/main/ipc/pty.ts'])).not.toContain(
expect(selectPrE2eSpecs(['src/main/ipc/pty/register-handlers.ts'])).not.toContain(
'tests/e2e/paired-remote-terminal-materialization-reconnect.spec.ts'
)
})
@@ -1,6 +1,6 @@
/**
* Minimal `electron` module for wsl-hook-relay-reattach-benchmark.mjs, which loads the real
* src/main/ipc/pty.ts under plain node. Only the surfaces that main's PTY graph touches are
* src/main/ipc/pty/ handlers under plain node. Only the surfaces that main's PTY graph touches are
* implemented; everything else stays undefined so an unexpected dependency fails loudly.
*/
import { homedir, tmpdir } from 'node:os'
@@ -287,7 +287,8 @@ async function main() {
// Why: main's PTY graph reads app paths at import time; keep it inside a disposable directory.
let userDataDir
let ptyIpc
let registerPtyHandlers
let killAllPty
let cleanupPaths = []
let manager = null
let staller = null
@@ -302,8 +303,9 @@ async function main() {
}
})
// Why sequential: concurrent jiti.import calls can each instantiate the module graph, and two
// copies of wsl-hook-relay-manager.ts would leave pty.ts refreshing a singleton we never see.
ptyIpc = await jiti.import('../../src/main/ipc/pty.ts')
// copies of wsl-hook-relay-manager.ts would leave the PTY graph refreshing a singleton we never see.
;({ registerPtyHandlers } = await jiti.import('../../src/main/ipc/pty/register-handlers.ts'))
;({ killAllPty } = await jiti.import('../../src/main/ipc/pty/kill-all.ts'))
const { WslHookRelayManager, wslHookRelayManager } = await jiti.import(
'../../src/main/agent-hooks/wsl-hook-relay-manager.ts'
)
@@ -318,7 +320,7 @@ async function main() {
const { FLOATING_TERMINAL_WORKTREE_ID } = await jiti.import('../../src/shared/constants.ts')
// Why: if jiti ever returns a second manager module, our monkey-patch would miss the singleton
// that ensureWslHookRelayForReattach (loaded via pty.ts) closes over — fail closed now.
// that ensureWslHookRelayForReattach (loaded via the PTY graph) closes over — fail closed now.
const singletonProbe = []
const previousEnsure = wslHookRelayManager.ensureForDistro.bind(wslHookRelayManager)
wslHookRelayManager.ensureForDistro = (probedDistro) => {
@@ -331,7 +333,7 @@ async function main() {
wslHookRelayManager.ensureForDistro = previousEnsure
if (singletonProbe.length !== 1 || singletonProbe[0] !== '__bench-singleton-probe__') {
throw new Error(
'jiti duplicated the WSL hook-relay manager graph; reattach patch would not observe pty.ts'
'jiti duplicated the WSL hook-relay manager graph; reattach patch would not observe the PTY spawn path'
)
}
@@ -354,9 +356,9 @@ async function main() {
const relayRefreshes = []
let delivered = 0
// Why: pty.ts refreshes through the production singleton, so route that singleton at the
// Why: the PTY spawn path refreshes through the production singleton, so route that singleton at the
// benchmark-scoped manager instead of calling the reattach helper from here — a removed or
// mislocated integration call in pty.ts must fail this benchmark.
// mislocated integration call in the PTY spawn path must fail this benchmark.
wslHookRelayManager.ensureForDistro = (refreshedDistro) => {
relayRefreshes.push(refreshedDistro)
manager?.ensureForDistro(refreshedDistro)
@@ -367,7 +369,7 @@ async function main() {
// hooks are on. This bench isolates the reattach call site (ensureWslHookRelayForReattach);
// the manager's own hooks gate lives behind the ensureForDistro patch above, so it stays out
// of the measurement — `manager` below resolves its own (enabled) managed-hook settings.
ptyIpc.registerPtyHandlers(
registerPtyHandlers(
createRendererWindowStub(),
runtime,
undefined,
@@ -520,7 +522,7 @@ async function main() {
} finally {
manager?.disposeAll()
await staller?.stop()
ptyIpc?.killAllPty?.()
killAllPty?.()
if (userDataDir) {
rmSync(userDataDir, { recursive: true, force: true })
}
@@ -40,7 +40,8 @@ vi.mock('./client', () => moduleFactories.client())
vi.mock('./daemon-lifecycle-event', () => moduleFactories.daemonLifecycleEvent())
vi.mock('./daemon-spawner', () => moduleFactories.daemonSpawner())
vi.mock('./daemon-pty-adapter', () => moduleFactories.daemonPtyAdapter())
vi.mock('../ipc/pty', () => moduleFactories.ipcPty())
vi.mock('../ipc/pty/provider/registry', () => moduleFactories.ptyProviderRegistry())
vi.mock('../ipc/pty/provider/listener-lifecycle', () => moduleFactories.ptyListenerLifecycle())
const ASAR_APP_PATH = join('/packaged', 'resources', 'app.asar')
const ASAR_UNPACKED_ENTRY = join(
@@ -32,7 +32,8 @@ vi.mock('./client', () => moduleFactories.client())
vi.mock('./daemon-lifecycle-event', () => moduleFactories.daemonLifecycleEvent())
vi.mock('./daemon-spawner', () => moduleFactories.daemonSpawner())
vi.mock('./daemon-pty-adapter', () => moduleFactories.daemonPtyAdapter())
vi.mock('../ipc/pty', () => moduleFactories.ipcPty())
vi.mock('../ipc/pty/provider/registry', () => moduleFactories.ptyProviderRegistry())
vi.mock('../ipc/pty/provider/listener-lifecycle', () => moduleFactories.ptyListenerLifecycle())
describe('daemon-init: runRestartDaemon (7-step sequence)', () => {
beforeEach(() => {
@@ -30,7 +30,8 @@ vi.mock('./client', () => moduleFactories.client())
vi.mock('./daemon-lifecycle-event', () => moduleFactories.daemonLifecycleEvent())
vi.mock('./daemon-spawner', () => moduleFactories.daemonSpawner())
vi.mock('./daemon-pty-adapter', () => moduleFactories.daemonPtyAdapter())
vi.mock('../ipc/pty', () => moduleFactories.ipcPty())
vi.mock('../ipc/pty/provider/registry', () => moduleFactories.ptyProviderRegistry())
vi.mock('../ipc/pty/provider/listener-lifecycle', () => moduleFactories.ptyListenerLifecycle())
describe('daemon-init: runRestartDaemon (7-step sequence)', () => {
beforeEach(() => {
@@ -226,9 +226,11 @@ export function createDaemonInitModuleFactories(state: DaemonInitMockState) {
daemonPtyAdapter: () => ({
DaemonPtyAdapter: MockDaemonPtyAdapter
}),
ipcPty: () => ({
ptyProviderRegistry: () => ({
getLocalPtyProvider: getLocalPtyProviderMock,
setLocalPtyProvider: setLocalPtyProviderMock,
setLocalPtyProvider: setLocalPtyProviderMock
}),
ptyListenerLifecycle: () => ({
unbindLocalProviderListeners: unbindLocalProviderListenersMock,
rebindLocalProviderListeners: rebindLocalProviderListenersMock
}),
@@ -44,7 +44,8 @@ vi.mock('./client', () => moduleFactories.client())
vi.mock('./daemon-lifecycle-event', () => moduleFactories.daemonLifecycleEvent())
vi.mock('./daemon-spawner', () => moduleFactories.daemonSpawner())
vi.mock('./daemon-pty-adapter', () => moduleFactories.daemonPtyAdapter())
vi.mock('../ipc/pty', () => moduleFactories.ipcPty())
vi.mock('../ipc/pty/provider/registry', () => moduleFactories.ptyProviderRegistry())
vi.mock('../ipc/pty/provider/listener-lifecycle', () => moduleFactories.ptyListenerLifecycle())
describe('daemon-init: runRestartDaemon (7-step sequence)', () => {
beforeEach(() => {
@@ -39,7 +39,8 @@ vi.mock('./client', () => moduleFactories.client())
vi.mock('./daemon-lifecycle-event', () => moduleFactories.daemonLifecycleEvent())
vi.mock('./daemon-spawner', () => moduleFactories.daemonSpawner())
vi.mock('./daemon-pty-adapter', () => moduleFactories.daemonPtyAdapter())
vi.mock('../ipc/pty', () => moduleFactories.ipcPty())
vi.mock('../ipc/pty/provider/registry', () => moduleFactories.ptyProviderRegistry())
vi.mock('../ipc/pty/provider/listener-lifecycle', () => moduleFactories.ptyListenerLifecycle())
describe('daemon-init: runRestartDaemon (7-step sequence)', () => {
beforeEach(() => {
@@ -43,7 +43,8 @@ vi.mock('./client', () => moduleFactories.client())
vi.mock('./daemon-lifecycle-event', () => moduleFactories.daemonLifecycleEvent())
vi.mock('./daemon-spawner', () => moduleFactories.daemonSpawner())
vi.mock('./daemon-pty-adapter', () => moduleFactories.daemonPtyAdapter())
vi.mock('../ipc/pty', () => moduleFactories.ipcPty())
vi.mock('../ipc/pty/provider/registry', () => moduleFactories.ptyProviderRegistry())
vi.mock('../ipc/pty/provider/listener-lifecycle', () => moduleFactories.ptyListenerLifecycle())
vi.mock('./macos-daemon-launchd', async (importOriginal) => {
const actual = await importOriginal<typeof MacDaemonLaunchd>()
return {
@@ -40,7 +40,8 @@ vi.mock('./client', () => moduleFactories.client())
vi.mock('./daemon-lifecycle-event', () => moduleFactories.daemonLifecycleEvent())
vi.mock('./daemon-spawner', () => moduleFactories.daemonSpawner())
vi.mock('./daemon-pty-adapter', () => moduleFactories.daemonPtyAdapter())
vi.mock('../ipc/pty', () => moduleFactories.ipcPty())
vi.mock('../ipc/pty/provider/registry', () => moduleFactories.ptyProviderRegistry())
vi.mock('../ipc/pty/provider/listener-lifecycle', () => moduleFactories.ptyListenerLifecycle())
describe('daemon-init: runRestartDaemon (7-step sequence)', () => {
beforeEach(() => {
@@ -47,7 +47,8 @@ vi.mock('./daemon-lifecycle-event', () => moduleFactories.daemonLifecycleEvent()
vi.mock('./daemon-adoption-telemetry-event', () => moduleFactories.daemonAdoptionTelemetryEvent())
vi.mock('./daemon-spawner', () => moduleFactories.daemonSpawner())
vi.mock('./daemon-pty-adapter', () => moduleFactories.daemonPtyAdapter())
vi.mock('../ipc/pty', () => moduleFactories.ipcPty())
vi.mock('../ipc/pty/provider/registry', () => moduleFactories.ptyProviderRegistry())
vi.mock('../ipc/pty/provider/listener-lifecycle', () => moduleFactories.ptyListenerLifecycle())
describe('daemon-init: runRestartDaemon (7-step sequence)', () => {
beforeEach(() => {
@@ -42,7 +42,8 @@ vi.mock('./client', () => moduleFactories.client())
vi.mock('./daemon-lifecycle-event', () => moduleFactories.daemonLifecycleEvent())
vi.mock('./daemon-spawner', () => moduleFactories.daemonSpawner())
vi.mock('./daemon-pty-adapter', () => moduleFactories.daemonPtyAdapter())
vi.mock('../ipc/pty', () => moduleFactories.ipcPty())
vi.mock('../ipc/pty/provider/registry', () => moduleFactories.ptyProviderRegistry())
vi.mock('../ipc/pty/provider/listener-lifecycle', () => moduleFactories.ptyListenerLifecycle())
describe('daemon-init: runRestartDaemon (7-step sequence)', () => {
beforeEach(() => {
@@ -40,7 +40,8 @@ vi.mock('./client', () => moduleFactories.client())
vi.mock('./daemon-lifecycle-event', () => moduleFactories.daemonLifecycleEvent())
vi.mock('./daemon-spawner', () => moduleFactories.daemonSpawner())
vi.mock('./daemon-pty-adapter', () => moduleFactories.daemonPtyAdapter())
vi.mock('../ipc/pty', () => moduleFactories.ipcPty())
vi.mock('../ipc/pty/provider/registry', () => moduleFactories.ptyProviderRegistry())
vi.mock('../ipc/pty/provider/listener-lifecycle', () => moduleFactories.ptyListenerLifecycle())
describe('daemon-init: runRestartDaemon (7-step sequence)', () => {
beforeEach(() => {
@@ -40,7 +40,8 @@ vi.mock('./client', () => moduleFactories.client())
vi.mock('./daemon-lifecycle-event', () => moduleFactories.daemonLifecycleEvent())
vi.mock('./daemon-spawner', () => moduleFactories.daemonSpawner())
vi.mock('./daemon-pty-adapter', () => moduleFactories.daemonPtyAdapter())
vi.mock('../ipc/pty', () => moduleFactories.ipcPty())
vi.mock('../ipc/pty/provider/registry', () => moduleFactories.ptyProviderRegistry())
vi.mock('../ipc/pty/provider/listener-lifecycle', () => moduleFactories.ptyListenerLifecycle())
describe('daemon-init: runRestartDaemon (7-step sequence)', () => {
beforeEach(() => {
@@ -1,6 +1,6 @@
import { afterEach, expect, it, vi } from 'vitest'
vi.mock('../ipc/pty', () => ({ setLocalPtyProvider: vi.fn() }))
vi.mock('../ipc/pty/provider/registry', () => ({ setLocalPtyProvider: vi.fn() }))
import { DaemonPtyRouter } from './daemon-pty-router'
import { createAdapter } from './daemon-pty-router-test-fixture'
+2 -1
View File
@@ -1,4 +1,5 @@
import { getLocalPtyProvider, rebindLocalProviderListeners } from '../ipc/pty'
import { getLocalPtyProvider } from '../ipc/pty/provider/registry'
import { rebindLocalProviderListeners } from '../ipc/pty/provider/listener-lifecycle'
import { isStartupDiagnosticsEnabled, logStartupDiagnostic } from '../startup/startup-diagnostics'
import { checkDaemonHealth } from './daemon-health'
import { collectPinnedDaemonVersions, pruneOldDaemonHosts } from './daemon-host-relocation'
+4 -1
View File
@@ -1,4 +1,7 @@
import { rebindLocalProviderListeners, unbindLocalProviderListeners } from '../ipc/pty'
import {
rebindLocalProviderListeners,
unbindLocalProviderListeners
} from '../ipc/pty/provider/listener-lifecycle'
import { DegradedDaemonPtyProvider } from './degraded-daemon-pty-provider'
import {
cleanupFailedDaemonAdoption,
+1 -1
View File
@@ -1,4 +1,4 @@
import { setLocalPtyProvider } from '../ipc/pty'
import { setLocalPtyProvider } from '../ipc/pty/provider/registry'
import { DegradedDaemonPtyProvider } from './degraded-daemon-pty-provider'
import { getDaemonRuntimeDir as getRuntimeDir } from './daemon-launch-paths'
import { readDaemonPidRecord as readDaemonPidRecordAt } from './daemon-endpoint-incarnation'
@@ -1,7 +1,8 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { makePaneKey } from '../../shared/stable-pane-id'
import { registerPtyHandlers, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
import {
resetAgentLaunchPanesForTests,
trackRunningAgentLaunchPane
@@ -1,7 +1,8 @@
import { describe, expect, it, vi } from 'vitest'
import { onMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -1,7 +1,8 @@
import { describe, expect, it, vi } from 'vitest'
import { onMock, spawnMock, trackMock, classifyErrorMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -7,7 +7,8 @@ import {
} from './pty-ipc-mock-registry'
import { TEST_CODEX_HOME, TEST_CODEX_AUTH_JSON, TEST_MANAGED_ROOT } from './pty-ipc-test-constants'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -1,7 +1,8 @@
import { describe, expect, it, vi } from 'vitest'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import type { AgentSessionOwnerBinding } from '../../shared/agent-session-host-authority'
import { clearProviderPtyState, setLocalPtyProvider } from './pty'
import { clearProviderPtyState } from './pty/provider/state-cleanup'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -2,13 +2,10 @@ import { describe, expect, it, vi } from 'vitest'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import type { AgentSessionOwnerBinding } from '../../shared/agent-session-host-authority'
import { LocalPtyProvider } from '../providers/local-pty-provider'
import {
registerPtyHandlers,
clearPtyOwnershipForConnection,
clearProviderPtyState,
setPtyOwnership,
setLocalPtyProvider
} from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { clearPtyOwnershipForConnection, clearProviderPtyState } from './pty/provider/state-cleanup'
import { setPtyOwnership } from './pty/provider/ownership-state'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -53,7 +53,8 @@ vi.mock('../pi/titlebar-extension-service', () => ({
piTitlebarExtensionService: { buildPtyEnv: () => ({}), clearPty: vi.fn() }
}))
import { registerPtyHandlers, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
import type { IPtyProvider, PtyProcessInfo } from '../providers/types'
// The runtime's worktree.ps liveness refresh calls the aggregate inventory (no connectionId)
@@ -7,13 +7,10 @@ import {
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import type { AgentSessionOwnerBinding } from '../../shared/agent-session-host-authority'
import { OrcaRuntimeService } from '../runtime/orca-runtime'
import {
registerPtyHandlers,
clearProviderPtyState,
setLocalPtyProvider,
isCurrentPtyExit,
restorePtyIncarnation
} from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { clearProviderPtyState } from './pty/provider/state-cleanup'
import { setLocalPtyProvider } from './pty/provider/registry'
import { isCurrentPtyExit, restorePtyIncarnation } from './pty/provider/ownership-state'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -1,11 +1,9 @@
import { describe, expect, it, vi } from 'vitest'
import { spawnMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import {
registerPtyHandlers,
getPtyRendererDeliveryDebugSnapshot,
setLocalPtyProvider
} from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { getPtyRendererDeliveryDebugSnapshot } from './pty/delivery/debug'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -1,6 +1,8 @@
import { describe, expect, it, vi } from 'vitest'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, setPtyOwnership, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setPtyOwnership } from './pty/provider/ownership-state'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -9,7 +9,7 @@ import { delimiter, join } from 'node:path'
import type { TuiAgent } from '../../shared/tui-agent'
import { LEGACY_TERMINAL_SHIM_REMOTE_ENV_KEYS } from '../pty/legacy-terminal-shim-dir'
import { wslHookRelayManager } from '../agent-hooks/wsl-hook-relay-manager'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -14,7 +14,8 @@ import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { createDaemonActiveProviderFixtures } from './pty-ipc-daemon-provider-fixtures'
import { join } from 'node:path'
import { SETUP_AGENT_SEQUENCE_STARTUP_COMMAND_ENV } from '../../shared/setup-agent-sequencing'
import { registerPtyHandlers, resolveCodexHomeAfterManagedAuthReadiness } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { resolveCodexHomeAfterManagedAuthReadiness } from './pty/host-env/codex-home'
const consumerConfigHome = join(TEST_MANAGED_ROOT, 'opencode-consumer-config')
@@ -2,7 +2,8 @@ import { describe, expect, it, vi } from 'vitest'
import { openCodeClearPtyMock, piBuildPtyEnvMock, piClearPtyMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { createDaemonActiveProviderFixtures } from './pty-ipc-daemon-provider-fixtures'
import { registerPtyHandlers, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -7,7 +7,7 @@ import {
} from './pty-ipc-daemon-provider-fixtures'
import { delimiter, join } from 'node:path'
import { _setWslCachesForTests } from '../wsl'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -1,7 +1,8 @@
import { describe, expect, it, vi } from 'vitest'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { TerminalIntentionalStops } from '../runtime/terminal-intentional-stops'
import { registerPtyHandlers, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
+2 -1
View File
@@ -3,7 +3,8 @@ import { withDurableRuntimeStore } from '../runtime/runtime-durable-store-fixtur
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { SessionNotFoundError } from '../daemon/daemon-errors'
import { makePaneKey } from '../../shared/stable-pane-id'
import { registerPtyHandlers, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -1,7 +1,8 @@
import { describe, expect, it, vi } from 'vitest'
import { spawnMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, getPtyRendererDeliveryDebugSnapshot } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { getPtyRendererDeliveryDebugSnapshot } from './pty/delivery/debug'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -1,7 +1,8 @@
import { describe, expect, it, vi } from 'vitest'
import { onMock, spawnMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, getPtyRendererDeliveryDebugSnapshot } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { getPtyRendererDeliveryDebugSnapshot } from './pty/delivery/debug'
import { _resetColorQueryReplyColorsForTest } from './pty/provider/registry'
import { _resetPtyOwnerHostColorsForTest } from '../../shared/pty-owner-color-query-colors'
import { _resetTerminalViewAttributesForTest } from '../runtime/terminal-view-attribute-store'
@@ -1,7 +1,8 @@
import { describe, expect, it, vi } from 'vitest'
import { spawnMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, getPtyRendererDeliveryDebugSnapshot } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { getPtyRendererDeliveryDebugSnapshot } from './pty/delivery/debug'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -4,7 +4,7 @@ import { posixOnlyIt, makeDeferred } from './pty-ipc-test-constants'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { isHiddenRendererPty } from './pty-hidden-delivery-gate'
import { OrcaRuntimeService } from '../runtime/orca-runtime'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { join } from 'node:path'
// Why resolved rather than hardcoded: the wrapper tree is content-addressed.
import { getShellReadyWrapperRoot } from '../providers/local-pty-shell-ready-wrapper-root'
@@ -1,6 +1,7 @@
import { vi } from 'vitest'
import type { TuiAgent } from '../../shared/tui-agent'
import { registerPtyHandlers, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
type IpcHandlerMap = Map<string, (_event: unknown, args: unknown) => unknown>
@@ -2,7 +2,8 @@ import { describe, expect, it, vi } from 'vitest'
import { spawnMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { redactPtyIdForDiagnostics } from '../../shared/pty-delivery-diagnostics'
import { registerPtyHandlers, getPtyRendererDeliveryDebugSnapshot } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { getPtyRendererDeliveryDebugSnapshot } from './pty/delivery/debug'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -1,6 +1,7 @@
import { describe, expect, it, vi } from 'vitest'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, getPtyRendererDeliveryDebugSnapshot } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { getPtyRendererDeliveryDebugSnapshot } from './pty/delivery/debug'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
+2 -1
View File
@@ -1,7 +1,8 @@
import { vi } from 'vitest'
import type { Mock } from 'vitest'
import type { AgentSessionOwnerBinding } from '../../shared/agent-session-host-authority'
import { registerPtyHandlers, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
import { makeDisposable } from './pty-ipc-test-constants'
/** The node-pty process double plus the emitters that drive its registered handlers. */
+1 -1
View File
@@ -1,6 +1,6 @@
import { vi } from 'vitest'
import type { TuiAgent } from '../../shared/tui-agent'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { accessSyncMock, spawnMock, statSyncMock } from './pty-ipc-mock-registry'
import { BUNDLED_CLI_PATH, BUNDLED_RESOURCES_PATH } from './pty-ipc-test-constants'
+1 -1
View File
@@ -51,7 +51,7 @@ import {
LocalPtyProvider,
_resetLocalPtyProviderStateForTest
} from '../providers/local-pty-provider'
import { setLocalPtyProvider } from './pty'
import { setLocalPtyProvider } from './pty/provider/registry'
import { _resetHiddenRendererPtyDeliveryGateForTest } from './pty-hidden-delivery-gate'
import { __resetShellStartupEnvCache } from '../pty/shell-startup-env'
import { _resetWslCachesForTests } from '../wsl'
@@ -3,7 +3,7 @@
// through the runtime controller registerPtyHandlers installs. Suites still declare the IPC vi.mock block.
import { vi } from 'vitest'
import type { Mock } from 'vitest'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { existsSyncMock, statSyncMock } from './pty-ipc-mock-registry'
import type { PtyIpcSuiteFixtures } from './pty-ipc-test-harness'
import { OrcaRuntimeService } from '../runtime/orca-runtime'
+1 -1
View File
@@ -1,7 +1,7 @@
import { vi, type Mock } from 'vitest'
import { makePaneKey } from '../../shared/stable-pane-id'
import { WORKTREE_TERMINALS_SLEEPING_ERROR } from '../runtime/worktree-terminals-sleeping-error'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
type IpcHandlerMap = Map<string, (_event: unknown, args: unknown) => unknown>
type LaunchRaceSpawnReply = {
@@ -8,7 +8,8 @@ import {
} from './pty-ipc-mock-registry'
import { posixOnlyIt, makeDisposable } from './pty-ipc-test-constants'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, setLocalPtyProvider, getLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider, getLocalPtyProvider } from './pty/provider/registry'
import { join } from 'node:path'
// Why resolved rather than hardcoded: the wrapper tree is content-addressed.
import { getShellReadyWrapperRoot } from '../providers/local-pty-shell-ready-wrapper-root'
@@ -8,7 +8,7 @@ import { posixOnlyIt } from './pty-ipc-test-constants'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { userInfo } from 'node:os'
import { resetMacosLoginShellPreflightForTests } from '../providers/macos-tcc-login-shell'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { join } from 'node:path'
import { POSIX_SHELL_STARTUP_COMMAND_ENV } from '../pty/posix-shell-startup-command'
// Why resolved rather than hardcoded: the wrapper tree is content-addressed.
@@ -192,7 +192,8 @@ describe('registerPtyHandlers', () => {
try {
await spawnAndGetCall({ cwd: '/tmp', command: 'echo hello' })
const { getBashShellReadyRcfileContent } = await import('./pty')
const { getBashShellReadyRcfileContent } =
await import('../providers/local-pty-shell-ready-bash-rcfile')
const bashRcContent = getBashShellReadyRcfileContent()
expect(bashRcContent).toContain('source "$HOME/.bash_profile"')
expect(bashRcContent).not.toContain('source "$HOME/.bashrc"')
@@ -1,7 +1,8 @@
import { describe, expect, it, vi } from 'vitest'
import { spawnMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
+2 -2
View File
@@ -1,11 +1,11 @@
import { describe, expect, it, vi } from 'vitest'
import { spawnMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers } from './pty/register-handlers'
import {
registerPtyHandlers,
getPtyRendererDeliveryDebugSnapshot,
resetPtyRendererDeliveryDebug
} from './pty'
} from './pty/delivery/debug'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -3,12 +3,10 @@ import { spawnMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { makePaneKey } from '../../shared/stable-pane-id'
import { OrcaRuntimeService } from '../runtime/orca-runtime'
import {
registerPtyHandlers,
clearProviderPtyState,
setLocalPtyProvider,
isCurrentPtyExit
} from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { clearProviderPtyState } from './pty/provider/state-cleanup'
import { setLocalPtyProvider } from './pty/provider/registry'
import { isCurrentPtyExit } from './pty/provider/ownership-state'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -6,7 +6,9 @@ import {
} from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { makePaneKey } from '../../shared/stable-pane-id'
import { registerPtyHandlers, getPtyIdForPaneKey, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { getPtyIdForPaneKey } from './pty/pane/key-state'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -2,7 +2,8 @@ import { describe, expect, it, vi } from 'vitest'
import { spawnMock, registerPtyMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { makePaneKey } from '../../shared/stable-pane-id'
import { registerPtyHandlers, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -3,7 +3,8 @@ import { describe, expect, it, vi } from 'vitest'
import { setupPtyIpcSuite, type PtyIpcSuiteFixtures } from './pty-ipc-test-harness'
import { TerminalKilledError } from '../daemon/daemon-pty-lifecycle-errors'
import { makePaneKey } from '../../shared/stable-pane-id'
import { registerPtyHandlers, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
import { TerminalIntentionalStops } from '../runtime/terminal-intentional-stops'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
+2 -1
View File
@@ -1,7 +1,8 @@
import { describe, expect, it, vi } from 'vitest'
import { spawnMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, getPtyRendererDeliveryDebugSnapshot } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { getPtyRendererDeliveryDebugSnapshot } from './pty/delivery/debug'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -4,7 +4,9 @@ import { statSyncMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { SessionNotFoundError, TerminalSessionOwnerUnverifiedError } from '../daemon/daemon-errors'
import { makePaneKey } from '../../shared/stable-pane-id'
import { registerPtyHandlers, clearProviderPtyState, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { clearProviderPtyState } from './pty/provider/state-cleanup'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -1,7 +1,8 @@
import { describe, expect, it, vi } from 'vitest'
import { spawnMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -1,7 +1,8 @@
import { describe, expect, it, vi } from 'vitest'
import { spawnMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, getPtyRendererDeliveryDebugSnapshot } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { getPtyRendererDeliveryDebugSnapshot } from './pty/delivery/debug'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { PtyWriteUnavailableError } from '../providers/pty-write-unavailable-error'
import { TERMINAL_INPUT_CHUNK_MAX_BYTES } from '../../shared/terminal-input'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -1,7 +1,8 @@
import { describe, expect, it, vi } from 'vitest'
import { spawnMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, getPtyRendererDeliveryDebugSnapshot } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { getPtyRendererDeliveryDebugSnapshot } from './pty/delivery/debug'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
+1 -1
View File
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest'
import { onMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -15,12 +15,10 @@ import { OrcaRuntimeService } from '../runtime/orca-runtime'
import type { RuntimeResolvedWorktreeCache } from '../runtime/runtime-resolved-worktree-cache'
import type { ResolvedWorktree } from '../runtime/runtime-worktree-path-identity'
import { getWorktreeScanMutationRevision } from '../local-worktree-scan-generation'
import {
registerPtyHandlers,
clearProviderPtyState,
getPtyIdForPaneKey,
setLocalPtyProvider
} from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { clearProviderPtyState } from './pty/provider/state-cleanup'
import { getPtyIdForPaneKey } from './pty/pane/key-state'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -46,7 +46,7 @@ vi.mock('../codex/codex-state-db-backfill-recovery', () =>
import('./pty-ipc-mock-registry').then((m) => m.codexBackfillRecoveryModuleMock())
)
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
const originalPlatform = Object.getOwnPropertyDescriptor(process, 'platform')!
@@ -3,7 +3,7 @@ import { makeDeferred } from './pty-ipc-test-constants'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { isHiddenRendererPty } from './pty-hidden-delivery-gate'
import { OrcaRuntimeService } from '../runtime/orca-runtime'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -4,14 +4,10 @@ import { makeDeferred } from './pty-ipc-test-constants'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { LOCAL_EXECUTION_HOST_ID } from '../../shared/execution-host'
import type { RuntimePtyController } from '../runtime/runtime-pty-controller-contract'
import {
registerPtyHandlers,
deletePtyOwnership,
setPtyOwnership,
setLocalPtyProvider,
rebindLocalProviderListeners,
getLocalPtyProvider
} from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { deletePtyOwnership, setPtyOwnership } from './pty/provider/ownership-state'
import { setLocalPtyProvider, getLocalPtyProvider } from './pty/provider/registry'
import { rebindLocalProviderListeners } from './pty/provider/listener-lifecycle'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest'
import { spawnMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -3,12 +3,10 @@ import { spawnMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { makePaneKey } from '../../shared/stable-pane-id'
import type * as WslManagedCliModule from '../cli/wsl-managed-cli'
import {
registerPtyHandlers,
clearProviderPtyState,
hasPendingRendererSerializerForPaneKey,
setLocalPtyProvider
} from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { clearProviderPtyState } from './pty/provider/state-cleanup'
import { hasPendingRendererSerializerForPaneKey } from './pty/pane/serializer-state'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -2,12 +2,9 @@ import { describe, expect, it, vi } from 'vitest'
import { onMock } from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { AGENT_SESSION_CLAIM_DIGEST_VERSION } from '../../shared/agent-session-host-authority'
import {
deletePtyOwnership,
registerPtyHandlers,
setPtyOwnership,
setLocalPtyProvider
} from './pty'
import { deletePtyOwnership, setPtyOwnership } from './pty/provider/ownership-state'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -4,7 +4,7 @@ import { TEST_CODEX_HOME, TEST_CODEX_AUTH_JSON } from './pty-ipc-test-constants'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { createDaemonActiveProviderFixtures } from './pty-ipc-daemon-provider-fixtures'
import { ManagedCodexHomeTemporarilyUnavailableError } from '../codex-accounts/host-codex-managed-home-ownership'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
+1 -1
View File
@@ -4,7 +4,7 @@ import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { FLOATING_TERMINAL_WORKTREE_ID } from '../../shared/constants'
import { _setWslCachesForTests } from '../wsl'
import { acquireWatcherRemovalGate } from './watcher-removal-gate'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -8,7 +8,7 @@ import {
} from './pty-ipc-mock-registry'
import { posixOnlyIt, TEST_CODEX_HOME, TEST_CODEX_AUTH_JSON } from './pty-ipc-test-constants'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -5,7 +5,9 @@ import { posixOnlyIt, TEST_MANAGED_ROOT } from './pty-ipc-test-constants'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { prepareCodexSessionResume } from '../codex/codex-session-resume-preparation'
import { POSIX_SHELL_STARTUP_COMMAND_ENV } from '../pty/posix-shell-startup-command'
import { registerPtyHandlers, setLocalPtyProvider, type PrepareCodexSessionResume } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
import type { PrepareCodexSessionResume } from './pty/host-env/types'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -7,7 +7,8 @@ import { LocalPtyProvider } from '../providers/local-pty-provider'
import { __resetPersistedWindowsPathCacheForTests } from '../pty/windows-environment-path'
import { __setWindowsPathRegistryLoaderForTests } from '../pty/windows-path-registry-reader'
import { wslHookRelayManager } from '../agent-hooks/wsl-hook-relay-manager'
import { registerPtyHandlers, buildPtyHostEnv } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { buildPtyHostEnv } from './pty/host-env/assembly'
import { buildJcodeRuntimeDir, shouldInjectJcodeRuntimeDir } from '../../shared/jcode-runtime-dir'
import { makePaneKey } from '../../shared/stable-pane-id'
import { selectShellStartupFeatures } from '../shell-startup-features'
+1 -1
View File
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { createDaemonActiveProviderFixtures } from './pty-ipc-daemon-provider-fixtures'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { makePaneKey } from '../../shared/stable-pane-id'
import type { TerminalPanePlacement } from '../../shared/terminal-pane-placement'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -11,7 +11,7 @@ import {
makePaneSpawnReservationKey,
reservePaneSpawn
} from './pty/pane/spawn-reservation'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
+3 -6
View File
@@ -1,12 +1,9 @@
import { describe, expect, it, vi } from 'vitest'
import { SSH_PROVIDER_UNREGISTERED_REASON } from '../../shared/pty-liveness-verdict'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import {
registerPtyHandlers,
deletePtyOwnership,
setPtyOwnership,
getLocalPtyProvider
} from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { deletePtyOwnership, setPtyOwnership } from './pty/provider/ownership-state'
import { getLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -2,7 +2,9 @@ import { describe, expect, it, vi } from 'vitest'
import { spawnMock } from './pty-ipc-mock-registry'
import { makeDeferred } from './pty-ipc-test-constants'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers, setLocalPtyProvider, rebindLocalProviderListeners } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
import { rebindLocalProviderListeners } from './pty/provider/listener-lifecycle'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest'
import { makeDeferred } from './pty-ipc-test-constants'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -11,7 +11,7 @@ import {
POWERSHELL_OSC133_ARGS
} from './pty-ipc-test-constants'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
@@ -8,7 +8,9 @@ import {
import { CLIPBOARD_TEXT_MEASURE_YIELD_CODE_UNITS } from '../../shared/clipboard-text'
import { PtyWriteUnavailableError } from '../providers/pty-write-unavailable-error'
import { wslHookRelayManager } from '../agent-hooks/wsl-hook-relay-manager'
import { registerPtyHandlers, deletePtyOwnership, setLocalPtyProvider } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { deletePtyOwnership } from './pty/provider/ownership-state'
import { setLocalPtyProvider } from './pty/provider/registry'
vi.mock('electron', () => import('./pty-ipc-mock-registry').then((m) => m.electronModuleMock()))
vi.mock('fs', () => import('./pty-ipc-mock-registry').then((m) => m.fsModuleMock()))
+1 -1
View File
@@ -7,7 +7,7 @@ import {
} from './pty-ipc-mock-registry'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { _setWslCachesForTests } from '../wsl'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { join } from 'node:path'
// Why resolved rather than hardcoded: the wrapper tree is content-addressed.
import { getShellReadyWrapperRoot } from '../providers/local-pty-shell-ready-wrapper-root'
-33
View File
@@ -1,33 +0,0 @@
export { getBashShellReadyRcfileContent } from '../providers/local-pty-shell-ready-bash-rcfile'
export {
isCurrentPtyExit,
deletePtyOwnership,
setPtyOwnership,
restorePtyIncarnation,
getPtyIdsForConnection
} from './pty/provider/ownership-state'
export { getPtyIdForPaneKey, registerPaneKeyTeardownListener } from './pty/pane/key-state'
export { hasPendingRendererSerializerForPaneKey } from './pty/pane/serializer-state'
export type {
BuildPtyHostEnvOptions,
CodexHomeLaunchContext,
GetSelectedCodexHomePath,
PrepareCodexSessionResume,
CodexHomePtySpawnedLifecycleArgs
} from './pty/host-env/types'
export { resolveCodexHomeAfterManagedAuthReadiness } from './pty/host-env/codex-home'
export { buildPtyHostEnv } from './pty/host-env/assembly'
export { getLocalPtyProvider, setLocalPtyProvider } from './pty/provider/registry'
export { clearProviderPtyState, clearPtyOwnershipForConnection } from './pty/provider/state-cleanup'
export {
rebindLocalProviderListeners,
unbindLocalProviderListeners
} from './pty/provider/listener-lifecycle'
export type { PtyRendererDeliveryDebugSnapshot } from './pty/delivery/debug'
export {
getPtyRendererDeliveryDebugSnapshot,
resetPtyRendererDeliveryDebug
} from './pty/delivery/debug'
export { registerPtyHandlers } from './pty/register-handlers'
export { registerHeadlessPtyRuntime } from './pty/register-headless-runtime'
export { killAllPty } from './pty/kill-all'
@@ -2,12 +2,10 @@ import { EventEmitter } from 'node:events'
import { describe, expect, it, vi } from 'vitest'
import { OrcaRuntimeService } from '../../runtime/orca-runtime'
import { setupPtyIpcSuite } from '../pty-ipc-test-harness'
import {
getLocalPtyProvider,
getPtyRendererDeliveryDebugSnapshot,
registerPtyHandlers,
setPtyOwnership
} from '../pty'
import { getLocalPtyProvider } from './provider/registry'
import { getPtyRendererDeliveryDebugSnapshot } from './delivery/debug'
import { registerPtyHandlers } from './register-handlers'
import { setPtyOwnership } from './provider/ownership-state'
import { registerHeadlessPtyRuntime } from './register-headless-runtime'
import { onMock } from '../pty-ipc-mock-registry'
@@ -1,7 +1,7 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { createDaemonActiveProviderFixtures } from './pty-ipc-daemon-provider-fixtures'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { isCommandOnPath } from './preflight-command-exec'
import { detectWslCommandsOnPath } from './preflight-wsl-agent-detection'
import type * as FsPromises from 'node:fs/promises'
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest'
import { setupPtyIpcSuite } from './pty-ipc-test-harness'
import { createDaemonActiveProviderFixtures } from './pty-ipc-daemon-provider-fixtures'
import { registerPtyHandlers } from './pty'
import { registerPtyHandlers } from './pty/register-handlers'
import { detectAgentCommandsOnHost } from '../preflight/agent-detection'
import { buildAgentStartupPlan, buildAgentResumeStartupPlan } from '../../shared/tui-agent-startup'
import { agentStartedTelemetry } from '../agent-launch/agent-started-telemetry'
@@ -59,7 +59,7 @@ import { registerOrcaProfileHandlers } from '../orca-profiles'
import { registerCodexAccountHandlers } from '../codex-accounts'
import { registerAgentHookHandlers } from '../agent-hooks'
import { registerCodexConfigSyncHandlers } from '../codex-config-sync'
import { getPtyIdForPaneKey } from '../pty'
import { getPtyIdForPaneKey } from '../pty/pane/key-state'
import { registerClaudeAccountHandlers } from '../claude-accounts'
import { registerOpenCodeGoCredentialsHandlers } from '../opencode-go-credentials'
import { registerMiniMaxCredentialsHandlers } from '../minimax-credentials'
-1
View File
@@ -11,7 +11,6 @@ vi.mock('../ssh/ssh-connection-store', () => mocks.sshConnectionStore)
vi.mock('./ssh-host-server-connect', () => mocks.hostServerConnect)
vi.mock('../ssh/ssh-connection-manager', () => mocks.sshConnectionManager)
vi.mock('../ssh/ssh-channel-multiplexer', () => mocks.sshChannelMultiplexer)
vi.mock('./pty', () => mocks.pty)
vi.mock('../ssh/ssh-port-forward', () => mocks.sshPortForward)
vi.mock('../ssh/ssh-port-scanner', () => mocks.sshPortScanner)
@@ -11,7 +11,6 @@ vi.mock('../ssh/ssh-connection-store', () => mocks.sshConnectionStore)
vi.mock('./ssh-host-server-connect', () => mocks.hostServerConnect)
vi.mock('../ssh/ssh-connection-manager', () => mocks.sshConnectionManager)
vi.mock('../ssh/ssh-channel-multiplexer', () => mocks.sshChannelMultiplexer)
vi.mock('./pty', () => mocks.pty)
vi.mock('../ssh/ssh-port-forward', () => mocks.sshPortForward)
vi.mock('../ssh/ssh-port-scanner', () => mocks.sshPortScanner)
@@ -11,7 +11,6 @@ vi.mock('../ssh/ssh-connection-store', () => mocks.sshConnectionStore)
vi.mock('./ssh-host-server-connect', () => mocks.hostServerConnect)
vi.mock('../ssh/ssh-connection-manager', () => mocks.sshConnectionManager)
vi.mock('../ssh/ssh-channel-multiplexer', () => mocks.sshChannelMultiplexer)
vi.mock('./pty', () => mocks.pty)
vi.mock('../ssh/ssh-port-forward', () => mocks.sshPortForward)
vi.mock('../ssh/ssh-port-scanner', () => mocks.sshPortScanner)
@@ -11,7 +11,6 @@ vi.mock('../ssh/ssh-connection-store', () => mocks.sshConnectionStore)
vi.mock('./ssh-host-server-connect', () => mocks.hostServerConnect)
vi.mock('../ssh/ssh-connection-manager', () => mocks.sshConnectionManager)
vi.mock('../ssh/ssh-channel-multiplexer', () => mocks.sshChannelMultiplexer)
vi.mock('./pty', () => mocks.pty)
vi.mock('../ssh/ssh-port-forward', () => mocks.sshPortForward)
vi.mock('../ssh/ssh-port-scanner', () => mocks.sshPortScanner)
-1
View File
@@ -79,7 +79,6 @@ export type SshIpcMockModules = {
sshConnectionStore: SshIpcMockModule
sshConnectionManager: SshIpcMockModule
sshChannelMultiplexer: SshIpcMockModule
pty: SshIpcMockModule
sshPortForward: SshIpcMockModule
sshPortScanner: SshIpcMockModule
}
-9
View File
@@ -150,15 +150,6 @@ export function createSshIpcMocks(): SshIpcMocks {
}
}
},
pty: {
clearPtyOwnershipForConnection: vi.fn(),
clearProviderPtyState: vi.fn(),
deletePtyOwnership: vi.fn(),
setPtyOwnership: vi.fn(),
getPtyIdsForConnection: vi.fn().mockReturnValue([]),
isCurrentPtyExit: vi.fn().mockReturnValue(true),
isRendererPtyOutputPaused: vi.fn().mockReturnValue(false)
},
sshPortForward: {
SshPortForwardManager: class MockPortForwardManager {
constructor() {
-4
View File
@@ -1,7 +1,6 @@
import { vi } from 'vitest'
import type { Mock } from 'vitest'
import { registerSshHandlers, resetSshHandlerStateForTests } from './ssh'
import { clearProviderPtyState, deletePtyOwnership, getPtyIdsForConnection } from './pty'
import type { SshIpcMocks } from './ssh-ipc-module-mocks'
import type { SshConnectionManagerMock, SshPortForwardManagerMock } from './ssh-ipc-mock-shapes'
@@ -128,9 +127,6 @@ export function createSshIpcHarness(mocks: SshIpcMocks): SshIpcHarness {
mockPortForwardManager.callbacksRef.current = null
powerMonitorOnMock.mockReset()
powerMonitorOffMock.mockReset()
vi.mocked(getPtyIdsForConnection).mockReset().mockReturnValue([])
vi.mocked(clearProviderPtyState).mockReset()
vi.mocked(deletePtyOwnership).mockReset()
registerSshHandlers(mockStore as never, () => mockWindow as never)
}
@@ -11,7 +11,6 @@ vi.mock('../ssh/ssh-connection-store', () => mocks.sshConnectionStore)
vi.mock('./ssh-host-server-connect', () => mocks.hostServerConnect)
vi.mock('../ssh/ssh-connection-manager', () => mocks.sshConnectionManager)
vi.mock('../ssh/ssh-channel-multiplexer', () => mocks.sshChannelMultiplexer)
vi.mock('./pty', () => mocks.pty)
vi.mock('../ssh/ssh-port-forward', () => mocks.sshPortForward)
vi.mock('../ssh/ssh-port-scanner', () => mocks.sshPortScanner)
-1
View File
@@ -11,7 +11,6 @@ vi.mock('../ssh/ssh-connection-store', () => mocks.sshConnectionStore)
vi.mock('./ssh-host-server-connect', () => mocks.hostServerConnect)
vi.mock('../ssh/ssh-connection-manager', () => mocks.sshConnectionManager)
vi.mock('../ssh/ssh-channel-multiplexer', () => mocks.sshChannelMultiplexer)
vi.mock('./pty', () => mocks.pty)
vi.mock('../ssh/ssh-port-forward', () => mocks.sshPortForward)
vi.mock('../ssh/ssh-port-scanner', () => mocks.sshPortScanner)
-1
View File
@@ -11,7 +11,6 @@ vi.mock('../ssh/ssh-connection-store', () => mocks.sshConnectionStore)
vi.mock('./ssh-host-server-connect', () => mocks.hostServerConnect)
vi.mock('../ssh/ssh-connection-manager', () => mocks.sshConnectionManager)
vi.mock('../ssh/ssh-channel-multiplexer', () => mocks.sshChannelMultiplexer)
vi.mock('./pty', () => mocks.pty)
vi.mock('../ssh/ssh-port-forward', () => mocks.sshPortForward)
vi.mock('../ssh/ssh-port-scanner', () => mocks.sshPortScanner)
-2
View File
@@ -60,8 +60,6 @@ vi.mock('../memory/pty-registry', () => ({
listRegisteredPtys: listRegisteredPtysMock
}))
vi.mock('./pty', () => ({}))
// Why: snapshot persistence does real file I/O; covered in workspace-cleanup-snapshot-ipc.test.ts.
vi.mock('../workspace-cleanup-scan-snapshot', () => ({
persistWorkspaceCleanupScanResult: vi.fn(async () => undefined),
@@ -98,7 +98,12 @@ vi.mock('../local-worktree-path-presence', async (importOriginal) => ({
vi.mock('../runtime/worktree-teardown', async () =>
(await import('./worktrees-test-module-mocks')).worktreeTeardownModuleMock()
)
vi.mock('./pty', async () => (await import('./worktrees-test-module-mocks')).ptyModuleMock())
vi.mock('./pty/provider/registry', async () =>
(await import('./worktrees-test-module-mocks')).ptyRegistryModuleMock()
)
vi.mock('./pty/provider/state-cleanup', async () =>
(await import('./worktrees-test-module-mocks')).ptyStateCleanupModuleMock()
)
const REPO_ID = 'repo-1'
const REPO_PATH = '/workspace/repo'

Some files were not shown because too many files have changed in this diff Show More