@nylorun/core 0.18.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 +125 -0
  2. package/dist/compatibility.d.ts +78 -30
  3. package/dist/compatibility.js +83 -30
  4. package/dist/contracts.d.ts +1531 -461
  5. package/dist/contracts.js +972 -344
  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 +356 -31
  35. package/dist/harness-api/schema.js +147 -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. */
@@ -497,57 +659,79 @@ export declare const CredentialIdentitySchema: z.ZodObject<{
497
659
  }, z.core.$strict>;
498
660
  export type CredentialIdentity = z.infer<typeof CredentialIdentitySchema>;
499
661
  /**
500
- * A credential for the server at `url` (the URL a manifest names): `bearer` sends
501
- * `Authorization: Bearer <token>`, `headers` its header map (R2b C2). The header names may not be
502
- * the MCP transport's headers or `Nylorun-*`.
662
+ * An environment variable name a shell secret or plain variable may take (R2c, D50): a POSIX
663
+ * name. Names the sandbox needs for itself (the proxy, the trust store, `PATH`, `HOME`) and
664
+ * `NYLORUN_*` are reserved.
503
665
  */
504
- export declare const CreateCredentialRequestSchema: z.ZodObject<{
505
- requestId: z.ZodString;
506
- idempotencyKey: z.ZodString;
507
- name: z.ZodString;
508
- auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
509
- via: z.ZodOptional<z.ZodString>;
510
- identity: z.ZodOptional<z.ZodObject<{
511
- header: z.ZodString;
512
- }, z.core.$strict>>;
513
- type: z.ZodLiteral<"bearer">;
514
- url: z.ZodString;
515
- token: z.ZodString;
516
- }, z.core.$strict>, z.ZodObject<{
517
- via: z.ZodOptional<z.ZodString>;
518
- identity: z.ZodOptional<z.ZodObject<{
519
- header: z.ZodString;
520
- }, z.core.$strict>>;
521
- type: z.ZodLiteral<"headers">;
522
- url: z.ZodString;
523
- headers: z.ZodRecord<z.ZodString, z.ZodString>;
524
- }, z.core.$strict>], "type">;
525
- }, z.core.$strict>;
526
- export type CreateCredentialRequest = z.infer<typeof CreateCredentialRequestSchema>;
666
+ export declare const ENVIRONMENT_NAME_PATTERN: RegExp;
667
+ export declare const RESERVED_ENVIRONMENT_NAMES: ReadonlySet<string>;
668
+ export declare function isReservedEnvironmentName(name: string): boolean;
669
+ /** The value a sandbox sees for every `environment_secret` (R2c, D50): never the secret. */
670
+ export declare const ENVIRONMENT_SECRET_SENTINEL = "nylorun-managed";
527
671
  /**
528
- * Replaces a credential's secret; its type and URL stay. `via` and `identity` are kept unless
529
- * given (`null` removes one).
672
+ * How egress-gate writes an `environment_secret` into a request (R2c, D50): one header, set on
673
+ * every request to a bound host. `format` is text with `{value}` once, optionally inside a
674
+ * `{base64:…}` group, for example `Bearer {value}` (the default),
675
+ * `Basic {base64:x-access-token:{value}}` or `{value}`.
530
676
  */
531
- export declare const RotateCredentialRequestSchema: z.ZodObject<{
532
- requestId: z.ZodString;
533
- idempotencyKey: z.ZodString;
534
- auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
535
- via: z.ZodOptional<z.ZodNullable<z.ZodString>>;
536
- identity: z.ZodOptional<z.ZodNullable<z.ZodObject<{
537
- header: z.ZodString;
538
- }, z.core.$strict>>>;
539
- type: z.ZodLiteral<"bearer">;
540
- token: z.ZodString;
541
- }, z.core.$strict>, z.ZodObject<{
542
- via: z.ZodOptional<z.ZodNullable<z.ZodString>>;
543
- identity: z.ZodOptional<z.ZodNullable<z.ZodObject<{
544
- header: z.ZodString;
545
- }, z.core.$strict>>>;
546
- type: z.ZodLiteral<"headers">;
547
- headers: z.ZodRecord<z.ZodString, z.ZodString>;
548
- }, z.core.$strict>], "type">;
677
+ export declare const ENVIRONMENT_SECRET_DEFAULT_INJECT: {
678
+ readonly header: "Authorization";
679
+ readonly format: "Bearer {value}";
680
+ };
681
+ export declare function isInjectFormat(format: string): boolean;
682
+ /** `format` with `{value}` replaced, and each `{base64:…}` group encoded. */
683
+ export declare function renderInjectFormat(format: string, value: string): string;
684
+ export declare const EnvironmentSecretInjectSchema: z.ZodObject<{
685
+ header: z.ZodString;
686
+ format: z.ZodString;
549
687
  }, z.core.$strict>;
550
- export type RotateCredentialRequest = z.infer<typeof RotateCredentialRequestSchema>;
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;
691
+ /**
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`.
699
+ */
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;
551
735
  /**
552
736
  * What the Runtime cannot learn from a custom OpenAI-compatible endpoint (Model Calls §7):
553
737
  * its context window and output limit, whether it reasons, and pi-ai `compat` settings
@@ -603,24 +787,26 @@ export declare const SelectHostModelRequestSchema: z.ZodObject<{
603
787
  }, z.core.$strict>;
604
788
  export type SelectHostModelRequest = z.infer<typeof SelectHostModelRequestSchema>;
605
789
  export type HostModelProviderInfo = z.infer<typeof HostModelProviderInfoSchema>;
606
- export declare const VaultInfoSchema: z.ZodObject<{
607
- id: z.ZodString;
608
- name: z.ZodString;
609
- ownerUserId: z.ZodString;
610
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
611
- createdAt: z.ZodString;
612
- }, z.core.$strict>;
613
- export type VaultInfo = z.infer<typeof VaultInfoSchema>;
614
- export declare const CredentialInfoSchema: z.ZodObject<{
615
- id: z.ZodString;
616
- 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<{
617
796
  name: z.ZodString;
618
797
  type: z.ZodEnum<{
619
798
  bearer: "bearer";
799
+ environment_secret: "environment_secret";
800
+ environment_variable: "environment_variable";
620
801
  headers: "headers";
621
802
  }>;
622
803
  binding: z.ZodObject<{
623
- url: z.ZodString;
804
+ url: z.ZodOptional<z.ZodString>;
805
+ allowedHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
806
+ inject: z.ZodOptional<z.ZodObject<{
807
+ header: z.ZodString;
808
+ format: z.ZodString;
809
+ }, z.core.$strict>>;
624
810
  }, z.core.$strict>;
625
811
  headerNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
626
812
  via: z.ZodOptional<z.ZodString>;
@@ -630,14 +816,40 @@ export declare const CredentialInfoSchema: z.ZodObject<{
630
816
  createdAt: z.ZodString;
631
817
  rotatedAt: z.ZodOptional<z.ZodString>;
632
818
  }, z.core.$strict>;
633
- 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>;
634
847
  /** The MCP transports a preview speaks: a manifest's remote server types. */
635
848
  export declare const MCP_PREVIEW_TYPES: readonly ["streamable-http", "sse"];
636
849
  /**
637
850
  * `POST /v1/tenant/mcp/preview` (R2b C12): what a remote MCP server offers, before an agent
638
- * names it. The Runtime connects with the installation vault's credential for `url` (one
639
- * credential across the installation vaults, or the one in `vaultId`), lists the tools and
640
- * 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.
641
853
  */
642
854
  export declare const McpPreviewRequestSchema: z.ZodObject<{
643
855
  requestId: z.ZodOptional<z.ZodString>;
@@ -647,7 +859,7 @@ export declare const McpPreviewRequestSchema: z.ZodObject<{
647
859
  "streamable-http": "streamable-http";
648
860
  }>>;
649
861
  name: z.ZodOptional<z.ZodString>;
650
- vaultId: z.ZodOptional<z.ZodString>;
862
+ environmentId: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
651
863
  }, z.core.$strict>;
652
864
  export type McpPreviewRequest = z.infer<typeof McpPreviewRequestSchema>;
653
865
  /** One tool a preview found. */
@@ -662,7 +874,7 @@ export type McpPreviewTool = z.infer<typeof McpPreviewToolSchema>;
662
874
  /**
663
875
  * A preview (R2b C12). A server that answered `401` is `authRequired`, with its RFC 9728
664
876
  * protected-resource metadata when it publishes any: it needs a person's sign-in or a key the
665
- * 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`).
666
878
  */
667
879
  export declare const McpPreviewSchema: z.ZodObject<{
668
880
  name: z.ZodString;
@@ -691,6 +903,84 @@ export declare const McpPreviewSchema: z.ZodObject<{
691
903
  }, z.core.$strict>>;
692
904
  }, z.core.$strict>;
693
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>;
694
984
  /** The most parts one message may carry (protocol 6). */
695
985
  export declare const MAX_MESSAGE_PARTS = 32;
696
986
  /**
@@ -834,10 +1124,18 @@ export type SessionEventBody = SessionCommand;
834
1124
  export type MessageEventBody = z.infer<typeof MessageEventBodySchema>;
835
1125
  /** The envelope every session event carries (`nylorun.event/2`, Durable Streams §9.5). */
836
1126
  export declare const EVENT_SCHEMA = "nylorun.event/2";
837
- /** 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
+ */
838
1134
  export declare const EventSourceKindSchema: z.ZodEnum<{
839
1135
  api: "api";
1136
+ client: "client";
840
1137
  controller: "controller";
1138
+ core: "core";
841
1139
  edge: "edge";
842
1140
  "egress-gate": "egress-gate";
843
1141
  evidence: "evidence";
@@ -852,7 +1150,12 @@ export declare const EventSourceKindSchema: z.ZodEnum<{
852
1150
  "tool-gate": "tool-gate";
853
1151
  }>;
854
1152
  export type EventSourceKind = z.infer<typeof EventSourceKindSchema>;
855
- /** 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
+ */
856
1159
  export declare const EvidenceClassSchema: z.ZodEnum<{
857
1160
  asserted: "asserted";
858
1161
  attested: "attested";
@@ -861,6 +1164,31 @@ export declare const EvidenceClassSchema: z.ZodEnum<{
861
1164
  observed: "observed";
862
1165
  }>;
863
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
+ }
864
1192
  /**
865
1193
  * The envelope fields. Not strict: a client strips fields it does not know, so the envelope
866
1194
  * can grow without a protocol bump.
@@ -888,7 +1216,9 @@ declare const eventEnvelope: {
888
1216
  source: z.ZodObject<{
889
1217
  kind: z.ZodEnum<{
890
1218
  api: "api";
1219
+ client: "client";
891
1220
  controller: "controller";
1221
+ core: "core";
892
1222
  edge: "edge";
893
1223
  "egress-gate": "egress-gate";
894
1224
  evidence: "evidence";
@@ -911,6 +1241,16 @@ declare const eventEnvelope: {
911
1241
  measured: "measured";
912
1242
  observed: "observed";
913
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>>;
914
1254
  trace: z.ZodOptional<z.ZodObject<{
915
1255
  traceId: z.ZodString;
916
1256
  spanId: z.ZodString;
@@ -946,7 +1286,9 @@ export declare const LiveEventSchema: z.ZodObject<{
946
1286
  source: z.ZodObject<{
947
1287
  kind: z.ZodEnum<{
948
1288
  api: "api";
1289
+ client: "client";
949
1290
  controller: "controller";
1291
+ core: "core";
950
1292
  edge: "edge";
951
1293
  "egress-gate": "egress-gate";
952
1294
  evidence: "evidence";
@@ -969,6 +1311,15 @@ export declare const LiveEventSchema: z.ZodObject<{
969
1311
  measured: "measured";
970
1312
  observed: "observed";
971
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>>;
972
1323
  trace: z.ZodOptional<z.ZodObject<{
973
1324
  traceId: z.ZodString;
974
1325
  spanId: z.ZodString;
@@ -999,10 +1350,17 @@ export declare const RejectedResponseSchema: z.ZodObject<{
999
1350
  status: z.ZodLiteral<"rejected">;
1000
1351
  code: z.ZodEnum<{
1001
1352
  connection_missing: "connection_missing";
1353
+ credential_conflict: "credential_conflict";
1002
1354
  credential_invalid: "credential_invalid";
1003
1355
  credential_rejected: "credential_rejected";
1004
1356
  credential_required: "credential_required";
1005
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";
1006
1364
  host_rejected: "host_rejected";
1007
1365
  incompatible_host: "incompatible_host";
1008
1366
  internal_error: "internal_error";
@@ -1016,12 +1374,8 @@ export declare const RejectedResponseSchema: z.ZodObject<{
1016
1374
  placement_refused: "placement_refused";
1017
1375
  protocol_unsupported: "protocol_unsupported";
1018
1376
  request_rejected: "request_rejected";
1019
- sandbox_busy: "sandbox_busy";
1020
- sandbox_expired: "sandbox_expired";
1021
- sandbox_lost: "sandbox_lost";
1022
- sandbox_not_granted: "sandbox_not_granted";
1023
- sandbox_unavailable: "sandbox_unavailable";
1024
1377
  scope_required: "scope_required";
1378
+ session_closed: "session_closed";
1025
1379
  subject_invalid: "subject_invalid";
1026
1380
  subject_required: "subject_required";
1027
1381
  token_expired: "token_expired";
@@ -1039,9 +1393,32 @@ export declare const AgentRefSchema: z.ZodObject<{
1039
1393
  path: z.ZodString;
1040
1394
  delegationId: z.ZodOptional<z.ZodString>;
1041
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>;
1042
1417
  /**
1043
1418
  * `message.assistant`: one completed model step. `invocationId` is the model call's.
1044
- * `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`).
1045
1422
  */
1046
1423
  export declare const AssistantMessagePayloadSchema: z.ZodObject<{
1047
1424
  agent: z.ZodOptional<z.ZodObject<{
@@ -1049,6 +1426,20 @@ export declare const AssistantMessagePayloadSchema: z.ZodObject<{
1049
1426
  path: z.ZodString;
1050
1427
  delegationId: z.ZodOptional<z.ZodString>;
1051
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>>;
1052
1443
  invocationId: z.ZodString;
1053
1444
  text: z.ZodString;
1054
1445
  model: z.ZodOptional<z.ZodObject<{
@@ -1063,6 +1454,11 @@ export declare const AssistantMessagePayloadSchema: z.ZodObject<{
1063
1454
  input: z.ZodUnknown;
1064
1455
  }, z.core.$loose>>;
1065
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;
1066
1462
  /**
1067
1463
  * `model.failed`: a model call that failed in a known way (Model Calls §6.4). The turn
1068
1464
  * then fails with `model.<code>`, or recovers.
@@ -1073,6 +1469,20 @@ export declare const ModelFailedPayloadSchema: z.ZodObject<{
1073
1469
  path: z.ZodString;
1074
1470
  delegationId: z.ZodOptional<z.ZodString>;
1075
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>>;
1076
1486
  invocationId: z.ZodOptional<z.ZodString>;
1077
1487
  code: z.ZodString;
1078
1488
  message: z.ZodString;
@@ -1080,7 +1490,8 @@ export declare const ModelFailedPayloadSchema: z.ZodObject<{
1080
1490
  }, z.core.$loose>;
1081
1491
  /**
1082
1492
  * `context.compacted`: the engine summarized older history to fit the model's window
1083
- * (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.
1084
1495
  */
1085
1496
  export declare const ContextCompactedPayloadSchema: z.ZodObject<{
1086
1497
  agent: z.ZodOptional<z.ZodObject<{
@@ -1088,6 +1499,20 @@ export declare const ContextCompactedPayloadSchema: z.ZodObject<{
1088
1499
  path: z.ZodString;
1089
1500
  delegationId: z.ZodOptional<z.ZodString>;
1090
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>>;
1091
1516
  invocationId: z.ZodOptional<z.ZodString>;
1092
1517
  trigger: z.ZodEnum<{
1093
1518
  overflow: "overflow";
@@ -1095,8 +1520,33 @@ export declare const ContextCompactedPayloadSchema: z.ZodObject<{
1095
1520
  }>;
1096
1521
  tokensBefore: z.ZodNumber;
1097
1522
  tokensAfter: z.ZodNumber;
1523
+ partial: z.ZodOptional<z.ZodLiteral<true>>;
1098
1524
  }, z.core.$loose>;
1099
- /** `tool.completed`: a tool the Runtime ran (HTTP, MCP, sandbox, built-in). `error` for a tool error. */
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>;
1541
+ }, z.core.$loose>;
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
+ */
1100
1550
  export declare const ToolCompletedPayloadSchema: z.ZodObject<{
1101
1551
  agent: z.ZodOptional<z.ZodObject<{
1102
1552
  id: z.ZodString;
@@ -1105,17 +1555,40 @@ export declare const ToolCompletedPayloadSchema: z.ZodObject<{
1105
1555
  }, z.core.$loose>>;
1106
1556
  callId: z.ZodString;
1107
1557
  invocationId: z.ZodString;
1558
+ effectId: z.ZodOptional<z.ZodString>;
1108
1559
  capabilityId: z.ZodString;
1109
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>>;
1110
1587
  output: z.ZodOptional<z.ZodUnknown>;
1111
1588
  error: z.ZodOptional<z.ZodObject<{
1112
1589
  code: z.ZodString;
1113
1590
  message: z.ZodString;
1114
1591
  server: z.ZodOptional<z.ZodString>;
1115
- vault: z.ZodOptional<z.ZodEnum<{
1116
- installation: "installation";
1117
- user: "user";
1118
- }>>;
1119
1592
  retryable: z.ZodOptional<z.ZodBoolean>;
1120
1593
  }, z.core.$loose>>;
1121
1594
  redacted: z.ZodOptional<z.ZodNumber>;
@@ -1125,6 +1598,14 @@ export declare const EffectUncertainPayloadSchema: z.ZodObject<{
1125
1598
  message: z.ZodOptional<z.ZodString>;
1126
1599
  }, z.core.$loose>;
1127
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>>;
1128
1609
  output: z.ZodUnknown;
1129
1610
  }, z.core.$loose>;
1130
1611
  export declare const TurnPausedPayloadSchema: z.ZodObject<{
@@ -1140,6 +1621,14 @@ export declare const TurnPausedPayloadSchema: z.ZodObject<{
1140
1621
  }, z.core.$loose>;
1141
1622
  /** Either `{ error: { code, message } }` or, when a segment threw, `{ message }`. */
1142
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>>;
1143
1632
  error: z.ZodOptional<z.ZodObject<{
1144
1633
  code: z.ZodOptional<z.ZodString>;
1145
1634
  message: z.ZodOptional<z.ZodString>;
@@ -1147,6 +1636,14 @@ export declare const TurnFailedPayloadSchema: z.ZodObject<{
1147
1636
  message: z.ZodOptional<z.ZodString>;
1148
1637
  }, z.core.$loose>;
1149
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>>;
1150
1647
  reason: z.ZodOptional<z.ZodString>;
1151
1648
  }, z.core.$loose>;
1152
1649
  /** Lifecycle of an agent used as a tool. `agent.delegationId` is the parent call's invocation. */
@@ -1165,6 +1662,20 @@ declare const TRANSCRIPT_PAYLOADS: {
1165
1662
  path: z.ZodString;
1166
1663
  delegationId: z.ZodOptional<z.ZodString>;
1167
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>>;
1168
1679
  invocationId: z.ZodString;
1169
1680
  text: z.ZodString;
1170
1681
  model: z.ZodOptional<z.ZodObject<{
@@ -1185,6 +1696,20 @@ declare const TRANSCRIPT_PAYLOADS: {
1185
1696
  path: z.ZodString;
1186
1697
  delegationId: z.ZodOptional<z.ZodString>;
1187
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>>;
1188
1713
  invocationId: z.ZodOptional<z.ZodString>;
1189
1714
  code: z.ZodString;
1190
1715
  message: z.ZodString;
@@ -1196,6 +1721,20 @@ declare const TRANSCRIPT_PAYLOADS: {
1196
1721
  path: z.ZodString;
1197
1722
  delegationId: z.ZodOptional<z.ZodString>;
1198
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>>;
1199
1738
  invocationId: z.ZodOptional<z.ZodString>;
1200
1739
  trigger: z.ZodEnum<{
1201
1740
  overflow: "overflow";
@@ -1203,6 +1742,7 @@ declare const TRANSCRIPT_PAYLOADS: {
1203
1742
  }>;
1204
1743
  tokensBefore: z.ZodNumber;
1205
1744
  tokensAfter: z.ZodNumber;
1745
+ partial: z.ZodOptional<z.ZodLiteral<true>>;
1206
1746
  }, z.core.$loose>;
1207
1747
  readonly "tool.completed": z.ZodObject<{
1208
1748
  agent: z.ZodOptional<z.ZodObject<{
@@ -1212,17 +1752,40 @@ declare const TRANSCRIPT_PAYLOADS: {
1212
1752
  }, z.core.$loose>>;
1213
1753
  callId: z.ZodString;
1214
1754
  invocationId: z.ZodString;
1755
+ effectId: z.ZodOptional<z.ZodString>;
1215
1756
  capabilityId: z.ZodString;
1216
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>>;
1217
1784
  output: z.ZodOptional<z.ZodUnknown>;
1218
1785
  error: z.ZodOptional<z.ZodObject<{
1219
1786
  code: z.ZodString;
1220
1787
  message: z.ZodString;
1221
1788
  server: z.ZodOptional<z.ZodString>;
1222
- vault: z.ZodOptional<z.ZodEnum<{
1223
- installation: "installation";
1224
- user: "user";
1225
- }>>;
1226
1789
  retryable: z.ZodOptional<z.ZodBoolean>;
1227
1790
  }, z.core.$loose>>;
1228
1791
  redacted: z.ZodOptional<z.ZodNumber>;
@@ -1232,6 +1795,14 @@ declare const TRANSCRIPT_PAYLOADS: {
1232
1795
  message: z.ZodOptional<z.ZodString>;
1233
1796
  }, z.core.$loose>;
1234
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>>;
1235
1806
  output: z.ZodUnknown;
1236
1807
  }, z.core.$loose>;
1237
1808
  readonly "turn.paused": z.ZodObject<{
@@ -1246,6 +1817,14 @@ declare const TRANSCRIPT_PAYLOADS: {
1246
1817
  }, z.core.$loose>>;
1247
1818
  }, z.core.$loose>;
1248
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>>;
1249
1828
  error: z.ZodOptional<z.ZodObject<{
1250
1829
  code: z.ZodOptional<z.ZodString>;
1251
1830
  message: z.ZodOptional<z.ZodString>;
@@ -1253,6 +1832,14 @@ declare const TRANSCRIPT_PAYLOADS: {
1253
1832
  message: z.ZodOptional<z.ZodString>;
1254
1833
  }, z.core.$loose>;
1255
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>>;
1256
1843
  reason: z.ZodOptional<z.ZodString>;
1257
1844
  }, z.core.$loose>;
1258
1845
  readonly "delegation.started": z.ZodObject<{
@@ -1290,6 +1877,10 @@ export declare const CommandMessagePayloadSchema: z.ZodObject<{
1290
1877
  version: z.ZodOptional<z.ZodNumber>;
1291
1878
  }, z.core.$strict>], "type">>>;
1292
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>>;
1293
1884
  }, z.core.$loose>;
1294
1885
  /** `command.approve`: an answer to an approval interaction. */
1295
1886
  export declare const CommandApprovePayloadSchema: z.ZodObject<{
@@ -1307,8 +1898,8 @@ export declare const CommandRespondPayloadSchema: z.ZodObject<{
1307
1898
  interactionId: z.ZodString;
1308
1899
  value: z.ZodUnknown;
1309
1900
  }, z.core.$loose>;
1310
- /** `sandbox.state`: the session's sandbox changed state. */
1311
- export declare const SandboxStatePayloadSchema: z.ZodObject<{
1901
+ /** `environment.state`: the session's sandbox changed state. */
1902
+ export declare const EnvironmentStatePayloadSchema: z.ZodObject<{
1312
1903
  state: z.ZodEnum<{
1313
1904
  creating: "creating";
1314
1905
  running: "running";
@@ -1324,14 +1915,14 @@ export declare const SandboxStatePayloadSchema: z.ZodObject<{
1324
1915
  error: z.ZodOptional<z.ZodString>;
1325
1916
  }, z.core.$loose>;
1326
1917
  /**
1327
- * `sandbox.attached`: the session was opened on a sandbox resource (`sandbox: { id }`). The
1328
- * 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.
1329
1920
  */
1330
- export declare const SandboxAttachedPayloadSchema: z.ZodObject<{
1331
- sandboxId: z.ZodString;
1921
+ export declare const EnvironmentAttachedPayloadSchema: z.ZodObject<{
1922
+ environmentId: z.ZodString;
1332
1923
  }, z.core.$loose>;
1333
- /** `sandbox.exec`: one sandbox tool call finished. */
1334
- export declare const SandboxExecPayloadSchema: z.ZodObject<{
1924
+ /** `environment.exec`: one sandbox tool call finished. */
1925
+ export declare const EnvironmentExecPayloadSchema: z.ZodObject<{
1335
1926
  tool: z.ZodString;
1336
1927
  command: z.ZodOptional<z.ZodString>;
1337
1928
  outcome: z.ZodString;
@@ -1345,6 +1936,30 @@ export declare const NodeStartedPayloadSchema: z.ZodObject<{
1345
1936
  key: z.ZodString;
1346
1937
  iterations: z.ZodOptional<z.ZodString>;
1347
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>;
1348
1963
  /** `node.agent`: a workflow node runs as a linked agent session. */
1349
1964
  export declare const NodeAgentPayloadSchema: z.ZodObject<{
1350
1965
  path: z.ZodString;
@@ -1389,6 +2004,7 @@ export declare const TranscriptUpdatedPayloadSchema: z.ZodObject<{
1389
2004
  export declare const ArtifactSourceSchema: z.ZodEnum<{
1390
2005
  engine: "engine";
1391
2006
  export: "export";
2007
+ snapshot: "snapshot";
1392
2008
  upload: "upload";
1393
2009
  }>;
1394
2010
  export type ArtifactSource = z.infer<typeof ArtifactSourceSchema>;
@@ -1420,6 +2036,7 @@ export declare const ArtifactVersionPayloadSchema: z.ZodObject<{
1420
2036
  source: z.ZodEnum<{
1421
2037
  engine: "engine";
1422
2038
  export: "export";
2039
+ snapshot: "snapshot";
1423
2040
  upload: "upload";
1424
2041
  }>;
1425
2042
  callId: z.ZodOptional<z.ZodString>;
@@ -1539,6 +2156,10 @@ export declare const EVENT_CATALOG: {
1539
2156
  version: z.ZodOptional<z.ZodNumber>;
1540
2157
  }, z.core.$strict>], "type">>>;
1541
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>>;
1542
2163
  }, z.core.$loose>;
1543
2164
  readonly source: "api";
1544
2165
  readonly version: 1;
@@ -1567,6 +2188,14 @@ export declare const EVENT_CATALOG: {
1567
2188
  };
1568
2189
  readonly "turn.completed": {
1569
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>>;
1570
2199
  output: z.ZodUnknown;
1571
2200
  }, z.core.$loose>;
1572
2201
  readonly source: "loop";
@@ -1589,6 +2218,14 @@ export declare const EVENT_CATALOG: {
1589
2218
  };
1590
2219
  readonly "turn.failed": {
1591
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>>;
1592
2229
  error: z.ZodOptional<z.ZodObject<{
1593
2230
  code: z.ZodOptional<z.ZodString>;
1594
2231
  message: z.ZodOptional<z.ZodString>;
@@ -1600,6 +2237,14 @@ export declare const EVENT_CATALOG: {
1600
2237
  };
1601
2238
  readonly "turn.cancelled": {
1602
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>>;
1603
2248
  reason: z.ZodOptional<z.ZodString>;
1604
2249
  }, z.core.$loose>;
1605
2250
  readonly source: "api";
@@ -1612,6 +2257,20 @@ export declare const EVENT_CATALOG: {
1612
2257
  path: z.ZodString;
1613
2258
  delegationId: z.ZodOptional<z.ZodString>;
1614
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>>;
1615
2274
  invocationId: z.ZodString;
1616
2275
  text: z.ZodString;
1617
2276
  model: z.ZodOptional<z.ZodObject<{
@@ -1636,6 +2295,20 @@ export declare const EVENT_CATALOG: {
1636
2295
  path: z.ZodString;
1637
2296
  delegationId: z.ZodOptional<z.ZodString>;
1638
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>>;
1639
2312
  invocationId: z.ZodOptional<z.ZodString>;
1640
2313
  code: z.ZodString;
1641
2314
  message: z.ZodString;
@@ -1651,6 +2324,20 @@ export declare const EVENT_CATALOG: {
1651
2324
  path: z.ZodString;
1652
2325
  delegationId: z.ZodOptional<z.ZodString>;
1653
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>>;
1654
2341
  invocationId: z.ZodOptional<z.ZodString>;
1655
2342
  trigger: z.ZodEnum<{
1656
2343
  overflow: "overflow";
@@ -1658,6 +2345,7 @@ export declare const EVENT_CATALOG: {
1658
2345
  }>;
1659
2346
  tokensBefore: z.ZodNumber;
1660
2347
  tokensAfter: z.ZodNumber;
2348
+ partial: z.ZodOptional<z.ZodLiteral<true>>;
1661
2349
  }, z.core.$loose>;
1662
2350
  readonly source: "loop";
1663
2351
  readonly version: 1;
@@ -1671,17 +2359,40 @@ export declare const EVENT_CATALOG: {
1671
2359
  }, z.core.$loose>>;
1672
2360
  callId: z.ZodString;
1673
2361
  invocationId: z.ZodString;
2362
+ effectId: z.ZodOptional<z.ZodString>;
1674
2363
  capabilityId: z.ZodString;
1675
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>>;
1676
2391
  output: z.ZodOptional<z.ZodUnknown>;
1677
2392
  error: z.ZodOptional<z.ZodObject<{
1678
2393
  code: z.ZodString;
1679
2394
  message: z.ZodString;
1680
2395
  server: z.ZodOptional<z.ZodString>;
1681
- vault: z.ZodOptional<z.ZodEnum<{
1682
- installation: "installation";
1683
- user: "user";
1684
- }>>;
1685
2396
  retryable: z.ZodOptional<z.ZodBoolean>;
1686
2397
  }, z.core.$loose>>;
1687
2398
  redacted: z.ZodOptional<z.ZodNumber>;
@@ -1747,7 +2458,7 @@ export declare const EVENT_CATALOG: {
1747
2458
  readonly source: "loop";
1748
2459
  readonly version: 1;
1749
2460
  };
1750
- readonly "sandbox.state": {
2461
+ readonly "environment.state": {
1751
2462
  readonly payload: z.ZodObject<{
1752
2463
  state: z.ZodEnum<{
1753
2464
  creating: "creating";
@@ -1766,7 +2477,7 @@ export declare const EVENT_CATALOG: {
1766
2477
  readonly source: "loop";
1767
2478
  readonly version: 1;
1768
2479
  };
1769
- readonly "sandbox.exec": {
2480
+ readonly "environment.exec": {
1770
2481
  readonly payload: z.ZodObject<{
1771
2482
  tool: z.ZodString;
1772
2483
  command: z.ZodOptional<z.ZodString>;
@@ -1777,13 +2488,39 @@ export declare const EVENT_CATALOG: {
1777
2488
  readonly source: "loop";
1778
2489
  readonly version: 1;
1779
2490
  };
1780
- readonly "sandbox.attached": {
2491
+ readonly "environment.attached": {
1781
2492
  readonly payload: z.ZodObject<{
1782
- sandboxId: z.ZodString;
2493
+ environmentId: z.ZodString;
1783
2494
  }, z.core.$loose>;
1784
2495
  readonly source: "api";
1785
2496
  readonly version: 1;
1786
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
+ };
1787
2524
  readonly "node.started": {
1788
2525
  readonly payload: z.ZodObject<{
1789
2526
  path: z.ZodString;
@@ -1794,6 +2531,27 @@ export declare const EVENT_CATALOG: {
1794
2531
  readonly source: "loop";
1795
2532
  readonly version: 1;
1796
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
+ };
1797
2555
  readonly "node.agent": {
1798
2556
  readonly payload: z.ZodObject<{
1799
2557
  path: z.ZodString;
@@ -1841,6 +2599,7 @@ export declare const EVENT_CATALOG: {
1841
2599
  source: z.ZodEnum<{
1842
2600
  engine: "engine";
1843
2601
  export: "export";
2602
+ snapshot: "snapshot";
1844
2603
  upload: "upload";
1845
2604
  }>;
1846
2605
  callId: z.ZodOptional<z.ZodString>;
@@ -1865,6 +2624,7 @@ export declare const EVENT_CATALOG: {
1865
2624
  source: z.ZodEnum<{
1866
2625
  engine: "engine";
1867
2626
  export: "export";
2627
+ snapshot: "snapshot";
1868
2628
  upload: "upload";
1869
2629
  }>;
1870
2630
  callId: z.ZodOptional<z.ZodString>;
@@ -1936,7 +2696,7 @@ type EventSchemaOf<T extends EventType> = z.ZodObject<typeof eventEnvelope & {
1936
2696
  /** One schema per event type, keyed by type (the OpenAPI components). */
1937
2697
  export declare const EVENT_SCHEMAS: { [T in EventType]: EventSchemaOf<T>; };
1938
2698
  /** A session event of a known type, discriminated on `type`. */
1939
- 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">;
1940
2700
  export type SessionEvent = {
1941
2701
  [T in EventType]: z.infer<EventSchemaOf<T>>;
1942
2702
  }[EventType];
@@ -1951,7 +2711,7 @@ export type SessionEventOf<T extends EventType> = Extract<SessionEvent, {
1951
2711
  */
1952
2712
  export declare function parseSessionEvent(value: unknown): SessionEvent | LiveEvent;
1953
2713
  export declare const SessionItemsResponseSchema: z.ZodObject<{
1954
- 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">>;
1955
2715
  cursor: z.ZodNullable<z.ZodString>;
1956
2716
  }, z.core.$strip>;
1957
2717
  export type SessionItemsResponse = {
@@ -2266,16 +3026,6 @@ export declare const SeedTenantConfigRequestSchema: z.ZodObject<{
2266
3026
  virtual: "virtual";
2267
3027
  }>>;
2268
3028
  config: z.ZodOptional<z.ZodObject<{
2269
- default: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"virtual">, z.ZodObject<{
2270
- image: z.ZodOptional<z.ZodString>;
2271
- network: z.ZodOptional<z.ZodObject<{
2272
- allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
2273
- }, z.core.$strict>>;
2274
- resources: z.ZodOptional<z.ZodObject<{
2275
- cpus: z.ZodOptional<z.ZodNumber>;
2276
- memory: z.ZodOptional<z.ZodString>;
2277
- }, z.core.$strict>>;
2278
- }, z.core.$strict>]>>;
2279
3029
  limits: z.ZodOptional<z.ZodObject<{
2280
3030
  network: z.ZodOptional<z.ZodArray<z.ZodString>>;
2281
3031
  resources: z.ZodOptional<z.ZodObject<{
@@ -2287,14 +3037,9 @@ export declare const SeedTenantConfigRequestSchema: z.ZodObject<{
2287
3037
  memory: z.ZodOptional<z.ZodString>;
2288
3038
  }, z.core.$strict>>;
2289
3039
  idle: z.ZodOptional<z.ZodString>;
2290
- sandboxes: z.ZodOptional<z.ZodNumber>;
2291
- ttl: z.ZodOptional<z.ZodString>;
3040
+ environments: z.ZodOptional<z.ZodNumber>;
2292
3041
  }, z.core.$strict>>;
2293
3042
  lifecycle: z.ZodOptional<z.ZodObject<{
2294
- onExpiry: z.ZodOptional<z.ZodEnum<{
2295
- delete: "delete";
2296
- retain: "retain";
2297
- }>>;
2298
3043
  stopGrace: z.ZodOptional<z.ZodString>;
2299
3044
  }, z.core.$strict>>;
2300
3045
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -2338,7 +3083,7 @@ export declare const ResetTenantRequestSchema: z.ZodObject<{
2338
3083
  requestId: z.ZodString;
2339
3084
  scope: z.ZodEnum<{
2340
3085
  all: "all";
2341
- sandboxes: "sandboxes";
3086
+ environments: "environments";
2342
3087
  sessions: "sessions";
2343
3088
  }>;
2344
3089
  activeWork: z.ZodEnum<{
@@ -2350,12 +3095,17 @@ export type ResetTenantRequest = z.infer<typeof ResetTenantRequestSchema>;
2350
3095
  /**
2351
3096
  * Acting for a subject (Host feature `subject-headers`): what an application principal may
2352
3097
  * narrow a request to. `sessions:own` reaches only the subject's own sessions; the others reach
2353
- * Tenant-wide resources. `sandboxes:write` creates and deletes sandboxes (Host feature
2354
- * `sandboxes`); a token caller's reach only the ids its sandbox grants name. Vaults are the
2355
- * 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.
2356
3101
  */
2357
- 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"];
2358
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";
2359
3109
  /** A valid subject: 1–200 visible ASCII characters, not reserved by the Runtime. */
2360
3110
  export declare function isSubject(value: unknown): value is string;
2361
3111
  /**
@@ -2373,9 +3123,9 @@ export declare function parseSubjectHeaders(subject: string, scopes: string | un
2373
3123
  /**
2374
3124
  * Scopes a token caller (a trusted issuer's token) may carry: never `agents:write`.
2375
3125
  */
2376
- export declare const TOKEN_SCOPES: readonly ["agents:read", "sessions:own", "sandboxes:write"];
2377
- /** The most sandbox grants one token caller carries. */
2378
- 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;
2379
3129
  export type TokenScope = (typeof TOKEN_SCOPES)[number];
2380
3130
  /**
2381
3131
  * The longest a token the Runtime signs itself lives, in seconds (capability links): rotating
@@ -2473,10 +3223,10 @@ export declare const RevokeSigningKeyRequestSchema: z.ZodObject<{
2473
3223
  * token scopes, and `studio`, an operator scope no Runtime route requires (Studio
2474
3224
  * admits a person who holds it, Tenant-wide).
2475
3225
  */
2476
- 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"];
2477
3227
  export type IssuerScope = (typeof ISSUER_SCOPES)[number];
2478
3228
  /** Every scope a caller can hold: the subject scopes, and an issuer token's `studio`. */
2479
- 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"];
2480
3230
  export type CallerScope = (typeof CALLER_SCOPES)[number];
2481
3231
  /**
2482
3232
  * `GET /v1/me`: who the Runtime takes the caller to be, for any credential.
@@ -2487,20 +3237,20 @@ export type CallerScope = (typeof CALLER_SCOPES)[number];
2487
3237
  * - `subject` is the person the request acts for; absent for an application key alone.
2488
3238
  * - `scopes`: what the caller holds. An application key alone holds every subject scope.
2489
3239
  * - `agents`: the agents it may reach, `*` for all.
2490
- * - `sandboxes`: the sandbox grants of a token caller (empty reaches none); absent for an
2491
- * 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.
2492
3242
  */
2493
3243
  export declare const MeResponseSchema: z.ZodObject<{
2494
3244
  subject: z.ZodOptional<z.ZodString>;
2495
3245
  scopes: z.ZodArray<z.ZodEnum<{
2496
3246
  "agents:read": "agents:read";
2497
3247
  "agents:write": "agents:write";
2498
- "sandboxes:write": "sandboxes:write";
3248
+ "environments:write": "environments:write";
2499
3249
  "sessions:own": "sessions:own";
2500
3250
  studio: "studio";
2501
3251
  }>>;
2502
3252
  agents: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>;
2503
- sandboxes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3253
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
2504
3254
  via: z.ZodString;
2505
3255
  }, z.core.$strict>;
2506
3256
  export type MeResponse = z.infer<typeof MeResponseSchema>;
@@ -2603,20 +3353,12 @@ export declare const SessionViewSchema: z.ZodObject<{
2603
3353
  waiting: "waiting";
2604
3354
  }>;
2605
3355
  activeTurnId: z.ZodNullable<z.ZodString>;
2606
- vaultIds: z.ZodArray<z.ZodString>;
2607
- credentialSelections: z.ZodArray<z.ZodObject<{
2608
- serverName: z.ZodString;
2609
- credentialId: z.ZodString;
2610
- }, z.core.$strict>>;
2611
- sandboxOwnerId: z.ZodNullable<z.ZodString>;
2612
- sandboxId: z.ZodOptional<z.ZodString>;
2613
- sandbox: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2614
- sandboxSource: z.ZodOptional<z.ZodEnum<{
2615
- default: "default";
2616
- inline: "inline";
2617
- sandbox: "sandbox";
2618
- shared: "shared";
2619
- }>>;
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>;
2620
3362
  mcpSnapshot: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2621
3363
  mcpDiagnostics: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2622
3364
  waits: z.ZodOptional<z.ZodUnknown>;
@@ -2694,18 +3436,8 @@ export declare const ListProvidersResponseSchema: z.ZodObject<{
2694
3436
  }, z.core.$strict>>;
2695
3437
  }, z.core.$strict>;
2696
3438
  export type ListProvidersResponse = z.infer<typeof ListProvidersResponseSchema>;
2697
- /** 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). */
2698
3440
  export declare const EffectiveSandboxConfigSchema: z.ZodObject<{
2699
- default: z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"virtual">, z.ZodObject<{
2700
- image: z.ZodOptional<z.ZodString>;
2701
- network: z.ZodOptional<z.ZodObject<{
2702
- allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
2703
- }, z.core.$strict>>;
2704
- resources: z.ZodOptional<z.ZodObject<{
2705
- cpus: z.ZodOptional<z.ZodNumber>;
2706
- memory: z.ZodOptional<z.ZodString>;
2707
- }, z.core.$strict>>;
2708
- }, z.core.$strict>]>;
2709
3441
  limits: z.ZodObject<{
2710
3442
  network: z.ZodArray<z.ZodString>;
2711
3443
  resources: z.ZodObject<{
@@ -2717,14 +3449,9 @@ export declare const EffectiveSandboxConfigSchema: z.ZodObject<{
2717
3449
  memoryMiB: z.ZodNumber;
2718
3450
  }, z.core.$strict>;
2719
3451
  idle: z.ZodString;
2720
- sandboxes: z.ZodOptional<z.ZodNumber>;
2721
- ttl: z.ZodOptional<z.ZodString>;
3452
+ environments: z.ZodOptional<z.ZodNumber>;
2722
3453
  }, z.core.$strict>;
2723
3454
  lifecycle: z.ZodOptional<z.ZodObject<{
2724
- onExpiry: z.ZodEnum<{
2725
- delete: "delete";
2726
- retain: "retain";
2727
- }>;
2728
3455
  stopGrace: z.ZodString;
2729
3456
  }, z.core.$strict>>;
2730
3457
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -2765,16 +3492,6 @@ export declare const TenantSandboxViewSchema: z.ZodObject<{
2765
3492
  }, z.core.$strict>>;
2766
3493
  defaultImage: z.ZodString;
2767
3494
  config: z.ZodObject<{
2768
- default: z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"virtual">, z.ZodObject<{
2769
- image: z.ZodOptional<z.ZodString>;
2770
- network: z.ZodOptional<z.ZodObject<{
2771
- allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
2772
- }, z.core.$strict>>;
2773
- resources: z.ZodOptional<z.ZodObject<{
2774
- cpus: z.ZodOptional<z.ZodNumber>;
2775
- memory: z.ZodOptional<z.ZodString>;
2776
- }, z.core.$strict>>;
2777
- }, z.core.$strict>]>;
2778
3495
  limits: z.ZodObject<{
2779
3496
  network: z.ZodArray<z.ZodString>;
2780
3497
  resources: z.ZodObject<{
@@ -2786,14 +3503,9 @@ export declare const TenantSandboxViewSchema: z.ZodObject<{
2786
3503
  memoryMiB: z.ZodNumber;
2787
3504
  }, z.core.$strict>;
2788
3505
  idle: z.ZodString;
2789
- sandboxes: z.ZodOptional<z.ZodNumber>;
2790
- ttl: z.ZodOptional<z.ZodString>;
3506
+ environments: z.ZodOptional<z.ZodNumber>;
2791
3507
  }, z.core.$strict>;
2792
3508
  lifecycle: z.ZodOptional<z.ZodObject<{
2793
- onExpiry: z.ZodEnum<{
2794
- delete: "delete";
2795
- retain: "retain";
2796
- }>;
2797
3509
  stopGrace: z.ZodString;
2798
3510
  }, z.core.$strict>>;
2799
3511
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -2912,39 +3624,112 @@ export declare const ModelBudgetsSchema: z.ZodObject<{
2912
3624
  }, z.core.$strict>>;
2913
3625
  }, z.core.$strict>;
2914
3626
  export type ModelBudgets = z.infer<typeof ModelBudgetsSchema>;
2915
- export declare const ListVaultsResponseSchema: z.ZodObject<{
2916
- vaults: z.ZodArray<z.ZodObject<{
2917
- id: z.ZodString;
2918
- name: z.ZodString;
2919
- ownerUserId: z.ZodString;
2920
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2921
- 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>;
2922
3700
  }, z.core.$strict>>;
2923
3701
  }, z.core.$strict>;
2924
- export type ListVaultsResponse = z.infer<typeof ListVaultsResponseSchema>;
2925
- export declare const ListCredentialsResponseSchema: z.ZodObject<{
2926
- credentials: z.ZodArray<z.ZodObject<{
2927
- id: z.ZodString;
2928
- vaultId: z.ZodString;
2929
- name: z.ZodString;
2930
- type: z.ZodEnum<{
2931
- bearer: "bearer";
2932
- 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";
2933
3710
  }>;
2934
- binding: z.ZodObject<{
2935
- url: z.ZodString;
2936
- }, z.core.$strict>;
2937
- headerNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
2938
- via: z.ZodOptional<z.ZodString>;
2939
- identity: z.ZodOptional<z.ZodObject<{
2940
- header: z.ZodString;
2941
- }, z.core.$strict>>;
2942
- createdAt: z.ZodString;
2943
- 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>;
2944
3728
  }, z.core.$strict>>;
3729
+ updatedAt: z.ZodNullable<z.ZodString>;
2945
3730
  }, z.core.$strict>;
2946
- export type ListCredentialsResponse = z.infer<typeof ListCredentialsResponseSchema>;
2947
- /** A deleted vault or credential. */
3731
+ export type ToolPolicy = z.infer<typeof ToolPolicySchema>;
3732
+ /** A deleted resource. */
2948
3733
  export declare const DeletedResponseSchema: z.ZodObject<{
2949
3734
  id: z.ZodString;
2950
3735
  }, z.core.$strict>;
@@ -2965,10 +3750,17 @@ export type StreamClosedFrame = z.infer<typeof StreamClosedFrameSchema>;
2965
3750
  */
2966
3751
  export declare const AgUiRunErrorCodeSchema: z.ZodEnum<{
2967
3752
  connection_missing: "connection_missing";
3753
+ credential_conflict: "credential_conflict";
2968
3754
  credential_invalid: "credential_invalid";
2969
3755
  credential_rejected: "credential_rejected";
2970
3756
  credential_required: "credential_required";
2971
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";
2972
3764
  host_rejected: "host_rejected";
2973
3765
  incompatible_host: "incompatible_host";
2974
3766
  internal_error: "internal_error";
@@ -2983,13 +3775,9 @@ export declare const AgUiRunErrorCodeSchema: z.ZodEnum<{
2983
3775
  protocol_unsupported: "protocol_unsupported";
2984
3776
  request_rejected: "request_rejected";
2985
3777
  runtime_error: "runtime_error";
2986
- sandbox_busy: "sandbox_busy";
2987
- sandbox_expired: "sandbox_expired";
2988
- sandbox_lost: "sandbox_lost";
2989
- sandbox_not_granted: "sandbox_not_granted";
2990
- sandbox_unavailable: "sandbox_unavailable";
2991
3778
  scope_required: "scope_required";
2992
3779
  session_busy: "session_busy";
3780
+ session_closed: "session_closed";
2993
3781
  subject_invalid: "subject_invalid";
2994
3782
  subject_required: "subject_required";
2995
3783
  token_expired: "token_expired";
@@ -3150,6 +3938,7 @@ export declare const ArtifactVersionViewSchema: z.ZodObject<{
3150
3938
  source: z.ZodEnum<{
3151
3939
  engine: "engine";
3152
3940
  export: "export";
3941
+ snapshot: "snapshot";
3153
3942
  upload: "upload";
3154
3943
  }>;
3155
3944
  createdAt: z.ZodString;
@@ -3168,6 +3957,7 @@ export declare const ArtifactViewSchema: z.ZodObject<{
3168
3957
  name: z.ZodString;
3169
3958
  contentType: z.ZodString;
3170
3959
  sessionId: z.ZodOptional<z.ZodString>;
3960
+ environmentId: z.ZodOptional<z.ZodString>;
3171
3961
  latestVersion: z.ZodNumber;
3172
3962
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3173
3963
  createdAt: z.ZodString;
@@ -3180,6 +3970,7 @@ export declare const ArtifactViewSchema: z.ZodObject<{
3180
3970
  source: z.ZodEnum<{
3181
3971
  engine: "engine";
3182
3972
  export: "export";
3973
+ snapshot: "snapshot";
3183
3974
  upload: "upload";
3184
3975
  }>;
3185
3976
  createdAt: z.ZodString;
@@ -3196,6 +3987,7 @@ export declare const ListArtifactsResponseSchema: z.ZodObject<{
3196
3987
  name: z.ZodString;
3197
3988
  contentType: z.ZodString;
3198
3989
  sessionId: z.ZodOptional<z.ZodString>;
3990
+ environmentId: z.ZodOptional<z.ZodString>;
3199
3991
  latestVersion: z.ZodNumber;
3200
3992
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3201
3993
  createdAt: z.ZodString;
@@ -3208,6 +4000,7 @@ export declare const ListArtifactsResponseSchema: z.ZodObject<{
3208
4000
  source: z.ZodEnum<{
3209
4001
  engine: "engine";
3210
4002
  export: "export";
4003
+ snapshot: "snapshot";
3211
4004
  upload: "upload";
3212
4005
  }>;
3213
4006
  createdAt: z.ZodString;
@@ -3215,6 +4008,42 @@ export declare const ListArtifactsResponseSchema: z.ZodObject<{
3215
4008
  }, z.core.$strict>>;
3216
4009
  }, z.core.$strict>;
3217
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>;
3218
4047
  /** What an upload answers: the artifact, and the version the upload created. */
3219
4048
  export declare const UploadArtifactResponseSchema: z.ZodObject<{
3220
4049
  artifact: z.ZodObject<{
@@ -3226,6 +4055,7 @@ export declare const UploadArtifactResponseSchema: z.ZodObject<{
3226
4055
  name: z.ZodString;
3227
4056
  contentType: z.ZodString;
3228
4057
  sessionId: z.ZodOptional<z.ZodString>;
4058
+ environmentId: z.ZodOptional<z.ZodString>;
3229
4059
  latestVersion: z.ZodNumber;
3230
4060
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3231
4061
  createdAt: z.ZodString;
@@ -3238,6 +4068,7 @@ export declare const UploadArtifactResponseSchema: z.ZodObject<{
3238
4068
  source: z.ZodEnum<{
3239
4069
  engine: "engine";
3240
4070
  export: "export";
4071
+ snapshot: "snapshot";
3241
4072
  upload: "upload";
3242
4073
  }>;
3243
4074
  createdAt: z.ZodString;
@@ -3251,6 +4082,7 @@ export declare const UploadArtifactResponseSchema: z.ZodObject<{
3251
4082
  source: z.ZodEnum<{
3252
4083
  engine: "engine";
3253
4084
  export: "export";
4085
+ snapshot: "snapshot";
3254
4086
  upload: "upload";
3255
4087
  }>;
3256
4088
  createdAt: z.ZodString;
@@ -3292,18 +4124,35 @@ export type ArtifactLink = z.infer<typeof ArtifactLinkSchema>;
3292
4124
  export declare const FOLDER_CONTENT_TYPE = "application/vnd.nylorun.folder+json";
3293
4125
  /** The manifest format a folder version is stored as. */
3294
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";
3295
4132
  /** The folder artifact a session's turn-end export writes, one per session. */
3296
4133
  export declare const OUTPUTS_ARTIFACT_NAME = "outputs";
3297
4134
  /** The most files one turn-end export stores; past it the export is skipped. */
3298
4135
  export declare const EXPORT_MAX_FILES = 10000;
3299
4136
  /** The most bytes one turn-end export stores (before dedupe); past it the export is skipped. */
3300
4137
  export declare const EXPORT_MAX_BYTES: number;
3301
- /** 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
+ */
3302
4144
  export declare const FolderEntrySchema: z.ZodObject<{
3303
4145
  path: z.ZodString;
3304
4146
  size: z.ZodNumber;
3305
4147
  sha256: z.ZodString;
3306
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>;
3307
4156
  }, z.core.$strict>;
3308
4157
  export type FolderEntry = z.infer<typeof FolderEntrySchema>;
3309
4158
  /**
@@ -3311,12 +4160,22 @@ export type FolderEntry = z.infer<typeof FolderEntrySchema>;
3311
4160
  * bytes by SHA-256. The one manifest format for folders, reused by P5's snapshots.
3312
4161
  */
3313
4162
  export declare const FolderManifestSchema: z.ZodObject<{
3314
- 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
+ }>;
3315
4167
  entries: z.ZodArray<z.ZodObject<{
3316
4168
  path: z.ZodString;
3317
4169
  size: z.ZodNumber;
3318
4170
  sha256: z.ZodString;
3319
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>;
3320
4179
  }, z.core.$strict>>;
3321
4180
  }, z.core.$strict>;
3322
4181
  export type FolderManifest = z.infer<typeof FolderManifestSchema>;
@@ -3329,6 +4188,13 @@ export declare const ArtifactTreeSchema: z.ZodObject<{
3329
4188
  size: z.ZodNumber;
3330
4189
  sha256: z.ZodString;
3331
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>;
3332
4198
  }, z.core.$strict>>;
3333
4199
  }, z.core.$strict>;
3334
4200
  export type ArtifactTree = z.infer<typeof ArtifactTreeSchema>;
@@ -3342,12 +4208,26 @@ export declare const ArtifactDiffSchema: z.ZodObject<{
3342
4208
  size: z.ZodNumber;
3343
4209
  sha256: z.ZodString;
3344
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>;
3345
4218
  }, z.core.$strict>>;
3346
4219
  removed: z.ZodArray<z.ZodObject<{
3347
4220
  path: z.ZodString;
3348
4221
  size: z.ZodNumber;
3349
4222
  sha256: z.ZodString;
3350
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>;
3351
4231
  }, z.core.$strict>>;
3352
4232
  changed: z.ZodArray<z.ZodObject<{
3353
4233
  path: z.ZodString;
@@ -3356,12 +4236,26 @@ export declare const ArtifactDiffSchema: z.ZodObject<{
3356
4236
  size: z.ZodNumber;
3357
4237
  sha256: z.ZodString;
3358
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>;
3359
4246
  }, z.core.$strict>;
3360
4247
  to: z.ZodObject<{
3361
4248
  path: z.ZodString;
3362
4249
  size: z.ZodNumber;
3363
4250
  sha256: z.ZodString;
3364
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>;
3365
4259
  }, z.core.$strict>;
3366
4260
  }, z.core.$strict>>;
3367
4261
  }, z.core.$strict>;
@@ -3409,7 +4303,7 @@ export declare const SessionListItemSchema: z.ZodObject<{
3409
4303
  }>;
3410
4304
  activeTurnId: z.ZodNullable<z.ZodString>;
3411
4305
  lastTurnId: z.ZodNullable<z.ZodString>;
3412
- sandboxId: z.ZodNullable<z.ZodString>;
4306
+ environmentId: z.ZodNullable<z.ZodString>;
3413
4307
  createdAt: z.ZodNullable<z.ZodString>;
3414
4308
  lastEventAt: z.ZodNullable<z.ZodString>;
3415
4309
  }, z.core.$strict>;
@@ -3432,7 +4326,7 @@ export declare const SessionPageSchema: z.ZodObject<{
3432
4326
  }>;
3433
4327
  activeTurnId: z.ZodNullable<z.ZodString>;
3434
4328
  lastTurnId: z.ZodNullable<z.ZodString>;
3435
- sandboxId: z.ZodNullable<z.ZodString>;
4329
+ environmentId: z.ZodNullable<z.ZodString>;
3436
4330
  createdAt: z.ZodNullable<z.ZodString>;
3437
4331
  lastEventAt: z.ZodNullable<z.ZodString>;
3438
4332
  }, z.core.$strict>>;
@@ -3448,7 +4342,7 @@ export declare const SessionManifestViewSchema: z.ZodObject<{
3448
4342
  }, z.core.$strict>;
3449
4343
  export type SessionManifestView = z.infer<typeof SessionManifestViewSchema>;
3450
4344
  export declare const HistoryPageSchema: z.ZodObject<{
3451
- 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">>;
3452
4346
  cursor: z.ZodNullable<z.ZodString>;
3453
4347
  tail: z.ZodBoolean;
3454
4348
  }, z.core.$strip>;
@@ -3473,6 +4367,7 @@ export declare const SessionUsageTotalsSchema: z.ZodObject<{
3473
4367
  export type SessionUsageTotals = z.infer<typeof SessionUsageTotalsSchema>;
3474
4368
  export declare const ModelCallSchema: z.ZodObject<{
3475
4369
  id: z.ZodString;
4370
+ effectId: z.ZodString;
3476
4371
  sessionId: z.ZodString;
3477
4372
  turnId: z.ZodString;
3478
4373
  agentId: z.ZodString;
@@ -3500,6 +4395,7 @@ export type ModelCall = z.infer<typeof ModelCallSchema>;
3500
4395
  export declare const ModelCallsPageSchema: z.ZodObject<{
3501
4396
  calls: z.ZodArray<z.ZodObject<{
3502
4397
  id: z.ZodString;
4398
+ effectId: z.ZodString;
3503
4399
  sessionId: z.ZodString;
3504
4400
  turnId: z.ZodString;
3505
4401
  agentId: z.ZodString;
@@ -3530,6 +4426,7 @@ export type ModelCallsPage = z.infer<typeof ModelCallsPageSchema>;
3530
4426
  export declare const ModelCallExportPageSchema: z.ZodObject<{
3531
4427
  calls: z.ZodArray<z.ZodObject<{
3532
4428
  id: z.ZodString;
4429
+ effectId: z.ZodString;
3533
4430
  sessionId: z.ZodString;
3534
4431
  turnId: z.ZodString;
3535
4432
  agentId: z.ZodString;
@@ -3558,21 +4455,183 @@ export declare const ModelCallExportPageSchema: z.ZodObject<{
3558
4455
  asOf: z.ZodString;
3559
4456
  }, z.core.$strict>;
3560
4457
  export type ModelCallExportPage = z.infer<typeof ModelCallExportPageSchema>;
3561
- export declare const SandboxPageSchema: z.ZodObject<{
3562
- 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<{
3563
4598
  id: z.ZodString;
3564
4599
  kind: z.ZodEnum<{
4600
+ none: "none";
3565
4601
  pod: "pod";
3566
4602
  virtual: "virtual";
3567
4603
  }>;
3568
4604
  labels: z.ZodRecord<z.ZodString, z.ZodString>;
3569
- spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3570
- state: z.ZodEnum<{
3571
- creating: "creating";
3572
- ready: "ready";
3573
- running: "running";
3574
- stopped: "stopped";
3575
- }>;
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;
3576
4635
  pod: z.ZodOptional<z.ZodObject<{
3577
4636
  desired: z.ZodEnum<{
3578
4637
  deleted: "deleted";
@@ -3582,7 +4641,6 @@ export declare const SandboxPageSchema: z.ZodObject<{
3582
4641
  observed: z.ZodEnum<{
3583
4642
  creating: "creating";
3584
4643
  deleting: "deleting";
3585
- expired: "expired";
3586
4644
  failed: "failed";
3587
4645
  lost: "lost";
3588
4646
  running: "running";
@@ -3590,9 +4648,21 @@ export declare const SandboxPageSchema: z.ZodObject<{
3590
4648
  }>;
3591
4649
  volumeGeneration: z.ZodNumber;
3592
4650
  hostEpoch: z.ZodNumber;
3593
- expiresAt: z.ZodOptional<z.ZodString>;
3594
4651
  reason: z.ZodOptional<z.ZodString>;
3595
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>>;
3596
4666
  sessions: z.ZodArray<z.ZodObject<{
3597
4667
  id: z.ZodString;
3598
4668
  activeTurnId: z.ZodNullable<z.ZodString>;
@@ -3602,4 +4672,4 @@ export declare const SandboxPageSchema: z.ZodObject<{
3602
4672
  }, z.core.$strict>>;
3603
4673
  nextCursor: z.ZodNullable<z.ZodString>;
3604
4674
  }, z.core.$strict>;
3605
- export type SandboxPage = z.infer<typeof SandboxPageSchema>;
4675
+ export type EnvironmentPage = z.infer<typeof EnvironmentPageSchema>;