From c77bebfb7b01c1790afe4aeedf54f3805ecbac00 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Mon, 12 Oct 2026 04:18:56 -0700 Subject: [PATCH] refactor(providers): import provider contracts directly (runtime) (#27965) Co-authored-by: m4air --- src/main/runtime/folder-workspace-pty-teardown.ts | 2 +- src/main/runtime/headless-seed-ownership.test.ts | 2 +- .../missing-worktree-terminal-reconciliation.test.ts | 2 +- .../runtime/missing-worktree-terminal-reconciliation.ts | 2 +- .../orca-runtime-build-controller-terminal-identities.ts | 2 +- .../orca-runtime-capture-provider-terminal-buffer.ts | 2 +- .../runtime/orca-runtime-emit-daemon-pty-transient-fact.ts | 2 +- src/main/runtime/orca-runtime-fit-override-listeners.ts | 2 +- src/main/runtime/orca-runtime-preserved-branch-cleanup.ts | 2 +- .../runtime/orca-runtime-pty-foreground-process-reads.ts | 2 +- ...untime-serialize-terminal-buffer-from-available-state.ts | 2 +- src/main/runtime/orca-runtime-state-fields.ts | 2 +- .../orca-runtime-terminal-create-idempotency.test.ts | 2 +- src/main/runtime/orca-runtime-test-mocks.spec.ts | 2 +- src/main/runtime/runtime-file-command-access.ts | 2 +- src/main/runtime/runtime-git-status-commands.ts | 2 +- src/main/runtime/runtime-pty-controller-contract.ts | 6 +++++- src/main/runtime/runtime-terminal-state-records.ts | 2 +- .../runtime/structured-session-worktree-teardown.test.ts | 2 +- src/main/runtime/terminal-intentional-stop-exit.test.ts | 2 +- src/main/runtime/terminal-run-facts-input.test.ts | 2 +- src/main/runtime/unstopped-pty-verification.ts | 2 +- src/main/runtime/worktree-pty-surface-sweeps.ts | 2 +- src/main/runtime/worktree-teardown-unstopped-pty.test.ts | 2 +- src/main/runtime/worktree-teardown.test.ts | 2 +- src/main/runtime/worktree-teardown.ts | 2 +- 26 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/main/runtime/folder-workspace-pty-teardown.ts b/src/main/runtime/folder-workspace-pty-teardown.ts index 3539fa36b28..38fd1f73689 100644 --- a/src/main/runtime/folder-workspace-pty-teardown.ts +++ b/src/main/runtime/folder-workspace-pty-teardown.ts @@ -1,5 +1,5 @@ import { killAllProcessesForWorktree } from './worktree-teardown' -import type { IPtyProvider } from '../providers/types' +import type { IPtyProvider } from '../providers/pty-provider-contract' import type { OrcaRuntimeService } from './orca-runtime' export type FolderWorkspacePtyTeardownDeps = { diff --git a/src/main/runtime/headless-seed-ownership.test.ts b/src/main/runtime/headless-seed-ownership.test.ts index 42fe9c91660..b1ab4fc685f 100644 --- a/src/main/runtime/headless-seed-ownership.test.ts +++ b/src/main/runtime/headless-seed-ownership.test.ts @@ -1,7 +1,7 @@ import { expect, it, vi } from 'vitest' import { HeadlessEmulator } from '../daemon/headless-emulator' import { deferred, makeDeferred, syncSinglePty } from './orca-runtime-test-fixtures.spec' -import type { PtyProviderBufferSnapshot } from '../providers/types' +import type { PtyProviderBufferSnapshot } from '../providers/pty-provider-contract' import { createHydrationRuntime, EMPTY_RETAINED_STATE, diff --git a/src/main/runtime/missing-worktree-terminal-reconciliation.test.ts b/src/main/runtime/missing-worktree-terminal-reconciliation.test.ts index 9ae33b91414..147f0e5691f 100644 --- a/src/main/runtime/missing-worktree-terminal-reconciliation.test.ts +++ b/src/main/runtime/missing-worktree-terminal-reconciliation.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import type { IPtyProvider } from '../providers/types' +import type { IPtyProvider } from '../providers/pty-provider-contract' import type { Repo } from '../../shared/repo-types' import type { OrcaRuntimeService } from './orca-runtime' import { stopMissingWorktreeTerminals } from './missing-worktree-terminal-reconciliation' diff --git a/src/main/runtime/missing-worktree-terminal-reconciliation.ts b/src/main/runtime/missing-worktree-terminal-reconciliation.ts index 93b7d4dc561..e28a6e1bed1 100644 --- a/src/main/runtime/missing-worktree-terminal-reconciliation.ts +++ b/src/main/runtime/missing-worktree-terminal-reconciliation.ts @@ -1,4 +1,4 @@ -import type { IPtyProvider } from '../providers/types' +import type { IPtyProvider } from '../providers/pty-provider-contract' import type { Repo } from '../../shared/repo-types' import { splitWorktreeId } from '../../shared/worktree/id' import { mapWithConcurrency } from '../../shared/map-with-concurrency' diff --git a/src/main/runtime/orca-runtime-build-controller-terminal-identities.ts b/src/main/runtime/orca-runtime-build-controller-terminal-identities.ts index 00e6da9b291..47b1ef0a7fa 100644 --- a/src/main/runtime/orca-runtime-build-controller-terminal-identities.ts +++ b/src/main/runtime/orca-runtime-build-controller-terminal-identities.ts @@ -1,5 +1,5 @@ import type { PtyControllerTerminalIdentity } from './runtime-pty-controller-contract' -import type { PtyProcessInfo } from '../providers/types' +import type { PtyProcessInfo } from '../providers/pty-provider-contract' export function buildControllerTerminalIdentities(sessions: PtyProcessInfo[]): { controllerIdentityByPtyId: Map diff --git a/src/main/runtime/orca-runtime-capture-provider-terminal-buffer.ts b/src/main/runtime/orca-runtime-capture-provider-terminal-buffer.ts index fc9ba31964a..0aec9cb45be 100644 --- a/src/main/runtime/orca-runtime-capture-provider-terminal-buffer.ts +++ b/src/main/runtime/orca-runtime-capture-provider-terminal-buffer.ts @@ -1,6 +1,6 @@ // @ts-nocheck -- mechanically split from OrcaRuntimeService; behavior is covered by AST equivalence and characterization tests. import { OrcaRuntimeWithSerializeTerminalBufferFromAvailableState } from './orca-runtime-serialize-terminal-buffer-from-available-state' -import type { PtyProviderBufferSnapshot } from '../providers/types' +import type { PtyProviderBufferSnapshot } from '../providers/pty-provider-contract' import { TerminalKittyKeyboardModeTracker } from '../../shared/terminal-kitty-keyboard-mode-tracker' import type { RuntimeTerminalRead } from '../../shared/runtime-types' import type { RuntimeProviderSnapshotReadOptions } from './runtime-terminal-contracts' diff --git a/src/main/runtime/orca-runtime-emit-daemon-pty-transient-fact.ts b/src/main/runtime/orca-runtime-emit-daemon-pty-transient-fact.ts index 8ce88334e1b..e322296a73f 100644 --- a/src/main/runtime/orca-runtime-emit-daemon-pty-transient-fact.ts +++ b/src/main/runtime/orca-runtime-emit-daemon-pty-transient-fact.ts @@ -1,6 +1,6 @@ // @ts-nocheck -- mechanically split from OrcaRuntimeService; behavior is covered by AST equivalence and characterization tests. import { OrcaRuntimeWithScheduleWaitBlockedCheck } from './orca-runtime-schedule-wait-blocked-check' -import type { PtyTransientFact } from '../providers/types' +import type { PtyTransientFact } from '../providers/pty-provider-contract' import type { TerminalSideEffectBatch, TerminalSideEffectFact diff --git a/src/main/runtime/orca-runtime-fit-override-listeners.ts b/src/main/runtime/orca-runtime-fit-override-listeners.ts index 5ef17ce4c2e..370da6b0c33 100644 --- a/src/main/runtime/orca-runtime-fit-override-listeners.ts +++ b/src/main/runtime/orca-runtime-fit-override-listeners.ts @@ -10,7 +10,7 @@ import type { RuntimeVisibleTerminalState } from './runtime-terminal-state-records' import type { TerminalKittyKeyboardModeTracker } from '../../shared/terminal-kitty-keyboard-mode-tracker' -import type { PtyProviderBufferSnapshot } from '../providers/types' +import type { PtyProviderBufferSnapshot } from '../providers/pty-provider-contract' import type { WaitBlockedCheckState } from './wait-blocked-check-state' import type { createAgentStatusOscProcessor } from '../../shared/agent-status-osc' import { RuntimeTerminalViewSubscribers } from './runtime-terminal-view-subscribers' diff --git a/src/main/runtime/orca-runtime-preserved-branch-cleanup.ts b/src/main/runtime/orca-runtime-preserved-branch-cleanup.ts index 167fdb2c440..be595cc148f 100644 --- a/src/main/runtime/orca-runtime-preserved-branch-cleanup.ts +++ b/src/main/runtime/orca-runtime-preserved-branch-cleanup.ts @@ -3,7 +3,7 @@ import { OrcaRuntimeWithTerminalDrivers } from './orca-runtime-terminal-drivers' import { confirmRunTerminalShellAlone, readRunTerminalClientUse } from './run-terminal-client-use' import { ALL_EXECUTION_HOSTS_SCOPE, type ExecutionHostScope } from '../../shared/execution-host' import { RuntimePreservedBranchCleanup } from './runtime-preserved-branch-cleanup' -import type { IPtyProvider } from '../providers/types' +import type { IPtyProvider } from '../providers/pty-provider-contract' import type { AgentSessionCreateOperation, OrchestrationCompatibilitySshAttachmentAuthority, diff --git a/src/main/runtime/orca-runtime-pty-foreground-process-reads.ts b/src/main/runtime/orca-runtime-pty-foreground-process-reads.ts index a0a79693d15..b711805f087 100644 --- a/src/main/runtime/orca-runtime-pty-foreground-process-reads.ts +++ b/src/main/runtime/orca-runtime-pty-foreground-process-reads.ts @@ -9,7 +9,7 @@ import { splitWorktreeIdForFilesystem } from '../../shared/worktree/id' import type { WorkspaceSessionState } from '../../shared/workspace-session-state-types' import type { ExecutionHostId } from '../../shared/execution-host' import { LOCAL_EXECUTION_HOST_ID, getRepoExecutionHostId } from '../../shared/execution-host' -import type { IPtyProvider } from '../providers/types' +import type { IPtyProvider } from '../providers/pty-provider-contract' import { killAllProcessesForWorktree } from './worktree-teardown' import type { RuntimeCommandSurfaceHost } from './orca-runtime-core' import type { MemorySnapshot, StatsSummary } from '../../shared/process-stats-types' diff --git a/src/main/runtime/orca-runtime-serialize-terminal-buffer-from-available-state.ts b/src/main/runtime/orca-runtime-serialize-terminal-buffer-from-available-state.ts index 7dea2fc4369..de5c47a6d29 100644 --- a/src/main/runtime/orca-runtime-serialize-terminal-buffer-from-available-state.ts +++ b/src/main/runtime/orca-runtime-serialize-terminal-buffer-from-available-state.ts @@ -1,7 +1,7 @@ // @ts-nocheck -- mechanically split from OrcaRuntimeService; behavior is covered by AST equivalence and characterization tests. import { OrcaRuntimeWithCreatePtyHeadlessTerminalState } from './orca-runtime-create-pty-headless-terminal-state' import type { TerminalOscLinkRange } from '../../shared/terminal-osc-link-ranges' -import type { PtyProviderBufferSnapshot } from '../providers/types' +import type { PtyProviderBufferSnapshot } from '../providers/pty-provider-contract' import { withTimeout } from './runtime-async-boundaries' export class OrcaRuntimeWithSerializeTerminalBufferFromAvailableState extends OrcaRuntimeWithCreatePtyHeadlessTerminalState { diff --git a/src/main/runtime/orca-runtime-state-fields.ts b/src/main/runtime/orca-runtime-state-fields.ts index 1620c036886..39b9869ba54 100644 --- a/src/main/runtime/orca-runtime-state-fields.ts +++ b/src/main/runtime/orca-runtime-state-fields.ts @@ -3,7 +3,7 @@ import { OrcaRuntimeWithLinearCommands } from './orca-runtime-linear-commands' import type { ExecutionHostScope } from '../../shared/execution-host' import type { RuntimeStore } from './runtime-store-contract' import type { StatsCollector } from '../stats/collector' -import type { IPtyProvider } from '../providers/types' +import type { IPtyProvider } from '../providers/pty-provider-contract' import type { PrepareClaudeAuth } from '../ipc/pty/host-env/types' import type { RuntimeTerminalAgentStatusEvent } from './runtime-terminal-contracts' import type { TerminalSideEffectBatch } from '../../shared/terminal-side-effect-facts' diff --git a/src/main/runtime/orca-runtime-terminal-create-idempotency.test.ts b/src/main/runtime/orca-runtime-terminal-create-idempotency.test.ts index fc61c51b2ea..5f267ff8ce4 100644 --- a/src/main/runtime/orca-runtime-terminal-create-idempotency.test.ts +++ b/src/main/runtime/orca-runtime-terminal-create-idempotency.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import type { PtyProcessInfo } from '../providers/types' +import type { PtyProcessInfo } from '../providers/pty-provider-contract' import type { RuntimeTerminalCreate } from '../../shared/runtime-types' import { OrcaRuntimeService } from './orca-runtime' import { deriveRemoteRuntimeTerminalCreateHandle } from './remote-runtime-terminal-create-identity' diff --git a/src/main/runtime/orca-runtime-test-mocks.spec.ts b/src/main/runtime/orca-runtime-test-mocks.spec.ts index 5238736627c..5b0d2a86bc0 100644 --- a/src/main/runtime/orca-runtime-test-mocks.spec.ts +++ b/src/main/runtime/orca-runtime-test-mocks.spec.ts @@ -256,7 +256,7 @@ export type { export type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' export type { FolderWorkspace } from '../../shared/folder-workspace-types' export type { GitUsernameModule } -export type { IPtyProvider } from '../providers/types' +export type { IPtyProvider } from '../providers/pty-provider-contract' export type { MessagePriority, MessageRow, MessageType } from './orchestration/types' export type { ProjectGroup } from '../../shared/project-group-types' export type { RpcRequest } from './rpc/core' diff --git a/src/main/runtime/runtime-file-command-access.ts b/src/main/runtime/runtime-file-command-access.ts index 8ce72510be0..433d055b63f 100644 --- a/src/main/runtime/runtime-file-command-access.ts +++ b/src/main/runtime/runtime-file-command-access.ts @@ -25,7 +25,7 @@ import { type RuntimeFileExplorerPath } from './runtime-file-command-target' import { parseExecutionHostId, type ExecutionHostId } from '../../shared/execution-host' -import type { FileStat } from '../providers/types' +import type { FileStat } from '../providers/filesystem-provider-contract' export class RuntimeFileCommandAccess { protected readonly terminalFileGrants = new Map() diff --git a/src/main/runtime/runtime-git-status-commands.ts b/src/main/runtime/runtime-git-status-commands.ts index 99a0799aa8a..4c4ef706383 100644 --- a/src/main/runtime/runtime-git-status-commands.ts +++ b/src/main/runtime/runtime-git-status-commands.ts @@ -5,7 +5,7 @@ import type { GitStatusResult } from '../../shared/git-status-types' import type { RuntimeGitCheckoutResult, RuntimeGitLocalBranches } from '../../shared/runtime-types' -import type { GitProviderStatusOptions } from '../providers/types' +import type { GitProviderStatusOptions } from '../providers/git-provider-contract' import { requireRuntimeGitProvider, type RuntimeGitCommandHost } from './runtime-git-command-target' export class RuntimeGitStatusCommands { diff --git a/src/main/runtime/runtime-pty-controller-contract.ts b/src/main/runtime/runtime-pty-controller-contract.ts index 157439f3b43..ca507031886 100644 --- a/src/main/runtime/runtime-pty-controller-contract.ts +++ b/src/main/runtime/runtime-pty-controller-contract.ts @@ -15,7 +15,11 @@ import type { PtyIncarnationId } from '../../shared/pty-incarnation' import type { PtyBindingSourceExpectation } from '../persistence' import type { TerminalPanePlacement } from '../../shared/terminal-pane-placement' import type { ExecutionHostId } from '../../shared/execution-host' -import type { PtyProviderBufferSnapshot, PtyProcessInfo, PtySpawnResult } from '../providers/types' +import type { + PtyProviderBufferSnapshot, + PtyProcessInfo, + PtySpawnResult +} from '../providers/pty-provider-contract' import type { PtyProcessInspection } from '../providers/pty-process-inspection' import type { WriteSettlement } from '../../shared/pty-write-settlement' import type { TerminalInputKind } from '../../shared/terminal-input-kind' diff --git a/src/main/runtime/runtime-terminal-state-records.ts b/src/main/runtime/runtime-terminal-state-records.ts index 78e0f475e21..92c7e99820a 100644 --- a/src/main/runtime/runtime-terminal-state-records.ts +++ b/src/main/runtime/runtime-terminal-state-records.ts @@ -9,7 +9,7 @@ import type { TerminalTitleTracker } from '../../shared/terminal-output-side-eff import type { TuiAgent } from '../../shared/tui-agent' import type { TerminalAgent } from '../../shared/terminal-agent' import type { HeadlessEmulator } from '../daemon/headless-emulator' -import type { PtyProviderBufferSnapshot } from '../providers/types' +import type { PtyProviderBufferSnapshot } from '../providers/pty-provider-contract' import type { RetainedTailRedrawCursor } from './terminal-tail-redraw-buffer' import type { TerminalTailWaitState } from './terminal-wait-tail-state' import type { TerminalCommandPaint } from './terminal-command-paint' diff --git a/src/main/runtime/structured-session-worktree-teardown.test.ts b/src/main/runtime/structured-session-worktree-teardown.test.ts index 4c4145bab2e..419274395ba 100644 --- a/src/main/runtime/structured-session-worktree-teardown.test.ts +++ b/src/main/runtime/structured-session-worktree-teardown.test.ts @@ -1,6 +1,6 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import type { AgentSessionRecord } from '../../shared/agent-session-record' -import type { IPtyProvider } from '../providers/types' +import type { IPtyProvider } from '../providers/pty-provider-contract' import { ABANDONED_SWEEP_GRACE_MS } from './forced-sweep-settlement' const hostRef: { current: unknown } = { current: null } diff --git a/src/main/runtime/terminal-intentional-stop-exit.test.ts b/src/main/runtime/terminal-intentional-stop-exit.test.ts index 031d3c3edd2..041d9710936 100644 --- a/src/main/runtime/terminal-intentional-stop-exit.test.ts +++ b/src/main/runtime/terminal-intentional-stop-exit.test.ts @@ -17,7 +17,7 @@ import { import { ptyIncarnationById, ptyOwnership } from '../ipc/pty/provider/ownership-state' import { getLocalPtyProvider, setLocalPtyProvider } from '../ipc/pty/provider/registry' import { createPtyIpcSession } from '../ipc/pty/session' -import type { IPtyProvider } from '../providers/types' +import type { IPtyProvider } from '../providers/pty-provider-contract' import { OrcaRuntimeService } from './orca-runtime' import { INCARNATION_ID, diff --git a/src/main/runtime/terminal-run-facts-input.test.ts b/src/main/runtime/terminal-run-facts-input.test.ts index 9e634b3b0cc..d4106114915 100644 --- a/src/main/runtime/terminal-run-facts-input.test.ts +++ b/src/main/runtime/terminal-run-facts-input.test.ts @@ -2,7 +2,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import type { TerminalInputKind } from '../../shared/terminal-input-kind' import { writePtyFromRuntimeController } from '../ipc/pty/runtime/operations' import { getLocalPtyProvider, setLocalPtyProvider } from '../ipc/pty/provider/registry' -import type { IPtyProvider } from '../providers/types' +import type { IPtyProvider } from '../providers/pty-provider-contract' import { settledWriteStub } from '../providers/settled-pty-write-stub' import { OrcaRuntimeService } from './orca-runtime' import type { RuntimePtyController } from './runtime-pty-controller-contract' diff --git a/src/main/runtime/unstopped-pty-verification.ts b/src/main/runtime/unstopped-pty-verification.ts index 7cfd5907797..9a37c4c58c2 100644 --- a/src/main/runtime/unstopped-pty-verification.ts +++ b/src/main/runtime/unstopped-pty-verification.ts @@ -1,4 +1,4 @@ -import type { IPtyProvider } from '../providers/types' +import type { IPtyProvider } from '../providers/pty-provider-contract' import type { OrcaRuntimeService } from './orca-runtime' import { UNSTOPPED_PTY_DETAIL_SEPARATOR, diff --git a/src/main/runtime/worktree-pty-surface-sweeps.ts b/src/main/runtime/worktree-pty-surface-sweeps.ts index 4c663086a39..86891b72b83 100644 --- a/src/main/runtime/worktree-pty-surface-sweeps.ts +++ b/src/main/runtime/worktree-pty-surface-sweeps.ts @@ -6,7 +6,7 @@ * provider's session list, and the local pty-registry. */ -import type { IPtyProvider } from '../providers/types' +import type { IPtyProvider } from '../providers/pty-provider-contract' import { listRegisteredPtys } from '../memory/pty-registry' import { isPathInsideOrEqual } from '../../shared/cross-platform-path' import { splitWorktreeId, splitWorktreeIdForFilesystem } from '../../shared/worktree/id' diff --git a/src/main/runtime/worktree-teardown-unstopped-pty.test.ts b/src/main/runtime/worktree-teardown-unstopped-pty.test.ts index c89c5e93747..621126809fa 100644 --- a/src/main/runtime/worktree-teardown-unstopped-pty.test.ts +++ b/src/main/runtime/worktree-teardown-unstopped-pty.test.ts @@ -14,7 +14,7 @@ import { classifyWorktreeForceDeleteReason, isProvenLivePtyRemovalError } from '../../shared/worktree/removal' -import type { IPtyProvider, PtyProcessInfo } from '../providers/types' +import type { IPtyProvider, PtyProcessInfo } from '../providers/pty-provider-contract' // Why: these tests advance fake timers *before* awaiting the teardown, so a // rejection mid-advance had no handler yet — Node reported it as an unhandled diff --git a/src/main/runtime/worktree-teardown.test.ts b/src/main/runtime/worktree-teardown.test.ts index ed29bc26e2f..feb90f06286 100644 --- a/src/main/runtime/worktree-teardown.test.ts +++ b/src/main/runtime/worktree-teardown.test.ts @@ -9,7 +9,7 @@ vi.mock('../memory/pty-registry', () => ({ })) import { killAllProcessesForWorktree, WORKTREE_PROCESS_SWEEP_TIMEOUT_MS } from './worktree-teardown' -import type { IPtyProvider, PtyProcessInfo } from '../providers/types' +import type { IPtyProvider, PtyProcessInfo } from '../providers/pty-provider-contract' import { DaemonPtyAdapter } from '../daemon/daemon-pty-adapter' function createProviderStub(listProcesses: () => Promise): IPtyProvider { diff --git a/src/main/runtime/worktree-teardown.ts b/src/main/runtime/worktree-teardown.ts index 417bf4ff1f7..8acef762bef 100644 --- a/src/main/runtime/worktree-teardown.ts +++ b/src/main/runtime/worktree-teardown.ts @@ -1,4 +1,4 @@ -import type { IPtyProvider } from '../providers/types' +import type { IPtyProvider } from '../providers/pty-provider-contract' import type { OrcaRuntimeService } from './orca-runtime' import { isUnstoppedPtyRemovalError,