@opengeni/runtime 0.6.1 → 0.7.1

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 (45) hide show
  1. package/dist/{chunk-DYBF7ZEB.js → chunk-RYDCVTMW.js} +1958 -207
  2. package/dist/chunk-RYDCVTMW.js.map +1 -0
  3. package/dist/{index-BTo_bZvN.d.ts → index-DIiiwQY2.d.ts} +689 -52
  4. package/dist/index.d.ts +296 -123
  5. package/dist/index.js +1907 -809
  6. package/dist/index.js.map +1 -1
  7. package/dist/sandbox/index.d.ts +1 -1
  8. package/dist/sandbox/index.js +79 -3
  9. package/package.json +21 -20
  10. package/src/codex-tool-search.ts +185 -31
  11. package/src/context-compaction.ts +78 -243
  12. package/src/history-sanitizer.ts +172 -20
  13. package/src/index.ts +2687 -920
  14. package/src/metrics.ts +28 -2
  15. package/src/sandbox/capabilities.ts +12 -3
  16. package/src/sandbox/channel-a.ts +420 -72
  17. package/src/sandbox/display-stack.ts +18 -4
  18. package/src/sandbox/errors.ts +13 -0
  19. package/src/sandbox/index.ts +398 -112
  20. package/src/sandbox/op-correlation.ts +70 -0
  21. package/src/sandbox/providers/index.ts +9 -3
  22. package/src/sandbox/providers/modal.ts +84 -14
  23. package/src/sandbox/providers/selfhosted.ts +1 -4
  24. package/src/sandbox/recording.ts +146 -90
  25. package/src/sandbox/routing/backend-resolver.ts +144 -10
  26. package/src/sandbox/routing/routing-session.ts +129 -25
  27. package/src/sandbox/select.ts +60 -8
  28. package/src/sandbox/selfhosted/capabilities.ts +59 -25
  29. package/src/sandbox/selfhosted/control-rpc.ts +160 -28
  30. package/src/sandbox/selfhosted/fault-rendering.ts +226 -0
  31. package/src/sandbox/selfhosted/op-observer.ts +54 -0
  32. package/src/sandbox/selfhosted/op-stream.ts +801 -0
  33. package/src/sandbox/selfhosted/op-testing.ts +468 -0
  34. package/src/sandbox/selfhosted/op-transport.ts +151 -0
  35. package/src/sandbox/selfhosted/retry-policy.ts +177 -0
  36. package/src/sandbox/selfhosted/session.ts +498 -55
  37. package/src/sandbox/selfhosted/testing.ts +60 -19
  38. package/src/sandbox/stream-port.ts +17 -5
  39. package/src/sandbox/stream-token.ts +8 -2
  40. package/src/sandbox/terminal-server.ts +18 -4
  41. package/src/sandbox-computer.ts +332 -70
  42. package/src/usage-telemetry.ts +73 -0
  43. package/dist/chunk-DYBF7ZEB.js.map +0 -1
  44. package/src/image-history.ts +0 -149
  45. package/src/screenshot-omitted-card.ts +0 -15
@@ -106,7 +106,9 @@ export class DisplayStackError extends Error {
106
106
  : exitCode === 14
107
107
  ? "paint"
108
108
  : "unknown";
109
- super(`desktop display stack failed at stage "${stage}" (exit ${exitCode})${output ? `:\n${output}` : ""}`);
109
+ super(
110
+ `desktop display stack failed at stage "${stage}" (exit ${exitCode})${output ? `:\n${output}` : ""}`,
111
+ );
110
112
  this.name = "DisplayStackError";
111
113
  this.exitCode = exitCode;
112
114
  this.stage = stage;
@@ -132,8 +134,16 @@ type ExecResultLike = {
132
134
  exitCode?: number | null;
133
135
  };
134
136
  type ExecCapableSession = {
135
- exec?: (args: { cmd: string; yieldTimeMs?: number; maxOutputTokens?: number }) => Promise<ExecResultLike>;
136
- execCommand?: (args: { cmd: string; yieldTimeMs?: number; maxOutputTokens?: number }) => Promise<string>;
137
+ exec?: (args: {
138
+ cmd: string;
139
+ yieldTimeMs?: number;
140
+ maxOutputTokens?: number;
141
+ }) => Promise<ExecResultLike>;
142
+ execCommand?: (args: {
143
+ cmd: string;
144
+ yieldTimeMs?: number;
145
+ maxOutputTokens?: number;
146
+ }) => Promise<string>;
137
147
  };
138
148
 
139
149
  export type EnsureDisplayStackOptions = {
@@ -331,6 +341,10 @@ export async function tearDownDisplayStack(session: unknown): Promise<void> {
331
341
  return;
332
342
  }
333
343
  if (typeof s?.execCommand === "function") {
334
- await s.execCommand({ cmd: "opengeni-desktop-down", yieldTimeMs: 10_000, maxOutputTokens: 4_000 });
344
+ await s.execCommand({
345
+ cmd: "opengeni-desktop-down",
346
+ yieldTimeMs: 10_000,
347
+ maxOutputTokens: 4_000,
348
+ });
335
349
  }
336
350
  }
@@ -17,6 +17,19 @@ export class SandboxConfigError extends Error {
17
17
  }
18
18
  }
19
19
 
20
+ /** A resume-only caller was handed a warm lease without a provider identity it
21
+ * can resume. The lease-aware caller must retire that exact epoch and re-enter
22
+ * admission; silently creating here would bypass the single-spawner guard. */
23
+ export class SandboxResumeStateUnavailableError extends Error {
24
+ readonly backend: SandboxBackend | string;
25
+
26
+ constructor(backend: SandboxBackend | string) {
27
+ super(`Sandbox lease for backend "${backend}" has no resumable provider identity`);
28
+ this.name = "SandboxResumeStateUnavailableError";
29
+ this.backend = backend;
30
+ }
31
+ }
32
+
20
33
  // Thrown by a provider's build() when its SDK client class is genuinely not
21
34
  // available in the installed @openai/agents-extensions. Per the P0.3 ruling we
22
35
  // NEVER fake a build body; if a provider cannot be constructed we register the