mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
New runtime exports for handling terminal unavailability: RuntimeTerminalUnavailableReason type and related error codes and messaging constants.
243 lines
8.9 KiB
TypeScript
243 lines
8.9 KiB
TypeScript
import { describe, expect, expectTypeOf, it } from 'vitest'
|
|
import type { PairingOffer } from './pairing'
|
|
import type { RuntimeCapability } from './protocol-version'
|
|
import * as RemoteClient from './remote-runtime-client'
|
|
import type { RuntimeOrchestrationEnvelope, RuntimeRpcResponse } from './runtime-rpc-envelope'
|
|
import * as Runtime from './runtime-types'
|
|
|
|
type RuntimeTypeInventory = [
|
|
Runtime.BrowserBackResult,
|
|
Runtime.BrowserCaptureStartResult,
|
|
Runtime.BrowserCaptureStopResult,
|
|
Runtime.BrowserCheckResult,
|
|
Runtime.BrowserClearResult,
|
|
Runtime.BrowserClickResult,
|
|
Runtime.BrowserConsoleEntry,
|
|
Runtime.BrowserConsoleResult,
|
|
Runtime.BrowserCookie,
|
|
Runtime.BrowserCookieDeleteResult,
|
|
Runtime.BrowserCookieGetResult,
|
|
Runtime.BrowserCookieSetResult,
|
|
Runtime.BrowserDetectedInfo,
|
|
Runtime.BrowserDetectedProfileInfo,
|
|
Runtime.BrowserDetectProfilesResult,
|
|
Runtime.BrowserDragResult,
|
|
Runtime.BrowserErrorCode,
|
|
Runtime.BrowserEvalResult,
|
|
Runtime.BrowserFillResult,
|
|
Runtime.BrowserFocusResult,
|
|
Runtime.BrowserGeolocationResult,
|
|
Runtime.BrowserGotoResult,
|
|
Runtime.BrowserHoverResult,
|
|
Runtime.BrowserInterceptDisableResult,
|
|
Runtime.BrowserInterceptedRequest,
|
|
Runtime.BrowserInterceptEnableResult,
|
|
Runtime.BrowserKeypressResult,
|
|
Runtime.BrowserNetworkEntry,
|
|
Runtime.BrowserNetworkLogResult,
|
|
Runtime.BrowserPdfResult,
|
|
Runtime.BrowserProfileClearDefaultCookiesResult,
|
|
Runtime.BrowserProfileCreateResult,
|
|
Runtime.BrowserProfileDeleteResult,
|
|
Runtime.BrowserProfileImportFromBrowserResult,
|
|
Runtime.BrowserProfileListResult,
|
|
Runtime.BrowserReloadResult,
|
|
Runtime.BrowserScreencastDialogClosedResult,
|
|
Runtime.BrowserScreencastDialogResult,
|
|
Runtime.BrowserScreencastEndResult,
|
|
Runtime.BrowserScreencastErrorResult,
|
|
Runtime.BrowserScreencastReadyResult,
|
|
Runtime.BrowserScreencastResult,
|
|
Runtime.BrowserScreenshotResult,
|
|
Runtime.BrowserScrollResult,
|
|
Runtime.BrowserSelectAllResult,
|
|
Runtime.BrowserSelectResult,
|
|
Runtime.BrowserSnapshotRef,
|
|
Runtime.BrowserSnapshotResult,
|
|
Runtime.BrowserTabCreateResult,
|
|
Runtime.BrowserTabCurrentResult,
|
|
Runtime.BrowserTabInfo,
|
|
Runtime.BrowserTabListResult,
|
|
Runtime.BrowserTabProfileCloneResult,
|
|
Runtime.BrowserTabProfileShowResult,
|
|
Runtime.BrowserTabSetProfileResult,
|
|
Runtime.BrowserTabShowResult,
|
|
Runtime.BrowserTabSwitchResult,
|
|
Runtime.BrowserTypeResult,
|
|
Runtime.BrowserUploadResult,
|
|
Runtime.BrowserViewportResult,
|
|
Runtime.BrowserWaitResult,
|
|
Runtime.CliRuntimeState,
|
|
Runtime.CliStatusResult,
|
|
Runtime.ComputerActionMetadata,
|
|
Runtime.ComputerActionResult,
|
|
Runtime.ComputerActionVerification,
|
|
Runtime.ComputerAppInfo,
|
|
Runtime.ComputerAppQuery,
|
|
Runtime.ComputerErrorCode,
|
|
Runtime.ComputerListAppsResult,
|
|
Runtime.ComputerListWindowsResult,
|
|
Runtime.ComputerProviderCapabilities,
|
|
Runtime.ComputerScreenshotData,
|
|
Runtime.ComputerScreenshotMetadata,
|
|
Runtime.ComputerScreenshotStatus,
|
|
Runtime.ComputerSnapshotData,
|
|
Runtime.ComputerSnapshotResult,
|
|
Runtime.ComputerWindowInfo,
|
|
Runtime.ComputerWindowListWindow,
|
|
Runtime.DeviceScope,
|
|
Runtime.RuntimeBrowserDriverState,
|
|
Runtime.RuntimeBrowserUnavailableReason,
|
|
Runtime.RuntimeDegradation,
|
|
Runtime.RuntimeDesktopWindowStatus,
|
|
Runtime.RuntimeFileListEntry,
|
|
Runtime.RuntimeFileListResult,
|
|
Runtime.RuntimeFileOpenResult,
|
|
Runtime.RuntimeFilePreviewResult,
|
|
Runtime.RuntimeFileReadChunkResult,
|
|
Runtime.RuntimeFileReadResult,
|
|
Runtime.RuntimeGitCheckoutResult,
|
|
Runtime.RuntimeGitLocalBranches,
|
|
Runtime.RuntimeGraphStatus,
|
|
Runtime.RuntimeMarkdownReadTabResult,
|
|
Runtime.RuntimeMarkdownSaveTabResult,
|
|
Runtime.RuntimeMobileSessionBrowserTab,
|
|
Runtime.RuntimeMobileSessionClientTab,
|
|
Runtime.RuntimeMobileSessionCreateTerminalResult,
|
|
Runtime.RuntimeMobileSessionFileTab,
|
|
Runtime.RuntimeMobileSessionMarkdownTab,
|
|
Runtime.RuntimeMobileSessionSnapshotTab,
|
|
Runtime.RuntimeMobileSessionTabCloseResult,
|
|
Runtime.RuntimeMobileSessionTabGroup,
|
|
Runtime.RuntimeMobileSessionTabMove,
|
|
Runtime.RuntimeMobileSessionTabMoveResult,
|
|
Runtime.RuntimeMobileSessionTabsRemovedResult,
|
|
Runtime.RuntimeMobileSessionTabsResult,
|
|
Runtime.RuntimeMobileSessionTabsSnapshot,
|
|
Runtime.RuntimeMobileSessionTerminalClientTab,
|
|
Runtime.RuntimeMobileSessionTerminalTab,
|
|
Runtime.RuntimeMobileTerminalTheme,
|
|
Runtime.RuntimeNativeChatFileContext,
|
|
Runtime.RuntimeNativeChatLaunchDraftResolution,
|
|
Runtime.RuntimeRendererSyncWindowGraph,
|
|
Runtime.RuntimeRepoList,
|
|
Runtime.RuntimeRepoSearchRefs,
|
|
Runtime.RuntimeSessionTabCloseReason,
|
|
Runtime.RuntimeSpeechModelSummary,
|
|
Runtime.RuntimeSpeechSetupState,
|
|
Runtime.RuntimeStatus,
|
|
Runtime.RuntimeSyncedLeaf,
|
|
Runtime.RuntimeSyncedTab,
|
|
Runtime.RuntimeSyncWindowGraph,
|
|
Runtime.RuntimeSyncWindowGraphResult,
|
|
Runtime.RuntimeTerminalAgentStatus,
|
|
Runtime.RuntimeTerminalAgentStatusState,
|
|
Runtime.RuntimeTerminalClose,
|
|
Runtime.RuntimeTerminalCreate,
|
|
Runtime.RuntimeTerminalCreateRequestPayload,
|
|
Runtime.RuntimeTerminalDriverState,
|
|
Runtime.RuntimeTerminalFocus,
|
|
Runtime.RuntimeTerminalInteractiveWait,
|
|
Runtime.RuntimeTerminalInteractiveWaitSource,
|
|
Runtime.RuntimeTerminalListHostScope,
|
|
Runtime.RuntimeTerminalListResult,
|
|
Runtime.RuntimeTerminalOrphanAdoptionClaim,
|
|
Runtime.RuntimeTerminalOrphanAdoptionRequest,
|
|
Runtime.RuntimeTerminalOrphanAdoptionResult,
|
|
Runtime.RuntimeTerminalOrphanTopology,
|
|
Runtime.RuntimeTerminalOrphanTopologyGroup,
|
|
Runtime.RuntimeTerminalOrphanTopologyTab,
|
|
Runtime.RuntimeTerminalPathOpenTarget,
|
|
Runtime.RuntimeTerminalPathResolution,
|
|
Runtime.RuntimeTerminalPresentation,
|
|
Runtime.RuntimeTerminalRead,
|
|
Runtime.RuntimeTerminalRename,
|
|
Runtime.RuntimeTerminalResolvePane,
|
|
Runtime.RuntimeTerminalSend,
|
|
Runtime.RuntimeTerminalShow,
|
|
Runtime.RuntimeTerminalSplit,
|
|
Runtime.RuntimeTerminalState,
|
|
Runtime.RuntimeTerminalSummary,
|
|
Runtime.RuntimeTerminalUnavailableReason,
|
|
Runtime.RuntimeTerminalVisualGroupNode,
|
|
Runtime.RuntimeTerminalVisualLayout,
|
|
Runtime.RuntimeTerminalVisualLayoutNode,
|
|
Runtime.RuntimeTerminalVisualPaneNode,
|
|
Runtime.RuntimeTerminalVisualTab,
|
|
Runtime.RuntimeTerminalVisualTerminalNode,
|
|
Runtime.RuntimeTerminalWait,
|
|
Runtime.RuntimeTerminalWaitBlockedReason,
|
|
Runtime.RuntimeTerminalWaitCondition,
|
|
Runtime.RuntimeWorktreeAgentRow,
|
|
Runtime.RuntimeWorktreeCreateResult,
|
|
Runtime.RuntimeWorktreeListResult,
|
|
Runtime.RuntimeWorktreePsConditionalResult,
|
|
Runtime.RuntimeWorktreePsResult,
|
|
Runtime.RuntimeWorktreePsSnapshotResult,
|
|
Runtime.RuntimeWorktreePsSummary,
|
|
Runtime.RuntimeWorktreePsUnchangedResult,
|
|
Runtime.RuntimeWorktreeRecord,
|
|
Runtime.RuntimeWorktreeRemoveResult,
|
|
Runtime.RuntimeWorktreeStatus,
|
|
Runtime.RuntimeWorktreeTerminalSleepResult
|
|
]
|
|
|
|
describe('runtime client public export parity', () => {
|
|
it('keeps the runtime type inventory compile-visible', () => {
|
|
expectTypeOf<RuntimeTypeInventory>().toEqualTypeOf<RuntimeTypeInventory>()
|
|
expectTypeOf<RemoteClient.RemoteRuntimeSubscription>().toEqualTypeOf<RemoteClient.RemoteRuntimeSubscription>()
|
|
expectTypeOf<RemoteClient.RemoteRuntimeSubscriptionCallbacks>().toEqualTypeOf<RemoteClient.RemoteRuntimeSubscriptionCallbacks>()
|
|
expectTypeOf(RemoteClient.sendRemoteRuntimeRequest).toEqualTypeOf<
|
|
<TResult>(
|
|
pairing: PairingOffer,
|
|
method: string,
|
|
params: unknown,
|
|
timeoutMs: number,
|
|
envelope?: RuntimeOrchestrationEnvelope,
|
|
signal?: AbortSignal,
|
|
clientCapabilities?: readonly RuntimeCapability[]
|
|
) => Promise<RuntimeRpcResponse<TResult>>
|
|
>()
|
|
expectTypeOf(RemoteClient.sendRemoteRuntimeRequestWithStatusPreflight).toEqualTypeOf<
|
|
<TResult>(
|
|
pairing: PairingOffer,
|
|
method: string,
|
|
params: unknown,
|
|
timeoutMs: number,
|
|
validateStatus: (response: RuntimeRpcResponse<Runtime.RuntimeStatus>) => void,
|
|
envelope?: RuntimeOrchestrationEnvelope,
|
|
clientCapabilities?: readonly RuntimeCapability[]
|
|
) => Promise<RuntimeRpcResponse<TResult>>
|
|
>()
|
|
expectTypeOf(RemoteClient.subscribeRemoteRuntimeRequest).toEqualTypeOf<
|
|
<TResult>(
|
|
pairing: PairingOffer,
|
|
method: string,
|
|
params: unknown,
|
|
timeoutMs: number,
|
|
callbacks: RemoteClient.RemoteRuntimeSubscriptionCallbacks<TResult>,
|
|
options?: RemoteClient.RemoteRuntimeSubscriptionOptions
|
|
) => Promise<RemoteClient.RemoteRuntimeSubscription>
|
|
>()
|
|
})
|
|
|
|
it('keeps the runtime and transport value exports exact', () => {
|
|
expect(Object.keys(Runtime).sort()).toEqual([
|
|
'BROWSER_UNAVAILABLE_ERROR_CODE',
|
|
'COMPUTER_ERROR_CODES',
|
|
'HEADLESS_RUNTIME_WINDOW_ID',
|
|
'TERMINAL_PTY_DEGRADATION_CAPABILITY',
|
|
'TERMINAL_UNAVAILABLE_ERROR_CODE',
|
|
'UNPUBLISHED_WORKTREE_PUBLICATION_EPOCH',
|
|
'browserUnavailableMessage',
|
|
'terminalUnavailableMessage'
|
|
])
|
|
expect(Object.keys(RemoteClient).sort()).toEqual([
|
|
'RemoteRuntimeClientError',
|
|
'sendRemoteRuntimeRequest',
|
|
'sendRemoteRuntimeRequestWithStatusPreflight',
|
|
'subscribeRemoteRuntimeRequest'
|
|
])
|
|
})
|
|
})
|