@mutagent/sdk 0.3.40 → 0.3.42
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.
- package/README.md +14 -8
- package/dist/commonjs/funcs/sandbox-get-api-sandbox-by-id-checkpoints.d.ts +18 -0
- package/dist/commonjs/funcs/sandbox-get-api-sandbox-by-id-checkpoints.d.ts.map +1 -0
- package/dist/commonjs/funcs/sandbox-get-api-sandbox-by-id-checkpoints.js +124 -0
- package/dist/commonjs/funcs/sandbox-get-api-sandbox-by-id-checkpoints.js.map +1 -0
- package/dist/commonjs/funcs/sandbox-get-api-sandbox-by-id-stream.d.ts +1 -1
- package/dist/commonjs/funcs/sandbox-get-api-sandbox-by-id-stream.js +1 -1
- package/dist/commonjs/funcs/sandbox-post-api-sandbox-by-id-checkpoint.d.ts +18 -0
- package/dist/commonjs/funcs/sandbox-post-api-sandbox-by-id-checkpoint.d.ts.map +1 -0
- package/dist/commonjs/funcs/sandbox-post-api-sandbox-by-id-checkpoint.js +125 -0
- package/dist/commonjs/funcs/sandbox-post-api-sandbox-by-id-checkpoint.js.map +1 -0
- package/dist/commonjs/funcs/sandbox-post-api-sandbox-by-id-restore.d.ts +18 -0
- package/dist/commonjs/funcs/sandbox-post-api-sandbox-by-id-restore.d.ts.map +1 -0
- package/dist/commonjs/funcs/sandbox-post-api-sandbox-by-id-restore.js +125 -0
- package/dist/commonjs/funcs/sandbox-post-api-sandbox-by-id-restore.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/definition-provider.d.ts +35 -0
- package/dist/commonjs/models/definition-provider.d.ts.map +1 -1
- package/dist/commonjs/models/definition-provider.js +21 -1
- package/dist/commonjs/models/definition-provider.js.map +1 -1
- package/dist/commonjs/models/index.d.ts +5 -3
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +5 -3
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/mode-arm-args.d.ts +62 -0
- package/dist/commonjs/models/mode-arm-args.d.ts.map +1 -0
- package/dist/commonjs/models/mode-arm-args.js +64 -0
- package/dist/commonjs/models/mode-arm-args.js.map +1 -0
- package/dist/commonjs/models/name-image-arch.d.ts +35 -0
- package/dist/commonjs/models/name-image-arch.d.ts.map +1 -1
- package/dist/commonjs/models/name-image-arch.js +21 -1
- package/dist/commonjs/models/name-image-arch.js.map +1 -1
- package/dist/commonjs/models/operations/get-api-sandbox-by-id-checkpoints.d.ts +38 -0
- package/dist/commonjs/models/operations/get-api-sandbox-by-id-checkpoints.d.ts.map +1 -0
- package/dist/commonjs/models/operations/get-api-sandbox-by-id-checkpoints.js +74 -0
- package/dist/commonjs/models/operations/get-api-sandbox-by-id-checkpoints.js.map +1 -0
- package/dist/commonjs/models/operations/get-api-sandbox-by-id.d.ts +1 -1
- package/dist/commonjs/models/operations/get-api-sandbox-by-id.js +1 -1
- package/dist/commonjs/models/operations/get-api-sandbox.d.ts +1 -1
- package/dist/commonjs/models/operations/get-api-sandbox.js +1 -1
- package/dist/commonjs/models/operations/index.d.ts +3 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +3 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/post-api-sandbox-by-id-checkpoint.d.ts +83 -0
- package/dist/commonjs/models/operations/post-api-sandbox-by-id-checkpoint.d.ts.map +1 -0
- package/dist/commonjs/models/operations/post-api-sandbox-by-id-checkpoint.js +77 -0
- package/dist/commonjs/models/operations/post-api-sandbox-by-id-checkpoint.js.map +1 -0
- package/dist/commonjs/models/operations/post-api-sandbox-by-id-restore.d.ts +151 -0
- package/dist/commonjs/models/operations/post-api-sandbox-by-id-restore.d.ts.map +1 -0
- package/dist/commonjs/models/operations/post-api-sandbox-by-id-restore.js +121 -0
- package/dist/commonjs/models/operations/post-api-sandbox-by-id-restore.js.map +1 -0
- package/dist/commonjs/models/operations/post-api-sandbox-by-id-session.d.ts +7 -3
- package/dist/commonjs/models/operations/post-api-sandbox-by-id-session.d.ts.map +1 -1
- package/dist/commonjs/models/operations/post-api-sandbox-by-id-session.js +3 -2
- package/dist/commonjs/models/operations/post-api-sandbox-by-id-session.js.map +1 -1
- package/dist/commonjs/models/operations/post-api-sandbox.d.ts +1 -1
- package/dist/commonjs/models/operations/post-api-sandbox.js +1 -1
- package/dist/commonjs/models/operations/update-organization-member.d.ts +1 -1
- package/dist/commonjs/models/operations/update-organization-member.js +1 -1
- package/dist/commonjs/models/operations/update-workspace-member.d.ts +1 -1
- package/dist/commonjs/models/operations/update-workspace-member.d.ts.map +1 -1
- package/dist/commonjs/models/operations/update-workspace-member.js +1 -1
- package/dist/commonjs/models/operations/update-workspace-member.js.map +1 -1
- package/dist/commonjs/models/preset-timeout-ms-keep2.d.ts +10 -0
- package/dist/commonjs/models/preset-timeout-ms-keep2.d.ts.map +1 -1
- package/dist/commonjs/models/preset-timeout-ms-keep2.js +2 -0
- package/dist/commonjs/models/preset-timeout-ms-keep2.js.map +1 -1
- package/dist/commonjs/models/schemadefaul11.d.ts +9 -0
- package/dist/commonjs/models/schemadefaul11.d.ts.map +1 -0
- package/dist/commonjs/models/{schemadefaul8.js → schemadefaul11.js} +9 -9
- package/dist/commonjs/models/schemadefaul11.js.map +1 -0
- package/dist/commonjs/models/schemadefaul5.d.ts +7 -4
- package/dist/commonjs/models/schemadefaul5.d.ts.map +1 -1
- package/dist/commonjs/models/schemadefaul5.js +8 -5
- package/dist/commonjs/models/schemadefaul5.js.map +1 -1
- package/dist/commonjs/models/schemadefaul6.d.ts +7 -5
- package/dist/commonjs/models/schemadefaul6.d.ts.map +1 -1
- package/dist/commonjs/models/schemadefaul6.js +7 -7
- package/dist/commonjs/models/schemadefaul6.js.map +1 -1
- package/dist/commonjs/models/schemadefaul7.d.ts +13 -0
- package/dist/commonjs/models/schemadefaul7.d.ts.map +1 -0
- package/dist/commonjs/models/{schemadefaul4.js → schemadefaul7.js} +11 -13
- package/dist/commonjs/models/schemadefaul7.js.map +1 -0
- package/dist/commonjs/models/schemadefaul9.d.ts +10 -0
- package/dist/commonjs/models/schemadefaul9.d.ts.map +1 -0
- package/dist/commonjs/models/{mode-args-env.js → schemadefaul9.js} +10 -13
- package/dist/commonjs/models/schemadefaul9.js.map +1 -0
- package/dist/commonjs/models/snapshot-id-definition-partial.d.ts +40 -0
- package/dist/commonjs/models/snapshot-id-definition-partial.d.ts.map +1 -0
- package/dist/commonjs/models/snapshot-id-definition-partial.js +63 -0
- package/dist/commonjs/models/snapshot-id-definition-partial.js.map +1 -0
- package/dist/commonjs/sdk/sandbox.d.ts +34 -13
- package/dist/commonjs/sdk/sandbox.d.ts.map +1 -1
- package/dist/commonjs/sdk/sandbox.js +47 -17
- package/dist/commonjs/sdk/sandbox.js.map +1 -1
- package/dist/esm/funcs/sandbox-get-api-sandbox-by-id-checkpoints.d.ts +18 -0
- package/dist/esm/funcs/sandbox-get-api-sandbox-by-id-checkpoints.d.ts.map +1 -0
- package/dist/esm/funcs/sandbox-get-api-sandbox-by-id-checkpoints.js +88 -0
- package/dist/esm/funcs/sandbox-get-api-sandbox-by-id-checkpoints.js.map +1 -0
- package/dist/esm/funcs/sandbox-get-api-sandbox-by-id-stream.d.ts +1 -1
- package/dist/esm/funcs/sandbox-get-api-sandbox-by-id-stream.js +1 -1
- package/dist/esm/funcs/sandbox-post-api-sandbox-by-id-checkpoint.d.ts +18 -0
- package/dist/esm/funcs/sandbox-post-api-sandbox-by-id-checkpoint.d.ts.map +1 -0
- package/dist/esm/funcs/sandbox-post-api-sandbox-by-id-checkpoint.js +89 -0
- package/dist/esm/funcs/sandbox-post-api-sandbox-by-id-checkpoint.js.map +1 -0
- package/dist/esm/funcs/sandbox-post-api-sandbox-by-id-restore.d.ts +18 -0
- package/dist/esm/funcs/sandbox-post-api-sandbox-by-id-restore.d.ts.map +1 -0
- package/dist/esm/funcs/sandbox-post-api-sandbox-by-id-restore.js +89 -0
- package/dist/esm/funcs/sandbox-post-api-sandbox-by-id-restore.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/definition-provider.d.ts +35 -0
- package/dist/esm/models/definition-provider.d.ts.map +1 -1
- package/dist/esm/models/definition-provider.js +19 -0
- package/dist/esm/models/definition-provider.js.map +1 -1
- package/dist/esm/models/index.d.ts +5 -3
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +5 -3
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/mode-arm-args.d.ts +62 -0
- package/dist/esm/models/mode-arm-args.d.ts.map +1 -0
- package/dist/esm/models/mode-arm-args.js +26 -0
- package/dist/esm/models/mode-arm-args.js.map +1 -0
- package/dist/esm/models/name-image-arch.d.ts +35 -0
- package/dist/esm/models/name-image-arch.d.ts.map +1 -1
- package/dist/esm/models/name-image-arch.js +19 -0
- package/dist/esm/models/name-image-arch.js.map +1 -1
- package/dist/esm/models/operations/get-api-sandbox-by-id-checkpoints.d.ts +38 -0
- package/dist/esm/models/operations/get-api-sandbox-by-id-checkpoints.d.ts.map +1 -0
- package/dist/esm/models/operations/get-api-sandbox-by-id-checkpoints.js +35 -0
- package/dist/esm/models/operations/get-api-sandbox-by-id-checkpoints.js.map +1 -0
- package/dist/esm/models/operations/get-api-sandbox-by-id.d.ts +1 -1
- package/dist/esm/models/operations/get-api-sandbox-by-id.js +1 -1
- package/dist/esm/models/operations/get-api-sandbox.d.ts +1 -1
- package/dist/esm/models/operations/get-api-sandbox.js +1 -1
- package/dist/esm/models/operations/index.d.ts +3 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +3 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/post-api-sandbox-by-id-checkpoint.d.ts +83 -0
- package/dist/esm/models/operations/post-api-sandbox-by-id-checkpoint.d.ts.map +1 -0
- package/dist/esm/models/operations/post-api-sandbox-by-id-checkpoint.js +38 -0
- package/dist/esm/models/operations/post-api-sandbox-by-id-checkpoint.js.map +1 -0
- package/dist/esm/models/operations/post-api-sandbox-by-id-restore.d.ts +151 -0
- package/dist/esm/models/operations/post-api-sandbox-by-id-restore.d.ts.map +1 -0
- package/dist/esm/models/operations/post-api-sandbox-by-id-restore.js +80 -0
- package/dist/esm/models/operations/post-api-sandbox-by-id-restore.js.map +1 -0
- package/dist/esm/models/operations/post-api-sandbox-by-id-session.d.ts +7 -3
- package/dist/esm/models/operations/post-api-sandbox-by-id-session.d.ts.map +1 -1
- package/dist/esm/models/operations/post-api-sandbox-by-id-session.js +3 -2
- package/dist/esm/models/operations/post-api-sandbox-by-id-session.js.map +1 -1
- package/dist/esm/models/operations/post-api-sandbox.d.ts +1 -1
- package/dist/esm/models/operations/post-api-sandbox.js +1 -1
- package/dist/esm/models/operations/update-organization-member.d.ts +1 -1
- package/dist/esm/models/operations/update-organization-member.js +1 -1
- package/dist/esm/models/operations/update-workspace-member.d.ts +1 -1
- package/dist/esm/models/operations/update-workspace-member.d.ts.map +1 -1
- package/dist/esm/models/operations/update-workspace-member.js +1 -1
- package/dist/esm/models/operations/update-workspace-member.js.map +1 -1
- package/dist/esm/models/preset-timeout-ms-keep2.d.ts +10 -0
- package/dist/esm/models/preset-timeout-ms-keep2.d.ts.map +1 -1
- package/dist/esm/models/preset-timeout-ms-keep2.js +2 -0
- package/dist/esm/models/preset-timeout-ms-keep2.js.map +1 -1
- package/dist/esm/models/schemadefaul11.d.ts +9 -0
- package/dist/esm/models/schemadefaul11.d.ts.map +1 -0
- package/dist/esm/models/schemadefaul11.js +13 -0
- package/dist/esm/models/schemadefaul11.js.map +1 -0
- package/dist/esm/models/schemadefaul5.d.ts +7 -4
- package/dist/esm/models/schemadefaul5.d.ts.map +1 -1
- package/dist/esm/models/schemadefaul5.js +7 -4
- package/dist/esm/models/schemadefaul5.js.map +1 -1
- package/dist/esm/models/schemadefaul6.d.ts +7 -5
- package/dist/esm/models/schemadefaul6.d.ts.map +1 -1
- package/dist/esm/models/schemadefaul6.js +6 -6
- package/dist/esm/models/schemadefaul6.js.map +1 -1
- package/dist/esm/models/schemadefaul7.d.ts +13 -0
- package/dist/esm/models/schemadefaul7.d.ts.map +1 -0
- package/dist/esm/models/schemadefaul7.js +15 -0
- package/dist/esm/models/schemadefaul7.js.map +1 -0
- package/dist/esm/models/schemadefaul9.d.ts +10 -0
- package/dist/esm/models/schemadefaul9.d.ts.map +1 -0
- package/dist/esm/models/schemadefaul9.js +14 -0
- package/dist/esm/models/schemadefaul9.js.map +1 -0
- package/dist/esm/models/snapshot-id-definition-partial.d.ts +40 -0
- package/dist/esm/models/snapshot-id-definition-partial.d.ts.map +1 -0
- package/dist/esm/models/snapshot-id-definition-partial.js +26 -0
- package/dist/esm/models/snapshot-id-definition-partial.js.map +1 -0
- package/dist/esm/sdk/sandbox.d.ts +34 -13
- package/dist/esm/sdk/sandbox.d.ts.map +1 -1
- package/dist/esm/sdk/sandbox.js +47 -17
- package/dist/esm/sdk/sandbox.js.map +1 -1
- package/package.json +1 -1
- package/src/funcs/sandbox-get-api-sandbox-by-id-checkpoints.ts +184 -0
- package/src/funcs/sandbox-get-api-sandbox-by-id-stream.ts +1 -1
- package/src/funcs/sandbox-post-api-sandbox-by-id-checkpoint.ts +186 -0
- package/src/funcs/sandbox-post-api-sandbox-by-id-restore.ts +186 -0
- package/src/lib/config.ts +2 -2
- package/src/models/definition-provider.ts +59 -0
- package/src/models/index.ts +5 -3
- package/src/models/mode-arm-args.ts +100 -0
- package/src/models/name-image-arch.ts +59 -0
- package/src/models/operations/get-api-sandbox-by-id-checkpoints.ts +97 -0
- package/src/models/operations/get-api-sandbox-by-id.ts +3 -3
- package/src/models/operations/get-api-sandbox.ts +3 -3
- package/src/models/operations/index.ts +3 -0
- package/src/models/operations/post-api-sandbox-by-id-checkpoint.ts +151 -0
- package/src/models/operations/post-api-sandbox-by-id-restore.ts +263 -0
- package/src/models/operations/post-api-sandbox-by-id-session.ts +14 -6
- package/src/models/operations/post-api-sandbox.ts +3 -3
- package/src/models/operations/update-organization-member.ts +3 -3
- package/src/models/operations/update-workspace-member.ts +3 -3
- package/src/models/preset-timeout-ms-keep2.ts +12 -0
- package/src/models/{schemadefaul8.ts → schemadefaul11.ts} +4 -3
- package/src/models/schemadefaul5.ts +7 -7
- package/src/models/schemadefaul6.ts +14 -6
- package/src/models/schemadefaul7.ts +25 -0
- package/src/models/schemadefaul9.ts +16 -0
- package/src/models/snapshot-id-definition-partial.ts +70 -0
- package/src/sdk/sandbox.ts +82 -28
- package/dist/commonjs/models/mode-args-env.d.ts +0 -35
- package/dist/commonjs/models/mode-args-env.d.ts.map +0 -1
- package/dist/commonjs/models/mode-args-env.js.map +0 -1
- package/dist/commonjs/models/schemadefaul4.d.ts +0 -15
- package/dist/commonjs/models/schemadefaul4.d.ts.map +0 -1
- package/dist/commonjs/models/schemadefaul4.js.map +0 -1
- package/dist/commonjs/models/schemadefaul8.d.ts +0 -9
- package/dist/commonjs/models/schemadefaul8.d.ts.map +0 -1
- package/dist/commonjs/models/schemadefaul8.js.map +0 -1
- package/dist/esm/models/mode-args-env.d.ts +0 -35
- package/dist/esm/models/mode-args-env.d.ts.map +0 -1
- package/dist/esm/models/mode-args-env.js +0 -16
- package/dist/esm/models/mode-args-env.js.map +0 -1
- package/dist/esm/models/schemadefaul4.d.ts +0 -15
- package/dist/esm/models/schemadefaul4.d.ts.map +0 -1
- package/dist/esm/models/schemadefaul4.js +0 -17
- package/dist/esm/models/schemadefaul4.js.map +0 -1
- package/dist/esm/models/schemadefaul8.d.ts +0 -9
- package/dist/esm/models/schemadefaul8.d.ts.map +0 -1
- package/dist/esm/models/schemadefaul8.js +0 -13
- package/dist/esm/models/schemadefaul8.js.map +0 -1
- package/src/models/mode-args-env.ts +0 -52
- package/src/models/schemadefaul4.ts +0 -24
package/dist/esm/sdk/sandbox.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
import { sandboxDeleteApiSandboxById } from "../funcs/sandbox-delete-api-sandbox-by-id.js";
|
|
5
|
+
import { sandboxGetApiSandboxByIdCheckpoints } from "../funcs/sandbox-get-api-sandbox-by-id-checkpoints.js";
|
|
5
6
|
import { sandboxGetApiSandboxByIdSessions } from "../funcs/sandbox-get-api-sandbox-by-id-sessions.js";
|
|
6
7
|
import { sandboxGetApiSandboxByIdStream } from "../funcs/sandbox-get-api-sandbox-by-id-stream.js";
|
|
7
8
|
import { sandboxGetApiSandboxByIdTraces } from "../funcs/sandbox-get-api-sandbox-by-id-traces.js";
|
|
@@ -10,8 +11,10 @@ import { sandboxGetApiSandboxPresets } from "../funcs/sandbox-get-api-sandbox-pr
|
|
|
10
11
|
import { sandboxGetApiSandboxProviders } from "../funcs/sandbox-get-api-sandbox-providers.js";
|
|
11
12
|
import { sandboxGetApiSandbox } from "../funcs/sandbox-get-api-sandbox.js";
|
|
12
13
|
import { sandboxPostApiSandboxAgentRun } from "../funcs/sandbox-post-api-sandbox-agent-run.js";
|
|
14
|
+
import { sandboxPostApiSandboxByIdCheckpoint } from "../funcs/sandbox-post-api-sandbox-by-id-checkpoint.js";
|
|
13
15
|
import { sandboxPostApiSandboxByIdExec } from "../funcs/sandbox-post-api-sandbox-by-id-exec.js";
|
|
14
16
|
import { sandboxPostApiSandboxByIdInput } from "../funcs/sandbox-post-api-sandbox-by-id-input.js";
|
|
17
|
+
import { sandboxPostApiSandboxByIdRestore } from "../funcs/sandbox-post-api-sandbox-by-id-restore.js";
|
|
15
18
|
import { sandboxPostApiSandboxByIdSession } from "../funcs/sandbox-post-api-sandbox-by-id-session.js";
|
|
16
19
|
import { sandboxPostApiSandboxByIdSignal } from "../funcs/sandbox-post-api-sandbox-by-id-signal.js";
|
|
17
20
|
import { sandboxPostApiSandboxPreflight } from "../funcs/sandbox-post-api-sandbox-preflight.js";
|
|
@@ -58,15 +61,6 @@ export class Sandbox extends ClientSDK {
|
|
|
58
61
|
async postApiSandboxRun(request, options) {
|
|
59
62
|
return unwrapAsync(sandboxPostApiSandboxRun(this, request, options));
|
|
60
63
|
}
|
|
61
|
-
/**
|
|
62
|
-
* Run one agent turn in a fresh sandbox
|
|
63
|
-
*
|
|
64
|
-
* @remarks
|
|
65
|
-
* `prompt` is WHO the agent is (the agent definition) and `task` is WHAT to do this turn. They are two different prompts and are never concatenated. The turn's output comes back on stdout with the agent's real exit code. With `?stream=1` the same turn is delivered as it happens, in the event framing of `GET /:id/stream`: a `sandbox` event naming the box, then `stdout`/`stderr` as the agent produces them, then a `result` event carrying the exit code and whether the sandbox was torn down, then the terminal `status`. Disconnecting mid-stream releases the sandbox.
|
|
66
|
-
*/
|
|
67
|
-
async postApiSandboxAgentRun(request, options) {
|
|
68
|
-
return unwrapAsync(sandboxPostApiSandboxAgentRun(this, request, options));
|
|
69
|
-
}
|
|
70
64
|
/**
|
|
71
65
|
* Spawn a sandbox
|
|
72
66
|
*
|
|
@@ -104,7 +98,7 @@ export class Sandbox extends ClientSDK {
|
|
|
104
98
|
* Watch a sandbox's output live
|
|
105
99
|
*
|
|
106
100
|
* @remarks
|
|
107
|
-
* Server-sent events: `stdout`, `stderr`, `rpc`, `unrecognised`, `status`, `ping` (every 15s), `error`. `rpc` carries one complete NDJSON frame from a Helix session running in RPC mode, verbatim — parse it client-side. `unrecognised` carries a line the backend could not classify; receiving one means this server and the sandbox image disagree about the protocol, and it is forwarded rather than dropped so that drift is visible instead of silent.
|
|
101
|
+
* Server-sent events: `stdout`, `stderr`, `rpc`, `unrecognised`, `session`, `live`, `status`, `ping` (every 15s), `error`. `rpc` carries one complete NDJSON frame from a Helix session running in RPC mode, verbatim — parse it client-side. `unrecognised` carries a line the backend could not classify; receiving one means this server and the sandbox image disagree about the protocol, and it is forwarded rather than dropped so that drift is visible instead of silent. Those four output events share the `{seq, ts, text}` shape and one sequence counter, so their interleaving is the order the box produced them. `session` shares that counter too but carries flat fields instead of `text` — `{sessionId, status: "started"|"exited", exitCode, lastSeq, generation}` — and is how a client learns a Helix session began or ended; it is persisted and replayed like any output event, and `exitCode` is the session's real code (the terminal `status` event describes the SANDBOX and reports null by contract). `live` is emitted at most once, before the opening `status`, and only when this instance cannot follow the sandbox: it replays the log and ends rather than tailing. `seq` is monotonic per sandbox and starts at 1, and every seq-bearing event also carries it as the SSE `id:` field; pass the last one seen as `?since=` to resume. A resume is served from the persisted event log first and the live buffer only for the tail, so it survives a restart and can be answered by an instance that never spawned the box. If the requested range has been TRIMMED from that log, an `error` event names the lost range rather than skipping it silently — it carries `code: 'gap'` with the inclusive `from`/`to` wire seqs, and the stream continues past the gap; a source failure instead carries `code: 'upstream'` and is the end of the stream. Branch on `code`, never on `message`. Disconnecting tears down the upstream.
|
|
108
102
|
*/
|
|
109
103
|
async getApiSandboxByIdStream(request, options) {
|
|
110
104
|
return unwrapAsync(sandboxGetApiSandboxByIdStream(this, request, options));
|
|
@@ -118,6 +112,21 @@ export class Sandbox extends ClientSDK {
|
|
|
118
112
|
async postApiSandboxByIdExec(request, options) {
|
|
119
113
|
return unwrapAsync(sandboxPostApiSandboxByIdExec(this, request, options));
|
|
120
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Ingest OTLP spans from inside a sandbox
|
|
117
|
+
*
|
|
118
|
+
* @remarks
|
|
119
|
+
* OTLP/HTTP JSON. Requires a task token; spans are attributed to the sandbox the token is bound to, never to the sandbox named in the payload.
|
|
120
|
+
*/
|
|
121
|
+
async postApiSandboxTelemetryV1Traces(options) {
|
|
122
|
+
return unwrapAsync(sandboxPostApiSandboxTelemetryV1Traces(this, options));
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Read a sandbox's captured spans
|
|
126
|
+
*/
|
|
127
|
+
async getApiSandboxByIdTraces(request, options) {
|
|
128
|
+
return unwrapAsync(sandboxGetApiSandboxByIdTraces(this, request, options));
|
|
129
|
+
}
|
|
121
130
|
/**
|
|
122
131
|
* Start a Helix session in a sandbox
|
|
123
132
|
*
|
|
@@ -155,19 +164,40 @@ export class Sandbox extends ClientSDK {
|
|
|
155
164
|
return unwrapAsync(sandboxPostApiSandboxByIdSignal(this, request, options));
|
|
156
165
|
}
|
|
157
166
|
/**
|
|
158
|
-
*
|
|
167
|
+
* Capture a Helix session's own transcript
|
|
159
168
|
*
|
|
160
169
|
* @remarks
|
|
161
|
-
*
|
|
170
|
+
* Copies the HARNESS's session file off the box, verbatim, and stores it. This is what a NEW box needs to CONTINUE the conversation — distinct from `GET /:id/stream?since=`, which replays what the client observed and restores no agent state at all. 409 when the session has not completed a turn: the harness writes its file lazily, so there is genuinely nothing to capture yet, and storing an empty snapshot would produce a restore that succeeds and restores nothing. 503 when the deployment has no snapshot store.
|
|
162
171
|
*/
|
|
163
|
-
async
|
|
164
|
-
return unwrapAsync(
|
|
172
|
+
async postApiSandboxByIdCheckpoint(request, options) {
|
|
173
|
+
return unwrapAsync(sandboxPostApiSandboxByIdCheckpoint(this, request, options));
|
|
165
174
|
}
|
|
166
175
|
/**
|
|
167
|
-
*
|
|
176
|
+
* List checkpoints captured from this sandbox
|
|
177
|
+
*
|
|
178
|
+
* @remarks
|
|
179
|
+
* Newest first, tenant-scoped, WITHOUT the stored bytes. `messageCount` is how much conversation each one holds.
|
|
168
180
|
*/
|
|
169
|
-
async
|
|
170
|
-
return unwrapAsync(
|
|
181
|
+
async getApiSandboxByIdCheckpoints(request, options) {
|
|
182
|
+
return unwrapAsync(sandboxGetApiSandboxByIdCheckpoints(this, request, options));
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Rebuild this sandbox from a checkpoint, with full state
|
|
186
|
+
*
|
|
187
|
+
* @remarks
|
|
188
|
+
* A cloud equivalent of a local `/resume`, and it does NOT require the old box to still exist — a reaped or torn-down sandbox is the ordinary input. In order: a fresh box is spawned for the SAME sandbox id at generation+1 with the same secret NAMES (values are re-minted, never stored); the relay's seq counter is seeded from the persisted high-water mark so a client's `?since=` cursor stays valid; the workspace and `$HOME/.mutagent` are extracted BEFORE Helix starts; a session is started in the checkpoint's cwd; the conversation is written in, its sha256 compared against the box's own, and only then switched onto; the runtime settings and pending queue are replayed; and a `session {status:"restored"}` frame is appended to the stream with a real seq. A digest mismatch is a 422 and the session is NOT switched. 404 if the snapshot is not in this workspace. Read `notRestored` — a restore that carried only the conversation is legitimate and says so there. A DEFAULTED restore uses the newest checkpoint that has a manifest and lists newer rows it passed over in `skippedSnapshots`. `partial: true` restores the incremental transcript prefix beyond the checkpoint when one exists (the frame then carries `partial: true`); its tail may end on a tool call with no result, which the harness answers with a synthetic error on the next turn — the accepted risk of asking for it.
|
|
189
|
+
*/
|
|
190
|
+
async postApiSandboxByIdRestore(request, options) {
|
|
191
|
+
return unwrapAsync(sandboxPostApiSandboxByIdRestore(this, request, options));
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Run one agent turn in a fresh sandbox
|
|
195
|
+
*
|
|
196
|
+
* @remarks
|
|
197
|
+
* `prompt` is WHO the agent is (the agent definition) and `task` is WHAT to do this turn. They are two different prompts and are never concatenated. The turn's output comes back on stdout with the agent's real exit code. With `?stream=1` the same turn is delivered as it happens, in the event framing of `GET /:id/stream`: a `sandbox` event naming the box, then `stdout`/`stderr` as the agent produces them, then a `result` event carrying the exit code and whether the sandbox was torn down, then the terminal `status`. Disconnecting mid-stream releases the sandbox.
|
|
198
|
+
*/
|
|
199
|
+
async postApiSandboxAgentRun(request, options) {
|
|
200
|
+
return unwrapAsync(sandboxPostApiSandboxAgentRun(this, request, options));
|
|
171
201
|
}
|
|
172
202
|
/**
|
|
173
203
|
* Exchange a platform API key for a sandbox operator token
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../../../src/sdk/sandbox.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EAA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,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,mBAAmB,CACvB,OAA8C,EAC9C,OAAwB;QAExB,OAAO,WAAW,CAAC,0BAA0B,CAC3C,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { MutagentCore } from "../core.js";
|
|
7
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
8
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
9
|
+
import * as M from "../lib/matchers.js";
|
|
10
|
+
import { compactMap } from "../lib/primitives.js";
|
|
11
|
+
import { safeParse } from "../lib/schemas.js";
|
|
12
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
13
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
14
|
+
import { pathToFunc } from "../lib/url.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/http-client-errors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { MutagentError } from "../models/errors/mutagent-error.js";
|
|
24
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
26
|
+
import * as operations from "../models/operations/index.js";
|
|
27
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
28
|
+
import { Result } from "../types/fp.js";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* List checkpoints captured from this sandbox
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Newest first, tenant-scoped, WITHOUT the stored bytes. `messageCount` is how much conversation each one holds.
|
|
35
|
+
*/
|
|
36
|
+
export function sandboxGetApiSandboxByIdCheckpoints(
|
|
37
|
+
client: MutagentCore,
|
|
38
|
+
request: operations.GetApiSandboxByIdCheckpointsRequest,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): APIPromise<
|
|
41
|
+
Result<
|
|
42
|
+
operations.GetApiSandboxByIdCheckpointsResponse,
|
|
43
|
+
| errors.ErrorMessage
|
|
44
|
+
| errors.ErrorMessageStatusCode
|
|
45
|
+
| MutagentError
|
|
46
|
+
| ResponseValidationError
|
|
47
|
+
| ConnectionError
|
|
48
|
+
| RequestAbortedError
|
|
49
|
+
| RequestTimeoutError
|
|
50
|
+
| InvalidRequestError
|
|
51
|
+
| UnexpectedClientError
|
|
52
|
+
| SDKValidationError
|
|
53
|
+
>
|
|
54
|
+
> {
|
|
55
|
+
return new APIPromise($do(
|
|
56
|
+
client,
|
|
57
|
+
request,
|
|
58
|
+
options,
|
|
59
|
+
));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function $do(
|
|
63
|
+
client: MutagentCore,
|
|
64
|
+
request: operations.GetApiSandboxByIdCheckpointsRequest,
|
|
65
|
+
options?: RequestOptions,
|
|
66
|
+
): Promise<
|
|
67
|
+
[
|
|
68
|
+
Result<
|
|
69
|
+
operations.GetApiSandboxByIdCheckpointsResponse,
|
|
70
|
+
| errors.ErrorMessage
|
|
71
|
+
| errors.ErrorMessageStatusCode
|
|
72
|
+
| MutagentError
|
|
73
|
+
| ResponseValidationError
|
|
74
|
+
| ConnectionError
|
|
75
|
+
| RequestAbortedError
|
|
76
|
+
| RequestTimeoutError
|
|
77
|
+
| InvalidRequestError
|
|
78
|
+
| UnexpectedClientError
|
|
79
|
+
| SDKValidationError
|
|
80
|
+
>,
|
|
81
|
+
APICall,
|
|
82
|
+
]
|
|
83
|
+
> {
|
|
84
|
+
const parsed = safeParse(
|
|
85
|
+
request,
|
|
86
|
+
(value) =>
|
|
87
|
+
z.parse(
|
|
88
|
+
operations.GetApiSandboxByIdCheckpointsRequest$outboundSchema,
|
|
89
|
+
value,
|
|
90
|
+
),
|
|
91
|
+
"Input validation failed",
|
|
92
|
+
);
|
|
93
|
+
if (!parsed.ok) {
|
|
94
|
+
return [parsed, { status: "invalid" }];
|
|
95
|
+
}
|
|
96
|
+
const payload = parsed.value;
|
|
97
|
+
const body = null;
|
|
98
|
+
|
|
99
|
+
const pathParams = {
|
|
100
|
+
id: encodeSimple("id", payload.id, {
|
|
101
|
+
explode: false,
|
|
102
|
+
charEncoding: "percent",
|
|
103
|
+
}),
|
|
104
|
+
};
|
|
105
|
+
const path = pathToFunc("/api/sandbox/{id}/checkpoints")(pathParams);
|
|
106
|
+
|
|
107
|
+
const headers = new Headers(compactMap({
|
|
108
|
+
Accept: "application/json",
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
112
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
113
|
+
|
|
114
|
+
const context = {
|
|
115
|
+
options: client._options,
|
|
116
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
117
|
+
operationID: "getApiSandboxByIdCheckpoints",
|
|
118
|
+
oAuth2Scopes: null,
|
|
119
|
+
|
|
120
|
+
resolvedSecurity: requestSecurity,
|
|
121
|
+
|
|
122
|
+
securitySource: client._options.security,
|
|
123
|
+
retryConfig: options?.retries
|
|
124
|
+
|| client._options.retryConfig
|
|
125
|
+
|| { strategy: "none" },
|
|
126
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const requestRes = client._createRequest(context, {
|
|
130
|
+
security: requestSecurity,
|
|
131
|
+
method: "GET",
|
|
132
|
+
baseURL: options?.serverURL,
|
|
133
|
+
path: path,
|
|
134
|
+
headers: headers,
|
|
135
|
+
body: body,
|
|
136
|
+
userAgent: client._options.userAgent,
|
|
137
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
138
|
+
}, options);
|
|
139
|
+
if (!requestRes.ok) {
|
|
140
|
+
return [requestRes, { status: "invalid" }];
|
|
141
|
+
}
|
|
142
|
+
const req = requestRes.value;
|
|
143
|
+
|
|
144
|
+
const doResult = await client._do(req, {
|
|
145
|
+
context,
|
|
146
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
147
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
148
|
+
retryConfig: context.retryConfig,
|
|
149
|
+
retryCodes: context.retryCodes,
|
|
150
|
+
});
|
|
151
|
+
if (!doResult.ok) {
|
|
152
|
+
return [doResult, { status: "request-error", request: req }];
|
|
153
|
+
}
|
|
154
|
+
const response = doResult.value;
|
|
155
|
+
|
|
156
|
+
const responseFields = {
|
|
157
|
+
HttpMeta: { Response: response, Request: req },
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const [result] = await M.match<
|
|
161
|
+
operations.GetApiSandboxByIdCheckpointsResponse,
|
|
162
|
+
| errors.ErrorMessage
|
|
163
|
+
| errors.ErrorMessageStatusCode
|
|
164
|
+
| MutagentError
|
|
165
|
+
| ResponseValidationError
|
|
166
|
+
| ConnectionError
|
|
167
|
+
| RequestAbortedError
|
|
168
|
+
| RequestTimeoutError
|
|
169
|
+
| InvalidRequestError
|
|
170
|
+
| UnexpectedClientError
|
|
171
|
+
| SDKValidationError
|
|
172
|
+
>(
|
|
173
|
+
M.json(200, operations.GetApiSandboxByIdCheckpointsResponse$inboundSchema),
|
|
174
|
+
M.jsonErr([400, 401, 403, 404], errors.ErrorMessage$inboundSchema),
|
|
175
|
+
M.jsonErr(500, errors.ErrorMessageStatusCode$inboundSchema),
|
|
176
|
+
M.fail("4XX"),
|
|
177
|
+
M.fail("5XX"),
|
|
178
|
+
)(response, req, { extraFields: responseFields });
|
|
179
|
+
if (!result.ok) {
|
|
180
|
+
return [result, { status: "complete", request: req, response }];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return [result, { status: "complete", request: req, response }];
|
|
184
|
+
}
|
|
@@ -31,7 +31,7 @@ import { Result } from "../types/fp.js";
|
|
|
31
31
|
* Watch a sandbox's output live
|
|
32
32
|
*
|
|
33
33
|
* @remarks
|
|
34
|
-
* Server-sent events: `stdout`, `stderr`, `rpc`, `unrecognised`, `status`, `ping` (every 15s), `error`. `rpc` carries one complete NDJSON frame from a Helix session running in RPC mode, verbatim — parse it client-side. `unrecognised` carries a line the backend could not classify; receiving one means this server and the sandbox image disagree about the protocol, and it is forwarded rather than dropped so that drift is visible instead of silent.
|
|
34
|
+
* Server-sent events: `stdout`, `stderr`, `rpc`, `unrecognised`, `session`, `live`, `status`, `ping` (every 15s), `error`. `rpc` carries one complete NDJSON frame from a Helix session running in RPC mode, verbatim — parse it client-side. `unrecognised` carries a line the backend could not classify; receiving one means this server and the sandbox image disagree about the protocol, and it is forwarded rather than dropped so that drift is visible instead of silent. Those four output events share the `{seq, ts, text}` shape and one sequence counter, so their interleaving is the order the box produced them. `session` shares that counter too but carries flat fields instead of `text` — `{sessionId, status: "started"|"exited", exitCode, lastSeq, generation}` — and is how a client learns a Helix session began or ended; it is persisted and replayed like any output event, and `exitCode` is the session's real code (the terminal `status` event describes the SANDBOX and reports null by contract). `live` is emitted at most once, before the opening `status`, and only when this instance cannot follow the sandbox: it replays the log and ends rather than tailing. `seq` is monotonic per sandbox and starts at 1, and every seq-bearing event also carries it as the SSE `id:` field; pass the last one seen as `?since=` to resume. A resume is served from the persisted event log first and the live buffer only for the tail, so it survives a restart and can be answered by an instance that never spawned the box. If the requested range has been TRIMMED from that log, an `error` event names the lost range rather than skipping it silently — it carries `code: 'gap'` with the inclusive `from`/`to` wire seqs, and the stream continues past the gap; a source failure instead carries `code: 'upstream'` and is the end of the stream. Branch on `code`, never on `message`. Disconnecting tears down the upstream.
|
|
35
35
|
*/
|
|
36
36
|
export function sandboxGetApiSandboxByIdStream(
|
|
37
37
|
client: MutagentCore,
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { MutagentCore } from "../core.js";
|
|
7
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
8
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
9
|
+
import * as M from "../lib/matchers.js";
|
|
10
|
+
import { compactMap } from "../lib/primitives.js";
|
|
11
|
+
import { safeParse } from "../lib/schemas.js";
|
|
12
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
13
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
14
|
+
import { pathToFunc } from "../lib/url.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/http-client-errors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { MutagentError } from "../models/errors/mutagent-error.js";
|
|
24
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
26
|
+
import * as operations from "../models/operations/index.js";
|
|
27
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
28
|
+
import { Result } from "../types/fp.js";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Capture a Helix session's own transcript
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Copies the HARNESS's session file off the box, verbatim, and stores it. This is what a NEW box needs to CONTINUE the conversation — distinct from `GET /:id/stream?since=`, which replays what the client observed and restores no agent state at all. 409 when the session has not completed a turn: the harness writes its file lazily, so there is genuinely nothing to capture yet, and storing an empty snapshot would produce a restore that succeeds and restores nothing. 503 when the deployment has no snapshot store.
|
|
35
|
+
*/
|
|
36
|
+
export function sandboxPostApiSandboxByIdCheckpoint(
|
|
37
|
+
client: MutagentCore,
|
|
38
|
+
request: operations.PostApiSandboxByIdCheckpointRequest,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): APIPromise<
|
|
41
|
+
Result<
|
|
42
|
+
operations.PostApiSandboxByIdCheckpointResponse,
|
|
43
|
+
| errors.ErrorMessage
|
|
44
|
+
| errors.ErrorMessageStatusCode
|
|
45
|
+
| MutagentError
|
|
46
|
+
| ResponseValidationError
|
|
47
|
+
| ConnectionError
|
|
48
|
+
| RequestAbortedError
|
|
49
|
+
| RequestTimeoutError
|
|
50
|
+
| InvalidRequestError
|
|
51
|
+
| UnexpectedClientError
|
|
52
|
+
| SDKValidationError
|
|
53
|
+
>
|
|
54
|
+
> {
|
|
55
|
+
return new APIPromise($do(
|
|
56
|
+
client,
|
|
57
|
+
request,
|
|
58
|
+
options,
|
|
59
|
+
));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function $do(
|
|
63
|
+
client: MutagentCore,
|
|
64
|
+
request: operations.PostApiSandboxByIdCheckpointRequest,
|
|
65
|
+
options?: RequestOptions,
|
|
66
|
+
): Promise<
|
|
67
|
+
[
|
|
68
|
+
Result<
|
|
69
|
+
operations.PostApiSandboxByIdCheckpointResponse,
|
|
70
|
+
| errors.ErrorMessage
|
|
71
|
+
| errors.ErrorMessageStatusCode
|
|
72
|
+
| MutagentError
|
|
73
|
+
| ResponseValidationError
|
|
74
|
+
| ConnectionError
|
|
75
|
+
| RequestAbortedError
|
|
76
|
+
| RequestTimeoutError
|
|
77
|
+
| InvalidRequestError
|
|
78
|
+
| UnexpectedClientError
|
|
79
|
+
| SDKValidationError
|
|
80
|
+
>,
|
|
81
|
+
APICall,
|
|
82
|
+
]
|
|
83
|
+
> {
|
|
84
|
+
const parsed = safeParse(
|
|
85
|
+
request,
|
|
86
|
+
(value) =>
|
|
87
|
+
z.parse(
|
|
88
|
+
operations.PostApiSandboxByIdCheckpointRequest$outboundSchema,
|
|
89
|
+
value,
|
|
90
|
+
),
|
|
91
|
+
"Input validation failed",
|
|
92
|
+
);
|
|
93
|
+
if (!parsed.ok) {
|
|
94
|
+
return [parsed, { status: "invalid" }];
|
|
95
|
+
}
|
|
96
|
+
const payload = parsed.value;
|
|
97
|
+
const body = encodeJSON("body", payload.body, { explode: true });
|
|
98
|
+
|
|
99
|
+
const pathParams = {
|
|
100
|
+
id: encodeSimple("id", payload.id, {
|
|
101
|
+
explode: false,
|
|
102
|
+
charEncoding: "percent",
|
|
103
|
+
}),
|
|
104
|
+
};
|
|
105
|
+
const path = pathToFunc("/api/sandbox/{id}/checkpoint")(pathParams);
|
|
106
|
+
|
|
107
|
+
const headers = new Headers(compactMap({
|
|
108
|
+
"Content-Type": "application/json",
|
|
109
|
+
Accept: "application/json",
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
113
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
114
|
+
|
|
115
|
+
const context = {
|
|
116
|
+
options: client._options,
|
|
117
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
118
|
+
operationID: "postApiSandboxByIdCheckpoint",
|
|
119
|
+
oAuth2Scopes: null,
|
|
120
|
+
|
|
121
|
+
resolvedSecurity: requestSecurity,
|
|
122
|
+
|
|
123
|
+
securitySource: client._options.security,
|
|
124
|
+
retryConfig: options?.retries
|
|
125
|
+
|| client._options.retryConfig
|
|
126
|
+
|| { strategy: "none" },
|
|
127
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const requestRes = client._createRequest(context, {
|
|
131
|
+
security: requestSecurity,
|
|
132
|
+
method: "POST",
|
|
133
|
+
baseURL: options?.serverURL,
|
|
134
|
+
path: path,
|
|
135
|
+
headers: headers,
|
|
136
|
+
body: body,
|
|
137
|
+
userAgent: client._options.userAgent,
|
|
138
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
139
|
+
}, options);
|
|
140
|
+
if (!requestRes.ok) {
|
|
141
|
+
return [requestRes, { status: "invalid" }];
|
|
142
|
+
}
|
|
143
|
+
const req = requestRes.value;
|
|
144
|
+
|
|
145
|
+
const doResult = await client._do(req, {
|
|
146
|
+
context,
|
|
147
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
148
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
149
|
+
retryConfig: context.retryConfig,
|
|
150
|
+
retryCodes: context.retryCodes,
|
|
151
|
+
});
|
|
152
|
+
if (!doResult.ok) {
|
|
153
|
+
return [doResult, { status: "request-error", request: req }];
|
|
154
|
+
}
|
|
155
|
+
const response = doResult.value;
|
|
156
|
+
|
|
157
|
+
const responseFields = {
|
|
158
|
+
HttpMeta: { Response: response, Request: req },
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const [result] = await M.match<
|
|
162
|
+
operations.PostApiSandboxByIdCheckpointResponse,
|
|
163
|
+
| errors.ErrorMessage
|
|
164
|
+
| errors.ErrorMessageStatusCode
|
|
165
|
+
| MutagentError
|
|
166
|
+
| ResponseValidationError
|
|
167
|
+
| ConnectionError
|
|
168
|
+
| RequestAbortedError
|
|
169
|
+
| RequestTimeoutError
|
|
170
|
+
| InvalidRequestError
|
|
171
|
+
| UnexpectedClientError
|
|
172
|
+
| SDKValidationError
|
|
173
|
+
>(
|
|
174
|
+
M.json(200, operations.PostApiSandboxByIdCheckpointResponse$inboundSchema),
|
|
175
|
+
M.jsonErr([400, 401, 403, 404], errors.ErrorMessage$inboundSchema),
|
|
176
|
+
M.jsonErr(409, errors.ErrorMessageStatusCode$inboundSchema),
|
|
177
|
+
M.jsonErr(500, errors.ErrorMessageStatusCode$inboundSchema),
|
|
178
|
+
M.fail("4XX"),
|
|
179
|
+
M.fail("5XX"),
|
|
180
|
+
)(response, req, { extraFields: responseFields });
|
|
181
|
+
if (!result.ok) {
|
|
182
|
+
return [result, { status: "complete", request: req, response }];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return [result, { status: "complete", request: req, response }];
|
|
186
|
+
}
|