@opengeni/runtime 0.7.1 → 0.13.0

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.
Files changed (61) hide show
  1. package/THIRD_PARTY_NOTICES +32 -0
  2. package/dist/agent-UMUIWWD2.js +8 -0
  3. package/dist/agent-UMUIWWD2.js.map +1 -0
  4. package/dist/chunk-4YJ5Z52Z.js +1789 -0
  5. package/dist/chunk-4YJ5Z52Z.js.map +1 -0
  6. package/dist/chunk-65UDUFUO.js +22133 -0
  7. package/dist/chunk-65UDUFUO.js.map +1 -0
  8. package/dist/chunk-DPULLAJG.js +215 -0
  9. package/dist/chunk-DPULLAJG.js.map +1 -0
  10. package/dist/chunk-HAN5D27J.js +292 -0
  11. package/dist/chunk-HAN5D27J.js.map +1 -0
  12. package/dist/chunk-K4V4QYCL.js +37683 -0
  13. package/dist/chunk-K4V4QYCL.js.map +1 -0
  14. package/dist/chunk-PZ5AY32C.js +10 -0
  15. package/dist/chunk-PZ5AY32C.js.map +1 -0
  16. package/dist/{index-DIiiwQY2.d.ts → index-DGUrY_yR.d.ts} +171 -18
  17. package/dist/index.d.ts +404 -125
  18. package/dist/index.js +8857 -412
  19. package/dist/index.js.map +1 -1
  20. package/dist/localSources-T3HZ6KY4.js +15 -0
  21. package/dist/localSources-T3HZ6KY4.js.map +1 -0
  22. package/dist/mcp-network.d.ts +78 -0
  23. package/dist/mcp-network.js +62 -0
  24. package/dist/mcp-network.js.map +1 -0
  25. package/dist/sandbox/index.d.ts +1 -1
  26. package/dist/sandbox/index.js +42 -5
  27. package/dist/skill-library.d.ts +74 -0
  28. package/dist/skill-library.js +18 -0
  29. package/dist/skill-library.js.map +1 -0
  30. package/package.json +18 -5
  31. package/src/bundled_hashicorp_terraform_skills/README.md +3 -3
  32. package/src/bundled_hashicorp_terraform_skills/checkov/SKILL.md +1 -1
  33. package/src/codex-tool-search.ts +20 -1
  34. package/src/context-compaction.ts +421 -24
  35. package/src/history-sanitizer.ts +14 -5
  36. package/src/index.ts +1806 -347
  37. package/src/mcp-network.ts +330 -0
  38. package/src/sandbox/channel-a.ts +526 -113
  39. package/src/sandbox/display-stack.ts +860 -23
  40. package/src/sandbox/exec-banner.ts +67 -0
  41. package/src/sandbox/index.ts +43 -2
  42. package/src/sandbox/providers/modal.ts +29 -2
  43. package/src/sandbox/routing/routing-session.ts +10 -2
  44. package/src/sandbox/run-credentials.ts +818 -0
  45. package/src/sandbox/select.ts +3 -3
  46. package/src/sandbox/selfhosted/capabilities.ts +1 -1
  47. package/src/sandbox/selfhosted/op-stream.ts +40 -0
  48. package/src/sandbox/selfhosted/op-testing.ts +50 -3
  49. package/src/sandbox/selfhosted/session.ts +17 -4
  50. package/src/sandbox/selfhosted/testing.ts +1 -1
  51. package/src/sandbox/stream-port.ts +1 -1
  52. package/src/sandbox/stream-token.ts +1 -1
  53. package/src/sandbox/terminal-server.ts +6 -2
  54. package/src/sandbox/toolspace-token.ts +147 -0
  55. package/src/sandbox/turn-tool-cancellation.ts +940 -0
  56. package/src/sandbox-computer.ts +3 -1
  57. package/src/skill-library.ts +323 -0
  58. package/src/usage-telemetry.ts +495 -51
  59. package/dist/chunk-RYDCVTMW.js +0 -5531
  60. package/dist/chunk-RYDCVTMW.js.map +0 -1
  61. /package/src/{bundled_hashicorp_terraform_skills → bundled_skill_library}/azure-verified-modules/SKILL.md +0 -0
@@ -0,0 +1,10 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ export {
8
+ __export
9
+ };
10
+ //# sourceMappingURL=chunk-PZ5AY32C.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,6 +1,6 @@
1
1
  import { Settings } from '@opengeni/config';
2
- import { SandboxBackend, CapabilityDescriptor, SandboxOs, SessionCapabilities, StreamTokenPayload, SessionEventType, SessionStructuredCapabilities, FsListRequest, FsListResponse, FsReadRequest, FsReadResponse, FsWriteRequest, FsWriteResponse, FsDeleteRequest, FsDeleteResponse, FsMoveRequest, FsMoveResponse, FsMkdirRequest, FsMkdirResponse, GitStatusRequest, GitStatusResponse, GitDiffRequest, GitDiffResponse, GitLogRequest, GitLogResponse, GitShowRequest, GitShowResponse, TerminalExecRequest, TerminalExecResponse, PtyOpenRequest, PtyOpenResponse, PtyWriteRequest, PtyResizeRequest, PtyCloseRequest, GitChangedPayload, GitDiffHunk, GitFileStatusCode, CapabilityUnavailableReason } from '@opengeni/contracts';
3
- import { Manifest, SandboxClient, SandboxSessionState } from '@openai/agents/sandbox';
2
+ import { SandboxBackend, CapabilityDescriptor, SandboxOs, SessionCapabilities, StreamTokenPayload, RunCredentialFile, RunCredentialAuthNeeded, RunCredentialRedaction, RunCredentialsResolution, SessionEventType, SessionStructuredCapabilities, FsListRequest, FsListResponse, FsReadRequest, FsReadResponse, FsWriteRequest, FsWriteResponse, FsDeleteRequest, FsDeleteResponse, FsMoveRequest, FsMoveResponse, FsMkdirRequest, FsMkdirResponse, GitStatusRequest, GitStatusResponse, GitDiffRequest, GitDiffResponse, GitLogRequest, GitLogResponse, GitShowRequest, GitShowResponse, TerminalExecRequest, TerminalExecResponse, PtyOpenRequest, PtyOpenResponse, PtyWriteRequest, PtyResizeRequest, PtyCloseRequest, GitChangedPayload, GitDiffHunk, GitFileStatusCode, CapabilityUnavailableReason } from '@opengeni/contracts';
3
+ import { SandboxSessionLike, ExecCommandArgs, SandboxClient, Manifest, SandboxSessionState } from '@openai/agents/sandbox';
4
4
  import * as modal from 'modal';
5
5
  import { ControlRequest, ControlResponse, ErrorCode, AgentError, ExecResponse, DesktopInputRequest, ExecRequest } from '@opengeni/agent-proto';
6
6
 
@@ -120,6 +120,7 @@ type ModalOrphanSweepResult = {
120
120
  terminated: ModalOrphanSweepTermination[];
121
121
  skipped: number;
122
122
  };
123
+ type RevalidateModalOrphanTermination = (candidate: ModalOrphanSweepTermination) => Promise<boolean>;
123
124
  declare function modalSandboxAttributionEnvironment(input: ModalSandboxAttribution): Record<string, string>;
124
125
  declare function modalSandboxAttributionTags(input: ModalSandboxAttribution): Record<string, string>;
125
126
  type ModalModule = typeof modal;
@@ -142,6 +143,9 @@ declare function sweepModalOrphanSandboxes(settings: Settings, liveLeases: LiveM
142
143
  maxTerminations?: number;
143
144
  unattributedGraceMs?: number;
144
145
  client?: ModalClientLike;
146
+ /** Re-read durable ownership immediately before provider termination. A
147
+ * false result or callback failure skips the destructive action. */
148
+ revalidateTermination?: RevalidateModalOrphanTermination;
145
149
  }): Promise<ModalOrphanSweepResult>;
146
150
 
147
151
  interface NegotiationContext {
@@ -173,7 +177,7 @@ interface NegotiationContext {
173
177
  * (settings.computerUseReadOnly). v1 default false (the agent clicks/types). */
174
178
  computerUseReadOnly?: boolean;
175
179
  /**
176
- * Whether a scoped-stream-token secret is resolvable (I8/OD-8). When desktop
180
+ * Whether a scoped-stream-token secret is resolvable (stream-token availability contract). When desktop
177
181
  * is enabled but this is false (no streamTokenSecret AND no delegationSecret),
178
182
  * the desktop plane GRACEFULLY DEGRADES to transport:null — the deployment
179
183
  * boots, but the pixel plane cannot mint scoped tokens. Defaults to true so a
@@ -319,7 +323,7 @@ declare const DEFAULT_DESKTOP_GEOMETRY: DesktopGeometry;
319
323
  * value to viewers by the caller; this error is for diagnostics. */
320
324
  declare class DisplayStackError extends Error {
321
325
  readonly exitCode: number;
322
- readonly stage: "xvfb" | "x11vnc" | "websockify" | "paint" | "unknown";
326
+ readonly stage: "xvfb" | "x11vnc" | "websockify" | "paint" | "lock" | "timeout" | "unknown";
323
327
  constructor(exitCode: number, output: string);
324
328
  }
325
329
  /** Thrown when the provider session cannot run commands (a headless-only
@@ -328,12 +332,39 @@ declare class DisplayStackError extends Error {
328
332
  declare class DisplayStackUnsupportedError extends Error {
329
333
  constructor(message: string);
330
334
  }
335
+ type DisplayStackCallerKind = "viewer" | "computer" | "unknown";
336
+ type DisplayStackClassification = "cold" | "already_ready" | "contention" | "unknown";
337
+ type DisplayStackTelemetryStatus = "started" | "waiting" | "completed" | "failed";
338
+ /** Secret-free, bounded-cardinality stage observation. Provider/sandbox IDs are
339
+ * log correlation fields, never metric labels. */
340
+ type DisplayStackTelemetryEvent = {
341
+ type: "display_stack.stage";
342
+ requestId: string;
343
+ stage: string;
344
+ status: DisplayStackTelemetryStatus;
345
+ elapsedMs: number;
346
+ source: "host" | "sandbox";
347
+ classification: DisplayStackClassification;
348
+ callerKind: DisplayStackCallerKind;
349
+ sandboxId?: string;
350
+ leaseEpoch?: number;
351
+ providerSessionId?: number;
352
+ };
353
+ type DisplayStackTelemetryContext = {
354
+ callerKind: DisplayStackCallerKind;
355
+ sandboxId?: string;
356
+ leaseEpoch?: number;
357
+ };
331
358
  type EnsureDisplayStackOptions = {
332
359
  geometry?: DesktopGeometry;
333
360
  /** The exposed stream port; defaults to 6080. */
334
361
  port?: number;
335
- /** Per-exec timeout; defaults to DISPLAY_STACK_TIMEOUT_MS. */
362
+ /** Whole-operation wall-clock timeout; defaults to DISPLAY_STACK_TIMEOUT_MS. */
336
363
  timeoutMs?: number;
364
+ /** Caller correlation. Supplying it enables the default structured log sink. */
365
+ telemetryContext?: DisplayStackTelemetryContext;
366
+ /** Optional non-blocking telemetry sink (tests/embedders may replace logging). */
367
+ onTelemetry?: (event: DisplayStackTelemetryEvent) => void | Promise<void>;
337
368
  };
338
369
  type EnsureDisplayStackResult = {
339
370
  /** The exposed port the stack listens on (websockify/noVNC). */
@@ -414,7 +445,11 @@ type EnsureTerminalServerResult = {
414
445
  *
415
446
  * Exported (pure, side-effect-free) so the ensureTerminalServer unit test can
416
447
  * assert the exact command sequence without a live box. Mirrors
417
- * buildDisplayStackScript.
448
+ * buildDisplayStackScript. A ttyd process is sandbox-group-global, not
449
+ * OpenGeni-session-specific, so it must never inherit the box-global legacy
450
+ * Toolspace pointer. Session-scoped interactive exec/PTY uses Channel A; the
451
+ * shared ttyd shell fails closed for Toolspace until that stream plane itself is
452
+ * session-isolated.
418
453
  */
419
454
  declare function buildTerminalServerScript(options?: EnsureTerminalServerOptions): string;
420
455
  /**
@@ -435,6 +470,92 @@ declare function ensureTerminalServer(session: unknown, options?: EnsureTerminal
435
470
  * missing process. Mirrors tearDownDisplayStack. */
436
471
  declare function tearDownTerminalServer(session: unknown): Promise<void>;
437
472
 
473
+ type RunCredentialExpectedScope = {
474
+ accountId: string;
475
+ workspaceId: string;
476
+ sessionId: string;
477
+ };
478
+ type NormalizedRunCredentialMaterial = {
479
+ environment: Record<string, string>;
480
+ files: RunCredentialFile[];
481
+ fileEnvironment: Record<string, string>;
482
+ expiresAt: Date | null;
483
+ authNeeded: RunCredentialAuthNeeded[];
484
+ redactions: RunCredentialRedaction[];
485
+ };
486
+ type RunCredentialCommandSession = Pick<SandboxSessionLike, "exec" | "execCommand">;
487
+ type RunCredentialCommandRunner = (session: RunCredentialCommandSession, args: ExecCommandArgs) => Promise<unknown>;
488
+ type RunCredentialSessionReady = (session: RunCredentialCommandSession) => Promise<void> | void;
489
+ declare class RunCredentialValidationError extends Error {
490
+ constructor(message: string);
491
+ }
492
+ /**
493
+ * Validate the untrusted host-port response before any secret is written to a
494
+ * box. The host owns credential selection; OpenGeni owns scope checks, bounds,
495
+ * path safety, and the transport lifecycle.
496
+ */
497
+ declare function normalizeRunCredentialsResolution(resolution: Extract<RunCredentialsResolution, {
498
+ status: "not_applicable";
499
+ }>, expected: RunCredentialExpectedScope, now?: Date): null;
500
+ declare function normalizeRunCredentialsResolution(resolution: Exclude<RunCredentialsResolution, {
501
+ status: "not_applicable";
502
+ }>, expected: RunCredentialExpectedScope, now?: Date): NormalizedRunCredentialMaterial;
503
+ declare function normalizeRunCredentialsResolution(resolution: RunCredentialsResolution, expected: RunCredentialExpectedScope, now?: Date): NormalizedRunCredentialMaterial | null;
504
+ declare function runCredentialRoot(sessionId: string): string;
505
+ declare function runCredentialPointerFile(sessionId: string): string;
506
+ type MaterializeRunCredentialsOptions = {
507
+ sessionId: string;
508
+ attemptId: string;
509
+ executionGeneration: number;
510
+ /** Initial provision after recovery may prune generations from older attempts. */
511
+ pruneOtherAttempts?: boolean;
512
+ /** An all-auth-needed replacement removes every prior readable generation. */
513
+ prunePreviousGenerations?: boolean;
514
+ /** Renewal keeps the active and immediately prior same-attempt generations. */
515
+ pruneSupersededGenerations?: boolean;
516
+ commandRunner?: RunCredentialCommandRunner;
517
+ };
518
+ /** Materialize one complete immutable generation, then atomically flip current. */
519
+ declare function materializeRunCredentials(session: RunCredentialCommandSession, material: NormalizedRunCredentialMaterial, options: MaterializeRunCredentialsOptions): Promise<void>;
520
+ declare function clearRunCredentials(session: RunCredentialCommandSession, sessionId: string, commandRunner?: RunCredentialCommandRunner): Promise<void>;
521
+ /**
522
+ * Remove only generations owned by one attempt. A successor may already have
523
+ * atomically activated its own pointer after queue admission; this cleanup must
524
+ * never clear or overwrite that newer generation.
525
+ */
526
+ declare function clearRunCredentialsForAttempt(session: RunCredentialCommandSession, options: Pick<MaterializeRunCredentialsOptions, "sessionId" | "attemptId" | "executionGeneration">, commandRunner?: RunCredentialCommandRunner): Promise<void>;
527
+ /** Prefix one sandbox command so every new process observes the active generation. */
528
+ declare function withRunCredentialEnvironment(cmd: string, sessionId: string): string;
529
+ /**
530
+ * Preserve the provider session identity/capabilities while decorating only
531
+ * command creation. Non-command methods stay bound to the original instance.
532
+ */
533
+ declare function withRunCredentialsSession<T extends object>(session: T, sessionId: string): T;
534
+ /** Decorate every client-created/resumed session after the host seeds it. */
535
+ declare function withRunCredentialsClient(client: SandboxClient, sessionId: string, onSessionReady?: RunCredentialSessionReady): SandboxClient;
536
+
537
+ declare class ToolspaceTokenPathError extends Error {
538
+ constructor(message: string);
539
+ }
540
+ /**
541
+ * Derive the per-session token file beside the legacy manifest pointer.
542
+ *
543
+ * The manifest pointer stays box-global so an already-warm shared sandbox does
544
+ * not receive an illegal environment delta. Every OpenGeni command overrides
545
+ * that pointer with this deterministic path. The hash is path hygiene and
546
+ * avoids disclosing host/session ids in filenames; filesystem paths are not an
547
+ * authorization boundary. The delegated bearer's session claim remains the
548
+ * authority boundary for Toolspace calls.
549
+ */
550
+ declare function toolspaceTokenFileForSession(manifestTokenFile: string, sessionId: string): string;
551
+ declare function toolspaceTokenFileFromEnvironment(environment: Readonly<Record<string, string>>, sessionId: string): string;
552
+ /** Prefix one sandbox command with its session-specific Toolspace pointer. */
553
+ declare function withToolspaceTokenEnvironment(cmd: string, tokenFile: string): string;
554
+ /** Preserve provider identity/capabilities while decorating command creation. */
555
+ declare function withToolspaceTokenSession<T extends object>(session: T, tokenFile: string): T;
556
+ /** Decorate every client-created/resumed session with one session pointer. */
557
+ declare function withToolspaceTokenClient(client: SandboxClient, tokenFile: string): SandboxClient;
558
+
438
559
  /** The provider-resolved endpoint for an exposed port. Mirrors the SDK's
439
560
  * `ExposedPortEndpoint` (host/port/tls/query/...) WITHOUT importing the
440
561
  * agent-loop barrel — the leaf stays agent-loop-free. */
@@ -595,6 +716,9 @@ declare function deleteRecordingArtifacts(session: unknown, proc: RecordingProce
595
716
  /** The storage object key for a recording artifact (parallels the file-asset layout). */
596
717
  declare function recordingStorageKey(workspaceId: string, sessionId: string, recordingId: string, codec: RecordingCodec): string;
597
718
 
719
+ declare function parseExecBannerSessionId(raw: string): number | null;
720
+ declare function parseExecBannerExitCode(raw: string): number | null;
721
+
598
722
  type ChannelAExecResult = {
599
723
  output?: string;
600
724
  stdout?: string;
@@ -638,6 +762,12 @@ type ChannelASession = {
638
762
  declare class ChannelAValidationError extends Error {
639
763
  constructor(message: string);
640
764
  }
765
+ /** A structurally valid Channel-A request could not be completed because the
766
+ * sandbox/provider control plane was temporarily unavailable. Callers may retry
767
+ * this class; it must never be presented as a bad user path. */
768
+ declare class ChannelAUnavailableError extends Error {
769
+ constructor(message: string);
770
+ }
641
771
  declare class ChannelAConflictError extends Error {
642
772
  constructor(message: string);
643
773
  }
@@ -678,11 +808,22 @@ declare class SandboxChannelAService {
678
808
  capabilities(repos?: string[]): SessionStructuredCapabilities;
679
809
  private run;
680
810
  fsList(req: FsListRequest): Promise<FsListResponse>;
811
+ /**
812
+ * Worker-only fast path for a bounded whole-workspace index. Matching
813
+ * directory nodes are emitted but pruned by `find` before descent, so residue
814
+ * such as node_modules cannot consume the result budget. The public fs/list
815
+ * wire remains unchanged; interactive callers still expand every directory
816
+ * they explicitly request.
817
+ */
818
+ fsListPruned(req: FsListRequest, pruneDirectoryNames: readonly string[]): Promise<FsListResponse>;
819
+ private fsListInternal;
681
820
  fsRead(req: FsReadRequest): Promise<FsReadResponse>;
682
- /** Read a file by base64-ing it through exec. Binary-safe and — crucially —
683
- * NOT subject to the provider's native-readFile workspace-escape validation,
684
- * so it can render a symlink whose target lives outside /workspace (the link
685
- * node itself is in-workspace). `base64 <path>` follows the symlink. */
821
+ private assertConfinedExistingDirectory;
822
+ private assertConfinedMutationParent;
823
+ private assertConfinementResult;
824
+ /** Binary-safe fallback for sessions without native reads. The file is opened
825
+ * before checking `/proc/.../fd/3`, so a symlink swap cannot redirect the
826
+ * subsequent read after confinement has been established. */
686
827
  private fsReadViaExec;
687
828
  private shapeRead;
688
829
  fsWrite(req: FsWriteRequest): Promise<FsWriteResponse>;
@@ -697,9 +838,10 @@ declare class SandboxChannelAService {
697
838
  /**
698
839
  * Detect repo roots within every supported workspace layout.
699
840
  *
700
- * The platform seeds GitHub repositories at
701
- * `repos/<owner>/<repo>`, which puts the `.git` marker at depth four from the
702
- * workspace root. Do not reintroduce a fixed maxdepth here. Traversal is
841
+ * The platform normally seeds repositories at
842
+ * `repos/<encoded-host>/<owner>/<repo>`, while explicit mount paths and
843
+ * connected-machine layouts can be deeper. Do not reintroduce a fixed
844
+ * maxdepth here. Traversal is
703
845
  * bounded instead by pruning known machine/build residue, a wall-clock
704
846
  * timeout, and a result limit. `.git` may be either a directory (ordinary
705
847
  * clone/submodule) or a file (linked worktree).
@@ -741,6 +883,10 @@ declare class SandboxChannelAService {
741
883
  /** The current FS revision (for the caller to persist/seed). */
742
884
  currentRevision(): number;
743
885
  private joinRoot;
886
+ /** Validate and enter an FS/Git directory in the same remote command that
887
+ * performs the operation. This preserves confinement without adding a full
888
+ * provider round-trip to every tree expansion or Git query. */
889
+ private runInConfinedDirectory;
744
890
  private repoWorkdir;
745
891
  private terminalWorkdir;
746
892
  private emitEvents;
@@ -750,9 +896,7 @@ declare class SandboxChannelAService {
750
896
  emitGitChanged(repoPath: string, reason: GitChangedPayload["reason"]): Promise<void>;
751
897
  }
752
898
  declare function stripExecBanner(raw: string): string;
753
- declare function isWorkspaceEscapeError(error: unknown): boolean;
754
899
  declare function isExecSessionLostBanner(out: string, execSessionId: number): boolean;
755
- declare function parseExecBannerSessionId(raw: string): number | null;
756
900
  declare function assertSafeRelPath(p: string): string;
757
901
  declare function parsePorcelainV2(z: string): Omit<GitStatusResponse, "revision">;
758
902
  type NumstatEntry = {
@@ -1511,6 +1655,13 @@ declare class SelfhostedSession {
1511
1655
  workdir?: string;
1512
1656
  runAs?: string;
1513
1657
  }): Promise<string>;
1658
+ /**
1659
+ * Physical turn-cancellation seam used by the runtime tool fence. Only the
1660
+ * op-stream transport has a process-tree cancellation protocol; a legacy
1661
+ * runner returns false and the caller remains fail-closed until its exec
1662
+ * deadline rather than claiming the machine is quiescent.
1663
+ */
1664
+ cancelExecCommand(opId: string): Promise<boolean>;
1514
1665
  /** SDK shell capability never calls this (gated on `supportsPty()` which is
1515
1666
  * false), but the surface advertises it. Selfhosted exec has no interactive PTY
1516
1667
  * session over the structured RPC, so a stdin write is unsupported. */
@@ -1608,7 +1759,7 @@ declare class SelfhostedSession {
1608
1759
  * after asking the agent to ensure a stream channel for the port. M8b wires the
1609
1760
  * real relay tier (the byte pump) behind THIS seam.
1610
1761
  *
1611
- * THE CHANNEL-KEY QUERY (the M8b relay-dial contract, dossier §10.5): the relay
1762
+ * THE CHANNEL-KEY QUERY (the M8b relay-dial contract): the relay
1612
1763
  * routes by `{workspaceId, agentId, port}` — the EXACT `ChannelKey::query` the
1613
1764
  * agent's relay client (`opengeni-agent-stream`) appends when it registers the
1614
1765
  * producer side: `ws=<workspaceId>&agent=<agentId>&port=<port>`. We append the
@@ -1753,7 +1904,7 @@ declare function buildSelfhostedBackendSession(deps: SelfhostedSessionBuild): Pr
1753
1904
  }>;
1754
1905
  /**
1755
1906
  * The selfhosted NotFound discriminator — THE load-bearing safety property
1756
- * (dossier §10.2/§19): for selfhosted, `agent-offline` (no responder) is NEVER a
1907
+ *: for selfhosted, `agent-offline` (no responder) is NEVER a
1757
1908
  * provider NotFound. A user's real machine is not recreatable; if the lease saw
1758
1909
  * agent-offline as NotFound it would cold-create a RIVAL box (a Modal box) for
1759
1910
  * the user's machine. So this ALWAYS returns FALSE for selfhosted — there is no
@@ -1955,6 +2106,7 @@ interface RoutableBackendSession {
1955
2106
  exec?(args: unknown): Promise<unknown>;
1956
2107
  execCommand?(args: unknown): Promise<string>;
1957
2108
  writeStdin?(args: unknown): Promise<string>;
2109
+ cancelExecCommand?(opId: string): Promise<boolean>;
1958
2110
  readFile?(args: unknown): Promise<string | Uint8Array>;
1959
2111
  writeFile?(args: unknown): Promise<unknown>;
1960
2112
  createEditor?(runAs?: string): unknown;
@@ -2116,6 +2268,7 @@ declare class RoutingSandboxSession implements RoutableBackendSession {
2116
2268
  exec(args: unknown): Promise<unknown>;
2117
2269
  execCommand(args: unknown): Promise<string>;
2118
2270
  writeStdin(args: unknown): Promise<string>;
2271
+ cancelExecCommand(opId: string): Promise<boolean>;
2119
2272
  readFile(args: unknown): Promise<string | Uint8Array>;
2120
2273
  writeFile(args: unknown): Promise<unknown>;
2121
2274
  listDir(args: unknown): Promise<unknown>;
@@ -2448,4 +2601,4 @@ declare function establishSandboxSessionFromEnvelope(settings: Settings, envelop
2448
2601
  */
2449
2602
  declare function serializeEstablishedSandboxEnvelope(established: EstablishedSandboxSession): Promise<Record<string, unknown> | null>;
2450
2603
 
2451
- export { type OpStreamTransport 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 MockExecHandler as G, type ModalModuleLoader as H, type ModalOrphanSweepResult as I, type ModalSandboxAttribution as J, NatsControlRpc as K, type LiveModalSandboxLeaseAttribution as L, type MintStreamTokenInput as M, NEVER_SENT_DETAIL_KEY as N, type NatsOpStreamConnection as O, NatsOpStreamTransport as P, type NatsRequestConnection as Q, type RuntimeMetricsHooks as R, type NegotiationContext as S, type NumstatEntry as T, OP_STREAM_ACK_INTERVAL_MS as U, OP_STREAM_DEFAULT_WINDOW_BYTES as V, OP_STREAM_RECONNECT_HOLD_MS as W, OP_STREAM_SILENCE_TIMEOUT_MS as X, type OpStreamExecOutcome as Y, type OpStreamJournal as Z, type OpStreamSubscription as _, ActiveBackendUnresolvableError as a, type SwapTargetEstablishability as a$, OpStreamUnavailableError as a0, PROVIDER_REGISTRY as a1, type ProviderConstructionContext as a2, type ProviderRegistration as a3, REPOSITORY_DISCOVERY_LIMIT as a4, type RecordingArtifactMetadata as a5, type RecordingCodec as a6, type RecordingContentType as a7, RecordingError as a8, type RecordingProcess as a9, SandboxConfigError as aA, type SandboxCreatedCallback as aB, SandboxProviderUnavailableError as aC, SandboxResumeStateUnavailableError as aD, type SelfhostedApplyDiff as aE, SelfhostedControlError as aF, type SelfhostedEditor as aG, type SelfhostedEnrollment as aH, type SelfhostedExecArgs as aI, type SelfhostedExecResult as aJ, type SelfhostedImageOutput as aK, type SelfhostedLivenessState as aL, type SelfhostedNegotiationInput as aM, type SelfhostedOpObservation as aN, type SelfhostedOpObserver as aO, type SelfhostedOpStreamDeps as aP, type SelfhostedRelayConfig as aQ, type SelfhostedRetryClock as aR, type SelfhostedRetryDecision as aS, SelfhostedSandboxClient as aT, SelfhostedSession as aU, type SelfhostedSessionBuild as aV, type SelfhostedSessionDeps as aW, type SelfhostedSessionState as aX, type SelfhostedUnavailableReason as aY, type StartRecordingInput as aZ, StreamPortUnavailableError as a_, RecordingUnavailableError as aa, type RepositoryDiscoveryDegradedReason as ab, type RepositoryDiscoveryResult as ac, type ResolvedActiveBackend as ad, type RoutableBackendSession as ae, type RoutableSandbox as af, RoutingSandboxSession as ag, type RoutingSandboxSessionDeps as ah, type RoutingTransitionEvent as ai, RoutingUnsupportedError as aj, SELFHOSTED_DEFAULT_TIMEOUT_MS as ak, SELFHOSTED_DRAINING_MAX_RETRIES as al, SELFHOSTED_EXEC_DRAINING_MAX_RETRIES as am, SELFHOSTED_IDEMPOTENT_READONLY_OPS as an, SELFHOSTED_INFRASTRUCTURE_FAULT_CLASSES as ao, SELFHOSTED_NEVER_SENT_MAX_RETRIES as ap, SELFHOSTED_RECONNECT_WINDOW_MS as aq, SELFHOSTED_RELAY_STREAM_PATH as ar, SELFHOSTED_RETRY_BACKOFF_BASE_MS as as, SELFHOSTED_RETRY_BACKOFF_CAP_MS as at, SELFHOSTED_RETRY_BACKOFF_FACTOR as au, SELFHOSTED_TIMEOUT_MAX_RETRIES as av, STREAM_PORT as aw, STREAM_TOKEN_DEFAULT_TTL_SECONDS as ax, SandboxChannelAService as ay, type SandboxChannelAServiceOptions as az, type ActivePointer as b, serializeEstablishedSandboxEnvelope as b$, TERMINAL_SERVER_TIMEOUT_MS as b0, TerminalServerError as b1, TerminalServerUnsupportedError as b2, agentErrorToControlError as b3, assertDescriptorRegistryInvariants as b4, assertProviderRegistryInvariants as b5, assertSafeRelPath as b6, backendSupportsOs as b7, buildDisplayStackScript as b8, buildSelfhostedBackendSession as b9, makeActiveBackendResolver as bA, mintStreamToken as bB, modalSandboxAttributionEnvironment as bC, modalSandboxAttributionTags as bD, negotiateCapabilities as bE, negotiateSelfhostedCapabilities as bF, nextDurableOpId as bG, offlineAgentError as bH, offlineControlResponse as bI, opAckSubject as bJ, opFrameSubject as bK, parseExecBannerSessionId as bL, parseNumstatZ as bM, parsePorcelainV2 as bN, parseUnifiedPatch as bO, payloadTooLargeMessage as bP, readWorkspaceArchiveFromEnvelopeSessionState as bQ, recordingStorageKey as bR, renderSelfhostedFault as bS, restoredSandboxSessionStateFromEntry as bT, runWithToolCallCorrelation as bU, sandboxStateEntryFromRunState as bV, sanitizeOpIdToken as bW, selectBackend as bX, selfhostedFaultClass as bY, selfhostedLiveness as bZ, selfhostedRetryBackoffMs as b_, buildStreamUrl as ba, buildTerminalServerScript as bb, contentTypeForCodec as bc, createSandboxClient as bd, createSandboxClientForBackend as be, decideSelfhostedRetry as bf, decodeModalSnapshotId as bg, defaultSelfhostedRetryClock as bh, deletePriorPersistedSnapshot as bi, deleteRecordingArtifacts as bj, deserializeSandboxSessionStateEnvelope as bk, desktopCapableBackend as bl, drainingExhaustedError as bm, drainingMessage as bn, ensureDisplayStack as bo, ensureModalRegistryImage as bp, ensureTerminalServer as bq, establishSandboxSessionFromEnvelope as br, execDeadlineHint as bs, exposeStreamPort as bt, extForCodec as bu, inspectRecordingArtifact as bv, isExecSessionLostBanner as bw, isProviderSandboxNotFoundError as bx, isSelfhostedProviderNotFoundError as by, isWorkspaceEscapeError as bz, type ChannelAEmitter as c, setSelfhostedApplyDiff as c0, startRecording as c1, stopRecording as c2, stripExecBanner as c3, subjectFor as c4, swapTargetEstablishability as c5, sweepModalOrphanSandboxes as c6, tagModalSandbox as c7, tearDownDisplayStack as c8, tearDownTerminalServer as c9, terminateModalSandboxById as ca, timeoutAgentError as cb, timeoutControlResponse as cc, uploadRecordingArtifact as cd, verifyStreamToken as ce, type ChannelAExecArgs as d, type ChannelAExecResult as e, ChannelANotFoundError as f, type ChannelASession as g, ChannelAUnsupportedError as h, ChannelAValidationError as i, type ControlRpc as j, DISPLAY_STACK_TIMEOUT_MS as k, type DesktopGeometry as l, DisplayStackError as m, DisplayStackUnsupportedError as n, type EnsureDisplayStackResult as o, type EnsureTerminalServerOptions as p, type EnsureTerminalServerResult as q, type EstablishedSandboxSession as r, type ExposeStreamPortInput as s, type ExposeStreamPortResult as t, type ExposedPortEndpoint as u, FAULT_FIELD_WHAT_PRESERVED as v, FAULT_FIELD_WHAT_TO_TRY as w, FAULT_FIELD_WHICH_LAYER as x, MockAgentResponder as y, type MockAgentResponderOptions as z };
2604
+ export { type NegotiationContext as $, type ActiveBackendResolverDeps as A, type BackendUnresolvableCode as B, ChannelAConflictError as C, DEFAULT_DESKTOP_GEOMETRY as D, type EnsureDisplayStackOptions as E, type ExposeStreamPortResult as F, type ExposedPortEndpoint as G, FAULT_FIELD_WHAT_HAPPENED as H, FAULT_FIELD_WHAT_PRESERVED as I, FAULT_FIELD_WHAT_TO_TRY as J, FAULT_FIELD_WHICH_LAYER as K, type LiveModalSandboxLeaseAttribution as L, type MaterializeRunCredentialsOptions as M, type MintStreamTokenInput as N, MockAgentResponder as O, type MockAgentResponderOptions as P, type MockExecHandler as Q, type RunCredentialSessionReady as R, type ModalModuleLoader as S, type ModalOrphanSweepResult as T, type ModalOrphanSweepTermination as U, type ModalSandboxAttribution as V, NEVER_SENT_DETAIL_KEY as W, NatsControlRpc as X, type NatsOpStreamConnection as Y, NatsOpStreamTransport as Z, type NatsRequestConnection as _, type RuntimeMetricsHooks as a, type SelfhostedNegotiationInput as a$, type NormalizedRunCredentialMaterial as a0, type NumstatEntry as a1, OP_STREAM_ACK_INTERVAL_MS as a2, OP_STREAM_DEFAULT_WINDOW_BYTES as a3, OP_STREAM_RECONNECT_HOLD_MS as a4, OP_STREAM_SILENCE_TIMEOUT_MS as a5, type OpStreamExecOutcome as a6, type OpStreamJournal as a7, type OpStreamSubscription as a8, type OpStreamTransport as a9, SELFHOSTED_DRAINING_MAX_RETRIES as aA, SELFHOSTED_EXEC_DRAINING_MAX_RETRIES as aB, SELFHOSTED_IDEMPOTENT_READONLY_OPS as aC, SELFHOSTED_INFRASTRUCTURE_FAULT_CLASSES as aD, SELFHOSTED_NEVER_SENT_MAX_RETRIES as aE, SELFHOSTED_RECONNECT_WINDOW_MS as aF, SELFHOSTED_RELAY_STREAM_PATH as aG, SELFHOSTED_RETRY_BACKOFF_BASE_MS as aH, SELFHOSTED_RETRY_BACKOFF_CAP_MS as aI, SELFHOSTED_RETRY_BACKOFF_FACTOR as aJ, SELFHOSTED_TIMEOUT_MAX_RETRIES as aK, STREAM_PORT as aL, STREAM_TOKEN_DEFAULT_TTL_SECONDS as aM, SandboxChannelAService as aN, type SandboxChannelAServiceOptions as aO, SandboxConfigError as aP, type SandboxCreatedCallback as aQ, SandboxProviderUnavailableError as aR, SandboxResumeStateUnavailableError as aS, type SelfhostedApplyDiff as aT, SelfhostedControlError as aU, type SelfhostedEditor as aV, type SelfhostedEnrollment as aW, type SelfhostedExecArgs as aX, type SelfhostedExecResult as aY, type SelfhostedImageOutput as aZ, type SelfhostedLivenessState as a_, OpStreamUnavailableError as aa, PROVIDER_REGISTRY as ab, type ProviderConstructionContext as ac, type ProviderRegistration as ad, REPOSITORY_DISCOVERY_LIMIT as ae, type RecordingArtifactMetadata as af, type RecordingCodec as ag, type RecordingContentType as ah, RecordingError as ai, type RecordingProcess as aj, RecordingUnavailableError as ak, type RepositoryDiscoveryDegradedReason as al, type RepositoryDiscoveryResult as am, type ResolvedActiveBackend as an, type RevalidateModalOrphanTermination as ao, type RoutableBackendSession as ap, type RoutableSandbox as aq, RoutingSandboxSession as ar, type RoutingSandboxSessionDeps as as, type RoutingTransitionEvent as at, RoutingUnsupportedError as au, type RunCredentialCommandRunner as av, type RunCredentialCommandSession as aw, type RunCredentialExpectedScope as ax, RunCredentialValidationError as ay, SELFHOSTED_DEFAULT_TIMEOUT_MS as az, ActiveBackendUnresolvableError as b, offlineControlResponse as b$, type SelfhostedOpObservation as b0, type SelfhostedOpObserver as b1, type SelfhostedOpStreamDeps as b2, type SelfhostedRelayConfig as b3, type SelfhostedRetryClock as b4, type SelfhostedRetryDecision as b5, SelfhostedSandboxClient as b6, SelfhostedSession as b7, type SelfhostedSessionBuild as b8, type SelfhostedSessionDeps as b9, deletePriorPersistedSnapshot as bA, deleteRecordingArtifacts as bB, deserializeSandboxSessionStateEnvelope as bC, desktopCapableBackend as bD, drainingExhaustedError as bE, drainingMessage as bF, ensureDisplayStack as bG, ensureModalRegistryImage as bH, ensureTerminalServer as bI, establishSandboxSessionFromEnvelope as bJ, execDeadlineHint as bK, exposeStreamPort as bL, extForCodec as bM, inspectRecordingArtifact as bN, isExecSessionLostBanner as bO, isProviderSandboxNotFoundError as bP, isSelfhostedProviderNotFoundError as bQ, makeActiveBackendResolver as bR, materializeRunCredentials as bS, mintStreamToken as bT, modalSandboxAttributionEnvironment as bU, modalSandboxAttributionTags as bV, negotiateCapabilities as bW, negotiateSelfhostedCapabilities as bX, nextDurableOpId as bY, normalizeRunCredentialsResolution as bZ, offlineAgentError as b_, type SelfhostedSessionState as ba, type SelfhostedUnavailableReason as bb, type StartRecordingInput as bc, StreamPortUnavailableError as bd, type SwapTargetEstablishability as be, TERMINAL_SERVER_TIMEOUT_MS as bf, TerminalServerError as bg, TerminalServerUnsupportedError as bh, ToolspaceTokenPathError as bi, agentErrorToControlError as bj, assertDescriptorRegistryInvariants as bk, assertProviderRegistryInvariants as bl, assertSafeRelPath as bm, backendSupportsOs as bn, buildDisplayStackScript as bo, buildSelfhostedBackendSession as bp, buildStreamUrl as bq, buildTerminalServerScript as br, clearRunCredentials as bs, clearRunCredentialsForAttempt as bt, contentTypeForCodec as bu, createSandboxClient as bv, createSandboxClientForBackend as bw, decideSelfhostedRetry as bx, decodeModalSnapshotId as by, defaultSelfhostedRetryClock as bz, type ActivePointer as c, opAckSubject as c0, opFrameSubject as c1, parseExecBannerExitCode as c2, parseExecBannerSessionId as c3, parseNumstatZ as c4, parsePorcelainV2 as c5, parseUnifiedPatch as c6, payloadTooLargeMessage as c7, readWorkspaceArchiveFromEnvelopeSessionState as c8, recordingStorageKey as c9, toolspaceTokenFileFromEnvironment as cA, uploadRecordingArtifact as cB, verifyStreamToken as cC, withRunCredentialEnvironment as cD, withRunCredentialsClient as cE, withRunCredentialsSession as cF, withToolspaceTokenClient as cG, withToolspaceTokenEnvironment as cH, withToolspaceTokenSession as cI, renderSelfhostedFault 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, setSelfhostedApplyDiff as cm, startRecording as cn, stopRecording as co, stripExecBanner as cp, subjectFor as cq, swapTargetEstablishability as cr, sweepModalOrphanSandboxes as cs, tagModalSandbox as ct, tearDownDisplayStack as cu, tearDownTerminalServer as cv, terminateModalSandboxById as cw, timeoutAgentError as cx, timeoutControlResponse as cy, toolspaceTokenFileForSession 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, type DisplayStackCallerKind as o, type DisplayStackClassification as p, DisplayStackError as q, type DisplayStackTelemetryContext as r, type DisplayStackTelemetryEvent as s, type DisplayStackTelemetryStatus as t, DisplayStackUnsupportedError as u, type EnsureDisplayStackResult as v, type EnsureTerminalServerOptions as w, type EnsureTerminalServerResult as x, type EstablishedSandboxSession as y, type ExposeStreamPortInput as z };