refactor(providers): import provider contracts directly (runtime) (#27965)

Co-authored-by: m4air <m4air@Mac.localdomain>
This commit is contained in:
OrcaWin
2026-10-12 04:18:56 -07:00
committed by GitHub
co-authored by m4air
parent 4ad0129984
commit c77bebfb7b
26 changed files with 30 additions and 26 deletions
@@ -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 = {
@@ -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,
@@ -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'
@@ -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'
@@ -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<string, PtyControllerTerminalIdentity>
@@ -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'
@@ -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
@@ -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'
@@ -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,
@@ -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'
@@ -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 {
@@ -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'
@@ -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'
@@ -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'
@@ -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<string, TerminalFileGrant>()
@@ -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 {
@@ -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'
@@ -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'
@@ -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 }
@@ -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,
@@ -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'
@@ -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,
@@ -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'
@@ -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
+1 -1
View File
@@ -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<PtyProcessInfo[]>): IPtyProvider {
+1 -1
View File
@@ -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,