@opengeni/runtime 0.11.0 → 0.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,48 @@ import { SandboxSessionLike, ExecCommandArgs, SandboxClient, Manifest, SandboxSe
4
4
  import * as modal from 'modal';
5
5
  import { ControlRequest, ControlResponse, ErrorCode, AgentError, ExecResponse, DesktopInputRequest, ExecRequest } from '@opengeni/agent-proto';
6
6
 
7
+ declare const WORKSPACE_ARCHIVE_DESCRIPTOR_VERSION: 1;
8
+ type WorkspaceTreeFingerprint = {
9
+ algorithm: "sha256";
10
+ sha256: string;
11
+ entryCount: number;
12
+ fileCount: number;
13
+ totalFileBytes: number;
14
+ };
15
+ type WorkspaceArchiveDescriptor = {
16
+ version: typeof WORKSPACE_ARCHIVE_DESCRIPTOR_VERSION;
17
+ revision: string;
18
+ archiveSha256: string;
19
+ archiveBytes: number;
20
+ capturedAt: string;
21
+ workspace: WorkspaceTreeFingerprint;
22
+ };
23
+ type VerifiedWorkspaceArchive = {
24
+ bytes: Uint8Array;
25
+ base64: string;
26
+ descriptor: WorkspaceArchiveDescriptor;
27
+ };
28
+ type WorkspaceArchiveIntegrityCode = "archive_metadata_missing" | "archive_metadata_invalid" | "archive_base64_invalid" | "archive_hash_mismatch" | "archive_hydration_failed" | "workspace_fingerprint_unavailable" | "workspace_changed_during_capture" | "workspace_fingerprint_mismatch";
29
+ declare class WorkspaceArchiveIntegrityError extends Error {
30
+ readonly code: WorkspaceArchiveIntegrityCode;
31
+ readonly name = "WorkspaceArchiveIntegrityError";
32
+ readonly retryable: boolean;
33
+ constructor(code: WorkspaceArchiveIntegrityCode, message: string, options?: {
34
+ retryable?: boolean;
35
+ });
36
+ }
37
+ declare function parseWorkspaceArchiveDescriptor(value: unknown): WorkspaceArchiveDescriptor | null;
38
+ declare function readVerifiedWorkspaceArchive(base64: unknown, metadata: unknown): VerifiedWorkspaceArchive | null;
39
+ /** Hashes names, kinds, modes, symlink targets and all file bytes through one
40
+ * deterministic GNU tar stream. Only the aggregate is returned; paths and file
41
+ * contents never enter logs or durable metadata. */
42
+ declare function fingerprintSandboxWorkspace(session: unknown): Promise<WorkspaceTreeFingerprint>;
43
+ /** Capture is accepted only when the complete tree is byte-identical immediately
44
+ * before and after the provider snapshot. A concurrent mutation makes the
45
+ * candidate non-durable and it is never folded onto the lease. */
46
+ declare function captureVerifiedWorkspaceArchive(session: unknown, capturedAtMs?: number): Promise<VerifiedWorkspaceArchive>;
47
+ declare function verifyRestoredWorkspace(session: unknown, descriptor: WorkspaceArchiveDescriptor): Promise<WorkspaceTreeFingerprint>;
48
+
7
49
  type RuntimeMetricsHooks = {
8
50
  onModelCall?: (input: {
9
51
  provider: string;
@@ -101,6 +143,39 @@ declare const PROVIDER_REGISTRY: Record<SandboxBackend, ProviderRegistration>;
101
143
  */
102
144
  declare function assertProviderRegistryInvariants(): void;
103
145
 
146
+ /**
147
+ * Provider sandbox failure classification.
148
+ *
149
+ * This is deliberately structural and fail-closed. DNS failures often contain
150
+ * the word "not found" (`ENOTFOUND`) while gRPC status values are also used by
151
+ * unrelated SDKs and command routers. A bare numeric status (including gRPC's
152
+ * numeric 5) is therefore not enough to retire a provider instance. Only
153
+ * authoritative, non-transient evidence may retire a provider instance and
154
+ * license lease recovery.
155
+ */
156
+ type ProviderSandboxFailureKind = "not_found" | "transient_transport" | "other";
157
+ type ProviderSandboxFailure = {
158
+ kind: ProviderSandboxFailureKind;
159
+ /** Bounded, non-secret diagnostic suitable for logs and lifecycle events. */
160
+ diagnostic: string;
161
+ };
162
+ /** Typed transport evidence always dominates nested/string NotFound text. */
163
+ declare function classifyProviderSandboxFailure(backendId: string, error: unknown): ProviderSandboxFailure;
164
+ declare function isProviderSandboxNotFoundError(backendId: string, error: unknown): boolean;
165
+ /**
166
+ * Whether a failure from an operation routed through an already-established
167
+ * sandbox proves that exact provider sandbox disappeared.
168
+ *
169
+ * Routed operations can legitimately return HTTP 404 / `NOT_FOUND` for paths,
170
+ * files, ports, processes, and other subresources. Those generic signals are
171
+ * sufficient for provider create/resume APIs, but they must never retire the
172
+ * live sandbox identity after an arbitrary operation. Only an explicit
173
+ * sandbox-scoped provider code or Modal's exact terminal sandbox grammar is
174
+ * authoritative on this path. Transient transport evidence still dominates.
175
+ */
176
+ declare function isProviderSandboxGoneDuringRoutedOperation(backendId: string, error: unknown): boolean;
177
+ declare function isProviderSandboxTransientError(backendId: string, error: unknown): boolean;
178
+
104
179
  type ModalSandboxAttribution = {
105
180
  leaseId: string;
106
181
  workspaceId: string;
@@ -120,6 +195,7 @@ type ModalOrphanSweepResult = {
120
195
  terminated: ModalOrphanSweepTermination[];
121
196
  skipped: number;
122
197
  };
198
+ type RevalidateModalOrphanTermination = (candidate: ModalOrphanSweepTermination) => Promise<boolean>;
123
199
  declare function modalSandboxAttributionEnvironment(input: ModalSandboxAttribution): Record<string, string>;
124
200
  declare function modalSandboxAttributionTags(input: ModalSandboxAttribution): Record<string, string>;
125
201
  type ModalModule = typeof modal;
@@ -142,6 +218,9 @@ declare function sweepModalOrphanSandboxes(settings: Settings, liveLeases: LiveM
142
218
  maxTerminations?: number;
143
219
  unattributedGraceMs?: number;
144
220
  client?: ModalClientLike;
221
+ /** Re-read durable ownership immediately before provider termination. A
222
+ * false result or callback failure skips the destructive action. */
223
+ revalidateTermination?: RevalidateModalOrphanTermination;
145
224
  }): Promise<ModalOrphanSweepResult>;
146
225
 
147
226
  interface NegotiationContext {
@@ -152,6 +231,11 @@ interface NegotiationContext {
152
231
  liveness: "cold" | "warming" | "warm" | "draining";
153
232
  /** The lease epoch echoed on viewer heartbeats (the split-brain fence). */
154
233
  leaseEpoch: number;
234
+ /** Numeric/boolean archive completeness truth. Non-persistable targets use
235
+ * null/null/false; archive locations and provider details are never exposed. */
236
+ workspaceGeneration?: number | null;
237
+ archiveGeneration?: number | null;
238
+ archiveComplete?: boolean;
155
239
  /** The deployment desktop toggle (settings.sandboxDesktopEnabled). */
156
240
  desktopEnabled: boolean;
157
241
  /**
@@ -319,7 +403,7 @@ declare const DEFAULT_DESKTOP_GEOMETRY: DesktopGeometry;
319
403
  * value to viewers by the caller; this error is for diagnostics. */
320
404
  declare class DisplayStackError extends Error {
321
405
  readonly exitCode: number;
322
- readonly stage: "xvfb" | "x11vnc" | "websockify" | "paint" | "unknown";
406
+ readonly stage: "xvfb" | "x11vnc" | "websockify" | "paint" | "lock" | "timeout" | "unknown";
323
407
  constructor(exitCode: number, output: string);
324
408
  }
325
409
  /** Thrown when the provider session cannot run commands (a headless-only
@@ -328,12 +412,39 @@ declare class DisplayStackError extends Error {
328
412
  declare class DisplayStackUnsupportedError extends Error {
329
413
  constructor(message: string);
330
414
  }
415
+ type DisplayStackCallerKind = "viewer" | "computer" | "unknown";
416
+ type DisplayStackClassification = "cold" | "already_ready" | "contention" | "unknown";
417
+ type DisplayStackTelemetryStatus = "started" | "waiting" | "completed" | "failed";
418
+ /** Secret-free, bounded-cardinality stage observation. Provider/sandbox IDs are
419
+ * log correlation fields, never metric labels. */
420
+ type DisplayStackTelemetryEvent = {
421
+ type: "display_stack.stage";
422
+ requestId: string;
423
+ stage: string;
424
+ status: DisplayStackTelemetryStatus;
425
+ elapsedMs: number;
426
+ source: "host" | "sandbox";
427
+ classification: DisplayStackClassification;
428
+ callerKind: DisplayStackCallerKind;
429
+ sandboxId?: string;
430
+ leaseEpoch?: number;
431
+ providerSessionId?: number;
432
+ };
433
+ type DisplayStackTelemetryContext = {
434
+ callerKind: DisplayStackCallerKind;
435
+ sandboxId?: string;
436
+ leaseEpoch?: number;
437
+ };
331
438
  type EnsureDisplayStackOptions = {
332
439
  geometry?: DesktopGeometry;
333
440
  /** The exposed stream port; defaults to 6080. */
334
441
  port?: number;
335
- /** Per-exec timeout; defaults to DISPLAY_STACK_TIMEOUT_MS. */
442
+ /** Whole-operation wall-clock timeout; defaults to DISPLAY_STACK_TIMEOUT_MS. */
336
443
  timeoutMs?: number;
444
+ /** Caller correlation. Supplying it enables the default structured log sink. */
445
+ telemetryContext?: DisplayStackTelemetryContext;
446
+ /** Optional non-blocking telemetry sink (tests/embedders may replace logging). */
447
+ onTelemetry?: (event: DisplayStackTelemetryEvent) => void | Promise<void>;
337
448
  };
338
449
  type EnsureDisplayStackResult = {
339
450
  /** The exposed port the stack listens on (websockify/noVNC). */
@@ -685,6 +796,10 @@ declare function deleteRecordingArtifacts(session: unknown, proc: RecordingProce
685
796
  /** The storage object key for a recording artifact (parallels the file-asset layout). */
686
797
  declare function recordingStorageKey(workspaceId: string, sessionId: string, recordingId: string, codec: RecordingCodec): string;
687
798
 
799
+ declare function parseExecBannerSessionId(raw: string): number | null;
800
+ declare function parseExecBannerExitCode(raw: string): number | null;
801
+ declare function isExecSessionLostBanner(out: string, execSessionId: number): boolean;
802
+
688
803
  type ChannelAExecResult = {
689
804
  output?: string;
690
805
  stdout?: string;
@@ -722,6 +837,21 @@ type ChannelASession = {
722
837
  yieldTimeMs?: number;
723
838
  maxOutputTokens?: number;
724
839
  }): Promise<string>;
840
+ writeStdinForProcessMutation?(args: {
841
+ sessionId: number;
842
+ chars?: string;
843
+ yieldTimeMs?: number;
844
+ maxOutputTokens?: number;
845
+ }): Promise<string>;
846
+ writeStdinForProcessControl?(args: {
847
+ sessionId: number;
848
+ chars?: string;
849
+ yieldTimeMs?: number;
850
+ maxOutputTokens?: number;
851
+ }): Promise<string>;
852
+ cancelExecCommand?(opId: string): Promise<boolean>;
853
+ hasRetainedProcess?(providerSessionId: number): boolean;
854
+ execCommandForProcessControl?(providerSessionId: number, args: ChannelAExecArgs): Promise<string>;
725
855
  createEditor?(runAs?: string): ChannelAEditor;
726
856
  supportsPty?(): boolean;
727
857
  };
@@ -820,10 +950,9 @@ declare class SandboxChannelAService {
820
950
  detectReposDetailed(): Promise<RepositoryDiscoveryResult>;
821
951
  /** Detect repo roots within the workspace (for the Git.repos capability). */
822
952
  detectRepos(): Promise<string[]>;
823
- /** Run a bounded command, return buffered stdout/stderr + exit code inline. The
824
- * long-running tail (when the process hasn't exited within timeoutMs) keeps
825
- * running in-box; if emitStream is set the buffered output is also published as
826
- * the agent firehose so other viewers see it. */
953
+ /** Run a bounded command to physical completion and return buffered output.
954
+ * A deadline cancels the exact provider operation, proves its process group
955
+ * absent, and settles any retained-process admission before returning 124. */
827
956
  terminalExec(req: TerminalExecRequest): Promise<TerminalExecResponse>;
828
957
  /** Open an interactive PTY: exec the shell with tty:true, yielding the numeric
829
958
  * exec-session id the caller persists (ptyId<->execSessionId) so subsequent
@@ -843,9 +972,10 @@ declare class SandboxChannelAService {
843
972
  /** Resize an open PTY (SIGWINCH via stty against the exec-session). The SDK has
844
973
  * no resize method; stty in the same tty session updates the geometry. */
845
974
  ptyResize(req: PtyResizeRequest, execSessionId: number): Promise<void>;
846
- /** Close an open PTY: write exit/EOF. The caller marks the row closed + emits
847
- * terminal.pty.exited. */
848
- ptyClose(_req: PtyCloseRequest, execSessionId: number | null): Promise<void>;
975
+ /** Ask an open PTY to exit and return the exact provider banner. The routing
976
+ * session settles durable process authority only when that banner proves this
977
+ * locator exited or was lost; callers must keep metadata open otherwise. */
978
+ ptyClose(_req: PtyCloseRequest, execSessionId: number | null): Promise<string>;
849
979
  /** The current FS revision (for the caller to persist/seed). */
850
980
  currentRevision(): number;
851
981
  private joinRoot;
@@ -862,11 +992,6 @@ declare class SandboxChannelAService {
862
992
  emitGitChanged(repoPath: string, reason: GitChangedPayload["reason"]): Promise<void>;
863
993
  }
864
994
  declare function stripExecBanner(raw: string): string;
865
- declare function isExecSessionLostBanner(out: string, execSessionId: number): boolean;
866
- declare function parseExecBannerSessionId(raw: string): number | null;
867
- /** Recover a completed execCommand fallback's exit status from its banner.
868
- * Only the banner region is inspected, so command output cannot spoof success. */
869
- declare function parseExecBannerExitCode(raw: string): number | null;
870
995
  declare function assertSafeRelPath(p: string): string;
871
996
  declare function parsePorcelainV2(z: string): Omit<GitStatusResponse, "revision">;
872
997
  type NumstatEntry = {
@@ -2104,7 +2229,46 @@ interface ResolvedActiveBackend {
2104
2229
  sandboxId: string | null;
2105
2230
  /** A label for diagnostics ("modal" | "selfhosted" | the sandbox name). */
2106
2231
  kind: string;
2232
+ /** Exact durable home-lease epoch for a persistable provider. Absent for
2233
+ * connected-machine and other non-persistable route targets. */
2234
+ leaseEpoch?: number;
2235
+ /** Exact durable provider identity paired with `leaseEpoch`. This is internal
2236
+ * routing metadata only; it is never projected to an agent or public API. */
2237
+ providerInstanceId?: string;
2238
+ /** Active-pointer epoch observed when this route was resolved. The proxy fills
2239
+ * this internally even when a resolver omits it. */
2240
+ activeEpoch?: number;
2107
2241
  }
2242
+ /** Durable identity assigned to a provider exec that yielded instead of
2243
+ * exiting. The UUID is OpenGeni authority; the numeric provider session id is
2244
+ * only a locator within the exact copied backend route. */
2245
+ type RoutingRetainedProcess = {
2246
+ id: string;
2247
+ providerSessionId: number;
2248
+ };
2249
+ /** Exact copied route identity required to reconstruct an already-durable
2250
+ * retained process after the request/runtime object that opened it is gone.
2251
+ * The live session is deliberately not caller-supplied: adoption may bind only
2252
+ * to this proxy's construction-time default backend, so it cannot resolve or
2253
+ * follow the current active pointer. */
2254
+ type RoutingRetainedProcessAdoption = {
2255
+ process: RoutingRetainedProcess;
2256
+ backend: {
2257
+ sandboxId: string | null;
2258
+ leaseEpoch?: number;
2259
+ providerInstanceId?: string;
2260
+ activeEpoch: number;
2261
+ };
2262
+ };
2263
+ type RoutingRetainedProcessTerminalProof = {
2264
+ outcome: "exited";
2265
+ exitCode: number;
2266
+ reason: "provider_exit_banner";
2267
+ } | {
2268
+ outcome: "lost";
2269
+ exitCode: null;
2270
+ reason: "provider_session_lost_banner";
2271
+ };
2108
2272
  interface RoutingSandboxSessionDeps {
2109
2273
  /**
2110
2274
  * The DEFAULT backend resolved at construction time (the same shape `resolve()`
@@ -2136,7 +2300,68 @@ interface RoutingSandboxSessionDeps {
2136
2300
  maxFenceRetries?: number;
2137
2301
  /** Optional structured-log sink for swap/fence transitions (diagnostics). */
2138
2302
  onTransition?: (event: RoutingTransitionEvent) => void;
2303
+ /** Admit a filesystem-writing operation after resolving its exact route but
2304
+ * before invoking the provider. A rejection fails closed and is deliberately
2305
+ * outside provider fence-retry/error handling, so it can never replay the op
2306
+ * against a rival backend. */
2307
+ beforeMutation?: (input: {
2308
+ op: string;
2309
+ backend: ResolvedActiveBackend;
2310
+ }) => Promise<unknown>;
2311
+ /** Mark a mutation physically settled after its provider promise resolves OR
2312
+ * rejects. A resolved result is also revalidated against the same durable
2313
+ * route and attempt fence before its output is accepted. Settlement rejection
2314
+ * leaves a fail-closed blocker and the mutation must never be replayed. */
2315
+ afterMutation?: (input: {
2316
+ op: string;
2317
+ backend: ResolvedActiveBackend;
2318
+ admission: unknown;
2319
+ outcome: "resolved" | "rejected";
2320
+ /** Provider result for a resolved call. Never present for rejection. */
2321
+ result?: unknown;
2322
+ /** Stable candidate generated before durable promotion is attempted. It is
2323
+ * supplied only when the provider returned a positive yielded-session id. */
2324
+ retainedProcess?: RoutingRetainedProcess;
2325
+ }) => Promise<void>;
2326
+ /** Admit one model/user-visible stdin mutation under the already-durable
2327
+ * retained process authority. Control polling and helper execs never call it. */
2328
+ beforeProcessMutation?: (input: {
2329
+ op: string;
2330
+ backend: ResolvedActiveBackend;
2331
+ process: RoutingRetainedProcess;
2332
+ }) => Promise<unknown>;
2333
+ /** Physically settle one process-scoped stdin admission. */
2334
+ afterProcessMutation?: (input: {
2335
+ op: string;
2336
+ backend: ResolvedActiveBackend;
2337
+ process: RoutingRetainedProcess;
2338
+ admission: unknown;
2339
+ outcome: "resolved" | "rejected";
2340
+ result?: unknown;
2341
+ }) => Promise<void>;
2342
+ /** Close the durable parent admission/process holder only after exact exit or
2343
+ * matching provider-loss proof. Tracking is removed only after this resolves. */
2344
+ settleProcess?: (input: {
2345
+ backend: ResolvedActiveBackend;
2346
+ process: RoutingRetainedProcess;
2347
+ proof: RoutingRetainedProcessTerminalProof;
2348
+ }) => Promise<void>;
2349
+ /** Called only when an operation against the default/home backend throws a
2350
+ * non-fence error. Wiring may classify definitive provider disappearance and
2351
+ * atomically retire the exact lease epoch. Returning a result makes dispatch
2352
+ * throw a typed recovery-required error WITHOUT replaying the operation (the
2353
+ * original mutation may have reached the provider). */
2354
+ onDefaultBackendError?: (input: {
2355
+ op: string;
2356
+ error: unknown;
2357
+ kind: string;
2358
+ backend: ResolvedActiveBackend;
2359
+ }) => Promise<DefaultBackendLossResult | null>;
2139
2360
  }
2361
+ type DefaultBackendLossResult = {
2362
+ leaseEpoch: number;
2363
+ recovery: "pending" | "degraded" | "unrecoverable" | "superseded";
2364
+ };
2140
2365
  interface RoutingTransitionEvent {
2141
2366
  type: "resolved" | "fenced-retry" | "epoch-changed";
2142
2367
  fromEpoch: number;
@@ -2150,6 +2375,34 @@ declare class RoutingUnsupportedError extends Error {
2150
2375
  readonly name = "RoutingUnsupportedError";
2151
2376
  constructor(op: string, kind: string);
2152
2377
  }
2378
+ declare class RoutingBackendRecoveryRequiredError extends Error {
2379
+ readonly op: string;
2380
+ readonly leaseEpoch: number;
2381
+ readonly recovery: DefaultBackendLossResult["recovery"];
2382
+ readonly name = "RoutingBackendRecoveryRequiredError";
2383
+ readonly retryable: boolean;
2384
+ constructor(op: string, leaseEpoch: number, recovery: DefaultBackendLossResult["recovery"]);
2385
+ }
2386
+ /** A mutating provider call was admitted but could not be settled against the
2387
+ * exact route that admitted it. The provider may have applied the effect, so the
2388
+ * proxy rejects the output and explicitly forbids an automatic replay. */
2389
+ declare class RoutingMutationOutcomeUnknownError extends Error {
2390
+ readonly op: string;
2391
+ readonly name = "RoutingMutationOutcomeUnknownError";
2392
+ readonly retryable = false;
2393
+ constructor(op: string, message: string, options?: {
2394
+ cause?: unknown;
2395
+ });
2396
+ }
2397
+ /** An explicit process-aware operation named a numeric provider locator that
2398
+ * is not retained by this routing session. Callers must never fall back to the
2399
+ * current active pointer for such an operation. */
2400
+ declare class RoutingRetainedProcessNotFoundError extends Error {
2401
+ readonly providerSessionId: number;
2402
+ readonly name = "RoutingRetainedProcessNotFoundError";
2403
+ readonly retryable = false;
2404
+ constructor(providerSessionId: number);
2405
+ }
2153
2406
  /**
2154
2407
  * ONE stable session-shaped object the SDK binds to. Every method re-reads the
2155
2408
  * pointer, resolves the active backend (cached by epoch), and dispatches. A
@@ -2172,6 +2425,10 @@ declare class RoutingSandboxSession implements RoutableBackendSession {
2172
2425
  private cachedSandboxId;
2173
2426
  private cached;
2174
2427
  private lastResolved;
2428
+ /** Provider session ids are scoped to one backend instance. Each entry copies
2429
+ * that exact resolved route so pointer movement can never redirect stdin,
2430
+ * polling, or process-group helpers to another box. */
2431
+ private readonly retainedProcesses;
2175
2432
  desktopInput?: (event: unknown) => Promise<void>;
2176
2433
  screenshot?: () => Promise<{
2177
2434
  png: Uint8Array;
@@ -2204,6 +2461,20 @@ declare class RoutingSandboxSession implements RoutableBackendSession {
2204
2461
  * is THE per-call re-read that makes a mid-turn swap land on the next op.
2205
2462
  */
2206
2463
  private resolve;
2464
+ private invalidate;
2465
+ private registerRetainedProcess;
2466
+ private retainedProcess;
2467
+ /** Reconstruct one process that was already promoted durably by an earlier
2468
+ * request. Adoption never reads the active pointer and never repeats parent
2469
+ * promotion. It can bind only to the exact construction-time default backend;
2470
+ * callers must reject non-default routes until they can independently rebuild
2471
+ * that provider session from its copied durable identity. */
2472
+ adoptRetainedProcess(input: RoutingRetainedProcessAdoption): void;
2473
+ private ensureParentPromotion;
2474
+ private settleRetainedProcess;
2475
+ private flushPendingProcessMutation;
2476
+ private dispatchProcessMutation;
2477
+ private dispatchProcessControl;
2207
2478
  /**
2208
2479
  * Dispatch an op to the currently-active backend, retrying on a stale-epoch
2209
2480
  * fence. The sequence per attempt:
@@ -2238,6 +2509,25 @@ declare class RoutingSandboxSession implements RoutableBackendSession {
2238
2509
  exec(args: unknown): Promise<unknown>;
2239
2510
  execCommand(args: unknown): Promise<string>;
2240
2511
  writeStdin(args: unknown): Promise<string>;
2512
+ /** Whether a positive provider session locator is still pinned to the exact
2513
+ * backend that yielded it. This synchronous probe is used only to select the
2514
+ * process-aware routing surface; it is not itself durable authority. */
2515
+ hasRetainedProcess(providerSessionId: number): boolean;
2516
+ /** Return only OpenGeni's durable UUID + provider locator. Backend/session
2517
+ * objects remain private so a caller cannot forge route authority from this
2518
+ * diagnostic handoff. */
2519
+ retainedProcessIdentity(providerSessionId: number): RoutingRetainedProcess | null;
2520
+ /** Model/user-visible stdin is a distinct workspace mutation admission under
2521
+ * the durable retained-process holder. It never re-reads the active pointer. */
2522
+ writeStdinForProcessMutation(args: unknown): Promise<string>;
2523
+ /** Cancellation and drain polling are control operations. They stay pinned to
2524
+ * the process backend and may prove terminal state, but never advance the
2525
+ * workspace generation. */
2526
+ writeStdinForProcessControl(args: unknown): Promise<string>;
2527
+ /** Run a PID/PGID marker or signal helper on the retained process's exact
2528
+ * backend. The helper is control-plane work and therefore has no workspace
2529
+ * mutation admission of its own. */
2530
+ execCommandForProcessControl(providerSessionId: number, args: unknown): Promise<string>;
2241
2531
  cancelExecCommand(opId: string): Promise<boolean>;
2242
2532
  readFile(args: unknown): Promise<string | Uint8Array>;
2243
2533
  writeFile(args: unknown): Promise<unknown>;
@@ -2261,7 +2551,10 @@ declare class RoutingSandboxSession implements RoutableBackendSession {
2261
2551
  * direct delegate returns undefined and every lazy turn would die at bind. Return a
2262
2552
  * LAZY EDITOR PROXY instead: a non-null editor whose async ops resolve the active
2263
2553
  * backend (establishing the box on first use, via `dispatch`) and delegate to its
2264
- * real editor — mirroring how this proxy defers exec/readFile. */
2554
+ * real editor — mirroring how this proxy defers exec/readFile. Even when an
2555
+ * eager editor already exists, returning it directly would bypass per-edit
2556
+ * route resolution and mutation-generation admission, so every editor is
2557
+ * represented by this dispatching proxy. */
2265
2558
  createEditor(runAs?: string): unknown;
2266
2559
  resolveExposedPort(port: number): Promise<ExposedPortEndpoint>;
2267
2560
  /** Serialize the active backend's session state. Used by the resume-by-id seam
@@ -2291,6 +2584,18 @@ interface ActiveBackendResolverDeps {
2291
2584
  defaultBackend: RoutableBackendSession;
2292
2585
  /** A label for the default backend (its backend id: "modal"/"selfhosted"/…). */
2293
2586
  defaultKind: string;
2587
+ /**
2588
+ * Re-resolve the session's HOME backend after the route cache is fenced.
2589
+ *
2590
+ * The normal path returns `defaultBackend` (the turn's already-established
2591
+ * handle), but an API-side same-target repair can rematerialize that lease
2592
+ * while a worker turn is still alive. Such a repair advances the route epoch
2593
+ * without changing the null pointer; callers that can resume the current
2594
+ * lease-owned identity may provide this callback so the next epoch does not
2595
+ * keep dispatching to the dead pre-repair object. This callback must never
2596
+ * create a provider or replay an operation.
2597
+ */
2598
+ resolveDefaultBackend?: (pointer: ActivePointer) => Promise<ResolvedActiveBackend>;
2294
2599
  /** Look up a first-class sandbox by id (the swap target). Returns null when the
2295
2600
  * id is unknown or not in this workspace (the caller 409s the swap). */
2296
2601
  getSandbox(sandboxId: string): Promise<RoutableSandbox | null>;
@@ -2519,23 +2824,22 @@ type EstablishedSandboxSession = {
2519
2824
  /** Set when a create-authorized reattach found the envelope's box GONE
2520
2825
  * (provider NotFound) and fell through to cold-restore. */
2521
2826
  lostInstanceId?: string;
2827
+ /** Exact durable archive revision verified byte-for-byte after hydration. */
2828
+ restoredArchive?: WorkspaceArchiveDescriptor;
2522
2829
  };
2830
+ declare class SandboxExecReadinessError extends Error {
2831
+ readonly backend: string;
2832
+ readonly code: "exec_probe_unavailable" | "exec_probe_timeout" | "exec_probe_failed";
2833
+ readonly timeoutMs: number;
2834
+ readonly exitCode: number | null;
2835
+ readonly name = "SandboxExecReadinessError";
2836
+ constructor(backend: string, code: "exec_probe_unavailable" | "exec_probe_timeout" | "exec_probe_failed", timeoutMs: number, exitCode?: number | null);
2837
+ }
2838
+ /** A provider handle is not workspace readiness. Modal can return a handle
2839
+ * before its command router accepts exec, so every create path must pass this
2840
+ * bounded probe before atomically publishing the lease warm/ready. */
2841
+ declare function verifySandboxExecReadiness(established: EstablishedSandboxSession, timeoutMs?: number): Promise<void>;
2523
2842
  type SandboxCreatedCallback = (established: EstablishedSandboxSession) => Promise<void>;
2524
- /**
2525
- * Per-provider NotFound discriminator. The @openai/agents-extensions
2526
- * `isProviderSandboxNotFoundError` / `assertResumeRecreateAllowed` helpers live
2527
- * under `@openai/agents-extensions/sandbox/shared`, which is NOT an exported
2528
- * subpath (the package `exports` map only exposes `./sandbox/<provider>`), so we
2529
- * re-implement the discrimination here by inspecting the thrown error shape.
2530
- *
2531
- * "Box no longer running" (the box was reaped / idled out / 24h-ceiling) is the
2532
- * ONLY error that licenses a cold-restore via create(). Every other resume
2533
- * failure (transient provider error, auth, network) must propagate so the caller
2534
- * backs off — never spawns a rival box. We err on the side of NOT recreating:
2535
- * an unrecognized error is treated as "not NotFound" (propagate), because a
2536
- * false-positive recreate is the dangerous direction (double-spawn).
2537
- */
2538
- declare function isProviderSandboxNotFoundError(backendId: string, error: unknown): boolean;
2539
2843
  /**
2540
2844
  * Establish from one recovery envelope under an explicit creation policy. The
2541
2845
  * envelope is the lease's box-identity descriptor (the same per-turn `_sandbox`
@@ -2555,6 +2859,10 @@ declare function establishSandboxSessionFromEnvelope(settings: Settings, envelop
2555
2859
  backendOverride?: SandboxBackend;
2556
2860
  environment?: Record<string, string>;
2557
2861
  onSandboxCreated?: SandboxCreatedCallback;
2862
+ /** Called after archive hydration but immediately before the exact workspace
2863
+ * fingerprint probe. Lease-aware callers persist `verifying` here so a box
2864
+ * is never observable as ready while verification is in flight. */
2865
+ onWorkspaceRestoreVerifying?: (descriptor: WorkspaceArchiveDescriptor) => Promise<void>;
2558
2866
  metrics?: RuntimeMetricsHooks;
2559
2867
  }): Promise<EstablishedSandboxSession>;
2560
2868
  /**
@@ -2570,5 +2878,30 @@ declare function establishSandboxSessionFromEnvelope(settings: Settings, envelop
2570
2878
  * no warm-reattach).
2571
2879
  */
2572
2880
  declare function serializeEstablishedSandboxEnvelope(established: EstablishedSandboxSession): Promise<Record<string, unknown> | null>;
2881
+ /**
2882
+ * Whether a replacement envelope contains a provider-resumable identity. An
2883
+ * archive-only envelope is intentionally valid recovery metadata, but it is
2884
+ * never proof that the newly-created provider box can be resumed or attached.
2885
+ */
2886
+ declare function hasPersistableSandboxProviderIdentity(envelope: Record<string, unknown> | null | undefined): envelope is Record<string, unknown>;
2887
+ /** A replacement provider may not be published warm without a resumable
2888
+ * identity. Archive-only state is retained only when the caller rolls back to
2889
+ * cold and needs the verified workspace bytes for the next attempt. */
2890
+ declare class SandboxReplacementProviderStateError extends Error {
2891
+ readonly backend: string;
2892
+ readonly code: "replacement_provider_state_unpersistable";
2893
+ constructor(backend: string);
2894
+ }
2895
+ declare function requirePersistableReplacementSandboxEnvelope(envelope: Record<string, unknown> | null, backend: string): Record<string, unknown>;
2896
+ /**
2897
+ * Build the only resume envelope that may be published for a newly-created
2898
+ * replacement sandbox. Historical state contributes durable archive pointers
2899
+ * only; it can never substitute for serialization of the replacement's provider
2900
+ * identity. If replacement serialization is unavailable or fails, publication
2901
+ * keeps an archive-only envelope (when one exists) or null. The new instance id
2902
+ * remains separately fenced on the lease, while later attach/resume fails closed
2903
+ * rather than targeting the dead provider that initiated rematerialization.
2904
+ */
2905
+ declare function serializeReplacementSandboxEnvelope(established: EstablishedSandboxSession, archiveSource: Record<string, unknown> | null): Promise<Record<string, unknown> | null>;
2573
2906
 
2574
- export { OP_STREAM_SILENCE_TIMEOUT_MS as $, type ActiveBackendResolverDeps as A, type BackendUnresolvableCode as B, ChannelAConflictError as C, DEFAULT_DESKTOP_GEOMETRY as D, type EnsureDisplayStackOptions as E, FAULT_FIELD_WHAT_HAPPENED as F, type MintStreamTokenInput as G, MockAgentResponder as H, type MockAgentResponderOptions as I, type MockExecHandler as J, type ModalModuleLoader as K, type LiveModalSandboxLeaseAttribution as L, type MaterializeRunCredentialsOptions as M, type ModalOrphanSweepResult as N, type ModalSandboxAttribution as O, NEVER_SENT_DETAIL_KEY as P, NatsControlRpc as Q, type RunCredentialSessionReady as R, type NatsOpStreamConnection as S, NatsOpStreamTransport as T, type NatsRequestConnection as U, type NegotiationContext as V, type NormalizedRunCredentialMaterial as W, type NumstatEntry as X, OP_STREAM_ACK_INTERVAL_MS as Y, OP_STREAM_DEFAULT_WINDOW_BYTES as Z, OP_STREAM_RECONNECT_HOLD_MS as _, type RuntimeMetricsHooks as a, SelfhostedSandboxClient as a$, type OpStreamExecOutcome as a0, type OpStreamJournal as a1, type OpStreamSubscription as a2, type OpStreamTransport as a3, OpStreamUnavailableError as a4, PROVIDER_REGISTRY as a5, type ProviderConstructionContext as a6, type ProviderRegistration as a7, REPOSITORY_DISCOVERY_LIMIT as a8, type RecordingArtifactMetadata as a9, SELFHOSTED_RETRY_BACKOFF_BASE_MS as aA, SELFHOSTED_RETRY_BACKOFF_CAP_MS as aB, SELFHOSTED_RETRY_BACKOFF_FACTOR as aC, SELFHOSTED_TIMEOUT_MAX_RETRIES as aD, STREAM_PORT as aE, STREAM_TOKEN_DEFAULT_TTL_SECONDS as aF, SandboxChannelAService as aG, type SandboxChannelAServiceOptions as aH, SandboxConfigError as aI, type SandboxCreatedCallback as aJ, SandboxProviderUnavailableError as aK, SandboxResumeStateUnavailableError as aL, type SelfhostedApplyDiff as aM, SelfhostedControlError as aN, type SelfhostedEditor as aO, type SelfhostedEnrollment as aP, type SelfhostedExecArgs as aQ, type SelfhostedExecResult as aR, type SelfhostedImageOutput as aS, type SelfhostedLivenessState as aT, type SelfhostedNegotiationInput as aU, type SelfhostedOpObservation as aV, type SelfhostedOpObserver as aW, type SelfhostedOpStreamDeps as aX, type SelfhostedRelayConfig as aY, type SelfhostedRetryClock as aZ, type SelfhostedRetryDecision as a_, type RecordingCodec as aa, type RecordingContentType as ab, RecordingError as ac, type RecordingProcess as ad, RecordingUnavailableError as ae, type RepositoryDiscoveryDegradedReason as af, type RepositoryDiscoveryResult as ag, type ResolvedActiveBackend as ah, type RoutableBackendSession as ai, type RoutableSandbox as aj, RoutingSandboxSession as ak, type RoutingSandboxSessionDeps as al, type RoutingTransitionEvent as am, RoutingUnsupportedError as an, type RunCredentialCommandRunner as ao, type RunCredentialCommandSession as ap, type RunCredentialExpectedScope as aq, RunCredentialValidationError as ar, SELFHOSTED_DEFAULT_TIMEOUT_MS as as, SELFHOSTED_DRAINING_MAX_RETRIES as at, SELFHOSTED_EXEC_DRAINING_MAX_RETRIES as au, SELFHOSTED_IDEMPOTENT_READONLY_OPS as av, SELFHOSTED_INFRASTRUCTURE_FAULT_CLASSES as aw, SELFHOSTED_NEVER_SENT_MAX_RETRIES as ax, SELFHOSTED_RECONNECT_WINDOW_MS as ay, SELFHOSTED_RELAY_STREAM_PATH as az, ActiveBackendUnresolvableError as b, parseUnifiedPatch as b$, SelfhostedSession as b0, type SelfhostedSessionBuild as b1, type SelfhostedSessionDeps as b2, type SelfhostedSessionState as b3, type SelfhostedUnavailableReason as b4, type StartRecordingInput as b5, StreamPortUnavailableError as b6, type SwapTargetEstablishability as b7, TERMINAL_SERVER_TIMEOUT_MS as b8, TerminalServerError as b9, ensureModalRegistryImage as bA, ensureTerminalServer as bB, establishSandboxSessionFromEnvelope as bC, execDeadlineHint as bD, exposeStreamPort as bE, extForCodec as bF, inspectRecordingArtifact as bG, isExecSessionLostBanner as bH, isProviderSandboxNotFoundError as bI, isSelfhostedProviderNotFoundError as bJ, makeActiveBackendResolver as bK, materializeRunCredentials as bL, mintStreamToken as bM, modalSandboxAttributionEnvironment as bN, modalSandboxAttributionTags as bO, negotiateCapabilities as bP, negotiateSelfhostedCapabilities as bQ, nextDurableOpId as bR, normalizeRunCredentialsResolution as bS, offlineAgentError as bT, offlineControlResponse as bU, opAckSubject as bV, opFrameSubject as bW, parseExecBannerExitCode as bX, parseExecBannerSessionId as bY, parseNumstatZ as bZ, parsePorcelainV2 as b_, TerminalServerUnsupportedError as ba, ToolspaceTokenPathError as bb, agentErrorToControlError as bc, assertDescriptorRegistryInvariants as bd, assertProviderRegistryInvariants as be, assertSafeRelPath as bf, backendSupportsOs as bg, buildDisplayStackScript as bh, buildSelfhostedBackendSession as bi, buildStreamUrl as bj, buildTerminalServerScript as bk, clearRunCredentials as bl, clearRunCredentialsForAttempt as bm, contentTypeForCodec as bn, createSandboxClient as bo, createSandboxClientForBackend as bp, decideSelfhostedRetry as bq, decodeModalSnapshotId as br, defaultSelfhostedRetryClock as bs, deletePriorPersistedSnapshot as bt, deleteRecordingArtifacts as bu, deserializeSandboxSessionStateEnvelope as bv, desktopCapableBackend as bw, drainingExhaustedError as bx, drainingMessage as by, ensureDisplayStack as bz, type ActivePointer as c, payloadTooLargeMessage as c0, readWorkspaceArchiveFromEnvelopeSessionState as c1, recordingStorageKey as c2, renderSelfhostedFault as c3, restoredSandboxSessionStateFromEntry as c4, runCredentialPointerFile as c5, runCredentialRoot as c6, runWithToolCallCorrelation as c7, sandboxStateEntryFromRunState as c8, sanitizeOpIdToken as c9, withToolspaceTokenEnvironment as cA, withToolspaceTokenSession as cB, selectBackend as ca, selfhostedFaultClass as cb, selfhostedLiveness as cc, selfhostedRetryBackoffMs as cd, serializeEstablishedSandboxEnvelope as ce, setSelfhostedApplyDiff as cf, startRecording as cg, stopRecording as ch, stripExecBanner as ci, subjectFor as cj, swapTargetEstablishability as ck, sweepModalOrphanSandboxes as cl, tagModalSandbox as cm, tearDownDisplayStack as cn, tearDownTerminalServer as co, terminateModalSandboxById as cp, timeoutAgentError as cq, timeoutControlResponse as cr, toolspaceTokenFileForSession as cs, toolspaceTokenFileFromEnvironment as ct, uploadRecordingArtifact as cu, verifyStreamToken as cv, withRunCredentialEnvironment as cw, withRunCredentialsClient as cx, withRunCredentialsSession as cy, withToolspaceTokenClient as cz, type ChannelAEmitter as d, type ChannelAExecArgs as e, type ChannelAExecResult as f, ChannelANotFoundError as g, type ChannelASession as h, ChannelAUnavailableError as i, ChannelAUnsupportedError as j, ChannelAValidationError as k, type ControlRpc as l, DISPLAY_STACK_TIMEOUT_MS as m, type DesktopGeometry as n, DisplayStackError as o, DisplayStackUnsupportedError as p, type EnsureDisplayStackResult as q, type EnsureTerminalServerOptions as r, type EnsureTerminalServerResult as s, type EstablishedSandboxSession as t, type ExposeStreamPortInput as u, type ExposeStreamPortResult as v, type ExposedPortEndpoint as w, FAULT_FIELD_WHAT_PRESERVED as x, FAULT_FIELD_WHAT_TO_TRY as y, FAULT_FIELD_WHICH_LAYER as z };
2907
+ export { type NatsRequestConnection as $, type ActiveBackendResolverDeps as A, type BackendUnresolvableCode as B, ChannelAConflictError as C, DEFAULT_DESKTOP_GEOMETRY as D, type EnsureDisplayStackOptions as E, type ExposeStreamPortInput as F, type ExposeStreamPortResult as G, type ExposedPortEndpoint as H, FAULT_FIELD_WHAT_HAPPENED as I, FAULT_FIELD_WHAT_PRESERVED as J, FAULT_FIELD_WHAT_TO_TRY as K, FAULT_FIELD_WHICH_LAYER as L, type LiveModalSandboxLeaseAttribution as M, type MaterializeRunCredentialsOptions as N, type MintStreamTokenInput as O, MockAgentResponder as P, type MockAgentResponderOptions as Q, type RunCredentialSessionReady as R, type MockExecHandler as S, type ModalModuleLoader as T, type ModalOrphanSweepResult as U, type ModalOrphanSweepTermination as V, type ModalSandboxAttribution as W, NEVER_SENT_DETAIL_KEY as X, NatsControlRpc as Y, type NatsOpStreamConnection as Z, NatsOpStreamTransport as _, type RuntimeMetricsHooks as a, SandboxProviderUnavailableError as a$, type NegotiationContext as a0, type NormalizedRunCredentialMaterial as a1, type NumstatEntry as a2, OP_STREAM_ACK_INTERVAL_MS as a3, OP_STREAM_DEFAULT_WINDOW_BYTES as a4, OP_STREAM_RECONNECT_HOLD_MS as a5, OP_STREAM_SILENCE_TIMEOUT_MS as a6, type OpStreamExecOutcome as a7, type OpStreamJournal as a8, type OpStreamSubscription as a9, RoutingSandboxSession as aA, type RoutingSandboxSessionDeps as aB, type RoutingTransitionEvent as aC, RoutingUnsupportedError as aD, type RunCredentialCommandRunner as aE, type RunCredentialCommandSession as aF, type RunCredentialExpectedScope as aG, RunCredentialValidationError as aH, SELFHOSTED_DEFAULT_TIMEOUT_MS as aI, SELFHOSTED_DRAINING_MAX_RETRIES as aJ, SELFHOSTED_EXEC_DRAINING_MAX_RETRIES as aK, SELFHOSTED_IDEMPOTENT_READONLY_OPS as aL, SELFHOSTED_INFRASTRUCTURE_FAULT_CLASSES as aM, SELFHOSTED_NEVER_SENT_MAX_RETRIES as aN, SELFHOSTED_RECONNECT_WINDOW_MS as aO, SELFHOSTED_RELAY_STREAM_PATH as aP, SELFHOSTED_RETRY_BACKOFF_BASE_MS as aQ, SELFHOSTED_RETRY_BACKOFF_CAP_MS as aR, SELFHOSTED_RETRY_BACKOFF_FACTOR as aS, SELFHOSTED_TIMEOUT_MAX_RETRIES as aT, STREAM_PORT as aU, STREAM_TOKEN_DEFAULT_TTL_SECONDS as aV, SandboxChannelAService as aW, type SandboxChannelAServiceOptions as aX, SandboxConfigError as aY, type SandboxCreatedCallback as aZ, SandboxExecReadinessError as a_, type OpStreamTransport as aa, OpStreamUnavailableError as ab, PROVIDER_REGISTRY as ac, type ProviderConstructionContext as ad, type ProviderRegistration as ae, type ProviderSandboxFailure as af, type ProviderSandboxFailureKind as ag, REPOSITORY_DISCOVERY_LIMIT as ah, type RecordingArtifactMetadata as ai, type RecordingCodec as aj, type RecordingContentType as ak, RecordingError as al, type RecordingProcess as am, RecordingUnavailableError as an, type RepositoryDiscoveryDegradedReason as ao, type RepositoryDiscoveryResult as ap, type ResolvedActiveBackend as aq, type RevalidateModalOrphanTermination as ar, type RoutableBackendSession as as, type RoutableSandbox as at, RoutingBackendRecoveryRequiredError as au, RoutingMutationOutcomeUnknownError as av, type RoutingRetainedProcess as aw, type RoutingRetainedProcessAdoption as ax, RoutingRetainedProcessNotFoundError as ay, type RoutingRetainedProcessTerminalProof as az, ActiveBackendUnresolvableError as b, ensureTerminalServer as b$, SandboxReplacementProviderStateError as b0, SandboxResumeStateUnavailableError as b1, type SelfhostedApplyDiff as b2, SelfhostedControlError as b3, type SelfhostedEditor as b4, type SelfhostedEnrollment as b5, type SelfhostedExecArgs as b6, type SelfhostedExecResult as b7, type SelfhostedImageOutput as b8, type SelfhostedLivenessState as b9, agentErrorToControlError as bA, assertDescriptorRegistryInvariants as bB, assertProviderRegistryInvariants as bC, assertSafeRelPath as bD, backendSupportsOs as bE, buildDisplayStackScript as bF, buildSelfhostedBackendSession as bG, buildStreamUrl as bH, buildTerminalServerScript as bI, captureVerifiedWorkspaceArchive as bJ, classifyProviderSandboxFailure as bK, clearRunCredentials as bL, clearRunCredentialsForAttempt as bM, contentTypeForCodec as bN, createSandboxClient as bO, createSandboxClientForBackend as bP, decideSelfhostedRetry as bQ, decodeModalSnapshotId as bR, defaultSelfhostedRetryClock as bS, deletePriorPersistedSnapshot as bT, deleteRecordingArtifacts as bU, deserializeSandboxSessionStateEnvelope as bV, desktopCapableBackend as bW, drainingExhaustedError as bX, drainingMessage as bY, ensureDisplayStack as bZ, ensureModalRegistryImage as b_, type SelfhostedNegotiationInput as ba, type SelfhostedOpObservation as bb, type SelfhostedOpObserver as bc, type SelfhostedOpStreamDeps as bd, type SelfhostedRelayConfig as be, type SelfhostedRetryClock as bf, type SelfhostedRetryDecision as bg, SelfhostedSandboxClient as bh, SelfhostedSession as bi, type SelfhostedSessionBuild as bj, type SelfhostedSessionDeps as bk, type SelfhostedSessionState as bl, type SelfhostedUnavailableReason as bm, type StartRecordingInput as bn, StreamPortUnavailableError as bo, type SwapTargetEstablishability as bp, TERMINAL_SERVER_TIMEOUT_MS as bq, TerminalServerError as br, TerminalServerUnsupportedError as bs, ToolspaceTokenPathError as bt, type VerifiedWorkspaceArchive as bu, WORKSPACE_ARCHIVE_DESCRIPTOR_VERSION as bv, type WorkspaceArchiveDescriptor as bw, type WorkspaceArchiveIntegrityCode as bx, WorkspaceArchiveIntegrityError as by, type WorkspaceTreeFingerprint as bz, type ActivePointer as c, toolspaceTokenFileFromEnvironment as c$, establishSandboxSessionFromEnvelope as c0, execDeadlineHint as c1, exposeStreamPort as c2, extForCodec as c3, fingerprintSandboxWorkspace as c4, hasPersistableSandboxProviderIdentity as c5, inspectRecordingArtifact as c6, isExecSessionLostBanner as c7, isProviderSandboxGoneDuringRoutedOperation as c8, isProviderSandboxNotFoundError as c9, requirePersistableReplacementSandboxEnvelope as cA, restoredSandboxSessionStateFromEntry as cB, runCredentialPointerFile as cC, runCredentialRoot as cD, runWithToolCallCorrelation as cE, sandboxStateEntryFromRunState as cF, sanitizeOpIdToken as cG, selectBackend as cH, selfhostedFaultClass as cI, selfhostedLiveness as cJ, selfhostedRetryBackoffMs as cK, serializeEstablishedSandboxEnvelope as cL, serializeReplacementSandboxEnvelope as cM, setSelfhostedApplyDiff as cN, startRecording as cO, stopRecording as cP, stripExecBanner as cQ, subjectFor as cR, swapTargetEstablishability as cS, sweepModalOrphanSandboxes as cT, tagModalSandbox as cU, tearDownDisplayStack as cV, tearDownTerminalServer as cW, terminateModalSandboxById as cX, timeoutAgentError as cY, timeoutControlResponse as cZ, toolspaceTokenFileForSession as c_, isProviderSandboxTransientError as ca, isSelfhostedProviderNotFoundError as cb, makeActiveBackendResolver as cc, materializeRunCredentials as cd, mintStreamToken as ce, modalSandboxAttributionEnvironment as cf, modalSandboxAttributionTags as cg, negotiateCapabilities as ch, negotiateSelfhostedCapabilities as ci, nextDurableOpId as cj, normalizeRunCredentialsResolution as ck, offlineAgentError as cl, offlineControlResponse as cm, opAckSubject as cn, opFrameSubject as co, parseExecBannerExitCode as cp, parseExecBannerSessionId as cq, parseNumstatZ as cr, parsePorcelainV2 as cs, parseUnifiedPatch as ct, parseWorkspaceArchiveDescriptor as cu, payloadTooLargeMessage as cv, readVerifiedWorkspaceArchive as cw, readWorkspaceArchiveFromEnvelopeSessionState as cx, recordingStorageKey as cy, renderSelfhostedFault as cz, type ChannelAEmitter as d, uploadRecordingArtifact as d0, verifyRestoredWorkspace as d1, verifySandboxExecReadiness as d2, verifyStreamToken as d3, withRunCredentialEnvironment as d4, withRunCredentialsClient as d5, withRunCredentialsSession as d6, withToolspaceTokenClient as d7, withToolspaceTokenEnvironment as d8, withToolspaceTokenSession as d9, type ChannelAExecArgs as e, type ChannelAExecResult as f, ChannelANotFoundError as g, type ChannelASession as h, ChannelAUnavailableError as i, ChannelAUnsupportedError as j, ChannelAValidationError as k, type ControlRpc as l, DISPLAY_STACK_TIMEOUT_MS as m, type DefaultBackendLossResult as n, type DesktopGeometry as o, type DisplayStackCallerKind as p, type DisplayStackClassification as q, DisplayStackError as r, type DisplayStackTelemetryContext as s, type DisplayStackTelemetryEvent as t, type DisplayStackTelemetryStatus as u, DisplayStackUnsupportedError as v, type EnsureDisplayStackResult as w, type EnsureTerminalServerOptions as x, type EnsureTerminalServerResult as y, type EstablishedSandboxSession as z };