@nylorun/core 0.19.0-beta → 0.20.0-beta

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 (42) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/dist/compatibility.d.ts +74 -32
  3. package/dist/compatibility.js +80 -33
  4. package/dist/contracts.d.ts +1496 -495
  5. package/dist/contracts.js +889 -374
  6. package/dist/define.d.ts +1 -0
  7. package/dist/define.js +1 -0
  8. package/dist/definition/approval.d.ts +16 -0
  9. package/dist/definition/approval.js +35 -0
  10. package/dist/definition/code-tools.d.ts +1 -1
  11. package/dist/definition/code-tools.js +1 -1
  12. package/dist/definition/flow/compile.js +0 -2
  13. package/dist/definition/http-tool.d.ts +7 -4
  14. package/dist/definition/http-tool.js +6 -10
  15. package/dist/definition/manifest.js +1 -0
  16. package/dist/definition/mcp.d.ts +4 -4
  17. package/dist/definition/mcp.js +15 -12
  18. package/dist/definition/removed.js +1 -1
  19. package/dist/definition/variant.d.ts +1 -1
  20. package/dist/definition/variant.js +6 -5
  21. package/dist/harness-api/entries.d.ts +241 -0
  22. package/dist/harness-api/entries.js +117 -0
  23. package/dist/harness-api/gates.d.ts +172 -0
  24. package/dist/harness-api/gates.js +119 -0
  25. package/dist/harness-api/harness-api.schema.json +5056 -0
  26. package/dist/harness-api/index.d.ts +19 -3
  27. package/dist/harness-api/index.js +16 -3
  28. package/dist/harness-api/json-schema.d.ts +12 -0
  29. package/dist/harness-api/json-schema.js +61 -0
  30. package/dist/harness-api/mcp.d.ts +61 -0
  31. package/dist/harness-api/mcp.js +41 -0
  32. package/dist/harness-api/messages.d.ts +12 -4
  33. package/dist/harness-api/messages.js +6 -2
  34. package/dist/harness-api/schema.d.ts +353 -31
  35. package/dist/harness-api/schema.js +138 -20
  36. package/dist/harness-api/transport.d.ts +55 -0
  37. package/dist/harness-api/transport.js +61 -0
  38. package/dist/types/manifest.d.ts +15 -9
  39. package/dist/types/observe.d.ts +3 -2
  40. package/dist/utils/harness-id.d.ts +9 -0
  41. package/dist/utils/harness-id.js +11 -0
  42. package/package.json +5 -4
@@ -3,6 +3,8 @@ import { z } from "zod";
3
3
  import type { AgentManifest, McpServerManifest } from "./types/manifest.js";
4
4
  import type { JsonValue } from "./types/shared.js";
5
5
  import type { WorkflowManifest } from "./types/workflow.js";
6
+ import { DEFAULT_HARNESS, HARNESS_ID_PATTERN, isHarnessId } from "./utils/harness-id.js";
7
+ export { DEFAULT_HARNESS, HARNESS_ID_PATTERN, isHarnessId };
6
8
  export type { AgentManifest } from "./types/manifest.js";
7
9
  export type { WorkflowManifest } from "./types/workflow.js";
8
10
  export { PROTOCOL_VERSION, ERROR_CODES } from "./compatibility.js";
@@ -28,86 +30,155 @@ export declare const PutAgentRequestSchema: z.ZodObject<{
28
30
  implementationVersion: z.ZodString;
29
31
  }, z.core.$strict>;
30
32
  export type PutAgentRequest = z.infer<typeof PutAgentRequestSchema>;
31
- export declare const CredentialSelectionSchema: z.ZodObject<{
32
- serverName: z.ZodString;
33
- credentialId: z.ZodString;
33
+ export declare const ENVIRONMENT_ID_MAX_LENGTH = 200;
34
+ export declare function isEnvironmentId(value: unknown): value is string;
35
+ /** An Environment grant: an exact Environment id, or a prefix ending in `/*` (`team-a/*`). */
36
+ export declare function isEnvironmentGrant(value: unknown): value is string;
37
+ /**
38
+ * Whether `grants` (a token caller's Environment grants) reach Environment `id`: an exact entry,
39
+ * or a prefix entry `p/*` for any id below `p/`. No grants reach no Environment.
40
+ */
41
+ export declare function environmentGranted(grants: readonly string[] | undefined, id: string): boolean;
42
+ export declare const EnvironmentIdSchema: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
43
+ export declare const EnvironmentGrantSchema: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
44
+ /**
45
+ * `virtual`: a just-bash workspace in the harness container, no cluster (a local convenience).
46
+ * `pod`: an agent-sandbox pod with its own volume (Host feature `sandbox-pods`). `none`: no
47
+ * compute, only the vault, for agents whose tools are remote MCP servers and HTTP tools.
48
+ */
49
+ export declare const ENVIRONMENT_KINDS: readonly ["virtual", "pod", "none"];
50
+ export type EnvironmentKind = (typeof ENVIRONMENT_KINDS)[number];
51
+ /** The kinds with a sandbox (a disk and the sandbox tools). */
52
+ export type SandboxKind = Exclude<EnvironmentKind, "none">;
53
+ export declare const ENVIRONMENT_LABELS_MAX = 32;
54
+ /** The developer's own key-value pairs; the Runtime stores and filters them, never reads them. */
55
+ export declare const EnvironmentLabelsSchema: z.ZodRecord<z.ZodString, z.ZodString>;
56
+ export type EnvironmentLabels = z.infer<typeof EnvironmentLabelsSchema>;
57
+ /** A harness id (track R4): what a harness names itself in `hello`. */
58
+ export declare const HarnessIdSchema: z.ZodString;
59
+ /**
60
+ * An Environment's lifecycle. `idle`: stop compute after this long without a turn, at most the
61
+ * Tenant's `limits.idle` (default the Tenant's). `deleteAfter`: delete the Environment, its vault
62
+ * and its disk once it has gone this long unused (no turn, recipe change, secret write, stop or
63
+ * reset); default never.
64
+ */
65
+ export declare const EnvironmentLifecycleSchema: z.ZodObject<{
66
+ idle: z.ZodOptional<z.ZodString>;
67
+ deleteAfter: z.ZodOptional<z.ZodString>;
34
68
  }, z.core.$strict>;
35
- export type CredentialSelection = z.infer<typeof CredentialSelectionSchema>;
69
+ export type EnvironmentLifecycle = z.infer<typeof EnvironmentLifecycleSchema>;
70
+ /** The most setup commands and input files an Environment's recipe holds (step 2). */
71
+ export declare const ENVIRONMENT_SETUP_MAX = 16;
72
+ /** A setup command's longest timeout (default 10m). */
73
+ export declare const ENVIRONMENT_SETUP_TIMEOUT_MAX_MS: number;
36
74
  /**
37
- * A sandbox defined when a session is opened. No `network.allow` means no egress. The Runtime
38
- * checks it against the Tenant's limits and pins the result on the session.
75
+ * One setup command (pods only): run with `/bin/sh -c` when the pod's disk is made or reset,
76
+ * before the engine takes a turn, with the Environment's variables, secrets (as the sentinel)
77
+ * and egress, as a turn's commands are.
39
78
  */
40
- export declare const SandboxInlineRequestSchema: z.ZodObject<{
41
- image: z.ZodOptional<z.ZodString>;
42
- network: z.ZodOptional<z.ZodObject<{
43
- allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
44
- }, z.core.$strict>>;
45
- resources: z.ZodOptional<z.ZodObject<{
46
- cpus: z.ZodOptional<z.ZodNumber>;
47
- memory: z.ZodOptional<z.ZodString>;
48
- }, z.core.$strict>>;
79
+ export declare const EnvironmentSetupCommandSchema: z.ZodObject<{
80
+ command: z.ZodString;
81
+ cwd: z.ZodOptional<z.ZodString>;
82
+ timeout: z.ZodOptional<z.ZodString>;
49
83
  }, z.core.$strict>;
50
- export type SandboxInlineRequest = z.infer<typeof SandboxInlineRequestSchema>;
51
- export declare const SANDBOX_ID_MAX_LENGTH = 200;
52
- export declare function isSandboxId(value: unknown): value is string;
53
- /** A sandbox grant: an exact sandbox id, or a prefix ending in `/*` (`team-a/*`). */
54
- export declare function isSandboxGrant(value: unknown): value is string;
84
+ export type EnvironmentSetupCommand = z.infer<typeof EnvironmentSetupCommandSchema>;
55
85
  /**
56
- * Whether `grants` (a token caller's sandbox grants) reach sandbox `id`: an exact entry, or a prefix
57
- * entry `p/*` for any id below `p/`. No grants reach no sandbox.
86
+ * One input file (pods only): a version of a Tenant-wide artifact, copied in when the pod's disk
87
+ * is made or reset, before the setup commands. A file artifact is written at `path`; a folder
88
+ * artifact is unpacked under it.
58
89
  */
59
- export declare function sandboxGranted(grants: readonly string[] | undefined, id: string): boolean;
60
- export declare const SandboxIdSchema: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
61
- export declare const SandboxGrantSchema: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
62
- /** `virtual`: a just-bash workspace, no cluster (F7.1). `pod`: an agent-sandbox pod (F7.2). */
63
- export declare const SANDBOX_KINDS: readonly ["virtual", "pod"];
64
- export type SandboxKind = (typeof SANDBOX_KINDS)[number];
65
- export declare const SANDBOX_LABELS_MAX = 32;
66
- /** The developer's own key-value pairs; the Runtime stores and filters them, never reads them. */
67
- export declare const SandboxLabelsSchema: z.ZodRecord<z.ZodString, z.ZodString>;
68
- export type SandboxLabels = z.infer<typeof SandboxLabelsSchema>;
90
+ export declare const EnvironmentFileSchema: z.ZodObject<{
91
+ artifactId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
92
+ version: z.ZodNumber;
93
+ path: z.ZodString;
94
+ }, z.core.$strict>;
95
+ export type EnvironmentFile = z.infer<typeof EnvironmentFileSchema>;
69
96
  /**
70
- * `PUT /v1/sandboxes/{sandboxId}`: creates the sandbox, or finds the one with this id. The spec
71
- * (`kind`, `image`, `network`, `resources`, `storage`) is checked against the Tenant's limits
72
- * and fixed once the sandbox exists; `labels`, when sent, replace the sandbox's labels.
73
- *
74
- * Kind `pod` (Host feature `sandbox-pods`) is created at once on the Tenant's cluster. A `PUT`
75
- * on an existing pod sandbox also starts it again when it was stopped, and one with a
76
- * `lifecycle.ttl` other than its own sets a new expiry (counted from its creation), which
77
- * revives an expired sandbox.
97
+ * `PUT /v1/environments/{environmentId}`: creates the Environment and its vault, or finds the
98
+ * one with this id, so "get or create" is one call. On an existing one the fields sent are
99
+ * compared: `kind` and `storage` are fixed (a difference is `409`), `labels` replace its labels,
100
+ * and any other difference changes its recipe and bumps its `version`. Image and resources
101
+ * reach a pod when it next starts from stopped; `network.allowedHosts` applies within seconds.
102
+ * A `PUT` that changes nothing answers the view unchanged.
78
103
  */
79
- export declare const PutSandboxRequestSchema: z.ZodObject<{
104
+ export declare const PutEnvironmentRequestSchema: z.ZodObject<{
80
105
  requestId: z.ZodOptional<z.ZodString>;
81
106
  kind: z.ZodOptional<z.ZodEnum<{
107
+ none: "none";
82
108
  pod: "pod";
83
109
  virtual: "virtual";
84
110
  }>>;
85
111
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
86
112
  image: z.ZodOptional<z.ZodString>;
87
- network: z.ZodOptional<z.ZodObject<{
88
- allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
89
- }, z.core.$strict>>;
90
113
  resources: z.ZodOptional<z.ZodObject<{
91
114
  cpus: z.ZodOptional<z.ZodNumber>;
92
115
  memory: z.ZodOptional<z.ZodString>;
93
116
  }, z.core.$strict>>;
94
117
  storage: z.ZodOptional<z.ZodString>;
118
+ network: z.ZodOptional<z.ZodObject<{
119
+ allowedHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
120
+ }, z.core.$strict>>;
121
+ harness: z.ZodOptional<z.ZodString>;
122
+ ownerUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
95
123
  lifecycle: z.ZodOptional<z.ZodObject<{
96
- ttl: z.ZodOptional<z.ZodString>;
124
+ idle: z.ZodOptional<z.ZodString>;
125
+ deleteAfter: z.ZodOptional<z.ZodString>;
97
126
  }, z.core.$strict>>;
127
+ setup: z.ZodOptional<z.ZodArray<z.ZodObject<{
128
+ command: z.ZodString;
129
+ cwd: z.ZodOptional<z.ZodString>;
130
+ timeout: z.ZodOptional<z.ZodString>;
131
+ }, z.core.$strict>>>;
132
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
133
+ artifactId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
134
+ version: z.ZodNumber;
135
+ path: z.ZodString;
136
+ }, z.core.$strict>>>;
137
+ from: z.ZodOptional<z.ZodObject<{
138
+ environment: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
139
+ version: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"latest">]>;
140
+ }, z.core.$strict>>;
141
+ }, z.core.$strict>;
142
+ export type PutEnvironmentRequest = z.infer<typeof PutEnvironmentRequestSchema>;
143
+ /** An Environment's recipe, resolved against the Tenant's limits. */
144
+ export declare const EnvironmentRecipeSchema: z.ZodObject<{
145
+ image: z.ZodOptional<z.ZodString>;
146
+ resources: z.ZodOptional<z.ZodObject<{
147
+ cpus: z.ZodNumber;
148
+ memory: z.ZodString;
149
+ }, z.core.$strict>>;
150
+ storage: z.ZodOptional<z.ZodString>;
151
+ network: z.ZodOptional<z.ZodObject<{
152
+ allowedHosts: z.ZodArray<z.ZodString>;
153
+ }, z.core.$strict>>;
154
+ harness: z.ZodString;
155
+ lifecycle: z.ZodObject<{
156
+ idle: z.ZodOptional<z.ZodString>;
157
+ deleteAfter: z.ZodOptional<z.ZodString>;
158
+ }, z.core.$strict>;
159
+ setup: z.ZodOptional<z.ZodArray<z.ZodObject<{
160
+ command: z.ZodString;
161
+ cwd: z.ZodOptional<z.ZodString>;
162
+ timeout: z.ZodOptional<z.ZodString>;
163
+ }, z.core.$strict>>>;
164
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
165
+ artifactId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
166
+ version: z.ZodNumber;
167
+ path: z.ZodString;
168
+ }, z.core.$strict>>>;
98
169
  }, z.core.$strict>;
99
- export type PutSandboxRequest = z.infer<typeof PutSandboxRequestSchema>;
100
- /** A session attached to a sandbox, as the sandbox's view lists it. */
101
- export declare const SandboxSessionSchema: z.ZodObject<{
170
+ export type EnvironmentRecipe = z.infer<typeof EnvironmentRecipeSchema>;
171
+ /** A session that names an Environment, as the Environment's view lists it. */
172
+ export declare const EnvironmentSessionSchema: z.ZodObject<{
102
173
  id: z.ZodString;
103
174
  activeTurnId: z.ZodNullable<z.ZodString>;
104
175
  }, z.core.$strict>;
105
- /** What the Runtime wants of a pod sandbox (`desired`) and what it last saw (`observed`). */
106
- export declare const SANDBOX_POD_DESIRED: readonly ["running", "suspended", "deleted"];
107
- export declare const SANDBOX_POD_OBSERVED: readonly ["creating", "running", "suspended", "expired", "lost", "failed", "deleting"];
108
- export type SandboxPodDesired = (typeof SANDBOX_POD_DESIRED)[number];
109
- export type SandboxPodObserved = (typeof SANDBOX_POD_OBSERVED)[number];
110
- export declare const SandboxPodViewSchema: z.ZodObject<{
176
+ /** What the Runtime wants of a pod (`desired`) and what it last saw (`observed`). */
177
+ export declare const POD_DESIRED: readonly ["running", "suspended", "deleted"];
178
+ export declare const POD_OBSERVED: readonly ["creating", "running", "suspended", "lost", "failed", "deleting"];
179
+ export type PodDesired = (typeof POD_DESIRED)[number];
180
+ export type PodObserved = (typeof POD_OBSERVED)[number];
181
+ export declare const EnvironmentPodViewSchema: z.ZodObject<{
111
182
  desired: z.ZodEnum<{
112
183
  deleted: "deleted";
113
184
  running: "running";
@@ -116,7 +187,6 @@ export declare const SandboxPodViewSchema: z.ZodObject<{
116
187
  observed: z.ZodEnum<{
117
188
  creating: "creating";
118
189
  deleting: "deleting";
119
- expired: "expired";
120
190
  failed: "failed";
121
191
  lost: "lost";
122
192
  running: "running";
@@ -124,25 +194,54 @@ export declare const SandboxPodViewSchema: z.ZodObject<{
124
194
  }>;
125
195
  volumeGeneration: z.ZodNumber;
126
196
  hostEpoch: z.ZodNumber;
127
- expiresAt: z.ZodOptional<z.ZodString>;
128
197
  reason: z.ZodOptional<z.ZodString>;
129
198
  }, z.core.$strict>;
130
- export type SandboxPodView = z.infer<typeof SandboxPodViewSchema>;
131
- /** `PUT` and `GET /v1/sandboxes/{sandboxId}`. */
132
- export declare const SandboxViewSchema: z.ZodObject<{
199
+ export type EnvironmentPodView = z.infer<typeof EnvironmentPodViewSchema>;
200
+ /**
201
+ * The compute states an Environment reports today: `ready` until a tool first runs in a virtual
202
+ * one, then `creating`, `running` or `stopped`. An open set: clients must accept values they do
203
+ * not know (a later release may add one, such as `cold`).
204
+ */
205
+ export declare const ENVIRONMENT_STATES: readonly ["ready", "creating", "running", "stopped"];
206
+ /** `PUT` and `GET /v1/environments/{environmentId}`. */
207
+ export declare const EnvironmentViewSchema: z.ZodObject<{
133
208
  id: z.ZodString;
134
209
  kind: z.ZodEnum<{
210
+ none: "none";
135
211
  pod: "pod";
136
212
  virtual: "virtual";
137
213
  }>;
138
214
  labels: z.ZodRecord<z.ZodString, z.ZodString>;
139
- spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
140
- state: z.ZodEnum<{
141
- creating: "creating";
142
- ready: "ready";
143
- running: "running";
144
- stopped: "stopped";
145
- }>;
215
+ recipe: z.ZodObject<{
216
+ image: z.ZodOptional<z.ZodString>;
217
+ resources: z.ZodOptional<z.ZodObject<{
218
+ cpus: z.ZodNumber;
219
+ memory: z.ZodString;
220
+ }, z.core.$strict>>;
221
+ storage: z.ZodOptional<z.ZodString>;
222
+ network: z.ZodOptional<z.ZodObject<{
223
+ allowedHosts: z.ZodArray<z.ZodString>;
224
+ }, z.core.$strict>>;
225
+ harness: z.ZodString;
226
+ lifecycle: z.ZodObject<{
227
+ idle: z.ZodOptional<z.ZodString>;
228
+ deleteAfter: z.ZodOptional<z.ZodString>;
229
+ }, z.core.$strict>;
230
+ setup: z.ZodOptional<z.ZodArray<z.ZodObject<{
231
+ command: z.ZodString;
232
+ cwd: z.ZodOptional<z.ZodString>;
233
+ timeout: z.ZodOptional<z.ZodString>;
234
+ }, z.core.$strict>>>;
235
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
236
+ artifactId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
237
+ version: z.ZodNumber;
238
+ path: z.ZodString;
239
+ }, z.core.$strict>>>;
240
+ }, z.core.$strict>;
241
+ version: z.ZodNumber;
242
+ appliedVersion: z.ZodNumber;
243
+ ownerUserId: z.ZodNullable<z.ZodString>;
244
+ state: z.ZodString;
146
245
  pod: z.ZodOptional<z.ZodObject<{
147
246
  desired: z.ZodEnum<{
148
247
  deleted: "deleted";
@@ -152,7 +251,6 @@ export declare const SandboxViewSchema: z.ZodObject<{
152
251
  observed: z.ZodEnum<{
153
252
  creating: "creating";
154
253
  deleting: "deleting";
155
- expired: "expired";
156
254
  failed: "failed";
157
255
  lost: "lost";
158
256
  running: "running";
@@ -160,9 +258,21 @@ export declare const SandboxViewSchema: z.ZodObject<{
160
258
  }>;
161
259
  volumeGeneration: z.ZodNumber;
162
260
  hostEpoch: z.ZodNumber;
163
- expiresAt: z.ZodOptional<z.ZodString>;
164
261
  reason: z.ZodOptional<z.ZodString>;
165
262
  }, z.core.$strict>>;
263
+ lastUsedAt: z.ZodString;
264
+ disk: z.ZodOptional<z.ZodObject<{
265
+ latestVersion: z.ZodNullable<z.ZodNumber>;
266
+ operation: z.ZodOptional<z.ZodObject<{
267
+ kind: z.ZodEnum<{
268
+ restore: "restore";
269
+ seed: "seed";
270
+ snapshot: "snapshot";
271
+ }>;
272
+ version: z.ZodOptional<z.ZodNumber>;
273
+ startedAt: z.ZodString;
274
+ }, z.core.$strict>>;
275
+ }, z.core.$strict>>;
166
276
  sessions: z.ZodArray<z.ZodObject<{
167
277
  id: z.ZodString;
168
278
  activeTurnId: z.ZodNullable<z.ZodString>;
@@ -170,22 +280,88 @@ export declare const SandboxViewSchema: z.ZodObject<{
170
280
  createdAt: z.ZodString;
171
281
  updatedAt: z.ZodString;
172
282
  }, z.core.$strict>;
173
- export type SandboxView = z.infer<typeof SandboxViewSchema>;
174
- export declare const ListSandboxesResponseSchema: z.ZodObject<{
175
- sandboxes: z.ZodArray<z.ZodObject<{
283
+ export type EnvironmentView = z.infer<typeof EnvironmentViewSchema>;
284
+ /** `POST /v1/environments/{id}/snapshot`: a new version of the Environment's disk. */
285
+ export declare const EnvironmentSnapshotSchema: z.ZodObject<{
286
+ environmentId: z.ZodString;
287
+ artifactId: z.ZodString;
288
+ version: z.ZodNumber;
289
+ format: z.ZodString;
290
+ files: z.ZodNumber;
291
+ bytes: z.ZodNumber;
292
+ storedBytes: z.ZodNumber;
293
+ durationMs: z.ZodNumber;
294
+ unchanged: z.ZodBoolean;
295
+ createdAt: z.ZodString;
296
+ }, z.core.$strict>;
297
+ export type EnvironmentSnapshot = z.infer<typeof EnvironmentSnapshotSchema>;
298
+ /** `POST /v1/environments/{id}/restore`: which version of its disk to put back. */
299
+ export declare const RestoreEnvironmentRequestSchema: z.ZodObject<{
300
+ requestId: z.ZodOptional<z.ZodString>;
301
+ version: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"latest">]>;
302
+ }, z.core.$strict>;
303
+ export type RestoreEnvironmentRequest = z.infer<typeof RestoreEnvironmentRequestSchema>;
304
+ export declare const EnvironmentRestoreSchema: z.ZodObject<{
305
+ environmentId: z.ZodString;
306
+ restored: z.ZodNumber;
307
+ status: z.ZodEnum<{
308
+ done: "done";
309
+ pending: "pending";
310
+ }>;
311
+ volumeGeneration: z.ZodOptional<z.ZodNumber>;
312
+ }, z.core.$strict>;
313
+ export type EnvironmentRestore = z.infer<typeof EnvironmentRestoreSchema>;
314
+ /** `GET /v1/environments/{id}/versions`: its disk versions, newest first. */
315
+ export declare const EnvironmentVersionsSchema: z.ZodObject<{
316
+ environmentId: z.ZodString;
317
+ artifactId: z.ZodNullable<z.ZodString>;
318
+ latest: z.ZodNullable<z.ZodNumber>;
319
+ versions: z.ZodArray<z.ZodObject<{
320
+ version: z.ZodNumber;
321
+ bytes: z.ZodNumber;
322
+ createdAt: z.ZodString;
323
+ }, z.core.$strict>>;
324
+ }, z.core.$strict>;
325
+ export type EnvironmentVersions = z.infer<typeof EnvironmentVersionsSchema>;
326
+ export declare const ListEnvironmentsResponseSchema: z.ZodObject<{
327
+ environments: z.ZodArray<z.ZodObject<{
176
328
  id: z.ZodString;
177
329
  kind: z.ZodEnum<{
330
+ none: "none";
178
331
  pod: "pod";
179
332
  virtual: "virtual";
180
333
  }>;
181
334
  labels: z.ZodRecord<z.ZodString, z.ZodString>;
182
- spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
183
- state: z.ZodEnum<{
184
- creating: "creating";
185
- ready: "ready";
186
- running: "running";
187
- stopped: "stopped";
188
- }>;
335
+ recipe: z.ZodObject<{
336
+ image: z.ZodOptional<z.ZodString>;
337
+ resources: z.ZodOptional<z.ZodObject<{
338
+ cpus: z.ZodNumber;
339
+ memory: z.ZodString;
340
+ }, z.core.$strict>>;
341
+ storage: z.ZodOptional<z.ZodString>;
342
+ network: z.ZodOptional<z.ZodObject<{
343
+ allowedHosts: z.ZodArray<z.ZodString>;
344
+ }, z.core.$strict>>;
345
+ harness: z.ZodString;
346
+ lifecycle: z.ZodObject<{
347
+ idle: z.ZodOptional<z.ZodString>;
348
+ deleteAfter: z.ZodOptional<z.ZodString>;
349
+ }, z.core.$strict>;
350
+ setup: z.ZodOptional<z.ZodArray<z.ZodObject<{
351
+ command: z.ZodString;
352
+ cwd: z.ZodOptional<z.ZodString>;
353
+ timeout: z.ZodOptional<z.ZodString>;
354
+ }, z.core.$strict>>>;
355
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
356
+ artifactId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
357
+ version: z.ZodNumber;
358
+ path: z.ZodString;
359
+ }, z.core.$strict>>>;
360
+ }, z.core.$strict>;
361
+ version: z.ZodNumber;
362
+ appliedVersion: z.ZodNumber;
363
+ ownerUserId: z.ZodNullable<z.ZodString>;
364
+ state: z.ZodString;
189
365
  pod: z.ZodOptional<z.ZodObject<{
190
366
  desired: z.ZodEnum<{
191
367
  deleted: "deleted";
@@ -195,7 +371,6 @@ export declare const ListSandboxesResponseSchema: z.ZodObject<{
195
371
  observed: z.ZodEnum<{
196
372
  creating: "creating";
197
373
  deleting: "deleting";
198
- expired: "expired";
199
374
  failed: "failed";
200
375
  lost: "lost";
201
376
  running: "running";
@@ -203,9 +378,21 @@ export declare const ListSandboxesResponseSchema: z.ZodObject<{
203
378
  }>;
204
379
  volumeGeneration: z.ZodNumber;
205
380
  hostEpoch: z.ZodNumber;
206
- expiresAt: z.ZodOptional<z.ZodString>;
207
381
  reason: z.ZodOptional<z.ZodString>;
208
382
  }, z.core.$strict>>;
383
+ lastUsedAt: z.ZodString;
384
+ disk: z.ZodOptional<z.ZodObject<{
385
+ latestVersion: z.ZodNullable<z.ZodNumber>;
386
+ operation: z.ZodOptional<z.ZodObject<{
387
+ kind: z.ZodEnum<{
388
+ restore: "restore";
389
+ seed: "seed";
390
+ snapshot: "snapshot";
391
+ }>;
392
+ version: z.ZodOptional<z.ZodNumber>;
393
+ startedAt: z.ZodString;
394
+ }, z.core.$strict>>;
395
+ }, z.core.$strict>>;
209
396
  sessions: z.ZodArray<z.ZodObject<{
210
397
  id: z.ZodString;
211
398
  activeTurnId: z.ZodNullable<z.ZodString>;
@@ -214,182 +401,192 @@ export declare const ListSandboxesResponseSchema: z.ZodObject<{
214
401
  updatedAt: z.ZodString;
215
402
  }, z.core.$strict>>;
216
403
  }, z.core.$strict>;
217
- export type ListSandboxesResponse = z.infer<typeof ListSandboxesResponseSchema>;
218
- export declare const DeleteSandboxResponseSchema: z.ZodObject<{
404
+ export type ListEnvironmentsResponse = z.infer<typeof ListEnvironmentsResponseSchema>;
405
+ export declare const DeleteEnvironmentResponseSchema: z.ZodObject<{
219
406
  id: z.ZodString;
220
407
  deleted: z.ZodBoolean;
221
408
  }, z.core.$strict>;
222
- export type DeleteSandboxResponse = z.infer<typeof DeleteSandboxResponseSchema>;
223
- /** The schema id of a sandbox's lifecycle events (its stream in the record). */
224
- export declare const SANDBOX_EVENT_SCHEMA = "nylorun.sandbox-event/1";
225
- export declare const SANDBOX_EVENT_TYPES: readonly ["sandbox.created", "sandbox.attached", "sandbox.detached", "sandbox.deleted", "sandbox.running", "sandbox.suspended", "sandbox.expired", "sandbox.relaunched", "sandbox.lost", "sandbox.reset", "sandbox.failed"];
226
- export type SandboxEventType = (typeof SANDBOX_EVENT_TYPES)[number];
227
- /** The payload of each sandbox lifecycle event. */
228
- export declare const SANDBOX_EVENT_PAYLOADS: {
229
- readonly "sandbox.created": z.ZodObject<{
409
+ export type DeleteEnvironmentResponse = z.infer<typeof DeleteEnvironmentResponseSchema>;
410
+ /**
411
+ * One connection a pod Environment opened through egress-gate (track R7, Q6): written when it
412
+ * closes, or at once when the gate refused it. The session log of the turn holding the
413
+ * Environment when it opened gets it as `egress.connection`; with no turn holding it, the
414
+ * Environment's own stream gets it as `environment.egress` (Q7).
415
+ *
416
+ * `startedAt` is the gate's clock at CONNECT and `durationMs` runs from there to the close, so
417
+ * the span is the gate's own measurement. `bytesUp` is what the sandbox sent, `bytesDown` what it
418
+ * got. `mode: "credential"` is a host an `environment_secret` is bound to (R2c): the gate read
419
+ * each request (`requests`) and set a credential on it (`credentialIds`, ids only). It never
420
+ * carries a header value, a URL path or a body.
421
+ */
422
+ export declare const EgressConnectionPayloadSchema: z.ZodObject<{
423
+ environmentId: z.ZodString;
424
+ host: z.ZodString;
425
+ port: z.ZodNumber;
426
+ outcome: z.ZodEnum<{
427
+ allowed: "allowed";
428
+ refused: "refused";
429
+ }>;
430
+ reason: z.ZodOptional<z.ZodString>;
431
+ status: z.ZodOptional<z.ZodNumber>;
432
+ mode: z.ZodEnum<{
433
+ credential: "credential";
434
+ tunnel: "tunnel";
435
+ }>;
436
+ credentialBound: z.ZodBoolean;
437
+ credentialIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
438
+ requests: z.ZodOptional<z.ZodNumber>;
439
+ bytesUp: z.ZodNumber;
440
+ bytesDown: z.ZodNumber;
441
+ durationMs: z.ZodNumber;
442
+ startedAt: z.ZodString;
443
+ }, z.core.$loose>;
444
+ /** The schema id of an Environment's lifecycle events (its stream in the record). */
445
+ export declare const ENVIRONMENT_EVENT_SCHEMA = "nylorun.environment-event/1";
446
+ export declare const ENVIRONMENT_EVENT_TYPES: readonly ["environment.created", "environment.attached", "environment.detached", "environment.deleted", "environment.running", "environment.suspended", "environment.relaunched", "environment.lost", "environment.reset", "environment.failed", "environment.egress"];
447
+ export type EnvironmentEventType = (typeof ENVIRONMENT_EVENT_TYPES)[number];
448
+ /** The payload of each Environment lifecycle event. */
449
+ export declare const ENVIRONMENT_EVENT_PAYLOADS: {
450
+ readonly "environment.created": z.ZodObject<{
230
451
  kind: z.ZodEnum<{
452
+ none: "none";
231
453
  pod: "pod";
232
454
  virtual: "virtual";
233
455
  }>;
234
456
  labels: z.ZodRecord<z.ZodString, z.ZodString>;
235
457
  }, z.core.$loose>;
236
- readonly "sandbox.attached": z.ZodObject<{
458
+ readonly "environment.attached": z.ZodObject<{
237
459
  sessionId: z.ZodString;
238
460
  }, z.core.$loose>;
239
- readonly "sandbox.detached": z.ZodObject<{
461
+ readonly "environment.detached": z.ZodObject<{
240
462
  sessionId: z.ZodString;
241
463
  reason: z.ZodEnum<{
242
464
  reset: "reset";
243
465
  }>;
244
466
  }, z.core.$loose>;
245
- readonly "sandbox.deleted": z.ZodObject<{}, z.core.$loose>;
246
- /** A pod joined and serves the sandbox. */
247
- readonly "sandbox.running": z.ZodObject<{
467
+ /** Deleted by a `DELETE`, or by the sweep once `lifecycle.deleteAfter` passed (`reason`). */
468
+ readonly "environment.deleted": z.ZodObject<{
469
+ reason: z.ZodOptional<z.ZodEnum<{
470
+ delete: "delete";
471
+ deleteAfter: "deleteAfter";
472
+ }>>;
473
+ }, z.core.$loose>;
474
+ /** A pod joined and serves the Environment. */
475
+ readonly "environment.running": z.ZodObject<{
248
476
  hostEpoch: z.ZodNumber;
249
477
  }, z.core.$loose>;
250
478
  /** Stopped (`POST .../stop`, or idle): the volume is kept; the next turn starts it again. */
251
- readonly "sandbox.suspended": z.ZodObject<{
479
+ readonly "environment.suspended": z.ZodObject<{
252
480
  reason: z.ZodEnum<{
253
481
  idle: "idle";
254
482
  stop: "stop";
255
483
  }>;
256
484
  }, z.core.$loose>;
257
- /** Its TTL passed: turns are refused until a `PUT` sets a longer TTL. */
258
- readonly "sandbox.expired": z.ZodObject<{
259
- onExpiry: z.ZodEnum<{
260
- delete: "delete";
261
- retain: "retain";
262
- }>;
263
- }, z.core.$loose>;
264
485
  /** Its pod was replaced (same volume): the old pod's host token no longer works. */
265
- readonly "sandbox.relaunched": z.ZodObject<{
486
+ readonly "environment.relaunched": z.ZodObject<{
266
487
  hostEpoch: z.ZodNumber;
267
488
  }, z.core.$loose>;
268
489
  /** Its volume or node is gone: turns are refused until a reset. */
269
- readonly "sandbox.lost": z.ZodObject<{
490
+ readonly "environment.lost": z.ZodObject<{
270
491
  reason: z.ZodString;
271
492
  }, z.core.$loose>;
272
493
  /** Reset: a new pod on a new, empty volume. */
273
- readonly "sandbox.reset": z.ZodObject<{
494
+ readonly "environment.reset": z.ZodObject<{
274
495
  volumeGeneration: z.ZodNumber;
275
496
  }, z.core.$loose>;
276
497
  /** The pod did not become ready. */
277
- readonly "sandbox.failed": z.ZodObject<{
498
+ readonly "environment.failed": z.ZodObject<{
278
499
  reason: z.ZodString;
279
500
  }, z.core.$loose>;
501
+ /** A connection through egress-gate while no turn held the Environment (`egress.connection`'s payload). */
502
+ readonly "environment.egress": z.ZodObject<{
503
+ environmentId: z.ZodString;
504
+ host: z.ZodString;
505
+ port: z.ZodNumber;
506
+ outcome: z.ZodEnum<{
507
+ allowed: "allowed";
508
+ refused: "refused";
509
+ }>;
510
+ reason: z.ZodOptional<z.ZodString>;
511
+ status: z.ZodOptional<z.ZodNumber>;
512
+ mode: z.ZodEnum<{
513
+ credential: "credential";
514
+ tunnel: "tunnel";
515
+ }>;
516
+ credentialBound: z.ZodBoolean;
517
+ credentialIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
518
+ requests: z.ZodOptional<z.ZodNumber>;
519
+ bytesUp: z.ZodNumber;
520
+ bytesDown: z.ZodNumber;
521
+ durationMs: z.ZodNumber;
522
+ startedAt: z.ZodString;
523
+ }, z.core.$loose>;
280
524
  };
281
- export type SandboxEventPayload<T extends SandboxEventType> = z.infer<(typeof SANDBOX_EVENT_PAYLOADS)[T]>;
282
- /** One lifecycle event on a sandbox's stream, numbered from 0. */
283
- export declare const SandboxEventSchema: z.ZodObject<{
284
- schema: z.ZodLiteral<"nylorun.sandbox-event/1">;
525
+ export type EnvironmentEventPayload<T extends EnvironmentEventType> = z.infer<(typeof ENVIRONMENT_EVENT_PAYLOADS)[T]>;
526
+ /** One lifecycle event on an Environment's stream, numbered from 0. */
527
+ export declare const EnvironmentEventSchema: z.ZodObject<{
528
+ schema: z.ZodLiteral<"nylorun.environment-event/1">;
285
529
  eventId: z.ZodString;
286
530
  tenantId: z.ZodString;
287
- sandboxId: z.ZodString;
531
+ environmentId: z.ZodString;
288
532
  seq: z.ZodNumber;
289
533
  time: z.ZodString;
290
534
  type: z.ZodEnum<{
291
- "sandbox.attached": "sandbox.attached";
292
- "sandbox.created": "sandbox.created";
293
- "sandbox.deleted": "sandbox.deleted";
294
- "sandbox.detached": "sandbox.detached";
295
- "sandbox.expired": "sandbox.expired";
296
- "sandbox.failed": "sandbox.failed";
297
- "sandbox.lost": "sandbox.lost";
298
- "sandbox.relaunched": "sandbox.relaunched";
299
- "sandbox.reset": "sandbox.reset";
300
- "sandbox.running": "sandbox.running";
301
- "sandbox.suspended": "sandbox.suspended";
535
+ "environment.attached": "environment.attached";
536
+ "environment.created": "environment.created";
537
+ "environment.deleted": "environment.deleted";
538
+ "environment.detached": "environment.detached";
539
+ "environment.egress": "environment.egress";
540
+ "environment.failed": "environment.failed";
541
+ "environment.lost": "environment.lost";
542
+ "environment.relaunched": "environment.relaunched";
543
+ "environment.reset": "environment.reset";
544
+ "environment.running": "environment.running";
545
+ "environment.suspended": "environment.suspended";
302
546
  }>;
303
547
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
304
548
  }, z.core.$strict>;
305
- export type SandboxEvent = z.infer<typeof SandboxEventSchema>;
306
- export declare const ListSandboxEventsResponseSchema: z.ZodObject<{
549
+ export type EnvironmentEvent = z.infer<typeof EnvironmentEventSchema>;
550
+ export declare const ListEnvironmentEventsResponseSchema: z.ZodObject<{
307
551
  events: z.ZodArray<z.ZodObject<{
308
- schema: z.ZodLiteral<"nylorun.sandbox-event/1">;
552
+ schema: z.ZodLiteral<"nylorun.environment-event/1">;
309
553
  eventId: z.ZodString;
310
554
  tenantId: z.ZodString;
311
- sandboxId: z.ZodString;
555
+ environmentId: z.ZodString;
312
556
  seq: z.ZodNumber;
313
557
  time: z.ZodString;
314
558
  type: z.ZodEnum<{
315
- "sandbox.attached": "sandbox.attached";
316
- "sandbox.created": "sandbox.created";
317
- "sandbox.deleted": "sandbox.deleted";
318
- "sandbox.detached": "sandbox.detached";
319
- "sandbox.expired": "sandbox.expired";
320
- "sandbox.failed": "sandbox.failed";
321
- "sandbox.lost": "sandbox.lost";
322
- "sandbox.relaunched": "sandbox.relaunched";
323
- "sandbox.reset": "sandbox.reset";
324
- "sandbox.running": "sandbox.running";
325
- "sandbox.suspended": "sandbox.suspended";
559
+ "environment.attached": "environment.attached";
560
+ "environment.created": "environment.created";
561
+ "environment.deleted": "environment.deleted";
562
+ "environment.detached": "environment.detached";
563
+ "environment.egress": "environment.egress";
564
+ "environment.failed": "environment.failed";
565
+ "environment.lost": "environment.lost";
566
+ "environment.relaunched": "environment.relaunched";
567
+ "environment.reset": "environment.reset";
568
+ "environment.running": "environment.running";
569
+ "environment.suspended": "environment.suspended";
326
570
  }>;
327
571
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
328
572
  }, z.core.$strict>>;
329
573
  }, z.core.$strict>;
330
- /**
331
- * `PutSessionRequest.sandbox`: `false` for none, `{ id }` to attach a sandbox resource (Host
332
- * feature `sandboxes`), `{ session }` to share another session's sandbox, or an inline sandbox.
333
- * Omitted means the Tenant's default.
334
- */
335
- export declare const SandboxRequestSchema: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
336
- id: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
337
- }, z.core.$strict>, z.ZodObject<{
338
- session: z.ZodString;
339
- }, z.core.$strict>, z.ZodObject<{
340
- image: z.ZodOptional<z.ZodString>;
341
- network: z.ZodOptional<z.ZodObject<{
342
- allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
343
- }, z.core.$strict>>;
344
- resources: z.ZodOptional<z.ZodObject<{
345
- cpus: z.ZodOptional<z.ZodNumber>;
346
- memory: z.ZodOptional<z.ZodString>;
347
- }, z.core.$strict>>;
348
- }, z.core.$strict>]>;
349
- export type SandboxRequest = z.infer<typeof SandboxRequestSchema>;
350
574
  export declare const PutSessionRequestSchema: z.ZodObject<{
351
575
  requestId: z.ZodString;
352
576
  agentId: z.ZodString;
353
577
  ownerUserId: z.ZodString;
354
578
  info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
355
- vaultIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
356
- credentialSelections: z.ZodOptional<z.ZodArray<z.ZodObject<{
357
- serverName: z.ZodString;
358
- credentialId: z.ZodString;
359
- }, z.core.$strict>>>;
360
- sandbox: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
361
- id: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
362
- }, z.core.$strict>, z.ZodObject<{
363
- session: z.ZodString;
364
- }, z.core.$strict>, z.ZodObject<{
365
- image: z.ZodOptional<z.ZodString>;
366
- network: z.ZodOptional<z.ZodObject<{
367
- allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
368
- }, z.core.$strict>>;
369
- resources: z.ZodOptional<z.ZodObject<{
370
- cpus: z.ZodOptional<z.ZodNumber>;
371
- memory: z.ZodOptional<z.ZodString>;
372
- }, z.core.$strict>>;
373
- }, z.core.$strict>]>>;
579
+ environment: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
374
580
  }, z.core.$strict>;
581
+ export type PutSessionRequest = z.infer<typeof PutSessionRequestSchema>;
375
582
  /** The hosts a harness can run on (blueprint D38). */
376
- export declare const SANDBOX_PLACEMENT_HOSTS: readonly ["harness-container", "sandbox"];
377
- export type SandboxPlacementHost = (typeof SANDBOX_PLACEMENT_HOSTS)[number];
583
+ export declare const PLACEMENT_HOSTS: readonly ["harness-container", "sandbox"];
584
+ export type PlacementHost = (typeof PLACEMENT_HOSTS)[number];
378
585
  /**
379
- * A Tenant's sandbox configuration (Tenant setting `sandbox.config`): what a session gets when
380
- * it names no sandbox, and the limits every session's sandbox must fit.
586
+ * A Tenant's Environment settings (Tenant setting `environments.config`): the limits every
587
+ * Environment's recipe must fit, the pods' stop grace, and where harnesses may run.
381
588
  */
382
- export declare const TenantSandboxConfigSchema: z.ZodObject<{
383
- default: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"virtual">, z.ZodObject<{
384
- image: z.ZodOptional<z.ZodString>;
385
- network: z.ZodOptional<z.ZodObject<{
386
- allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
387
- }, z.core.$strict>>;
388
- resources: z.ZodOptional<z.ZodObject<{
389
- cpus: z.ZodOptional<z.ZodNumber>;
390
- memory: z.ZodOptional<z.ZodString>;
391
- }, z.core.$strict>>;
392
- }, z.core.$strict>]>>;
589
+ export declare const TenantEnvironmentsConfigSchema: z.ZodObject<{
393
590
  limits: z.ZodOptional<z.ZodObject<{
394
591
  network: z.ZodOptional<z.ZodArray<z.ZodString>>;
395
592
  resources: z.ZodOptional<z.ZodObject<{
@@ -401,14 +598,9 @@ export declare const TenantSandboxConfigSchema: z.ZodObject<{
401
598
  memory: z.ZodOptional<z.ZodString>;
402
599
  }, z.core.$strict>>;
403
600
  idle: z.ZodOptional<z.ZodString>;
404
- sandboxes: z.ZodOptional<z.ZodNumber>;
405
- ttl: z.ZodOptional<z.ZodString>;
601
+ environments: z.ZodOptional<z.ZodNumber>;
406
602
  }, z.core.$strict>>;
407
603
  lifecycle: z.ZodOptional<z.ZodObject<{
408
- onExpiry: z.ZodOptional<z.ZodEnum<{
409
- delete: "delete";
410
- retain: "retain";
411
- }>>;
412
604
  stopGrace: z.ZodOptional<z.ZodString>;
413
605
  }, z.core.$strict>>;
414
606
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -418,19 +610,9 @@ export declare const TenantSandboxConfigSchema: z.ZodObject<{
418
610
  }>>;
419
611
  }, z.core.$strict>>>;
420
612
  }, z.core.$strict>;
421
- export type TenantSandboxConfig = z.infer<typeof TenantSandboxConfigSchema>;
422
- /** `PUT /v1/tenant/sandbox`: replaces the Tenant's sandbox configuration. */
423
- export declare const PutTenantSandboxRequestSchema: z.ZodObject<{
424
- default: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"virtual">, z.ZodObject<{
425
- image: z.ZodOptional<z.ZodString>;
426
- network: z.ZodOptional<z.ZodObject<{
427
- allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
428
- }, z.core.$strict>>;
429
- resources: z.ZodOptional<z.ZodObject<{
430
- cpus: z.ZodOptional<z.ZodNumber>;
431
- memory: z.ZodOptional<z.ZodString>;
432
- }, z.core.$strict>>;
433
- }, z.core.$strict>]>>;
613
+ export type TenantEnvironmentsConfig = z.infer<typeof TenantEnvironmentsConfigSchema>;
614
+ /** `PUT /v1/tenant/sandbox`: replaces the Tenant's Environment settings (`environments.config`). */
615
+ export declare const PutTenantEnvironmentsRequestSchema: z.ZodObject<{
434
616
  limits: z.ZodOptional<z.ZodObject<{
435
617
  network: z.ZodOptional<z.ZodArray<z.ZodString>>;
436
618
  resources: z.ZodOptional<z.ZodObject<{
@@ -442,14 +624,9 @@ export declare const PutTenantSandboxRequestSchema: z.ZodObject<{
442
624
  memory: z.ZodOptional<z.ZodString>;
443
625
  }, z.core.$strict>>;
444
626
  idle: z.ZodOptional<z.ZodString>;
445
- sandboxes: z.ZodOptional<z.ZodNumber>;
446
- ttl: z.ZodOptional<z.ZodString>;
627
+ environments: z.ZodOptional<z.ZodNumber>;
447
628
  }, z.core.$strict>>;
448
629
  lifecycle: z.ZodOptional<z.ZodObject<{
449
- onExpiry: z.ZodOptional<z.ZodEnum<{
450
- delete: "delete";
451
- retain: "retain";
452
- }>>;
453
630
  stopGrace: z.ZodOptional<z.ZodString>;
454
631
  }, z.core.$strict>>;
455
632
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -460,22 +637,7 @@ export declare const PutTenantSandboxRequestSchema: z.ZodObject<{
460
637
  }, z.core.$strict>>>;
461
638
  requestId: z.ZodOptional<z.ZodString>;
462
639
  }, z.core.$strict>;
463
- export type PutTenantSandboxRequest = z.infer<typeof PutTenantSandboxRequestSchema>;
464
- export type PutSessionRequest = z.infer<typeof PutSessionRequestSchema>;
465
- /** The owner of every installation vault (`scope: "installation"`); a reserved subject. */
466
- export declare const INSTALLATION_OWNER = "installation";
467
- export declare const CreateVaultRequestSchema: z.ZodObject<{
468
- requestId: z.ZodString;
469
- idempotencyKey: z.ZodString;
470
- name: z.ZodString;
471
- scope: z.ZodOptional<z.ZodEnum<{
472
- installation: "installation";
473
- user: "user";
474
- }>>;
475
- ownerUserId: z.ZodOptional<z.ZodString>;
476
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
477
- }, z.core.$strict>;
478
- export type CreateVaultRequest = z.infer<typeof CreateVaultRequestSchema>;
640
+ export type PutTenantEnvironmentsRequest = z.infer<typeof PutTenantEnvironmentsRequestSchema>;
479
641
  /** An RFC 9110 field name. */
480
642
  export declare const HEADER_NAME_PATTERN: RegExp;
481
643
  /** A loopback host as a URL's `hostname` names it: plain `http` reaches only these. */
@@ -524,77 +686,52 @@ export declare const EnvironmentSecretInjectSchema: z.ZodObject<{
524
686
  format: z.ZodString;
525
687
  }, z.core.$strict>;
526
688
  export type EnvironmentSecretInject = z.infer<typeof EnvironmentSecretInjectSchema>;
689
+ /** The name of a credential for a tool (`bearer` or `headers`): a label of 1–64 characters. */
690
+ export declare const TOOL_SECRET_NAME_PATTERN: RegExp;
527
691
  /**
528
- * A credential for the server at `url` (the URL a manifest names): `bearer` sends
529
- * `Authorization: Bearer <token>`, `headers` its header map (R2b C2). The header names may not be
530
- * the MCP transport's headers or `Nylorun-*`.
531
- */
532
- export declare const CreateCredentialRequestSchema: z.ZodObject<{
533
- requestId: z.ZodString;
534
- idempotencyKey: z.ZodString;
535
- name: z.ZodString;
536
- auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
537
- via: z.ZodOptional<z.ZodString>;
538
- identity: z.ZodOptional<z.ZodObject<{
539
- header: z.ZodString;
540
- }, z.core.$strict>>;
541
- type: z.ZodLiteral<"bearer">;
542
- url: z.ZodString;
543
- token: z.ZodString;
544
- }, z.core.$strict>, z.ZodObject<{
545
- via: z.ZodOptional<z.ZodString>;
546
- identity: z.ZodOptional<z.ZodObject<{
547
- header: z.ZodString;
548
- }, z.core.$strict>>;
549
- type: z.ZodLiteral<"headers">;
550
- url: z.ZodString;
551
- headers: z.ZodRecord<z.ZodString, z.ZodString>;
552
- }, z.core.$strict>, z.ZodObject<{
553
- type: z.ZodLiteral<"environment_secret">;
554
- secretName: z.ZodString;
555
- secretValue: z.ZodString;
556
- allowedHosts: z.ZodArray<z.ZodString>;
557
- inject: z.ZodOptional<z.ZodObject<{
558
- header: z.ZodString;
559
- format: z.ZodString;
560
- }, z.core.$strict>>;
561
- }, z.core.$strict>, z.ZodObject<{
562
- type: z.ZodLiteral<"environment_variable">;
563
- variableName: z.ZodString;
564
- variableValue: z.ZodString;
565
- }, z.core.$strict>], "type">;
566
- }, z.core.$strict>;
567
- export type CreateCredentialRequest = z.infer<typeof CreateCredentialRequestSchema>;
568
- /**
569
- * Replaces a credential's secret; its type and URL stay. `via` and `identity` are kept unless
570
- * given (`null` removes one).
692
+ * `PUT /v1/environments/{environmentId}/secrets/{name}` (D56): creates or replaces one credential
693
+ * in the Environment's vault. For `environment_secret` and `environment_variable` the name is
694
+ * the variable's name (a POSIX name, not reserved); for `bearer` and `headers` it is a label.
695
+ * The same name and type keeps the credential and re-seals its value and binding; another type
696
+ * replaces it. Values are write-only: no route reads them back. Two `environment_secret`
697
+ * credentials bound to one host, or two `bearer`/`headers` credentials for one URL, are
698
+ * `409 credential_conflict`.
571
699
  */
572
- export declare const RotateCredentialRequestSchema: z.ZodObject<{
573
- requestId: z.ZodString;
574
- idempotencyKey: z.ZodString;
575
- auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
576
- via: z.ZodOptional<z.ZodNullable<z.ZodString>>;
577
- identity: z.ZodOptional<z.ZodNullable<z.ZodObject<{
578
- header: z.ZodString;
579
- }, z.core.$strict>>>;
580
- type: z.ZodLiteral<"bearer">;
581
- token: z.ZodString;
582
- }, z.core.$strict>, z.ZodObject<{
583
- via: z.ZodOptional<z.ZodNullable<z.ZodString>>;
584
- identity: z.ZodOptional<z.ZodNullable<z.ZodObject<{
585
- header: z.ZodString;
586
- }, z.core.$strict>>>;
587
- type: z.ZodLiteral<"headers">;
588
- headers: z.ZodRecord<z.ZodString, z.ZodString>;
589
- }, z.core.$strict>, z.ZodObject<{
590
- type: z.ZodLiteral<"environment_secret">;
591
- secretValue: z.ZodString;
592
- }, z.core.$strict>, z.ZodObject<{
593
- type: z.ZodLiteral<"environment_variable">;
594
- variableValue: z.ZodString;
595
- }, z.core.$strict>], "type">;
596
- }, z.core.$strict>;
597
- export type RotateCredentialRequest = z.infer<typeof RotateCredentialRequestSchema>;
700
+ export declare const PutEnvironmentSecretRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
701
+ requestId: z.ZodOptional<z.ZodString>;
702
+ type: z.ZodLiteral<"environment_secret">;
703
+ value: z.ZodString;
704
+ allowedHosts: z.ZodArray<z.ZodString>;
705
+ inject: z.ZodOptional<z.ZodObject<{
706
+ header: z.ZodString;
707
+ format: z.ZodString;
708
+ }, z.core.$strict>>;
709
+ }, z.core.$strict>, z.ZodObject<{
710
+ requestId: z.ZodOptional<z.ZodString>;
711
+ type: z.ZodLiteral<"environment_variable">;
712
+ value: z.ZodString;
713
+ }, z.core.$strict>, z.ZodObject<{
714
+ via: z.ZodOptional<z.ZodString>;
715
+ identity: z.ZodOptional<z.ZodObject<{
716
+ header: z.ZodString;
717
+ }, z.core.$strict>>;
718
+ requestId: z.ZodOptional<z.ZodString>;
719
+ type: z.ZodLiteral<"bearer">;
720
+ url: z.ZodString;
721
+ value: z.ZodString;
722
+ }, z.core.$strict>, z.ZodObject<{
723
+ via: z.ZodOptional<z.ZodString>;
724
+ identity: z.ZodOptional<z.ZodObject<{
725
+ header: z.ZodString;
726
+ }, z.core.$strict>>;
727
+ requestId: z.ZodOptional<z.ZodString>;
728
+ type: z.ZodLiteral<"headers">;
729
+ url: z.ZodString;
730
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
731
+ }, z.core.$strict>], "type">;
732
+ export type PutEnvironmentSecretRequest = z.infer<typeof PutEnvironmentSecretRequestSchema>;
733
+ /** Whether `name` may name a secret of `type` (`PUT .../secrets/{name}`); a message when not. */
734
+ export declare function environmentSecretNameError(type: PutEnvironmentSecretRequest["type"], name: string): string | undefined;
598
735
  /**
599
736
  * What the Runtime cannot learn from a custom OpenAI-compatible endpoint (Model Calls §7):
600
737
  * its context window and output limit, whether it reasons, and pi-ai `compat` settings
@@ -650,17 +787,12 @@ export declare const SelectHostModelRequestSchema: z.ZodObject<{
650
787
  }, z.core.$strict>;
651
788
  export type SelectHostModelRequest = z.infer<typeof SelectHostModelRequestSchema>;
652
789
  export type HostModelProviderInfo = z.infer<typeof HostModelProviderInfoSchema>;
653
- export declare const VaultInfoSchema: z.ZodObject<{
654
- id: z.ZodString;
655
- name: z.ZodString;
656
- ownerUserId: z.ZodString;
657
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
658
- createdAt: z.ZodString;
659
- }, z.core.$strict>;
660
- export type VaultInfo = z.infer<typeof VaultInfoSchema>;
661
- export declare const CredentialInfoSchema: z.ZodObject<{
662
- id: z.ZodString;
663
- vaultId: z.ZodString;
790
+ export declare const ENVIRONMENT_SECRET_TYPES: readonly ["bearer", "headers", "environment_secret", "environment_variable"];
791
+ /**
792
+ * One credential of an Environment's vault, never its value: what it is bound to (the server
793
+ * `url` for `bearer` and `headers`; the hosts and header for `environment_secret`).
794
+ */
795
+ export declare const EnvironmentSecretViewSchema: z.ZodObject<{
664
796
  name: z.ZodString;
665
797
  type: z.ZodEnum<{
666
798
  bearer: "bearer";
@@ -670,14 +802,11 @@ export declare const CredentialInfoSchema: z.ZodObject<{
670
802
  }>;
671
803
  binding: z.ZodObject<{
672
804
  url: z.ZodOptional<z.ZodString>;
673
- secretName: z.ZodOptional<z.ZodString>;
674
805
  allowedHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
675
806
  inject: z.ZodOptional<z.ZodObject<{
676
807
  header: z.ZodString;
677
808
  format: z.ZodString;
678
809
  }, z.core.$strict>>;
679
- variableName: z.ZodOptional<z.ZodString>;
680
- variableValue: z.ZodOptional<z.ZodString>;
681
810
  }, z.core.$strict>;
682
811
  headerNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
683
812
  via: z.ZodOptional<z.ZodString>;
@@ -687,14 +816,40 @@ export declare const CredentialInfoSchema: z.ZodObject<{
687
816
  createdAt: z.ZodString;
688
817
  rotatedAt: z.ZodOptional<z.ZodString>;
689
818
  }, z.core.$strict>;
690
- export type CredentialInfo = z.infer<typeof CredentialInfoSchema>;
819
+ export type EnvironmentSecretView = z.infer<typeof EnvironmentSecretViewSchema>;
820
+ export declare const ListEnvironmentSecretsResponseSchema: z.ZodObject<{
821
+ secrets: z.ZodArray<z.ZodObject<{
822
+ name: z.ZodString;
823
+ type: z.ZodEnum<{
824
+ bearer: "bearer";
825
+ environment_secret: "environment_secret";
826
+ environment_variable: "environment_variable";
827
+ headers: "headers";
828
+ }>;
829
+ binding: z.ZodObject<{
830
+ url: z.ZodOptional<z.ZodString>;
831
+ allowedHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
832
+ inject: z.ZodOptional<z.ZodObject<{
833
+ header: z.ZodString;
834
+ format: z.ZodString;
835
+ }, z.core.$strict>>;
836
+ }, z.core.$strict>;
837
+ headerNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
838
+ via: z.ZodOptional<z.ZodString>;
839
+ identity: z.ZodOptional<z.ZodObject<{
840
+ header: z.ZodString;
841
+ }, z.core.$strict>>;
842
+ createdAt: z.ZodString;
843
+ rotatedAt: z.ZodOptional<z.ZodString>;
844
+ }, z.core.$strict>>;
845
+ }, z.core.$strict>;
846
+ export type ListEnvironmentSecretsResponse = z.infer<typeof ListEnvironmentSecretsResponseSchema>;
691
847
  /** The MCP transports a preview speaks: a manifest's remote server types. */
692
848
  export declare const MCP_PREVIEW_TYPES: readonly ["streamable-http", "sse"];
693
849
  /**
694
850
  * `POST /v1/tenant/mcp/preview` (R2b C12): what a remote MCP server offers, before an agent
695
- * names it. The Runtime connects with the installation vault's credential for `url` (one
696
- * credential across the installation vaults, or the one in `vaultId`), lists the tools and
697
- * closes the connection; it never calls a tool.
851
+ * names it. The Runtime connects with the credential for `url` in the vault of `environmentId`
852
+ * (none without one), lists the tools and closes the connection; it never calls a tool.
698
853
  */
699
854
  export declare const McpPreviewRequestSchema: z.ZodObject<{
700
855
  requestId: z.ZodOptional<z.ZodString>;
@@ -704,7 +859,7 @@ export declare const McpPreviewRequestSchema: z.ZodObject<{
704
859
  "streamable-http": "streamable-http";
705
860
  }>>;
706
861
  name: z.ZodOptional<z.ZodString>;
707
- vaultId: z.ZodOptional<z.ZodString>;
862
+ environmentId: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
708
863
  }, z.core.$strict>;
709
864
  export type McpPreviewRequest = z.infer<typeof McpPreviewRequestSchema>;
710
865
  /** One tool a preview found. */
@@ -719,7 +874,7 @@ export type McpPreviewTool = z.infer<typeof McpPreviewToolSchema>;
719
874
  /**
720
875
  * A preview (R2b C12). A server that answered `401` is `authRequired`, with its RFC 9728
721
876
  * protected-resource metadata when it publishes any: it needs a person's sign-in or a key the
722
- * installation vaults do not hold, so reach it with a key or through a gateway (`via`).
877
+ * Environment's vault does not hold, so reach it with a key or through a gateway (`via`).
723
878
  */
724
879
  export declare const McpPreviewSchema: z.ZodObject<{
725
880
  name: z.ZodString;
@@ -748,6 +903,84 @@ export declare const McpPreviewSchema: z.ZodObject<{
748
903
  }, z.core.$strict>>;
749
904
  }, z.core.$strict>;
750
905
  export type McpPreview = z.infer<typeof McpPreviewSchema>;
906
+ /**
907
+ * `POST /v1/tenant/credential-coverage`: which credential each of a saved agent's remote MCP
908
+ * servers and HTTP tools would get in a session that names `environmentId`, decided as the
909
+ * session's tool calls decide it (by URL). It reads no secret and calls no server.
910
+ */
911
+ export declare const CredentialCoverageRequestSchema: z.ZodObject<{
912
+ requestId: z.ZodOptional<z.ZodString>;
913
+ agentId: z.ZodString;
914
+ environmentId: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
915
+ }, z.core.$strict>;
916
+ export type CredentialCoverageRequest = z.infer<typeof CredentialCoverageRequestSchema>;
917
+ /** A credential coverage names: where it is, never its value. */
918
+ export declare const CoverageCredentialSchema: z.ZodObject<{
919
+ environmentId: z.ZodString;
920
+ name: z.ZodString;
921
+ via: z.ZodOptional<z.ZodString>;
922
+ }, z.core.$strict>;
923
+ export type CoverageCredential = z.infer<typeof CoverageCredentialSchema>;
924
+ /**
925
+ * What a session would send for one URL an agent declares:
926
+ * - `covered`: the Environment's vault holds a credential for it (`credential`);
927
+ * - `missing`: it holds none: an MCP server is called without a credential (a public server
928
+ * needs none), an HTTP tool fails with `http.credential`.
929
+ */
930
+ export declare const COVERAGE_STATUSES: readonly ["covered", "missing"];
931
+ export type CoverageStatus = (typeof COVERAGE_STATUSES)[number];
932
+ /** One remote MCP server or HTTP tool credential an agent declares. */
933
+ export declare const CredentialCoverageEntrySchema: z.ZodObject<{
934
+ kind: z.ZodEnum<{
935
+ http: "http";
936
+ mcp: "mcp";
937
+ }>;
938
+ agentId: z.ZodOptional<z.ZodString>;
939
+ stage: z.ZodOptional<z.ZodString>;
940
+ name: z.ZodString;
941
+ serverName: z.ZodString;
942
+ url: z.ZodString;
943
+ required: z.ZodBoolean;
944
+ status: z.ZodEnum<{
945
+ covered: "covered";
946
+ missing: "missing";
947
+ }>;
948
+ credential: z.ZodOptional<z.ZodObject<{
949
+ environmentId: z.ZodString;
950
+ name: z.ZodString;
951
+ via: z.ZodOptional<z.ZodString>;
952
+ }, z.core.$strict>>;
953
+ message: z.ZodString;
954
+ }, z.core.$strict>;
955
+ export type CredentialCoverageEntry = z.infer<typeof CredentialCoverageEntrySchema>;
956
+ export declare const CredentialCoverageSchema: z.ZodObject<{
957
+ agentId: z.ZodString;
958
+ environmentId: z.ZodNullable<z.ZodString>;
959
+ complete: z.ZodBoolean;
960
+ entries: z.ZodArray<z.ZodObject<{
961
+ kind: z.ZodEnum<{
962
+ http: "http";
963
+ mcp: "mcp";
964
+ }>;
965
+ agentId: z.ZodOptional<z.ZodString>;
966
+ stage: z.ZodOptional<z.ZodString>;
967
+ name: z.ZodString;
968
+ serverName: z.ZodString;
969
+ url: z.ZodString;
970
+ required: z.ZodBoolean;
971
+ status: z.ZodEnum<{
972
+ covered: "covered";
973
+ missing: "missing";
974
+ }>;
975
+ credential: z.ZodOptional<z.ZodObject<{
976
+ environmentId: z.ZodString;
977
+ name: z.ZodString;
978
+ via: z.ZodOptional<z.ZodString>;
979
+ }, z.core.$strict>>;
980
+ message: z.ZodString;
981
+ }, z.core.$strict>>;
982
+ }, z.core.$strict>;
983
+ export type CredentialCoverage = z.infer<typeof CredentialCoverageSchema>;
751
984
  /** The most parts one message may carry (protocol 6). */
752
985
  export declare const MAX_MESSAGE_PARTS = 32;
753
986
  /**
@@ -891,10 +1124,18 @@ export type SessionEventBody = SessionCommand;
891
1124
  export type MessageEventBody = z.infer<typeof MessageEventBodySchema>;
892
1125
  /** The envelope every session event carries (`nylorun.event/2`, Durable Streams §9.5). */
893
1126
  export declare const EVENT_SCHEMA = "nylorun.event/2";
894
- /** Who wrote an event. v1 writes `loop` (the engine) and `api` (commands and results). */
1127
+ /**
1128
+ * Who wrote an event (track R4, R4.9): the writer says so, not the event's type. `client` is a
1129
+ * command over the Runtime API (its `principal` says who sent it), `core` is core's own logic
1130
+ * (settle, sweeps, the flow host, exports, the tools core serves), `harness` is what a harness
1131
+ * reported (`source.id` is its harness id, `runId` its run), and the gates are themselves.
1132
+ * `loop` and `api` are what events written before R4 say.
1133
+ */
895
1134
  export declare const EventSourceKindSchema: z.ZodEnum<{
896
1135
  api: "api";
1136
+ client: "client";
897
1137
  controller: "controller";
1138
+ core: "core";
898
1139
  edge: "edge";
899
1140
  "egress-gate": "egress-gate";
900
1141
  evidence: "evidence";
@@ -909,7 +1150,12 @@ export declare const EventSourceKindSchema: z.ZodEnum<{
909
1150
  "tool-gate": "tool-gate";
910
1151
  }>;
911
1152
  export type EventSourceKind = z.infer<typeof EventSourceKindSchema>;
912
- /** How far an event can be trusted, by who could forge it. v1 writes `observed` only. */
1153
+ /**
1154
+ * How far an event can be trusted, by who could forge it. `observed`: the Runtime saw it itself
1155
+ * (commands, the tools core serves, gate records, core's settle). `claimed`: a harness reported
1156
+ * it (an assistant message, a tool result it ran, its turn's end), so it is the harness's claim;
1157
+ * the Model Gate's usage row is the measured record of the same model call.
1158
+ */
913
1159
  export declare const EvidenceClassSchema: z.ZodEnum<{
914
1160
  asserted: "asserted";
915
1161
  attested: "attested";
@@ -918,6 +1164,31 @@ export declare const EvidenceClassSchema: z.ZodEnum<{
918
1164
  observed: "observed";
919
1165
  }>;
920
1166
  export type EvidenceClass = z.infer<typeof EvidenceClassSchema>;
1167
+ /** A command's sender (R4.9): from the request's credential, never from its body. */
1168
+ export declare const EventPrincipalSchema: z.ZodObject<{
1169
+ kind: z.ZodEnum<{
1170
+ application: "application";
1171
+ core: "core";
1172
+ "flow-host": "flow-host";
1173
+ subject: "subject";
1174
+ }>;
1175
+ id: z.ZodString;
1176
+ }, z.core.$strict>;
1177
+ export type EventPrincipal = z.infer<typeof EventPrincipalSchema>;
1178
+ /**
1179
+ * Who wrote an event, as its writer says (R4.9). Absent, core wrote it and saw it (`core`,
1180
+ * `observed`).
1181
+ */
1182
+ export interface EventWriter {
1183
+ readonly source: {
1184
+ readonly kind: EventSourceKind;
1185
+ readonly id: string;
1186
+ };
1187
+ readonly evidence?: EvidenceClass;
1188
+ /** The run the event was written in. */
1189
+ readonly runId?: string;
1190
+ readonly principal?: EventPrincipal;
1191
+ }
921
1192
  /**
922
1193
  * The envelope fields. Not strict: a client strips fields it does not know, so the envelope
923
1194
  * can grow without a protocol bump.
@@ -945,7 +1216,9 @@ declare const eventEnvelope: {
945
1216
  source: z.ZodObject<{
946
1217
  kind: z.ZodEnum<{
947
1218
  api: "api";
1219
+ client: "client";
948
1220
  controller: "controller";
1221
+ core: "core";
949
1222
  edge: "edge";
950
1223
  "egress-gate": "egress-gate";
951
1224
  evidence: "evidence";
@@ -968,6 +1241,16 @@ declare const eventEnvelope: {
968
1241
  measured: "measured";
969
1242
  observed: "observed";
970
1243
  }>;
1244
+ /** Who sent a command (`command.*`, a cancel's `turn.cancelled`), from its credential (R4.9). */
1245
+ principal: z.ZodOptional<z.ZodObject<{
1246
+ kind: z.ZodEnum<{
1247
+ application: "application";
1248
+ core: "core";
1249
+ "flow-host": "flow-host";
1250
+ subject: "subject";
1251
+ }>;
1252
+ id: z.ZodString;
1253
+ }, z.core.$strict>>;
971
1254
  trace: z.ZodOptional<z.ZodObject<{
972
1255
  traceId: z.ZodString;
973
1256
  spanId: z.ZodString;
@@ -1003,7 +1286,9 @@ export declare const LiveEventSchema: z.ZodObject<{
1003
1286
  source: z.ZodObject<{
1004
1287
  kind: z.ZodEnum<{
1005
1288
  api: "api";
1289
+ client: "client";
1006
1290
  controller: "controller";
1291
+ core: "core";
1007
1292
  edge: "edge";
1008
1293
  "egress-gate": "egress-gate";
1009
1294
  evidence: "evidence";
@@ -1026,6 +1311,15 @@ export declare const LiveEventSchema: z.ZodObject<{
1026
1311
  measured: "measured";
1027
1312
  observed: "observed";
1028
1313
  }>;
1314
+ principal: z.ZodOptional<z.ZodObject<{
1315
+ kind: z.ZodEnum<{
1316
+ application: "application";
1317
+ core: "core";
1318
+ "flow-host": "flow-host";
1319
+ subject: "subject";
1320
+ }>;
1321
+ id: z.ZodString;
1322
+ }, z.core.$strict>>;
1029
1323
  trace: z.ZodOptional<z.ZodObject<{
1030
1324
  traceId: z.ZodString;
1031
1325
  spanId: z.ZodString;
@@ -1061,6 +1355,12 @@ export declare const RejectedResponseSchema: z.ZodObject<{
1061
1355
  credential_rejected: "credential_rejected";
1062
1356
  credential_required: "credential_required";
1063
1357
  definition_files_missing: "definition_files_missing";
1358
+ environment_busy: "environment_busy";
1359
+ environment_lost: "environment_lost";
1360
+ environment_not_granted: "environment_not_granted";
1361
+ environment_owner_mismatch: "environment_owner_mismatch";
1362
+ environment_unavailable: "environment_unavailable";
1363
+ harness_mismatch: "harness_mismatch";
1064
1364
  host_rejected: "host_rejected";
1065
1365
  incompatible_host: "incompatible_host";
1066
1366
  internal_error: "internal_error";
@@ -1074,12 +1374,8 @@ export declare const RejectedResponseSchema: z.ZodObject<{
1074
1374
  placement_refused: "placement_refused";
1075
1375
  protocol_unsupported: "protocol_unsupported";
1076
1376
  request_rejected: "request_rejected";
1077
- sandbox_busy: "sandbox_busy";
1078
- sandbox_expired: "sandbox_expired";
1079
- sandbox_lost: "sandbox_lost";
1080
- sandbox_not_granted: "sandbox_not_granted";
1081
- sandbox_unavailable: "sandbox_unavailable";
1082
1377
  scope_required: "scope_required";
1378
+ session_closed: "session_closed";
1083
1379
  subject_invalid: "subject_invalid";
1084
1380
  subject_required: "subject_required";
1085
1381
  token_expired: "token_expired";
@@ -1097,9 +1393,32 @@ export declare const AgentRefSchema: z.ZodObject<{
1097
1393
  path: z.ZodString;
1098
1394
  delegationId: z.ZodOptional<z.ZodString>;
1099
1395
  }, z.core.$strict>;
1396
+ /**
1397
+ * When a gate served a call (R7.1): its own start and end, as it measured them. Absent when no
1398
+ * gate measured the call (a fixture model, a sandbox or core-served tool, a call refused before
1399
+ * it was sent).
1400
+ */
1401
+ export declare const GateTimesSchema: z.ZodObject<{
1402
+ startedAt: z.ZodString;
1403
+ endedAt: z.ZodString;
1404
+ }, z.core.$loose>;
1405
+ /**
1406
+ * What the Model Gate's meter recorded for a model call (R7.1), from the usage ledger: the
1407
+ * tokens and cost the Runtime counts, beside the `usage` the harness reported. `cachedTokens`
1408
+ * and `costUsd` are absent when zero.
1409
+ */
1410
+ export declare const MeteredUsageSchema: z.ZodObject<{
1411
+ inputTokens: z.ZodNumber;
1412
+ outputTokens: z.ZodNumber;
1413
+ totalTokens: z.ZodNumber;
1414
+ cachedTokens: z.ZodOptional<z.ZodNumber>;
1415
+ costUsd: z.ZodOptional<z.ZodNumber>;
1416
+ }, z.core.$loose>;
1100
1417
  /**
1101
1418
  * `message.assistant`: one completed model step. `invocationId` is the model call's.
1102
- * `model`, `finishReason` and `usage` are present when the provider reported them.
1419
+ * `model`, `finishReason` and `usage` are present when the provider reported them. A step that
1420
+ * said nothing (no text, no tool calls, as a structured answer) has `text: ""` and no tool
1421
+ * calls: it is in the log for its timing, and is never a message (`isEmptyAssistantMessage`).
1103
1422
  */
1104
1423
  export declare const AssistantMessagePayloadSchema: z.ZodObject<{
1105
1424
  agent: z.ZodOptional<z.ZodObject<{
@@ -1107,6 +1426,20 @@ export declare const AssistantMessagePayloadSchema: z.ZodObject<{
1107
1426
  path: z.ZodString;
1108
1427
  delegationId: z.ZodOptional<z.ZodString>;
1109
1428
  }, z.core.$loose>>;
1429
+ effectId: z.ZodOptional<z.ZodString>;
1430
+ durationMs: z.ZodOptional<z.ZodNumber>;
1431
+ gate: z.ZodOptional<z.ZodObject<{
1432
+ startedAt: z.ZodString;
1433
+ endedAt: z.ZodString;
1434
+ }, z.core.$loose>>;
1435
+ firstTokenMs: z.ZodOptional<z.ZodNumber>;
1436
+ meteredUsage: z.ZodOptional<z.ZodObject<{
1437
+ inputTokens: z.ZodNumber;
1438
+ outputTokens: z.ZodNumber;
1439
+ totalTokens: z.ZodNumber;
1440
+ cachedTokens: z.ZodOptional<z.ZodNumber>;
1441
+ costUsd: z.ZodOptional<z.ZodNumber>;
1442
+ }, z.core.$loose>>;
1110
1443
  invocationId: z.ZodString;
1111
1444
  text: z.ZodString;
1112
1445
  model: z.ZodOptional<z.ZodObject<{
@@ -1121,6 +1454,11 @@ export declare const AssistantMessagePayloadSchema: z.ZodObject<{
1121
1454
  input: z.ZodUnknown;
1122
1455
  }, z.core.$loose>>;
1123
1456
  }, z.core.$loose>;
1457
+ /** True when a `message.assistant` said nothing: no text and no tool calls (R7.1). */
1458
+ export declare function isEmptyAssistantMessage(payload: {
1459
+ readonly text?: unknown;
1460
+ readonly toolCalls?: readonly unknown[];
1461
+ }): boolean;
1124
1462
  /**
1125
1463
  * `model.failed`: a model call that failed in a known way (Model Calls §6.4). The turn
1126
1464
  * then fails with `model.<code>`, or recovers.
@@ -1131,6 +1469,20 @@ export declare const ModelFailedPayloadSchema: z.ZodObject<{
1131
1469
  path: z.ZodString;
1132
1470
  delegationId: z.ZodOptional<z.ZodString>;
1133
1471
  }, z.core.$loose>>;
1472
+ effectId: z.ZodOptional<z.ZodString>;
1473
+ durationMs: z.ZodOptional<z.ZodNumber>;
1474
+ gate: z.ZodOptional<z.ZodObject<{
1475
+ startedAt: z.ZodString;
1476
+ endedAt: z.ZodString;
1477
+ }, z.core.$loose>>;
1478
+ firstTokenMs: z.ZodOptional<z.ZodNumber>;
1479
+ meteredUsage: z.ZodOptional<z.ZodObject<{
1480
+ inputTokens: z.ZodNumber;
1481
+ outputTokens: z.ZodNumber;
1482
+ totalTokens: z.ZodNumber;
1483
+ cachedTokens: z.ZodOptional<z.ZodNumber>;
1484
+ costUsd: z.ZodOptional<z.ZodNumber>;
1485
+ }, z.core.$loose>>;
1134
1486
  invocationId: z.ZodOptional<z.ZodString>;
1135
1487
  code: z.ZodString;
1136
1488
  message: z.ZodString;
@@ -1138,7 +1490,8 @@ export declare const ModelFailedPayloadSchema: z.ZodObject<{
1138
1490
  }, z.core.$loose>;
1139
1491
  /**
1140
1492
  * `context.compacted`: the engine summarized older history to fit the model's window
1141
- * (Model Calls §8). Token counts are estimates.
1493
+ * (Model Calls §8). Token counts are estimates. `partial: true`: one summary call of several,
1494
+ * in the log for its timing; only the last one (without `partial`) replaced the history.
1142
1495
  */
1143
1496
  export declare const ContextCompactedPayloadSchema: z.ZodObject<{
1144
1497
  agent: z.ZodOptional<z.ZodObject<{
@@ -1146,6 +1499,20 @@ export declare const ContextCompactedPayloadSchema: z.ZodObject<{
1146
1499
  path: z.ZodString;
1147
1500
  delegationId: z.ZodOptional<z.ZodString>;
1148
1501
  }, z.core.$loose>>;
1502
+ effectId: z.ZodOptional<z.ZodString>;
1503
+ durationMs: z.ZodOptional<z.ZodNumber>;
1504
+ gate: z.ZodOptional<z.ZodObject<{
1505
+ startedAt: z.ZodString;
1506
+ endedAt: z.ZodString;
1507
+ }, z.core.$loose>>;
1508
+ firstTokenMs: z.ZodOptional<z.ZodNumber>;
1509
+ meteredUsage: z.ZodOptional<z.ZodObject<{
1510
+ inputTokens: z.ZodNumber;
1511
+ outputTokens: z.ZodNumber;
1512
+ totalTokens: z.ZodNumber;
1513
+ cachedTokens: z.ZodOptional<z.ZodNumber>;
1514
+ costUsd: z.ZodOptional<z.ZodNumber>;
1515
+ }, z.core.$loose>>;
1149
1516
  invocationId: z.ZodOptional<z.ZodString>;
1150
1517
  trigger: z.ZodEnum<{
1151
1518
  overflow: "overflow";
@@ -1153,8 +1520,33 @@ export declare const ContextCompactedPayloadSchema: z.ZodObject<{
1153
1520
  }>;
1154
1521
  tokensBefore: z.ZodNumber;
1155
1522
  tokensAfter: z.ZodNumber;
1523
+ partial: z.ZodOptional<z.ZodLiteral<true>>;
1524
+ }, z.core.$loose>;
1525
+ /** How a tool call ended (R5.1): the tool answered, the Runtime ended it, or a cancel did. */
1526
+ export declare const TOOL_CALL_STATUSES: readonly ["completed", "failed", "cancelled"];
1527
+ /** Where a tool call ran (R5.1): a remote MCP server, an HTTP tool, the sandbox, or core. */
1528
+ export declare const TOOL_CALL_KINDS: readonly ["mcp", "http", "sandbox", "platform"];
1529
+ /**
1530
+ * What the Tenant's tool policy did with a tool call (R5 step 2), when it did more than allow
1531
+ * it: `deny` refused it unsent; `ask` held it for a person, who approved it (`approvedBy`, when
1532
+ * known) or denied it.
1533
+ */
1534
+ export declare const ToolPolicyFactSchema: z.ZodObject<{
1535
+ decision: z.ZodEnum<{
1536
+ ask: "ask";
1537
+ deny: "deny";
1538
+ }>;
1539
+ reason: z.ZodString;
1540
+ approvedBy: z.ZodOptional<z.ZodString>;
1156
1541
  }, z.core.$loose>;
1157
- /** `tool.completed`: a tool the Runtime ran (HTTP, MCP, sandbox, built-in). `error` for a tool error. */
1542
+ /**
1543
+ * `tool.completed`: how one tool call ended, written once per call (R5.1). `status`
1544
+ * `completed`: the tool answered, with its output or the tool error it reported (`error`).
1545
+ * `failed`: the Runtime ended the call (`tool.disabled`, `tool.unavailable`, `tool.denied`, or
1546
+ * `tool.interrupted` for a call a crash interrupted, which may have run). `cancelled`: the turn
1547
+ * was cancelled while the call ran; it may have run. `attempts` above 1: the call was sent again
1548
+ * after a crash, with the same key.
1549
+ */
1158
1550
  export declare const ToolCompletedPayloadSchema: z.ZodObject<{
1159
1551
  agent: z.ZodOptional<z.ZodObject<{
1160
1552
  id: z.ZodString;
@@ -1163,17 +1555,40 @@ export declare const ToolCompletedPayloadSchema: z.ZodObject<{
1163
1555
  }, z.core.$loose>>;
1164
1556
  callId: z.ZodString;
1165
1557
  invocationId: z.ZodString;
1558
+ effectId: z.ZodOptional<z.ZodString>;
1166
1559
  capabilityId: z.ZodString;
1167
1560
  toolName: z.ZodString;
1561
+ status: z.ZodOptional<z.ZodEnum<{
1562
+ cancelled: "cancelled";
1563
+ completed: "completed";
1564
+ failed: "failed";
1565
+ }>>;
1566
+ kind: z.ZodOptional<z.ZodEnum<{
1567
+ http: "http";
1568
+ mcp: "mcp";
1569
+ platform: "platform";
1570
+ sandbox: "sandbox";
1571
+ }>>;
1572
+ server: z.ZodOptional<z.ZodString>;
1573
+ attempts: z.ZodOptional<z.ZodNumber>;
1574
+ durationMs: z.ZodOptional<z.ZodNumber>;
1575
+ gate: z.ZodOptional<z.ZodObject<{
1576
+ startedAt: z.ZodString;
1577
+ endedAt: z.ZodString;
1578
+ }, z.core.$loose>>;
1579
+ policy: z.ZodOptional<z.ZodObject<{
1580
+ decision: z.ZodEnum<{
1581
+ ask: "ask";
1582
+ deny: "deny";
1583
+ }>;
1584
+ reason: z.ZodString;
1585
+ approvedBy: z.ZodOptional<z.ZodString>;
1586
+ }, z.core.$loose>>;
1168
1587
  output: z.ZodOptional<z.ZodUnknown>;
1169
1588
  error: z.ZodOptional<z.ZodObject<{
1170
1589
  code: z.ZodString;
1171
1590
  message: z.ZodString;
1172
1591
  server: z.ZodOptional<z.ZodString>;
1173
- vault: z.ZodOptional<z.ZodEnum<{
1174
- installation: "installation";
1175
- user: "user";
1176
- }>>;
1177
1592
  retryable: z.ZodOptional<z.ZodBoolean>;
1178
1593
  }, z.core.$loose>>;
1179
1594
  redacted: z.ZodOptional<z.ZodNumber>;
@@ -1183,6 +1598,14 @@ export declare const EffectUncertainPayloadSchema: z.ZodObject<{
1183
1598
  message: z.ZodOptional<z.ZodString>;
1184
1599
  }, z.core.$loose>;
1185
1600
  export declare const TurnCompletedPayloadSchema: z.ZodObject<{
1601
+ durationMs: z.ZodOptional<z.ZodNumber>;
1602
+ pausedMs: z.ZodOptional<z.ZodNumber>;
1603
+ agentId: z.ZodOptional<z.ZodString>;
1604
+ totals: z.ZodOptional<z.ZodObject<{
1605
+ steps: z.ZodNumber;
1606
+ tokens: z.ZodNumber;
1607
+ costUsd: z.ZodNumber;
1608
+ }, z.core.$loose>>;
1186
1609
  output: z.ZodUnknown;
1187
1610
  }, z.core.$loose>;
1188
1611
  export declare const TurnPausedPayloadSchema: z.ZodObject<{
@@ -1198,6 +1621,14 @@ export declare const TurnPausedPayloadSchema: z.ZodObject<{
1198
1621
  }, z.core.$loose>;
1199
1622
  /** Either `{ error: { code, message } }` or, when a segment threw, `{ message }`. */
1200
1623
  export declare const TurnFailedPayloadSchema: z.ZodObject<{
1624
+ durationMs: z.ZodOptional<z.ZodNumber>;
1625
+ pausedMs: z.ZodOptional<z.ZodNumber>;
1626
+ agentId: z.ZodOptional<z.ZodString>;
1627
+ totals: z.ZodOptional<z.ZodObject<{
1628
+ steps: z.ZodNumber;
1629
+ tokens: z.ZodNumber;
1630
+ costUsd: z.ZodNumber;
1631
+ }, z.core.$loose>>;
1201
1632
  error: z.ZodOptional<z.ZodObject<{
1202
1633
  code: z.ZodOptional<z.ZodString>;
1203
1634
  message: z.ZodOptional<z.ZodString>;
@@ -1205,6 +1636,14 @@ export declare const TurnFailedPayloadSchema: z.ZodObject<{
1205
1636
  message: z.ZodOptional<z.ZodString>;
1206
1637
  }, z.core.$loose>;
1207
1638
  export declare const TurnCancelledPayloadSchema: z.ZodObject<{
1639
+ durationMs: z.ZodOptional<z.ZodNumber>;
1640
+ pausedMs: z.ZodOptional<z.ZodNumber>;
1641
+ agentId: z.ZodOptional<z.ZodString>;
1642
+ totals: z.ZodOptional<z.ZodObject<{
1643
+ steps: z.ZodNumber;
1644
+ tokens: z.ZodNumber;
1645
+ costUsd: z.ZodNumber;
1646
+ }, z.core.$loose>>;
1208
1647
  reason: z.ZodOptional<z.ZodString>;
1209
1648
  }, z.core.$loose>;
1210
1649
  /** Lifecycle of an agent used as a tool. `agent.delegationId` is the parent call's invocation. */
@@ -1223,6 +1662,20 @@ declare const TRANSCRIPT_PAYLOADS: {
1223
1662
  path: z.ZodString;
1224
1663
  delegationId: z.ZodOptional<z.ZodString>;
1225
1664
  }, z.core.$loose>>;
1665
+ effectId: z.ZodOptional<z.ZodString>;
1666
+ durationMs: z.ZodOptional<z.ZodNumber>;
1667
+ gate: z.ZodOptional<z.ZodObject<{
1668
+ startedAt: z.ZodString;
1669
+ endedAt: z.ZodString;
1670
+ }, z.core.$loose>>;
1671
+ firstTokenMs: z.ZodOptional<z.ZodNumber>;
1672
+ meteredUsage: z.ZodOptional<z.ZodObject<{
1673
+ inputTokens: z.ZodNumber;
1674
+ outputTokens: z.ZodNumber;
1675
+ totalTokens: z.ZodNumber;
1676
+ cachedTokens: z.ZodOptional<z.ZodNumber>;
1677
+ costUsd: z.ZodOptional<z.ZodNumber>;
1678
+ }, z.core.$loose>>;
1226
1679
  invocationId: z.ZodString;
1227
1680
  text: z.ZodString;
1228
1681
  model: z.ZodOptional<z.ZodObject<{
@@ -1243,6 +1696,20 @@ declare const TRANSCRIPT_PAYLOADS: {
1243
1696
  path: z.ZodString;
1244
1697
  delegationId: z.ZodOptional<z.ZodString>;
1245
1698
  }, z.core.$loose>>;
1699
+ effectId: z.ZodOptional<z.ZodString>;
1700
+ durationMs: z.ZodOptional<z.ZodNumber>;
1701
+ gate: z.ZodOptional<z.ZodObject<{
1702
+ startedAt: z.ZodString;
1703
+ endedAt: z.ZodString;
1704
+ }, z.core.$loose>>;
1705
+ firstTokenMs: z.ZodOptional<z.ZodNumber>;
1706
+ meteredUsage: z.ZodOptional<z.ZodObject<{
1707
+ inputTokens: z.ZodNumber;
1708
+ outputTokens: z.ZodNumber;
1709
+ totalTokens: z.ZodNumber;
1710
+ cachedTokens: z.ZodOptional<z.ZodNumber>;
1711
+ costUsd: z.ZodOptional<z.ZodNumber>;
1712
+ }, z.core.$loose>>;
1246
1713
  invocationId: z.ZodOptional<z.ZodString>;
1247
1714
  code: z.ZodString;
1248
1715
  message: z.ZodString;
@@ -1254,6 +1721,20 @@ declare const TRANSCRIPT_PAYLOADS: {
1254
1721
  path: z.ZodString;
1255
1722
  delegationId: z.ZodOptional<z.ZodString>;
1256
1723
  }, z.core.$loose>>;
1724
+ effectId: z.ZodOptional<z.ZodString>;
1725
+ durationMs: z.ZodOptional<z.ZodNumber>;
1726
+ gate: z.ZodOptional<z.ZodObject<{
1727
+ startedAt: z.ZodString;
1728
+ endedAt: z.ZodString;
1729
+ }, z.core.$loose>>;
1730
+ firstTokenMs: z.ZodOptional<z.ZodNumber>;
1731
+ meteredUsage: z.ZodOptional<z.ZodObject<{
1732
+ inputTokens: z.ZodNumber;
1733
+ outputTokens: z.ZodNumber;
1734
+ totalTokens: z.ZodNumber;
1735
+ cachedTokens: z.ZodOptional<z.ZodNumber>;
1736
+ costUsd: z.ZodOptional<z.ZodNumber>;
1737
+ }, z.core.$loose>>;
1257
1738
  invocationId: z.ZodOptional<z.ZodString>;
1258
1739
  trigger: z.ZodEnum<{
1259
1740
  overflow: "overflow";
@@ -1261,6 +1742,7 @@ declare const TRANSCRIPT_PAYLOADS: {
1261
1742
  }>;
1262
1743
  tokensBefore: z.ZodNumber;
1263
1744
  tokensAfter: z.ZodNumber;
1745
+ partial: z.ZodOptional<z.ZodLiteral<true>>;
1264
1746
  }, z.core.$loose>;
1265
1747
  readonly "tool.completed": z.ZodObject<{
1266
1748
  agent: z.ZodOptional<z.ZodObject<{
@@ -1270,17 +1752,40 @@ declare const TRANSCRIPT_PAYLOADS: {
1270
1752
  }, z.core.$loose>>;
1271
1753
  callId: z.ZodString;
1272
1754
  invocationId: z.ZodString;
1755
+ effectId: z.ZodOptional<z.ZodString>;
1273
1756
  capabilityId: z.ZodString;
1274
1757
  toolName: z.ZodString;
1758
+ status: z.ZodOptional<z.ZodEnum<{
1759
+ cancelled: "cancelled";
1760
+ completed: "completed";
1761
+ failed: "failed";
1762
+ }>>;
1763
+ kind: z.ZodOptional<z.ZodEnum<{
1764
+ http: "http";
1765
+ mcp: "mcp";
1766
+ platform: "platform";
1767
+ sandbox: "sandbox";
1768
+ }>>;
1769
+ server: z.ZodOptional<z.ZodString>;
1770
+ attempts: z.ZodOptional<z.ZodNumber>;
1771
+ durationMs: z.ZodOptional<z.ZodNumber>;
1772
+ gate: z.ZodOptional<z.ZodObject<{
1773
+ startedAt: z.ZodString;
1774
+ endedAt: z.ZodString;
1775
+ }, z.core.$loose>>;
1776
+ policy: z.ZodOptional<z.ZodObject<{
1777
+ decision: z.ZodEnum<{
1778
+ ask: "ask";
1779
+ deny: "deny";
1780
+ }>;
1781
+ reason: z.ZodString;
1782
+ approvedBy: z.ZodOptional<z.ZodString>;
1783
+ }, z.core.$loose>>;
1275
1784
  output: z.ZodOptional<z.ZodUnknown>;
1276
1785
  error: z.ZodOptional<z.ZodObject<{
1277
1786
  code: z.ZodString;
1278
1787
  message: z.ZodString;
1279
1788
  server: z.ZodOptional<z.ZodString>;
1280
- vault: z.ZodOptional<z.ZodEnum<{
1281
- installation: "installation";
1282
- user: "user";
1283
- }>>;
1284
1789
  retryable: z.ZodOptional<z.ZodBoolean>;
1285
1790
  }, z.core.$loose>>;
1286
1791
  redacted: z.ZodOptional<z.ZodNumber>;
@@ -1290,6 +1795,14 @@ declare const TRANSCRIPT_PAYLOADS: {
1290
1795
  message: z.ZodOptional<z.ZodString>;
1291
1796
  }, z.core.$loose>;
1292
1797
  readonly "turn.completed": z.ZodObject<{
1798
+ durationMs: z.ZodOptional<z.ZodNumber>;
1799
+ pausedMs: z.ZodOptional<z.ZodNumber>;
1800
+ agentId: z.ZodOptional<z.ZodString>;
1801
+ totals: z.ZodOptional<z.ZodObject<{
1802
+ steps: z.ZodNumber;
1803
+ tokens: z.ZodNumber;
1804
+ costUsd: z.ZodNumber;
1805
+ }, z.core.$loose>>;
1293
1806
  output: z.ZodUnknown;
1294
1807
  }, z.core.$loose>;
1295
1808
  readonly "turn.paused": z.ZodObject<{
@@ -1304,6 +1817,14 @@ declare const TRANSCRIPT_PAYLOADS: {
1304
1817
  }, z.core.$loose>>;
1305
1818
  }, z.core.$loose>;
1306
1819
  readonly "turn.failed": z.ZodObject<{
1820
+ durationMs: z.ZodOptional<z.ZodNumber>;
1821
+ pausedMs: z.ZodOptional<z.ZodNumber>;
1822
+ agentId: z.ZodOptional<z.ZodString>;
1823
+ totals: z.ZodOptional<z.ZodObject<{
1824
+ steps: z.ZodNumber;
1825
+ tokens: z.ZodNumber;
1826
+ costUsd: z.ZodNumber;
1827
+ }, z.core.$loose>>;
1307
1828
  error: z.ZodOptional<z.ZodObject<{
1308
1829
  code: z.ZodOptional<z.ZodString>;
1309
1830
  message: z.ZodOptional<z.ZodString>;
@@ -1311,6 +1832,14 @@ declare const TRANSCRIPT_PAYLOADS: {
1311
1832
  message: z.ZodOptional<z.ZodString>;
1312
1833
  }, z.core.$loose>;
1313
1834
  readonly "turn.cancelled": z.ZodObject<{
1835
+ durationMs: z.ZodOptional<z.ZodNumber>;
1836
+ pausedMs: z.ZodOptional<z.ZodNumber>;
1837
+ agentId: z.ZodOptional<z.ZodString>;
1838
+ totals: z.ZodOptional<z.ZodObject<{
1839
+ steps: z.ZodNumber;
1840
+ tokens: z.ZodNumber;
1841
+ costUsd: z.ZodNumber;
1842
+ }, z.core.$loose>>;
1314
1843
  reason: z.ZodOptional<z.ZodString>;
1315
1844
  }, z.core.$loose>;
1316
1845
  readonly "delegation.started": z.ZodObject<{
@@ -1348,6 +1877,10 @@ export declare const CommandMessagePayloadSchema: z.ZodObject<{
1348
1877
  version: z.ZodOptional<z.ZodNumber>;
1349
1878
  }, z.core.$strict>], "type">>>;
1350
1879
  manifest: z.ZodOptional<z.ZodUnknown>;
1880
+ trace: z.ZodOptional<z.ZodObject<{
1881
+ traceparent: z.ZodString;
1882
+ tracestate: z.ZodOptional<z.ZodString>;
1883
+ }, z.core.$loose>>;
1351
1884
  }, z.core.$loose>;
1352
1885
  /** `command.approve`: an answer to an approval interaction. */
1353
1886
  export declare const CommandApprovePayloadSchema: z.ZodObject<{
@@ -1365,8 +1898,8 @@ export declare const CommandRespondPayloadSchema: z.ZodObject<{
1365
1898
  interactionId: z.ZodString;
1366
1899
  value: z.ZodUnknown;
1367
1900
  }, z.core.$loose>;
1368
- /** `sandbox.state`: the session's sandbox changed state. */
1369
- export declare const SandboxStatePayloadSchema: z.ZodObject<{
1901
+ /** `environment.state`: the session's sandbox changed state. */
1902
+ export declare const EnvironmentStatePayloadSchema: z.ZodObject<{
1370
1903
  state: z.ZodEnum<{
1371
1904
  creating: "creating";
1372
1905
  running: "running";
@@ -1382,14 +1915,14 @@ export declare const SandboxStatePayloadSchema: z.ZodObject<{
1382
1915
  error: z.ZodOptional<z.ZodString>;
1383
1916
  }, z.core.$loose>;
1384
1917
  /**
1385
- * `sandbox.attached`: the session was opened on a sandbox resource (`sandbox: { id }`). The
1386
- * sandbox's own stream records the same attachment.
1918
+ * `environment.attached`: the session was opened on an Environment (`environment`). The
1919
+ * Environment's own stream records the same attachment.
1387
1920
  */
1388
- export declare const SandboxAttachedPayloadSchema: z.ZodObject<{
1389
- sandboxId: z.ZodString;
1921
+ export declare const EnvironmentAttachedPayloadSchema: z.ZodObject<{
1922
+ environmentId: z.ZodString;
1390
1923
  }, z.core.$loose>;
1391
- /** `sandbox.exec`: one sandbox tool call finished. */
1392
- export declare const SandboxExecPayloadSchema: z.ZodObject<{
1924
+ /** `environment.exec`: one sandbox tool call finished. */
1925
+ export declare const EnvironmentExecPayloadSchema: z.ZodObject<{
1393
1926
  tool: z.ZodString;
1394
1927
  command: z.ZodOptional<z.ZodString>;
1395
1928
  outcome: z.ZodString;
@@ -1403,6 +1936,30 @@ export declare const NodeStartedPayloadSchema: z.ZodObject<{
1403
1936
  key: z.ZodString;
1404
1937
  iterations: z.ZodOptional<z.ZodString>;
1405
1938
  }, z.core.$loose>;
1939
+ /**
1940
+ * `node.completed`: a flow's HTTP stage or HTTP verifier ended, or a tool stage the Runtime
1941
+ * refused to run (R7.1), named as its `node.started` names it. `status` reads as
1942
+ * `tool.completed`'s: `completed` when the stage's server answered (an error answer included),
1943
+ * `failed` when the Runtime ended it, `cancelled` when a cancel did. `gate` is the Tool Gate's
1944
+ * own start and end of its last send.
1945
+ */
1946
+ export declare const NodeCompletedPayloadSchema: z.ZodObject<{
1947
+ path: z.ZodString;
1948
+ kind: z.ZodString;
1949
+ key: z.ZodString;
1950
+ iterations: z.ZodOptional<z.ZodString>;
1951
+ effectId: z.ZodString;
1952
+ status: z.ZodEnum<{
1953
+ cancelled: "cancelled";
1954
+ completed: "completed";
1955
+ failed: "failed";
1956
+ }>;
1957
+ durationMs: z.ZodOptional<z.ZodNumber>;
1958
+ gate: z.ZodOptional<z.ZodObject<{
1959
+ startedAt: z.ZodString;
1960
+ endedAt: z.ZodString;
1961
+ }, z.core.$loose>>;
1962
+ }, z.core.$loose>;
1406
1963
  /** `node.agent`: a workflow node runs as a linked agent session. */
1407
1964
  export declare const NodeAgentPayloadSchema: z.ZodObject<{
1408
1965
  path: z.ZodString;
@@ -1447,6 +2004,7 @@ export declare const TranscriptUpdatedPayloadSchema: z.ZodObject<{
1447
2004
  export declare const ArtifactSourceSchema: z.ZodEnum<{
1448
2005
  engine: "engine";
1449
2006
  export: "export";
2007
+ snapshot: "snapshot";
1450
2008
  upload: "upload";
1451
2009
  }>;
1452
2010
  export type ArtifactSource = z.infer<typeof ArtifactSourceSchema>;
@@ -1478,6 +2036,7 @@ export declare const ArtifactVersionPayloadSchema: z.ZodObject<{
1478
2036
  source: z.ZodEnum<{
1479
2037
  engine: "engine";
1480
2038
  export: "export";
2039
+ snapshot: "snapshot";
1481
2040
  upload: "upload";
1482
2041
  }>;
1483
2042
  callId: z.ZodOptional<z.ZodString>;
@@ -1597,6 +2156,10 @@ export declare const EVENT_CATALOG: {
1597
2156
  version: z.ZodOptional<z.ZodNumber>;
1598
2157
  }, z.core.$strict>], "type">>>;
1599
2158
  manifest: z.ZodOptional<z.ZodUnknown>;
2159
+ trace: z.ZodOptional<z.ZodObject<{
2160
+ traceparent: z.ZodString;
2161
+ tracestate: z.ZodOptional<z.ZodString>;
2162
+ }, z.core.$loose>>;
1600
2163
  }, z.core.$loose>;
1601
2164
  readonly source: "api";
1602
2165
  readonly version: 1;
@@ -1625,6 +2188,14 @@ export declare const EVENT_CATALOG: {
1625
2188
  };
1626
2189
  readonly "turn.completed": {
1627
2190
  readonly payload: z.ZodObject<{
2191
+ durationMs: z.ZodOptional<z.ZodNumber>;
2192
+ pausedMs: z.ZodOptional<z.ZodNumber>;
2193
+ agentId: z.ZodOptional<z.ZodString>;
2194
+ totals: z.ZodOptional<z.ZodObject<{
2195
+ steps: z.ZodNumber;
2196
+ tokens: z.ZodNumber;
2197
+ costUsd: z.ZodNumber;
2198
+ }, z.core.$loose>>;
1628
2199
  output: z.ZodUnknown;
1629
2200
  }, z.core.$loose>;
1630
2201
  readonly source: "loop";
@@ -1647,6 +2218,14 @@ export declare const EVENT_CATALOG: {
1647
2218
  };
1648
2219
  readonly "turn.failed": {
1649
2220
  readonly payload: z.ZodObject<{
2221
+ durationMs: z.ZodOptional<z.ZodNumber>;
2222
+ pausedMs: z.ZodOptional<z.ZodNumber>;
2223
+ agentId: z.ZodOptional<z.ZodString>;
2224
+ totals: z.ZodOptional<z.ZodObject<{
2225
+ steps: z.ZodNumber;
2226
+ tokens: z.ZodNumber;
2227
+ costUsd: z.ZodNumber;
2228
+ }, z.core.$loose>>;
1650
2229
  error: z.ZodOptional<z.ZodObject<{
1651
2230
  code: z.ZodOptional<z.ZodString>;
1652
2231
  message: z.ZodOptional<z.ZodString>;
@@ -1658,6 +2237,14 @@ export declare const EVENT_CATALOG: {
1658
2237
  };
1659
2238
  readonly "turn.cancelled": {
1660
2239
  readonly payload: z.ZodObject<{
2240
+ durationMs: z.ZodOptional<z.ZodNumber>;
2241
+ pausedMs: z.ZodOptional<z.ZodNumber>;
2242
+ agentId: z.ZodOptional<z.ZodString>;
2243
+ totals: z.ZodOptional<z.ZodObject<{
2244
+ steps: z.ZodNumber;
2245
+ tokens: z.ZodNumber;
2246
+ costUsd: z.ZodNumber;
2247
+ }, z.core.$loose>>;
1661
2248
  reason: z.ZodOptional<z.ZodString>;
1662
2249
  }, z.core.$loose>;
1663
2250
  readonly source: "api";
@@ -1670,6 +2257,20 @@ export declare const EVENT_CATALOG: {
1670
2257
  path: z.ZodString;
1671
2258
  delegationId: z.ZodOptional<z.ZodString>;
1672
2259
  }, z.core.$loose>>;
2260
+ effectId: z.ZodOptional<z.ZodString>;
2261
+ durationMs: z.ZodOptional<z.ZodNumber>;
2262
+ gate: z.ZodOptional<z.ZodObject<{
2263
+ startedAt: z.ZodString;
2264
+ endedAt: z.ZodString;
2265
+ }, z.core.$loose>>;
2266
+ firstTokenMs: z.ZodOptional<z.ZodNumber>;
2267
+ meteredUsage: z.ZodOptional<z.ZodObject<{
2268
+ inputTokens: z.ZodNumber;
2269
+ outputTokens: z.ZodNumber;
2270
+ totalTokens: z.ZodNumber;
2271
+ cachedTokens: z.ZodOptional<z.ZodNumber>;
2272
+ costUsd: z.ZodOptional<z.ZodNumber>;
2273
+ }, z.core.$loose>>;
1673
2274
  invocationId: z.ZodString;
1674
2275
  text: z.ZodString;
1675
2276
  model: z.ZodOptional<z.ZodObject<{
@@ -1694,6 +2295,20 @@ export declare const EVENT_CATALOG: {
1694
2295
  path: z.ZodString;
1695
2296
  delegationId: z.ZodOptional<z.ZodString>;
1696
2297
  }, z.core.$loose>>;
2298
+ effectId: z.ZodOptional<z.ZodString>;
2299
+ durationMs: z.ZodOptional<z.ZodNumber>;
2300
+ gate: z.ZodOptional<z.ZodObject<{
2301
+ startedAt: z.ZodString;
2302
+ endedAt: z.ZodString;
2303
+ }, z.core.$loose>>;
2304
+ firstTokenMs: z.ZodOptional<z.ZodNumber>;
2305
+ meteredUsage: z.ZodOptional<z.ZodObject<{
2306
+ inputTokens: z.ZodNumber;
2307
+ outputTokens: z.ZodNumber;
2308
+ totalTokens: z.ZodNumber;
2309
+ cachedTokens: z.ZodOptional<z.ZodNumber>;
2310
+ costUsd: z.ZodOptional<z.ZodNumber>;
2311
+ }, z.core.$loose>>;
1697
2312
  invocationId: z.ZodOptional<z.ZodString>;
1698
2313
  code: z.ZodString;
1699
2314
  message: z.ZodString;
@@ -1709,6 +2324,20 @@ export declare const EVENT_CATALOG: {
1709
2324
  path: z.ZodString;
1710
2325
  delegationId: z.ZodOptional<z.ZodString>;
1711
2326
  }, z.core.$loose>>;
2327
+ effectId: z.ZodOptional<z.ZodString>;
2328
+ durationMs: z.ZodOptional<z.ZodNumber>;
2329
+ gate: z.ZodOptional<z.ZodObject<{
2330
+ startedAt: z.ZodString;
2331
+ endedAt: z.ZodString;
2332
+ }, z.core.$loose>>;
2333
+ firstTokenMs: z.ZodOptional<z.ZodNumber>;
2334
+ meteredUsage: z.ZodOptional<z.ZodObject<{
2335
+ inputTokens: z.ZodNumber;
2336
+ outputTokens: z.ZodNumber;
2337
+ totalTokens: z.ZodNumber;
2338
+ cachedTokens: z.ZodOptional<z.ZodNumber>;
2339
+ costUsd: z.ZodOptional<z.ZodNumber>;
2340
+ }, z.core.$loose>>;
1712
2341
  invocationId: z.ZodOptional<z.ZodString>;
1713
2342
  trigger: z.ZodEnum<{
1714
2343
  overflow: "overflow";
@@ -1716,6 +2345,7 @@ export declare const EVENT_CATALOG: {
1716
2345
  }>;
1717
2346
  tokensBefore: z.ZodNumber;
1718
2347
  tokensAfter: z.ZodNumber;
2348
+ partial: z.ZodOptional<z.ZodLiteral<true>>;
1719
2349
  }, z.core.$loose>;
1720
2350
  readonly source: "loop";
1721
2351
  readonly version: 1;
@@ -1729,17 +2359,40 @@ export declare const EVENT_CATALOG: {
1729
2359
  }, z.core.$loose>>;
1730
2360
  callId: z.ZodString;
1731
2361
  invocationId: z.ZodString;
2362
+ effectId: z.ZodOptional<z.ZodString>;
1732
2363
  capabilityId: z.ZodString;
1733
2364
  toolName: z.ZodString;
2365
+ status: z.ZodOptional<z.ZodEnum<{
2366
+ cancelled: "cancelled";
2367
+ completed: "completed";
2368
+ failed: "failed";
2369
+ }>>;
2370
+ kind: z.ZodOptional<z.ZodEnum<{
2371
+ http: "http";
2372
+ mcp: "mcp";
2373
+ platform: "platform";
2374
+ sandbox: "sandbox";
2375
+ }>>;
2376
+ server: z.ZodOptional<z.ZodString>;
2377
+ attempts: z.ZodOptional<z.ZodNumber>;
2378
+ durationMs: z.ZodOptional<z.ZodNumber>;
2379
+ gate: z.ZodOptional<z.ZodObject<{
2380
+ startedAt: z.ZodString;
2381
+ endedAt: z.ZodString;
2382
+ }, z.core.$loose>>;
2383
+ policy: z.ZodOptional<z.ZodObject<{
2384
+ decision: z.ZodEnum<{
2385
+ ask: "ask";
2386
+ deny: "deny";
2387
+ }>;
2388
+ reason: z.ZodString;
2389
+ approvedBy: z.ZodOptional<z.ZodString>;
2390
+ }, z.core.$loose>>;
1734
2391
  output: z.ZodOptional<z.ZodUnknown>;
1735
2392
  error: z.ZodOptional<z.ZodObject<{
1736
2393
  code: z.ZodString;
1737
2394
  message: z.ZodString;
1738
2395
  server: z.ZodOptional<z.ZodString>;
1739
- vault: z.ZodOptional<z.ZodEnum<{
1740
- installation: "installation";
1741
- user: "user";
1742
- }>>;
1743
2396
  retryable: z.ZodOptional<z.ZodBoolean>;
1744
2397
  }, z.core.$loose>>;
1745
2398
  redacted: z.ZodOptional<z.ZodNumber>;
@@ -1805,7 +2458,7 @@ export declare const EVENT_CATALOG: {
1805
2458
  readonly source: "loop";
1806
2459
  readonly version: 1;
1807
2460
  };
1808
- readonly "sandbox.state": {
2461
+ readonly "environment.state": {
1809
2462
  readonly payload: z.ZodObject<{
1810
2463
  state: z.ZodEnum<{
1811
2464
  creating: "creating";
@@ -1824,7 +2477,7 @@ export declare const EVENT_CATALOG: {
1824
2477
  readonly source: "loop";
1825
2478
  readonly version: 1;
1826
2479
  };
1827
- readonly "sandbox.exec": {
2480
+ readonly "environment.exec": {
1828
2481
  readonly payload: z.ZodObject<{
1829
2482
  tool: z.ZodString;
1830
2483
  command: z.ZodOptional<z.ZodString>;
@@ -1835,13 +2488,39 @@ export declare const EVENT_CATALOG: {
1835
2488
  readonly source: "loop";
1836
2489
  readonly version: 1;
1837
2490
  };
1838
- readonly "sandbox.attached": {
2491
+ readonly "environment.attached": {
1839
2492
  readonly payload: z.ZodObject<{
1840
- sandboxId: z.ZodString;
2493
+ environmentId: z.ZodString;
1841
2494
  }, z.core.$loose>;
1842
2495
  readonly source: "api";
1843
2496
  readonly version: 1;
1844
2497
  };
2498
+ readonly "egress.connection": {
2499
+ readonly payload: z.ZodObject<{
2500
+ environmentId: z.ZodString;
2501
+ host: z.ZodString;
2502
+ port: z.ZodNumber;
2503
+ outcome: z.ZodEnum<{
2504
+ allowed: "allowed";
2505
+ refused: "refused";
2506
+ }>;
2507
+ reason: z.ZodOptional<z.ZodString>;
2508
+ status: z.ZodOptional<z.ZodNumber>;
2509
+ mode: z.ZodEnum<{
2510
+ credential: "credential";
2511
+ tunnel: "tunnel";
2512
+ }>;
2513
+ credentialBound: z.ZodBoolean;
2514
+ credentialIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
2515
+ requests: z.ZodOptional<z.ZodNumber>;
2516
+ bytesUp: z.ZodNumber;
2517
+ bytesDown: z.ZodNumber;
2518
+ durationMs: z.ZodNumber;
2519
+ startedAt: z.ZodString;
2520
+ }, z.core.$loose>;
2521
+ readonly source: "egress-gate";
2522
+ readonly version: 1;
2523
+ };
1845
2524
  readonly "node.started": {
1846
2525
  readonly payload: z.ZodObject<{
1847
2526
  path: z.ZodString;
@@ -1852,6 +2531,27 @@ export declare const EVENT_CATALOG: {
1852
2531
  readonly source: "loop";
1853
2532
  readonly version: 1;
1854
2533
  };
2534
+ readonly "node.completed": {
2535
+ readonly payload: z.ZodObject<{
2536
+ path: z.ZodString;
2537
+ kind: z.ZodString;
2538
+ key: z.ZodString;
2539
+ iterations: z.ZodOptional<z.ZodString>;
2540
+ effectId: z.ZodString;
2541
+ status: z.ZodEnum<{
2542
+ cancelled: "cancelled";
2543
+ completed: "completed";
2544
+ failed: "failed";
2545
+ }>;
2546
+ durationMs: z.ZodOptional<z.ZodNumber>;
2547
+ gate: z.ZodOptional<z.ZodObject<{
2548
+ startedAt: z.ZodString;
2549
+ endedAt: z.ZodString;
2550
+ }, z.core.$loose>>;
2551
+ }, z.core.$loose>;
2552
+ readonly source: "loop";
2553
+ readonly version: 1;
2554
+ };
1855
2555
  readonly "node.agent": {
1856
2556
  readonly payload: z.ZodObject<{
1857
2557
  path: z.ZodString;
@@ -1899,6 +2599,7 @@ export declare const EVENT_CATALOG: {
1899
2599
  source: z.ZodEnum<{
1900
2600
  engine: "engine";
1901
2601
  export: "export";
2602
+ snapshot: "snapshot";
1902
2603
  upload: "upload";
1903
2604
  }>;
1904
2605
  callId: z.ZodOptional<z.ZodString>;
@@ -1923,6 +2624,7 @@ export declare const EVENT_CATALOG: {
1923
2624
  source: z.ZodEnum<{
1924
2625
  engine: "engine";
1925
2626
  export: "export";
2627
+ snapshot: "snapshot";
1926
2628
  upload: "upload";
1927
2629
  }>;
1928
2630
  callId: z.ZodOptional<z.ZodString>;
@@ -1994,7 +2696,7 @@ type EventSchemaOf<T extends EventType> = z.ZodObject<typeof eventEnvelope & {
1994
2696
  /** One schema per event type, keyed by type (the OpenAPI components). */
1995
2697
  export declare const EVENT_SCHEMAS: { [T in EventType]: EventSchemaOf<T>; };
1996
2698
  /** A session event of a known type, discriminated on `type`. */
1997
- export declare const SessionEventSchema: z.ZodDiscriminatedUnion<[EventSchemaOf<"artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "message.assistant" | "model.failed" | "node.agent" | "node.started" | "sandbox.attached" | "sandbox.exec" | "sandbox.state" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">, ...EventSchemaOf<"artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "message.assistant" | "model.failed" | "node.agent" | "node.started" | "sandbox.attached" | "sandbox.exec" | "sandbox.state" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">[]], "type">;
2699
+ export declare const SessionEventSchema: z.ZodDiscriminatedUnion<[EventSchemaOf<"artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "egress.connection" | "environment.attached" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "message.assistant" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">, ...EventSchemaOf<"artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "egress.connection" | "environment.attached" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "message.assistant" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">[]], "type">;
1998
2700
  export type SessionEvent = {
1999
2701
  [T in EventType]: z.infer<EventSchemaOf<T>>;
2000
2702
  }[EventType];
@@ -2009,7 +2711,7 @@ export type SessionEventOf<T extends EventType> = Extract<SessionEvent, {
2009
2711
  */
2010
2712
  export declare function parseSessionEvent(value: unknown): SessionEvent | LiveEvent;
2011
2713
  export declare const SessionItemsResponseSchema: z.ZodObject<{
2012
- items: z.ZodArray<z.ZodDiscriminatedUnion<[EventSchemaOf<"artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "message.assistant" | "model.failed" | "node.agent" | "node.started" | "sandbox.attached" | "sandbox.exec" | "sandbox.state" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">, ...EventSchemaOf<"artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "message.assistant" | "model.failed" | "node.agent" | "node.started" | "sandbox.attached" | "sandbox.exec" | "sandbox.state" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">[]], "type">>;
2714
+ items: z.ZodArray<z.ZodDiscriminatedUnion<[EventSchemaOf<"artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "egress.connection" | "environment.attached" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "message.assistant" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">, ...EventSchemaOf<"artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "egress.connection" | "environment.attached" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "message.assistant" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">[]], "type">>;
2013
2715
  cursor: z.ZodNullable<z.ZodString>;
2014
2716
  }, z.core.$strip>;
2015
2717
  export type SessionItemsResponse = {
@@ -2324,16 +3026,6 @@ export declare const SeedTenantConfigRequestSchema: z.ZodObject<{
2324
3026
  virtual: "virtual";
2325
3027
  }>>;
2326
3028
  config: z.ZodOptional<z.ZodObject<{
2327
- default: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"virtual">, z.ZodObject<{
2328
- image: z.ZodOptional<z.ZodString>;
2329
- network: z.ZodOptional<z.ZodObject<{
2330
- allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
2331
- }, z.core.$strict>>;
2332
- resources: z.ZodOptional<z.ZodObject<{
2333
- cpus: z.ZodOptional<z.ZodNumber>;
2334
- memory: z.ZodOptional<z.ZodString>;
2335
- }, z.core.$strict>>;
2336
- }, z.core.$strict>]>>;
2337
3029
  limits: z.ZodOptional<z.ZodObject<{
2338
3030
  network: z.ZodOptional<z.ZodArray<z.ZodString>>;
2339
3031
  resources: z.ZodOptional<z.ZodObject<{
@@ -2345,14 +3037,9 @@ export declare const SeedTenantConfigRequestSchema: z.ZodObject<{
2345
3037
  memory: z.ZodOptional<z.ZodString>;
2346
3038
  }, z.core.$strict>>;
2347
3039
  idle: z.ZodOptional<z.ZodString>;
2348
- sandboxes: z.ZodOptional<z.ZodNumber>;
2349
- ttl: z.ZodOptional<z.ZodString>;
3040
+ environments: z.ZodOptional<z.ZodNumber>;
2350
3041
  }, z.core.$strict>>;
2351
3042
  lifecycle: z.ZodOptional<z.ZodObject<{
2352
- onExpiry: z.ZodOptional<z.ZodEnum<{
2353
- delete: "delete";
2354
- retain: "retain";
2355
- }>>;
2356
3043
  stopGrace: z.ZodOptional<z.ZodString>;
2357
3044
  }, z.core.$strict>>;
2358
3045
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -2396,7 +3083,7 @@ export declare const ResetTenantRequestSchema: z.ZodObject<{
2396
3083
  requestId: z.ZodString;
2397
3084
  scope: z.ZodEnum<{
2398
3085
  all: "all";
2399
- sandboxes: "sandboxes";
3086
+ environments: "environments";
2400
3087
  sessions: "sessions";
2401
3088
  }>;
2402
3089
  activeWork: z.ZodEnum<{
@@ -2408,12 +3095,17 @@ export type ResetTenantRequest = z.infer<typeof ResetTenantRequestSchema>;
2408
3095
  /**
2409
3096
  * Acting for a subject (Host feature `subject-headers`): what an application principal may
2410
3097
  * narrow a request to. `sessions:own` reaches only the subject's own sessions; the others reach
2411
- * Tenant-wide resources. `sandboxes:write` creates and deletes sandboxes (Host feature
2412
- * `sandboxes`); a token caller's reach only the ids its sandbox grants name. Vaults are the
2413
- * installation's, managed with management keys on the Management API (protocol 8).
3098
+ * Tenant-wide resources. `environments:write` creates, changes and deletes Environments and
3099
+ * writes their secrets (protocol 11); a token caller's reach only the ids its Environment
3100
+ * grants name.
2414
3101
  */
2415
- export declare const SUBJECT_SCOPES: readonly ["agents:read", "agents:write", "sessions:own", "sandboxes:write"];
3102
+ export declare const SUBJECT_SCOPES: readonly ["agents:read", "agents:write", "sessions:own", "environments:write"];
2416
3103
  export type SubjectScope = (typeof SUBJECT_SCOPES)[number];
3104
+ /**
3105
+ * The owner of a session opened for no person: an MCP server's or HTTP tool's identity header
3106
+ * (R2b C2) names nobody for it. A reserved subject.
3107
+ */
3108
+ export declare const INSTALLATION_OWNER = "installation";
2417
3109
  /** A valid subject: 1–200 visible ASCII characters, not reserved by the Runtime. */
2418
3110
  export declare function isSubject(value: unknown): value is string;
2419
3111
  /**
@@ -2431,9 +3123,9 @@ export declare function parseSubjectHeaders(subject: string, scopes: string | un
2431
3123
  /**
2432
3124
  * Scopes a token caller (a trusted issuer's token) may carry: never `agents:write`.
2433
3125
  */
2434
- export declare const TOKEN_SCOPES: readonly ["agents:read", "sessions:own", "sandboxes:write"];
2435
- /** The most sandbox grants one token caller carries. */
2436
- export declare const TOKEN_SANDBOX_GRANTS_MAX = 16;
3126
+ export declare const TOKEN_SCOPES: readonly ["agents:read", "sessions:own", "environments:write"];
3127
+ /** The most Environment grants one token caller carries. */
3128
+ export declare const TOKEN_ENVIRONMENT_GRANTS_MAX = 16;
2437
3129
  export type TokenScope = (typeof TOKEN_SCOPES)[number];
2438
3130
  /**
2439
3131
  * The longest a token the Runtime signs itself lives, in seconds (capability links): rotating
@@ -2531,10 +3223,10 @@ export declare const RevokeSigningKeyRequestSchema: z.ZodObject<{
2531
3223
  * token scopes, and `studio`, an operator scope no Runtime route requires (Studio
2532
3224
  * admits a person who holds it, Tenant-wide).
2533
3225
  */
2534
- export declare const ISSUER_SCOPES: readonly ["agents:read", "sessions:own", "sandboxes:write", "studio"];
3226
+ export declare const ISSUER_SCOPES: readonly ["agents:read", "sessions:own", "environments:write", "studio"];
2535
3227
  export type IssuerScope = (typeof ISSUER_SCOPES)[number];
2536
3228
  /** Every scope a caller can hold: the subject scopes, and an issuer token's `studio`. */
2537
- export declare const CALLER_SCOPES: readonly ["agents:read", "agents:write", "sessions:own", "sandboxes:write", "studio"];
3229
+ export declare const CALLER_SCOPES: readonly ["agents:read", "agents:write", "sessions:own", "environments:write", "studio"];
2538
3230
  export type CallerScope = (typeof CALLER_SCOPES)[number];
2539
3231
  /**
2540
3232
  * `GET /v1/me`: who the Runtime takes the caller to be, for any credential.
@@ -2545,20 +3237,20 @@ export type CallerScope = (typeof CALLER_SCOPES)[number];
2545
3237
  * - `subject` is the person the request acts for; absent for an application key alone.
2546
3238
  * - `scopes`: what the caller holds. An application key alone holds every subject scope.
2547
3239
  * - `agents`: the agents it may reach, `*` for all.
2548
- * - `sandboxes`: the sandbox grants of a token caller (empty reaches none); absent for an
2549
- * application key, alone or acting for a subject, which no grant limits.
3240
+ * - `environments`: the Environment grants of a token caller (empty reaches none); absent for
3241
+ * an application key, alone or acting for a subject, which no grant limits.
2550
3242
  */
2551
3243
  export declare const MeResponseSchema: z.ZodObject<{
2552
3244
  subject: z.ZodOptional<z.ZodString>;
2553
3245
  scopes: z.ZodArray<z.ZodEnum<{
2554
3246
  "agents:read": "agents:read";
2555
3247
  "agents:write": "agents:write";
2556
- "sandboxes:write": "sandboxes:write";
3248
+ "environments:write": "environments:write";
2557
3249
  "sessions:own": "sessions:own";
2558
3250
  studio: "studio";
2559
3251
  }>>;
2560
3252
  agents: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>;
2561
- sandboxes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3253
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
2562
3254
  via: z.ZodString;
2563
3255
  }, z.core.$strict>;
2564
3256
  export type MeResponse = z.infer<typeof MeResponseSchema>;
@@ -2661,20 +3353,12 @@ export declare const SessionViewSchema: z.ZodObject<{
2661
3353
  waiting: "waiting";
2662
3354
  }>;
2663
3355
  activeTurnId: z.ZodNullable<z.ZodString>;
2664
- vaultIds: z.ZodArray<z.ZodString>;
2665
- credentialSelections: z.ZodArray<z.ZodObject<{
2666
- serverName: z.ZodString;
2667
- credentialId: z.ZodString;
2668
- }, z.core.$strict>>;
2669
- sandboxOwnerId: z.ZodNullable<z.ZodString>;
2670
- sandboxId: z.ZodOptional<z.ZodString>;
2671
- sandbox: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2672
- sandboxSource: z.ZodOptional<z.ZodEnum<{
2673
- default: "default";
2674
- inline: "inline";
2675
- sandbox: "sandbox";
2676
- shared: "shared";
2677
- }>>;
3356
+ environment: z.ZodNullable<z.ZodObject<{
3357
+ id: z.ZodString;
3358
+ version: z.ZodNumber;
3359
+ }, z.core.$strict>>;
3360
+ harness: z.ZodString;
3361
+ closedReason: z.ZodOptional<z.ZodString>;
2678
3362
  mcpSnapshot: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2679
3363
  mcpDiagnostics: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2680
3364
  waits: z.ZodOptional<z.ZodUnknown>;
@@ -2752,18 +3436,8 @@ export declare const ListProvidersResponseSchema: z.ZodObject<{
2752
3436
  }, z.core.$strict>>;
2753
3437
  }, z.core.$strict>;
2754
3438
  export type ListProvidersResponse = z.infer<typeof ListProvidersResponseSchema>;
2755
- /** A Tenant's sandbox configuration with every default applied (sizes in MiB). */
3439
+ /** A Tenant's Environment settings with every default applied (sizes in MiB). */
2756
3440
  export declare const EffectiveSandboxConfigSchema: z.ZodObject<{
2757
- default: z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"virtual">, z.ZodObject<{
2758
- image: z.ZodOptional<z.ZodString>;
2759
- network: z.ZodOptional<z.ZodObject<{
2760
- allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
2761
- }, z.core.$strict>>;
2762
- resources: z.ZodOptional<z.ZodObject<{
2763
- cpus: z.ZodOptional<z.ZodNumber>;
2764
- memory: z.ZodOptional<z.ZodString>;
2765
- }, z.core.$strict>>;
2766
- }, z.core.$strict>]>;
2767
3441
  limits: z.ZodObject<{
2768
3442
  network: z.ZodArray<z.ZodString>;
2769
3443
  resources: z.ZodObject<{
@@ -2775,14 +3449,9 @@ export declare const EffectiveSandboxConfigSchema: z.ZodObject<{
2775
3449
  memoryMiB: z.ZodNumber;
2776
3450
  }, z.core.$strict>;
2777
3451
  idle: z.ZodString;
2778
- sandboxes: z.ZodOptional<z.ZodNumber>;
2779
- ttl: z.ZodOptional<z.ZodString>;
3452
+ environments: z.ZodOptional<z.ZodNumber>;
2780
3453
  }, z.core.$strict>;
2781
3454
  lifecycle: z.ZodOptional<z.ZodObject<{
2782
- onExpiry: z.ZodEnum<{
2783
- delete: "delete";
2784
- retain: "retain";
2785
- }>;
2786
3455
  stopGrace: z.ZodString;
2787
3456
  }, z.core.$strict>>;
2788
3457
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -2823,16 +3492,6 @@ export declare const TenantSandboxViewSchema: z.ZodObject<{
2823
3492
  }, z.core.$strict>>;
2824
3493
  defaultImage: z.ZodString;
2825
3494
  config: z.ZodObject<{
2826
- default: z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"virtual">, z.ZodObject<{
2827
- image: z.ZodOptional<z.ZodString>;
2828
- network: z.ZodOptional<z.ZodObject<{
2829
- allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
2830
- }, z.core.$strict>>;
2831
- resources: z.ZodOptional<z.ZodObject<{
2832
- cpus: z.ZodOptional<z.ZodNumber>;
2833
- memory: z.ZodOptional<z.ZodString>;
2834
- }, z.core.$strict>>;
2835
- }, z.core.$strict>]>;
2836
3495
  limits: z.ZodObject<{
2837
3496
  network: z.ZodArray<z.ZodString>;
2838
3497
  resources: z.ZodObject<{
@@ -2844,14 +3503,9 @@ export declare const TenantSandboxViewSchema: z.ZodObject<{
2844
3503
  memoryMiB: z.ZodNumber;
2845
3504
  }, z.core.$strict>;
2846
3505
  idle: z.ZodString;
2847
- sandboxes: z.ZodOptional<z.ZodNumber>;
2848
- ttl: z.ZodOptional<z.ZodString>;
3506
+ environments: z.ZodOptional<z.ZodNumber>;
2849
3507
  }, z.core.$strict>;
2850
3508
  lifecycle: z.ZodOptional<z.ZodObject<{
2851
- onExpiry: z.ZodEnum<{
2852
- delete: "delete";
2853
- retain: "retain";
2854
- }>;
2855
3509
  stopGrace: z.ZodString;
2856
3510
  }, z.core.$strict>>;
2857
3511
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -2970,49 +3624,112 @@ export declare const ModelBudgetsSchema: z.ZodObject<{
2970
3624
  }, z.core.$strict>>;
2971
3625
  }, z.core.$strict>;
2972
3626
  export type ModelBudgets = z.infer<typeof ModelBudgetsSchema>;
2973
- export declare const ListVaultsResponseSchema: z.ZodObject<{
2974
- vaults: z.ZodArray<z.ZodObject<{
2975
- id: z.ZodString;
2976
- name: z.ZodString;
2977
- ownerUserId: z.ZodString;
2978
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2979
- createdAt: z.ZodString;
3627
+ /** What a tool policy rule does to a call it matches (R5 step 2). */
3628
+ export declare const TOOL_POLICY_EFFECTS: readonly ["allow", "ask", "deny"];
3629
+ /** A test of one field of a tool call's input; every test it sets must hold. */
3630
+ export declare const ToolInputConditionSchema: z.ZodObject<{
3631
+ equals: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3632
+ in: z.ZodOptional<z.ZodArray<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
3633
+ gt: z.ZodOptional<z.ZodNumber>;
3634
+ gte: z.ZodOptional<z.ZodNumber>;
3635
+ lt: z.ZodOptional<z.ZodNumber>;
3636
+ lte: z.ZodOptional<z.ZodNumber>;
3637
+ matches: z.ZodOptional<z.ZodString>;
3638
+ }, z.core.$strict>;
3639
+ export type ToolInputCondition = z.infer<typeof ToolInputConditionSchema>;
3640
+ /**
3641
+ * One rule of the Tenant's tool policy (R5 step 2), applied at the Tool Gate to every MCP and
3642
+ * HTTP tool call of every harness. A rule matches a call when every selector it sets matches:
3643
+ * `tool` (the name the model calls it by, `*` for any run of characters), `server` (an MCP
3644
+ * server's name), `kind`, `agent` (the agent that calls it) and `when` (fields of the input, by
3645
+ * dotted path). The strictest matching rule decides: `deny` refuses the call before it is sent,
3646
+ * `ask` holds it until a person approves it on the session (`approve`), `allow` runs it. A call no
3647
+ * rule matches runs. Sandbox tools never cross the gate; their network side is egress policy.
3648
+ */
3649
+ export declare const ToolRuleSchema: z.ZodObject<{
3650
+ effect: z.ZodEnum<{
3651
+ allow: "allow";
3652
+ ask: "ask";
3653
+ deny: "deny";
3654
+ }>;
3655
+ tool: z.ZodOptional<z.ZodString>;
3656
+ server: z.ZodOptional<z.ZodString>;
3657
+ kind: z.ZodOptional<z.ZodEnum<{
3658
+ http: "http";
3659
+ mcp: "mcp";
3660
+ }>>;
3661
+ agent: z.ZodOptional<z.ZodString>;
3662
+ when: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
3663
+ equals: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3664
+ in: z.ZodOptional<z.ZodArray<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
3665
+ gt: z.ZodOptional<z.ZodNumber>;
3666
+ gte: z.ZodOptional<z.ZodNumber>;
3667
+ lt: z.ZodOptional<z.ZodNumber>;
3668
+ lte: z.ZodOptional<z.ZodNumber>;
3669
+ matches: z.ZodOptional<z.ZodString>;
3670
+ }, z.core.$strict>>>;
3671
+ reason: z.ZodOptional<z.ZodString>;
3672
+ }, z.core.$strict>;
3673
+ export type ToolRule = z.infer<typeof ToolRuleSchema>;
3674
+ /** `PUT /v1/tenant/tool-policy`: replaces every rule. An empty list allows every call. */
3675
+ export declare const PutToolPolicyRequestSchema: z.ZodObject<{
3676
+ requestId: z.ZodOptional<z.ZodString>;
3677
+ rules: z.ZodArray<z.ZodObject<{
3678
+ effect: z.ZodEnum<{
3679
+ allow: "allow";
3680
+ ask: "ask";
3681
+ deny: "deny";
3682
+ }>;
3683
+ tool: z.ZodOptional<z.ZodString>;
3684
+ server: z.ZodOptional<z.ZodString>;
3685
+ kind: z.ZodOptional<z.ZodEnum<{
3686
+ http: "http";
3687
+ mcp: "mcp";
3688
+ }>>;
3689
+ agent: z.ZodOptional<z.ZodString>;
3690
+ when: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
3691
+ equals: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3692
+ in: z.ZodOptional<z.ZodArray<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
3693
+ gt: z.ZodOptional<z.ZodNumber>;
3694
+ gte: z.ZodOptional<z.ZodNumber>;
3695
+ lt: z.ZodOptional<z.ZodNumber>;
3696
+ lte: z.ZodOptional<z.ZodNumber>;
3697
+ matches: z.ZodOptional<z.ZodString>;
3698
+ }, z.core.$strict>>>;
3699
+ reason: z.ZodOptional<z.ZodString>;
2980
3700
  }, z.core.$strict>>;
2981
3701
  }, z.core.$strict>;
2982
- export type ListVaultsResponse = z.infer<typeof ListVaultsResponseSchema>;
2983
- export declare const ListCredentialsResponseSchema: z.ZodObject<{
2984
- credentials: z.ZodArray<z.ZodObject<{
2985
- id: z.ZodString;
2986
- vaultId: z.ZodString;
2987
- name: z.ZodString;
2988
- type: z.ZodEnum<{
2989
- bearer: "bearer";
2990
- environment_secret: "environment_secret";
2991
- environment_variable: "environment_variable";
2992
- headers: "headers";
3702
+ export type PutToolPolicyRequest = z.infer<typeof PutToolPolicyRequestSchema>;
3703
+ /** The Tenant's tool policy; `updatedAt` is null until one is set. */
3704
+ export declare const ToolPolicySchema: z.ZodObject<{
3705
+ rules: z.ZodArray<z.ZodObject<{
3706
+ effect: z.ZodEnum<{
3707
+ allow: "allow";
3708
+ ask: "ask";
3709
+ deny: "deny";
2993
3710
  }>;
2994
- binding: z.ZodObject<{
2995
- url: z.ZodOptional<z.ZodString>;
2996
- secretName: z.ZodOptional<z.ZodString>;
2997
- allowedHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
2998
- inject: z.ZodOptional<z.ZodObject<{
2999
- header: z.ZodString;
3000
- format: z.ZodString;
3001
- }, z.core.$strict>>;
3002
- variableName: z.ZodOptional<z.ZodString>;
3003
- variableValue: z.ZodOptional<z.ZodString>;
3004
- }, z.core.$strict>;
3005
- headerNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
3006
- via: z.ZodOptional<z.ZodString>;
3007
- identity: z.ZodOptional<z.ZodObject<{
3008
- header: z.ZodString;
3009
- }, z.core.$strict>>;
3010
- createdAt: z.ZodString;
3011
- rotatedAt: z.ZodOptional<z.ZodString>;
3711
+ tool: z.ZodOptional<z.ZodString>;
3712
+ server: z.ZodOptional<z.ZodString>;
3713
+ kind: z.ZodOptional<z.ZodEnum<{
3714
+ http: "http";
3715
+ mcp: "mcp";
3716
+ }>>;
3717
+ agent: z.ZodOptional<z.ZodString>;
3718
+ when: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
3719
+ equals: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3720
+ in: z.ZodOptional<z.ZodArray<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
3721
+ gt: z.ZodOptional<z.ZodNumber>;
3722
+ gte: z.ZodOptional<z.ZodNumber>;
3723
+ lt: z.ZodOptional<z.ZodNumber>;
3724
+ lte: z.ZodOptional<z.ZodNumber>;
3725
+ matches: z.ZodOptional<z.ZodString>;
3726
+ }, z.core.$strict>>>;
3727
+ reason: z.ZodOptional<z.ZodString>;
3012
3728
  }, z.core.$strict>>;
3729
+ updatedAt: z.ZodNullable<z.ZodString>;
3013
3730
  }, z.core.$strict>;
3014
- export type ListCredentialsResponse = z.infer<typeof ListCredentialsResponseSchema>;
3015
- /** A deleted vault or credential. */
3731
+ export type ToolPolicy = z.infer<typeof ToolPolicySchema>;
3732
+ /** A deleted resource. */
3016
3733
  export declare const DeletedResponseSchema: z.ZodObject<{
3017
3734
  id: z.ZodString;
3018
3735
  }, z.core.$strict>;
@@ -3038,6 +3755,12 @@ export declare const AgUiRunErrorCodeSchema: z.ZodEnum<{
3038
3755
  credential_rejected: "credential_rejected";
3039
3756
  credential_required: "credential_required";
3040
3757
  definition_files_missing: "definition_files_missing";
3758
+ environment_busy: "environment_busy";
3759
+ environment_lost: "environment_lost";
3760
+ environment_not_granted: "environment_not_granted";
3761
+ environment_owner_mismatch: "environment_owner_mismatch";
3762
+ environment_unavailable: "environment_unavailable";
3763
+ harness_mismatch: "harness_mismatch";
3041
3764
  host_rejected: "host_rejected";
3042
3765
  incompatible_host: "incompatible_host";
3043
3766
  internal_error: "internal_error";
@@ -3052,13 +3775,9 @@ export declare const AgUiRunErrorCodeSchema: z.ZodEnum<{
3052
3775
  protocol_unsupported: "protocol_unsupported";
3053
3776
  request_rejected: "request_rejected";
3054
3777
  runtime_error: "runtime_error";
3055
- sandbox_busy: "sandbox_busy";
3056
- sandbox_expired: "sandbox_expired";
3057
- sandbox_lost: "sandbox_lost";
3058
- sandbox_not_granted: "sandbox_not_granted";
3059
- sandbox_unavailable: "sandbox_unavailable";
3060
3778
  scope_required: "scope_required";
3061
3779
  session_busy: "session_busy";
3780
+ session_closed: "session_closed";
3062
3781
  subject_invalid: "subject_invalid";
3063
3782
  subject_required: "subject_required";
3064
3783
  token_expired: "token_expired";
@@ -3219,6 +3938,7 @@ export declare const ArtifactVersionViewSchema: z.ZodObject<{
3219
3938
  source: z.ZodEnum<{
3220
3939
  engine: "engine";
3221
3940
  export: "export";
3941
+ snapshot: "snapshot";
3222
3942
  upload: "upload";
3223
3943
  }>;
3224
3944
  createdAt: z.ZodString;
@@ -3237,6 +3957,7 @@ export declare const ArtifactViewSchema: z.ZodObject<{
3237
3957
  name: z.ZodString;
3238
3958
  contentType: z.ZodString;
3239
3959
  sessionId: z.ZodOptional<z.ZodString>;
3960
+ environmentId: z.ZodOptional<z.ZodString>;
3240
3961
  latestVersion: z.ZodNumber;
3241
3962
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3242
3963
  createdAt: z.ZodString;
@@ -3249,6 +3970,7 @@ export declare const ArtifactViewSchema: z.ZodObject<{
3249
3970
  source: z.ZodEnum<{
3250
3971
  engine: "engine";
3251
3972
  export: "export";
3973
+ snapshot: "snapshot";
3252
3974
  upload: "upload";
3253
3975
  }>;
3254
3976
  createdAt: z.ZodString;
@@ -3265,6 +3987,7 @@ export declare const ListArtifactsResponseSchema: z.ZodObject<{
3265
3987
  name: z.ZodString;
3266
3988
  contentType: z.ZodString;
3267
3989
  sessionId: z.ZodOptional<z.ZodString>;
3990
+ environmentId: z.ZodOptional<z.ZodString>;
3268
3991
  latestVersion: z.ZodNumber;
3269
3992
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3270
3993
  createdAt: z.ZodString;
@@ -3277,6 +4000,7 @@ export declare const ListArtifactsResponseSchema: z.ZodObject<{
3277
4000
  source: z.ZodEnum<{
3278
4001
  engine: "engine";
3279
4002
  export: "export";
4003
+ snapshot: "snapshot";
3280
4004
  upload: "upload";
3281
4005
  }>;
3282
4006
  createdAt: z.ZodString;
@@ -3284,6 +4008,42 @@ export declare const ListArtifactsResponseSchema: z.ZodObject<{
3284
4008
  }, z.core.$strict>>;
3285
4009
  }, z.core.$strict>;
3286
4010
  export type ListArtifactsResponse = z.infer<typeof ListArtifactsResponseSchema>;
4011
+ /** Paged metadata only; read the artifact separately for its version history and bytes. */
4012
+ export declare const ArtifactListItemSchema: z.ZodObject<{
4013
+ artifactId: z.ZodString;
4014
+ kind: z.ZodEnum<{
4015
+ file: "file";
4016
+ folder: "folder";
4017
+ }>;
4018
+ name: z.ZodString;
4019
+ contentType: z.ZodString;
4020
+ sessionId: z.ZodOptional<z.ZodString>;
4021
+ environmentId: z.ZodOptional<z.ZodString>;
4022
+ latestVersion: z.ZodNumber;
4023
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
4024
+ createdAt: z.ZodString;
4025
+ updatedAt: z.ZodString;
4026
+ }, z.core.$strict>;
4027
+ export type ArtifactListItem = z.infer<typeof ArtifactListItemSchema>;
4028
+ export declare const ArtifactPageSchema: z.ZodObject<{
4029
+ artifacts: z.ZodArray<z.ZodObject<{
4030
+ artifactId: z.ZodString;
4031
+ kind: z.ZodEnum<{
4032
+ file: "file";
4033
+ folder: "folder";
4034
+ }>;
4035
+ name: z.ZodString;
4036
+ contentType: z.ZodString;
4037
+ sessionId: z.ZodOptional<z.ZodString>;
4038
+ environmentId: z.ZodOptional<z.ZodString>;
4039
+ latestVersion: z.ZodNumber;
4040
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
4041
+ createdAt: z.ZodString;
4042
+ updatedAt: z.ZodString;
4043
+ }, z.core.$strict>>;
4044
+ nextCursor: z.ZodNullable<z.ZodString>;
4045
+ }, z.core.$strict>;
4046
+ export type ArtifactPage = z.infer<typeof ArtifactPageSchema>;
3287
4047
  /** What an upload answers: the artifact, and the version the upload created. */
3288
4048
  export declare const UploadArtifactResponseSchema: z.ZodObject<{
3289
4049
  artifact: z.ZodObject<{
@@ -3295,6 +4055,7 @@ export declare const UploadArtifactResponseSchema: z.ZodObject<{
3295
4055
  name: z.ZodString;
3296
4056
  contentType: z.ZodString;
3297
4057
  sessionId: z.ZodOptional<z.ZodString>;
4058
+ environmentId: z.ZodOptional<z.ZodString>;
3298
4059
  latestVersion: z.ZodNumber;
3299
4060
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3300
4061
  createdAt: z.ZodString;
@@ -3307,6 +4068,7 @@ export declare const UploadArtifactResponseSchema: z.ZodObject<{
3307
4068
  source: z.ZodEnum<{
3308
4069
  engine: "engine";
3309
4070
  export: "export";
4071
+ snapshot: "snapshot";
3310
4072
  upload: "upload";
3311
4073
  }>;
3312
4074
  createdAt: z.ZodString;
@@ -3320,6 +4082,7 @@ export declare const UploadArtifactResponseSchema: z.ZodObject<{
3320
4082
  source: z.ZodEnum<{
3321
4083
  engine: "engine";
3322
4084
  export: "export";
4085
+ snapshot: "snapshot";
3323
4086
  upload: "upload";
3324
4087
  }>;
3325
4088
  createdAt: z.ZodString;
@@ -3361,18 +4124,35 @@ export type ArtifactLink = z.infer<typeof ArtifactLinkSchema>;
3361
4124
  export declare const FOLDER_CONTENT_TYPE = "application/vnd.nylorun.folder+json";
3362
4125
  /** The manifest format a folder version is stored as. */
3363
4126
  export declare const FOLDER_MANIFEST_FORMAT = "nylorun.folder.v1";
4127
+ /**
4128
+ * The manifest format of an Environment's disk versions (R2d step 3): v1's entries, plus file
4129
+ * modes and modification times, symbolic links and empty directories. Readers accept both.
4130
+ */
4131
+ export declare const FOLDER_MANIFEST_FORMAT_V2 = "nylorun.folder.v2";
3364
4132
  /** The folder artifact a session's turn-end export writes, one per session. */
3365
4133
  export declare const OUTPUTS_ARTIFACT_NAME = "outputs";
3366
4134
  /** The most files one turn-end export stores; past it the export is skipped. */
3367
4135
  export declare const EXPORT_MAX_FILES = 10000;
3368
4136
  /** The most bytes one turn-end export stores (before dedupe); past it the export is skipped. */
3369
4137
  export declare const EXPORT_MAX_BYTES: number;
3370
- /** One file of a folder: its path in the folder (`/`-separated, relative), size, hash and type. */
4138
+ /**
4139
+ * One file of a folder: its path in the folder (`/`-separated, relative), size, hash and type.
4140
+ * In a v2 manifest an entry may also be a symbolic link (`type: "link"`, its `target`) or an
4141
+ * empty directory (`type: "dir"`), with no bytes (`size` 0, `sha256` and `contentType` empty),
4142
+ * and any entry may carry its `mode` and `mtimeMs`.
4143
+ */
3371
4144
  export declare const FolderEntrySchema: z.ZodObject<{
3372
4145
  path: z.ZodString;
3373
4146
  size: z.ZodNumber;
3374
4147
  sha256: z.ZodString;
3375
4148
  contentType: z.ZodString;
4149
+ type: z.ZodOptional<z.ZodEnum<{
4150
+ dir: "dir";
4151
+ link: "link";
4152
+ }>>;
4153
+ mode: z.ZodOptional<z.ZodNumber>;
4154
+ mtimeMs: z.ZodOptional<z.ZodNumber>;
4155
+ target: z.ZodOptional<z.ZodString>;
3376
4156
  }, z.core.$strict>;
3377
4157
  export type FolderEntry = z.infer<typeof FolderEntrySchema>;
3378
4158
  /**
@@ -3380,12 +4160,22 @@ export type FolderEntry = z.infer<typeof FolderEntrySchema>;
3380
4160
  * bytes by SHA-256. The one manifest format for folders, reused by P5's snapshots.
3381
4161
  */
3382
4162
  export declare const FolderManifestSchema: z.ZodObject<{
3383
- format: z.ZodLiteral<"nylorun.folder.v1">;
4163
+ format: z.ZodEnum<{
4164
+ "nylorun.folder.v1": "nylorun.folder.v1";
4165
+ "nylorun.folder.v2": "nylorun.folder.v2";
4166
+ }>;
3384
4167
  entries: z.ZodArray<z.ZodObject<{
3385
4168
  path: z.ZodString;
3386
4169
  size: z.ZodNumber;
3387
4170
  sha256: z.ZodString;
3388
4171
  contentType: z.ZodString;
4172
+ type: z.ZodOptional<z.ZodEnum<{
4173
+ dir: "dir";
4174
+ link: "link";
4175
+ }>>;
4176
+ mode: z.ZodOptional<z.ZodNumber>;
4177
+ mtimeMs: z.ZodOptional<z.ZodNumber>;
4178
+ target: z.ZodOptional<z.ZodString>;
3389
4179
  }, z.core.$strict>>;
3390
4180
  }, z.core.$strict>;
3391
4181
  export type FolderManifest = z.infer<typeof FolderManifestSchema>;
@@ -3398,6 +4188,13 @@ export declare const ArtifactTreeSchema: z.ZodObject<{
3398
4188
  size: z.ZodNumber;
3399
4189
  sha256: z.ZodString;
3400
4190
  contentType: z.ZodString;
4191
+ type: z.ZodOptional<z.ZodEnum<{
4192
+ dir: "dir";
4193
+ link: "link";
4194
+ }>>;
4195
+ mode: z.ZodOptional<z.ZodNumber>;
4196
+ mtimeMs: z.ZodOptional<z.ZodNumber>;
4197
+ target: z.ZodOptional<z.ZodString>;
3401
4198
  }, z.core.$strict>>;
3402
4199
  }, z.core.$strict>;
3403
4200
  export type ArtifactTree = z.infer<typeof ArtifactTreeSchema>;
@@ -3411,12 +4208,26 @@ export declare const ArtifactDiffSchema: z.ZodObject<{
3411
4208
  size: z.ZodNumber;
3412
4209
  sha256: z.ZodString;
3413
4210
  contentType: z.ZodString;
4211
+ type: z.ZodOptional<z.ZodEnum<{
4212
+ dir: "dir";
4213
+ link: "link";
4214
+ }>>;
4215
+ mode: z.ZodOptional<z.ZodNumber>;
4216
+ mtimeMs: z.ZodOptional<z.ZodNumber>;
4217
+ target: z.ZodOptional<z.ZodString>;
3414
4218
  }, z.core.$strict>>;
3415
4219
  removed: z.ZodArray<z.ZodObject<{
3416
4220
  path: z.ZodString;
3417
4221
  size: z.ZodNumber;
3418
4222
  sha256: z.ZodString;
3419
4223
  contentType: z.ZodString;
4224
+ type: z.ZodOptional<z.ZodEnum<{
4225
+ dir: "dir";
4226
+ link: "link";
4227
+ }>>;
4228
+ mode: z.ZodOptional<z.ZodNumber>;
4229
+ mtimeMs: z.ZodOptional<z.ZodNumber>;
4230
+ target: z.ZodOptional<z.ZodString>;
3420
4231
  }, z.core.$strict>>;
3421
4232
  changed: z.ZodArray<z.ZodObject<{
3422
4233
  path: z.ZodString;
@@ -3425,12 +4236,26 @@ export declare const ArtifactDiffSchema: z.ZodObject<{
3425
4236
  size: z.ZodNumber;
3426
4237
  sha256: z.ZodString;
3427
4238
  contentType: z.ZodString;
4239
+ type: z.ZodOptional<z.ZodEnum<{
4240
+ dir: "dir";
4241
+ link: "link";
4242
+ }>>;
4243
+ mode: z.ZodOptional<z.ZodNumber>;
4244
+ mtimeMs: z.ZodOptional<z.ZodNumber>;
4245
+ target: z.ZodOptional<z.ZodString>;
3428
4246
  }, z.core.$strict>;
3429
4247
  to: z.ZodObject<{
3430
4248
  path: z.ZodString;
3431
4249
  size: z.ZodNumber;
3432
4250
  sha256: z.ZodString;
3433
4251
  contentType: z.ZodString;
4252
+ type: z.ZodOptional<z.ZodEnum<{
4253
+ dir: "dir";
4254
+ link: "link";
4255
+ }>>;
4256
+ mode: z.ZodOptional<z.ZodNumber>;
4257
+ mtimeMs: z.ZodOptional<z.ZodNumber>;
4258
+ target: z.ZodOptional<z.ZodString>;
3434
4259
  }, z.core.$strict>;
3435
4260
  }, z.core.$strict>>;
3436
4261
  }, z.core.$strict>;
@@ -3478,7 +4303,7 @@ export declare const SessionListItemSchema: z.ZodObject<{
3478
4303
  }>;
3479
4304
  activeTurnId: z.ZodNullable<z.ZodString>;
3480
4305
  lastTurnId: z.ZodNullable<z.ZodString>;
3481
- sandboxId: z.ZodNullable<z.ZodString>;
4306
+ environmentId: z.ZodNullable<z.ZodString>;
3482
4307
  createdAt: z.ZodNullable<z.ZodString>;
3483
4308
  lastEventAt: z.ZodNullable<z.ZodString>;
3484
4309
  }, z.core.$strict>;
@@ -3501,7 +4326,7 @@ export declare const SessionPageSchema: z.ZodObject<{
3501
4326
  }>;
3502
4327
  activeTurnId: z.ZodNullable<z.ZodString>;
3503
4328
  lastTurnId: z.ZodNullable<z.ZodString>;
3504
- sandboxId: z.ZodNullable<z.ZodString>;
4329
+ environmentId: z.ZodNullable<z.ZodString>;
3505
4330
  createdAt: z.ZodNullable<z.ZodString>;
3506
4331
  lastEventAt: z.ZodNullable<z.ZodString>;
3507
4332
  }, z.core.$strict>>;
@@ -3517,7 +4342,7 @@ export declare const SessionManifestViewSchema: z.ZodObject<{
3517
4342
  }, z.core.$strict>;
3518
4343
  export type SessionManifestView = z.infer<typeof SessionManifestViewSchema>;
3519
4344
  export declare const HistoryPageSchema: z.ZodObject<{
3520
- items: z.ZodArray<z.ZodDiscriminatedUnion<[EventSchemaOf<"artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "message.assistant" | "model.failed" | "node.agent" | "node.started" | "sandbox.attached" | "sandbox.exec" | "sandbox.state" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">, ...EventSchemaOf<"artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "message.assistant" | "model.failed" | "node.agent" | "node.started" | "sandbox.attached" | "sandbox.exec" | "sandbox.state" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">[]], "type">>;
4345
+ items: z.ZodArray<z.ZodDiscriminatedUnion<[EventSchemaOf<"artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "egress.connection" | "environment.attached" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "message.assistant" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">, ...EventSchemaOf<"artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "egress.connection" | "environment.attached" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "message.assistant" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">[]], "type">>;
3521
4346
  cursor: z.ZodNullable<z.ZodString>;
3522
4347
  tail: z.ZodBoolean;
3523
4348
  }, z.core.$strip>;
@@ -3542,6 +4367,7 @@ export declare const SessionUsageTotalsSchema: z.ZodObject<{
3542
4367
  export type SessionUsageTotals = z.infer<typeof SessionUsageTotalsSchema>;
3543
4368
  export declare const ModelCallSchema: z.ZodObject<{
3544
4369
  id: z.ZodString;
4370
+ effectId: z.ZodString;
3545
4371
  sessionId: z.ZodString;
3546
4372
  turnId: z.ZodString;
3547
4373
  agentId: z.ZodString;
@@ -3569,6 +4395,7 @@ export type ModelCall = z.infer<typeof ModelCallSchema>;
3569
4395
  export declare const ModelCallsPageSchema: z.ZodObject<{
3570
4396
  calls: z.ZodArray<z.ZodObject<{
3571
4397
  id: z.ZodString;
4398
+ effectId: z.ZodString;
3572
4399
  sessionId: z.ZodString;
3573
4400
  turnId: z.ZodString;
3574
4401
  agentId: z.ZodString;
@@ -3599,6 +4426,7 @@ export type ModelCallsPage = z.infer<typeof ModelCallsPageSchema>;
3599
4426
  export declare const ModelCallExportPageSchema: z.ZodObject<{
3600
4427
  calls: z.ZodArray<z.ZodObject<{
3601
4428
  id: z.ZodString;
4429
+ effectId: z.ZodString;
3602
4430
  sessionId: z.ZodString;
3603
4431
  turnId: z.ZodString;
3604
4432
  agentId: z.ZodString;
@@ -3627,21 +4455,183 @@ export declare const ModelCallExportPageSchema: z.ZodObject<{
3627
4455
  asOf: z.ZodString;
3628
4456
  }, z.core.$strict>;
3629
4457
  export type ModelCallExportPage = z.infer<typeof ModelCallExportPageSchema>;
3630
- export declare const SandboxPageSchema: z.ZodObject<{
3631
- sandboxes: z.ZodArray<z.ZodObject<{
4458
+ /**
4459
+ * One tool call of a session (R5.2), read from the effect journal: what ran, with what input,
4460
+ * how many sends, and how it ended. `invoking` while it runs. `uncertain` only for a call
4461
+ * recorded before R5. The output is in the session's log (`tool.completed`).
4462
+ */
4463
+ export declare const ToolCallSchema: z.ZodObject<{
4464
+ effectId: z.ZodString;
4465
+ turnId: z.ZodString;
4466
+ callId: z.ZodNullable<z.ZodString>;
4467
+ capabilityId: z.ZodNullable<z.ZodString>;
4468
+ toolName: z.ZodNullable<z.ZodString>;
4469
+ kind: z.ZodNullable<z.ZodEnum<{
4470
+ http: "http";
4471
+ mcp: "mcp";
4472
+ platform: "platform";
4473
+ sandbox: "sandbox";
4474
+ }>>;
4475
+ server: z.ZodNullable<z.ZodString>;
4476
+ status: z.ZodEnum<{
4477
+ cancelled: "cancelled";
4478
+ completed: "completed";
4479
+ failed: "failed";
4480
+ held: "held";
4481
+ invoking: "invoking";
4482
+ uncertain: "uncertain";
4483
+ }>;
4484
+ attempts: z.ZodNumber;
4485
+ input: z.ZodUnknown;
4486
+ error: z.ZodNullable<z.ZodObject<{
4487
+ code: z.ZodString;
4488
+ message: z.ZodString;
4489
+ }, z.core.$strict>>;
4490
+ startedAt: z.ZodNullable<z.ZodString>;
4491
+ settledAt: z.ZodNullable<z.ZodString>;
4492
+ durationMs: z.ZodNullable<z.ZodNumber>;
4493
+ }, z.core.$strict>;
4494
+ export type ToolCall = z.infer<typeof ToolCallSchema>;
4495
+ export declare const ToolCallsPageSchema: z.ZodObject<{
4496
+ calls: z.ZodArray<z.ZodObject<{
4497
+ effectId: z.ZodString;
4498
+ turnId: z.ZodString;
4499
+ callId: z.ZodNullable<z.ZodString>;
4500
+ capabilityId: z.ZodNullable<z.ZodString>;
4501
+ toolName: z.ZodNullable<z.ZodString>;
4502
+ kind: z.ZodNullable<z.ZodEnum<{
4503
+ http: "http";
4504
+ mcp: "mcp";
4505
+ platform: "platform";
4506
+ sandbox: "sandbox";
4507
+ }>>;
4508
+ server: z.ZodNullable<z.ZodString>;
4509
+ status: z.ZodEnum<{
4510
+ cancelled: "cancelled";
4511
+ completed: "completed";
4512
+ failed: "failed";
4513
+ held: "held";
4514
+ invoking: "invoking";
4515
+ uncertain: "uncertain";
4516
+ }>;
4517
+ attempts: z.ZodNumber;
4518
+ input: z.ZodUnknown;
4519
+ error: z.ZodNullable<z.ZodObject<{
4520
+ code: z.ZodString;
4521
+ message: z.ZodString;
4522
+ }, z.core.$strict>>;
4523
+ startedAt: z.ZodNullable<z.ZodString>;
4524
+ settledAt: z.ZodNullable<z.ZodString>;
4525
+ durationMs: z.ZodNullable<z.ZodNumber>;
4526
+ }, z.core.$strict>>;
4527
+ nextCursor: z.ZodNullable<z.ZodString>;
4528
+ asOf: z.ZodString;
4529
+ }, z.core.$strict>;
4530
+ export type ToolCallsPage = z.infer<typeof ToolCallsPageSchema>;
4531
+ /** One OTLP attribute (R7.5): a key and an `AnyValue` (`stringValue`, `intValue`, …). */
4532
+ export declare const OtlpKeyValueSchema: z.ZodObject<{
4533
+ key: z.ZodString;
4534
+ value: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4535
+ }, z.core.$loose>;
4536
+ /**
4537
+ * One span as OTLP/HTTP JSON encodes it (R7.5): hex ids, times in nanoseconds as decimal strings,
4538
+ * `kind` (1 internal, 3 client) and `status.code` (0 unset, 1 ok, 2 error) as numbers.
4539
+ */
4540
+ export declare const OtlpSpanSchema: z.ZodObject<{
4541
+ traceId: z.ZodString;
4542
+ spanId: z.ZodString;
4543
+ parentSpanId: z.ZodOptional<z.ZodString>;
4544
+ name: z.ZodString;
4545
+ kind: z.ZodNumber;
4546
+ startTimeUnixNano: z.ZodString;
4547
+ endTimeUnixNano: z.ZodString;
4548
+ attributes: z.ZodArray<z.ZodObject<{
4549
+ key: z.ZodString;
4550
+ value: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4551
+ }, z.core.$loose>>;
4552
+ status: z.ZodObject<{
4553
+ code: z.ZodNumber;
4554
+ message: z.ZodOptional<z.ZodString>;
4555
+ }, z.core.$loose>;
4556
+ }, z.core.$loose>;
4557
+ export type OtlpSpan = z.infer<typeof OtlpSpanSchema>;
4558
+ /**
4559
+ * A turn's trace (R7.5, feature `traces`): the OTLP `ExportTraceServiceRequest` JSON the Runtime
4560
+ * posts to a collector, built from the turn's log rows. One resource, one scope.
4561
+ */
4562
+ export declare const TurnTraceSchema: z.ZodObject<{
4563
+ resourceSpans: z.ZodArray<z.ZodObject<{
4564
+ resource: z.ZodObject<{
4565
+ attributes: z.ZodArray<z.ZodObject<{
4566
+ key: z.ZodString;
4567
+ value: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4568
+ }, z.core.$loose>>;
4569
+ }, z.core.$loose>;
4570
+ scopeSpans: z.ZodArray<z.ZodObject<{
4571
+ scope: z.ZodObject<{
4572
+ name: z.ZodString;
4573
+ version: z.ZodOptional<z.ZodString>;
4574
+ }, z.core.$loose>;
4575
+ spans: z.ZodArray<z.ZodObject<{
4576
+ traceId: z.ZodString;
4577
+ spanId: z.ZodString;
4578
+ parentSpanId: z.ZodOptional<z.ZodString>;
4579
+ name: z.ZodString;
4580
+ kind: z.ZodNumber;
4581
+ startTimeUnixNano: z.ZodString;
4582
+ endTimeUnixNano: z.ZodString;
4583
+ attributes: z.ZodArray<z.ZodObject<{
4584
+ key: z.ZodString;
4585
+ value: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4586
+ }, z.core.$loose>>;
4587
+ status: z.ZodObject<{
4588
+ code: z.ZodNumber;
4589
+ message: z.ZodOptional<z.ZodString>;
4590
+ }, z.core.$loose>;
4591
+ }, z.core.$loose>>;
4592
+ }, z.core.$loose>>;
4593
+ }, z.core.$loose>>;
4594
+ }, z.core.$loose>;
4595
+ export type TurnTrace = z.infer<typeof TurnTraceSchema>;
4596
+ export declare const EnvironmentPageSchema: z.ZodObject<{
4597
+ environments: z.ZodArray<z.ZodObject<{
3632
4598
  id: z.ZodString;
3633
4599
  kind: z.ZodEnum<{
4600
+ none: "none";
3634
4601
  pod: "pod";
3635
4602
  virtual: "virtual";
3636
4603
  }>;
3637
4604
  labels: z.ZodRecord<z.ZodString, z.ZodString>;
3638
- spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3639
- state: z.ZodEnum<{
3640
- creating: "creating";
3641
- ready: "ready";
3642
- running: "running";
3643
- stopped: "stopped";
3644
- }>;
4605
+ recipe: z.ZodObject<{
4606
+ image: z.ZodOptional<z.ZodString>;
4607
+ resources: z.ZodOptional<z.ZodObject<{
4608
+ cpus: z.ZodNumber;
4609
+ memory: z.ZodString;
4610
+ }, z.core.$strict>>;
4611
+ storage: z.ZodOptional<z.ZodString>;
4612
+ network: z.ZodOptional<z.ZodObject<{
4613
+ allowedHosts: z.ZodArray<z.ZodString>;
4614
+ }, z.core.$strict>>;
4615
+ harness: z.ZodString;
4616
+ lifecycle: z.ZodObject<{
4617
+ idle: z.ZodOptional<z.ZodString>;
4618
+ deleteAfter: z.ZodOptional<z.ZodString>;
4619
+ }, z.core.$strict>;
4620
+ setup: z.ZodOptional<z.ZodArray<z.ZodObject<{
4621
+ command: z.ZodString;
4622
+ cwd: z.ZodOptional<z.ZodString>;
4623
+ timeout: z.ZodOptional<z.ZodString>;
4624
+ }, z.core.$strict>>>;
4625
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
4626
+ artifactId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
4627
+ version: z.ZodNumber;
4628
+ path: z.ZodString;
4629
+ }, z.core.$strict>>>;
4630
+ }, z.core.$strict>;
4631
+ version: z.ZodNumber;
4632
+ appliedVersion: z.ZodNumber;
4633
+ ownerUserId: z.ZodNullable<z.ZodString>;
4634
+ state: z.ZodString;
3645
4635
  pod: z.ZodOptional<z.ZodObject<{
3646
4636
  desired: z.ZodEnum<{
3647
4637
  deleted: "deleted";
@@ -3651,7 +4641,6 @@ export declare const SandboxPageSchema: z.ZodObject<{
3651
4641
  observed: z.ZodEnum<{
3652
4642
  creating: "creating";
3653
4643
  deleting: "deleting";
3654
- expired: "expired";
3655
4644
  failed: "failed";
3656
4645
  lost: "lost";
3657
4646
  running: "running";
@@ -3659,9 +4648,21 @@ export declare const SandboxPageSchema: z.ZodObject<{
3659
4648
  }>;
3660
4649
  volumeGeneration: z.ZodNumber;
3661
4650
  hostEpoch: z.ZodNumber;
3662
- expiresAt: z.ZodOptional<z.ZodString>;
3663
4651
  reason: z.ZodOptional<z.ZodString>;
3664
4652
  }, z.core.$strict>>;
4653
+ lastUsedAt: z.ZodString;
4654
+ disk: z.ZodOptional<z.ZodObject<{
4655
+ latestVersion: z.ZodNullable<z.ZodNumber>;
4656
+ operation: z.ZodOptional<z.ZodObject<{
4657
+ kind: z.ZodEnum<{
4658
+ restore: "restore";
4659
+ seed: "seed";
4660
+ snapshot: "snapshot";
4661
+ }>;
4662
+ version: z.ZodOptional<z.ZodNumber>;
4663
+ startedAt: z.ZodString;
4664
+ }, z.core.$strict>>;
4665
+ }, z.core.$strict>>;
3665
4666
  sessions: z.ZodArray<z.ZodObject<{
3666
4667
  id: z.ZodString;
3667
4668
  activeTurnId: z.ZodNullable<z.ZodString>;
@@ -3671,4 +4672,4 @@ export declare const SandboxPageSchema: z.ZodObject<{
3671
4672
  }, z.core.$strict>>;
3672
4673
  nextCursor: z.ZodNullable<z.ZodString>;
3673
4674
  }, z.core.$strict>;
3674
- export type SandboxPage = z.infer<typeof SandboxPageSchema>;
4675
+ export type EnvironmentPage = z.infer<typeof EnvironmentPageSchema>;