@opengeni/runtime 3.0.1 → 4.0.0-canary.35585322809001

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 (99) hide show
  1. package/dist/assets/codemode-client.json +1 -0
  2. package/dist/chunk-4A4XTKKX.js +1 -0
  3. package/dist/{chunk-RIJ6DCYS.js → chunk-HCGLD7NH.js} +9817 -9494
  4. package/dist/chunk-HCGLD7NH.js.map +1 -0
  5. package/dist/{chunk-FHGLYLBL.js → chunk-SPT3PLMX.js} +1 -87
  6. package/dist/chunk-SPT3PLMX.js.map +1 -0
  7. package/dist/{chunk-GB763TSV.js → chunk-TE27J65Q.js} +1 -1
  8. package/dist/chunk-TE27J65Q.js.map +1 -0
  9. package/dist/{chunk-46BFUGFL.js → chunk-WIHICNWS.js} +1660 -388
  10. package/dist/chunk-WIHICNWS.js.map +1 -0
  11. package/dist/{chunk-UU6EJR52.js → chunk-YU4VRTR4.js} +2 -2
  12. package/dist/chunk-YU4VRTR4.js.map +1 -0
  13. package/dist/chunk-ZG2YH25H.js +94 -0
  14. package/dist/chunk-ZG2YH25H.js.map +1 -0
  15. package/dist/codex-tool-search.d.ts +5 -4
  16. package/dist/context-compaction.d.ts +19 -0
  17. package/dist/gmail-rest-mcp.js +1 -1
  18. package/dist/index.d.ts +30 -22
  19. package/dist/index.js +25 -5
  20. package/dist/lazy-manifest-OEYEHNVY.js +45 -0
  21. package/dist/lazy-manifest-OEYEHNVY.js.map +1 -0
  22. package/dist/lazy-manifest.d.ts +6 -0
  23. package/dist/lazy-tool-transport.d.ts +3 -2
  24. package/dist/{localSources-PVFCAPN2.js → localSources-TWHTEKGO.js} +3 -2
  25. package/dist/localSources-TWHTEKGO.js.map +1 -0
  26. package/dist/metrics.d.ts +6 -0
  27. package/dist/operational-instructions.d.ts +1 -1
  28. package/dist/prepared-compaction-request.d.ts +8 -0
  29. package/dist/provider-history-adapter.d.ts +2 -2
  30. package/dist/runtime-skills.d.ts +3 -10
  31. package/dist/sandbox/codemode-client.d.ts +17 -0
  32. package/dist/sandbox/codemode-token.d.ts +3 -3
  33. package/dist/sandbox/index.d.ts +2 -1
  34. package/dist/sandbox/index.js +8 -2
  35. package/dist/sandbox/materialization-verification-error.d.ts +27 -0
  36. package/dist/sandbox/provider-command-session.d.ts +44 -2
  37. package/dist/sandbox/providers/modal-command-control.d.ts +32 -29
  38. package/dist/sandbox/providers/modal-command-router-wire.d.ts +49 -0
  39. package/dist/sandbox/providers/modal-command-session.d.ts +2 -1
  40. package/dist/sandbox/providers/modal-legacy-command-control.d.ts +50 -0
  41. package/dist/sandbox/providers/modal-materialization-verification.d.ts +7 -0
  42. package/dist/sandbox/providers/modal.d.ts +0 -8
  43. package/dist/sandbox/routing/routing-session.d.ts +21 -0
  44. package/dist/sandbox/turn-tool-cancellation.d.ts +1 -0
  45. package/dist/skill-library.d.ts +0 -6
  46. package/dist/skill-library.js +1 -1
  47. package/dist/workspace-tool-gateway.js +7 -5
  48. package/package.json +13 -11
  49. package/src/bundled_artifact_skills/opengeni-documents/SKILL.md +19 -0
  50. package/src/bundled_artifact_skills/opengeni-documents/references/api.md +22 -0
  51. package/src/bundled_default_skills/opengeni-client/SKILL.md +349 -0
  52. package/src/bundled_default_skills/opengeni-client/agents/openai.yaml +4 -0
  53. package/src/bundled_default_skills/opengeni-client/references/api-workflows.md +256 -0
  54. package/src/bundled_default_skills/opengeni-client/references/compatibility-and-troubleshooting.md +84 -0
  55. package/src/bundled_default_skills/opengeni-client/references/customer-skill-template.md +96 -0
  56. package/src/bundled_default_skills/opengeni-client/references/data-tools-and-credentials.md +99 -0
  57. package/src/bundled_default_skills/opengeni-client/references/discovery-and-autonomy.md +81 -0
  58. package/src/bundled_default_skills/opengeni-client/references/external-users-and-connect.md +457 -0
  59. package/src/bundled_default_skills/opengeni-client/references/isolation-and-authorization.md +77 -0
  60. package/src/bundled_default_skills/opengeni-client/references/product-integration-shapes.md +232 -0
  61. package/src/bundled_default_skills/opengeni-client/references/product-shapes-and-ui.md +116 -0
  62. package/src/bundled_default_skills/opengeni-client/references/runtime-profile-and-verification.md +157 -0
  63. package/src/bundled_default_skills/opengeni-help/SKILL.md +101 -0
  64. package/src/bundled_management_skills/opengeni-skills/SKILL.md +33 -3
  65. package/src/codex-tool-search.ts +13 -5
  66. package/src/context-compaction.ts +87 -4
  67. package/src/gmail-rest-mcp.ts +1 -2
  68. package/src/index.ts +363 -131
  69. package/src/lazy-manifest.ts +55 -0
  70. package/src/lazy-tool-transport.ts +15 -2
  71. package/src/metrics.ts +6 -0
  72. package/src/model-request-capture.ts +3 -0
  73. package/src/operational-instructions.ts +11 -2
  74. package/src/prepared-compaction-request.ts +51 -0
  75. package/src/provider-history-adapter.ts +12 -3
  76. package/src/runtime-skills.ts +3 -17
  77. package/src/sandbox/codemode-client.ts +204 -0
  78. package/src/sandbox/codemode-token.ts +7 -2
  79. package/src/sandbox/index.ts +7 -0
  80. package/src/sandbox/materialization-verification-error.ts +65 -0
  81. package/src/sandbox/provider-command-session.ts +70 -2
  82. package/src/sandbox/providers/modal-command-control.ts +386 -242
  83. package/src/sandbox/providers/modal-command-router-wire.ts +248 -0
  84. package/src/sandbox/providers/modal-command-session.ts +177 -4
  85. package/src/sandbox/providers/modal-legacy-command-control.ts +351 -0
  86. package/src/sandbox/providers/modal-materialization-verification.ts +122 -0
  87. package/src/sandbox/providers/modal.ts +1 -9
  88. package/src/sandbox/routing/routing-session.ts +417 -79
  89. package/src/sandbox/turn-tool-cancellation.ts +38 -2
  90. package/src/skill-catalog.ts +1 -0
  91. package/src/skill-library.ts +0 -6
  92. package/src/workspace-governance.ts +0 -1
  93. package/src/workspace-skills.ts +114 -74
  94. package/dist/chunk-46BFUGFL.js.map +0 -1
  95. package/dist/chunk-FHGLYLBL.js.map +0 -1
  96. package/dist/chunk-GB763TSV.js.map +0 -1
  97. package/dist/chunk-RIJ6DCYS.js.map +0 -1
  98. package/dist/chunk-UU6EJR52.js.map +0 -1
  99. /package/dist/{localSources-PVFCAPN2.js.map → chunk-4A4XTKKX.js.map} +0 -0
@@ -1,6 +1,8 @@
1
- import type { SandboxProviderCommand } from "@opengeni/contracts";
1
+ import type { SandboxProviderCommand, ModalRouterProviderCommand, CommandSupervisionReceipt } from "@opengeni/contracts";
2
2
  export type ProviderCommandOutput = {
3
3
  command: SandboxProviderCommand;
4
+ /** Exact read baseline for atomic byte-offset capture; absent for legacy pages. */
5
+ expected?: ModalRouterProviderCommand;
4
6
  chunks: Array<{
5
7
  stream: "stdout" | "stderr";
6
8
  chunkId: string;
@@ -12,20 +14,60 @@ export type ProviderCommandOutput = {
12
14
  /** These callbacks are supplied by the control plane after exact-route
13
15
  * retention/adoption. They are never accepted as command arguments. */
14
16
  export type ProviderCommandPersistence = {
17
+ rejectSupervisedLaunch?(command: ModalRouterProviderCommand): Promise<void>;
15
18
  load(): Promise<SandboxProviderCommand | null>;
16
19
  acknowledge(command: SandboxProviderCommand): Promise<SandboxProviderCommand>;
17
- reserveInput(): Promise<number>;
20
+ reserveInput(byteLength?: number): Promise<number>;
21
+ recordSupervisionReceipt?(receipt: CommandSupervisionReceipt): Promise<void>;
22
+ loadSupervisionReceipt?(): Promise<CommandSupervisionReceipt | null>;
23
+ requestCancellation?(reason: "provider_deadline" | "explicit_stop"): Promise<void>;
24
+ cancellationRequested?(): Promise<boolean>;
25
+ captureRouterPage?(page: {
26
+ expected: ModalRouterProviderCommand;
27
+ command: ModalRouterProviderCommand;
28
+ stdout: string;
29
+ stderr: string;
30
+ }): Promise<{
31
+ command: ModalRouterProviderCommand;
32
+ captured: boolean;
33
+ }>;
18
34
  };
35
+ export declare class ProviderCommandStartRejectedError extends Error {
36
+ constructor(cause: unknown);
37
+ }
19
38
  export type ProviderCommandSession = {
39
+ verifyCommandSupervisionCapability?(): Promise<{
40
+ sandboxId: string;
41
+ taskId: string;
42
+ }>;
43
+ releaseSupervisedCommand?(handle: number): Promise<void>;
44
+ cancelSupervisedCommand?(handle: number, reason: "provider_deadline" | "explicit_stop"): Promise<boolean>;
20
45
  /** Abort only starts/initial observations still owned by this session call. */
21
46
  cancelPendingExecCommand?(): Promise<void>;
22
47
  getProviderCommand?(handle: number): SandboxProviderCommand | null;
23
48
  bindProviderCommand?(handle: number, command: SandboxProviderCommand, persistence: ProviderCommandPersistence): void;
24
49
  getProviderCommandOutput?(result: unknown): ProviderCommandOutput | null;
25
50
  acknowledgeCommandOutput?(result: string): Promise<void>;
51
+ /** Returns false for a legacy receipt. True means bytes and offsets committed
52
+ * together (or the page lost a cursor CAS and was safely discarded). */
53
+ captureCommandOutput?(result: string): Promise<boolean>;
54
+ };
55
+ export type PendingCommandSupervision = {
56
+ managed: boolean;
57
+ };
58
+ export declare function withPendingCommandSupervision<T>(state: PendingCommandSupervision | undefined, fn: () => T): T;
59
+ /** Called only by the provider adapter before dispatching an idle supervisor. */
60
+ export declare function markPendingCommandSupervised(): void;
61
+ type SupervisedLaunchReservation = {
62
+ reserve(command: ModalRouterProviderCommand): Promise<void>;
26
63
  };
64
+ export declare function withSupervisedLaunchReservation<T>(reservation: SupervisedLaunchReservation, fn: () => T): T;
65
+ export declare function reserveSupervisedLaunch(command: ModalRouterProviderCommand): Promise<void>;
66
+ export declare function withCommandSupervisionReady<T>(ready: boolean, fn: () => T): T;
67
+ export declare function admittedCommandSupervisionReady(): boolean;
27
68
  export declare const MAX_PROVIDER_COMMAND_HANDLE = 2147483647;
28
69
  /** The alias is allocated by serialized workspace mutation admission, not by
29
70
  * an SDK instance or a process-writable counter. It remains route-scoped. */
30
71
  export declare function withProviderCommandHandle<T>(handle: number | undefined, fn: () => T): T;
31
72
  export declare function admittedProviderCommandHandle(): number | undefined;
73
+ export {};
@@ -1,38 +1,41 @@
1
- import { ModalClient } from "modal";
2
- import { SandboxProviderCommand } from "@opengeni/contracts";
1
+ import { SandboxProviderCommand, CommandSupervisionReceipt, type ModalRouterProviderCommand } from "@opengeni/contracts";
3
2
  import type { ChannelAExecArgs } from "../channel-a.js";
4
- type CommandClient = Pick<ModalClient, "cpClient" | "version"> & Partial<Pick<ModalClient, "profile" | "logger">>;
5
- type GrpcMiddleware = NonNullable<NonNullable<ConstructorParameters<typeof ModalClient>[0]>["grpcMiddleware"]>[number];
6
- /** This dedicated command client never retries a request behind the caller's
7
- * back and preserves the exact cancellation signal, including streaming RPCs. */
8
- export declare const modalCommandAbortMiddleware: GrpcMiddleware;
9
- export type ModalCommandStream = "stdout" | "stderr";
3
+ import type { ProviderCommandOutput } from "../provider-command-session.js";
4
+ import { commandControlPlane } from "./modal-legacy-command-control.js";
5
+ export { modalCommandAbortMiddleware } from "./modal-legacy-command-control.js";
10
6
  export type ModalProviderCommand = SandboxProviderCommand;
11
- export type ModalProviderOutputPage = {
12
- command: ModalProviderCommand;
13
- chunks: Array<{
14
- stream: ModalCommandStream;
15
- chunkId: string;
16
- text: string;
17
- }>;
18
- exitCode: number | null;
19
- streamFidelity: "separate" | "merged";
20
- };
21
- /** Version-pinned Modal control-plane boundary. Execution identity, output
22
- * batches and exit status come from authenticated provider RPCs, never sandbox
23
- * files or an SDK object's in-memory process map. Callers must store the
24
- * returned locator/cursors outside the command's write authority. */
7
+ export type ModalProviderOutputPage = ProviderCommandOutput;
8
+ type Client = Parameters<typeof commandControlPlane>[0];
9
+ /** New commands use replayable task-router byte offsets. Legacy identifiers
10
+ * never cross that protocol boundary and are never used for new starts. */
25
11
  export declare class ModalCommandControl {
26
- private readonly client;
27
12
  private readonly sandboxIdentity;
28
13
  private readonly root;
29
14
  private readonly environment;
15
+ private readonly routers;
16
+ private readonly client;
17
+ private readonly legacy;
18
+ private closed;
30
19
  private constructor();
31
- static forSandbox(client: CommandClient, sandboxId: string | (() => string), root: string, environment?: Record<string, string> | (() => Record<string, string>)): ModalCommandControl;
20
+ static forSandbox(client: Client, sandboxId: string | (() => string), root: string, environment?: Record<string, string> | (() => Record<string, string>)): ModalCommandControl;
32
21
  private get sandboxId();
33
- start(args: ChannelAExecArgs, signal?: AbortSignal): Promise<ModalProviderCommand>;
34
- read(command: ModalProviderCommand, yieldTimeMs: number, signal?: AbortSignal): Promise<ModalProviderOutputPage>;
35
- write(command: ModalProviderCommand, chars: string, messageIndex: number): Promise<void>;
36
- private assertIdentity;
22
+ private withRouter;
23
+ close(): Promise<void>;
24
+ start(args: ChannelAExecArgs, signal?: AbortSignal): Promise<ModalRouterProviderCommand>;
25
+ /** Read-only, authenticated control execution on this exact instance. Never
26
+ * inferred from a fleet image selector or user command stdout. No cache: warm
27
+ * instances and route/task replacement must each pass before admission. */
28
+ verifySupervisionCapability(): Promise<{
29
+ sandboxId: string;
30
+ taskId: string;
31
+ }>;
32
+ /** Separate authenticated provider execution of the installed control helper.
33
+ * User command streams are never inspected for control evidence. */
34
+ supervisionControl(command: ModalRouterProviderCommand, action: "release" | "cancel" | "status" | "ack", receiptId?: string): Promise<{
35
+ state: "idle" | "running" | "quiescent";
36
+ receipt?: CommandSupervisionReceipt;
37
+ }>;
38
+ read(command: ModalProviderCommand, waitMs: number, signal?: AbortSignal): Promise<ModalProviderOutputPage>;
39
+ readProbe(command: ModalProviderCommand, waitMs: number, cancellation: AbortController): Promise<ModalProviderOutputPage>;
40
+ write(command: ModalProviderCommand, chars: string, index: number): Promise<void>;
37
41
  }
38
- export {};
@@ -0,0 +1,49 @@
1
+ import protobuf from "protobufjs";
2
+ import { ProviderCommandStartRejectedError } from "../provider-command-session.js";
3
+ export declare const modalRouterWire: protobuf.Root;
4
+ /** Only constructed at the authenticated Start RPC boundary. Transport loss,
5
+ * deadline, cancellation and UNKNOWN are deliberately not rejection proof. */
6
+ export declare class ModalCommandStartRejectedError extends ProviderCommandStartRejectedError {
7
+ readonly code: number;
8
+ constructor(code: number, cause: unknown);
9
+ }
10
+ export type ModalRouterIdentity = {
11
+ taskId: string;
12
+ execId: string;
13
+ };
14
+ export type ModalRouterAccess = {
15
+ url: string;
16
+ jwt: string;
17
+ };
18
+ export type ModalRouterStart = ModalRouterIdentity & {
19
+ commandArgs: string[];
20
+ workdir: string;
21
+ env: Record<string, string>;
22
+ ptyInfo?: {
23
+ enabled: boolean;
24
+ winszRows: number;
25
+ winszCols: number;
26
+ envTerm: string;
27
+ ptyType: number;
28
+ noTerminateOnIdleStdin: boolean;
29
+ };
30
+ };
31
+ /** A single authenticated transport, owned and closed by its command adapter.
32
+ * Reads may stop at a byte boundary because the next read resumes at that exact
33
+ * offset. Mutations are never retried by this layer, including ambiguous starts.
34
+ */
35
+ export declare class ModalCommandRouterWire {
36
+ private readonly client;
37
+ private readonly metadata;
38
+ private closed;
39
+ constructor(access: ModalRouterAccess, trustedRoots?: Buffer);
40
+ close(): void;
41
+ private unary;
42
+ start(request: ModalRouterStart, signal?: AbortSignal): Promise<void>;
43
+ write(identity: ModalRouterIdentity, offset: number, data: Uint8Array, signal?: AbortSignal): Promise<void>;
44
+ poll(identity: ModalRouterIdentity, signal?: AbortSignal): Promise<number | null>;
45
+ read(identity: ModalRouterIdentity, stream: "stdout" | "stderr", offset: number, waitMs: number, signal?: AbortSignal): Promise<{
46
+ bytes: Buffer;
47
+ eof: boolean;
48
+ }>;
49
+ }
@@ -7,4 +7,5 @@ import type { ModalCommandControl } from "./modal-command-control.js";
7
7
  export declare function installModalCommandSession(session: ProviderCommandSession & {
8
8
  execCommand?: ChannelASession["execCommand"];
9
9
  writeStdin?: ChannelASession["writeStdin"];
10
- }, control: ModalCommandControl): void;
10
+ verifyMaterializedPath?: (path: string, workdir: string) => Promise<void>;
11
+ }, control: Pick<ModalCommandControl, "start" | "read" | "readProbe" | "write"> & Partial<Pick<ModalCommandControl, "supervisionControl" | "verifySupervisionCapability">>): void;
@@ -0,0 +1,50 @@
1
+ import { ModalClient } from "modal";
2
+ import { ModalLegacyProviderCommand } from "@opengeni/contracts";
3
+ import type { ChannelAExecArgs } from "../channel-a.js";
4
+ type ControlPlane = Pick<ModalClient["cpClient"], "sandboxGetTaskId" | "containerExec" | "containerExecGetOutput" | "containerExecPutInput" | "taskGetCommandRouterAccess">;
5
+ type CommandClient = Pick<ModalClient, "cpClient" | "version"> & Partial<Pick<ModalClient, "profile" | "logger">>;
6
+ type GrpcMiddleware = NonNullable<NonNullable<ConstructorParameters<typeof ModalClient>[0]>["grpcMiddleware"]>[number];
7
+ /** This dedicated command client never retries a request behind the caller's
8
+ * back and preserves the exact cancellation signal, including streaming RPCs. */
9
+ export declare const modalCommandAbortMiddleware: GrpcMiddleware;
10
+ export declare function commandControlPlane(client: CommandClient): ControlPlane;
11
+ export type ModalCommandStream = "stdout" | "stderr";
12
+ export type ModalProviderCommand = ModalLegacyProviderCommand;
13
+ export type ModalProviderOutputPage = {
14
+ command: ModalProviderCommand;
15
+ chunks: Array<{
16
+ stream: ModalCommandStream;
17
+ chunkId: string;
18
+ text: string;
19
+ }>;
20
+ exitCode: number | null;
21
+ streamFidelity: "separate" | "merged";
22
+ };
23
+ export declare function decodePage(prior: string, input: Uint8Array[], terminal: boolean): {
24
+ text: string;
25
+ remainder: string;
26
+ };
27
+ /** Version-pinned Modal control-plane boundary. Execution identity, output
28
+ * batches and exit status come from authenticated provider RPCs, never sandbox
29
+ * files or an SDK object's in-memory process map. Callers must store the
30
+ * returned locator/cursors outside the command's write authority. */
31
+ export declare class ModalCommandControl {
32
+ private readonly client;
33
+ private readonly sandboxIdentity;
34
+ private readonly root;
35
+ private readonly environment;
36
+ private constructor();
37
+ static forSandbox(client: CommandClient, sandboxId: string | (() => string), root: string, environment?: Record<string, string> | (() => Record<string, string>)): ModalCommandControl;
38
+ private get sandboxId();
39
+ start(args: ChannelAExecArgs, signal?: AbortSignal): Promise<ModalProviderCommand>;
40
+ read(command: ModalProviderCommand, yieldTimeMs: number, signal?: AbortSignal): Promise<ModalProviderOutputPage>;
41
+ /** Fixed internal probes own their cancellation controller and must drain
42
+ * both reads before relinquishing the surrounding provider-operation gate.
43
+ * Retained-command readers keep their existing signal/receipt contract.
44
+ */
45
+ readProbe(command: ModalProviderCommand, yieldTimeMs: number, cancellation: AbortController): Promise<ModalProviderOutputPage>;
46
+ private readOutput;
47
+ write(command: ModalProviderCommand, chars: string, messageIndex: number): Promise<void>;
48
+ private assertIdentity;
49
+ }
50
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { ModalCommandControl } from "./modal-command-control.js";
2
+ /** A fixed read-only probe, not an admitted user command. Advance its private
3
+ * provider cursor locally; never borrow the surrounding mutation's retained
4
+ * handle or relax retained-command persistence requirements. The caller keeps
5
+ * the original backend and provider-operation gate for the entire observation.
6
+ */
7
+ export declare function verifyModalMaterializedPath(control: Pick<ModalCommandControl, "start" | "readProbe">, path: string, workdir: string, pending: Set<AbortController>, observationTimeoutMs?: number): Promise<void>;
@@ -58,14 +58,6 @@ type ModalModule = typeof import("modal");
58
58
  type ModalClientLike = InstanceType<ModalModule["ModalClient"]>;
59
59
  /** Loader seam so unit tests can inject a fake modal module. */
60
60
  export type ModalModuleLoader = () => Promise<Pick<ModalModule, "ModalClient">>;
61
- /**
62
- * Resolve + cache the private-registry Modal image. No-op unless BOTH
63
- * `modalImageRef` and `modalImageRegistrySecret` are set. Memoized per
64
- * (imageRef, secret, environment) so it runs once per worker process. Awaited at
65
- * worker boot for the deployment-global image and at turn time for pack-scoped
66
- * images BEFORE the first sandbox using that ref is created; `build` then reads the
67
- * resolved image and otherwise falls back to the public `fromTag` path.
68
- */
69
61
  export declare function ensureModalRegistryImage(settings: Settings, loadModal?: ModalModuleLoader): Promise<void>;
70
62
  /**
71
63
  * Choose the image selector for a Modal sandbox client from settings. Returns:
@@ -1,6 +1,7 @@
1
1
  import type { ExposedPortEndpoint } from "../stream-port.js";
2
2
  import { type ProviderCommandPersistence, type ProviderCommandSession } from "../provider-command-session.js";
3
3
  import type { SandboxProviderCommand } from "@opengeni/contracts";
4
+ import { type MaterializationFailureReason } from "../materialization-verification-error.js";
4
5
  import type { ChannelAExecArgs, ChannelAExecResult, ChannelARoutedWorkspaceImportBatchRequest, ChannelARoutedWorkspaceImportRequest, WorkspaceFileImportReceipt } from "../channel-a.js";
5
6
  /** The per-session active-sandbox pointer the proxy re-reads on every op. Mirror
6
7
  * of `@opengeni/db`'s `ActiveSandboxPointer` (structural, so the leaf does not
@@ -42,6 +43,8 @@ export interface RoutableBackendSession extends ProviderCommandSession {
42
43
  pathExists?(path: string, runAs?: string): Promise<boolean>;
43
44
  viewImage?(args: unknown): Promise<unknown>;
44
45
  materializeEntry?(args: unknown): Promise<void>;
46
+ /** Provider-owned fixed read-only probe; never an agent command surface. */
47
+ verifyMaterializedPath?(path: string, workdir: string): Promise<void>;
45
48
  supportsPty?(): boolean;
46
49
  resolveExposedPort?(port: number): Promise<ExposedPortEndpoint>;
47
50
  serializeSessionState?(): Promise<unknown>;
@@ -109,6 +112,7 @@ export type RoutingRetainedProcessTerminalProof = {
109
112
  };
110
113
  export interface RoutingSandboxSessionDeps {
111
114
  providerCommandHandle?: (admission: unknown) => number | undefined;
115
+ providerSupervisionReady?: () => Promise<boolean>;
112
116
  providerCommandPersistence?: (process: RoutingRetainedProcess) => ProviderCommandPersistence;
113
117
  /**
114
118
  * The DEFAULT backend resolved at construction time (the same shape `resolve()`
@@ -148,6 +152,8 @@ export interface RoutingSandboxSessionDeps {
148
152
  * diagnostic only: callback failures are isolated and can never change the
149
153
  * provider result or durable mutation-settlement ordering. */
150
154
  onOperation?: RoutingSandboxOperationObserver;
155
+ /** Capture gates are not physical provider calls; observe every wait separately. */
156
+ onCaptureWait?: RoutingSandboxCaptureWaitObserver;
151
157
  /** Observe the first complete routed operation and only the subphases that
152
158
  * actually ran. Child durations are exclusive; capture waits are removed
153
159
  * from their enclosing admission/provider spans. */
@@ -238,8 +244,16 @@ export type RoutingSandboxOperationObservation = {
238
244
  op: string;
239
245
  outcome: "ok" | "not_found" | "failed";
240
246
  durationMs: number;
247
+ materializationFailureReason?: MaterializationFailureReason;
241
248
  };
242
249
  export type RoutingSandboxOperationObserver = (observation: RoutingSandboxOperationObservation) => void;
250
+ export type RoutingSandboxCaptureWaitObserver = (observation: {
251
+ backend: string;
252
+ op: string;
253
+ outcome: "ok" | "failed";
254
+ durationMs: number;
255
+ captureWaitStage: "admission" | "provider";
256
+ }) => void;
243
257
  export type RoutingSandboxPhaseOutcome = "completed" | "failed";
244
258
  export type RoutingSandboxWaitObservation = {
245
259
  durationMs: number;
@@ -351,6 +365,7 @@ export declare class RoutingSandboxSession implements RoutableBackendSession {
351
365
  private cachedEpoch;
352
366
  private cachedSandboxId;
353
367
  private cached;
368
+ private readonly homeResolutions;
354
369
  private lastResolved;
355
370
  /** Claimed synchronously before the first dispatch awaits, so concurrent
356
371
  * callers cannot emit duplicate first-operation observations. */
@@ -398,6 +413,7 @@ export declare class RoutingSandboxSession implements RoutableBackendSession {
398
413
  * is THE per-call re-read that makes a mid-turn swap land on the next op.
399
414
  */
400
415
  private resolve;
416
+ private resolvePointer;
401
417
  private invalidate;
402
418
  private registerRetainedProcess;
403
419
  private bindRetainedProviderCommand;
@@ -430,7 +446,11 @@ export declare class RoutingSandboxSession implements RoutableBackendSession {
430
446
  * race).
431
447
  */
432
448
  private dispatch;
449
+ /** Classify loss on the copied backend, including read-only preflight. This
450
+ * path never admits work or retries the failed operation on a new route. */
451
+ private throwProviderError;
433
452
  private dispatchWithRetries;
453
+ private observeCaptureWait;
434
454
  private invokeProviderOperation;
435
455
  /**
436
456
  * The failure-visibility boundary for the `exec_command` SDK capability tool — the
@@ -486,6 +506,7 @@ export declare class RoutingSandboxSession implements RoutableBackendSession {
486
506
  * the process backend and may prove terminal state, but never advance the
487
507
  * workspace generation. */
488
508
  writeStdinForProcessControl(args: unknown): Promise<string>;
509
+ cancelSupervisedCommand(providerSessionId: number, reason: "provider_deadline" | "explicit_stop"): Promise<boolean>;
489
510
  /** Empty-input eager reads belong to the model's foreground wait, while
490
511
  * cancellation/drain reads use the non-observing control method above. */
491
512
  writeStdinForProcessRead(args: unknown): Promise<string>;
@@ -17,6 +17,7 @@ type CommandCancellationSession = {
17
17
  retainedProcessIdentity?(providerSessionId: number): {
18
18
  id: string;
19
19
  } | null;
20
+ cancelSupervisedCommand?(providerSessionId: number, reason: "explicit_stop"): Promise<boolean>;
20
21
  writeStdinForProcessRead?(args: {
21
22
  sessionId: number;
22
23
  chars?: string;
@@ -88,12 +88,6 @@ export declare function readSkillLibraryArtifact(root: string): SkillLibraryArti
88
88
  * the same canonical path and whole-artifact digest rules.
89
89
  */
90
90
  export declare function buildPortableSkillArtifact(inputFiles: readonly SkillLibraryFile[]): PortableSkillArtifact;
91
- /**
92
- * Canonical whole-artifact identity for any validated runtime Skill shape.
93
- * This deliberately does not require frontmatter because legacy Pack/session
94
- * contracts historically allowed a top-level SKILL.md without metadata. The
95
- * content identity is nevertheless byte-exact and shared with portable imports.
96
- */
97
91
  export declare function skillArtifactContentSha256(inputFiles: readonly SkillLibraryFile[]): string;
98
92
  /** Verify a reviewed artifact against its immutable catalog digest. */
99
93
  export declare function verifySkillLibraryArtifact(root: string, expectedSha256: string, entry?: Pick<SkillLibraryEntry, "id" | "version">): SkillLibraryArtifact;
@@ -20,7 +20,7 @@ import {
20
20
  skillArtifactContentSha256,
21
21
  skillLibraryRepositoryUrl,
22
22
  verifySkillLibraryArtifact
23
- } from "./chunk-GB763TSV.js";
23
+ } from "./chunk-TE27J65Q.js";
24
24
  import "./chunk-PZ5AY32C.js";
25
25
  export {
26
26
  SKILL_MAX_FILES as PORTABLE_SKILL_MAX_FILES,
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  prepareAgentTools
3
- } from "./chunk-RIJ6DCYS.js";
4
- import "./chunk-46BFUGFL.js";
5
- import "./chunk-FHGLYLBL.js";
6
- import "./chunk-GB763TSV.js";
3
+ } from "./chunk-HCGLD7NH.js";
4
+ import "./chunk-WIHICNWS.js";
5
+ import "./chunk-SPT3PLMX.js";
6
+ import "./chunk-4A4XTKKX.js";
7
+ import "./chunk-ZG2YH25H.js";
8
+ import "./chunk-TE27J65Q.js";
7
9
  import "./chunk-UZ66CGC2.js";
8
- import "./chunk-UU6EJR52.js";
10
+ import "./chunk-YU4VRTR4.js";
9
11
  import "./chunk-UNICCRW5.js";
10
12
  import "./chunk-PZ5AY32C.js";
11
13
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/runtime",
3
- "version": "3.0.1",
3
+ "version": "4.0.0-canary.35585322809001",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -57,24 +57,26 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@alibaba-group/opensandbox": "0.1.11",
60
+ "@grpc/grpc-js": "1.14.4",
60
61
  "@modelcontextprotocol/sdk": "1.29.0",
61
62
  "@noble/hashes": "^1.8.0",
62
63
  "@openai/agents": "0.14.3",
63
64
  "@openai/agents-core": "0.14.3",
64
65
  "@openai/agents-extensions": "0.14.3",
65
- "@opengeni/agent-proto": "^0.6.0",
66
- "@opengeni/capabilities": "^0.3.4",
67
- "@opengeni/codemode": "^0.5.9",
68
- "@opengeni/codex": "^0.2.23",
69
- "@opengeni/config": "^1.2.2",
70
- "@opengeni/contracts": "^4.1.0",
71
- "@opengeni/network": "^0.3.1",
72
- "@opengeni/sdk": "^6.1.0",
73
- "@opengeni/tool-gateway": "^0.1.10",
74
- "@opengeni/xai-subscription": "^0.1.4",
66
+ "@opengeni/agent-proto": "^0.6.0-canary.35585322809001",
67
+ "@opengeni/capabilities": "^0.3.4-canary.35585322809001",
68
+ "@opengeni/codemode": "^0.6.0-canary.35585322809001",
69
+ "@opengeni/codex": "^0.2.24-canary.35585322809001",
70
+ "@opengeni/config": "^2.0.0-canary.35585322809001",
71
+ "@opengeni/contracts": "^5.0.0-canary.35585322809001",
72
+ "@opengeni/network": "^0.3.1-canary.35585322809001",
73
+ "@opengeni/sdk": "^7.0.0-canary.35585322809001",
74
+ "@opengeni/tool-gateway": "^0.1.11-canary.35585322809001",
75
+ "@opengeni/xai-subscription": "^0.1.4-canary.35585322809001",
75
76
  "debug": "4.4.3",
76
77
  "modal": "0.9.0",
77
78
  "openai": "6.47.0",
79
+ "protobufjs": "7.6.5",
78
80
  "ws": "8.21.1",
79
81
  "zod": "4.4.3"
80
82
  }
@@ -10,6 +10,14 @@ live object the user sees in the Artifacts dock and full editor. Never create a
10
10
  mutable DOCX shadow, publish a sandbox file, or alternate between file and
11
11
  artifact state.
12
12
 
13
+ This also applies when a report is a secondary output of another task, such as
14
+ a Knowledge cleanup audit. Declare the report through the available goal tools
15
+ before authoring; if the task has no goal and goal tools are available, create
16
+ one with the report requirement. If a goal already exists, append the report
17
+ requirement without replacing the standing objective. Ordinary chat answers,
18
+ brief progress updates, internal worker findings, code navigation and explicitly requested local-file
19
+ work are not report deliverables.
20
+
13
21
  Read [references/api.md](references/api.md) before editing.
14
22
  When using `skill_read`, request that relative path from this Skill; reading
15
23
  does not materialize a local folder. Use an existing local copy only when the
@@ -63,8 +71,19 @@ Skill was installed or explicitly checked out to the filesystem.
63
71
 
64
72
  ## Completion gate
65
73
 
74
+ - Every declared report requirement has server-verified artifact delivery
75
+ evidence at goal completion. Use the exact artifact and inspection identities
76
+ returned by the tools, not a boolean assertion or an invented reference.
66
77
  - The requested result exists in the durable artifact, not merely a local file.
67
78
  - Relevant structure and review annotations were inspected after the final edit.
79
+ - Report completion needs a final `body` inspection receipt; `summary` alone
80
+ does not qualify. Inspect all relevant pages and annotations as needed; the
81
+ receipt proves the bounded query, not exhaustive review or semantic quality.
68
82
  - Any requested export completed and its `fileId`, format, and pinned source
69
83
  head were reported.
70
84
  - The user can continue from the same document in the session Artifacts dock.
85
+ - Include the returned artifact reference in the handoff. A sandbox path, raw
86
+ file ID, or separately published Markdown/DOCX file does not replace the native
87
+ document. If creation, inspection, authorization or delivery fails, retain the
88
+ unfinished requirement and state the concrete blocker; do not silently fall
89
+ back to a sandbox report or claim delivery succeeded.
@@ -17,6 +17,28 @@ automatically.
17
17
  For a direct `opengeni__editable_artifact_inspect` call, pass the query below as
18
18
  `request`, alongside `artifactId` and `modality: "document"`.
19
19
 
20
+ ## Report requirements and inspection evidence
21
+
22
+ For a report deliverable, declare `reportRequirements: [{ id: "audit", title:
23
+ "Knowledge organization audit" }]` through `goal_set` when creating a goal, or
24
+ through `goal_progress` alongside its progress note and idempotency key for an
25
+ existing active goal. Keep requirement IDs stable; do not replace the objective
26
+ merely to add a report. Ordinary answers and internal worker findings need no
27
+ report requirement.
28
+
29
+ After the final edit, inspect the relevant document body using a `body` query;
30
+ a `summary` query alone does not satisfy report completion. Inspect additional
31
+ pages and annotations as needed—the receipt proves only the bounded query, not
32
+ exhaustive review or content quality. The direct result
33
+ and `document.inspect(...)` return `inspectionReceiptId` when the server records
34
+ verified document inspection. Pass `reportDeliveries: [{ requirementId: "audit",
35
+ artifactId: document.id, inspectionReceiptId }]` with the completion evidence to
36
+ `goal_complete`. Missing proof is not a successful delivery; never fabricate it.
37
+ If the document changes, inspect it again and use the new receipt. Include the
38
+ returned artifact reference in the user handoff.
39
+
40
+ ## Authoring example
41
+
20
42
  ```js
21
43
  import { openGeni } from "@opengeni/codemode";
22
44