diff --git a/mobile/scripts/mock-server-native-chat-scenario.ts b/mobile/scripts/mock-server-native-chat-scenario.ts index cc72c5d461a..bfb50a29433 100644 --- a/mobile/scripts/mock-server-native-chat-scenario.ts +++ b/mobile/scripts/mock-server-native-chat-scenario.ts @@ -4,10 +4,8 @@ import { join } from 'node:path' import type { WebSocket } from 'ws' import type { AgentStatusEntry } from '../../src/shared/agent-status/contracts/agent-status-types' import type { NativeChatMessage } from '../../src/shared/native-chat/native-chat-types' -import type { - RuntimeMobileSessionTabsResult, - RuntimeMobileSessionTerminalClientTab -} from '../../src/shared/runtime-types' +import type { RuntimeMobileSessionTabsResult } from '../../src/shared/runtime-types' +import type { RuntimeMobileSessionTerminalClientTab } from '../../src/shared/runtime-mobile-session-tab-contracts' import type { RpcRequest, RpcResponse } from './mock-server-rpc-handlers' // Read send behavior from control file per request: restarting mock rekeys E2EE and forces re-pair, preventing mid-session native chat repros. diff --git a/mobile/src/terminal/session/TerminalPaneView.tsx b/mobile/src/terminal/session/TerminalPaneView.tsx index a063818cc14..b6c4d54013c 100644 --- a/mobile/src/terminal/session/TerminalPaneView.tsx +++ b/mobile/src/terminal/session/TerminalPaneView.tsx @@ -10,12 +10,12 @@ import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme' import type { TerminalFrame } from '../terminal-webview-messages' import { TerminalWebView } from '../TerminalWebView' import type { - MobileTerminalTheme, TerminalKeyboardAvoidanceMetrics, TerminalModes, TerminalPointerInput, TerminalWebViewHandle } from '../terminal-webview-contract' +import type { RuntimeMobileTerminalTheme } from '../../../../src/shared/runtime-mobile-session-tab-contracts' type TerminalPaneViewProps = { handle: string @@ -28,7 +28,7 @@ type TerminalPaneViewProps = { title?: string onFrame?: (handle: string, frame: TerminalFrame) => void keyboardLift: number - terminalTheme?: MobileTerminalTheme + terminalTheme?: RuntimeMobileTerminalTheme textScale: number onRef: (handle: string, ref: TerminalWebViewHandle | null) => void onWebReady: (handle: string) => void diff --git a/mobile/src/terminal/session/mobile-terminal-records.ts b/mobile/src/terminal/session/mobile-terminal-records.ts index 694cbcdc618..161c9d54eda 100644 --- a/mobile/src/terminal/session/mobile-terminal-records.ts +++ b/mobile/src/terminal/session/mobile-terminal-records.ts @@ -1,4 +1,4 @@ -import type { RuntimeMobileTerminalTheme as MobileTerminalTheme } from '../../../../src/shared/runtime-mobile-session-tab-contracts' +import type { RuntimeMobileTerminalTheme } from '../../../../src/shared/runtime-mobile-session-tab-contracts' import type { AgentStatusEntry } from '../../../../src/shared/agent-status/contracts/agent-status-types' import type { BrowserLoadError } from '../../../../src/shared/browser-workspace-types' import { browserLoadErrorsEqual } from '../../../../src/shared/browser-load-failure' @@ -7,7 +7,7 @@ import { translate } from '../../i18n/mobile-i18n' export type TerminalRecord = { handle: string title: string - terminalTheme?: MobileTerminalTheme + terminalTheme?: RuntimeMobileTerminalTheme isActive: boolean /** From `terminal.list`; parked and proven-absent leaves report false. */ connected?: boolean @@ -30,7 +30,7 @@ export type MobileTerminalSessionTab = { /** Host-provided launch context still parked as an unsent TUI-input draft. */ launchDraft?: string launchDraftCreatedAt?: number - terminalTheme?: MobileTerminalTheme + terminalTheme?: RuntimeMobileTerminalTheme isActive: boolean } @@ -82,8 +82,8 @@ type MobileSessionTabLike = } export function mobileTerminalThemesEqual( - left: MobileTerminalTheme | null | undefined, - right: MobileTerminalTheme | null | undefined + left: RuntimeMobileTerminalTheme | null | undefined, + right: RuntimeMobileTerminalTheme | null | undefined ): boolean { if (left === right) { return true diff --git a/mobile/src/terminal/terminal-webview-contract.ts b/mobile/src/terminal/terminal-webview-contract.ts index 32199e338ee..d58413fe890 100644 --- a/mobile/src/terminal/terminal-webview-contract.ts +++ b/mobile/src/terminal/terminal-webview-contract.ts @@ -1,5 +1,5 @@ import type { ParsedFileLinkLocation } from '../../../src/shared/file-links/file-link-location' -import type { RuntimeMobileTerminalTheme } from '../../../src/shared/runtime-types' +import type { RuntimeMobileTerminalTheme } from '../../../src/shared/runtime-mobile-session-tab-contracts' import type { TerminalOscLinkRange } from '../../../src/shared/terminal/links/terminal-osc-link-ranges' import type { StyleProp, ViewStyle } from 'react-native' import type { TerminalFitDimensions } from './terminal-grid-fit' @@ -61,8 +61,6 @@ function toNonNegativeInteger(value: unknown): number { return typeof value === 'number' && Number.isFinite(value) && value > 0 ? Math.floor(value) : 0 } -export type MobileTerminalTheme = RuntimeMobileTerminalTheme - export type TerminalPointerInput = { readonly click: boolean } @@ -89,7 +87,7 @@ export type TerminalSelectionEvents = { export type TerminalWebViewProps = { style?: StyleProp - terminalTheme?: MobileTerminalTheme + terminalTheme?: RuntimeMobileTerminalTheme // Persistent font-size preset; transient CSS pinch zoom is committed into it on release. textScale?: number // Only initially shown views build pre-ready engines, limiting WebGL context use. diff --git a/mobile/src/terminal/terminal-webview-html/theme.ts b/mobile/src/terminal/terminal-webview-html/theme.ts index 185405f04d1..728a2cc57cc 100644 --- a/mobile/src/terminal/terminal-webview-html/theme.ts +++ b/mobile/src/terminal/terminal-webview-html/theme.ts @@ -1,4 +1,4 @@ -import type { RuntimeMobileTerminalTheme } from '../../../../src/shared/runtime-types' +import type { RuntimeMobileTerminalTheme } from '../../../../src/shared/runtime-mobile-session-tab-contracts' import { colors } from '../../theme/mobile-theme' export const DEFAULT_TERMINAL_THEME: RuntimeMobileTerminalTheme['theme'] = { diff --git a/mobile/src/terminal/terminal-webview-messages.ts b/mobile/src/terminal/terminal-webview-messages.ts index 3719e7663c1..bb71effd322 100644 --- a/mobile/src/terminal/terminal-webview-messages.ts +++ b/mobile/src/terminal/terminal-webview-messages.ts @@ -1,4 +1,4 @@ -import type { RuntimeMobileTerminalTheme } from '../../../src/shared/runtime-types' +import type { RuntimeMobileTerminalTheme } from '../../../src/shared/runtime-mobile-session-tab-contracts' import type { TerminalOscLinkRange } from '../../../src/shared/terminal/links/terminal-osc-link-ranges' export type TerminalFrame = { width: number; height: number } diff --git a/src/main/ipc/runtime.ts b/src/main/ipc/runtime.ts index 27fe40bee0a..52565e74f8e 100644 --- a/src/main/ipc/runtime.ts +++ b/src/main/ipc/runtime.ts @@ -1,12 +1,11 @@ import { BrowserWindow, ipcMain } from 'electron' import type { OrcaRuntimeService } from '../runtime/orca-runtime' import type { - RuntimeBrowserDriverState, RuntimeRendererSyncWindowGraph, RuntimeStatus, - RuntimeSyncWindowGraphResult, - RuntimeTerminalDriverState + RuntimeSyncWindowGraphResult } from '../../shared/runtime-types' +import type { RuntimeTerminalDriverState } from '../../shared/runtime-session-contracts' import type { RuntimeRpcResponse } from '../../shared/runtime-rpc-envelope' import type { ClientHostedBrowserRowsEvent } from '../../shared/client-hosted-browser-rows' import { TERMINAL_FIT_RESTORE_DEADLINE_MS } from '../../shared/terminal/viewport/terminal-fit-restore-deadline' @@ -178,7 +177,7 @@ export function registerRuntimeHandlers(runtime: OrcaRuntimeService): void { ipcMain.removeHandler('runtime:getBrowserDrivers') ipcMain.handle( 'runtime:getBrowserDrivers', - (): { browserPageId: string; driver: RuntimeBrowserDriverState }[] => { + (): { browserPageId: string; driver: RuntimeTerminalDriverState }[] => { const drivers = runtime.getAllBrowserDrivers() return Array.from(drivers.entries()).map(([browserPageId, driver]) => ({ browserPageId, diff --git a/src/main/network/proxy-settings.ts b/src/main/network/proxy-settings.ts index ec84b780b32..1203433cf65 100644 --- a/src/main/network/proxy-settings.ts +++ b/src/main/network/proxy-settings.ts @@ -17,8 +17,6 @@ import { runBoundedProxyApplication } from './bounded-proxy-application' import { defaultProxySession, type ProxySession } from './electron-default-proxy-session' import { resolveProxyPolicyWithoutSession, type ProxyApplyResult } from './proxy-policy-resolution' -export { setDefaultProxySessionResolver } from './electron-default-proxy-session' -export type { ProxyApplyResult } from './proxy-policy-resolution' const PROXY_PROBE_URL = 'https://api.anthropic.com/' type SessionProxyApplicationState = { appliedKey: string | null diff --git a/src/main/runtime/browser/driver/runtime-browser-driver-controller.ts b/src/main/runtime/browser/driver/runtime-browser-driver-controller.ts index 700746e066b..cdf9494ace6 100644 --- a/src/main/runtime/browser/driver/runtime-browser-driver-controller.ts +++ b/src/main/runtime/browser/driver/runtime-browser-driver-controller.ts @@ -1,24 +1,24 @@ -import type { RuntimeBrowserDriverState } from '../../../../shared/runtime-session-contracts' +import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' type RuntimeBrowserDriverControllerDeps = { - notifyChanged: (browserPageId: string, next: RuntimeBrowserDriverState) => void + notifyChanged: (browserPageId: string, next: RuntimeTerminalDriverState) => void cancelScreencast: (browserPageId: string) => void } export class RuntimeBrowserDriverController { - private readonly drivers = new Map() + private readonly drivers = new Map() constructor(private readonly deps: RuntimeBrowserDriverControllerDeps) {} - getAll(): Map { + getAll(): Map { return new Map(this.drivers) } - get(browserPageId: string): RuntimeBrowserDriverState { + get(browserPageId: string): RuntimeTerminalDriverState { return this.drivers.get(browserPageId) ?? { kind: 'idle' } } - set(browserPageId: string, next: RuntimeBrowserDriverState): void { + set(browserPageId: string, next: RuntimeTerminalDriverState): void { const prev = this.get(browserPageId) if (prev.kind === next.kind) { if (prev.kind === 'mobile' && next.kind === 'mobile' && prev.clientId === next.clientId) { diff --git a/src/main/runtime/browser/screencast/browser-screencast-driver-scope.ts b/src/main/runtime/browser/screencast/browser-screencast-driver-scope.ts index a1bddcd9e1e..eccfcba4894 100644 --- a/src/main/runtime/browser/screencast/browser-screencast-driver-scope.ts +++ b/src/main/runtime/browser/screencast/browser-screencast-driver-scope.ts @@ -1,4 +1,4 @@ -import type { RuntimeBrowserDriverState } from '../../../../shared/runtime-session-contracts' +import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' export type BrowserScreencastSubscriber = { cancel: (emitEnd?: boolean) => void @@ -16,7 +16,7 @@ export function screencastSubscriberDrivesAsMobile( export function resolveBrowserDriverAfterMobileRelease( remaining: Iterable -): RuntimeBrowserDriverState { +): RuntimeTerminalDriverState { let fallback: BrowserScreencastSubscriber | null = null for (const subscriber of remaining) { if (subscriber.drivesAsMobile) { diff --git a/src/main/runtime/browser/screencast/browser-screencast-subscriber-test-harness.ts b/src/main/runtime/browser/screencast/browser-screencast-subscriber-test-harness.ts index 9e97df22f68..f360732b9c7 100644 --- a/src/main/runtime/browser/screencast/browser-screencast-subscriber-test-harness.ts +++ b/src/main/runtime/browser/screencast/browser-screencast-subscriber-test-harness.ts @@ -1,6 +1,6 @@ import { expect, vi } from 'vitest' import { OrcaRuntimeService } from '../../orca-runtime' -import type { RuntimeBrowserDriverState } from '../../../../shared/runtime-session-contracts' +import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' export const HARNESS_WORKTREE_ID = 'repo-1::/tmp/worktree-a' export const HARNESS_PAGE_ID = 'page-1' @@ -48,7 +48,7 @@ export type ScreencastHarness = { connectionId: string clientKind?: 'mobile' | 'runtime' }) => ScreencastSubscriber - driver: () => RuntimeBrowserDriverState | undefined + driver: () => RuntimeTerminalDriverState | undefined } /** Drive production subscription state with fake Chromium sessions. */ diff --git a/src/main/runtime/browser/screencast/runtime-browser-screencast-controller.ts b/src/main/runtime/browser/screencast/runtime-browser-screencast-controller.ts index 46487dd98da..473aefcc58d 100644 --- a/src/main/runtime/browser/screencast/runtime-browser-screencast-controller.ts +++ b/src/main/runtime/browser/screencast/runtime-browser-screencast-controller.ts @@ -1,5 +1,5 @@ import type { BrowserScreencastResult } from '../../../../shared/browser/runtime/runtime-browser-contracts' -import type { RuntimeBrowserDriverState } from '../../../../shared/runtime-session-contracts' +import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' import { BrowserError } from '../../../browser/browser-error' import { resolveBrowserDriverAfterMobileRelease, @@ -17,8 +17,8 @@ type RuntimeBrowserScreencastControllerDeps = { connectionId?: string ) => void cleanupSubscription: (subscriptionId: string) => void - getDriver: (browserPageId: string) => RuntimeBrowserDriverState - setDriver: (browserPageId: string, next: RuntimeBrowserDriverState) => void + getDriver: (browserPageId: string) => RuntimeTerminalDriverState + setDriver: (browserPageId: string, next: RuntimeTerminalDriverState) => void notifyRemoteViewersChanged: (browserPageId: string, hasRemoteViewers: boolean) => void } diff --git a/src/main/runtime/client/events/runtime-notifier-contract.ts b/src/main/runtime/client/events/runtime-notifier-contract.ts index a39b6216384..aeaacdf7d83 100644 --- a/src/main/runtime/client/events/runtime-notifier-contract.ts +++ b/src/main/runtime/client/events/runtime-notifier-contract.ts @@ -29,7 +29,6 @@ import type { import type { CreateWorktreeResult } from '../../../../shared/worktree/create-types' import type { WorktreeStartupLaunch } from '../../../../shared/worktree/launch-types' import type { - RuntimeBrowserDriverState, RuntimeMobileSessionTabMove, RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' @@ -39,8 +38,6 @@ import type { AgentPaneActivityChange } from '../../../../shared/agent-status/presentation/agent-list-status' -type DriverState = RuntimeTerminalDriverState - export type RuntimeNotifier = { automationsChanged?(payload: { selector?: { kind: 'self' } | { kind: 'ssh'; targetId: string } | { kind: 'orphan' } @@ -187,12 +184,12 @@ export type RuntimeNotifier = { rows: number ): void // Publish driver/clientId so the lock banner distinguishes mobile actors; boolean lock state loses identity (docs/mobile-presence-lock.md). - terminalDriverChanged(ptyId: string, driver: DriverState): void + terminalDriverChanged(ptyId: string, driver: RuntimeTerminalDriverState): void nativeChatLaunchDraftResolved?( tabId: string, resolution: { text: string; createdAt: number } ): void - browserDriverChanged?(browserPageId: string, driver: RuntimeBrowserDriverState): void + browserDriverChanged?(browserPageId: string, driver: RuntimeTerminalDriverState): void browserRemoteViewersChanged?(browserPageId: string, hasRemoteViewers: boolean): void clientHostedBrowserRowsChanged?(event: ClientHostedBrowserRowsEvent): void claudeAccountSelected?(change: ClaudeAccountSelectionChange): void diff --git a/src/main/runtime/rpc/methods/terminal/terminal-input-delivery.ts b/src/main/runtime/rpc/methods/terminal/terminal-input-delivery.ts index f52fe5f5671..04863e7695a 100644 --- a/src/main/runtime/rpc/methods/terminal/terminal-input-delivery.ts +++ b/src/main/runtime/rpc/methods/terminal/terminal-input-delivery.ts @@ -7,7 +7,7 @@ import type { RpcCallerIdentity } from '../../rpc-caller-identity' import { InvalidArgumentError } from '../../core' import type { RuntimeTerminalSend } from '../../../../../shared/runtime-terminal-send-contract' import type { OrcaRuntimeService } from '../../../orca-runtime' -import type { RuntimeTerminalDriverState as DriverState } from '../../../../../shared/runtime-session-contracts' +import type { RuntimeTerminalDriverState } from '../../../../../shared/runtime-session-contracts' import { TERMINAL_INPUT_MAX_BYTES, TERMINAL_INPUT_TOO_LARGE_ERROR, @@ -54,7 +54,7 @@ export async function assertTerminalSendTextWithinLimit(text: string | undefined } export function resolveMobileFloorClientId( - driver: DriverState | null, + driver: RuntimeTerminalDriverState | null, client: TerminalViewportClient | undefined ): string | null { if (client?.type === 'mobile') { diff --git a/src/main/runtime/session-tabs/main-session-tab-rows.ts b/src/main/runtime/session-tabs/main-session-tab-rows.ts index 20feedaebe9..d6fbf316b8b 100644 --- a/src/main/runtime/session-tabs/main-session-tab-rows.ts +++ b/src/main/runtime/session-tabs/main-session-tab-rows.ts @@ -11,8 +11,6 @@ import type { RuntimeMobileSessionTabsSnapshot } from '../../../shared/runtime-session-contracts' -type Row = RuntimeMobileSessionSnapshotTab - /** Main's projection of the rows (projectSessionTabs): the snapshot minus the runtime's stamps. */ export type MainSessionTabRows = Omit< RuntimeMobileSessionTabsSnapshot, @@ -20,7 +18,7 @@ export type MainSessionTabRows = Omit< > /** Merge window facts into terminal/edit rows; keep window browser/chat/diff/preview rows whole while listed, including diff-draft dirty state. */ -function isMainRow(row: Row): boolean { +function isMainRow(row: RuntimeMobileSessionSnapshotTab): boolean { return ( row.type === 'terminal' || (row.type === 'file' && row.mode !== 'diff') || @@ -29,7 +27,7 @@ function isMainRow(row: Row): boolean { } /** A terminal row with a manual name: its tab's custom title or its pane's own title. */ -function isNamed(row: Extract): boolean { +function isNamed(row: Extract): boolean { return !!row.customTitle || !!row.parentLayout?.titlesByLeafId?.[row.leafId]?.trim() } @@ -62,7 +60,11 @@ function keepsWindowPtyId( } /** Use window-only fields and pending terminal bindings until main catches up; main's certified exit overrides the window's old terminal id. */ -function withWindowFacts(row: Row, windowRow: Row | undefined, rules: MergeRules): Row { +function withWindowFacts( + row: RuntimeMobileSessionSnapshotTab, + windowRow: RuntimeMobileSessionSnapshotTab | undefined, + rules: MergeRules +): RuntimeMobileSessionSnapshotTab { if (row.type === 'terminal' && windowRow?.type === 'terminal') { return { ...row, @@ -100,10 +102,10 @@ function withWindowFacts(row: Row, windowRow: Row | undefined, rules: MergeRules /** Main's rows in main's order, each window-only row after the row it follows in the window's. */ function withWindowOnlyRows( - rows: Row[], - windowRows: readonly Row[], + rows: RuntimeMobileSessionSnapshotTab[], + windowRows: readonly RuntimeMobileSessionSnapshotTab[], windowOnly: ReadonlySet -): Row[] { +): RuntimeMobileSessionSnapshotTab[] { const merged = [...rows] windowRows.forEach((row, index) => { if (!windowOnly.has(row.id)) { @@ -162,7 +164,7 @@ export function withMainSessionTabRows( const shown = !mainRetiredSelection ? windowGroups.get(group.id)?.activeTabId : undefined return shown !== undefined ? { ...group, activeTabId: shown } : group }) - const activeGroupIndex = (activeRow: Row | undefined): number => { + const activeGroupIndex = (activeRow: RuntimeMobileSessionSnapshotTab | undefined): number => { const byRow = activeRow ? tabGroups.findIndex((group) => group.tabOrder.includes(orderIdOf(activeRow))) : -1 diff --git a/src/main/runtime/terminal/driver/runtime-terminal-driver-controller.ts b/src/main/runtime/terminal/driver/runtime-terminal-driver-controller.ts index a9ebabf764a..d64685dbaab 100644 --- a/src/main/runtime/terminal/driver/runtime-terminal-driver-controller.ts +++ b/src/main/runtime/terminal/driver/runtime-terminal-driver-controller.ts @@ -1,42 +1,40 @@ import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' import { notifyRuntimeListeners } from '../../events/runtime-listener-delivery' -type DriverState = RuntimeTerminalDriverState - type RuntimeTerminalDriverDependencies = { - notifyChanged: (ptyId: string, next: DriverState) => void + notifyChanged: (ptyId: string, next: RuntimeTerminalDriverState) => void canClaimMobileFloor: (ptyId: string, clientId: string) => boolean commitMobileFloor: ( ptyId: string, clientId: string, - previousFloor: DriverState, + previousFloor: RuntimeTerminalDriverState, isCurrent: () => boolean ) => Promise } type MobileInputFloorState = { - base: DriverState + base: RuntimeTerminalDriverState generation: number committedGeneration: number pending: Map } export class RuntimeTerminalDriverController { - private readonly current = new Map() - private readonly listeners = new Map void>>() + private readonly current = new Map() + private readonly listeners = new Map void>>() private readonly inputFloorClaims = new Map() constructor(private readonly deps: RuntimeTerminalDriverDependencies) {} - get(ptyId: string): DriverState { + get(ptyId: string): RuntimeTerminalDriverState { return this.current.get(ptyId) ?? { kind: 'idle' } } - getAll(): Map { + getAll(): Map { return new Map(this.current) } - set(ptyId: string, next: DriverState): void { + set(ptyId: string, next: RuntimeTerminalDriverState): void { // A desktop reclaim or disconnect supersedes unfinished mobile input. if (next.kind !== 'mobile') { this.inputFloorClaims.delete(ptyId) @@ -71,8 +69,9 @@ export class RuntimeTerminalDriverController { return true } - subscribe(ptyId: string, listener: (driver: DriverState) => void): () => void { - const listeners = this.listeners.get(ptyId) ?? new Set<(driver: DriverState) => void>() + subscribe(ptyId: string, listener: (driver: RuntimeTerminalDriverState) => void): () => void { + const listeners = + this.listeners.get(ptyId) ?? new Set<(driver: RuntimeTerminalDriverState) => void>() listeners.add(listener) this.listeners.set(ptyId, listeners) return () => { diff --git a/src/main/runtime/terminal/driver/terminal-driver-resources.ts b/src/main/runtime/terminal/driver/terminal-driver-resources.ts index 24f10c0f36b..c9655ef980e 100644 --- a/src/main/runtime/terminal/driver/terminal-driver-resources.ts +++ b/src/main/runtime/terminal/driver/terminal-driver-resources.ts @@ -20,7 +20,7 @@ import type { import type { ExactWorkerProviderSession } from '../../../../shared/orchestration/workers/orchestration-worker-output' import type { RuntimeProviderSnapshotReadOptions } from '../output/provider-snapshot-read-options' import { OrcaRuntimeWithFitOverrideListeners } from '../lifecycle/terminal-view-resources' -import type { RuntimeTerminalDriverState as DriverState } from '../../../../shared/runtime-session-contracts' +import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' import type { ApplyLayoutResult, PtyLayoutTarget, @@ -121,7 +121,7 @@ export abstract class OrcaRuntimeWithTerminalDrivers extends OrcaRuntimeWithFitO providerSnapshot?: RuntimeProviderSnapshotReadOptions ): Promise - abstract getDriver(ptyId: string): DriverState + abstract getDriver(ptyId: string): RuntimeTerminalDriverState protected abstract enqueueLayout( ptyId: string, target: PtyLayoutTarget @@ -129,7 +129,7 @@ export abstract class OrcaRuntimeWithTerminalDrivers extends OrcaRuntimeWithFitO abstract mobileTookFloor( ptyId: string, clientId: string, - previousFloor?: DriverState, + previousFloor?: RuntimeTerminalDriverState, isCurrent?: () => boolean ): Promise protected abstract resolveDesktopRestoreTarget(ptyId: string): { cols: number; rows: number } diff --git a/src/main/runtime/terminal/layout/mobile-terminal-activity.ts b/src/main/runtime/terminal/layout/mobile-terminal-activity.ts index 73143af938a..509858d785a 100644 --- a/src/main/runtime/terminal/layout/mobile-terminal-activity.ts +++ b/src/main/runtime/terminal/layout/mobile-terminal-activity.ts @@ -1,6 +1,6 @@ import { OrcaRuntimeWithMarkPtyLivenessUnverifiable } from './terminal-input-floor' import type { ApplyLayoutResult } from './terminal-layout-state' -import type { RuntimeTerminalDriverState as DriverState } from '../../../../shared/runtime-session-contracts' +import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' import { clampTerminalViewport } from '../../../../shared/terminal/viewport/terminal-viewport' export abstract class OrcaRuntimeWithMobileTookFloor extends OrcaRuntimeWithMarkPtyLivenessUnverifiable { @@ -11,7 +11,7 @@ export abstract class OrcaRuntimeWithMobileTookFloor extends OrcaRuntimeWithMark async mobileTookFloor( ptyId: string, clientId: string, - previousFloor?: DriverState, + previousFloor?: RuntimeTerminalDriverState, isCurrent?: () => boolean ): Promise { if (!isCurrent) { diff --git a/src/main/runtime/terminal/layout/terminal-client-disconnect.ts b/src/main/runtime/terminal/layout/terminal-client-disconnect.ts index 54be780e280..8b21da52c16 100644 --- a/src/main/runtime/terminal/layout/terminal-client-disconnect.ts +++ b/src/main/runtime/terminal/layout/terminal-client-disconnect.ts @@ -1,5 +1,5 @@ import { OrcaRuntimeWithHasRecentTerminalOutputPath } from '../output/terminal-output-path' -import type { RuntimeTerminalDriverState as DriverState } from '../../../../shared/runtime-session-contracts' +import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' import type { RuntimeFileCommandSurface } from '../../construction/runtime-file-command-surface' export abstract class OrcaRuntimeWithOnClientDisconnected extends OrcaRuntimeWithHasRecentTerminalOutputPath { @@ -7,7 +7,7 @@ export abstract class OrcaRuntimeWithOnClientDisconnected extends OrcaRuntimeWit protected abstract pickMostRecentActor( inner: Map ): { clientId: string; lastActedAt: number } | null - protected abstract setDriver(ptyId: string, next: DriverState): void + protected abstract setDriver(ptyId: string, next: RuntimeTerminalDriverState): void abstract applyRemoteDesktopLayout(ptyId: string): Promise protected abstract getAutoRestoreFitMs(): number | null diff --git a/src/main/runtime/terminal/layout/terminal-input-floor.ts b/src/main/runtime/terminal/layout/terminal-input-floor.ts index da7b0c2010c..5c1527774f1 100644 --- a/src/main/runtime/terminal/layout/terminal-input-floor.ts +++ b/src/main/runtime/terminal/layout/terminal-input-floor.ts @@ -1,6 +1,6 @@ import { OrcaRuntimeWithOnPtyExit } from '../lifecycle/pty-exit-lifecycle' import type { PtyLivenessVerdict } from '../../../../shared/terminal/pty/lifecycle/pty-liveness-verdict' -import type { RuntimeTerminalDriverState as DriverState } from '../../../../shared/runtime-session-contracts' +import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' import { isDrivingInputKind, type TerminalInputKind @@ -158,11 +158,11 @@ export abstract class OrcaRuntimeWithMarkPtyLivenessUnverifiable extends OrcaRun this.ptyLivenessVerdictByPtyId.delete(ptyId) } - getDriver(ptyId: string): DriverState { + getDriver(ptyId: string): RuntimeTerminalDriverState { return this.terminalDrivers.get(ptyId) } - protected setDriver(ptyId: string, next: DriverState): void { + protected setDriver(ptyId: string, next: RuntimeTerminalDriverState): void { this.terminalDrivers.set(ptyId, next) } diff --git a/src/main/runtime/terminal/layout/terminal-view-presence.ts b/src/main/runtime/terminal/layout/terminal-view-presence.ts index 706683009b3..0a9630d2873 100644 --- a/src/main/runtime/terminal/layout/terminal-view-presence.ts +++ b/src/main/runtime/terminal/layout/terminal-view-presence.ts @@ -5,7 +5,7 @@ import type { PtyProviderBufferSnapshot } from '../../../providers/pty-provider- import type { RuntimeTerminalWriteOptions } from '../input/runtime-terminal-writer' import type { WriteSettlement } from '../../../../shared/terminal/pty/lifecycle/pty-write-settlement' -import type { RuntimeTerminalDriverState as DriverState } from '../../../../shared/runtime-session-contracts' +import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' import { addListenerToMap } from './terminal-listener-map' import { notifyRuntimeListeners } from '../../events/runtime-listener-delivery' import type { RuntimeTerminalAttention } from '../../../../shared/runtime-terminal-contracts' @@ -222,7 +222,10 @@ export abstract class OrcaRuntimeWithNotifyRemoteTerminalViewPresenceChanged ext return addListenerToMap(this.fitOverrideListeners, ptyId, listener) } - subscribeToDriverChanges(ptyId: string, listener: (driver: DriverState) => void): () => void { + subscribeToDriverChanges( + ptyId: string, + listener: (driver: RuntimeTerminalDriverState) => void + ): () => void { return this.terminalDrivers.subscribe(ptyId, listener) } diff --git a/src/main/runtime/terminal/output/terminal-output-path.ts b/src/main/runtime/terminal/output/terminal-output-path.ts index 0e49610ab15..51fb6bda854 100644 --- a/src/main/runtime/terminal/output/terminal-output-path.ts +++ b/src/main/runtime/terminal/output/terminal-output-path.ts @@ -1,5 +1,5 @@ import type { ApplyLayoutResult, PtyLayoutTarget } from '../layout/terminal-layout-state' -import type { RuntimeTerminalDriverState as DriverState } from '../../../../shared/runtime-session-contracts' +import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' import { OrcaRuntimeWithGetOrchestrationDispatchAuthority } from './terminal-orchestration-authority' import { clampTerminalViewport } from '../../../../shared/terminal/viewport/terminal-viewport' @@ -11,7 +11,7 @@ export abstract class OrcaRuntimeWithHasRecentTerminalOutputPath extends OrcaRun abstract mobileTookFloor( ptyId: string, clientId: string, - previousFloor?: DriverState, + previousFloor?: RuntimeTerminalDriverState, isCurrent?: () => boolean ): Promise protected abstract resolveDesktopRestoreTarget(ptyId: string): { cols: number; rows: number } @@ -153,7 +153,7 @@ export abstract class OrcaRuntimeWithHasRecentTerminalOutputPath extends OrcaRun return result } - getAllTerminalDrivers(): Map { + getAllTerminalDrivers(): Map { return this.terminalDrivers.getAll() } diff --git a/src/main/startup/main-process-preflight.ts b/src/main/startup/main-process-preflight.ts index 16bddb5f6bd..d0644f29c4a 100644 --- a/src/main/startup/main-process-preflight.ts +++ b/src/main/startup/main-process-preflight.ts @@ -71,7 +71,7 @@ import { electronSpeechServiceFactories } from '../host/electron-speech-services import { setSpeechServiceFactories } from '../speech/speech-runtime-service' import { setWorktreeWatcherRemoval } from '../workspaces/removal/worktree-watcher-removal' import { desktopWorktreeWatcherRemoval } from '../ipc/filesystem/watchers/filesystem-watcher' -import { setDefaultProxySessionResolver } from '../network/proxy-settings' +import { setDefaultProxySessionResolver } from '../network/electron-default-proxy-session' import { initDataPath, getCanonicalUserDataPath } from '../persistence/loading-store/user-data-path' import { applyMacPressAndHoldDefaultAtStartup } from '../window/desktop-integration/macos-press-and-hold-default' import { configureSessionParseCachePersistence } from '../ai-vault/parse-cache/session-parse-cache-persistence' diff --git a/src/main/text-generation/source-control-local-process.ts b/src/main/text-generation/source-control-local-process.ts index ff5eb0fedc0..fe75e880b9d 100644 --- a/src/main/text-generation/source-control-local-process.ts +++ b/src/main/text-generation/source-control-local-process.ts @@ -6,7 +6,7 @@ import { producePromptRecords } from './source-control-prompt-producer' import { argumentBudgetFailure } from './source-control-command-line-budget' export { fitsLocalCommandLine } from './source-control-command-line-budget' import { removeTree } from '../../shared/windows-transient-lock-removal' -import { WindowsCmdLineBreakError } from '@orca/process-host' +import { WindowsCmdLineBreakError } from '@orca/process-host/windows-command-line' import { WindowsCommandLineBudgetError } from '../../shared/windows-command-line-budget' import { supervisedProviderSpawnFailure } from '../provider-process/provider-spawn-failure-report' import { diff --git a/src/packages/process-host/src/run-process.ts b/src/packages/process-host/src/run-process.ts index c8b699fa62e..7ddfb634a24 100644 --- a/src/packages/process-host/src/run-process.ts +++ b/src/packages/process-host/src/run-process.ts @@ -12,8 +12,6 @@ import { hasSpawnObserver, notifySpawnObserver } from './spawn-observer' import { createOutputSink } from './bounded-output-sink' import { createChildTerminationReporter } from './child-termination-reporter' -export { WindowsCmdLineBreakError } from './windows-command-line' - import type { PipedProcessSpec, ProcessSpec, ProcessResult } from './process-spec' import { DEFAULT_PROCESS_TIMEOUT_MS, DEFAULT_MAX_OUTPUT_BYTES } from './process-spec' // Bound waits for children that ignore termination and never emit close. diff --git a/src/preload/api/runtime-api.ts b/src/preload/api/runtime-api.ts index 5a590a01475..057d0635354 100644 --- a/src/preload/api/runtime-api.ts +++ b/src/preload/api/runtime-api.ts @@ -7,11 +7,10 @@ import type { ManagedOrcadPreloadApi } from './managed-orcad-api' import type { WslHostsPreloadApi } from './wsl-hosts-api' import type { RuntimeHostStatusSnapshot } from '../../shared/remote-runtime/host-status/runtime-host-status' import type { - RuntimeBrowserDriverState, RuntimeRendererSyncWindowGraph, - RuntimeSyncWindowGraphResult, - RuntimeTerminalDriverState + RuntimeSyncWindowGraphResult } from '../../shared/runtime-types' +import type { RuntimeTerminalDriverState } from '../../shared/runtime-session-contracts' import type { RuntimeStatus } from '../../shared/runtime-session-contracts' import type { RuntimeRpcResponse } from '../../shared/runtime-rpc-envelope' import type { ClientHostedBrowserRowsEvent } from '../../shared/client-hosted-browser-rows' @@ -56,7 +55,7 @@ export type RuntimeApi = { getBrowserDrivers: () => Promise< { browserPageId: string - driver: RuntimeBrowserDriverState + driver: RuntimeTerminalDriverState }[] > getBrowserRemoteViewerPages?: () => Promise @@ -78,7 +77,7 @@ export type RuntimeApi = { callback: (event: { tabId: string; text: string; createdAt: number }) => void ) => () => void onBrowserDriverChanged: ( - callback: (event: { browserPageId: string; driver: RuntimeBrowserDriverState }) => void + callback: (event: { browserPageId: string; driver: RuntimeTerminalDriverState }) => void ) => () => void // Older preloads lack this signal. onBrowserRemoteViewersChanged?: ( diff --git a/src/preload/api/runtime-bridge.ts b/src/preload/api/runtime-bridge.ts index e0894d91a21..eaf6c4e7eff 100644 --- a/src/preload/api/runtime-bridge.ts +++ b/src/preload/api/runtime-bridge.ts @@ -2,12 +2,11 @@ import { ipcRenderer } from 'electron' import type { ClientHostedBrowserRowsEvent } from '../../shared/client-hosted-browser-rows' import type { SidebarInputsChangedEvent } from '../../shared/sidebar-list/sidebar-inputs-feed-contract' import type { - RuntimeBrowserDriverState, RuntimeRendererSyncWindowGraph, RuntimeStatus, - RuntimeSyncWindowGraphResult, - RuntimeTerminalDriverState + RuntimeSyncWindowGraphResult } from '../../shared/runtime-types' +import type { RuntimeTerminalDriverState } from '../../shared/runtime-session-contracts' import type { RuntimeRpcResponse } from '../../shared/runtime-rpc-envelope' import type { RuntimeEnvironmentSubscriptionHandle } from '../runtime-environment-subscriptions' import type { PreloadApi } from '../api-types' @@ -55,7 +54,7 @@ export const runtimeApi = { getBrowserDrivers: (): Promise< { browserPageId: string - driver: RuntimeBrowserDriverState + driver: RuntimeTerminalDriverState }[] > => ipcRenderer.invoke('runtime:getBrowserDrivers'), getBrowserRemoteViewerPages: (): Promise => @@ -110,13 +109,13 @@ export const runtimeApi = { return () => ipcRenderer.removeListener('runtime:nativeChatLaunchDraftResolved', listener) }, onBrowserDriverChanged: ( - callback: (event: { browserPageId: string; driver: RuntimeBrowserDriverState }) => void + callback: (event: { browserPageId: string; driver: RuntimeTerminalDriverState }) => void ): (() => void) => { const listener = ( _event: Electron.IpcRendererEvent, data: { browserPageId: string - driver: RuntimeBrowserDriverState + driver: RuntimeTerminalDriverState } ) => callback(data) ipcRenderer.on('runtime:browserDriverChanged', listener) diff --git a/src/renderer/src/components/browser-pane/assemble-chrome/BrowserMobileDriverOverlay.tsx b/src/renderer/src/components/browser-pane/assemble-chrome/BrowserMobileDriverOverlay.tsx index 9da8606fa75..6767e8140bb 100644 --- a/src/renderer/src/components/browser-pane/assemble-chrome/BrowserMobileDriverOverlay.tsx +++ b/src/renderer/src/components/browser-pane/assemble-chrome/BrowserMobileDriverOverlay.tsx @@ -1,11 +1,11 @@ import { useCallback, useRef, useState, type ReactElement } from 'react' import { Button } from '@/components/ui/button' import { cn } from '@/lib/utils' -import type { BrowserDriverState } from '@/lib/pane-manager/browser-mobile-driver-state' +import type { RuntimeTerminalDriverState } from '../../../../../shared/runtime-session-contracts' import { useTranslate } from '@/i18n/use-translate' type Props = { - driver: BrowserDriverState + driver: RuntimeTerminalDriverState onTakeBack: () => void | Promise } diff --git a/src/renderer/src/components/native-chat/host-access/native-chat-send-eligibility.ts b/src/renderer/src/components/native-chat/host-access/native-chat-send-eligibility.ts index 457abe385a3..95411bc6b74 100644 --- a/src/renderer/src/components/native-chat/host-access/native-chat-send-eligibility.ts +++ b/src/renderer/src/components/native-chat/host-access/native-chat-send-eligibility.ts @@ -1,7 +1,9 @@ -import type { DriverState } from '@/lib/pane-manager/mobile-driver-state' +import type { RuntimeTerminalDriverState } from '../../../../../shared/runtime-session-contracts' /** Mirror terminal mobile-driver locks; unresolved driver state stays usable until send-time PTY validation. */ -export function deriveNativeChatCanSend(driver: DriverState | null | undefined): boolean { +export function deriveNativeChatCanSend( + driver: RuntimeTerminalDriverState | null | undefined +): boolean { return driver?.kind !== 'mobile' } diff --git a/src/renderer/src/components/terminal-pane/mobile-driver/MobileDriverOverlay.tsx b/src/renderer/src/components/terminal-pane/mobile-driver/MobileDriverOverlay.tsx index c61670477c7..15be78fc5da 100644 --- a/src/renderer/src/components/terminal-pane/mobile-driver/MobileDriverOverlay.tsx +++ b/src/renderer/src/components/terminal-pane/mobile-driver/MobileDriverOverlay.tsx @@ -1,4 +1,4 @@ -import type { RuntimeTerminalDriverState as DriverState } from '../../../../../shared/runtime-session-contracts' +import type { RuntimeTerminalDriverState } from '../../../../../shared/runtime-session-contracts' import { useCallback, useEffect, useId, useRef, useState, type ReactElement } from 'react' import { Minimize2, Smartphone } from 'lucide-react' import { Button } from '@/components/ui/button' @@ -13,7 +13,7 @@ import { import { useTranslate } from '@/i18n/use-translate' type Props = { - driver: DriverState + driver: RuntimeTerminalDriverState hasFitOverride: boolean onAction: () => void | Promise onAllAction?: () => void | Promise diff --git a/src/renderer/src/hooks/ipc-events/mobile-driver-ipc-bridge.ts b/src/renderer/src/hooks/ipc-events/mobile-driver-ipc-bridge.ts index c22b2893190..57460110218 100644 --- a/src/renderer/src/hooks/ipc-events/mobile-driver-ipc-bridge.ts +++ b/src/renderer/src/hooks/ipc-events/mobile-driver-ipc-bridge.ts @@ -11,10 +11,7 @@ import type { ClientHostedBrowserRowsEvent } from '../../../../shared/client-hos import { setDriverForPty, hydrateDrivers } from '@/lib/pane-manager/mobile-driver-state' import { setFitOverride, hydrateOverrides } from '@/lib/pane-manager/mobile-fit-overrides' import { applyNativeChatLaunchDraftResolved } from '@/runtime/native-chat/launch-drafts/native-chat-launch-draft-runtime-resolution' -import type { - RuntimeBrowserDriverState, - RuntimeTerminalDriverState -} from '../../../../shared/runtime-types' +import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' import { useAppStore } from '../../store/index' const MAX_PENDING_MOBILE_STATE_EVENTS = 300 @@ -32,7 +29,7 @@ type PendingMobileStateEvent = | { kind: 'driver'; event: { ptyId: string; driver: RuntimeTerminalDriverState } } | { kind: 'browser-driver' - event: { browserPageId: string; driver: RuntimeBrowserDriverState } + event: { browserPageId: string; driver: RuntimeTerminalDriverState } } export function registerMobileDriverIpcBridge( diff --git a/src/renderer/src/lib/pane-manager/browser-mobile-driver-state.ts b/src/renderer/src/lib/pane-manager/browser-mobile-driver-state.ts index 52befac2501..73702d2eb83 100644 --- a/src/renderer/src/lib/pane-manager/browser-mobile-driver-state.ts +++ b/src/renderer/src/lib/pane-manager/browser-mobile-driver-state.ts @@ -1,17 +1,15 @@ import { useSyncExternalStore } from 'react' import { recomputeOn } from '@/lib/recompute-on' -import type { RuntimeBrowserDriverState } from '../../../../shared/runtime-types' +import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' -export type BrowserDriverState = RuntimeBrowserDriverState - -const driverByBrowserPageId = new Map() +const driverByBrowserPageId = new Map() // Why: a shared instance keeps getDriverForBrowserPage referentially stable for useSyncExternalStore snapshots. -export const IDLE_BROWSER_DRIVER: BrowserDriverState = { kind: 'idle' } +export const IDLE_BROWSER_DRIVER: RuntimeTerminalDriverState = { kind: 'idle' } type BrowserDriverChangeEvent = { browserPageId: string - driver: BrowserDriverState + driver: RuntimeTerminalDriverState } type BrowserDriverChangeListener = (event: BrowserDriverChangeEvent) => void @@ -49,7 +47,10 @@ function notifyChange(event: BrowserDriverChangeEvent): void { } } -export function setDriverForBrowserPage(browserPageId: string, driver: BrowserDriverState): void { +export function setDriverForBrowserPage( + browserPageId: string, + driver: RuntimeTerminalDriverState +): void { if (driver.kind === 'idle') { driverByBrowserPageId.delete(browserPageId) } else { @@ -58,13 +59,13 @@ export function setDriverForBrowserPage(browserPageId: string, driver: BrowserDr notifyChange({ browserPageId, driver }) } -export function getDriverForBrowserPage(browserPageId: string): BrowserDriverState { +export function getDriverForBrowserPage(browserPageId: string): RuntimeTerminalDriverState { return driverByBrowserPageId.get(browserPageId) ?? IDLE_BROWSER_DRIVER } export function useBrowserDriverForPage( browserPageId: string | null | undefined -): BrowserDriverState { +): RuntimeTerminalDriverState { const storeVersion = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) return recomputeOn([storeVersion], () => browserPageId ? getDriverForBrowserPage(browserPageId) : IDLE_BROWSER_DRIVER @@ -108,7 +109,7 @@ export function useBrowserMobileDrivenPageIds( } export function hydrateBrowserDrivers( - drivers: { browserPageId: string; driver: BrowserDriverState }[] + drivers: { browserPageId: string; driver: RuntimeTerminalDriverState }[] ): void { const affectedPageIds = new Set(driverByBrowserPageId.keys()) driverByBrowserPageId.clear() diff --git a/src/renderer/src/lib/pane-manager/mobile-driver-state.ts b/src/renderer/src/lib/pane-manager/mobile-driver-state.ts index 089f9a0d973..eab1376d635 100644 --- a/src/renderer/src/lib/pane-manager/mobile-driver-state.ts +++ b/src/renderer/src/lib/pane-manager/mobile-driver-state.ts @@ -1,14 +1,12 @@ // Mirror runtime PTY driver presence from IPC: mobile ownership locks xterm input/resize and shows Take back (mobile-presence-lock.md). -import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-types' +import type { RuntimeTerminalDriverState } from '../../../../shared/runtime-session-contracts' -export type DriverState = RuntimeTerminalDriverState - -const driverByPtyId = new Map() +const driverByPtyId = new Map() type DriverChangeEvent = { ptyId: string - driver: DriverState + driver: RuntimeTerminalDriverState } type DriverChangeListener = (event: DriverChangeEvent) => void const changeListeners = new Set() @@ -24,7 +22,7 @@ function notifyChange(event: DriverChangeEvent): void { } } -export function setDriverForPty(ptyId: string, driver: DriverState): void { +export function setDriverForPty(ptyId: string, driver: RuntimeTerminalDriverState): void { if (driver.kind === 'idle') { driverByPtyId.delete(ptyId) } else { @@ -45,11 +43,11 @@ export function replaceDriverPtyId(replacedPtyId: string, ptyId: string): void { setDriverForPty(replacedPtyId, { kind: 'idle' }) } -export function getDriverForPty(ptyId: string): DriverState { +export function getDriverForPty(ptyId: string): RuntimeTerminalDriverState { return driverByPtyId.get(ptyId) ?? { kind: 'idle' } } -export function getAllDrivers(): Map { +export function getAllDrivers(): Map { return new Map(driverByPtyId) } @@ -57,7 +55,9 @@ export function isPtyLocked(ptyId: string): boolean { return driverByPtyId.get(ptyId)?.kind === 'mobile' } -export function hydrateDrivers(drivers: { ptyId: string; driver: DriverState }[]): void { +export function hydrateDrivers( + drivers: { ptyId: string; driver: RuntimeTerminalDriverState }[] +): void { const affectedPtyIds = new Set(driverByPtyId.keys()) driverByPtyId.clear() diff --git a/src/renderer/src/runtime/hosted-terminals/recovery/surfaces/web-session-terminal-orphan-recovery-surface.ts b/src/renderer/src/runtime/hosted-terminals/recovery/surfaces/web-session-terminal-orphan-recovery-surface.ts index 1c83eb9500d..16b85e93193 100644 --- a/src/renderer/src/runtime/hosted-terminals/recovery/surfaces/web-session-terminal-orphan-recovery-surface.ts +++ b/src/renderer/src/runtime/hosted-terminals/recovery/surfaces/web-session-terminal-orphan-recovery-surface.ts @@ -28,7 +28,6 @@ export type TerminalOrphanRecoveryState = WebTerminalOrphanTopologyState & { tabsByWorktree: Record } -export type TerminalSurface = RuntimeMobileSessionTerminalClientTab export type RecoveryDisposition = 'claim' | 'retain' | 'remove' type RecoverySurfaceCoordinates = { @@ -36,7 +35,7 @@ type RecoverySurfaceCoordinates = { leafId: string surfaceKey: string localTab: TerminalTab - incoming?: TerminalSurface + incoming?: RuntimeMobileSessionTerminalClientTab pending: boolean expectedPtyId: string | null locallyActive: boolean @@ -166,7 +165,9 @@ export function prepareTerminalOrphanRecovery( return { candidates, unresolved, observed, retained } } -export function buildRetainedTerminalSurface(surface: AnyRecoverySurface): TerminalSurface { +export function buildRetainedTerminalSurface( + surface: AnyRecoverySurface +): RuntimeMobileSessionTerminalClientTab { const incoming = surface.incoming const localTitle = typeof surface.localTab.title === 'string' ? surface.localTab.title.trim() : '' // Why: a ready row counts as a live terminal, so a slept pane (#30108) would wake in the mirror. @@ -190,7 +191,7 @@ export function buildRetainedTerminalSurface(surface: AnyRecoverySurface): Termi terminal: null } } - const base: TerminalSurface = incoming ?? { + const base: RuntimeMobileSessionTerminalClientTab = incoming ?? { type: 'terminal', id: `${surface.tabId}::${surface.leafId}`, parentTabId: surface.tabId, diff --git a/src/renderer/src/runtime/sync-runtime-graph/graph-state.ts b/src/renderer/src/runtime/sync-runtime-graph/graph-state.ts index 5b7e3c140a9..6073535a0b9 100644 --- a/src/renderer/src/runtime/sync-runtime-graph/graph-state.ts +++ b/src/renderer/src/runtime/sync-runtime-graph/graph-state.ts @@ -1,10 +1,8 @@ import type { MobileProjectSectionCatalog } from '../../../../shared/mobile-project-sections-contract' import { createNonSecureContextUuid as createBrowserUuid } from '../../../../shared/non-secure-context-uuid' import type { AppState } from '@/store/types' -import type { - RuntimeMobileSessionSnapshotTab, - RuntimeMobileSessionTabsSnapshot -} from '../../../../shared/runtime-types' +import type { RuntimeMobileSessionTabsSnapshot } from '../../../../shared/runtime-types' +import type { RuntimeMobileSessionSnapshotTab } from '../../../../shared/runtime-mobile-session-tab-contracts' import type { BrowserPagesProjectionCache, BrowserWorkspacesProjectionCache, diff --git a/src/renderer/src/runtime/sync-runtime-graph/mirrored-editor-tab-republication.test.ts b/src/renderer/src/runtime/sync-runtime-graph/mirrored-editor-tab-republication.test.ts index a3546b911fa..a5e42d62639 100644 --- a/src/renderer/src/runtime/sync-runtime-graph/mirrored-editor-tab-republication.test.ts +++ b/src/renderer/src/runtime/sync-runtime-graph/mirrored-editor-tab-republication.test.ts @@ -11,7 +11,7 @@ import { } from '../web-session-tabs-sync/testing/web-session-tabs-sync.test-fixture' import { buildMobileSessionTabSnapshots } from './mobile-session-snapshots' import { getRuntimeMobileSessionSyncKey, runtimeMobileSessionSyncKeysEqual } from './sync-key' -import type { RuntimeMobileSessionFileTab } from '../../../../shared/runtime-types' +import type { RuntimeMobileSessionFileTab } from '../../../../shared/runtime-mobile-session-tab-contracts' vi.mock('../../store', () => ({ useAppStore: { setState: vi.fn() } })) diff --git a/src/renderer/src/runtime/sync-runtime-graph/mobile-session-browser-tabs.ts b/src/renderer/src/runtime/sync-runtime-graph/mobile-session-browser-tabs.ts index 4ffff1aba3c..4c304c5d4c0 100644 --- a/src/renderer/src/runtime/sync-runtime-graph/mobile-session-browser-tabs.ts +++ b/src/renderer/src/runtime/sync-runtime-graph/mobile-session-browser-tabs.ts @@ -1,5 +1,5 @@ import type { AppState } from '@/store/types' -import type { RuntimeMobileSessionBrowserTab } from '../../../../shared/runtime-types' +import type { RuntimeMobileSessionBrowserTab } from '../../../../shared/runtime-mobile-session-tab-contracts' import type { Tab } from '../../../../shared/tab-types' import { editorRowHost } from '../../../../shared/workspace-session/session-tab-file-host' import { remoteTabFaviconUrl } from '../../../../shared/browser/browser-favicon-url' diff --git a/src/renderer/src/runtime/sync-runtime-graph/mobile-session-editor-tabs.ts b/src/renderer/src/runtime/sync-runtime-graph/mobile-session-editor-tabs.ts index 61986357fb7..1a42dc625d4 100644 --- a/src/renderer/src/runtime/sync-runtime-graph/mobile-session-editor-tabs.ts +++ b/src/renderer/src/runtime/sync-runtime-graph/mobile-session-editor-tabs.ts @@ -2,7 +2,7 @@ import type { AppState } from '@/store/types' import type { RuntimeMobileSessionFileTab, RuntimeMobileSessionMarkdownTab -} from '../../../../shared/runtime-types' +} from '../../../../shared/runtime-mobile-session-tab-contracts' import type { Tab } from '../../../../shared/tab-types' import { editorRowHost } from '../../../../shared/workspace-session/session-tab-file-host' import type { MobileSessionWorktreeInputs } from './types' diff --git a/src/renderer/src/runtime/sync-runtime-graph/mobile-session-snapshots.ts b/src/renderer/src/runtime/sync-runtime-graph/mobile-session-snapshots.ts index 6874e475038..44243754905 100644 --- a/src/renderer/src/runtime/sync-runtime-graph/mobile-session-snapshots.ts +++ b/src/renderer/src/runtime/sync-runtime-graph/mobile-session-snapshots.ts @@ -1,9 +1,7 @@ import { getSystemPrefersDark } from '@/lib/terminal-theme' import type { AppState } from '@/store/types' -import type { - RuntimeMobileSessionSnapshotTab, - RuntimeMobileSessionTabsSnapshot -} from '../../../../shared/runtime-types' +import type { RuntimeMobileSessionTabsSnapshot } from '../../../../shared/runtime-types' +import type { RuntimeMobileSessionSnapshotTab } from '../../../../shared/runtime-mobile-session-tab-contracts' import { parseWorkspaceKey } from '../../../../shared/workspace-scope' import { collectAmbiguousTerminalTabIds, diff --git a/src/renderer/src/runtime/sync-runtime-graph/mobile-terminal-theme.ts b/src/renderer/src/runtime/sync-runtime-graph/mobile-terminal-theme.ts index 9d858076d3f..5f435055320 100644 --- a/src/renderer/src/runtime/sync-runtime-graph/mobile-terminal-theme.ts +++ b/src/renderer/src/runtime/sync-runtime-graph/mobile-terminal-theme.ts @@ -1,6 +1,6 @@ import { getSystemPrefersDark, resolveEffectiveTerminalAppearance } from '@/lib/terminal-theme' import type { AppState } from '@/store/types' -import type { RuntimeMobileTerminalTheme } from '../../../../shared/runtime-types' +import type { RuntimeMobileTerminalTheme } from '../../../../shared/runtime-mobile-session-tab-contracts' import '../../../../shared/terminal-themes/terminal-contrast-correction' import { normalizeTerminalMinimumContrastRatio } from '../../../../shared/terminal-themes/terminal-minimum-contrast-settings' diff --git a/src/renderer/src/runtime/sync-runtime-graph/types.ts b/src/renderer/src/runtime/sync-runtime-graph/types.ts index aa65027a4d7..322e273fc14 100644 --- a/src/renderer/src/runtime/sync-runtime-graph/types.ts +++ b/src/renderer/src/runtime/sync-runtime-graph/types.ts @@ -1,5 +1,5 @@ import type { AppState } from '@/store/types' -import type { RuntimeMobileTerminalTheme } from '../../../../shared/runtime-types' +import type { RuntimeMobileTerminalTheme } from '../../../../shared/runtime-mobile-session-tab-contracts' import type { TabGroupLayoutNode } from '../../../../shared/tab-types' import type { TerminalPaneLayoutNode } from '../../../../shared/workspace-layout/terminal-tab-types' diff --git a/src/renderer/src/runtime/web-session-tabs-sync/agent-status-patch.ts b/src/renderer/src/runtime/web-session-tabs-sync/agent-status-patch.ts index 76684f6d8e6..1ed7ad99008 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync/agent-status-patch.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/agent-status-patch.ts @@ -11,10 +11,10 @@ import { import type { TerminalTab } from '../../../../shared/workspace-layout/terminal-tab-types' import type { MirroredTerminalTab, - TerminalSurface, WebSessionTabsBatchContext, WebSessionTabsSyncState } from './state' +import type { RuntimeMobileSessionTerminalClientTab } from '../../../../shared/runtime-mobile-session-tab-contracts' import { isClientOwnedAgentStatus, isMirroredAgentStatusOwnedBy, @@ -35,7 +35,7 @@ import { export function buildMirroredAgentStatusPatch( state: WebSessionTabsSyncState, currentTerminalTabs: readonly TerminalTab[], - terminalSurfaceTabs: readonly TerminalSurface[], + terminalSurfaceTabs: readonly RuntimeMobileSessionTerminalClientTab[], mirroredTerminalTabs: readonly MirroredTerminalTab[], environmentId: string, worktreeId: string, @@ -58,7 +58,7 @@ export function buildMirroredAgentStatusPatch( } let retainedSurfaceByHostTabAndPrunedLeafId: - | Map> + | Map> | undefined for (const entry of mirroredTerminalTabs) { if (entry.retainedSurfaceByPrunedLeafId) { diff --git a/src/renderer/src/runtime/web-session-tabs-sync/agent-status-primitives.ts b/src/renderer/src/runtime/web-session-tabs-sync/agent-status-primitives.ts index ef232ee116d..b5972ddf426 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync/agent-status-primitives.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/agent-status-primitives.ts @@ -8,7 +8,8 @@ import { isClientAuthoritativeAgentStatusPane } from '@/components/terminal-pane import { normalizeCompatibleAgentStatusEntryForOwner } from '../../../../shared/agent-status/title/agent-title-owner' import { resolvePaneAgentOwnerRecord } from '../../../../shared/agent-status/identity/pane-agent-owner' import { toWebTerminalSurfaceTabId } from '../../../../shared/workspace-layout/terminal-surface-id' -import type { TerminalSurface, WebSessionTabsBatchContext, WebSessionTabsSyncState } from './state' +import type { WebSessionTabsBatchContext, WebSessionTabsSyncState } from './state' +import type { RuntimeMobileSessionTerminalClientTab } from '../../../../shared/runtime-mobile-session-tab-contracts' import { type RetiredTerminalTabSweepState, @@ -29,7 +30,7 @@ export function isMirroredAgentStatusOwnedBy( } export function toMirroredPaneKey( - surface: TerminalSurface, + surface: RuntimeMobileSessionTerminalClientTab, leafId = surface.leafId ): string | null { if (!isTerminalLeafId(leafId)) { @@ -42,9 +43,9 @@ export function toMirroredPaneKey( * frame publishes: older hosts omit it on agents restored after a restart, and clients judge a * row's ownership (and retraction) by worktree, so every reader must see the same owner. */ export function remapHostAgentStatus( - surface: TerminalSurface, + surface: RuntimeMobileSessionTerminalClientTab, frameWorktreeId: string, - retainedSurface?: TerminalSurface + retainedSurface?: RuntimeMobileSessionTerminalClientTab ): AgentStatusEntry | null { if (!surface.agentStatus) { return null diff --git a/src/renderer/src/runtime/web-session-tabs-sync/layout-groups.ts b/src/renderer/src/runtime/web-session-tabs-sync/layout-groups.ts index 9a04ec51785..14ff4a42fbd 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync/layout-groups.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/layout-groups.ts @@ -1,12 +1,8 @@ import type { RuntimeMobileSessionTabGroup } from '../../../../shared/runtime-types' import type { TabGroup } from '../../../../shared/tab-types' import type { TerminalTab } from '../../../../shared/workspace-layout/terminal-tab-types' -import type { - MirroredAgentTab, - MirroredBrowserTab, - MirroredEditorTab, - TerminalSurface -} from './state' +import type { MirroredAgentTab, MirroredBrowserTab, MirroredEditorTab } from './state' +import type { RuntimeMobileSessionTerminalClientTab } from '../../../../shared/runtime-mobile-session-tab-contracts' import { toWebTerminalSurfaceTabId } from '../../../../shared/workspace-layout/terminal-surface-id' import { clearHostSessionTabIdMappings, setHostSessionTabIdMapping } from './tracking-mappings' import { isWebSessionBrowserPlacementGroupReserved } from '../browser/placement/web-session-browser-placement' @@ -21,7 +17,7 @@ export function buildHostToLocalTabIdMap({ editorTabs, agentTabs }: { - terminalSurfaces: readonly TerminalSurface[] + terminalSurfaces: readonly RuntimeMobileSessionTerminalClientTab[] terminalTabs: readonly TerminalTab[] browserTabs: readonly MirroredBrowserTab[] editorTabs: readonly MirroredEditorTab[] @@ -52,7 +48,7 @@ export function buildHostToLocalTabIdMap({ export function updateHostSessionTabIdMappings(args: { environmentId: string worktreeId: string - terminalSurfaces: readonly TerminalSurface[] + terminalSurfaces: readonly RuntimeMobileSessionTerminalClientTab[] terminalTabs: readonly TerminalTab[] browserTabs: readonly MirroredBrowserTab[] editorTabs: readonly MirroredEditorTab[] diff --git a/src/renderer/src/runtime/web-session-tabs-sync/mirrored-browser-tabs.ts b/src/renderer/src/runtime/web-session-tabs-sync/mirrored-browser-tabs.ts index 4ccd080eaf8..f47fc580b4f 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync/mirrored-browser-tabs.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/mirrored-browser-tabs.ts @@ -1,7 +1,5 @@ -import type { - RuntimeMobileSessionBrowserTab, - RuntimeMobileSessionTabsResult -} from '../../../../shared/runtime-types' +import type { RuntimeMobileSessionTabsResult } from '../../../../shared/runtime-types' +import type { RuntimeMobileSessionBrowserTab } from '../../../../shared/runtime-mobile-session-tab-contracts' import type { BrowserPage, BrowserWorkspace } from '../../../../shared/browser-workspace-types' import type { Tab } from '../../../../shared/tab-types' import type { WebSessionTabsSyncState, MirroredBrowserTab } from './state' diff --git a/src/renderer/src/runtime/web-session-tabs-sync/runtime-pane-title-patch.ts b/src/renderer/src/runtime/web-session-tabs-sync/runtime-pane-title-patch.ts index a56d3534abd..fb220a28817 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync/runtime-pane-title-patch.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/runtime-pane-title-patch.ts @@ -13,16 +13,16 @@ import { clientAgentStatusFencesHost } from './agent-status-primitives' import { writableWebSessionTabsRecord } from './state-equality-core' import type { MirroredTerminalTab, - TerminalSurface, WebSessionTabsBatchContext, WebSessionTabsSyncState } from './state' +import type { RuntimeMobileSessionTerminalClientTab } from '../../../../shared/runtime-mobile-session-tab-contracts' /** Reconcile saved pane titles with the accepted host inventory, including inactive tabs. */ export function buildMirroredRuntimePaneTitlePatch( state: WebSessionTabsSyncState, tabs: readonly MirroredTerminalTab[], - surfaces: readonly TerminalSurface[], + surfaces: readonly RuntimeMobileSessionTerminalClientTab[], now: number, batchContext?: WebSessionTabsBatchContext ): Partial | null { @@ -37,9 +37,11 @@ export function buildMirroredRuntimePaneTitlePatch( if (titledTabs.length === 0) { return null } - const surfacesByTab = new Map>() + const surfacesByTab = new Map>() for (const surface of surfaces) { - const byLeaf = surfacesByTab.get(surface.parentTabId) ?? new Map() + const byLeaf = + surfacesByTab.get(surface.parentTabId) ?? + new Map() byLeaf.set(surface.leafId, surface) surfacesByTab.set(surface.parentTabId, byLeaf) } diff --git a/src/renderer/src/runtime/web-session-tabs-sync/state.ts b/src/renderer/src/runtime/web-session-tabs-sync/state.ts index 04d547c25be..4f4b23bcb34 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync/state.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/state.ts @@ -1,15 +1,16 @@ import type { AppState } from '../../store/types' import type { RetiredTerminalTabSweepState } from '../../store/terminals/retired-terminal-tab-state-sweep' import type { - RuntimeMobileSessionAgentTab, + RuntimeMobileSessionTabGroup, + RuntimeMobileSessionTabsRemovedResult, + RuntimeMobileSessionTabsResult +} from '../../../../shared/runtime-types' +import type { RuntimeMobileSessionBrowserTab, RuntimeMobileSessionFileTab, RuntimeMobileSessionMarkdownTab, - RuntimeMobileSessionTabGroup, - RuntimeMobileSessionTabsRemovedResult, - RuntimeMobileSessionTabsResult, RuntimeMobileSessionTerminalClientTab -} from '../../../../shared/runtime-types' +} from '../../../../shared/runtime-mobile-session-tab-contracts' import type { BrowserCertificateFailure, BrowserPage, @@ -173,7 +174,6 @@ export function resetReceivedSessionTabsFrameSequence(): void { receivedSessionTabsFrameSequence = 0 } -export type TerminalSurface = RuntimeMobileSessionTerminalClientTab export type ReadyTerminalSurface = RuntimeMobileSessionTerminalClientTab & { status: 'ready' } export type ReadyBrowserSurface = RuntimeMobileSessionBrowserTab & { browserPageId: string } export type ReadyEditorSurface = RuntimeMobileSessionMarkdownTab | RuntimeMobileSessionFileTab @@ -184,7 +184,7 @@ export type MirroredTerminalTab = { hostTabId: string ptyIds: string[] layout: TerminalLayoutSnapshot - retainedSurfaceByPrunedLeafId?: ReadonlyMap + retainedSurfaceByPrunedLeafId?: ReadonlyMap } export type MirroredBrowserTab = { workspace: BrowserWorkspace @@ -282,6 +282,5 @@ export type WebSessionTabsBatchContext = { openFilesIndex: WebSessionOpenFilesIndex | null } -export type AgentTab = RuntimeMobileSessionAgentTab export type TabGroupSnapshot = RuntimeMobileSessionTabGroup export type RemovedTabsResult = RuntimeMobileSessionTabsRemovedResult diff --git a/src/renderer/src/runtime/web-session-tabs-sync/tab-builders.ts b/src/renderer/src/runtime/web-session-tabs-sync/tab-builders.ts index 828bdf21b23..5857a414b3a 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync/tab-builders.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/tab-builders.ts @@ -1,7 +1,5 @@ -import type { - RuntimeMobileSessionBrowserTab, - RuntimeMobileSessionTabsResult -} from '../../../../shared/runtime-types' +import type { RuntimeMobileSessionTabsResult } from '../../../../shared/runtime-types' +import type { RuntimeMobileSessionBrowserTab } from '../../../../shared/runtime-mobile-session-tab-contracts' import type { BrowserWorkspace } from '../../../../shared/browser-workspace-types' import type { Tab } from '../../../../shared/tab-types' import type { TerminalTab } from '../../../../shared/workspace-layout/terminal-tab-types' diff --git a/src/renderer/src/runtime/web-session-tabs-sync/terminal-build.ts b/src/renderer/src/runtime/web-session-tabs-sync/terminal-build.ts index b65330dfe7c..017f63e50ba 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync/terminal-build.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/terminal-build.ts @@ -9,7 +9,8 @@ import { normalizeCompatibleAgentTitleForOwner } from '../../../../shared/agent- import { getRemoteRuntimePtyEnvironmentId } from '../hosted-terminals/identity/remote-runtime-pty-owner' import { toRemoteRuntimePtyId } from '../../../../shared/remote-runtime/remote-runtime-pty-id' import { toWebTerminalSurfaceTabId } from '../../../../shared/workspace-layout/terminal-surface-id' -import type { MirroredTerminalTab, TerminalSurface, ReadyTerminalSurface } from './state' +import type { MirroredTerminalTab, ReadyTerminalSurface } from './state' +import type { RuntimeMobileSessionTerminalClientTab } from '../../../../shared/runtime-mobile-session-tab-contracts' import { chooseRemoteTerminalLayout, isTerminalSurfaceTab } from './terminal-surfaces' function pendingBindingBelongsToEnvironment( @@ -25,7 +26,7 @@ function pendingBindingBelongsToEnvironment( /** Keep a known pane binding while the host briefly publishes its surface as pending. */ function retainPendingTerminalBindings( - surfaces: readonly TerminalSurface[], + surfaces: readonly RuntimeMobileSessionTerminalClientTab[], existingLayout: TerminalLayoutSnapshot | undefined, ptyIdsByLeafId: Record, environmentId: string, @@ -67,7 +68,7 @@ export function buildMirroredTerminalTabs( focusTarget?: { parentTabId: string; leafId: string }, terminalPtyMode: 'local' | 'remote' = 'remote' ): MirroredTerminalTab[] { - const groups = new Map() + const groups = new Map() for (const tab of snapshot.tabs.filter(isTerminalSurfaceTab)) { const group = groups.get(tab.parentTabId) ?? [] group.push(tab) @@ -114,7 +115,9 @@ export function buildMirroredTerminalTabs( const ptyIds = layoutPtyEntries .map(([, ptyId]) => ptyId) .filter((ptyId) => livePtyIds.has(ptyId)) - let retainedSurfaceByPrunedLeafId: Map | undefined + let retainedSurfaceByPrunedLeafId: + | Map + | undefined if (layoutPtyEntries.length < Object.keys(ptyIdsByLeafId).length) { const retainedLeafIdByPtyId = new Map( layoutPtyEntries.map(([leafId, ptyId]) => [ptyId, leafId]) diff --git a/src/renderer/src/runtime/web-session-tabs-sync/terminal-surfaces.ts b/src/renderer/src/runtime/web-session-tabs-sync/terminal-surfaces.ts index 2191a30e4dc..10f173d1a9d 100644 --- a/src/renderer/src/runtime/web-session-tabs-sync/terminal-surfaces.ts +++ b/src/renderer/src/runtime/web-session-tabs-sync/terminal-surfaces.ts @@ -1,8 +1,9 @@ import { readStructuredAgentLaunchRecord } from '@/lib/agent-session/launch/structured-agent-session-launch-persistence' +import type { RuntimeMobileSessionTabsResult } from '../../../../shared/runtime-types' import type { - RuntimeMobileSessionTabsResult, - RuntimeMobileSessionAgentTab -} from '../../../../shared/runtime-types' + RuntimeMobileSessionAgentTab, + RuntimeMobileSessionTerminalClientTab +} from '../../../../shared/runtime-mobile-session-tab-contracts' import type { TerminalLayoutSnapshot, TerminalTab @@ -21,7 +22,6 @@ import type { ReadyBrowserSurface, ReadyEditorSurface, ReadyTerminalSurface, - TerminalSurface, MirroredAgentTab } from './state' import type { Tab } from '../../../../shared/tab-types' @@ -42,7 +42,7 @@ export function isReadyTerminalTab( export function isTerminalSurfaceTab( tab: RuntimeMobileSessionTabsResult['tabs'][number] -): tab is TerminalSurface { +): tab is RuntimeMobileSessionTerminalClientTab { return tab.type === 'terminal' } @@ -176,7 +176,7 @@ export function isMirroredTerminalSurfaceId(tabId: string): boolean { } export function chooseRemoteTerminalLayout( - surfaces: readonly TerminalSurface[], + surfaces: readonly RuntimeMobileSessionTerminalClientTab[], ptyIdsByLeafId: Record, existingLayout?: TerminalLayoutSnapshot, requestedActiveLeafId?: string diff --git a/src/shared/runtime-session-contracts.ts b/src/shared/runtime-session-contracts.ts index 46eb0eab084..934e6ea7a53 100644 --- a/src/shared/runtime-session-contracts.ts +++ b/src/shared/runtime-session-contracts.ts @@ -20,8 +20,6 @@ import type { CliStatusCaller } from './orchestration/orchestration-caller-statu import type { RuntimeHostDescriptor } from './remote-runtime/host-status/runtime-host-descriptor' import type { TuiAgent } from './agent-launch/catalog/tui-agent' -export type * from './runtime-mobile-session-tab-contracts' - export type RuntimeGraphStatus = 'ready' | 'reloading' | 'unavailable' export type RuntimeDesktopWindowStatus = 'available' | 'openable' | 'initializing' | 'blocked' @@ -35,8 +33,6 @@ export type RuntimeTerminalDriverState = | { kind: 'desktop' } | { kind: 'mobile'; clientId: string } -export type RuntimeBrowserDriverState = RuntimeTerminalDriverState - export const BROWSER_UNAVAILABLE_ERROR_CODE = 'browser_unavailable' as const // Render actionable per-cause messages host-side so older clients can display reasons they cannot decode. diff --git a/src/shared/runtime-types.ts b/src/shared/runtime-types.ts index ea46424b987..5464a4118e7 100644 --- a/src/shared/runtime-types.ts +++ b/src/shared/runtime-types.ts @@ -39,18 +39,10 @@ export type { CliRuntimeState, CliStatusResult, DeviceScope, - RuntimeBrowserDriverState, RuntimeDesktopWindowStatus, RuntimeGraphStatus, - RuntimeMobileSessionAgentTab, - RuntimeMobileSessionAgentTabStatus, - RuntimeMobileSessionBrowserTab, - RuntimeMobileSessionClientTab, RuntimeMobileSessionCreateTerminalResult, - RuntimeMobileSessionFileTab, - RuntimeMobileSessionMarkdownTab, RuntimeMobileSessionRetiredTerminalSurface, - RuntimeMobileSessionSnapshotTab, RuntimeMobileSessionTabCloseResult, RuntimeMobileSessionTabGroup, RuntimeMobileSessionTabMove, @@ -58,9 +50,6 @@ export type { RuntimeMobileSessionTabsRemovedResult, RuntimeMobileSessionTabsResult, RuntimeMobileSessionTabsSnapshot, - RuntimeMobileSessionTerminalClientTab, - RuntimeMobileSessionTerminalTab, - RuntimeMobileTerminalTheme, RuntimeMountedLeaf, RuntimeNativeChatLaunchDraftResolution, RuntimeRendererSyncWindowGraph, @@ -69,8 +58,7 @@ export type { RuntimeSyncedLeaf, RuntimeSyncedTab, RuntimeSyncWindowGraph, - RuntimeSyncWindowGraphResult, - RuntimeTerminalDriverState + RuntimeSyncWindowGraphResult } from './runtime-session-contracts' export type { RuntimeTerminalAgentStatus, diff --git a/tests/e2e/paired-remote-pane-layout-retry.spec.ts b/tests/e2e/paired-remote-pane-layout-retry.spec.ts index 559cbdab7ba..4e1461c7d4e 100644 --- a/tests/e2e/paired-remote-pane-layout-retry.spec.ts +++ b/tests/e2e/paired-remote-pane-layout-retry.spec.ts @@ -1,8 +1,6 @@ import type { Page } from '@stablyai/playwright-test' -import type { - RuntimeMobileSessionTabsResult, - RuntimeMobileSessionTerminalClientTab -} from '../../src/shared/runtime-types' +import type { RuntimeMobileSessionTabsResult } from '../../src/shared/runtime-types' +import type { RuntimeMobileSessionTerminalClientTab } from '../../src/shared/runtime-mobile-session-tab-contracts' import { toWebTerminalSurfaceTabId } from '../../src/shared/workspace-layout/terminal-surface-id' import type { TerminalLayoutSnapshot } from '../../src/shared/workspace-layout/terminal-tab-types' import {