refactor(providers): import provider contracts directly (ipc); delete the barrel (#27966)

Co-authored-by: m4air <m4air@Mac.localdomain>
This commit is contained in:
OrcaWin
2026-10-12 04:44:48 -07:00
committed by GitHub
co-authored by m4air
parent c77bebfb7b
commit 3c49cdf09c
33 changed files with 44 additions and 66 deletions
@@ -55,7 +55,7 @@ vi.mock('../pi/titlebar-extension-service', () => ({
import { registerPtyHandlers } from './pty/register-handlers'
import { setLocalPtyProvider } from './pty/provider/registry'
import type { IPtyProvider, PtyProcessInfo } from '../providers/types'
import type { IPtyProvider, PtyProcessInfo } from '../providers/pty-provider-contract'
// The runtime's worktree.ps liveness refresh calls the aggregate inventory (no connectionId)
// under a 3s budget, and only a returned inventory can retire an exited PTY. STA-517: one
@@ -1,4 +1,4 @@
import type { PtySpawnResult } from '../../../providers/types'
import type { PtySpawnResult } from '../../../providers/pty-provider-contract'
import { ptySizes } from './visibility-state'
export type PtyGrid = { cols: number; rows: number }
@@ -1,6 +1,6 @@
import { normalizeRuntimePathForComparison } from '../../../../shared/cross-platform-path'
import { splitWorktreeIdForFilesystem } from '../../../../shared/worktree/id'
import type { IPtyProvider } from '../../../providers/types'
import type { IPtyProvider } from '../../../providers/pty-provider-contract'
import { beginTerminalInstall } from '../../watcher-removal-gate'
export function isClaudeLaunchCommand(command: string | undefined): boolean {
+1 -1
View File
@@ -3,7 +3,7 @@ import { getPtyIpc } from '../../pty-host-bindings'
import type { Store } from '../../../persistence'
import type { OrcaRuntimeService } from '../../../runtime/orca-runtime'
import type { TerminalIntentionalStopKind } from '../../../runtime/terminal-intentional-stops'
import type { IPtyProvider } from '../../../providers/types'
import type { IPtyProvider } from '../../../providers/pty-provider-contract'
import { SSH_PROVIDER_UNREGISTERED_REASON } from '../../../../shared/pty-liveness-verdict'
import { ptyIncarnationById } from '../provider/ownership-state'
import {
+1 -1
View File
@@ -3,7 +3,7 @@ import { resolveAgentLaunchPaneVerdict } from '../../../agent-launch/agent-launc
import { AGENT_LAUNCH_PANE_REFUSED_CODE } from '../../../../shared/agent-launch-pane-verdict'
import { agentLaunchPaneEvidence } from '../pane/agent-launch-pane-evidence'
import { isValidTerminalTabId } from '../../../../shared/terminal-tab-id'
import type { PtySpawnResult } from '../../../providers/types'
import type { PtySpawnResult } from '../../../providers/pty-provider-contract'
import type { CodexPaneHomeRoute } from '../../../codex/codex-pane-account-registry'
import { createPtySpawnTiming } from '../../pty-spawn-timing'
import { allocatePtyLifecycleSequence } from '../host-env/types'
+1 -1
View File
@@ -1,7 +1,7 @@
import { isValidTerminalTabId } from '../../../../shared/terminal-tab-id'
import { agentHookServer } from '../../../agent-hooks/server'
import { registerPty } from '../../../memory/pty-registry'
import type { PtySpawnResult } from '../../../providers/types'
import type { PtySpawnResult } from '../../../providers/pty-provider-contract'
import { clearMigrationUnsupportedPtysForPaneKey } from '../../../agent-hooks/migration-unsupported-pty-state'
import { recordPtySpawnTelemetry } from '../pane/spawn-telemetry'
import {
@@ -1,5 +1,5 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import type { PtySpawnResult } from '../../../providers/types'
import type { PtySpawnResult } from '../../../providers/pty-provider-contract'
import { ptySizes } from '../delivery/visibility-state'
import { buildPtyIpcSpawnOptions } from './spawn-options'
import { commitPtyIpcSpawn } from './spawn-commit'
+5 -1
View File
@@ -1,4 +1,8 @@
import type { IPtyProvider, PtySpawnOptions, PtySpawnResult } from '../../../providers/types'
import type {
IPtyProvider,
PtySpawnOptions,
PtySpawnResult
} from '../../../providers/pty-provider-contract'
import type { CodexPaneHomeRoute } from '../../../codex/codex-pane-account-registry'
import type { CodexAccountSelectionTarget } from '../../../codex-accounts/runtime-selection'
import type { SleepingAgentLaunchConfig } from '../../../../shared/agent-session-resume'
+1 -1
View File
@@ -9,7 +9,7 @@ import type { GlobalSettings } from '../../../../shared/global-settings-types'
import type { TerminalStartupCwdMissingDirFallback } from '../../../../shared/terminal-startup-cwd'
import type { OrcaRuntimeService } from '../../../runtime/orca-runtime'
import type { Store } from '../../../persistence'
import type { PtySpawnResult } from '../../../providers/types'
import type { PtySpawnResult } from '../../../providers/pty-provider-contract'
import type { CodexAccountSelectionTarget } from '../../../codex-accounts/runtime-selection'
import type { CodexSessionResumePreparation } from '../../../codex/codex-session-resume-home'
import type {
+1 -1
View File
@@ -1,7 +1,7 @@
import type { IpcMainEvent, IpcMainInvokeEvent } from 'electron'
import type { PtyRendererDelivery } from '../session'
import type { OrcaRuntimeService } from '../../../runtime/orca-runtime'
import type { IPtyProvider } from '../../../providers/types'
import type { IPtyProvider } from '../../../providers/pty-provider-contract'
import { isPtyWriteUnavailableError } from '../../../providers/pty-write-unavailable-error'
import {
isTerminalInputTooLargeWithDeferredMeasurement,
@@ -2,7 +2,7 @@ import type { AgentSessionOwnerBinding } from '../../../../shared/agent-session-
import { ClaimedAgentPtyOwnerRegistry } from '../../../../shared/claimed-agent-pty-owner'
import { isPtyIncarnationId } from '../../../../shared/pty-incarnation'
import type { OrcaRuntimeService } from '../../../runtime/orca-runtime'
import type { PtySpawnResult } from '../../../providers/types'
import type { PtySpawnResult } from '../../../providers/pty-provider-contract'
import { ptyIncarnationById, ptyOwnership } from '../provider/ownership-state'
import type { ExecutionHostId } from '../../../../shared/execution-host'
import { registeredPtyProviders, tryGetProviderForPty } from '../provider/registry'
+1 -1
View File
@@ -1,6 +1,6 @@
import type { Store } from '../../../persistence'
import type { OrcaRuntimeService } from '../../../runtime/orca-runtime'
import type { IPtyProvider, PtySpawnResult } from '../../../providers/types'
import type { IPtyProvider, PtySpawnResult } from '../../../providers/pty-provider-contract'
import {
isCurrentPtyExit,
ptyIncarnationById,
+1 -1
View File
@@ -1,5 +1,5 @@
import type { SleepingAgentLaunchConfig } from '../../../../shared/agent-session-resume'
import type { PtySpawnResult } from '../../../providers/types'
import type { PtySpawnResult } from '../../../providers/pty-provider-contract'
import { isWorktreeTerminalsSleepingError } from '../../../runtime/worktree-terminals-sleeping-error'
export type PaneSpawnReservation = {
+5 -1
View File
@@ -6,7 +6,11 @@ import { UNVERIFIED_PROCESS_EXIT_CODE } from '../../../../shared/terminal-exit-c
import type { Store } from '../../../persistence'
import { retireTerminalSurfaceFromPersistence } from '../../../runtime/mobile-session-terminal-persistence-retirement'
import type { OrcaRuntimeService } from '../../../runtime/orca-runtime'
import type { IPtyProvider, PtySpawnOptions, PtySpawnResult } from '../../../providers/types'
import type {
IPtyProvider,
PtySpawnOptions,
PtySpawnResult
} from '../../../providers/pty-provider-contract'
import { getPtySshConnectionId } from '../provider/registry'
import {
isDaemonEndpointGoneError,
@@ -7,7 +7,7 @@ import { getDefaultWorkspaceSession } from '../../../../shared/constants'
import type { WorkspaceSessionState } from '../../../../shared/workspace-session-state-types'
import { SessionNotFoundError } from '../../../daemon/daemon-errors'
import type { Store } from '../../../persistence'
import type { IPtyProvider } from '../../../providers/types'
import type { IPtyProvider } from '../../../providers/pty-provider-contract'
import { OrcaRuntimeService } from '../../../runtime/orca-runtime'
import { spawnForStablePane } from './stable-owner'
@@ -6,7 +6,7 @@ import {
TerminalSessionOwnerUnverifiedError
} from '../../../daemon/daemon-errors'
import type { Store } from '../../../persistence'
import type { IPtyProvider } from '../../../providers/types'
import type { IPtyProvider } from '../../../providers/pty-provider-contract'
import { spawnForStablePane, type StablePaneOwner } from './stable-owner'
const LEAF = '1b3f2c4d-5e6a-4b7c-8d9e-0f1a2b3c4d5e'
@@ -1,4 +1,4 @@
import type { PtySpawnResult } from '../../../providers/types'
import type { PtySpawnResult } from '../../../providers/pty-provider-contract'
import type { OrcaRuntimeService } from '../../../runtime/orca-runtime'
import { pendingByPaneKey, rendererSerializerReadiness } from './serializer-state'
+1 -1
View File
@@ -2,7 +2,7 @@ import type { AgentSessionOwnerBinding } from '../../../../shared/agent-session-
import { agentSessionOwnerBindingsEqual } from '../../../../shared/claimed-agent-pty-owner'
import { addNodePtyRecoveryHint } from '../../../daemon/node-pty-error-hints'
import type { Store } from '../../../persistence'
import type { IPtyProvider } from '../../../providers/types'
import type { IPtyProvider } from '../../../providers/pty-provider-contract'
import { ptyIncarnationById, ptyOwnership } from './ownership-state'
import { getRelayPtyId } from './registry'
import {
@@ -1,5 +1,5 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import type { IPtyProvider } from '../../../providers/types'
import type { IPtyProvider } from '../../../providers/pty-provider-contract'
import { getCwdFromRuntimeController, resizePtyFromRuntimeController } from '../runtime/operations'
import { deletePtyOwnership, setPtyOwnership } from './ownership-state'
import {
+1 -1
View File
@@ -1,5 +1,5 @@
import { LocalPtyProvider } from '../../../providers/local-pty-provider'
import type { IPtyProvider } from '../../../providers/types'
import type { IPtyProvider } from '../../../providers/pty-provider-contract'
import { parseAppSshPtyId, toAppSshPtyId, toRelaySshPtyId } from '../../../providers/ssh-pty-id'
import { ptyOwnership } from './ownership-state'
import type { TerminalOscColorQueryReplyColors } from '../../../../shared/terminal-osc-color-reply'
+1 -1
View File
@@ -1,4 +1,4 @@
import type { IPtyProvider } from '../../../providers/types'
import type { IPtyProvider } from '../../../providers/pty-provider-contract'
import { ptyIncarnationById } from './ownership-state'
export async function shutdownProviderAndDetectExit(
+1 -1
View File
@@ -1,7 +1,7 @@
import type { PtyRendererDelivery } from '../session'
import type { OrcaRuntimeService } from '../../../runtime/orca-runtime'
import type { Store } from '../../../persistence'
import type { IPtyProvider } from '../../../providers/types'
import type { IPtyProvider } from '../../../providers/pty-provider-contract'
import type { GlobalSettings } from '../../../../shared/global-settings-types'
import type { TuiAgent } from '../../../../shared/tui-agent'
import type { AgentProviderSessionMetadata } from '../../../../shared/agent-session-resume'
+1 -1
View File
@@ -1,4 +1,4 @@
import type { IPtyProvider } from '../../../providers/types'
import type { IPtyProvider } from '../../../providers/pty-provider-contract'
import { SSH_PROVIDER_UNREGISTERED_REASON } from '../../../../shared/pty-liveness-verdict'
import { ptyOwnership, ptyIncarnationById } from '../provider/ownership-state'
import {
+1 -1
View File
@@ -1,6 +1,6 @@
import { isRemoteRuntimePtyId } from '../../../../shared/remote-runtime-pty-id'
import { LOCAL_EXECUTION_HOST_ID } from '../../../../shared/execution-host'
import type { IPtyProvider } from '../../../providers/types'
import type { IPtyProvider } from '../../../providers/pty-provider-contract'
import { LocalPtyProvider } from '../../../providers/local-pty-provider'
import { ptyOwnership } from '../provider/ownership-state'
import { ptySizes } from '../delivery/visibility-state'
+1 -1
View File
@@ -1,4 +1,4 @@
import type { PtySpawnResult } from '../../../providers/types'
import type { PtySpawnResult } from '../../../providers/pty-provider-contract'
import { getAppPtyId } from '../provider/registry'
import { allocatePtyLifecycleSequence } from '../host-env/types'
import { snapshotCodexPaneHomeRoutes, codexReattachedHomeRouteField } from '../host-env/codex-home'
+1 -1
View File
@@ -1,4 +1,4 @@
import type { PtySpawnResult } from '../../../providers/types'
import type { PtySpawnResult } from '../../../providers/pty-provider-contract'
import { ptyIncarnationById } from '../provider/ownership-state'
import { ptySizes } from '../delivery/visibility-state'
import { tryGetProviderForPty } from '../provider/registry'
+1 -1
View File
@@ -1,6 +1,6 @@
import { getAppEnvironment } from '../../../../shared/app-environment'
import { getLegacyOpenCodeEnvKeysToDelete } from '../../../opencode/legacy-shared-config-dir'
import type { IPtyProvider, PtySpawnResult } from '../../../providers/types'
import type { IPtyProvider, PtySpawnResult } from '../../../providers/pty-provider-contract'
import { LocalPtyProvider } from '../../../providers/local-pty-provider'
import { makePaneKey, isTerminalLeafId } from '../../../../shared/stable-pane-id'
import { isValidTerminalTabId } from '../../../../shared/terminal-tab-id'
+1 -1
View File
@@ -1,7 +1,7 @@
import { withClaudeProfileTerminalEnv } from '../../../claude-accounts/claude-profile-installed-router'
import { inheritOmpLaunchEnvironment } from '../host-env/omp-launch-environment'
import { getAppEnvironment } from '../../../../shared/app-environment'
import type { PtySpawnResult } from '../../../providers/types'
import type { PtySpawnResult } from '../../../providers/pty-provider-contract'
import { LocalPtyProvider } from '../../../providers/local-pty-provider'
import { isValidTerminalTabId } from '../../../../shared/terminal-tab-id'
import { isTerminalLeafId } from '../../../../shared/stable-pane-id'
+5 -1
View File
@@ -1,5 +1,9 @@
import type { SpawnIntent } from '../../../../shared/host-spawn-admission'
import type { IPtyProvider, PtySpawnOptions, PtySpawnResult } from '../../../providers/types'
import type {
IPtyProvider,
PtySpawnOptions,
PtySpawnResult
} from '../../../providers/pty-provider-contract'
import type { CodexPaneHomeRoute } from '../../../codex/codex-pane-account-registry'
import type { CodexAccountSelectionTarget } from '../../../codex-accounts/runtime-selection'
import type { ClaudeRuntimeAuthPreparation } from '../../../claude-accounts/runtime-auth-service'
+1 -1
View File
@@ -2,7 +2,7 @@ import type { BrowserWindow, WebContents } from 'electron'
import type { OrcaRuntimeService } from '../../runtime/orca-runtime'
import type { Store } from '../../persistence'
import type { GlobalSettings } from '../../../shared/global-settings-types'
import type { IPtyProvider } from '../../providers/types'
import type { IPtyProvider } from '../../providers/pty-provider-contract'
import type { PtyModelRestoreReason } from '../../../shared/pty-model-restore-marker'
import type {
PtyDeliveryWriteOff,
@@ -2,7 +2,7 @@ import { normalize } from 'node:path'
import { realpath, stat } from 'node:fs/promises'
import type { Stats } from 'node:fs'
import type { Store } from '../persistence'
import type { FileStat, IFilesystemProvider } from '../providers/types'
import type { FileStat, IFilesystemProvider } from '../providers/filesystem-provider-contract'
import type { GlobalSettings } from '../../shared/global-settings-types'
import type { Repo } from '../../shared/repo-types'
import { getRepoExecutionHostId, LOCAL_EXECUTION_HOST_ID } from '../../shared/execution-host'
@@ -6,7 +6,7 @@ import {
normalizeRuntimePathSeparators,
resolveRuntimePath
} from '../../shared/cross-platform-path'
import type { FileStat } from '../providers/types'
import type { FileStat } from '../providers/filesystem-provider-contract'
type GitDirectoryStat = Stats | FileStat
-34
View File
@@ -1,34 +0,0 @@
// Aggregate provider contract surface. The three per-domain contracts live in
// their own files; this barrel keeps every historical `providers/types` import
// path working.
// ─── PTY Provider ───────────────────────────────────────────────────
export type {
IPtyProvider,
PtyBackgroundStreamEvent,
PtyDataEvent,
PtyProcessInfo,
PtyProviderBufferSnapshot,
PtySpawnOptions,
PtySpawnResult,
PtyTransientFact
} from './pty-provider-contract'
// ─── Filesystem Provider ────────────────────────────────────────────
export type {
FileRangeReadResult,
FileReadLimits,
FileReadResult,
FileStat,
FileUploadSession,
IFilesystemProvider,
TerminalArtifactAccessOptions
} from './filesystem-provider-contract'
export { FileRangeReadUnsupportedError } from './filesystem-provider-contract'
// ─── Git Provider ───────────────────────────────────────────────────
export type { GitProviderStatusOptions, IGitProvider } from './git-provider-contract'