@opengeni/runtime 0.6.1 → 0.7.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 (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 +293 -123
  5. package/dist/index.js +1819 -790
  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 +2573 -898
  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
package/src/metrics.ts CHANGED
@@ -1,5 +1,31 @@
1
1
  export type RuntimeMetricsHooks = {
2
- onModelCall?: (input: { provider: string; outcome: "completed" | "failed"; durationSeconds: number }) => void;
3
- onSandboxCreate?: (input: { backend: string; outcome: "completed" | "failed"; durationSeconds: number }) => void;
2
+ onModelCall?: (input: {
3
+ provider: string;
4
+ outcome: "completed" | "failed";
5
+ durationSeconds: number;
6
+ }) => void;
7
+ onSandboxCreate?: (input: {
8
+ backend: string;
9
+ outcome: "completed" | "failed";
10
+ durationSeconds: number;
11
+ }) => void;
4
12
  onSandboxWarmingTimeout?: (input: { backend: string }) => void;
13
+ /**
14
+ * One completed Connected Machine (selfhosted) control op — the out-of-band
15
+ * telemetry twin of the in-band fault rendering. `code` is the typed wire-code
16
+ * NAME on a failure (bounded label cardinality); `healed` marks a success that
17
+ * only landed after ≥1 retry (the leading indicator of the next unhealed fault);
18
+ * `replyBytes` is set only on a payload-wall fault. Wired from the runtime's
19
+ * `SelfhostedOpObserver` seam.
20
+ */
21
+ onSandboxOp?: (input: {
22
+ backend: string;
23
+ op: string;
24
+ outcome: "ok" | "failed";
25
+ code?: string;
26
+ healed: boolean;
27
+ retries: number;
28
+ durationSeconds: number;
29
+ replyBytes?: number;
30
+ }) => void;
5
31
  };
@@ -35,20 +35,29 @@ export function assertDescriptorRegistryInvariants(): void {
35
35
 
36
36
  // DesktopStream implies a non-"none" port-exposure mechanism (split-plane B
37
37
  // needs a way to surface 6080 to a viewer).
38
- if (descriptor.capabilities.DesktopStream.available && descriptor.portExposure.kind === "none") {
38
+ if (
39
+ descriptor.capabilities.DesktopStream.available &&
40
+ descriptor.portExposure.kind === "none"
41
+ ) {
39
42
  throw new Error(`"${backend}" claims DesktopStream but portExposure.kind=none`);
40
43
  }
41
44
 
42
45
  // DesktopStream implies a transport, and a desktop transport implies the
43
46
  // capability is available (no half-declared desktop rows).
44
- if (descriptor.capabilities.DesktopStream.available && descriptor.capabilities.DesktopStream.transport === null) {
47
+ if (
48
+ descriptor.capabilities.DesktopStream.available &&
49
+ descriptor.capabilities.DesktopStream.transport === null
50
+ ) {
45
51
  throw new Error(`"${backend}" claims DesktopStream but transport is null`);
46
52
  }
47
53
 
48
54
  // Recording feasibility is the same Xvfb display as DesktopStream: a desktop
49
55
  // backend MUST be able to x11grab; a non-desktop backend MUST NOT claim it
50
56
  // (Recording.available == DesktopStream.available && os==linux — Part D).
51
- if (descriptor.capabilities.DesktopStream.available !== descriptor.capabilities.Recording.available) {
57
+ if (
58
+ descriptor.capabilities.DesktopStream.available !==
59
+ descriptor.capabilities.Recording.available
60
+ ) {
52
61
  throw new Error(
53
62
  `"${backend}" Recording.available (${descriptor.capabilities.Recording.available}) must equal DesktopStream.available (${descriptor.capabilities.DesktopStream.available})`,
54
63
  );