@nylorun/core 0.8.0-beta → 0.10.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 (41) hide show
  1. package/CHANGELOG.md +258 -0
  2. package/dist/compatibility.d.ts +58 -6
  3. package/dist/compatibility.js +82 -9
  4. package/dist/contracts.d.ts +2335 -377
  5. package/dist/contracts.js +1225 -173
  6. package/dist/define.d.ts +5 -5
  7. package/dist/define.js +3 -2
  8. package/dist/definition/assemble.js +15 -20
  9. package/dist/definition/bind-tool.js +1 -0
  10. package/dist/definition/bound.d.ts +2 -0
  11. package/dist/definition/builder.d.ts +4 -10
  12. package/dist/definition/builder.js +2 -26
  13. package/dist/definition/declaration.js +6 -2
  14. package/dist/definition/flow/compile.d.ts +0 -2
  15. package/dist/definition/flow/compile.js +1 -29
  16. package/dist/definition/flow/types.d.ts +1 -3
  17. package/dist/definition/model-failure.d.ts +4 -0
  18. package/dist/definition/model-failure.js +23 -0
  19. package/dist/definition/sandbox-capability.d.ts +12 -0
  20. package/dist/definition/sandbox-capability.js +33 -0
  21. package/dist/definition/schema.js +3 -0
  22. package/dist/definition/workflow/build.d.ts +3 -13
  23. package/dist/definition/workflow/build.js +3 -25
  24. package/dist/definition/workflow/chain.js +0 -1
  25. package/dist/definition/workflow/loop.js +0 -2
  26. package/dist/definition/workflow/map.js +0 -1
  27. package/dist/definition/workflow/parallel.js +0 -1
  28. package/dist/definition/workflow/runnable.d.ts +0 -4
  29. package/dist/definition/workflow/runnable.js +0 -34
  30. package/dist/definition/workflow/switch.js +0 -2
  31. package/dist/errors.d.ts +3 -1
  32. package/dist/types/middleware.d.ts +1 -3
  33. package/dist/types/model.d.ts +34 -1
  34. package/dist/types/observe.d.ts +7 -1
  35. package/dist/types/tool.d.ts +6 -0
  36. package/dist/types/transcript.d.ts +14 -1
  37. package/dist/utils/sandbox.d.ts +0 -4
  38. package/dist/utils/sandbox.js +0 -16
  39. package/package.json +1 -1
  40. package/dist/definition/sandbox.d.ts +0 -29
  41. package/dist/definition/sandbox.js +0 -93
@@ -27,6 +27,38 @@ export declare const CredentialSelectionSchema: z.ZodObject<{
27
27
  credentialId: z.ZodString;
28
28
  }, z.core.$strict>;
29
29
  export type CredentialSelection = z.infer<typeof CredentialSelectionSchema>;
30
+ /**
31
+ * A sandbox defined when a session is opened. No `network.allow` means no egress. The Runtime
32
+ * checks it against the Tenant's limits and pins the result on the session.
33
+ */
34
+ export declare const SandboxInlineRequestSchema: z.ZodObject<{
35
+ image: z.ZodOptional<z.ZodString>;
36
+ network: z.ZodOptional<z.ZodObject<{
37
+ allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
38
+ }, z.core.$strict>>;
39
+ resources: z.ZodOptional<z.ZodObject<{
40
+ cpus: z.ZodOptional<z.ZodNumber>;
41
+ memory: z.ZodOptional<z.ZodString>;
42
+ }, z.core.$strict>>;
43
+ }, z.core.$strict>;
44
+ export type SandboxInlineRequest = z.infer<typeof SandboxInlineRequestSchema>;
45
+ /**
46
+ * `PutSessionRequest.sandbox`: `false` for none, `{ session }` to share another session's
47
+ * sandbox, or an inline sandbox. Omitted means the Tenant's default.
48
+ */
49
+ export declare const SandboxRequestSchema: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
50
+ session: z.ZodString;
51
+ }, z.core.$strict>, z.ZodObject<{
52
+ image: z.ZodOptional<z.ZodString>;
53
+ network: z.ZodOptional<z.ZodObject<{
54
+ allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
55
+ }, z.core.$strict>>;
56
+ resources: z.ZodOptional<z.ZodObject<{
57
+ cpus: z.ZodOptional<z.ZodNumber>;
58
+ memory: z.ZodOptional<z.ZodString>;
59
+ }, z.core.$strict>>;
60
+ }, z.core.$strict>]>;
61
+ export type SandboxRequest = z.infer<typeof SandboxRequestSchema>;
30
62
  export declare const PutSessionRequestSchema: z.ZodObject<{
31
63
  requestId: z.ZodString;
32
64
  agentId: z.ZodString;
@@ -37,10 +69,75 @@ export declare const PutSessionRequestSchema: z.ZodObject<{
37
69
  serverName: z.ZodString;
38
70
  credentialId: z.ZodString;
39
71
  }, z.core.$strict>>>;
40
- sandbox: z.ZodOptional<z.ZodObject<{
72
+ sandbox: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
41
73
  session: z.ZodString;
74
+ }, z.core.$strict>, z.ZodObject<{
75
+ image: z.ZodOptional<z.ZodString>;
76
+ network: z.ZodOptional<z.ZodObject<{
77
+ allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
78
+ }, z.core.$strict>>;
79
+ resources: z.ZodOptional<z.ZodObject<{
80
+ cpus: z.ZodOptional<z.ZodNumber>;
81
+ memory: z.ZodOptional<z.ZodString>;
82
+ }, z.core.$strict>>;
83
+ }, z.core.$strict>]>>;
84
+ }, z.core.$strict>;
85
+ /**
86
+ * A Tenant's sandbox configuration (Tenant setting `sandbox.config`): what a session gets when
87
+ * it names no sandbox, and the limits every session's sandbox must fit.
88
+ */
89
+ export declare const TenantSandboxConfigSchema: z.ZodObject<{
90
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"virtual">, z.ZodObject<{
91
+ image: z.ZodOptional<z.ZodString>;
92
+ network: z.ZodOptional<z.ZodObject<{
93
+ allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
94
+ }, z.core.$strict>>;
95
+ resources: z.ZodOptional<z.ZodObject<{
96
+ cpus: z.ZodOptional<z.ZodNumber>;
97
+ memory: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strict>>;
99
+ }, z.core.$strict>]>>;
100
+ limits: z.ZodOptional<z.ZodObject<{
101
+ network: z.ZodOptional<z.ZodArray<z.ZodString>>;
102
+ resources: z.ZodOptional<z.ZodObject<{
103
+ cpus: z.ZodOptional<z.ZodNumber>;
104
+ memory: z.ZodOptional<z.ZodString>;
105
+ }, z.core.$strict>>;
106
+ defaultResources: z.ZodOptional<z.ZodObject<{
107
+ cpus: z.ZodOptional<z.ZodNumber>;
108
+ memory: z.ZodOptional<z.ZodString>;
109
+ }, z.core.$strict>>;
110
+ idle: z.ZodOptional<z.ZodString>;
111
+ }, z.core.$strict>>;
112
+ }, z.core.$strict>;
113
+ export type TenantSandboxConfig = z.infer<typeof TenantSandboxConfigSchema>;
114
+ /** `PUT /v1/tenant/sandbox`: replaces the Tenant's sandbox configuration. */
115
+ export declare const PutTenantSandboxRequestSchema: z.ZodObject<{
116
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"virtual">, z.ZodObject<{
117
+ image: z.ZodOptional<z.ZodString>;
118
+ network: z.ZodOptional<z.ZodObject<{
119
+ allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
120
+ }, z.core.$strict>>;
121
+ resources: z.ZodOptional<z.ZodObject<{
122
+ cpus: z.ZodOptional<z.ZodNumber>;
123
+ memory: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$strict>>;
125
+ }, z.core.$strict>]>>;
126
+ limits: z.ZodOptional<z.ZodObject<{
127
+ network: z.ZodOptional<z.ZodArray<z.ZodString>>;
128
+ resources: z.ZodOptional<z.ZodObject<{
129
+ cpus: z.ZodOptional<z.ZodNumber>;
130
+ memory: z.ZodOptional<z.ZodString>;
131
+ }, z.core.$strict>>;
132
+ defaultResources: z.ZodOptional<z.ZodObject<{
133
+ cpus: z.ZodOptional<z.ZodNumber>;
134
+ memory: z.ZodOptional<z.ZodString>;
135
+ }, z.core.$strict>>;
136
+ idle: z.ZodOptional<z.ZodString>;
42
137
  }, z.core.$strict>>;
138
+ requestId: z.ZodOptional<z.ZodString>;
43
139
  }, z.core.$strict>;
140
+ export type PutTenantSandboxRequest = z.infer<typeof PutTenantSandboxRequestSchema>;
44
141
  export type PutSessionRequest = z.infer<typeof PutSessionRequestSchema>;
45
142
  export declare const CreateVaultRequestSchema: z.ZodObject<{
46
143
  requestId: z.ZodString;
@@ -93,12 +190,30 @@ export declare const RotateCredentialRequestSchema: z.ZodObject<{
93
190
  }, z.core.$strict>], "type">;
94
191
  }, z.core.$strict>;
95
192
  export type RotateCredentialRequest = z.infer<typeof RotateCredentialRequestSchema>;
193
+ /**
194
+ * What the Runtime cannot learn from a custom OpenAI-compatible endpoint (Model Calls §7):
195
+ * its context window and output limit, whether it reasons, and pi-ai `compat` settings
196
+ * (`thinkingFormat`, `thinkingTokenBudgetField`, `chatTemplateKwargs`, …).
197
+ */
198
+ export declare const CustomModelSettingsSchema: z.ZodObject<{
199
+ contextWindow: z.ZodOptional<z.ZodNumber>;
200
+ maxTokens: z.ZodOptional<z.ZodNumber>;
201
+ reasoning: z.ZodOptional<z.ZodBoolean>;
202
+ compat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
203
+ }, z.core.$strict>;
204
+ export type CustomModelSettings = z.infer<typeof CustomModelSettingsSchema>;
96
205
  export declare const PutHostModelRequestSchema: z.ZodObject<{
97
206
  requestId: z.ZodString;
98
207
  idempotencyKey: z.ZodString;
99
208
  provider: z.ZodString;
100
209
  model: z.ZodString;
101
210
  baseUrl: z.ZodOptional<z.ZodString>;
211
+ settings: z.ZodOptional<z.ZodObject<{
212
+ contextWindow: z.ZodOptional<z.ZodNumber>;
213
+ maxTokens: z.ZodOptional<z.ZodNumber>;
214
+ reasoning: z.ZodOptional<z.ZodBoolean>;
215
+ compat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
216
+ }, z.core.$strict>>;
102
217
  auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
103
218
  type: z.ZodLiteral<"api_key">;
104
219
  key: z.ZodString;
@@ -119,6 +234,7 @@ export type HostModelView = {
119
234
  readonly model: string;
120
235
  readonly authType: "api_key" | "oauth";
121
236
  readonly baseUrl?: string;
237
+ readonly settings?: CustomModelSettings;
122
238
  };
123
239
  export declare const SelectHostModelRequestSchema: z.ZodObject<{
124
240
  requestId: z.ZodString;
@@ -128,34 +244,31 @@ export declare const SelectHostModelRequestSchema: z.ZodObject<{
128
244
  baseUrl: z.ZodOptional<z.ZodString>;
129
245
  }, z.core.$strict>;
130
246
  export type SelectHostModelRequest = z.infer<typeof SelectHostModelRequestSchema>;
131
- export type HostModelProviderInfo = {
132
- readonly id: string;
133
- readonly name: string;
134
- readonly model: string;
135
- readonly authType: "api_key" | "oauth";
136
- readonly baseUrl?: string;
137
- readonly lastUpdated: string;
138
- readonly active: boolean;
139
- };
140
- export interface VaultInfo {
141
- readonly id: string;
142
- readonly name: string;
143
- readonly ownerUserId: string;
144
- readonly metadata?: Readonly<Record<string, string>>;
145
- readonly createdAt: string;
146
- }
147
- export interface CredentialInfo {
148
- readonly id: string;
149
- readonly vaultId: string;
150
- readonly name: string;
151
- readonly type: "bearer" | "oauth";
152
- readonly binding: {
153
- readonly url: string;
154
- };
155
- readonly expiresAt?: string;
156
- readonly createdAt: string;
157
- readonly rotatedAt?: string;
158
- }
247
+ export type HostModelProviderInfo = z.infer<typeof HostModelProviderInfoSchema>;
248
+ export declare const VaultInfoSchema: z.ZodObject<{
249
+ id: z.ZodString;
250
+ name: z.ZodString;
251
+ ownerUserId: z.ZodString;
252
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
253
+ createdAt: z.ZodString;
254
+ }, z.core.$strict>;
255
+ export type VaultInfo = z.infer<typeof VaultInfoSchema>;
256
+ export declare const CredentialInfoSchema: z.ZodObject<{
257
+ id: z.ZodString;
258
+ vaultId: z.ZodString;
259
+ name: z.ZodString;
260
+ type: z.ZodEnum<{
261
+ bearer: "bearer";
262
+ oauth: "oauth";
263
+ }>;
264
+ binding: z.ZodObject<{
265
+ url: z.ZodString;
266
+ }, z.core.$strict>;
267
+ expiresAt: z.ZodOptional<z.ZodString>;
268
+ createdAt: z.ZodString;
269
+ rotatedAt: z.ZodOptional<z.ZodString>;
270
+ }, z.core.$strict>;
271
+ export type CredentialInfo = z.infer<typeof CredentialInfoSchema>;
159
272
  /** Exactly one of `content` or `data`. Optional `manifest` for per-turn agent patches. */
160
273
  export declare const MessageEventBodySchema: z.ZodUnion<readonly [z.ZodObject<{
161
274
  requestId: z.ZodString;
@@ -175,18 +288,6 @@ export declare const ActionOutcomeSchema: z.ZodObject<{
175
288
  statePatch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
176
289
  }, z.core.$strict>;
177
290
  export type ActionOutcome = z.infer<typeof ActionOutcomeSchema>;
178
- export declare const ActionResultCommandSchema: z.ZodObject<{
179
- requestId: z.ZodString;
180
- idempotencyKey: z.ZodString;
181
- type: z.ZodLiteral<"action_result">;
182
- actionId: z.ZodString;
183
- claimId: z.ZodString;
184
- generation: z.ZodNumber;
185
- outcome: z.ZodObject<{
186
- value: z.ZodUnknown;
187
- statePatch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
188
- }, z.core.$strict>;
189
- }, z.core.$strict>;
190
291
  export declare const SessionCommandSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
191
292
  requestId: z.ZodString;
192
293
  idempotencyKey: z.ZodString;
@@ -216,17 +317,6 @@ export declare const SessionCommandSchema: z.ZodUnion<readonly [z.ZodUnion<reado
216
317
  idempotencyKey: z.ZodString;
217
318
  type: z.ZodLiteral<"cancel">;
218
319
  reason: z.ZodOptional<z.ZodString>;
219
- }, z.core.$strict>, z.ZodObject<{
220
- requestId: z.ZodString;
221
- idempotencyKey: z.ZodString;
222
- type: z.ZodLiteral<"action_result">;
223
- actionId: z.ZodString;
224
- claimId: z.ZodString;
225
- generation: z.ZodNumber;
226
- outcome: z.ZodObject<{
227
- value: z.ZodUnknown;
228
- statePatch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
229
- }, z.core.$strict>;
230
320
  }, z.core.$strict>]>;
231
321
  export declare const SessionEventBodySchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
232
322
  requestId: z.ZodString;
@@ -257,46 +347,166 @@ export declare const SessionEventBodySchema: z.ZodUnion<readonly [z.ZodUnion<rea
257
347
  idempotencyKey: z.ZodString;
258
348
  type: z.ZodLiteral<"cancel">;
259
349
  reason: z.ZodOptional<z.ZodString>;
260
- }, z.core.$strict>, z.ZodObject<{
261
- requestId: z.ZodString;
262
- idempotencyKey: z.ZodString;
263
- type: z.ZodLiteral<"action_result">;
264
- actionId: z.ZodString;
265
- claimId: z.ZodString;
266
- generation: z.ZodNumber;
267
- outcome: z.ZodObject<{
268
- value: z.ZodUnknown;
269
- statePatch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
270
- }, z.core.$strict>;
271
350
  }, z.core.$strict>]>;
272
351
  export type SessionCommand = z.infer<typeof SessionCommandSchema>;
273
352
  export type SessionEventBody = SessionCommand;
274
353
  export type MessageEventBody = z.infer<typeof MessageEventBodySchema>;
275
- export declare const LiveEventSchema: z.ZodObject<{
354
+ /** The envelope every session event carries (`nylorun.event/2`, Durable Streams §9.5). */
355
+ export declare const EVENT_SCHEMA = "nylorun.event/2";
356
+ /** Who wrote an event. v1 writes `loop` (the engine) and `api` (commands and results). */
357
+ export declare const EventSourceKindSchema: z.ZodEnum<{
358
+ api: "api";
359
+ controller: "controller";
360
+ edge: "edge";
361
+ "egress-gate": "egress-gate";
362
+ evidence: "evidence";
363
+ harness: "harness";
364
+ human: "human";
365
+ init: "init";
366
+ loop: "loop";
367
+ "model-gate": "model-gate";
368
+ operator: "operator";
369
+ sandboxd: "sandboxd";
370
+ supervisor: "supervisor";
371
+ "tool-gate": "tool-gate";
372
+ }>;
373
+ export type EventSourceKind = z.infer<typeof EventSourceKindSchema>;
374
+ /** How far an event can be trusted, by who could forge it. v1 writes `observed` only. */
375
+ export declare const EvidenceClassSchema: z.ZodEnum<{
376
+ asserted: "asserted";
377
+ attested: "attested";
378
+ claimed: "claimed";
379
+ measured: "measured";
380
+ observed: "observed";
381
+ }>;
382
+ export type EvidenceClass = z.infer<typeof EvidenceClassSchema>;
383
+ /**
384
+ * The envelope fields. Not strict: a client strips fields it does not know, so the envelope
385
+ * can grow without a protocol bump.
386
+ */
387
+ declare const eventEnvelope: {
388
+ schema: z.ZodLiteral<"nylorun.event/2">;
276
389
  eventId: z.ZodString;
390
+ tenantId: z.ZodString;
277
391
  sessionId: z.ZodString;
392
+ /** The run the event belongs to; null until runs exist. */
393
+ runId: z.ZodNullable<z.ZodString>;
394
+ turnId: z.ZodNullable<z.ZodString>;
395
+ /** The session's restore incarnation; 0 until restores exist. */
396
+ incarnation: z.ZodNumber;
397
+ /** The session's ownership epoch when the event was written. */
398
+ epoch: z.ZodNumber;
399
+ /** Position in the session's log, from 0, in commit order. */
400
+ seq: z.ZodNumber;
401
+ /** `base64url(sessionId:seq)`: resume from here with `Last-Event-ID` or `?cursor=`. */
402
+ cursor: z.ZodString;
403
+ /** When the event was written (ISO 8601). */
404
+ time: z.ZodString;
405
+ /** The version of the event type's payload schema. */
406
+ schemaVersion: z.ZodNumber;
407
+ source: z.ZodObject<{
408
+ kind: z.ZodEnum<{
409
+ api: "api";
410
+ controller: "controller";
411
+ edge: "edge";
412
+ "egress-gate": "egress-gate";
413
+ evidence: "evidence";
414
+ harness: "harness";
415
+ human: "human";
416
+ init: "init";
417
+ loop: "loop";
418
+ "model-gate": "model-gate";
419
+ operator: "operator";
420
+ sandboxd: "sandboxd";
421
+ supervisor: "supervisor";
422
+ "tool-gate": "tool-gate";
423
+ }>;
424
+ id: z.ZodString;
425
+ }, z.core.$strip>;
426
+ evidence: z.ZodEnum<{
427
+ asserted: "asserted";
428
+ attested: "attested";
429
+ claimed: "claimed";
430
+ measured: "measured";
431
+ observed: "observed";
432
+ }>;
433
+ trace: z.ZodOptional<z.ZodObject<{
434
+ traceId: z.ZodString;
435
+ spanId: z.ZodString;
436
+ parentSpanId: z.ZodOptional<z.ZodString>;
437
+ }, z.core.$strip>>;
438
+ visibility: z.ZodEnum<{
439
+ internal: "internal";
440
+ public: "public";
441
+ restricted: "restricted";
442
+ }>;
443
+ retention: z.ZodEnum<{
444
+ full: "full";
445
+ metadata: "metadata";
446
+ }>;
447
+ };
448
+ /**
449
+ * Any session event: the envelope with an open `type` and `payload`. Clients read an event of
450
+ * a type they do not know as this; `SessionEventSchema` types the known ones.
451
+ */
452
+ export declare const LiveEventSchema: z.ZodObject<{
453
+ schema: z.ZodLiteral<"nylorun.event/2">;
454
+ eventId: z.ZodString;
278
455
  tenantId: z.ZodString;
456
+ sessionId: z.ZodString;
457
+ runId: z.ZodNullable<z.ZodString>;
279
458
  turnId: z.ZodNullable<z.ZodString>;
459
+ incarnation: z.ZodNumber;
460
+ epoch: z.ZodNumber;
461
+ seq: z.ZodNumber;
280
462
  cursor: z.ZodString;
281
- createdAt: z.ZodString;
463
+ time: z.ZodString;
464
+ schemaVersion: z.ZodNumber;
465
+ source: z.ZodObject<{
466
+ kind: z.ZodEnum<{
467
+ api: "api";
468
+ controller: "controller";
469
+ edge: "edge";
470
+ "egress-gate": "egress-gate";
471
+ evidence: "evidence";
472
+ harness: "harness";
473
+ human: "human";
474
+ init: "init";
475
+ loop: "loop";
476
+ "model-gate": "model-gate";
477
+ operator: "operator";
478
+ sandboxd: "sandboxd";
479
+ supervisor: "supervisor";
480
+ "tool-gate": "tool-gate";
481
+ }>;
482
+ id: z.ZodString;
483
+ }, z.core.$strip>;
484
+ evidence: z.ZodEnum<{
485
+ asserted: "asserted";
486
+ attested: "attested";
487
+ claimed: "claimed";
488
+ measured: "measured";
489
+ observed: "observed";
490
+ }>;
491
+ trace: z.ZodOptional<z.ZodObject<{
492
+ traceId: z.ZodString;
493
+ spanId: z.ZodString;
494
+ parentSpanId: z.ZodOptional<z.ZodString>;
495
+ }, z.core.$strip>>;
496
+ visibility: z.ZodEnum<{
497
+ internal: "internal";
498
+ public: "public";
499
+ restricted: "restricted";
500
+ }>;
501
+ retention: z.ZodEnum<{
502
+ full: "full";
503
+ metadata: "metadata";
504
+ }>;
282
505
  type: z.ZodString;
283
506
  payload: z.ZodUnknown;
284
- }, z.core.$strict>;
285
- export type LiveEvent = z.infer<typeof LiveEventSchema>;
286
- export declare const SessionItemsResponseSchema: z.ZodObject<{
287
- items: z.ZodArray<z.ZodObject<{
288
- eventId: z.ZodString;
289
- sessionId: z.ZodString;
290
- tenantId: z.ZodString;
291
- turnId: z.ZodNullable<z.ZodString>;
292
- cursor: z.ZodString;
293
- createdAt: z.ZodString;
294
- type: z.ZodString;
295
- payload: z.ZodUnknown;
296
- }, z.core.$strict>>;
297
- cursor: z.ZodNullable<z.ZodString>;
298
507
  }, z.core.$strip>;
299
- export type SessionItemsResponse = z.infer<typeof SessionItemsResponseSchema>;
508
+ /** Any session event (`SessionEvent` when its type is known). */
509
+ export type LiveEvent = z.infer<typeof LiveEventSchema>;
300
510
  export declare const AcceptedResponseSchema: z.ZodObject<{
301
511
  status: z.ZodLiteral<"accepted">;
302
512
  turnId: z.ZodNullable<z.ZodString>;
@@ -307,16 +517,20 @@ export type AcceptedResponse = z.infer<typeof AcceptedResponseSchema>;
307
517
  export declare const RejectedResponseSchema: z.ZodObject<{
308
518
  status: z.ZodLiteral<"rejected">;
309
519
  code: z.ZodEnum<{
310
- active_work: "active_work";
311
520
  connection_missing: "connection_missing";
312
521
  host_rejected: "host_rejected";
313
522
  incompatible_host: "incompatible_host";
523
+ internal_error: "internal_error";
524
+ invalid_request: "invalid_request";
525
+ limit_exceeded: "limit_exceeded";
314
526
  not_found: "not_found";
315
527
  origin_rejected: "origin_rejected";
316
528
  protocol_unsupported: "protocol_unsupported";
529
+ request_rejected: "request_rejected";
317
530
  scope_required: "scope_required";
318
531
  subject_invalid: "subject_invalid";
319
- tenant_conflict: "tenant_conflict";
532
+ subject_required: "subject_required";
533
+ token_expired: "token_expired";
320
534
  unsupported_media_type: "unsupported_media_type";
321
535
  }>;
322
536
  message: z.ZodString;
@@ -355,14 +569,13 @@ export declare const ActionSchema: z.ZodUnion<readonly [z.ZodObject<{
355
569
  context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
356
570
  status: z.ZodEnum<{
357
571
  cancelled: "cancelled";
358
- claimed: "claimed";
359
572
  completed: "completed";
573
+ delivering: "delivering";
360
574
  pending: "pending";
361
575
  uncertain: "uncertain";
362
576
  }>;
363
577
  generation: z.ZodNumber;
364
- claimId: z.ZodNullable<z.ZodString>;
365
- leaseExpiresAt: z.ZodNullable<z.ZodString>;
578
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
366
579
  agent: z.ZodOptional<z.ZodObject<{
367
580
  id: z.ZodString;
368
581
  path: z.ZodString;
@@ -384,14 +597,13 @@ export declare const ActionSchema: z.ZodUnion<readonly [z.ZodObject<{
384
597
  context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
385
598
  status: z.ZodEnum<{
386
599
  cancelled: "cancelled";
387
- claimed: "claimed";
388
600
  completed: "completed";
601
+ delivering: "delivering";
389
602
  pending: "pending";
390
603
  uncertain: "uncertain";
391
604
  }>;
392
605
  generation: z.ZodNumber;
393
- claimId: z.ZodNullable<z.ZodString>;
394
- leaseExpiresAt: z.ZodNullable<z.ZodString>;
606
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
395
607
  agent: z.ZodOptional<z.ZodObject<{
396
608
  id: z.ZodString;
397
609
  path: z.ZodString;
@@ -413,14 +625,13 @@ export declare const ActionSchema: z.ZodUnion<readonly [z.ZodObject<{
413
625
  context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
414
626
  status: z.ZodEnum<{
415
627
  cancelled: "cancelled";
416
- claimed: "claimed";
417
628
  completed: "completed";
629
+ delivering: "delivering";
418
630
  pending: "pending";
419
631
  uncertain: "uncertain";
420
632
  }>;
421
633
  generation: z.ZodNumber;
422
- claimId: z.ZodNullable<z.ZodString>;
423
- leaseExpiresAt: z.ZodNullable<z.ZodString>;
634
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
424
635
  agent: z.ZodOptional<z.ZodObject<{
425
636
  id: z.ZodString;
426
637
  path: z.ZodString;
@@ -449,14 +660,13 @@ export declare const ActionSchema: z.ZodUnion<readonly [z.ZodObject<{
449
660
  context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
450
661
  status: z.ZodEnum<{
451
662
  cancelled: "cancelled";
452
- claimed: "claimed";
453
663
  completed: "completed";
664
+ delivering: "delivering";
454
665
  pending: "pending";
455
666
  uncertain: "uncertain";
456
667
  }>;
457
668
  generation: z.ZodNumber;
458
- claimId: z.ZodNullable<z.ZodString>;
459
- leaseExpiresAt: z.ZodNullable<z.ZodString>;
669
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
460
670
  agent: z.ZodOptional<z.ZodObject<{
461
671
  id: z.ZodString;
462
672
  path: z.ZodString;
@@ -476,14 +686,13 @@ export declare const ActionSchema: z.ZodUnion<readonly [z.ZodObject<{
476
686
  context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
477
687
  status: z.ZodEnum<{
478
688
  cancelled: "cancelled";
479
- claimed: "claimed";
480
689
  completed: "completed";
690
+ delivering: "delivering";
481
691
  pending: "pending";
482
692
  uncertain: "uncertain";
483
693
  }>;
484
694
  generation: z.ZodNumber;
485
- claimId: z.ZodNullable<z.ZodString>;
486
- leaseExpiresAt: z.ZodNullable<z.ZodString>;
695
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
487
696
  agent: z.ZodOptional<z.ZodObject<{
488
697
  id: z.ZodString;
489
698
  path: z.ZodString;
@@ -494,7 +703,10 @@ export declare const ActionSchema: z.ZodUnion<readonly [z.ZodObject<{
494
703
  key: z.ZodString;
495
704
  }, z.core.$strict>]>;
496
705
  export type Action = z.infer<typeof ActionSchema>;
497
- /** `message.assistant`: one completed model step. `invocationId` is the model call's. */
706
+ /**
707
+ * `message.assistant`: one completed model step. `invocationId` is the model call's.
708
+ * `model`, `finishReason` and `usage` are present when the provider reported them.
709
+ */
498
710
  export declare const AssistantMessagePayloadSchema: z.ZodObject<{
499
711
  agent: z.ZodOptional<z.ZodObject<{
500
712
  id: z.ZodString;
@@ -503,12 +715,51 @@ export declare const AssistantMessagePayloadSchema: z.ZodObject<{
503
715
  }, z.core.$loose>>;
504
716
  invocationId: z.ZodString;
505
717
  text: z.ZodString;
718
+ model: z.ZodOptional<z.ZodObject<{
719
+ provider: z.ZodString;
720
+ model: z.ZodString;
721
+ }, z.core.$loose>>;
722
+ finishReason: z.ZodOptional<z.ZodString>;
723
+ usage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
506
724
  toolCalls: z.ZodArray<z.ZodObject<{
507
725
  callId: z.ZodString;
508
726
  name: z.ZodString;
509
727
  input: z.ZodUnknown;
510
728
  }, z.core.$loose>>;
511
729
  }, z.core.$loose>;
730
+ /**
731
+ * `model.failed`: a model call that failed in a known way (Model Calls §6.4). The turn
732
+ * then fails with `model.<code>`, or recovers.
733
+ */
734
+ export declare const ModelFailedPayloadSchema: z.ZodObject<{
735
+ agent: z.ZodOptional<z.ZodObject<{
736
+ id: z.ZodString;
737
+ path: z.ZodString;
738
+ delegationId: z.ZodOptional<z.ZodString>;
739
+ }, z.core.$loose>>;
740
+ invocationId: z.ZodOptional<z.ZodString>;
741
+ code: z.ZodString;
742
+ message: z.ZodString;
743
+ retryable: z.ZodBoolean;
744
+ }, z.core.$loose>;
745
+ /**
746
+ * `context.compacted`: the engine summarized older history to fit the model's window
747
+ * (Model Calls §8). Token counts are estimates.
748
+ */
749
+ export declare const ContextCompactedPayloadSchema: z.ZodObject<{
750
+ agent: z.ZodOptional<z.ZodObject<{
751
+ id: z.ZodString;
752
+ path: z.ZodString;
753
+ delegationId: z.ZodOptional<z.ZodString>;
754
+ }, z.core.$loose>>;
755
+ invocationId: z.ZodOptional<z.ZodString>;
756
+ trigger: z.ZodEnum<{
757
+ overflow: "overflow";
758
+ threshold: "threshold";
759
+ }>;
760
+ tokensBefore: z.ZodNumber;
761
+ tokensAfter: z.ZodNumber;
762
+ }, z.core.$loose>;
512
763
  /** `tool.completed`: an MCP or sandbox tool the Runtime ran. `error` for a tool error. */
513
764
  export declare const ToolCompletedPayloadSchema: z.ZodObject<{
514
765
  agent: z.ZodOptional<z.ZodObject<{
@@ -535,6 +786,8 @@ export declare const ActionPendingPayloadSchema: z.ZodObject<{
535
786
  actionId: z.ZodString;
536
787
  kind: z.ZodString;
537
788
  toolName: z.ZodOptional<z.ZodString>;
789
+ path: z.ZodOptional<z.ZodString>;
790
+ key: z.ZodOptional<z.ZodString>;
538
791
  callId: z.ZodOptional<z.ZodString>;
539
792
  invocationId: z.ZodOptional<z.ZodString>;
540
793
  input: z.ZodUnknown;
@@ -548,6 +801,8 @@ export declare const ActionCompletedPayloadSchema: z.ZodObject<{
548
801
  actionId: z.ZodString;
549
802
  kind: z.ZodString;
550
803
  toolName: z.ZodOptional<z.ZodString>;
804
+ path: z.ZodOptional<z.ZodString>;
805
+ key: z.ZodOptional<z.ZodString>;
551
806
  callId: z.ZodOptional<z.ZodString>;
552
807
  invocationId: z.ZodOptional<z.ZodString>;
553
808
  result: z.ZodUnknown;
@@ -606,12 +861,43 @@ declare const TRANSCRIPT_PAYLOADS: {
606
861
  }, z.core.$loose>>;
607
862
  invocationId: z.ZodString;
608
863
  text: z.ZodString;
864
+ model: z.ZodOptional<z.ZodObject<{
865
+ provider: z.ZodString;
866
+ model: z.ZodString;
867
+ }, z.core.$loose>>;
868
+ finishReason: z.ZodOptional<z.ZodString>;
869
+ usage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
609
870
  toolCalls: z.ZodArray<z.ZodObject<{
610
871
  callId: z.ZodString;
611
872
  name: z.ZodString;
612
873
  input: z.ZodUnknown;
613
874
  }, z.core.$loose>>;
614
875
  }, z.core.$loose>;
876
+ readonly "model.failed": z.ZodObject<{
877
+ agent: z.ZodOptional<z.ZodObject<{
878
+ id: z.ZodString;
879
+ path: z.ZodString;
880
+ delegationId: z.ZodOptional<z.ZodString>;
881
+ }, z.core.$loose>>;
882
+ invocationId: z.ZodOptional<z.ZodString>;
883
+ code: z.ZodString;
884
+ message: z.ZodString;
885
+ retryable: z.ZodBoolean;
886
+ }, z.core.$loose>;
887
+ readonly "context.compacted": z.ZodObject<{
888
+ agent: z.ZodOptional<z.ZodObject<{
889
+ id: z.ZodString;
890
+ path: z.ZodString;
891
+ delegationId: z.ZodOptional<z.ZodString>;
892
+ }, z.core.$loose>>;
893
+ invocationId: z.ZodOptional<z.ZodString>;
894
+ trigger: z.ZodEnum<{
895
+ overflow: "overflow";
896
+ threshold: "threshold";
897
+ }>;
898
+ tokensBefore: z.ZodNumber;
899
+ tokensAfter: z.ZodNumber;
900
+ }, z.core.$loose>;
615
901
  readonly "tool.completed": z.ZodObject<{
616
902
  agent: z.ZodOptional<z.ZodObject<{
617
903
  id: z.ZodString;
@@ -637,6 +923,8 @@ declare const TRANSCRIPT_PAYLOADS: {
637
923
  actionId: z.ZodString;
638
924
  kind: z.ZodString;
639
925
  toolName: z.ZodOptional<z.ZodString>;
926
+ path: z.ZodOptional<z.ZodString>;
927
+ key: z.ZodOptional<z.ZodString>;
640
928
  callId: z.ZodOptional<z.ZodString>;
641
929
  invocationId: z.ZodOptional<z.ZodString>;
642
930
  input: z.ZodUnknown;
@@ -650,6 +938,8 @@ declare const TRANSCRIPT_PAYLOADS: {
650
938
  actionId: z.ZodString;
651
939
  kind: z.ZodString;
652
940
  toolName: z.ZodOptional<z.ZodString>;
941
+ path: z.ZodOptional<z.ZodString>;
942
+ key: z.ZodOptional<z.ZodString>;
653
943
  callId: z.ZodOptional<z.ZodString>;
654
944
  invocationId: z.ZodOptional<z.ZodString>;
655
945
  result: z.ZodUnknown;
@@ -708,227 +998,533 @@ declare const TRANSCRIPT_PAYLOADS: {
708
998
  };
709
999
  export type TranscriptEventType = keyof typeof TRANSCRIPT_PAYLOADS;
710
1000
  export declare const TRANSCRIPT_EVENT_TYPES: readonly TranscriptEventType[];
711
- export type TranscriptEvent = {
712
- [K in TranscriptEventType]: Omit<LiveEvent, "type" | "payload"> & {
713
- type: K;
714
- payload: z.infer<(typeof TRANSCRIPT_PAYLOADS)[K]>;
715
- };
716
- }[TranscriptEventType];
717
- /** Types a transcript event's payload; `undefined` for other types or a malformed payload. */
718
- export declare function parseTranscriptEvent(event: LiveEvent): TranscriptEvent | undefined;
719
- export declare const ActionClaimRequestSchema: z.ZodObject<{
1001
+ /** `command.message`: the message a client sent, as accepted. */
1002
+ export declare const CommandMessagePayloadSchema: z.ZodObject<{
720
1003
  requestId: z.ZodString;
721
- implementationVersion: z.ZodString;
722
- }, z.core.$strict>;
723
- export declare const ActionHeartbeatRequestSchema: z.ZodObject<{
1004
+ idempotencyKey: z.ZodString;
1005
+ type: z.ZodLiteral<"message">;
1006
+ content: z.ZodOptional<z.ZodString>;
1007
+ data: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
1008
+ manifest: z.ZodOptional<z.ZodUnknown>;
1009
+ }, z.core.$loose>;
1010
+ /** `command.approve`: an answer to an approval interaction. */
1011
+ export declare const CommandApprovePayloadSchema: z.ZodObject<{
724
1012
  requestId: z.ZodString;
725
- claimId: z.ZodString;
726
- generation: z.ZodNumber;
727
- }, z.core.$strict>;
728
- export declare const ActionClaimResponseSchema: z.ZodObject<{
729
- action: z.ZodUnion<readonly [z.ZodObject<{
730
- actionId: z.ZodString;
731
- sessionId: z.ZodString;
732
- turnId: z.ZodString;
733
- agentId: z.ZodString;
734
- manifestHash: z.ZodString;
735
- implementationVersion: z.ZodString;
736
- input: z.ZodUnknown;
737
- context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
738
- status: z.ZodEnum<{
739
- cancelled: "cancelled";
740
- claimed: "claimed";
741
- completed: "completed";
742
- pending: "pending";
743
- uncertain: "uncertain";
744
- }>;
745
- generation: z.ZodNumber;
746
- claimId: z.ZodNullable<z.ZodString>;
747
- leaseExpiresAt: z.ZodNullable<z.ZodString>;
748
- agent: z.ZodOptional<z.ZodObject<{
749
- id: z.ZodString;
750
- path: z.ZodString;
751
- delegationId: z.ZodOptional<z.ZodString>;
752
- }, z.core.$strict>>;
753
- kind: z.ZodLiteral<"tool">;
754
- capabilityId: z.ZodString;
755
- toolName: z.ZodString;
756
- inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
757
- outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
758
- }, z.core.$strict>, z.ZodObject<{
759
- actionId: z.ZodString;
760
- sessionId: z.ZodString;
761
- turnId: z.ZodString;
762
- agentId: z.ZodString;
763
- manifestHash: z.ZodString;
764
- implementationVersion: z.ZodString;
765
- input: z.ZodUnknown;
766
- context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
767
- status: z.ZodEnum<{
768
- cancelled: "cancelled";
769
- claimed: "claimed";
770
- completed: "completed";
771
- pending: "pending";
772
- uncertain: "uncertain";
773
- }>;
774
- generation: z.ZodNumber;
775
- claimId: z.ZodNullable<z.ZodString>;
776
- leaseExpiresAt: z.ZodNullable<z.ZodString>;
777
- agent: z.ZodOptional<z.ZodObject<{
778
- id: z.ZodString;
779
- path: z.ZodString;
780
- delegationId: z.ZodOptional<z.ZodString>;
781
- }, z.core.$strict>>;
782
- kind: z.ZodLiteral<"tool">;
1013
+ idempotencyKey: z.ZodString;
1014
+ type: z.ZodLiteral<"approve">;
1015
+ interactionId: z.ZodString;
1016
+ approved: z.ZodBoolean;
1017
+ }, z.core.$loose>;
1018
+ /** `command.respond`: an answer to an input interaction. */
1019
+ export declare const CommandRespondPayloadSchema: z.ZodObject<{
1020
+ requestId: z.ZodString;
1021
+ idempotencyKey: z.ZodString;
1022
+ type: z.ZodLiteral<"respond">;
1023
+ interactionId: z.ZodString;
1024
+ value: z.ZodUnknown;
1025
+ }, z.core.$loose>;
1026
+ /** `action.delivered`: the Runtime sent an Action to its endpoint. */
1027
+ export declare const ActionDeliveredPayloadSchema: z.ZodObject<{
1028
+ agent: z.ZodOptional<z.ZodObject<{
1029
+ id: z.ZodString;
783
1030
  path: z.ZodString;
784
- key: z.ZodString;
785
- inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
786
- outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
787
- }, z.core.$strict>, z.ZodObject<{
788
- actionId: z.ZodString;
789
- sessionId: z.ZodString;
790
- turnId: z.ZodString;
791
- agentId: z.ZodString;
792
- manifestHash: z.ZodString;
793
- implementationVersion: z.ZodString;
794
- input: z.ZodUnknown;
795
- context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
796
- status: z.ZodEnum<{
797
- cancelled: "cancelled";
798
- claimed: "claimed";
799
- completed: "completed";
800
- pending: "pending";
801
- uncertain: "uncertain";
802
- }>;
803
- generation: z.ZodNumber;
804
- claimId: z.ZodNullable<z.ZodString>;
805
- leaseExpiresAt: z.ZodNullable<z.ZodString>;
806
- agent: z.ZodOptional<z.ZodObject<{
807
- id: z.ZodString;
808
- path: z.ZodString;
809
- delegationId: z.ZodOptional<z.ZodString>;
810
- }, z.core.$strict>>;
811
- kind: z.ZodLiteral<"hook">;
812
- hook: z.ZodObject<{
813
- at: z.ZodEnum<{
814
- after: "after";
815
- before: "before";
1031
+ delegationId: z.ZodOptional<z.ZodString>;
1032
+ }, z.core.$loose>>;
1033
+ actionId: z.ZodString;
1034
+ generation: z.ZodNumber;
1035
+ }, z.core.$loose>;
1036
+ /** `action.delivery_failed`: a delivery did not reach its endpoint, or was refused; it is retried. */
1037
+ export declare const ActionDeliveryFailedPayloadSchema: z.ZodObject<{
1038
+ actionId: z.ZodString;
1039
+ generation: z.ZodNumber;
1040
+ reason: z.ZodString;
1041
+ message: z.ZodOptional<z.ZodString>;
1042
+ retryInMs: z.ZodNumber;
1043
+ }, z.core.$loose>;
1044
+ /** `sandbox.state`: the session's sandbox changed state. */
1045
+ export declare const SandboxStatePayloadSchema: z.ZodObject<{
1046
+ state: z.ZodEnum<{
1047
+ creating: "creating";
1048
+ running: "running";
1049
+ stopped: "stopped";
1050
+ }>;
1051
+ backend: z.ZodString;
1052
+ isolation: z.ZodOptional<z.ZodString>;
1053
+ image: z.ZodOptional<z.ZodString>;
1054
+ network: z.ZodOptional<z.ZodUnknown>;
1055
+ reattach: z.ZodOptional<z.ZodBoolean>;
1056
+ lost: z.ZodOptional<z.ZodBoolean>;
1057
+ note: z.ZodOptional<z.ZodString>;
1058
+ error: z.ZodOptional<z.ZodString>;
1059
+ }, z.core.$loose>;
1060
+ /** `sandbox.exec`: one sandbox tool call finished. */
1061
+ export declare const SandboxExecPayloadSchema: z.ZodObject<{
1062
+ tool: z.ZodString;
1063
+ command: z.ZodOptional<z.ZodString>;
1064
+ outcome: z.ZodString;
1065
+ code: z.ZodOptional<z.ZodString>;
1066
+ durationMs: z.ZodNumber;
1067
+ }, z.core.$loose>;
1068
+ /** `node.started`: a workflow node that runs an Action started. */
1069
+ export declare const NodeStartedPayloadSchema: z.ZodObject<{
1070
+ path: z.ZodString;
1071
+ kind: z.ZodString;
1072
+ key: z.ZodString;
1073
+ iterations: z.ZodOptional<z.ZodString>;
1074
+ }, z.core.$loose>;
1075
+ /** `node.agent`: a workflow node runs as a linked agent session. */
1076
+ export declare const NodeAgentPayloadSchema: z.ZodObject<{
1077
+ path: z.ZodString;
1078
+ iterations: z.ZodOptional<z.ZodString>;
1079
+ sessionId: z.ZodString;
1080
+ turnId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1081
+ }, z.core.$loose>;
1082
+ /** `loop.iteration`: a Loop started its `n`th agent turn. */
1083
+ export declare const LoopIterationPayloadSchema: z.ZodObject<{
1084
+ path: z.ZodString;
1085
+ n: z.ZodNumber;
1086
+ sessionId: z.ZodOptional<z.ZodString>;
1087
+ turnId: z.ZodOptional<z.ZodString>;
1088
+ manifestHash: z.ZodOptional<z.ZodString>;
1089
+ }, z.core.$loose>;
1090
+ /** `loop.verified`: a Loop's verifier judged iteration `n`. */
1091
+ export declare const LoopVerifiedPayloadSchema: z.ZodObject<{
1092
+ path: z.ZodString;
1093
+ n: z.ZodNumber;
1094
+ pass: z.ZodBoolean;
1095
+ feedback: z.ZodOptional<z.ZodString>;
1096
+ data: z.ZodOptional<z.ZodUnknown>;
1097
+ }, z.core.$loose>;
1098
+ /** `loop.decided`: a Loop's decide step chose to iterate again (`input`) or finish (`output`). */
1099
+ export declare const LoopDecidedPayloadSchema: z.ZodObject<{
1100
+ path: z.ZodString;
1101
+ n: z.ZodNumber;
1102
+ next: z.ZodEnum<{
1103
+ input: "input";
1104
+ output: "output";
1105
+ }>;
1106
+ patched: z.ZodBoolean;
1107
+ }, z.core.$loose>;
1108
+ /**
1109
+ * `transcript.updated` (internal; blueprint P0.3): the own loop's model-facing transcript after a
1110
+ * settled segment, as an edit of the previous one: keep its first `keep` entries, then append
1111
+ * `entries`; the result has `length` entries. `keep` is 0 for a snapshot (after compaction, or
1112
+ * for a session written before transcripts were recorded). Large edits are split into
1113
+ * consecutive events, each appending to the last. Entries are the engine's `TranscriptEntry`
1114
+ * values, checked by the Runtime when it folds them. Never served to clients.
1115
+ */
1116
+ export declare const TranscriptUpdatedPayloadSchema: z.ZodObject<{
1117
+ keep: z.ZodNumber;
1118
+ entries: z.ZodArray<z.ZodUnknown>;
1119
+ length: z.ZodNumber;
1120
+ }, z.core.$loose>;
1121
+ /**
1122
+ * The event catalog (Durable Streams §9.5): every session event type, its payload schema, its
1123
+ * payload schema version and who writes it. A type not listed here cannot be written. A type
1124
+ * with `visibility: "internal"` is recorded and folded by the Runtime but never served to
1125
+ * clients (SSE, history, AG-UI and A2A skip it).
1126
+ *
1127
+ * Evolution: new types and new optional payload fields are additive (clients ignore types
1128
+ * they do not know, and payloads pass unknown fields through). A breaking payload change is a
1129
+ * new type or a protocol version, never an edit in place.
1130
+ */
1131
+ export declare const EVENT_CATALOG: {
1132
+ readonly "command.message": {
1133
+ readonly payload: z.ZodObject<{
1134
+ requestId: z.ZodString;
1135
+ idempotencyKey: z.ZodString;
1136
+ type: z.ZodLiteral<"message">;
1137
+ content: z.ZodOptional<z.ZodString>;
1138
+ data: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
1139
+ manifest: z.ZodOptional<z.ZodUnknown>;
1140
+ }, z.core.$loose>;
1141
+ readonly source: "api";
1142
+ readonly version: 1;
1143
+ };
1144
+ readonly "command.approve": {
1145
+ readonly payload: z.ZodObject<{
1146
+ requestId: z.ZodString;
1147
+ idempotencyKey: z.ZodString;
1148
+ type: z.ZodLiteral<"approve">;
1149
+ interactionId: z.ZodString;
1150
+ approved: z.ZodBoolean;
1151
+ }, z.core.$loose>;
1152
+ readonly source: "api";
1153
+ readonly version: 1;
1154
+ };
1155
+ readonly "command.respond": {
1156
+ readonly payload: z.ZodObject<{
1157
+ requestId: z.ZodString;
1158
+ idempotencyKey: z.ZodString;
1159
+ type: z.ZodLiteral<"respond">;
1160
+ interactionId: z.ZodString;
1161
+ value: z.ZodUnknown;
1162
+ }, z.core.$loose>;
1163
+ readonly source: "api";
1164
+ readonly version: 1;
1165
+ };
1166
+ readonly "turn.completed": {
1167
+ readonly payload: z.ZodObject<{
1168
+ output: z.ZodUnknown;
1169
+ }, z.core.$loose>;
1170
+ readonly source: "loop";
1171
+ readonly version: 1;
1172
+ };
1173
+ readonly "turn.paused": {
1174
+ readonly payload: z.ZodObject<{
1175
+ interactions: z.ZodArray<z.ZodObject<{
1176
+ invocationId: z.ZodString;
1177
+ interaction: z.ZodObject<{
1178
+ id: z.ZodString;
1179
+ kind: z.ZodString;
1180
+ }, z.core.$loose>;
1181
+ status: z.ZodOptional<z.ZodString>;
1182
+ }, z.core.$loose>>;
1183
+ }, z.core.$loose>;
1184
+ readonly source: "loop";
1185
+ readonly version: 1;
1186
+ };
1187
+ readonly "turn.failed": {
1188
+ readonly payload: z.ZodObject<{
1189
+ error: z.ZodOptional<z.ZodObject<{
1190
+ code: z.ZodOptional<z.ZodString>;
1191
+ message: z.ZodOptional<z.ZodString>;
1192
+ }, z.core.$loose>>;
1193
+ message: z.ZodOptional<z.ZodString>;
1194
+ }, z.core.$loose>;
1195
+ readonly source: "loop";
1196
+ readonly version: 1;
1197
+ };
1198
+ readonly "turn.cancelled": {
1199
+ readonly payload: z.ZodObject<{
1200
+ reason: z.ZodOptional<z.ZodString>;
1201
+ }, z.core.$loose>;
1202
+ readonly source: "api";
1203
+ readonly version: 1;
1204
+ };
1205
+ readonly "message.assistant": {
1206
+ readonly payload: z.ZodObject<{
1207
+ agent: z.ZodOptional<z.ZodObject<{
1208
+ id: z.ZodString;
1209
+ path: z.ZodString;
1210
+ delegationId: z.ZodOptional<z.ZodString>;
1211
+ }, z.core.$loose>>;
1212
+ invocationId: z.ZodString;
1213
+ text: z.ZodString;
1214
+ model: z.ZodOptional<z.ZodObject<{
1215
+ provider: z.ZodString;
1216
+ model: z.ZodString;
1217
+ }, z.core.$loose>>;
1218
+ finishReason: z.ZodOptional<z.ZodString>;
1219
+ usage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
1220
+ toolCalls: z.ZodArray<z.ZodObject<{
1221
+ callId: z.ZodString;
1222
+ name: z.ZodString;
1223
+ input: z.ZodUnknown;
1224
+ }, z.core.$loose>>;
1225
+ }, z.core.$loose>;
1226
+ readonly source: "loop";
1227
+ readonly version: 1;
1228
+ };
1229
+ readonly "model.failed": {
1230
+ readonly payload: z.ZodObject<{
1231
+ agent: z.ZodOptional<z.ZodObject<{
1232
+ id: z.ZodString;
1233
+ path: z.ZodString;
1234
+ delegationId: z.ZodOptional<z.ZodString>;
1235
+ }, z.core.$loose>>;
1236
+ invocationId: z.ZodOptional<z.ZodString>;
1237
+ code: z.ZodString;
1238
+ message: z.ZodString;
1239
+ retryable: z.ZodBoolean;
1240
+ }, z.core.$loose>;
1241
+ readonly source: "loop";
1242
+ readonly version: 1;
1243
+ };
1244
+ readonly "context.compacted": {
1245
+ readonly payload: z.ZodObject<{
1246
+ agent: z.ZodOptional<z.ZodObject<{
1247
+ id: z.ZodString;
1248
+ path: z.ZodString;
1249
+ delegationId: z.ZodOptional<z.ZodString>;
1250
+ }, z.core.$loose>>;
1251
+ invocationId: z.ZodOptional<z.ZodString>;
1252
+ trigger: z.ZodEnum<{
1253
+ overflow: "overflow";
1254
+ threshold: "threshold";
816
1255
  }>;
817
- scope: z.ZodEnum<{
818
- step: "step";
819
- turn: "turn";
1256
+ tokensBefore: z.ZodNumber;
1257
+ tokensAfter: z.ZodNumber;
1258
+ }, z.core.$loose>;
1259
+ readonly source: "loop";
1260
+ readonly version: 1;
1261
+ };
1262
+ readonly "tool.completed": {
1263
+ readonly payload: z.ZodObject<{
1264
+ agent: z.ZodOptional<z.ZodObject<{
1265
+ id: z.ZodString;
1266
+ path: z.ZodString;
1267
+ delegationId: z.ZodOptional<z.ZodString>;
1268
+ }, z.core.$loose>>;
1269
+ callId: z.ZodString;
1270
+ invocationId: z.ZodString;
1271
+ capabilityId: z.ZodString;
1272
+ toolName: z.ZodString;
1273
+ output: z.ZodOptional<z.ZodUnknown>;
1274
+ error: z.ZodOptional<z.ZodObject<{
1275
+ code: z.ZodString;
1276
+ message: z.ZodString;
1277
+ }, z.core.$loose>>;
1278
+ }, z.core.$loose>;
1279
+ readonly source: "loop";
1280
+ readonly version: 1;
1281
+ };
1282
+ readonly "action.pending": {
1283
+ readonly payload: z.ZodObject<{
1284
+ agent: z.ZodOptional<z.ZodObject<{
1285
+ id: z.ZodString;
1286
+ path: z.ZodString;
1287
+ delegationId: z.ZodOptional<z.ZodString>;
1288
+ }, z.core.$loose>>;
1289
+ actionId: z.ZodString;
1290
+ kind: z.ZodString;
1291
+ toolName: z.ZodOptional<z.ZodString>;
1292
+ path: z.ZodOptional<z.ZodString>;
1293
+ key: z.ZodOptional<z.ZodString>;
1294
+ callId: z.ZodOptional<z.ZodString>;
1295
+ invocationId: z.ZodOptional<z.ZodString>;
1296
+ input: z.ZodUnknown;
1297
+ }, z.core.$loose>;
1298
+ readonly source: "loop";
1299
+ readonly version: 1;
1300
+ };
1301
+ readonly "action.delivered": {
1302
+ readonly payload: z.ZodObject<{
1303
+ agent: z.ZodOptional<z.ZodObject<{
1304
+ id: z.ZodString;
1305
+ path: z.ZodString;
1306
+ delegationId: z.ZodOptional<z.ZodString>;
1307
+ }, z.core.$loose>>;
1308
+ actionId: z.ZodString;
1309
+ generation: z.ZodNumber;
1310
+ }, z.core.$loose>;
1311
+ readonly source: "loop";
1312
+ readonly version: 1;
1313
+ };
1314
+ readonly "action.delivery_failed": {
1315
+ readonly payload: z.ZodObject<{
1316
+ actionId: z.ZodString;
1317
+ generation: z.ZodNumber;
1318
+ reason: z.ZodString;
1319
+ message: z.ZodOptional<z.ZodString>;
1320
+ retryInMs: z.ZodNumber;
1321
+ }, z.core.$loose>;
1322
+ readonly source: "loop";
1323
+ readonly version: 1;
1324
+ };
1325
+ readonly "action.completed": {
1326
+ readonly payload: z.ZodObject<{
1327
+ agent: z.ZodOptional<z.ZodObject<{
1328
+ id: z.ZodString;
1329
+ path: z.ZodString;
1330
+ delegationId: z.ZodOptional<z.ZodString>;
1331
+ }, z.core.$loose>>;
1332
+ actionId: z.ZodString;
1333
+ kind: z.ZodString;
1334
+ toolName: z.ZodOptional<z.ZodString>;
1335
+ path: z.ZodOptional<z.ZodString>;
1336
+ key: z.ZodOptional<z.ZodString>;
1337
+ callId: z.ZodOptional<z.ZodString>;
1338
+ invocationId: z.ZodOptional<z.ZodString>;
1339
+ result: z.ZodUnknown;
1340
+ }, z.core.$loose>;
1341
+ readonly source: "api";
1342
+ readonly version: 1;
1343
+ };
1344
+ readonly "action.uncertain": {
1345
+ readonly payload: z.ZodObject<{
1346
+ agent: z.ZodOptional<z.ZodObject<{
1347
+ id: z.ZodString;
1348
+ path: z.ZodString;
1349
+ delegationId: z.ZodOptional<z.ZodString>;
1350
+ }, z.core.$loose>>;
1351
+ actionId: z.ZodString;
1352
+ }, z.core.$loose>;
1353
+ readonly source: "loop";
1354
+ readonly version: 1;
1355
+ };
1356
+ readonly "effect.uncertain": {
1357
+ readonly payload: z.ZodObject<{
1358
+ effectId: z.ZodString;
1359
+ message: z.ZodOptional<z.ZodString>;
1360
+ }, z.core.$loose>;
1361
+ readonly source: "loop";
1362
+ readonly version: 1;
1363
+ };
1364
+ readonly "delegation.started": {
1365
+ readonly payload: z.ZodObject<{
1366
+ agent: z.ZodObject<{
1367
+ id: z.ZodString;
1368
+ path: z.ZodString;
1369
+ delegationId: z.ZodOptional<z.ZodString>;
1370
+ }, z.core.$loose>;
1371
+ callId: z.ZodOptional<z.ZodString>;
1372
+ }, z.core.$loose>;
1373
+ readonly source: "loop";
1374
+ readonly version: 1;
1375
+ };
1376
+ readonly "delegation.completed": {
1377
+ readonly payload: z.ZodObject<{
1378
+ agent: z.ZodObject<{
1379
+ id: z.ZodString;
1380
+ path: z.ZodString;
1381
+ delegationId: z.ZodOptional<z.ZodString>;
1382
+ }, z.core.$loose>;
1383
+ callId: z.ZodOptional<z.ZodString>;
1384
+ }, z.core.$loose>;
1385
+ readonly source: "loop";
1386
+ readonly version: 1;
1387
+ };
1388
+ readonly "sandbox.state": {
1389
+ readonly payload: z.ZodObject<{
1390
+ state: z.ZodEnum<{
1391
+ creating: "creating";
1392
+ running: "running";
1393
+ stopped: "stopped";
820
1394
  }>;
821
- capabilityIds: z.ZodArray<z.ZodString>;
822
- }, z.core.$strict>;
823
- }, z.core.$strict>, z.ZodObject<{
824
- actionId: z.ZodString;
825
- sessionId: z.ZodString;
826
- turnId: z.ZodString;
827
- agentId: z.ZodString;
828
- manifestHash: z.ZodString;
829
- implementationVersion: z.ZodString;
830
- input: z.ZodUnknown;
831
- context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
832
- status: z.ZodEnum<{
833
- cancelled: "cancelled";
834
- claimed: "claimed";
835
- completed: "completed";
836
- pending: "pending";
837
- uncertain: "uncertain";
838
- }>;
839
- generation: z.ZodNumber;
840
- claimId: z.ZodNullable<z.ZodString>;
841
- leaseExpiresAt: z.ZodNullable<z.ZodString>;
842
- agent: z.ZodOptional<z.ZodObject<{
843
- id: z.ZodString;
1395
+ backend: z.ZodString;
1396
+ isolation: z.ZodOptional<z.ZodString>;
1397
+ image: z.ZodOptional<z.ZodString>;
1398
+ network: z.ZodOptional<z.ZodUnknown>;
1399
+ reattach: z.ZodOptional<z.ZodBoolean>;
1400
+ lost: z.ZodOptional<z.ZodBoolean>;
1401
+ note: z.ZodOptional<z.ZodString>;
1402
+ error: z.ZodOptional<z.ZodString>;
1403
+ }, z.core.$loose>;
1404
+ readonly source: "loop";
1405
+ readonly version: 1;
1406
+ };
1407
+ readonly "sandbox.exec": {
1408
+ readonly payload: z.ZodObject<{
1409
+ tool: z.ZodString;
1410
+ command: z.ZodOptional<z.ZodString>;
1411
+ outcome: z.ZodString;
1412
+ code: z.ZodOptional<z.ZodString>;
1413
+ durationMs: z.ZodNumber;
1414
+ }, z.core.$loose>;
1415
+ readonly source: "loop";
1416
+ readonly version: 1;
1417
+ };
1418
+ readonly "node.started": {
1419
+ readonly payload: z.ZodObject<{
844
1420
  path: z.ZodString;
845
- delegationId: z.ZodOptional<z.ZodString>;
846
- }, z.core.$strict>>;
847
- kind: z.ZodLiteral<"fn">;
848
- path: z.ZodString;
849
- key: z.ZodString;
850
- }, z.core.$strict>, z.ZodObject<{
851
- actionId: z.ZodString;
852
- sessionId: z.ZodString;
853
- turnId: z.ZodString;
854
- agentId: z.ZodString;
855
- manifestHash: z.ZodString;
856
- implementationVersion: z.ZodString;
857
- input: z.ZodUnknown;
858
- context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
859
- status: z.ZodEnum<{
860
- cancelled: "cancelled";
861
- claimed: "claimed";
862
- completed: "completed";
863
- pending: "pending";
864
- uncertain: "uncertain";
865
- }>;
866
- generation: z.ZodNumber;
867
- claimId: z.ZodNullable<z.ZodString>;
868
- leaseExpiresAt: z.ZodNullable<z.ZodString>;
869
- agent: z.ZodOptional<z.ZodObject<{
870
- id: z.ZodString;
1421
+ kind: z.ZodString;
1422
+ key: z.ZodString;
1423
+ iterations: z.ZodOptional<z.ZodString>;
1424
+ }, z.core.$loose>;
1425
+ readonly source: "loop";
1426
+ readonly version: 1;
1427
+ };
1428
+ readonly "node.agent": {
1429
+ readonly payload: z.ZodObject<{
871
1430
  path: z.ZodString;
872
- delegationId: z.ZodOptional<z.ZodString>;
873
- }, z.core.$strict>>;
874
- kind: z.ZodLiteral<"verify">;
875
- path: z.ZodString;
876
- key: z.ZodString;
877
- }, z.core.$strict>]>;
878
- claimId: z.ZodString;
879
- generation: z.ZodNumber;
880
- leaseExpiresAt: z.ZodString;
881
- }, z.core.$strip>;
882
- export type ActionClaim = z.infer<typeof ActionClaimResponseSchema>;
883
- export interface ExecutorScope {
884
- readonly agentId: string;
885
- readonly manifestHash?: string;
886
- readonly implementationVersion: string;
887
- }
888
- export declare const ExecutorNotificationSchema: z.ZodObject<{
889
- type: z.ZodLiteral<"work_available">;
890
- }, z.core.$strip>;
891
- export declare const ExecutorRegistrationSchema: z.ZodObject<{
892
- agentId: z.ZodString;
893
- implementationVersion: z.ZodString;
894
- manifestHash: z.ZodOptional<z.ZodString>;
895
- token: z.ZodString;
896
- }, z.core.$strict>;
897
- export declare const RegisterExecutorsRequestSchema: z.ZodObject<{
898
- executors: z.ZodArray<z.ZodObject<{
899
- agentId: z.ZodString;
900
- implementationVersion: z.ZodString;
901
- manifestHash: z.ZodOptional<z.ZodString>;
902
- token: z.ZodString;
903
- }, z.core.$strict>>;
904
- }, z.core.$strict>;
905
- export declare const RegisterExecutorsResponseSchema: z.ZodObject<{
906
- executors: z.ZodArray<z.ZodObject<{
907
- agentId: z.ZodString;
908
- implementationVersion: z.ZodString;
909
- rotated: z.ZodBoolean;
910
- replacedBy: z.ZodOptional<z.ZodLiteral<"different-credential">>;
911
- }, z.core.$strip>>;
912
- }, z.core.$strip>;
913
- export declare const ExecutorSummarySchema: z.ZodObject<{
914
- agentId: z.ZodString;
915
- implementationVersion: z.ZodString;
916
- manifestHash: z.ZodOptional<z.ZodString>;
917
- connected: z.ZodBoolean;
918
- updatedAt: z.ZodString;
919
- }, z.core.$strip>;
920
- export declare const ListExecutorsResponseSchema: z.ZodObject<{
921
- executors: z.ZodArray<z.ZodObject<{
922
- agentId: z.ZodString;
923
- implementationVersion: z.ZodString;
924
- manifestHash: z.ZodOptional<z.ZodString>;
925
- connected: z.ZodBoolean;
926
- updatedAt: z.ZodString;
927
- }, z.core.$strip>>;
1431
+ iterations: z.ZodOptional<z.ZodString>;
1432
+ sessionId: z.ZodString;
1433
+ turnId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1434
+ }, z.core.$loose>;
1435
+ readonly source: "loop";
1436
+ readonly version: 1;
1437
+ };
1438
+ readonly "loop.iteration": {
1439
+ readonly payload: z.ZodObject<{
1440
+ path: z.ZodString;
1441
+ n: z.ZodNumber;
1442
+ sessionId: z.ZodOptional<z.ZodString>;
1443
+ turnId: z.ZodOptional<z.ZodString>;
1444
+ manifestHash: z.ZodOptional<z.ZodString>;
1445
+ }, z.core.$loose>;
1446
+ readonly source: "loop";
1447
+ readonly version: 1;
1448
+ };
1449
+ readonly "loop.verified": {
1450
+ readonly payload: z.ZodObject<{
1451
+ path: z.ZodString;
1452
+ n: z.ZodNumber;
1453
+ pass: z.ZodBoolean;
1454
+ feedback: z.ZodOptional<z.ZodString>;
1455
+ data: z.ZodOptional<z.ZodUnknown>;
1456
+ }, z.core.$loose>;
1457
+ readonly source: "api";
1458
+ readonly version: 1;
1459
+ };
1460
+ readonly "loop.decided": {
1461
+ readonly payload: z.ZodObject<{
1462
+ path: z.ZodString;
1463
+ n: z.ZodNumber;
1464
+ next: z.ZodEnum<{
1465
+ input: "input";
1466
+ output: "output";
1467
+ }>;
1468
+ patched: z.ZodBoolean;
1469
+ }, z.core.$loose>;
1470
+ readonly source: "api";
1471
+ readonly version: 1;
1472
+ };
1473
+ readonly "transcript.updated": {
1474
+ readonly payload: z.ZodObject<{
1475
+ keep: z.ZodNumber;
1476
+ entries: z.ZodArray<z.ZodUnknown>;
1477
+ length: z.ZodNumber;
1478
+ }, z.core.$loose>;
1479
+ readonly source: "loop";
1480
+ readonly version: 1;
1481
+ readonly visibility: "internal";
1482
+ };
1483
+ };
1484
+ export type EventType = keyof typeof EVENT_CATALOG;
1485
+ export declare const EVENT_TYPES: readonly EventType[];
1486
+ /** Drops the index signatures `passthrough` adds, so plain interfaces are assignable. */
1487
+ type Closed<T> = T extends readonly (infer U)[] ? Closed<U>[] : T extends object ? {
1488
+ [K in keyof T as string extends K ? never : K]: Closed<T[K]>;
1489
+ } : T;
1490
+ /**
1491
+ * The payload a writer passes for an event of `type` (checked again at runtime against the
1492
+ * catalog, unknown fields included).
1493
+ */
1494
+ export type EventPayload<T extends EventType> = Closed<z.input<(typeof EVENT_CATALOG)[T]["payload"]>>;
1495
+ export declare function isEventType(type: string): type is EventType;
1496
+ type EventSchemaOf<T extends EventType> = z.ZodObject<typeof eventEnvelope & {
1497
+ type: z.ZodLiteral<T>;
1498
+ payload: (typeof EVENT_CATALOG)[T]["payload"];
1499
+ }>;
1500
+ /** One schema per event type, keyed by type (the OpenAPI components). */
1501
+ export declare const EVENT_SCHEMAS: { [T in EventType]: EventSchemaOf<T>; };
1502
+ /** A session event of a known type, discriminated on `type`. */
1503
+ export declare const SessionEventSchema: z.ZodDiscriminatedUnion<[EventSchemaOf<"action.completed" | "action.delivered" | "action.delivery_failed" | "action.pending" | "action.uncertain" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "loop.decided" | "loop.iteration" | "loop.verified" | "message.assistant" | "model.failed" | "node.agent" | "node.started" | "sandbox.exec" | "sandbox.state" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">, ...EventSchemaOf<"action.completed" | "action.delivered" | "action.delivery_failed" | "action.pending" | "action.uncertain" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "loop.decided" | "loop.iteration" | "loop.verified" | "message.assistant" | "model.failed" | "node.agent" | "node.started" | "sandbox.exec" | "sandbox.state" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">[]], "type">;
1504
+ export type SessionEvent = {
1505
+ [T in EventType]: z.infer<EventSchemaOf<T>>;
1506
+ }[EventType];
1507
+ /** The session event of type `T`. */
1508
+ export type SessionEventOf<T extends EventType> = Extract<SessionEvent, {
1509
+ type: T;
1510
+ }>;
1511
+ /**
1512
+ * Reads one event from the wire: typed when its type is in the catalog and it matches, else
1513
+ * the bare envelope (a newer Runtime's type, which a client ignores). Throws only when even
1514
+ * the envelope does not match.
1515
+ */
1516
+ export declare function parseSessionEvent(value: unknown): SessionEvent | LiveEvent;
1517
+ export declare const SessionItemsResponseSchema: z.ZodObject<{
1518
+ items: z.ZodArray<z.ZodDiscriminatedUnion<[EventSchemaOf<"action.completed" | "action.delivered" | "action.delivery_failed" | "action.pending" | "action.uncertain" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "loop.decided" | "loop.iteration" | "loop.verified" | "message.assistant" | "model.failed" | "node.agent" | "node.started" | "sandbox.exec" | "sandbox.state" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">, ...EventSchemaOf<"action.completed" | "action.delivered" | "action.delivery_failed" | "action.pending" | "action.uncertain" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "loop.decided" | "loop.iteration" | "loop.verified" | "message.assistant" | "model.failed" | "node.agent" | "node.started" | "sandbox.exec" | "sandbox.state" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused">[]], "type">>;
1519
+ cursor: z.ZodNullable<z.ZodString>;
928
1520
  }, z.core.$strip>;
929
- export type ExecutorRegistration = z.infer<typeof ExecutorRegistrationSchema>;
930
- export type RegisterExecutorsResponse = z.infer<typeof RegisterExecutorsResponseSchema>;
931
- export type ExecutorSummary = z.infer<typeof ExecutorSummarySchema>;
1521
+ export type SessionItemsResponse = {
1522
+ items: (SessionEvent | LiveEvent)[];
1523
+ cursor: string | null;
1524
+ };
1525
+ export type TranscriptEvent = SessionEventOf<TranscriptEventType>;
1526
+ /** Types a transcript event's payload; `undefined` for other types or a malformed payload. */
1527
+ export declare function parseTranscriptEvent(event: LiveEvent): TranscriptEvent | undefined;
932
1528
  export declare const ProtocolRangeSchema: z.ZodObject<{
933
1529
  min: z.ZodNumber;
934
1530
  max: z.ZodNumber;
@@ -975,38 +1571,16 @@ export declare const TenantEnvelopeSchema: z.ZodObject<{
975
1571
  schemaVersion: z.ZodNumber;
976
1572
  }, z.core.$strict>;
977
1573
  export type TenantEnvelope = z.infer<typeof TenantEnvelopeSchema>;
978
- export declare const CreateTenantRequestSchema: z.ZodObject<{
979
- tenantId: z.ZodString;
980
- name: z.ZodString;
981
- principalId: z.ZodString;
982
- credentialHash: z.ZodString;
983
- idempotencyKey: z.ZodString;
984
- studioCredentialHash: z.ZodOptional<z.ZodString>;
985
- derivedPrincipals: z.ZodOptional<z.ZodArray<z.ZodObject<{
986
- id: z.ZodString;
987
- credentialHash: z.ZodString;
988
- }, z.core.$strict>>>;
989
- }, z.core.$strict>;
990
- export type CreateTenantRequest = z.infer<typeof CreateTenantRequestSchema>;
991
- export declare const AdminTenantSchema: z.ZodObject<{
992
- id: z.ZodString;
993
- name: z.ZodNullable<z.ZodString>;
994
- state: z.ZodEnum<{
995
- open: "open";
996
- quarantined: "quarantined";
997
- }>;
998
- envelope: z.ZodNullable<z.ZodObject<{
999
- id: z.ZodString;
1000
- name: z.ZodString;
1001
- createdAt: z.ZodString;
1002
- updatedAt: z.ZodString;
1003
- schemaVersion: z.ZodNumber;
1004
- }, z.core.$strict>>;
1005
- }, z.core.$strict>;
1006
- export type AdminTenant = z.infer<typeof AdminTenantSchema>;
1007
- export declare const QuarantineSchema: z.ZodObject<{
1574
+ /**
1575
+ * Why a Host's Tenant is not open (`HostTenant.cause`): it could not be opened, and the Host
1576
+ * fails readiness until the cause is repaired and the Host restarted. `database-layout-old`:
1577
+ * the database was written by a Runtime from before one Tenant per installation; this release
1578
+ * starts fresh on a new database.
1579
+ */
1580
+ export declare const TenantCauseSchema: z.ZodObject<{
1008
1581
  code: z.ZodEnum<{
1009
1582
  corrupt: "corrupt";
1583
+ "database-layout-old": "database-layout-old";
1010
1584
  "envelope-invalid": "envelope-invalid";
1011
1585
  "kek-missing": "kek-missing";
1012
1586
  "migration-failed": "migration-failed";
@@ -1017,13 +1591,17 @@ export declare const QuarantineSchema: z.ZodObject<{
1017
1591
  message: z.ZodString;
1018
1592
  repair: z.ZodString;
1019
1593
  }, z.core.$strict>;
1020
- export type QuarantineInfo = z.infer<typeof QuarantineSchema>;
1021
- export declare const AdminTenantStatusSchema: z.ZodObject<{
1022
- id: z.ZodString;
1594
+ export type TenantCause = z.infer<typeof TenantCauseSchema>;
1595
+ /**
1596
+ * The Host's one Tenant, as `/v1/admin/status` reports it. `unavailable` while it opens, when
1597
+ * opening it failed (`cause`), or when it is closing.
1598
+ */
1599
+ export declare const HostTenantSchema: z.ZodObject<{
1600
+ id: z.ZodNullable<z.ZodString>;
1023
1601
  name: z.ZodNullable<z.ZodString>;
1024
1602
  state: z.ZodEnum<{
1025
1603
  open: "open";
1026
- quarantined: "quarantined";
1604
+ unavailable: "unavailable";
1027
1605
  }>;
1028
1606
  envelope: z.ZodNullable<z.ZodObject<{
1029
1607
  id: z.ZodString;
@@ -1032,9 +1610,10 @@ export declare const AdminTenantStatusSchema: z.ZodObject<{
1032
1610
  updatedAt: z.ZodString;
1033
1611
  schemaVersion: z.ZodNumber;
1034
1612
  }, z.core.$strict>>;
1035
- quarantine: z.ZodOptional<z.ZodObject<{
1613
+ cause: z.ZodOptional<z.ZodObject<{
1036
1614
  code: z.ZodEnum<{
1037
1615
  corrupt: "corrupt";
1616
+ "database-layout-old": "database-layout-old";
1038
1617
  "envelope-invalid": "envelope-invalid";
1039
1618
  "kek-missing": "kek-missing";
1040
1619
  "migration-failed": "migration-failed";
@@ -1046,14 +1625,32 @@ export declare const AdminTenantStatusSchema: z.ZodObject<{
1046
1625
  repair: z.ZodString;
1047
1626
  }, z.core.$strict>>;
1048
1627
  }, z.core.$strict>;
1049
- export type AdminTenantStatus = z.infer<typeof AdminTenantStatusSchema>;
1628
+ export type HostTenant = z.infer<typeof HostTenantSchema>;
1629
+ /** A stream relay's state (Durable Streams §7). */
1630
+ export declare const StreamRelayStatusSchema: z.ZodObject<{
1631
+ active: z.ZodBoolean;
1632
+ pendingTxs: z.ZodNumber;
1633
+ pendingRows: z.ZodNumber;
1634
+ confirmed: z.ZodNullable<z.ZodString>;
1635
+ reconciliations: z.ZodNumber;
1636
+ lastError: z.ZodNullable<z.ZodString>;
1637
+ lagBytes: z.ZodOptional<z.ZodNumber>;
1638
+ }, z.core.$strict>;
1639
+ export type StreamRelayStatus = z.infer<typeof StreamRelayStatusSchema>;
1050
1640
  export declare const HostAggregateSchema: z.ZodObject<{
1051
1641
  runningSessions: z.ZodNumber;
1052
- connectedExecutors: z.ZodNumber;
1642
+ inFlightDeliveries: z.ZodNumber;
1053
1643
  pendingActions: z.ZodNumber;
1054
1644
  uncertainEffects: z.ZodNumber;
1055
- outboxDepth: z.ZodOptional<z.ZodNumber>;
1056
- relayLagMs: z.ZodOptional<z.ZodNumber>;
1645
+ relay: z.ZodOptional<z.ZodObject<{
1646
+ active: z.ZodBoolean;
1647
+ pendingTxs: z.ZodNumber;
1648
+ pendingRows: z.ZodNumber;
1649
+ confirmed: z.ZodNullable<z.ZodString>;
1650
+ reconciliations: z.ZodNumber;
1651
+ lastError: z.ZodNullable<z.ZodString>;
1652
+ lagBytes: z.ZodOptional<z.ZodNumber>;
1653
+ }, z.core.$strict>>;
1057
1654
  }, z.core.$strict>;
1058
1655
  export type HostAggregate = z.infer<typeof HostAggregateSchema>;
1059
1656
  export declare const AdminHostStatusSchema: z.ZodObject<{
@@ -1066,12 +1663,12 @@ export declare const AdminHostStatusSchema: z.ZodObject<{
1066
1663
  max: z.ZodNumber;
1067
1664
  features: z.ZodArray<z.ZodString>;
1068
1665
  }, z.core.$strict>;
1069
- tenants: z.ZodArray<z.ZodObject<{
1070
- id: z.ZodString;
1666
+ tenant: z.ZodObject<{
1667
+ id: z.ZodNullable<z.ZodString>;
1071
1668
  name: z.ZodNullable<z.ZodString>;
1072
1669
  state: z.ZodEnum<{
1073
1670
  open: "open";
1074
- quarantined: "quarantined";
1671
+ unavailable: "unavailable";
1075
1672
  }>;
1076
1673
  envelope: z.ZodNullable<z.ZodObject<{
1077
1674
  id: z.ZodString;
@@ -1080,14 +1677,35 @@ export declare const AdminHostStatusSchema: z.ZodObject<{
1080
1677
  updatedAt: z.ZodString;
1081
1678
  schemaVersion: z.ZodNumber;
1082
1679
  }, z.core.$strict>>;
1083
- }, z.core.$strict>>;
1680
+ cause: z.ZodOptional<z.ZodObject<{
1681
+ code: z.ZodEnum<{
1682
+ corrupt: "corrupt";
1683
+ "database-layout-old": "database-layout-old";
1684
+ "envelope-invalid": "envelope-invalid";
1685
+ "kek-missing": "kek-missing";
1686
+ "migration-failed": "migration-failed";
1687
+ "open-failed": "open-failed";
1688
+ "open-timeout": "open-timeout";
1689
+ "schema-too-new": "schema-too-new";
1690
+ }>;
1691
+ message: z.ZodString;
1692
+ repair: z.ZodString;
1693
+ }, z.core.$strict>>;
1694
+ }, z.core.$strict>;
1084
1695
  aggregate: z.ZodObject<{
1085
1696
  runningSessions: z.ZodNumber;
1086
- connectedExecutors: z.ZodNumber;
1697
+ inFlightDeliveries: z.ZodNumber;
1087
1698
  pendingActions: z.ZodNumber;
1088
1699
  uncertainEffects: z.ZodNumber;
1089
- outboxDepth: z.ZodOptional<z.ZodNumber>;
1090
- relayLagMs: z.ZodOptional<z.ZodNumber>;
1700
+ relay: z.ZodOptional<z.ZodObject<{
1701
+ active: z.ZodBoolean;
1702
+ pendingTxs: z.ZodNumber;
1703
+ pendingRows: z.ZodNumber;
1704
+ confirmed: z.ZodNullable<z.ZodString>;
1705
+ reconciliations: z.ZodNumber;
1706
+ lastError: z.ZodNullable<z.ZodString>;
1707
+ lagBytes: z.ZodOptional<z.ZodNumber>;
1708
+ }, z.core.$strict>>;
1091
1709
  }, z.core.$strict>;
1092
1710
  }, z.core.$strict>;
1093
1711
  export type AdminHostStatus = z.infer<typeof AdminHostStatusSchema>;
@@ -1100,12 +1718,12 @@ export declare const AdminStatusSchema: z.ZodObject<{
1100
1718
  max: z.ZodNumber;
1101
1719
  features: z.ZodArray<z.ZodString>;
1102
1720
  }, z.core.$strict>;
1103
- tenants: z.ZodArray<z.ZodObject<{
1104
- id: z.ZodString;
1721
+ tenant: z.ZodObject<{
1722
+ id: z.ZodNullable<z.ZodString>;
1105
1723
  name: z.ZodNullable<z.ZodString>;
1106
1724
  state: z.ZodEnum<{
1107
1725
  open: "open";
1108
- quarantined: "quarantined";
1726
+ unavailable: "unavailable";
1109
1727
  }>;
1110
1728
  envelope: z.ZodNullable<z.ZodObject<{
1111
1729
  id: z.ZodString;
@@ -1114,14 +1732,35 @@ export declare const AdminStatusSchema: z.ZodObject<{
1114
1732
  updatedAt: z.ZodString;
1115
1733
  schemaVersion: z.ZodNumber;
1116
1734
  }, z.core.$strict>>;
1117
- }, z.core.$strict>>;
1735
+ cause: z.ZodOptional<z.ZodObject<{
1736
+ code: z.ZodEnum<{
1737
+ corrupt: "corrupt";
1738
+ "database-layout-old": "database-layout-old";
1739
+ "envelope-invalid": "envelope-invalid";
1740
+ "kek-missing": "kek-missing";
1741
+ "migration-failed": "migration-failed";
1742
+ "open-failed": "open-failed";
1743
+ "open-timeout": "open-timeout";
1744
+ "schema-too-new": "schema-too-new";
1745
+ }>;
1746
+ message: z.ZodString;
1747
+ repair: z.ZodString;
1748
+ }, z.core.$strict>>;
1749
+ }, z.core.$strict>;
1118
1750
  aggregate: z.ZodObject<{
1119
1751
  runningSessions: z.ZodNumber;
1120
- connectedExecutors: z.ZodNumber;
1752
+ inFlightDeliveries: z.ZodNumber;
1121
1753
  pendingActions: z.ZodNumber;
1122
1754
  uncertainEffects: z.ZodNumber;
1123
- outboxDepth: z.ZodOptional<z.ZodNumber>;
1124
- relayLagMs: z.ZodOptional<z.ZodNumber>;
1755
+ relay: z.ZodOptional<z.ZodObject<{
1756
+ active: z.ZodBoolean;
1757
+ pendingTxs: z.ZodNumber;
1758
+ pendingRows: z.ZodNumber;
1759
+ confirmed: z.ZodNullable<z.ZodString>;
1760
+ reconciliations: z.ZodNumber;
1761
+ lastError: z.ZodNullable<z.ZodString>;
1762
+ lagBytes: z.ZodOptional<z.ZodNumber>;
1763
+ }, z.core.$strict>>;
1125
1764
  }, z.core.$strict>;
1126
1765
  host: z.ZodOptional<z.ZodObject<{
1127
1766
  hostId: z.ZodString;
@@ -1130,11 +1769,18 @@ export declare const AdminStatusSchema: z.ZodObject<{
1130
1769
  }, z.core.$strict>>;
1131
1770
  }, z.core.$strict>;
1132
1771
  export type AdminStatus = z.infer<typeof AdminStatusSchema>;
1133
- export declare const ProjectLinkFileSchema: z.ZodObject<{
1134
- format: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
1772
+ /**
1773
+ * `.nylorun/link.json`: the installation a Project uses. Format 2 (one Tenant per
1774
+ * installation) names the local `stack` that `nylorun start` created or attached; `tenantId`
1775
+ * is information only, since nothing in a request selects a Tenant. Formats 0 and 1 named a
1776
+ * Tenant on a multi-Tenant Host of an older Runtime.
1777
+ */
1778
+ export declare const ProjectLinkFileSchema: z.ZodObject<{
1779
+ format: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
1780
+ stack: z.ZodOptional<z.ZodString>;
1135
1781
  hostUrl: z.ZodString;
1136
1782
  hostId: z.ZodString;
1137
- tenantId: z.ZodString;
1783
+ tenantId: z.ZodOptional<z.ZodString>;
1138
1784
  }, z.core.$loose>;
1139
1785
  export type ProjectLinkFile = z.infer<typeof ProjectLinkFileSchema>;
1140
1786
  export declare const ProjectCredentialsFileSchema: z.ZodObject<{
@@ -1154,6 +1800,12 @@ export declare const HostModelViewSchema: z.ZodUnion<readonly [z.ZodObject<{
1154
1800
  oauth: "oauth";
1155
1801
  }>;
1156
1802
  baseUrl: z.ZodOptional<z.ZodString>;
1803
+ settings: z.ZodOptional<z.ZodObject<{
1804
+ contextWindow: z.ZodOptional<z.ZodNumber>;
1805
+ maxTokens: z.ZodOptional<z.ZodNumber>;
1806
+ reasoning: z.ZodOptional<z.ZodBoolean>;
1807
+ compat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1808
+ }, z.core.$strict>>;
1157
1809
  }, z.core.$strict>]>;
1158
1810
  export declare const TenantStatusSchema: z.ZodObject<{
1159
1811
  tenant: z.ZodObject<{
@@ -1168,7 +1820,7 @@ export declare const TenantStatusSchema: z.ZodObject<{
1168
1820
  store: z.ZodBoolean;
1169
1821
  scheduler: z.ZodBoolean;
1170
1822
  model: z.ZodBoolean;
1171
- executors: z.ZodBoolean;
1823
+ endpoints: z.ZodBoolean;
1172
1824
  schema: z.ZodBoolean;
1173
1825
  }, z.core.$strict>;
1174
1826
  model: z.ZodUnion<readonly [z.ZodObject<{
@@ -1182,11 +1834,17 @@ export declare const TenantStatusSchema: z.ZodObject<{
1182
1834
  oauth: "oauth";
1183
1835
  }>;
1184
1836
  baseUrl: z.ZodOptional<z.ZodString>;
1837
+ settings: z.ZodOptional<z.ZodObject<{
1838
+ contextWindow: z.ZodOptional<z.ZodNumber>;
1839
+ maxTokens: z.ZodOptional<z.ZodNumber>;
1840
+ reasoning: z.ZodOptional<z.ZodBoolean>;
1841
+ compat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1842
+ }, z.core.$strict>>;
1185
1843
  }, z.core.$strict>]>;
1186
1844
  agents: z.ZodArray<z.ZodObject<{
1187
1845
  agentId: z.ZodString;
1188
1846
  registered: z.ZodBoolean;
1189
- connected: z.ZodBoolean;
1847
+ endpoint: z.ZodBoolean;
1190
1848
  }, z.core.$strict>>;
1191
1849
  counts: z.ZodObject<{
1192
1850
  sessions: z.ZodNumber;
@@ -1218,27 +1876,61 @@ export declare const TenantStatusSchema: z.ZodObject<{
1218
1876
  failures: z.ZodNumber;
1219
1877
  lastError: z.ZodNullable<z.ZodString>;
1220
1878
  }, z.core.$strict>;
1221
- outbox: z.ZodObject<{
1222
- depth: z.ZodNumber;
1223
- oldestAgeMs: z.ZodNullable<z.ZodNumber>;
1224
- }, z.core.$strict>;
1225
- relayLagMs: z.ZodNumber;
1226
- collectionPending: z.ZodBoolean;
1879
+ generation: z.ZodNumber;
1880
+ relay: z.ZodNullable<z.ZodObject<{
1881
+ active: z.ZodBoolean;
1882
+ pendingTxs: z.ZodNumber;
1883
+ pendingRows: z.ZodNumber;
1884
+ confirmed: z.ZodNullable<z.ZodString>;
1885
+ reconciliations: z.ZodNumber;
1886
+ lastError: z.ZodNullable<z.ZodString>;
1887
+ lagBytes: z.ZodOptional<z.ZodNumber>;
1888
+ }, z.core.$strict>>;
1227
1889
  }, z.core.$strict>>;
1228
1890
  }, z.core.$strict>;
1229
1891
  export type TenantStatus = z.infer<typeof TenantStatusSchema>;
1230
1892
  export declare const SeedTenantConfigRequestSchema: z.ZodObject<{
1231
1893
  requestId: z.ZodString;
1232
1894
  sandbox: z.ZodOptional<z.ZodObject<{
1233
- backend: z.ZodEnum<{
1895
+ backend: z.ZodOptional<z.ZodEnum<{
1234
1896
  auto: "auto";
1235
1897
  virtual: "virtual";
1236
- }>;
1898
+ }>>;
1899
+ config: z.ZodOptional<z.ZodObject<{
1900
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"virtual">, z.ZodObject<{
1901
+ image: z.ZodOptional<z.ZodString>;
1902
+ network: z.ZodOptional<z.ZodObject<{
1903
+ allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
1904
+ }, z.core.$strict>>;
1905
+ resources: z.ZodOptional<z.ZodObject<{
1906
+ cpus: z.ZodOptional<z.ZodNumber>;
1907
+ memory: z.ZodOptional<z.ZodString>;
1908
+ }, z.core.$strict>>;
1909
+ }, z.core.$strict>]>>;
1910
+ limits: z.ZodOptional<z.ZodObject<{
1911
+ network: z.ZodOptional<z.ZodArray<z.ZodString>>;
1912
+ resources: z.ZodOptional<z.ZodObject<{
1913
+ cpus: z.ZodOptional<z.ZodNumber>;
1914
+ memory: z.ZodOptional<z.ZodString>;
1915
+ }, z.core.$strict>>;
1916
+ defaultResources: z.ZodOptional<z.ZodObject<{
1917
+ cpus: z.ZodOptional<z.ZodNumber>;
1918
+ memory: z.ZodOptional<z.ZodString>;
1919
+ }, z.core.$strict>>;
1920
+ idle: z.ZodOptional<z.ZodString>;
1921
+ }, z.core.$strict>>;
1922
+ }, z.core.$strict>>;
1237
1923
  }, z.core.$strict>>;
1238
1924
  model: z.ZodOptional<z.ZodObject<{
1239
1925
  provider: z.ZodString;
1240
1926
  model: z.ZodString;
1241
1927
  baseUrl: z.ZodOptional<z.ZodString>;
1928
+ settings: z.ZodOptional<z.ZodObject<{
1929
+ contextWindow: z.ZodOptional<z.ZodNumber>;
1930
+ maxTokens: z.ZodOptional<z.ZodNumber>;
1931
+ reasoning: z.ZodOptional<z.ZodBoolean>;
1932
+ compat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1933
+ }, z.core.$strict>>;
1242
1934
  auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
1243
1935
  type: z.ZodLiteral<"api_key">;
1244
1936
  key: z.ZodString;
@@ -1278,6 +1970,8 @@ export type ResetTenantRequest = z.infer<typeof ResetTenantRequestSchema>;
1278
1970
  */
1279
1971
  export declare const SUBJECT_SCOPES: readonly ["agents:read", "agents:write", "sessions:own", "vaults:own", "tenant:settings"];
1280
1972
  export type SubjectScope = (typeof SUBJECT_SCOPES)[number];
1973
+ /** A valid subject: 1–200 visible ASCII characters, not reserved by the Runtime. */
1974
+ export declare function isSubject(value: unknown): value is string;
1281
1975
  /**
1282
1976
  * Validates `Nylorun-Subject` and `Nylorun-Scopes`. Returns the subject and its scopes, or a
1283
1977
  * message naming what is wrong. Scopes are required: the Runtime never grants a default.
@@ -1290,3 +1984,1267 @@ export declare function parseSubjectHeaders(subject: string, scopes: string | un
1290
1984
  ok: false;
1291
1985
  message: string;
1292
1986
  };
1987
+ /** Scopes a subject token may carry: never `agents:write` or `tenant:settings`. */
1988
+ export declare const TOKEN_SCOPES: readonly ["agents:read", "sessions:own", "vaults:own"];
1989
+ export type TokenScope = (typeof TOKEN_SCOPES)[number];
1990
+ /** The JWT `typ` of a subject token (RFC 8725 explicit typing). */
1991
+ export declare const SUBJECT_TOKEN_TYPE = "nylorun-subject+jwt";
1992
+ /** The `aud` of every subject token. */
1993
+ export declare const SUBJECT_TOKEN_AUDIENCE = "nylorun";
1994
+ /** The `iss` of a Tenant's subject tokens. */
1995
+ export declare function subjectTokenIssuer(tenantId: string): string;
1996
+ /** Token lifetimes, in seconds. */
1997
+ export declare const TOKEN_TTL_MIN_SECONDS = 60;
1998
+ export declare const TOKEN_TTL_MAX_SECONDS = 900;
1999
+ export declare const TOKEN_TTL_DEFAULT_SECONDS = 600;
2000
+ /** A role's name in the access policy; `anon` is reserved for publishable keys. */
2001
+ export declare const ROLE_NAME_PATTERN: RegExp;
2002
+ export declare const RoleLimitsSchema: z.ZodObject<{
2003
+ turnsPerHour: z.ZodOptional<z.ZodNumber>;
2004
+ concurrentTurns: z.ZodOptional<z.ZodNumber>;
2005
+ }, z.core.$strict>;
2006
+ export type RoleLimits = z.infer<typeof RoleLimitsSchema>;
2007
+ export declare const AccessRoleSchema: z.ZodObject<{
2008
+ scopes: z.ZodArray<z.ZodEnum<{
2009
+ "agents:read": "agents:read";
2010
+ "sessions:own": "sessions:own";
2011
+ "vaults:own": "vaults:own";
2012
+ }>>;
2013
+ agents: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>;
2014
+ limits: z.ZodOptional<z.ZodObject<{
2015
+ turnsPerHour: z.ZodOptional<z.ZodNumber>;
2016
+ concurrentTurns: z.ZodOptional<z.ZodNumber>;
2017
+ }, z.core.$strict>>;
2018
+ }, z.core.$strict>;
2019
+ export type AccessRole = z.infer<typeof AccessRoleSchema>;
2020
+ /**
2021
+ * The Tenant's access policy: what each role may do with a subject token, what a publishable
2022
+ * key grants alone (`anon`), and how long tokens live. Without roles nothing can be minted.
2023
+ */
2024
+ export declare const AccessPolicySchema: z.ZodObject<{
2025
+ version: z.ZodLiteral<1>;
2026
+ roles: z.ZodRecord<z.ZodString, z.ZodObject<{
2027
+ scopes: z.ZodArray<z.ZodEnum<{
2028
+ "agents:read": "agents:read";
2029
+ "sessions:own": "sessions:own";
2030
+ "vaults:own": "vaults:own";
2031
+ }>>;
2032
+ agents: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>;
2033
+ limits: z.ZodOptional<z.ZodObject<{
2034
+ turnsPerHour: z.ZodOptional<z.ZodNumber>;
2035
+ concurrentTurns: z.ZodOptional<z.ZodNumber>;
2036
+ }, z.core.$strict>>;
2037
+ }, z.core.$strict>>;
2038
+ anon: z.ZodObject<{
2039
+ scopes: z.ZodArray<z.ZodLiteral<"agents:read">>;
2040
+ agents: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>;
2041
+ }, z.core.$strict>;
2042
+ tokens: z.ZodObject<{
2043
+ maxTtlSeconds: z.ZodNumber;
2044
+ }, z.core.$strict>;
2045
+ }, z.core.$strict>;
2046
+ export type AccessPolicy = z.infer<typeof AccessPolicySchema>;
2047
+ /** The policy of a Tenant that never set one: no roles, nothing for `anon`. */
2048
+ export declare const DEFAULT_ACCESS_POLICY: AccessPolicy;
2049
+ export declare const PutAccessPolicyRequestSchema: z.ZodObject<{
2050
+ requestId: z.ZodString;
2051
+ policy: z.ZodObject<{
2052
+ version: z.ZodLiteral<1>;
2053
+ roles: z.ZodRecord<z.ZodString, z.ZodObject<{
2054
+ scopes: z.ZodArray<z.ZodEnum<{
2055
+ "agents:read": "agents:read";
2056
+ "sessions:own": "sessions:own";
2057
+ "vaults:own": "vaults:own";
2058
+ }>>;
2059
+ agents: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>;
2060
+ limits: z.ZodOptional<z.ZodObject<{
2061
+ turnsPerHour: z.ZodOptional<z.ZodNumber>;
2062
+ concurrentTurns: z.ZodOptional<z.ZodNumber>;
2063
+ }, z.core.$strict>>;
2064
+ }, z.core.$strict>>;
2065
+ anon: z.ZodObject<{
2066
+ scopes: z.ZodArray<z.ZodLiteral<"agents:read">>;
2067
+ agents: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>;
2068
+ }, z.core.$strict>;
2069
+ tokens: z.ZodObject<{
2070
+ maxTtlSeconds: z.ZodNumber;
2071
+ }, z.core.$strict>;
2072
+ }, z.core.$strict>;
2073
+ }, z.core.$strict>;
2074
+ export type PutAccessPolicyRequest = z.infer<typeof PutAccessPolicyRequestSchema>;
2075
+ export declare const CreateTokenRequestSchema: z.ZodObject<{
2076
+ requestId: z.ZodString;
2077
+ subject: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
2078
+ role: z.ZodString;
2079
+ scopes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2080
+ "agents:read": "agents:read";
2081
+ "sessions:own": "sessions:own";
2082
+ "vaults:own": "vaults:own";
2083
+ }>>>;
2084
+ agents: z.ZodOptional<z.ZodArray<z.ZodString>>;
2085
+ ttlSeconds: z.ZodOptional<z.ZodNumber>;
2086
+ }, z.core.$strict>;
2087
+ export type CreateTokenRequest = z.infer<typeof CreateTokenRequestSchema>;
2088
+ export declare const CreateTokenResponseSchema: z.ZodObject<{
2089
+ token: z.ZodString;
2090
+ expiresAt: z.ZodString;
2091
+ subject: z.ZodString;
2092
+ role: z.ZodString;
2093
+ scopes: z.ZodArray<z.ZodEnum<{
2094
+ "agents:read": "agents:read";
2095
+ "sessions:own": "sessions:own";
2096
+ "vaults:own": "vaults:own";
2097
+ }>>;
2098
+ agents: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>;
2099
+ keyId: z.ZodString;
2100
+ }, z.core.$strict>;
2101
+ export type CreateTokenResponse = z.infer<typeof CreateTokenResponseSchema>;
2102
+ export declare const SIGNING_KEY_STATES: readonly ["standby", "current", "previous", "revoked"];
2103
+ export type SigningKeyState = (typeof SIGNING_KEY_STATES)[number];
2104
+ /** A public JSON Web Key as the JWKS publishes it. */
2105
+ export declare const PublicJwkSchema: z.ZodObject<{
2106
+ kty: z.ZodLiteral<"EC">;
2107
+ crv: z.ZodLiteral<"P-256">;
2108
+ x: z.ZodString;
2109
+ y: z.ZodString;
2110
+ kid: z.ZodString;
2111
+ alg: z.ZodLiteral<"ES256">;
2112
+ use: z.ZodLiteral<"sig">;
2113
+ }, z.core.$strict>;
2114
+ export type PublicJwk = z.infer<typeof PublicJwkSchema>;
2115
+ export declare const SigningKeyViewSchema: z.ZodObject<{
2116
+ id: z.ZodString;
2117
+ state: z.ZodEnum<{
2118
+ current: "current";
2119
+ previous: "previous";
2120
+ revoked: "revoked";
2121
+ standby: "standby";
2122
+ }>;
2123
+ alg: z.ZodLiteral<"ES256">;
2124
+ publicKey: z.ZodObject<{
2125
+ kty: z.ZodLiteral<"EC">;
2126
+ crv: z.ZodLiteral<"P-256">;
2127
+ x: z.ZodString;
2128
+ y: z.ZodString;
2129
+ kid: z.ZodString;
2130
+ alg: z.ZodLiteral<"ES256">;
2131
+ use: z.ZodLiteral<"sig">;
2132
+ }, z.core.$strict>;
2133
+ createdAt: z.ZodString;
2134
+ activatedAt: z.ZodNullable<z.ZodString>;
2135
+ retiredAt: z.ZodNullable<z.ZodString>;
2136
+ revokedAt: z.ZodNullable<z.ZodString>;
2137
+ }, z.core.$strict>;
2138
+ export type SigningKeyView = z.infer<typeof SigningKeyViewSchema>;
2139
+ export declare const SigningKeyListSchema: z.ZodObject<{
2140
+ keys: z.ZodArray<z.ZodObject<{
2141
+ id: z.ZodString;
2142
+ state: z.ZodEnum<{
2143
+ current: "current";
2144
+ previous: "previous";
2145
+ revoked: "revoked";
2146
+ standby: "standby";
2147
+ }>;
2148
+ alg: z.ZodLiteral<"ES256">;
2149
+ publicKey: z.ZodObject<{
2150
+ kty: z.ZodLiteral<"EC">;
2151
+ crv: z.ZodLiteral<"P-256">;
2152
+ x: z.ZodString;
2153
+ y: z.ZodString;
2154
+ kid: z.ZodString;
2155
+ alg: z.ZodLiteral<"ES256">;
2156
+ use: z.ZodLiteral<"sig">;
2157
+ }, z.core.$strict>;
2158
+ createdAt: z.ZodString;
2159
+ activatedAt: z.ZodNullable<z.ZodString>;
2160
+ retiredAt: z.ZodNullable<z.ZodString>;
2161
+ revokedAt: z.ZodNullable<z.ZodString>;
2162
+ }, z.core.$strict>>;
2163
+ }, z.core.$strict>;
2164
+ export declare const JwksSchema: z.ZodObject<{
2165
+ keys: z.ZodArray<z.ZodObject<{
2166
+ kty: z.ZodLiteral<"EC">;
2167
+ crv: z.ZodLiteral<"P-256">;
2168
+ x: z.ZodString;
2169
+ y: z.ZodString;
2170
+ kid: z.ZodString;
2171
+ alg: z.ZodLiteral<"ES256">;
2172
+ use: z.ZodLiteral<"sig">;
2173
+ }, z.core.$strict>>;
2174
+ }, z.core.$strict>;
2175
+ export type Jwks = z.infer<typeof JwksSchema>;
2176
+ export declare const RotateSigningKeysRequestSchema: z.ZodObject<{
2177
+ requestId: z.ZodString;
2178
+ force: z.ZodOptional<z.ZodBoolean>;
2179
+ }, z.core.$strict>;
2180
+ export declare const RevokeSigningKeyRequestSchema: z.ZodObject<{
2181
+ requestId: z.ZodString;
2182
+ }, z.core.$strict>;
2183
+ export declare const RevokeSubjectRequestSchema: z.ZodObject<{
2184
+ requestId: z.ZodString;
2185
+ subject: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
2186
+ }, z.core.$strict>;
2187
+ export type RevokeSubjectRequest = z.infer<typeof RevokeSubjectRequestSchema>;
2188
+ export declare const RevokeSubjectResponseSchema: z.ZodObject<{
2189
+ subject: z.ZodString;
2190
+ epoch: z.ZodNumber;
2191
+ }, z.core.$strict>;
2192
+ /** The claims of a subject token, as the Runtime writes them. */
2193
+ export interface SubjectTokenClaims {
2194
+ iss: string;
2195
+ aud: string;
2196
+ /** Tenant id. */
2197
+ tnt: string;
2198
+ sub: string;
2199
+ role: string;
2200
+ /** Space-separated token scopes. */
2201
+ scp: string;
2202
+ /** The agents the mint narrowed the role to; absent when not narrowed. */
2203
+ agt?: string[];
2204
+ /** The subject's revocation epoch when minted. */
2205
+ epc: number;
2206
+ iat: number;
2207
+ exp: number;
2208
+ jti: string;
2209
+ }
2210
+ /** Loopback origins with any port, for development: `http://localhost:*`, `http://127.0.0.1:*`. */
2211
+ export declare const LOOPBACK_ORIGIN_WILDCARDS: readonly ["http://localhost:*", "http://127.0.0.1:*"];
2212
+ /** True for a serialized web origin: `scheme://host[:port]`, lowercase, no path. */
2213
+ export declare function isSerializedOrigin(value: string): boolean;
2214
+ /** An origin allowlist entry: an exact origin or a loopback wildcard. */
2215
+ export declare const OriginEntrySchema: z.ZodString;
2216
+ /** True when `origin` (a request's `Origin`) is allowed by `origins`. */
2217
+ export declare function originAllowed(origins: readonly string[], origin: string): boolean;
2218
+ export declare const PublishableKeySchema: z.ZodObject<{
2219
+ id: z.ZodString;
2220
+ name: z.ZodString;
2221
+ key: z.ZodString;
2222
+ origins: z.ZodArray<z.ZodString>;
2223
+ createdAt: z.ZodString;
2224
+ revokedAt: z.ZodNullable<z.ZodString>;
2225
+ }, z.core.$strict>;
2226
+ export type PublishableKey = z.infer<typeof PublishableKeySchema>;
2227
+ export declare const CreatePublishableKeyRequestSchema: z.ZodObject<{
2228
+ requestId: z.ZodString;
2229
+ name: z.ZodString;
2230
+ origins: z.ZodArray<z.ZodString>;
2231
+ }, z.core.$strict>;
2232
+ export type CreatePublishableKeyRequest = z.infer<typeof CreatePublishableKeyRequestSchema>;
2233
+ export declare const UpdatePublishableKeyRequestSchema: z.ZodObject<{
2234
+ requestId: z.ZodString;
2235
+ origins: z.ZodArray<z.ZodString>;
2236
+ }, z.core.$strict>;
2237
+ /** `GET /v1/agents` with an application key: every definition, manifest included. */
2238
+ export declare const AgentDefinitionViewSchema: z.ZodObject<{
2239
+ agentId: z.ZodString;
2240
+ manifest: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2241
+ manifestHash: z.ZodString;
2242
+ implementationVersion: z.ZodString;
2243
+ }, z.core.$strict>;
2244
+ export type AgentDefinitionView = z.infer<typeof AgentDefinitionViewSchema>;
2245
+ export declare const ListAgentsResponseSchema: z.ZodObject<{
2246
+ agents: z.ZodArray<z.ZodObject<{
2247
+ agentId: z.ZodString;
2248
+ manifest: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2249
+ manifestHash: z.ZodString;
2250
+ implementationVersion: z.ZodString;
2251
+ }, z.core.$strict>>;
2252
+ }, z.core.$strict>;
2253
+ export type ListAgentsResponse = z.infer<typeof ListAgentsResponseSchema>;
2254
+ /** `GET /v1/agents` with a subject token or publishable key: the allowed agents' names only. */
2255
+ export declare const PublicAgentSchema: z.ZodObject<{
2256
+ agentId: z.ZodString;
2257
+ name: z.ZodOptional<z.ZodString>;
2258
+ description: z.ZodOptional<z.ZodString>;
2259
+ }, z.core.$strict>;
2260
+ export type PublicAgent = z.infer<typeof PublicAgentSchema>;
2261
+ export declare const ListPublicAgentsResponseSchema: z.ZodObject<{
2262
+ agents: z.ZodArray<z.ZodObject<{
2263
+ agentId: z.ZodString;
2264
+ name: z.ZodOptional<z.ZodString>;
2265
+ description: z.ZodOptional<z.ZodString>;
2266
+ }, z.core.$strict>>;
2267
+ }, z.core.$strict>;
2268
+ export type ListPublicAgentsResponse = z.infer<typeof ListPublicAgentsResponseSchema>;
2269
+ export declare const PutAgentResponseSchema: z.ZodObject<{
2270
+ agentId: z.ZodString;
2271
+ manifestHash: z.ZodString;
2272
+ implementationVersion: z.ZodString;
2273
+ }, z.core.$strict>;
2274
+ export type PutAgentResponse = z.infer<typeof PutAgentResponseSchema>;
2275
+ export declare const SESSION_STATUSES: readonly ["idle", "runnable", "running", "waiting", "paused", "uncertain", "completed", "failed", "cancelled"];
2276
+ export declare const SessionSummarySchema: z.ZodObject<{
2277
+ id: z.ZodString;
2278
+ agentId: z.ZodString;
2279
+ ownerUserId: z.ZodString;
2280
+ status: z.ZodEnum<{
2281
+ cancelled: "cancelled";
2282
+ completed: "completed";
2283
+ failed: "failed";
2284
+ idle: "idle";
2285
+ paused: "paused";
2286
+ runnable: "runnable";
2287
+ running: "running";
2288
+ uncertain: "uncertain";
2289
+ waiting: "waiting";
2290
+ }>;
2291
+ activeTurnId: z.ZodNullable<z.ZodString>;
2292
+ }, z.core.$strict>;
2293
+ export type SessionSummary = z.infer<typeof SessionSummarySchema>;
2294
+ export declare const ListSessionsResponseSchema: z.ZodObject<{
2295
+ sessions: z.ZodArray<z.ZodObject<{
2296
+ id: z.ZodString;
2297
+ agentId: z.ZodString;
2298
+ ownerUserId: z.ZodString;
2299
+ status: z.ZodEnum<{
2300
+ cancelled: "cancelled";
2301
+ completed: "completed";
2302
+ failed: "failed";
2303
+ idle: "idle";
2304
+ paused: "paused";
2305
+ runnable: "runnable";
2306
+ running: "running";
2307
+ uncertain: "uncertain";
2308
+ waiting: "waiting";
2309
+ }>;
2310
+ activeTurnId: z.ZodNullable<z.ZodString>;
2311
+ }, z.core.$strict>>;
2312
+ }, z.core.$strict>;
2313
+ export type ListSessionsResponse = z.infer<typeof ListSessionsResponseSchema>;
2314
+ /** `PUT` and `GET /v1/sessions/:id`. */
2315
+ export declare const SessionViewSchema: z.ZodObject<{
2316
+ id: z.ZodString;
2317
+ agentId: z.ZodString;
2318
+ ownerUserId: z.ZodString;
2319
+ manifestHash: z.ZodString;
2320
+ implementationVersion: z.ZodString;
2321
+ status: z.ZodEnum<{
2322
+ cancelled: "cancelled";
2323
+ completed: "completed";
2324
+ failed: "failed";
2325
+ idle: "idle";
2326
+ paused: "paused";
2327
+ runnable: "runnable";
2328
+ running: "running";
2329
+ uncertain: "uncertain";
2330
+ waiting: "waiting";
2331
+ }>;
2332
+ activeTurnId: z.ZodNullable<z.ZodString>;
2333
+ vaultIds: z.ZodArray<z.ZodString>;
2334
+ credentialSelections: z.ZodArray<z.ZodObject<{
2335
+ serverName: z.ZodString;
2336
+ credentialId: z.ZodString;
2337
+ }, z.core.$strict>>;
2338
+ sandboxOwnerId: z.ZodNullable<z.ZodString>;
2339
+ sandbox: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2340
+ sandboxSource: z.ZodOptional<z.ZodEnum<{
2341
+ default: "default";
2342
+ inline: "inline";
2343
+ shared: "shared";
2344
+ }>>;
2345
+ mcpSnapshot: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2346
+ mcpDiagnostics: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2347
+ waits: z.ZodOptional<z.ZodUnknown>;
2348
+ error: z.ZodOptional<z.ZodString>;
2349
+ actions: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
2350
+ actionId: z.ZodString;
2351
+ sessionId: z.ZodString;
2352
+ turnId: z.ZodString;
2353
+ agentId: z.ZodString;
2354
+ manifestHash: z.ZodString;
2355
+ implementationVersion: z.ZodString;
2356
+ input: z.ZodUnknown;
2357
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2358
+ status: z.ZodEnum<{
2359
+ cancelled: "cancelled";
2360
+ completed: "completed";
2361
+ delivering: "delivering";
2362
+ pending: "pending";
2363
+ uncertain: "uncertain";
2364
+ }>;
2365
+ generation: z.ZodNumber;
2366
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2367
+ agent: z.ZodOptional<z.ZodObject<{
2368
+ id: z.ZodString;
2369
+ path: z.ZodString;
2370
+ delegationId: z.ZodOptional<z.ZodString>;
2371
+ }, z.core.$strict>>;
2372
+ kind: z.ZodLiteral<"tool">;
2373
+ capabilityId: z.ZodString;
2374
+ toolName: z.ZodString;
2375
+ inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2376
+ outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2377
+ }, z.core.$strict>, z.ZodObject<{
2378
+ actionId: z.ZodString;
2379
+ sessionId: z.ZodString;
2380
+ turnId: z.ZodString;
2381
+ agentId: z.ZodString;
2382
+ manifestHash: z.ZodString;
2383
+ implementationVersion: z.ZodString;
2384
+ input: z.ZodUnknown;
2385
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2386
+ status: z.ZodEnum<{
2387
+ cancelled: "cancelled";
2388
+ completed: "completed";
2389
+ delivering: "delivering";
2390
+ pending: "pending";
2391
+ uncertain: "uncertain";
2392
+ }>;
2393
+ generation: z.ZodNumber;
2394
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2395
+ agent: z.ZodOptional<z.ZodObject<{
2396
+ id: z.ZodString;
2397
+ path: z.ZodString;
2398
+ delegationId: z.ZodOptional<z.ZodString>;
2399
+ }, z.core.$strict>>;
2400
+ kind: z.ZodLiteral<"tool">;
2401
+ path: z.ZodString;
2402
+ key: z.ZodString;
2403
+ inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2404
+ outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2405
+ }, z.core.$strict>, z.ZodObject<{
2406
+ actionId: z.ZodString;
2407
+ sessionId: z.ZodString;
2408
+ turnId: z.ZodString;
2409
+ agentId: z.ZodString;
2410
+ manifestHash: z.ZodString;
2411
+ implementationVersion: z.ZodString;
2412
+ input: z.ZodUnknown;
2413
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2414
+ status: z.ZodEnum<{
2415
+ cancelled: "cancelled";
2416
+ completed: "completed";
2417
+ delivering: "delivering";
2418
+ pending: "pending";
2419
+ uncertain: "uncertain";
2420
+ }>;
2421
+ generation: z.ZodNumber;
2422
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2423
+ agent: z.ZodOptional<z.ZodObject<{
2424
+ id: z.ZodString;
2425
+ path: z.ZodString;
2426
+ delegationId: z.ZodOptional<z.ZodString>;
2427
+ }, z.core.$strict>>;
2428
+ kind: z.ZodLiteral<"hook">;
2429
+ hook: z.ZodObject<{
2430
+ at: z.ZodEnum<{
2431
+ after: "after";
2432
+ before: "before";
2433
+ }>;
2434
+ scope: z.ZodEnum<{
2435
+ step: "step";
2436
+ turn: "turn";
2437
+ }>;
2438
+ capabilityIds: z.ZodArray<z.ZodString>;
2439
+ }, z.core.$strict>;
2440
+ }, z.core.$strict>, z.ZodObject<{
2441
+ actionId: z.ZodString;
2442
+ sessionId: z.ZodString;
2443
+ turnId: z.ZodString;
2444
+ agentId: z.ZodString;
2445
+ manifestHash: z.ZodString;
2446
+ implementationVersion: z.ZodString;
2447
+ input: z.ZodUnknown;
2448
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2449
+ status: z.ZodEnum<{
2450
+ cancelled: "cancelled";
2451
+ completed: "completed";
2452
+ delivering: "delivering";
2453
+ pending: "pending";
2454
+ uncertain: "uncertain";
2455
+ }>;
2456
+ generation: z.ZodNumber;
2457
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2458
+ agent: z.ZodOptional<z.ZodObject<{
2459
+ id: z.ZodString;
2460
+ path: z.ZodString;
2461
+ delegationId: z.ZodOptional<z.ZodString>;
2462
+ }, z.core.$strict>>;
2463
+ kind: z.ZodLiteral<"fn">;
2464
+ path: z.ZodString;
2465
+ key: z.ZodString;
2466
+ }, z.core.$strict>, z.ZodObject<{
2467
+ actionId: z.ZodString;
2468
+ sessionId: z.ZodString;
2469
+ turnId: z.ZodString;
2470
+ agentId: z.ZodString;
2471
+ manifestHash: z.ZodString;
2472
+ implementationVersion: z.ZodString;
2473
+ input: z.ZodUnknown;
2474
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2475
+ status: z.ZodEnum<{
2476
+ cancelled: "cancelled";
2477
+ completed: "completed";
2478
+ delivering: "delivering";
2479
+ pending: "pending";
2480
+ uncertain: "uncertain";
2481
+ }>;
2482
+ generation: z.ZodNumber;
2483
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2484
+ agent: z.ZodOptional<z.ZodObject<{
2485
+ id: z.ZodString;
2486
+ path: z.ZodString;
2487
+ delegationId: z.ZodOptional<z.ZodString>;
2488
+ }, z.core.$strict>>;
2489
+ kind: z.ZodLiteral<"verify">;
2490
+ path: z.ZodString;
2491
+ key: z.ZodString;
2492
+ }, z.core.$strict>]>>;
2493
+ uncertainEffects: z.ZodArray<z.ZodObject<{
2494
+ effectId: z.ZodString;
2495
+ turnId: z.ZodString;
2496
+ kind: z.ZodString;
2497
+ error: z.ZodUnknown;
2498
+ }, z.core.$strict>>;
2499
+ }, z.core.$strict>;
2500
+ export type SessionView = z.infer<typeof SessionViewSchema>;
2501
+ /** A sandbox tool call's answer (`POST …/sandbox/:tool`): its output, or why it failed. */
2502
+ export declare const SandboxToolOutcomeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2503
+ kind: z.ZodLiteral<"completed">;
2504
+ output: z.ZodUnknown;
2505
+ }, z.core.$strict>, z.ZodObject<{
2506
+ kind: z.ZodLiteral<"failed">;
2507
+ code: z.ZodString;
2508
+ message: z.ZodString;
2509
+ }, z.core.$strict>], "kind">;
2510
+ export type SandboxToolOutcome = z.infer<typeof SandboxToolOutcomeSchema>;
2511
+ export declare const ResetTenantResponseSchema: z.ZodObject<{
2512
+ ok: z.ZodLiteral<true>;
2513
+ }, z.core.$strict>;
2514
+ export type ResetTenantResponse = z.infer<typeof ResetTenantResponseSchema>;
2515
+ /** `GET /v1/tenant/models`: public provider and model names, no credentials. */
2516
+ export declare const HostModelCatalogSchema: z.ZodObject<{
2517
+ providers: z.ZodArray<z.ZodObject<{
2518
+ id: z.ZodString;
2519
+ name: z.ZodString;
2520
+ models: z.ZodArray<z.ZodObject<{
2521
+ id: z.ZodString;
2522
+ name: z.ZodString;
2523
+ }, z.core.$strict>>;
2524
+ }, z.core.$strict>>;
2525
+ }, z.core.$strict>;
2526
+ export type HostModelCatalog = z.infer<typeof HostModelCatalogSchema>;
2527
+ export declare const HostModelProviderInfoSchema: z.ZodObject<{
2528
+ id: z.ZodString;
2529
+ name: z.ZodString;
2530
+ model: z.ZodString;
2531
+ authType: z.ZodEnum<{
2532
+ api_key: "api_key";
2533
+ oauth: "oauth";
2534
+ }>;
2535
+ baseUrl: z.ZodOptional<z.ZodString>;
2536
+ settings: z.ZodOptional<z.ZodObject<{
2537
+ contextWindow: z.ZodOptional<z.ZodNumber>;
2538
+ maxTokens: z.ZodOptional<z.ZodNumber>;
2539
+ reasoning: z.ZodOptional<z.ZodBoolean>;
2540
+ compat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2541
+ }, z.core.$strict>>;
2542
+ lastUpdated: z.ZodString;
2543
+ active: z.ZodBoolean;
2544
+ }, z.core.$strict>;
2545
+ export declare const ListProvidersResponseSchema: z.ZodObject<{
2546
+ providers: z.ZodArray<z.ZodObject<{
2547
+ id: z.ZodString;
2548
+ name: z.ZodString;
2549
+ model: z.ZodString;
2550
+ authType: z.ZodEnum<{
2551
+ api_key: "api_key";
2552
+ oauth: "oauth";
2553
+ }>;
2554
+ baseUrl: z.ZodOptional<z.ZodString>;
2555
+ settings: z.ZodOptional<z.ZodObject<{
2556
+ contextWindow: z.ZodOptional<z.ZodNumber>;
2557
+ maxTokens: z.ZodOptional<z.ZodNumber>;
2558
+ reasoning: z.ZodOptional<z.ZodBoolean>;
2559
+ compat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2560
+ }, z.core.$strict>>;
2561
+ lastUpdated: z.ZodString;
2562
+ active: z.ZodBoolean;
2563
+ }, z.core.$strict>>;
2564
+ }, z.core.$strict>;
2565
+ export type ListProvidersResponse = z.infer<typeof ListProvidersResponseSchema>;
2566
+ /** A Tenant's sandbox configuration with every default applied (sizes in MiB). */
2567
+ export declare const EffectiveSandboxConfigSchema: z.ZodObject<{
2568
+ default: z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"virtual">, z.ZodObject<{
2569
+ image: z.ZodOptional<z.ZodString>;
2570
+ network: z.ZodOptional<z.ZodObject<{
2571
+ allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
2572
+ }, z.core.$strict>>;
2573
+ resources: z.ZodOptional<z.ZodObject<{
2574
+ cpus: z.ZodOptional<z.ZodNumber>;
2575
+ memory: z.ZodOptional<z.ZodString>;
2576
+ }, z.core.$strict>>;
2577
+ }, z.core.$strict>]>;
2578
+ limits: z.ZodObject<{
2579
+ network: z.ZodArray<z.ZodString>;
2580
+ resources: z.ZodObject<{
2581
+ cpus: z.ZodNumber;
2582
+ memoryMiB: z.ZodNumber;
2583
+ }, z.core.$strict>;
2584
+ defaultResources: z.ZodObject<{
2585
+ cpus: z.ZodNumber;
2586
+ memoryMiB: z.ZodNumber;
2587
+ }, z.core.$strict>;
2588
+ idle: z.ZodString;
2589
+ }, z.core.$strict>;
2590
+ }, z.core.$strict>;
2591
+ export type EffectiveSandboxConfig = z.infer<typeof EffectiveSandboxConfigSchema>;
2592
+ /** `GET` and `PUT /v1/tenant/sandbox`: the backend chosen, and the configuration in force. */
2593
+ export declare const TenantSandboxViewSchema: z.ZodObject<{
2594
+ preference: z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodEnum<{
2595
+ virtual: "virtual";
2596
+ }>]>;
2597
+ backend: z.ZodNullable<z.ZodEnum<{
2598
+ virtual: "virtual";
2599
+ }>>;
2600
+ isolation: z.ZodNullable<z.ZodEnum<{
2601
+ container: "container";
2602
+ process: "process";
2603
+ }>>;
2604
+ reason: z.ZodString;
2605
+ probes: z.ZodArray<z.ZodObject<{
2606
+ name: z.ZodEnum<{
2607
+ virtual: "virtual";
2608
+ }>;
2609
+ available: z.ZodBoolean;
2610
+ isolation: z.ZodEnum<{
2611
+ container: "container";
2612
+ process: "process";
2613
+ }>;
2614
+ reason: z.ZodOptional<z.ZodString>;
2615
+ version: z.ZodOptional<z.ZodString>;
2616
+ }, z.core.$strict>>;
2617
+ defaultImage: z.ZodString;
2618
+ config: z.ZodObject<{
2619
+ default: z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"virtual">, z.ZodObject<{
2620
+ image: z.ZodOptional<z.ZodString>;
2621
+ network: z.ZodOptional<z.ZodObject<{
2622
+ allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
2623
+ }, z.core.$strict>>;
2624
+ resources: z.ZodOptional<z.ZodObject<{
2625
+ cpus: z.ZodOptional<z.ZodNumber>;
2626
+ memory: z.ZodOptional<z.ZodString>;
2627
+ }, z.core.$strict>>;
2628
+ }, z.core.$strict>]>;
2629
+ limits: z.ZodObject<{
2630
+ network: z.ZodArray<z.ZodString>;
2631
+ resources: z.ZodObject<{
2632
+ cpus: z.ZodNumber;
2633
+ memoryMiB: z.ZodNumber;
2634
+ }, z.core.$strict>;
2635
+ defaultResources: z.ZodObject<{
2636
+ cpus: z.ZodNumber;
2637
+ memoryMiB: z.ZodNumber;
2638
+ }, z.core.$strict>;
2639
+ idle: z.ZodString;
2640
+ }, z.core.$strict>;
2641
+ }, z.core.$strict>;
2642
+ }, z.core.$strict>;
2643
+ export type TenantSandboxView = z.infer<typeof TenantSandboxViewSchema>;
2644
+ /** What a usage total or a budget covers: the whole Tenant, one agent, or one turn. */
2645
+ export declare const ModelUsageScopeSchema: z.ZodEnum<{
2646
+ agent: "agent";
2647
+ tenant: "tenant";
2648
+ turn: "turn";
2649
+ }>;
2650
+ export type ModelUsageScope = z.infer<typeof ModelUsageScopeSchema>;
2651
+ /** `GET /v1/tenant/usage`: which rows of the model usage ledger to total. */
2652
+ export declare const ModelUsageQuerySchema: z.ZodObject<{
2653
+ scope: z.ZodDefault<z.ZodEnum<{
2654
+ agent: "agent";
2655
+ tenant: "tenant";
2656
+ turn: "turn";
2657
+ }>>;
2658
+ id: z.ZodOptional<z.ZodString>;
2659
+ period: z.ZodDefault<z.ZodEnum<{
2660
+ day: "day";
2661
+ month: "month";
2662
+ total: "total";
2663
+ }>>;
2664
+ }, z.core.$strict>;
2665
+ export type ModelUsageQuery = z.infer<typeof ModelUsageQuerySchema>;
2666
+ /** The model calls the ledger recorded for one scope and period, and what they cost. */
2667
+ export declare const ModelUsageTotalsSchema: z.ZodObject<{
2668
+ scope: z.ZodEnum<{
2669
+ agent: "agent";
2670
+ tenant: "tenant";
2671
+ turn: "turn";
2672
+ }>;
2673
+ id: z.ZodOptional<z.ZodString>;
2674
+ period: z.ZodEnum<{
2675
+ day: "day";
2676
+ month: "month";
2677
+ total: "total";
2678
+ }>;
2679
+ since: z.ZodOptional<z.ZodString>;
2680
+ calls: z.ZodNumber;
2681
+ tokens: z.ZodNumber;
2682
+ costUsd: z.ZodNumber;
2683
+ }, z.core.$strict>;
2684
+ export type ModelUsageTotals = z.infer<typeof ModelUsageTotalsSchema>;
2685
+ /**
2686
+ * A hard cap on model spend. Before each call the model gate checks the scope's spend (and its
2687
+ * calls in flight) against the cap; once it is reached the call fails with `budget_exhausted`
2688
+ * and the turn with `model.budget_exhausted`.
2689
+ */
2690
+ export declare const ModelBudgetSchema: z.ZodObject<{
2691
+ scope: z.ZodEnum<{
2692
+ agent: "agent";
2693
+ tenant: "tenant";
2694
+ turn: "turn";
2695
+ }>;
2696
+ id: z.ZodOptional<z.ZodString>;
2697
+ period: z.ZodOptional<z.ZodEnum<{
2698
+ day: "day";
2699
+ month: "month";
2700
+ }>>;
2701
+ limitUsd: z.ZodOptional<z.ZodNumber>;
2702
+ limitTokens: z.ZodOptional<z.ZodNumber>;
2703
+ }, z.core.$strict>;
2704
+ export type ModelBudget = z.infer<typeof ModelBudgetSchema>;
2705
+ /** `PUT /v1/tenant/budgets`: replaces every budget. An empty list removes them all. */
2706
+ export declare const PutModelBudgetsRequestSchema: z.ZodObject<{
2707
+ requestId: z.ZodOptional<z.ZodString>;
2708
+ budgets: z.ZodArray<z.ZodObject<{
2709
+ scope: z.ZodEnum<{
2710
+ agent: "agent";
2711
+ tenant: "tenant";
2712
+ turn: "turn";
2713
+ }>;
2714
+ id: z.ZodOptional<z.ZodString>;
2715
+ period: z.ZodOptional<z.ZodEnum<{
2716
+ day: "day";
2717
+ month: "month";
2718
+ }>>;
2719
+ limitUsd: z.ZodOptional<z.ZodNumber>;
2720
+ limitTokens: z.ZodOptional<z.ZodNumber>;
2721
+ }, z.core.$strict>>;
2722
+ }, z.core.$strict>;
2723
+ export type PutModelBudgetsRequest = z.infer<typeof PutModelBudgetsRequestSchema>;
2724
+ export declare const ModelBudgetsSchema: z.ZodObject<{
2725
+ budgets: z.ZodArray<z.ZodObject<{
2726
+ scope: z.ZodEnum<{
2727
+ agent: "agent";
2728
+ tenant: "tenant";
2729
+ turn: "turn";
2730
+ }>;
2731
+ id: z.ZodOptional<z.ZodString>;
2732
+ period: z.ZodOptional<z.ZodEnum<{
2733
+ day: "day";
2734
+ month: "month";
2735
+ }>>;
2736
+ limitUsd: z.ZodOptional<z.ZodNumber>;
2737
+ limitTokens: z.ZodOptional<z.ZodNumber>;
2738
+ }, z.core.$strict>>;
2739
+ }, z.core.$strict>;
2740
+ export type ModelBudgets = z.infer<typeof ModelBudgetsSchema>;
2741
+ export declare const ListVaultsResponseSchema: z.ZodObject<{
2742
+ vaults: z.ZodArray<z.ZodObject<{
2743
+ id: z.ZodString;
2744
+ name: z.ZodString;
2745
+ ownerUserId: z.ZodString;
2746
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2747
+ createdAt: z.ZodString;
2748
+ }, z.core.$strict>>;
2749
+ }, z.core.$strict>;
2750
+ export type ListVaultsResponse = z.infer<typeof ListVaultsResponseSchema>;
2751
+ export declare const ListCredentialsResponseSchema: z.ZodObject<{
2752
+ credentials: z.ZodArray<z.ZodObject<{
2753
+ id: z.ZodString;
2754
+ vaultId: z.ZodString;
2755
+ name: z.ZodString;
2756
+ type: z.ZodEnum<{
2757
+ bearer: "bearer";
2758
+ oauth: "oauth";
2759
+ }>;
2760
+ binding: z.ZodObject<{
2761
+ url: z.ZodString;
2762
+ }, z.core.$strict>;
2763
+ expiresAt: z.ZodOptional<z.ZodString>;
2764
+ createdAt: z.ZodString;
2765
+ rotatedAt: z.ZodOptional<z.ZodString>;
2766
+ }, z.core.$strict>>;
2767
+ }, z.core.$strict>;
2768
+ export type ListCredentialsResponse = z.infer<typeof ListCredentialsResponseSchema>;
2769
+ /** A deleted vault or credential. */
2770
+ export declare const DeletedResponseSchema: z.ZodObject<{
2771
+ id: z.ZodString;
2772
+ }, z.core.$strict>;
2773
+ export type DeletedResponse = z.infer<typeof DeletedResponseSchema>;
2774
+ export declare const AccessPolicyResponseSchema: z.ZodObject<{
2775
+ policy: z.ZodObject<{
2776
+ version: z.ZodLiteral<1>;
2777
+ roles: z.ZodRecord<z.ZodString, z.ZodObject<{
2778
+ scopes: z.ZodArray<z.ZodEnum<{
2779
+ "agents:read": "agents:read";
2780
+ "sessions:own": "sessions:own";
2781
+ "vaults:own": "vaults:own";
2782
+ }>>;
2783
+ agents: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>;
2784
+ limits: z.ZodOptional<z.ZodObject<{
2785
+ turnsPerHour: z.ZodOptional<z.ZodNumber>;
2786
+ concurrentTurns: z.ZodOptional<z.ZodNumber>;
2787
+ }, z.core.$strict>>;
2788
+ }, z.core.$strict>>;
2789
+ anon: z.ZodObject<{
2790
+ scopes: z.ZodArray<z.ZodLiteral<"agents:read">>;
2791
+ agents: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>;
2792
+ }, z.core.$strict>;
2793
+ tokens: z.ZodObject<{
2794
+ maxTtlSeconds: z.ZodNumber;
2795
+ }, z.core.$strict>;
2796
+ }, z.core.$strict>;
2797
+ }, z.core.$strict>;
2798
+ export type AccessPolicyResponse = z.infer<typeof AccessPolicyResponseSchema>;
2799
+ export declare const ListPublishableKeysResponseSchema: z.ZodObject<{
2800
+ keys: z.ZodArray<z.ZodObject<{
2801
+ id: z.ZodString;
2802
+ name: z.ZodString;
2803
+ key: z.ZodString;
2804
+ origins: z.ZodArray<z.ZodString>;
2805
+ createdAt: z.ZodString;
2806
+ revokedAt: z.ZodNullable<z.ZodString>;
2807
+ }, z.core.$strict>>;
2808
+ }, z.core.$strict>;
2809
+ export type ListPublishableKeysResponse = z.infer<typeof ListPublishableKeysResponseSchema>;
2810
+ export declare const HostShutdownResponseSchema: z.ZodObject<{
2811
+ status: z.ZodLiteral<"shutting_down">;
2812
+ }, z.core.$strict>;
2813
+ /** The last frame of a session stream the Runtime ends: `event: nylorun.closed`. */
2814
+ export declare const StreamClosedFrameSchema: z.ZodObject<{
2815
+ reason: z.ZodEnum<{
2816
+ revoked: "revoked";
2817
+ token_expired: "token_expired";
2818
+ }>;
2819
+ }, z.core.$strict>;
2820
+ export type StreamClosedFrame = z.infer<typeof StreamClosedFrameSchema>;
2821
+ /**
2822
+ * The `code` of an AG-UI `RUN_ERROR` the Runtime sends: a rejection's code, or `session_busy`
2823
+ * (another turn is running) or `runtime_error` (the Runtime failed). Never an HTTP body's code.
2824
+ */
2825
+ export declare const AgUiRunErrorCodeSchema: z.ZodEnum<{
2826
+ connection_missing: "connection_missing";
2827
+ host_rejected: "host_rejected";
2828
+ incompatible_host: "incompatible_host";
2829
+ internal_error: "internal_error";
2830
+ invalid_request: "invalid_request";
2831
+ limit_exceeded: "limit_exceeded";
2832
+ not_found: "not_found";
2833
+ origin_rejected: "origin_rejected";
2834
+ protocol_unsupported: "protocol_unsupported";
2835
+ request_rejected: "request_rejected";
2836
+ runtime_error: "runtime_error";
2837
+ scope_required: "scope_required";
2838
+ session_busy: "session_busy";
2839
+ subject_invalid: "subject_invalid";
2840
+ subject_required: "subject_required";
2841
+ token_expired: "token_expired";
2842
+ unsupported_media_type: "unsupported_media_type";
2843
+ }>;
2844
+ export type AgUiRunErrorCode = z.infer<typeof AgUiRunErrorCodeSchema>;
2845
+ /** The JWT `typ` of a delivery token (RFC 8725 explicit typing). */
2846
+ export declare const DELIVERY_TOKEN_TYPE = "nylorun-delivery+jwt";
2847
+ /**
2848
+ * A delivery token lives no longer than a subject token: rotating signing keys revokes the
2849
+ * previous key once the longest token it may have signed has expired.
2850
+ */
2851
+ export declare const DELIVERY_TOKEN_MAX_TTL_SECONDS = 900;
2852
+ /** Inline delivery timeouts, in milliseconds. The maximum keeps a token within its lifetime. */
2853
+ export declare const ENDPOINT_TIMEOUT_DEFAULT_MS = 60000;
2854
+ export declare const ENDPOINT_TIMEOUT_MAX_MS: number;
2855
+ /** In-flight deliveries per endpoint when the registration does not say. */
2856
+ export declare const ENDPOINT_MAX_CONCURRENT_DEFAULT = 16;
2857
+ /** One agent's or workflow's Action endpoint, as the application registers it. */
2858
+ export declare const EndpointRegistrationSchema: z.ZodObject<{
2859
+ agentId: z.ZodString;
2860
+ url: z.ZodString;
2861
+ implementationVersion: z.ZodString;
2862
+ manifestHash: z.ZodOptional<z.ZodString>;
2863
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
2864
+ maxConcurrent: z.ZodOptional<z.ZodNumber>;
2865
+ }, z.core.$strict>;
2866
+ export type EndpointRegistration = z.infer<typeof EndpointRegistrationSchema>;
2867
+ export declare const PutEndpointsRequestSchema: z.ZodObject<{
2868
+ endpoints: z.ZodArray<z.ZodObject<{
2869
+ agentId: z.ZodString;
2870
+ url: z.ZodString;
2871
+ implementationVersion: z.ZodString;
2872
+ manifestHash: z.ZodOptional<z.ZodString>;
2873
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
2874
+ maxConcurrent: z.ZodOptional<z.ZodNumber>;
2875
+ }, z.core.$strict>>;
2876
+ }, z.core.$strict>;
2877
+ export type PutEndpointsRequest = z.infer<typeof PutEndpointsRequestSchema>;
2878
+ /** What recent deliveries and the last ping say about an endpoint. */
2879
+ export declare const EndpointHealthSchema: z.ZodObject<{
2880
+ lastDeliveryAt: z.ZodOptional<z.ZodString>;
2881
+ lastSuccessAt: z.ZodOptional<z.ZodString>;
2882
+ lastError: z.ZodOptional<z.ZodObject<{
2883
+ code: z.ZodString;
2884
+ message: z.ZodString;
2885
+ }, z.core.$strip>>;
2886
+ consecutiveFailures: z.ZodNumber;
2887
+ served: z.ZodOptional<z.ZodObject<{
2888
+ implementationVersion: z.ZodString;
2889
+ manifestHash: z.ZodOptional<z.ZodString>;
2890
+ }, z.core.$strict>>;
2891
+ }, z.core.$strict>;
2892
+ export type EndpointHealth = z.infer<typeof EndpointHealthSchema>;
2893
+ export declare const EndpointSchema: z.ZodObject<{
2894
+ agentId: z.ZodString;
2895
+ url: z.ZodString;
2896
+ implementationVersion: z.ZodString;
2897
+ manifestHash: z.ZodOptional<z.ZodString>;
2898
+ timeoutMs: z.ZodNumber;
2899
+ maxConcurrent: z.ZodNumber;
2900
+ health: z.ZodObject<{
2901
+ lastDeliveryAt: z.ZodOptional<z.ZodString>;
2902
+ lastSuccessAt: z.ZodOptional<z.ZodString>;
2903
+ lastError: z.ZodOptional<z.ZodObject<{
2904
+ code: z.ZodString;
2905
+ message: z.ZodString;
2906
+ }, z.core.$strip>>;
2907
+ consecutiveFailures: z.ZodNumber;
2908
+ served: z.ZodOptional<z.ZodObject<{
2909
+ implementationVersion: z.ZodString;
2910
+ manifestHash: z.ZodOptional<z.ZodString>;
2911
+ }, z.core.$strict>>;
2912
+ }, z.core.$strict>;
2913
+ updatedAt: z.ZodString;
2914
+ }, z.core.$strict>;
2915
+ export type Endpoint = z.infer<typeof EndpointSchema>;
2916
+ export declare const ListEndpointsResponseSchema: z.ZodObject<{
2917
+ endpoints: z.ZodArray<z.ZodObject<{
2918
+ agentId: z.ZodString;
2919
+ url: z.ZodString;
2920
+ implementationVersion: z.ZodString;
2921
+ manifestHash: z.ZodOptional<z.ZodString>;
2922
+ timeoutMs: z.ZodNumber;
2923
+ maxConcurrent: z.ZodNumber;
2924
+ health: z.ZodObject<{
2925
+ lastDeliveryAt: z.ZodOptional<z.ZodString>;
2926
+ lastSuccessAt: z.ZodOptional<z.ZodString>;
2927
+ lastError: z.ZodOptional<z.ZodObject<{
2928
+ code: z.ZodString;
2929
+ message: z.ZodString;
2930
+ }, z.core.$strip>>;
2931
+ consecutiveFailures: z.ZodNumber;
2932
+ served: z.ZodOptional<z.ZodObject<{
2933
+ implementationVersion: z.ZodString;
2934
+ manifestHash: z.ZodOptional<z.ZodString>;
2935
+ }, z.core.$strict>>;
2936
+ }, z.core.$strict>;
2937
+ updatedAt: z.ZodString;
2938
+ }, z.core.$strict>>;
2939
+ }, z.core.$strict>;
2940
+ export type ListEndpointsResponse = z.infer<typeof ListEndpointsResponseSchema>;
2941
+ export declare const DeleteEndpointResponseSchema: z.ZodObject<{
2942
+ agentId: z.ZodString;
2943
+ deleted: z.ZodLiteral<true>;
2944
+ }, z.core.$strict>;
2945
+ export type DeleteEndpointResponse = z.infer<typeof DeleteEndpointResponseSchema>;
2946
+ /** The body the Runtime POSTs to an Action endpoint. */
2947
+ export declare const ActionDeliverySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2948
+ type: z.ZodLiteral<"action">;
2949
+ action: z.ZodUnion<readonly [z.ZodObject<{
2950
+ actionId: z.ZodString;
2951
+ sessionId: z.ZodString;
2952
+ turnId: z.ZodString;
2953
+ agentId: z.ZodString;
2954
+ manifestHash: z.ZodString;
2955
+ implementationVersion: z.ZodString;
2956
+ input: z.ZodUnknown;
2957
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2958
+ status: z.ZodEnum<{
2959
+ cancelled: "cancelled";
2960
+ completed: "completed";
2961
+ delivering: "delivering";
2962
+ pending: "pending";
2963
+ uncertain: "uncertain";
2964
+ }>;
2965
+ generation: z.ZodNumber;
2966
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2967
+ agent: z.ZodOptional<z.ZodObject<{
2968
+ id: z.ZodString;
2969
+ path: z.ZodString;
2970
+ delegationId: z.ZodOptional<z.ZodString>;
2971
+ }, z.core.$strict>>;
2972
+ kind: z.ZodLiteral<"tool">;
2973
+ capabilityId: z.ZodString;
2974
+ toolName: z.ZodString;
2975
+ inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2976
+ outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2977
+ }, z.core.$strict>, z.ZodObject<{
2978
+ actionId: z.ZodString;
2979
+ sessionId: z.ZodString;
2980
+ turnId: z.ZodString;
2981
+ agentId: z.ZodString;
2982
+ manifestHash: z.ZodString;
2983
+ implementationVersion: z.ZodString;
2984
+ input: z.ZodUnknown;
2985
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2986
+ status: z.ZodEnum<{
2987
+ cancelled: "cancelled";
2988
+ completed: "completed";
2989
+ delivering: "delivering";
2990
+ pending: "pending";
2991
+ uncertain: "uncertain";
2992
+ }>;
2993
+ generation: z.ZodNumber;
2994
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2995
+ agent: z.ZodOptional<z.ZodObject<{
2996
+ id: z.ZodString;
2997
+ path: z.ZodString;
2998
+ delegationId: z.ZodOptional<z.ZodString>;
2999
+ }, z.core.$strict>>;
3000
+ kind: z.ZodLiteral<"tool">;
3001
+ path: z.ZodString;
3002
+ key: z.ZodString;
3003
+ inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3004
+ outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3005
+ }, z.core.$strict>, z.ZodObject<{
3006
+ actionId: z.ZodString;
3007
+ sessionId: z.ZodString;
3008
+ turnId: z.ZodString;
3009
+ agentId: z.ZodString;
3010
+ manifestHash: z.ZodString;
3011
+ implementationVersion: z.ZodString;
3012
+ input: z.ZodUnknown;
3013
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3014
+ status: z.ZodEnum<{
3015
+ cancelled: "cancelled";
3016
+ completed: "completed";
3017
+ delivering: "delivering";
3018
+ pending: "pending";
3019
+ uncertain: "uncertain";
3020
+ }>;
3021
+ generation: z.ZodNumber;
3022
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3023
+ agent: z.ZodOptional<z.ZodObject<{
3024
+ id: z.ZodString;
3025
+ path: z.ZodString;
3026
+ delegationId: z.ZodOptional<z.ZodString>;
3027
+ }, z.core.$strict>>;
3028
+ kind: z.ZodLiteral<"hook">;
3029
+ hook: z.ZodObject<{
3030
+ at: z.ZodEnum<{
3031
+ after: "after";
3032
+ before: "before";
3033
+ }>;
3034
+ scope: z.ZodEnum<{
3035
+ step: "step";
3036
+ turn: "turn";
3037
+ }>;
3038
+ capabilityIds: z.ZodArray<z.ZodString>;
3039
+ }, z.core.$strict>;
3040
+ }, z.core.$strict>, z.ZodObject<{
3041
+ actionId: z.ZodString;
3042
+ sessionId: z.ZodString;
3043
+ turnId: z.ZodString;
3044
+ agentId: z.ZodString;
3045
+ manifestHash: z.ZodString;
3046
+ implementationVersion: z.ZodString;
3047
+ input: z.ZodUnknown;
3048
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3049
+ status: z.ZodEnum<{
3050
+ cancelled: "cancelled";
3051
+ completed: "completed";
3052
+ delivering: "delivering";
3053
+ pending: "pending";
3054
+ uncertain: "uncertain";
3055
+ }>;
3056
+ generation: z.ZodNumber;
3057
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3058
+ agent: z.ZodOptional<z.ZodObject<{
3059
+ id: z.ZodString;
3060
+ path: z.ZodString;
3061
+ delegationId: z.ZodOptional<z.ZodString>;
3062
+ }, z.core.$strict>>;
3063
+ kind: z.ZodLiteral<"fn">;
3064
+ path: z.ZodString;
3065
+ key: z.ZodString;
3066
+ }, z.core.$strict>, z.ZodObject<{
3067
+ actionId: z.ZodString;
3068
+ sessionId: z.ZodString;
3069
+ turnId: z.ZodString;
3070
+ agentId: z.ZodString;
3071
+ manifestHash: z.ZodString;
3072
+ implementationVersion: z.ZodString;
3073
+ input: z.ZodUnknown;
3074
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3075
+ status: z.ZodEnum<{
3076
+ cancelled: "cancelled";
3077
+ completed: "completed";
3078
+ delivering: "delivering";
3079
+ pending: "pending";
3080
+ uncertain: "uncertain";
3081
+ }>;
3082
+ generation: z.ZodNumber;
3083
+ deadlineAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3084
+ agent: z.ZodOptional<z.ZodObject<{
3085
+ id: z.ZodString;
3086
+ path: z.ZodString;
3087
+ delegationId: z.ZodOptional<z.ZodString>;
3088
+ }, z.core.$strict>>;
3089
+ kind: z.ZodLiteral<"verify">;
3090
+ path: z.ZodString;
3091
+ key: z.ZodString;
3092
+ }, z.core.$strict>]>;
3093
+ sandbox: z.ZodBoolean;
3094
+ }, z.core.$strict>, z.ZodObject<{
3095
+ type: z.ZodLiteral<"ping">;
3096
+ agentId: z.ZodString;
3097
+ manifestHash: z.ZodOptional<z.ZodString>;
3098
+ }, z.core.$strict>], "type">;
3099
+ export type ActionDelivery = z.infer<typeof ActionDeliverySchema>;
3100
+ /** An Action endpoint's answer to a ping. */
3101
+ export declare const EndpointPingResponseSchema: z.ZodObject<{
3102
+ agentId: z.ZodString;
3103
+ implementationVersion: z.ZodString;
3104
+ manifestHash: z.ZodOptional<z.ZodString>;
3105
+ }, z.core.$strip>;
3106
+ export type EndpointPingResponse = z.infer<typeof EndpointPingResponseSchema>;
3107
+ /** The answer to a background delivery's heartbeat: a fresh token and the new deadline. */
3108
+ export declare const DeliveryHeartbeatResponseSchema: z.ZodObject<{
3109
+ token: z.ZodString;
3110
+ deadlineAt: z.ZodString;
3111
+ }, z.core.$strip>;
3112
+ export type DeliveryHeartbeatResponse = z.infer<typeof DeliveryHeartbeatResponseSchema>;
3113
+ /**
3114
+ * The receipt of a background result (`POST /v1/actions/:id/result`): a session command's
3115
+ * receipt without `requestId`, since the result carries none. The same result again returns it.
3116
+ */
3117
+ export declare const ActionResultReceiptSchema: z.ZodObject<{
3118
+ status: z.ZodLiteral<"accepted">;
3119
+ turnId: z.ZodNullable<z.ZodString>;
3120
+ cursor: z.ZodNullable<z.ZodString>;
3121
+ }, z.core.$strip>;
3122
+ export type ActionResultReceipt = z.infer<typeof ActionResultReceiptSchema>;
3123
+ /** `POST /_studio/login-tokens` body. No `tenant` mints a Host-wide token (the CLI's `{}`). */
3124
+ export declare const StudioLoginTokenRequestSchema: z.ZodObject<{
3125
+ tenant: z.ZodOptional<z.ZodString>;
3126
+ subject: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
3127
+ }, z.core.$strict>;
3128
+ export type StudioLoginTokenRequest = z.infer<typeof StudioLoginTokenRequestSchema>;
3129
+ export declare const StudioLoginTokenResponseSchema: z.ZodObject<{
3130
+ token: z.ZodString;
3131
+ url: z.ZodString;
3132
+ expiresAt: z.ZodString;
3133
+ tenant: z.ZodNullable<z.ZodString>;
3134
+ subject: z.ZodNullable<z.ZodString>;
3135
+ }, z.core.$strip>;
3136
+ export type StudioLoginTokenResponse = z.infer<typeof StudioLoginTokenResponseSchema>;
3137
+ /** `POST /_studio/sessions` body: the login token an embedder passed in `init`. */
3138
+ export declare const StudioSessionRequestSchema: z.ZodObject<{
3139
+ token: z.ZodString;
3140
+ }, z.core.$strict>;
3141
+ export type StudioSessionRequest = z.infer<typeof StudioSessionRequestSchema>;
3142
+ export declare const StudioSessionResponseSchema: z.ZodObject<{
3143
+ sessionToken: z.ZodString;
3144
+ tenant: z.ZodNullable<z.ZodString>;
3145
+ subject: z.ZodNullable<z.ZodString>;
3146
+ expiresAt: z.ZodString;
3147
+ }, z.core.$strip>;
3148
+ export type StudioSessionResponse = z.infer<typeof StudioSessionResponseSchema>;
3149
+ /** Message protocol versions this release speaks. */
3150
+ export declare const STUDIO_EMBED_PROTOCOLS: readonly [1];
3151
+ export declare const STUDIO_EMBED_MESSAGE_TYPE = "nylorun.studio";
3152
+ /** The embedder's theme. Unknown keys are dropped, not rejected. */
3153
+ export declare const StudioThemeSchema: z.ZodObject<{
3154
+ mode: z.ZodEnum<{
3155
+ dark: "dark";
3156
+ light: "light";
3157
+ }>;
3158
+ accent: z.ZodOptional<z.ZodString>;
3159
+ background: z.ZodOptional<z.ZodString>;
3160
+ foreground: z.ZodOptional<z.ZodString>;
3161
+ }, z.core.$strip>;
3162
+ export type StudioTheme = z.infer<typeof StudioThemeSchema>;
3163
+ /** Every message between an embedder and Studio (Studio design §8.8). */
3164
+ export declare const StudioEmbedMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3165
+ type: z.ZodLiteral<"nylorun.studio">;
3166
+ protocol: z.ZodNumber;
3167
+ kind: z.ZodLiteral<"ready">;
3168
+ protocols: z.ZodArray<z.ZodNumber>;
3169
+ studioVersion: z.ZodString;
3170
+ }, z.core.$strip>, z.ZodObject<{
3171
+ type: z.ZodLiteral<"nylorun.studio">;
3172
+ protocol: z.ZodNumber;
3173
+ kind: z.ZodLiteral<"init">;
3174
+ token: z.ZodString;
3175
+ theme: z.ZodOptional<z.ZodObject<{
3176
+ mode: z.ZodEnum<{
3177
+ dark: "dark";
3178
+ light: "light";
3179
+ }>;
3180
+ accent: z.ZodOptional<z.ZodString>;
3181
+ background: z.ZodOptional<z.ZodString>;
3182
+ foreground: z.ZodOptional<z.ZodString>;
3183
+ }, z.core.$strip>>;
3184
+ route: z.ZodOptional<z.ZodString>;
3185
+ }, z.core.$strip>, z.ZodObject<{
3186
+ type: z.ZodLiteral<"nylorun.studio">;
3187
+ protocol: z.ZodNumber;
3188
+ kind: z.ZodLiteral<"token.refresh">;
3189
+ token: z.ZodString;
3190
+ }, z.core.$strip>, z.ZodObject<{
3191
+ type: z.ZodLiteral<"nylorun.studio">;
3192
+ protocol: z.ZodNumber;
3193
+ kind: z.ZodLiteral<"theme.changed">;
3194
+ theme: z.ZodObject<{
3195
+ mode: z.ZodEnum<{
3196
+ dark: "dark";
3197
+ light: "light";
3198
+ }>;
3199
+ accent: z.ZodOptional<z.ZodString>;
3200
+ background: z.ZodOptional<z.ZodString>;
3201
+ foreground: z.ZodOptional<z.ZodString>;
3202
+ }, z.core.$strip>;
3203
+ }, z.core.$strip>, z.ZodObject<{
3204
+ type: z.ZodLiteral<"nylorun.studio">;
3205
+ protocol: z.ZodNumber;
3206
+ kind: z.ZodLiteral<"navigate">;
3207
+ route: z.ZodString;
3208
+ }, z.core.$strip>, z.ZodObject<{
3209
+ type: z.ZodLiteral<"nylorun.studio">;
3210
+ protocol: z.ZodNumber;
3211
+ kind: z.ZodLiteral<"session">;
3212
+ tenant: z.ZodNullable<z.ZodString>;
3213
+ subject: z.ZodNullable<z.ZodString>;
3214
+ expiresAt: z.ZodString;
3215
+ }, z.core.$strip>, z.ZodObject<{
3216
+ type: z.ZodLiteral<"nylorun.studio">;
3217
+ protocol: z.ZodNumber;
3218
+ kind: z.ZodLiteral<"token.expiring">;
3219
+ expiresAt: z.ZodNullable<z.ZodString>;
3220
+ }, z.core.$strip>, z.ZodObject<{
3221
+ type: z.ZodLiteral<"nylorun.studio">;
3222
+ protocol: z.ZodNumber;
3223
+ kind: z.ZodLiteral<"route.changed">;
3224
+ route: z.ZodString;
3225
+ }, z.core.$strip>, z.ZodObject<{
3226
+ type: z.ZodLiteral<"nylorun.studio">;
3227
+ protocol: z.ZodNumber;
3228
+ kind: z.ZodLiteral<"open.external">;
3229
+ url: z.ZodString;
3230
+ }, z.core.$strip>, z.ZodObject<{
3231
+ type: z.ZodLiteral<"nylorun.studio">;
3232
+ protocol: z.ZodNumber;
3233
+ kind: z.ZodLiteral<"open.babai">;
3234
+ sessionId: z.ZodString;
3235
+ }, z.core.$strip>, z.ZodObject<{
3236
+ type: z.ZodLiteral<"nylorun.studio">;
3237
+ protocol: z.ZodNumber;
3238
+ kind: z.ZodLiteral<"error">;
3239
+ code: z.ZodString;
3240
+ message: z.ZodString;
3241
+ }, z.core.$strip>], "kind">;
3242
+ export type StudioEmbedMessage = z.infer<typeof StudioEmbedMessageSchema>;
3243
+ export type StudioEmbedKind = StudioEmbedMessage["kind"];
3244
+ /** True for one exact embedder origin: `https://…`, `http://…` or `<custom>://host[:port]`. */
3245
+ export declare function isFrameAncestor(value: string): boolean;
3246
+ /**
3247
+ * Parses `NYLORUN_STUDIO_FRAME_ANCESTORS`: exact origins separated by whitespace. Wildcards,
3248
+ * keywords, scheme-only entries and paths are refused with the entry named. Empty gives `[]`.
3249
+ */
3250
+ export declare function parseFrameAncestors(value: string): string[];