@byok-sdk/protocol 0.30.1 → 0.31.0

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.
@@ -151,13 +151,6 @@ export declare const ConnHelloPayloadSchema: z.ZodObject<{
151
151
  cursor: z.ZodOptional<z.ZodNumber>;
152
152
  }, z.core.$strip>;
153
153
  export type ConnHelloPayload = z.infer<typeof ConnHelloPayloadSchema>;
154
- /** server -> daemon: handshake acknowledgement. */
155
- export declare const ConnAckPayloadSchema: z.ZodObject<{
156
- protocolVersion: z.ZodNumber;
157
- capabilities: z.ZodArray<z.ZodString>;
158
- serverTime: z.ZodISODateTime;
159
- }, z.core.$strip>;
160
- export type ConnAckPayload = z.infer<typeof ConnAckPayloadSchema>;
161
154
  /**
162
155
  * The web-selected runtime/model target carried end to end with a task.
163
156
  *
@@ -192,128 +185,8 @@ export declare const DispatchSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObje
192
185
  }, z.core.$strict>;
193
186
  }, z.core.$strict>], "lane">;
194
187
  export type DispatchSelection = z.infer<typeof DispatchSelectionSchema>;
195
- /**
196
- * server -> daemon: offer a task for a device to claim.
197
- *
198
- * `taskId` used to be duplicated here; it is now carried only by the
199
- * envelope's `task_id` (M1 gap #7 — single source of truth for routing).
200
- */
201
- export declare const TaskOfferPayloadSchema: z.ZodObject<{
202
- sealed: z.ZodOptional<z.ZodNever>;
203
- sealing: z.ZodOptional<z.ZodNever>;
204
- instruction: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
205
- blobRef: z.ZodObject<{
206
- blobId: z.ZodString;
207
- contentHash: z.ZodString;
208
- size: z.ZodNumber;
209
- contentType: z.ZodString;
210
- url: z.ZodOptional<z.ZodString>;
211
- }, z.core.$strip>;
212
- }, z.core.$strict>]>;
213
- runtime: z.ZodOptional<z.ZodEnum<{
214
- claude: "claude";
215
- codex: "codex";
216
- pi: "pi";
217
- }>>;
218
- harnessId: z.ZodOptional<z.ZodString>;
219
- dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
220
- lane: z.ZodLiteral<"subscription">;
221
- runtimeId: z.ZodEnum<{
222
- claude: "claude";
223
- codex: "codex";
224
- }>;
225
- providerId: z.ZodNull;
226
- modelId: z.ZodString;
227
- }, z.core.$strict>, z.ZodObject<{
228
- lane: z.ZodLiteral<"byok">;
229
- runtimeId: z.ZodLiteral<"pi">;
230
- providerId: z.ZodString;
231
- modelId: z.ZodString;
232
- }, z.core.$strict>, z.ZodObject<{
233
- lane: z.ZodLiteral<"byok-profile">;
234
- runtimeId: z.ZodLiteral<"pi">;
235
- providerProfile: z.ZodObject<{
236
- profileRef: z.ZodString;
237
- profileRevision: z.ZodString;
238
- profileHash: z.ZodString;
239
- modelId: z.ZodString;
240
- requiredCapabilities: z.ZodArray<z.ZodEnum<{
241
- "image-input": "image-input";
242
- }>>;
243
- }, z.core.$strict>;
244
- }, z.core.$strict>], "lane">>;
245
- sessionRef: z.ZodOptional<z.ZodString>;
246
- workspaceHint: z.ZodOptional<z.ZodString>;
247
- limits: z.ZodOptional<z.ZodObject<{
248
- maxDurationMs: z.ZodOptional<z.ZodNumber>;
249
- maxTokens: z.ZodOptional<z.ZodNumber>;
250
- }, z.core.$strip>>;
251
- }, z.core.$strip>;
252
- export type TaskOfferPayload = z.infer<typeof TaskOfferPayloadSchema>;
253
188
  /** Every named toolset is required; duplicates are rejected instead of silently de-duplicated. */
254
189
  export declare const RequiredToolsetsSchema: z.ZodArray<z.ZodString>;
255
- /**
256
- * Additive v1 offer variant for tasks whose semantics require local MCP
257
- * tools. This is a distinct message type rather than an optional field on
258
- * `task.offer`, so an older daemon can never strip an unknown optional control
259
- * field and run the task without its required tools. An unknown type is not
260
- * silently skipped either: on long-poll it freezes the cursor, so the enqueue
261
- * capability gate is the real compatibility boundary. The whole payload is
262
- * strict because every field here affects execution authority.
263
- */
264
- export declare const TaskOfferWithToolsetsPayloadSchema: z.ZodObject<{
265
- sealed: z.ZodOptional<z.ZodNever>;
266
- sealing: z.ZodOptional<z.ZodNever>;
267
- instruction: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
268
- blobRef: z.ZodObject<{
269
- blobId: z.ZodString;
270
- contentHash: z.ZodString;
271
- size: z.ZodNumber;
272
- contentType: z.ZodString;
273
- url: z.ZodOptional<z.ZodString>;
274
- }, z.core.$strip>;
275
- }, z.core.$strict>]>;
276
- runtime: z.ZodOptional<z.ZodEnum<{
277
- claude: "claude";
278
- codex: "codex";
279
- pi: "pi";
280
- }>>;
281
- harnessId: z.ZodOptional<z.ZodString>;
282
- dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
283
- lane: z.ZodLiteral<"subscription">;
284
- runtimeId: z.ZodEnum<{
285
- claude: "claude";
286
- codex: "codex";
287
- }>;
288
- providerId: z.ZodNull;
289
- modelId: z.ZodString;
290
- }, z.core.$strict>, z.ZodObject<{
291
- lane: z.ZodLiteral<"byok">;
292
- runtimeId: z.ZodLiteral<"pi">;
293
- providerId: z.ZodString;
294
- modelId: z.ZodString;
295
- }, z.core.$strict>, z.ZodObject<{
296
- lane: z.ZodLiteral<"byok-profile">;
297
- runtimeId: z.ZodLiteral<"pi">;
298
- providerProfile: z.ZodObject<{
299
- profileRef: z.ZodString;
300
- profileRevision: z.ZodString;
301
- profileHash: z.ZodString;
302
- modelId: z.ZodString;
303
- requiredCapabilities: z.ZodArray<z.ZodEnum<{
304
- "image-input": "image-input";
305
- }>>;
306
- }, z.core.$strict>;
307
- }, z.core.$strict>], "lane">>;
308
- sessionRef: z.ZodOptional<z.ZodString>;
309
- workspaceHint: z.ZodOptional<z.ZodString>;
310
- limits: z.ZodOptional<z.ZodObject<{
311
- maxDurationMs: z.ZodOptional<z.ZodNumber>;
312
- maxTokens: z.ZodOptional<z.ZodNumber>;
313
- }, z.core.$strip>>;
314
- requiredToolsets: z.ZodArray<z.ZodString>;
315
- }, z.core.$strict>;
316
- export type TaskOfferWithToolsetsPayload = z.infer<typeof TaskOfferWithToolsetsPayloadSchema>;
317
190
  /**
318
191
  * How an Agent Attempt uses its Agent home. `memory-reader` runs the Attempt
319
192
  * in its own run directory, `<home>/.byok/runs/<taskId>/`, beside other
@@ -345,32 +218,36 @@ export declare const AgentMemorySelectionSchema: z.ZodEnum<{
345
218
  }>;
346
219
  export type AgentMemorySelection = z.infer<typeof AgentMemorySelectionSchema>;
347
220
  /**
348
- * Strict additive offer for a durable host-owned Agent. An older daemon that
349
- * does not advertise `agent-home-contract` skips this distinct message type
350
- * instead of stripping identity and applying legacy workspace semantics.
351
- *
352
- * `agentMemory` selects the Agent memory of this one task (see
353
- * {@link AgentMemorySelectionSchema}). Absent keeps the daemon admission. A
354
- * host sends it only to a device that advertises `agent-memory-selection`. The
355
- * prepared offer replaces it with its own required selection.
221
+ * How a `task.offer` starts its runtime session. `resume` continues the named
222
+ * session; `fresh` lets the selected runtime mint one after start. It is
223
+ * required, so an offer without a resume reference is never read as fresh.
356
224
  */
357
- export declare const TaskOfferForAgentPayloadSchema: z.ZodObject<{
225
+ export declare const SessionSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
226
+ mode: z.ZodLiteral<"resume">;
227
+ sessionRef: z.ZodString;
228
+ }, z.core.$strict>, z.ZodObject<{
229
+ mode: z.ZodLiteral<"fresh">;
230
+ }, z.core.$strict>], "mode">;
231
+ export type SessionSelection = z.infer<typeof SessionSelectionSchema>;
232
+ /** server -> daemon: a `task.offer` of a task that is not sealed. */
233
+ export declare const TaskOfferPlainPayloadSchema: z.ZodObject<{
358
234
  sealed: z.ZodOptional<z.ZodNever>;
359
235
  sealing: z.ZodOptional<z.ZodNever>;
360
- instruction: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
361
- blobRef: z.ZodObject<{
362
- blobId: z.ZodString;
363
- contentHash: z.ZodString;
364
- size: z.ZodNumber;
365
- contentType: z.ZodString;
366
- url: z.ZodOptional<z.ZodString>;
367
- }, z.core.$strip>;
368
- }, z.core.$strict>]>;
369
236
  agentRef: z.ZodObject<{
370
237
  agentId: z.ZodString;
371
238
  profileRevision: z.ZodString;
372
239
  }, z.core.$strict>;
373
- homeAccess: z.ZodOptional<z.ZodLiteral<"memory-reader">>;
240
+ session: z.ZodDiscriminatedUnion<[z.ZodObject<{
241
+ mode: z.ZodLiteral<"resume">;
242
+ sessionRef: z.ZodString;
243
+ }, z.core.$strict>, z.ZodObject<{
244
+ mode: z.ZodLiteral<"fresh">;
245
+ }, z.core.$strict>], "mode">;
246
+ preparation: z.ZodOptional<z.ZodObject<{
247
+ reference: z.ZodString;
248
+ requestDigest: z.ZodString;
249
+ artifactDigest: z.ZodOptional<z.ZodString>;
250
+ }, z.core.$strict>>;
374
251
  agentMemory: z.ZodOptional<z.ZodEnum<{
375
252
  none: "none";
376
253
  read: "read";
@@ -378,6 +255,7 @@ export declare const TaskOfferForAgentPayloadSchema: z.ZodObject<{
378
255
  "read-write": "read-write";
379
256
  "read-write-if-admitted": "read-write-if-admitted";
380
257
  }>>;
258
+ homeAccess: z.ZodOptional<z.ZodLiteral<"memory-reader">>;
381
259
  requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
382
260
  runtime: z.ZodOptional<z.ZodEnum<{
383
261
  claude: "claude";
@@ -418,22 +296,48 @@ export declare const TaskOfferForAgentPayloadSchema: z.ZodObject<{
418
296
  contract: z.ZodString;
419
297
  schema: z.ZodCustom<import("./result-schema").ResultSchema, import("./result-schema").ResultSchema>;
420
298
  }, z.core.$strict>], "mode">>;
421
- sessionRef: z.ZodOptional<z.ZodString>;
422
299
  limits: z.ZodOptional<z.ZodObject<{
423
300
  maxDurationMs: z.ZodOptional<z.ZodNumber>;
424
301
  maxTokens: z.ZodOptional<z.ZodNumber>;
425
- }, z.core.$strip>>;
426
- }, z.core.$strict>;
427
- export type TaskOfferForAgentPayload = z.infer<typeof TaskOfferForAgentPayloadSchema>;
428
- /**
429
- * Strict Agent offer which consumes the typed egress policy. It is a distinct
430
- * message so an older Agent-home daemon cannot strip control data and proceed
431
- * with an unconsumed egress declaration.
432
- */
433
- export declare const TaskOfferForAgentWithEgressPayloadSchema: z.ZodObject<{
434
- sealed: z.ZodOptional<z.ZodNever>;
435
- sealing: z.ZodOptional<z.ZodNever>;
436
- instruction: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
302
+ }, z.core.$strict>>;
303
+ egressPolicy: z.ZodOptional<z.ZodObject<{
304
+ policyRevision: z.ZodString;
305
+ activity: z.ZodObject<{
306
+ delivery: z.ZodLiteral<"latest-value">;
307
+ maxCoalesceMs: z.ZodNumber;
308
+ maxEventBytes: z.ZodNumber;
309
+ }, z.core.$strict>;
310
+ reliable: z.ZodObject<{
311
+ maxPendingEventsPerAgent: z.ZodNumber;
312
+ maxPendingBytesPerAgent: z.ZodNumber;
313
+ maxPendingBytesPerTenant: z.ZodNumber;
314
+ }, z.core.$strict>;
315
+ transfers: z.ZodObject<{
316
+ workspace: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
317
+ maxBytes: z.ZodNumber;
318
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
319
+ }, z.core.$strict>]>;
320
+ transcript: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
321
+ maxBytes: z.ZodNumber;
322
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
323
+ }, z.core.$strict>]>;
324
+ artifact: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
325
+ maxBytes: z.ZodNumber;
326
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
327
+ }, z.core.$strict>]>;
328
+ }, z.core.$strict>;
329
+ }, z.core.$strict>>;
330
+ messageEgress: z.ZodOptional<z.ZodObject<{
331
+ mode: z.ZodLiteral<"required">;
332
+ contract: z.ZodString;
333
+ contentType: z.ZodEnum<{
334
+ "text/markdown": "text/markdown";
335
+ "text/plain": "text/plain";
336
+ }>;
337
+ maxBytes: z.ZodNumber;
338
+ }, z.core.$strict>>;
339
+ routineRef: z.ZodOptional<z.ZodNever>;
340
+ instruction: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
437
341
  blobRef: z.ZodObject<{
438
342
  blobId: z.ZodString;
439
343
  contentHash: z.ZodString;
@@ -441,12 +345,21 @@ export declare const TaskOfferForAgentWithEgressPayloadSchema: z.ZodObject<{
441
345
  contentType: z.ZodString;
442
346
  url: z.ZodOptional<z.ZodString>;
443
347
  }, z.core.$strip>;
444
- }, z.core.$strict>]>;
348
+ }, z.core.$strict>]>>;
349
+ }, z.core.$strict>;
350
+ export type TaskOfferPlainPayload = z.infer<typeof TaskOfferPlainPayloadSchema>;
351
+ /** server -> daemon: a `task.offer` of a sealed task. */
352
+ export declare const TaskOfferSealedPayloadSchema: z.ZodObject<{
445
353
  agentRef: z.ZodObject<{
446
354
  agentId: z.ZodString;
447
355
  profileRevision: z.ZodString;
448
356
  }, z.core.$strict>;
449
- homeAccess: z.ZodOptional<z.ZodLiteral<"memory-reader">>;
357
+ session: z.ZodDiscriminatedUnion<[z.ZodObject<{
358
+ mode: z.ZodLiteral<"resume">;
359
+ sessionRef: z.ZodString;
360
+ }, z.core.$strict>, z.ZodObject<{
361
+ mode: z.ZodLiteral<"fresh">;
362
+ }, z.core.$strict>], "mode">;
450
363
  agentMemory: z.ZodOptional<z.ZodEnum<{
451
364
  none: "none";
452
365
  read: "read";
@@ -454,6 +367,7 @@ export declare const TaskOfferForAgentWithEgressPayloadSchema: z.ZodObject<{
454
367
  "read-write": "read-write";
455
368
  "read-write-if-admitted": "read-write-if-admitted";
456
369
  }>>;
370
+ homeAccess: z.ZodOptional<z.ZodLiteral<"memory-reader">>;
457
371
  requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
458
372
  runtime: z.ZodOptional<z.ZodEnum<{
459
373
  claude: "claude";
@@ -497,9 +411,8 @@ export declare const TaskOfferForAgentWithEgressPayloadSchema: z.ZodObject<{
497
411
  limits: z.ZodOptional<z.ZodObject<{
498
412
  maxDurationMs: z.ZodOptional<z.ZodNumber>;
499
413
  maxTokens: z.ZodOptional<z.ZodNumber>;
500
- }, z.core.$strip>>;
501
- sessionRef: z.ZodString;
502
- egressPolicy: z.ZodObject<{
414
+ }, z.core.$strict>>;
415
+ egressPolicy: z.ZodOptional<z.ZodObject<{
503
416
  policyRevision: z.ZodString;
504
417
  activity: z.ZodObject<{
505
418
  delivery: z.ZodLiteral<"latest-value">;
@@ -525,7 +438,7 @@ export declare const TaskOfferForAgentWithEgressPayloadSchema: z.ZodObject<{
525
438
  allowedMimeTypes: z.ZodArray<z.ZodString>;
526
439
  }, z.core.$strict>]>;
527
440
  }, z.core.$strict>;
528
- }, z.core.$strict>;
441
+ }, z.core.$strict>>;
529
442
  messageEgress: z.ZodOptional<z.ZodObject<{
530
443
  mode: z.ZodLiteral<"required">;
531
444
  contract: z.ZodString;
@@ -535,18 +448,7 @@ export declare const TaskOfferForAgentWithEgressPayloadSchema: z.ZodObject<{
535
448
  }>;
536
449
  maxBytes: z.ZodNumber;
537
450
  }, z.core.$strict>>;
538
- }, z.core.$strict>;
539
- export type TaskOfferForAgentWithEgressPayload = z.infer<typeof TaskOfferForAgentWithEgressPayloadSchema>;
540
- /**
541
- * Strict fresh-session Agent egress offer. It deliberately omits `sessionRef`:
542
- * the selected runtime is the sole authority that can mint that identity after
543
- * start. This distinct message prevents a missing resume reference from being
544
- * interpreted as a fresh execution by an older daemon.
545
- */
546
- export declare const TaskOfferForAgentWithEgressFreshPayloadSchema: z.ZodObject<{
547
- sealed: z.ZodOptional<z.ZodNever>;
548
- sealing: z.ZodOptional<z.ZodNever>;
549
- instruction: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
451
+ instruction: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
550
452
  blobRef: z.ZodObject<{
551
453
  blobId: z.ZodString;
552
454
  contentHash: z.ZodString;
@@ -554,12 +456,74 @@ export declare const TaskOfferForAgentWithEgressFreshPayloadSchema: z.ZodObject<
554
456
  contentType: z.ZodString;
555
457
  url: z.ZodOptional<z.ZodString>;
556
458
  }, z.core.$strip>;
557
- }, z.core.$strict>]>;
459
+ }, z.core.$strict>]>>;
460
+ sealing: z.ZodObject<{
461
+ scopeId: z.ZodString;
462
+ epoch: z.ZodNumber;
463
+ categories: z.ZodArray<z.ZodEnum<{
464
+ "task-input": "task-input";
465
+ "task-output": "task-output";
466
+ }>>;
467
+ }, z.core.$strict>;
468
+ sealed: z.ZodOptional<z.ZodObject<{
469
+ v: z.ZodLiteral<1>;
470
+ suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
471
+ category: z.ZodLiteral<"task-input">;
472
+ scope: z.ZodObject<{
473
+ id: z.ZodString;
474
+ epoch: z.ZodNumber;
475
+ keyId: z.ZodString;
476
+ }, z.core.$strict>;
477
+ chainHead: z.ZodObject<{
478
+ seq: z.ZodNumber;
479
+ hash: z.ZodString;
480
+ }, z.core.$strict>;
481
+ sender: z.ZodString;
482
+ salt: z.ZodString;
483
+ nonce: z.ZodString;
484
+ paddedLength: z.ZodNumber;
485
+ contentMac: z.ZodString;
486
+ ciphertext: z.ZodOptional<z.ZodString>;
487
+ ciphertextRef: z.ZodOptional<z.ZodObject<{
488
+ blobId: z.ZodString;
489
+ contentHash: z.ZodString;
490
+ size: z.ZodNumber;
491
+ contentType: z.ZodString;
492
+ }, z.core.$strict>>;
493
+ }, z.core.$strict>>;
494
+ routineRef: z.ZodOptional<z.ZodObject<{
495
+ routineId: z.ZodString;
496
+ definitionVersion: z.ZodNumber;
497
+ notAfter: z.ZodString;
498
+ }, z.core.$strict>>;
499
+ preparation: z.ZodOptional<z.ZodNever>;
500
+ }, z.core.$strict>;
501
+ export type TaskOfferSealedPayload = z.infer<typeof TaskOfferSealedPayloadSchema>;
502
+ /**
503
+ * server -> daemon: the one task-opening offer. Both branches are strict, so a
504
+ * field this decoder does not know stops the daemon's cursor (the long-poll
505
+ * treats it like an unknown type) instead of being stripped. The plaintext
506
+ * branch comes first and refuses `sealing`, so a sealed offer always takes the
507
+ * sealed branch; narrow with `payload.sealing !== undefined`.
508
+ */
509
+ export declare const TaskOfferPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
510
+ sealed: z.ZodOptional<z.ZodNever>;
511
+ sealing: z.ZodOptional<z.ZodNever>;
558
512
  agentRef: z.ZodObject<{
559
513
  agentId: z.ZodString;
560
514
  profileRevision: z.ZodString;
561
515
  }, z.core.$strict>;
562
- homeAccess: z.ZodOptional<z.ZodLiteral<"memory-reader">>;
516
+ session: z.ZodDiscriminatedUnion<[z.ZodObject<{
517
+ mode: z.ZodLiteral<"resume">;
518
+ sessionRef: z.ZodString;
519
+ }, z.core.$strict>, z.ZodObject<{
520
+ mode: z.ZodLiteral<"fresh">;
521
+ }, z.core.$strict>], "mode">;
522
+ preparation: z.ZodOptional<z.ZodObject<{
523
+ reference: z.ZodString;
524
+ requestDigest: z.ZodString;
525
+ artifactDigest: z.ZodOptional<z.ZodString>;
526
+ }, z.core.$strict>>;
563
527
  agentMemory: z.ZodOptional<z.ZodEnum<{
564
528
  none: "none";
565
529
  read: "read";
@@ -567,6 +531,7 @@ export declare const TaskOfferForAgentWithEgressFreshPayloadSchema: z.ZodObject<
567
531
  "read-write": "read-write";
568
532
  "read-write-if-admitted": "read-write-if-admitted";
569
533
  }>>;
534
+ homeAccess: z.ZodOptional<z.ZodLiteral<"memory-reader">>;
570
535
  requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
571
536
  runtime: z.ZodOptional<z.ZodEnum<{
572
537
  claude: "claude";
@@ -610,8 +575,8 @@ export declare const TaskOfferForAgentWithEgressFreshPayloadSchema: z.ZodObject<
610
575
  limits: z.ZodOptional<z.ZodObject<{
611
576
  maxDurationMs: z.ZodOptional<z.ZodNumber>;
612
577
  maxTokens: z.ZodOptional<z.ZodNumber>;
613
- }, z.core.$strip>>;
614
- egressPolicy: z.ZodObject<{
578
+ }, z.core.$strict>>;
579
+ egressPolicy: z.ZodOptional<z.ZodObject<{
615
580
  policyRevision: z.ZodString;
616
581
  activity: z.ZodObject<{
617
582
  delivery: z.ZodLiteral<"latest-value">;
@@ -637,7 +602,7 @@ export declare const TaskOfferForAgentWithEgressFreshPayloadSchema: z.ZodObject<
637
602
  allowedMimeTypes: z.ZodArray<z.ZodString>;
638
603
  }, z.core.$strict>]>;
639
604
  }, z.core.$strict>;
640
- }, z.core.$strict>;
605
+ }, z.core.$strict>>;
641
606
  messageEgress: z.ZodOptional<z.ZodObject<{
642
607
  mode: z.ZodLiteral<"required">;
643
608
  contract: z.ZodString;
@@ -647,39 +612,38 @@ export declare const TaskOfferForAgentWithEgressFreshPayloadSchema: z.ZodObject<
647
612
  }>;
648
613
  maxBytes: z.ZodNumber;
649
614
  }, z.core.$strict>>;
650
- }, z.core.$strict>;
651
- export type TaskOfferForAgentWithEgressFreshPayload = z.infer<typeof TaskOfferForAgentWithEgressFreshPayloadSchema>;
652
- /**
653
- * Strict offer for an already-counted prepared Execution.
654
- *
655
- * A DISTINCT message type, not a `preparation` field added to
656
- * `task.offer_for_agent`, for the same N/N-1 reason the toolset and egress
657
- * variants are distinct. On long-poll, both an unknown message type and an
658
- * unknown key on a strict payload freeze the cursor. The enqueue capability
659
- * gate is the compatibility boundary: v6 requires a drain and paired upgrade,
660
- * with no dual token or dual read.
661
- *
662
- * It carries no `instruction`: the user request is already inside the frozen
663
- * envelope the referenced record retained, and an offer that carried both would
664
- * have two answers to what the runtime is about to send. `sessionRef` is absent
665
- * for the same structural reason the adapter refuses the pair — a prepared
666
- * Execution never resumes.
667
- *
668
- * Every value under `preparation` is the Host RE-PRESENTING what the device
669
- * already told it. The device compares each one against its own durable record
670
- * and declines non-retryably on any difference; nothing here is authority.
671
- */
672
- export declare const TaskOfferPreparedPayloadSchema: z.ZodObject<{
673
- sealed: z.ZodOptional<z.ZodNever>;
674
- sealing: z.ZodOptional<z.ZodNever>;
675
- agentRef: z.ZodObject<{
676
- agentId: z.ZodString;
677
- profileRevision: z.ZodString;
678
- }, z.core.$strict>;
679
- homeAccess: z.ZodOptional<z.ZodLiteral<"memory-reader">>;
680
- requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
681
- runtime: z.ZodOptional<z.ZodEnum<{
682
- claude: "claude";
615
+ routineRef: z.ZodOptional<z.ZodNever>;
616
+ instruction: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
617
+ blobRef: z.ZodObject<{
618
+ blobId: z.ZodString;
619
+ contentHash: z.ZodString;
620
+ size: z.ZodNumber;
621
+ contentType: z.ZodString;
622
+ url: z.ZodOptional<z.ZodString>;
623
+ }, z.core.$strip>;
624
+ }, z.core.$strict>]>>;
625
+ }, z.core.$strict>, z.ZodObject<{
626
+ agentRef: z.ZodObject<{
627
+ agentId: z.ZodString;
628
+ profileRevision: z.ZodString;
629
+ }, z.core.$strict>;
630
+ session: z.ZodDiscriminatedUnion<[z.ZodObject<{
631
+ mode: z.ZodLiteral<"resume">;
632
+ sessionRef: z.ZodString;
633
+ }, z.core.$strict>, z.ZodObject<{
634
+ mode: z.ZodLiteral<"fresh">;
635
+ }, z.core.$strict>], "mode">;
636
+ agentMemory: z.ZodOptional<z.ZodEnum<{
637
+ none: "none";
638
+ read: "read";
639
+ "read-if-admitted": "read-if-admitted";
640
+ "read-write": "read-write";
641
+ "read-write-if-admitted": "read-write-if-admitted";
642
+ }>>;
643
+ homeAccess: z.ZodOptional<z.ZodLiteral<"memory-reader">>;
644
+ requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
645
+ runtime: z.ZodOptional<z.ZodEnum<{
646
+ claude: "claude";
683
647
  codex: "codex";
684
648
  pi: "pi";
685
649
  }>>;
@@ -720,18 +684,8 @@ export declare const TaskOfferPreparedPayloadSchema: z.ZodObject<{
720
684
  limits: z.ZodOptional<z.ZodObject<{
721
685
  maxDurationMs: z.ZodOptional<z.ZodNumber>;
722
686
  maxTokens: z.ZodOptional<z.ZodNumber>;
723
- }, z.core.$strip>>;
724
- preparation: z.ZodObject<{
725
- reference: z.ZodString;
726
- requestDigest: z.ZodString;
727
- artifactDigest: z.ZodOptional<z.ZodString>;
728
- }, z.core.$strict>;
729
- agentMemory: z.ZodEnum<{
730
- none: "none";
731
- read: "read";
732
- "read-write": "read-write";
733
- }>;
734
- egressPolicy: z.ZodObject<{
687
+ }, z.core.$strict>>;
688
+ egressPolicy: z.ZodOptional<z.ZodObject<{
735
689
  policyRevision: z.ZodString;
736
690
  activity: z.ZodObject<{
737
691
  delivery: z.ZodLiteral<"latest-value">;
@@ -757,7 +711,7 @@ export declare const TaskOfferPreparedPayloadSchema: z.ZodObject<{
757
711
  allowedMimeTypes: z.ZodArray<z.ZodString>;
758
712
  }, z.core.$strict>]>;
759
713
  }, z.core.$strict>;
760
- }, z.core.$strict>;
714
+ }, z.core.$strict>>;
761
715
  messageEgress: z.ZodOptional<z.ZodObject<{
762
716
  mode: z.ZodLiteral<"required">;
763
717
  contract: z.ZodString;
@@ -767,8 +721,57 @@ export declare const TaskOfferPreparedPayloadSchema: z.ZodObject<{
767
721
  }>;
768
722
  maxBytes: z.ZodNumber;
769
723
  }, z.core.$strict>>;
770
- }, z.core.$strict>;
771
- export type TaskOfferPreparedPayload = z.infer<typeof TaskOfferPreparedPayloadSchema>;
724
+ instruction: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
725
+ blobRef: z.ZodObject<{
726
+ blobId: z.ZodString;
727
+ contentHash: z.ZodString;
728
+ size: z.ZodNumber;
729
+ contentType: z.ZodString;
730
+ url: z.ZodOptional<z.ZodString>;
731
+ }, z.core.$strip>;
732
+ }, z.core.$strict>]>>;
733
+ sealing: z.ZodObject<{
734
+ scopeId: z.ZodString;
735
+ epoch: z.ZodNumber;
736
+ categories: z.ZodArray<z.ZodEnum<{
737
+ "task-input": "task-input";
738
+ "task-output": "task-output";
739
+ }>>;
740
+ }, z.core.$strict>;
741
+ sealed: z.ZodOptional<z.ZodObject<{
742
+ v: z.ZodLiteral<1>;
743
+ suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
744
+ category: z.ZodLiteral<"task-input">;
745
+ scope: z.ZodObject<{
746
+ id: z.ZodString;
747
+ epoch: z.ZodNumber;
748
+ keyId: z.ZodString;
749
+ }, z.core.$strict>;
750
+ chainHead: z.ZodObject<{
751
+ seq: z.ZodNumber;
752
+ hash: z.ZodString;
753
+ }, z.core.$strict>;
754
+ sender: z.ZodString;
755
+ salt: z.ZodString;
756
+ nonce: z.ZodString;
757
+ paddedLength: z.ZodNumber;
758
+ contentMac: z.ZodString;
759
+ ciphertext: z.ZodOptional<z.ZodString>;
760
+ ciphertextRef: z.ZodOptional<z.ZodObject<{
761
+ blobId: z.ZodString;
762
+ contentHash: z.ZodString;
763
+ size: z.ZodNumber;
764
+ contentType: z.ZodString;
765
+ }, z.core.$strict>>;
766
+ }, z.core.$strict>>;
767
+ routineRef: z.ZodOptional<z.ZodObject<{
768
+ routineId: z.ZodString;
769
+ definitionVersion: z.ZodNumber;
770
+ notAfter: z.ZodString;
771
+ }, z.core.$strict>>;
772
+ preparation: z.ZodOptional<z.ZodNever>;
773
+ }, z.core.$strict>]>;
774
+ export type TaskOfferPayload = z.infer<typeof TaskOfferPayloadSchema>;
772
775
  /** Daemon -> cloud: one durable reliable-lane item, forwarded as the Agent produced it. */
773
776
  export declare const AgentEgressReliablePayloadSchema: z.ZodObject<{
774
777
  agentRef: z.ZodObject<{
@@ -1032,7 +1035,7 @@ export type AgentMemoryIntentAvailablePayload = z.infer<typeof AgentMemoryIntent
1032
1035
  * Server -> daemon: one task-free, exact-device remote input preparation.
1033
1036
  *
1034
1037
  * Distinct message type rather than an optional field on an existing one, for
1035
- * the same N/N-1 reason `task.offer_with_toolsets` is: an optional field could be
1038
+ * the same N/N-1 reason the Agent offers are: an optional field could be
1036
1039
  * legally STRIPPED by a daemon that predates this contract, which would then
1037
1040
  * answer as though a preparation it never performed had somehow been handled.
1038
1041
  * An unknown type (`parseMessage` -> `UnknownMessageTypeError`) is not skipped
@@ -1179,18 +1182,15 @@ export type AgentInputPreparationPayload = z.infer<typeof AgentInputPreparationP
1179
1182
  * `task.fail`/`task.cancelled` if resuming turns out to be impossible) — no
1180
1183
  * new ack message type is introduced. See docs/protocol.md "Approval flow".
1181
1184
  *
1182
- * `approvalId` (M5, additive-minor — docs/protocol.md §5.3): OPTIONAL target
1183
- * identity for the SPECIFIC pending approval this decision resolves, rather
1184
- * than "whichever one is currently pending" (the pre-M5 behavior, and still
1185
- * what happens when this field is absent — a legacy server that never
1186
- * learned an id, or one talking to a legacy daemon). When present, the
1187
- * daemon compares it against its own currently-dispatched approval id
1188
- * (`ActiveTask.pendingApprovalId`, `packages/client`'s `task-runner.ts`) and
1189
- * treats a mismatch as a stale, audit-only no-op instead of resolving
1190
- * whatever happens to be pending right now — see `TaskRunner.handleApprove`.
1185
+ * `approvalId` (required since v4): the SPECIFIC pending approval this
1186
+ * decision resolves. The daemon compares it against its own
1187
+ * currently-dispatched approval id (`ActiveTask.pendingApprovalId`,
1188
+ * `packages/client`'s `task-runner.ts`) and treats a mismatch as a stale,
1189
+ * audit-only no-op, so a late decision never lands on the task's next
1190
+ * approval — see `TaskRunner.handleApprove`.
1191
1191
  */
1192
1192
  export declare const TaskApprovePayloadSchema: z.ZodObject<{
1193
- approvalId: z.ZodOptional<z.ZodString>;
1193
+ approvalId: z.ZodString;
1194
1194
  }, z.core.$strip>;
1195
1195
  export type TaskApprovePayload = z.infer<typeof TaskApprovePayloadSchema>;
1196
1196
  /**
@@ -1201,13 +1201,13 @@ export type TaskApprovePayload = z.infer<typeof TaskApprovePayloadSchema>;
1201
1201
  * message just tells the daemon to stop, and the daemon reports the outcome
1202
1202
  * via its existing `task.fail` terminal message.
1203
1203
  *
1204
- * `approvalId` (M5, additive-minor — docs/protocol.md §5.3): same optional
1205
- * targeting semantics as `TaskApprovePayloadSchema.approvalId` above, applied
1206
- * to the reject path (`TaskRunner.handleReject`).
1204
+ * `approvalId` (required since v4): same targeting as
1205
+ * `TaskApprovePayloadSchema.approvalId` above, applied to the reject path
1206
+ * (`TaskRunner.handleReject`).
1207
1207
  */
1208
1208
  export declare const TaskRejectPayloadSchema: z.ZodObject<{
1209
1209
  reason: z.ZodOptional<z.ZodString>;
1210
- approvalId: z.ZodOptional<z.ZodString>;
1210
+ approvalId: z.ZodString;
1211
1211
  }, z.core.$strip>;
1212
1212
  export type TaskRejectPayload = z.infer<typeof TaskRejectPayloadSchema>;
1213
1213
  /**
@@ -1223,13 +1223,23 @@ export declare const TaskCancelPayloadSchema: z.ZodObject<{
1223
1223
  reason: z.ZodOptional<z.ZodString>;
1224
1224
  }, z.core.$strip>;
1225
1225
  export type TaskCancelPayload = z.infer<typeof TaskCancelPayloadSchema>;
1226
- /** server -> daemon: inject steering text into a running task. */
1227
- export declare const TaskSteerPayloadSchema: z.ZodObject<{
1228
- sealed: z.ZodOptional<z.ZodNever>;
1229
- sealing: z.ZodOptional<z.ZodNever>;
1230
- text: z.ZodString;
1231
- }, z.core.$strip>;
1232
- export type TaskSteerPayload = z.infer<typeof TaskSteerPayloadSchema>;
1226
+ /** Maximum offer admission duration, and of each phase in it (seven days). */
1227
+ export declare const OFFER_ADMISSION_MAX_DURATION_MS = 604800000;
1228
+ /**
1229
+ * #1014: how long this device spent admitting an offer, in milliseconds of its
1230
+ * monotonic clock, from receiving the offer to sending the claim or decline
1231
+ * that ends admission. A phase is present only when it ran; the time no phase
1232
+ * names is `totalMs` minus their sum.
1233
+ */
1234
+ export declare const OfferAdmissionTimingsSchema: z.ZodObject<{
1235
+ totalMs: z.ZodNumber;
1236
+ agentHomeWaitMs: z.ZodOptional<z.ZodNumber>;
1237
+ messageHelperPreflightMs: z.ZodOptional<z.ZodNumber>;
1238
+ resultHelperPreflightMs: z.ZodOptional<z.ZodNumber>;
1239
+ toolsetProbeMs: z.ZodOptional<z.ZodNumber>;
1240
+ runtimeLaunchMs: z.ZodOptional<z.ZodNumber>;
1241
+ }, z.core.$strict>;
1242
+ export type OfferAdmissionTimings = z.infer<typeof OfferAdmissionTimingsSchema>;
1233
1243
  /**
1234
1244
  * daemon -> server: claim an offered task (idempotent CAS on the server
1235
1245
  * side). `taskId` used to be duplicated here; it is now carried only by the
@@ -1239,18 +1249,17 @@ export type TaskSteerPayload = z.infer<typeof TaskSteerPayloadSchema>;
1239
1249
  * `task.started`.
1240
1250
  *
1241
1251
  * `runtime` (M5, additive-minor — docs/protocol.md §3.1): the ACTUAL
1242
- * adapter this device selected for the task, distinct from `task.offer`'s
1243
- * own `runtime` (the merely REQUESTED one, `TaskOfferPayloadSchema.runtime`
1252
+ * adapter this device selected for the task, distinct from the offer's
1253
+ * own `runtime` (the merely REQUESTED one, `TaskOfferPayloadSchema`'s `runtime`
1244
1254
  * above). When an offer names no runtime the daemon auto-selects (pi-first —
1245
1255
  * `TaskRunner.pickAdapter`, `packages/client`'s `task-runner.ts`), and before
1246
1256
  * this field existed the server had no way to learn which adapter actually
1247
1257
  * ran — `TaskSnapshot.runtime` (`packages/server`'s `types.ts`) only ever
1248
1258
  * recorded what was requested. Plain optional property on this already-
1249
1259
  * tolerant `z.object()`: an old server simply never reads it, so this needed
1250
- * no version bump and no emission gating (same shape as `approvalId` on
1251
- * `task.await_approval`/`task.approve`/`task.reject`, §5.3) — a new daemon
1252
- * sends it unconditionally, regardless of whether the connected server is
1253
- * new enough to store it.
1260
+ * no version bump and no emission gating — a new daemon sends it
1261
+ * unconditionally, regardless of whether the connected server is new enough
1262
+ * to store it.
1254
1263
  *
1255
1264
  * `capabilities` (S0/D-4, additive-minor — docs/protocol.md §2.4): the
1256
1265
  * TASK-level capability authority — what the claiming adapter reported about
@@ -1287,6 +1296,14 @@ export declare const TaskClaimPayloadSchema: z.ZodObject<{
1287
1296
  mcpToolsets: z.ZodOptional<z.ZodBoolean>;
1288
1297
  messageDraft: z.ZodOptional<z.ZodBoolean>;
1289
1298
  }, z.core.$strip>>;
1299
+ admission: z.ZodOptional<z.ZodObject<{
1300
+ totalMs: z.ZodNumber;
1301
+ agentHomeWaitMs: z.ZodOptional<z.ZodNumber>;
1302
+ messageHelperPreflightMs: z.ZodOptional<z.ZodNumber>;
1303
+ resultHelperPreflightMs: z.ZodOptional<z.ZodNumber>;
1304
+ toolsetProbeMs: z.ZodOptional<z.ZodNumber>;
1305
+ runtimeLaunchMs: z.ZodOptional<z.ZodNumber>;
1306
+ }, z.core.$strict>>;
1290
1307
  }, z.core.$strip>;
1291
1308
  export type TaskClaimPayload = z.infer<typeof TaskClaimPayloadSchema>;
1292
1309
  /**
@@ -1296,170 +1313,6 @@ export type TaskClaimPayload = z.infer<typeof TaskClaimPayloadSchema>;
1296
1313
  */
1297
1314
  export declare const TaskStartedPayloadSchema: z.ZodObject<{}, z.core.$strip>;
1298
1315
  export type TaskStartedPayload = z.infer<typeof TaskStartedPayloadSchema>;
1299
- /**
1300
- * #654: a sealed decline code names a fixed, non-retryable outcome and
1301
- * carries no content, so its `reason` is the code itself. A free-text reason
1302
- * or `retryable: true` never goes with it.
1303
- */
1304
- export declare const TaskDeclinePayloadSchema: z.ZodObject<{
1305
- sealed: z.ZodOptional<z.ZodNever>;
1306
- sealing: z.ZodOptional<z.ZodNever>;
1307
- reason: z.ZodString;
1308
- retryable: z.ZodOptional<z.ZodBoolean>;
1309
- agentRef: z.ZodOptional<z.ZodObject<{
1310
- agentId: z.ZodString;
1311
- profileRevision: z.ZodString;
1312
- }, z.core.$strict>>;
1313
- code: z.ZodOptional<z.ZodEnum<{
1314
- agent_home_reader_busy: "agent_home_reader_busy";
1315
- agent_home_writer_busy: "agent_home_writer_busy";
1316
- sealed_content_mac_mismatch: "sealed_content_mac_mismatch";
1317
- sealed_key_unavailable: "sealed_key_unavailable";
1318
- sealed_open_failed: "sealed_open_failed";
1319
- sealing_policy_mismatch: "sealing_policy_mismatch";
1320
- }>>;
1321
- }, z.core.$strip>;
1322
- export type TaskDeclinePayload = z.infer<typeof TaskDeclinePayloadSchema>;
1323
- /**
1324
- * daemon -> server: batch of normalized agent events.
1325
- *
1326
- * `events` elements are known-or-unknown (`AgentEventOrUnknownSchema` —
1327
- * `agent-event.ts`), not bare `AgentEventSchema`: pre-freeze, an unrecognized
1328
- * event `type` must not fail the whole batch, since a peer running a newer
1329
- * minor version may have emitted an additive event variant this schema
1330
- * doesn't know about yet. See `agent-event.ts` for the full rationale and
1331
- * `partitionAgentEvents`/`isKnownAgentEvent` for how consumers should skip
1332
- * unknowns instead of choking on them.
1333
- */
1334
- export declare const TaskProgressPayloadSchema: z.ZodObject<{
1335
- sealed: z.ZodOptional<z.ZodNever>;
1336
- sealing: z.ZodOptional<z.ZodNever>;
1337
- seq: z.ZodNumber;
1338
- events: z.ZodArray<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
1339
- type: z.ZodLiteral<"progress">;
1340
- text: z.ZodString;
1341
- }, z.core.$strip>, z.ZodObject<{
1342
- type: z.ZodLiteral<"tool_use">;
1343
- tool: z.ZodString;
1344
- mcp: z.ZodOptional<z.ZodObject<{
1345
- server: z.ZodString;
1346
- tool: z.ZodString;
1347
- }, z.core.$strict>>;
1348
- input: z.ZodOptional<z.ZodUnknown>;
1349
- toolCallId: z.ZodOptional<z.ZodString>;
1350
- spill: z.ZodOptional<z.ZodObject<{
1351
- field: z.ZodEnum<{
1352
- input: "input";
1353
- output: "output";
1354
- }>;
1355
- totalBytes: z.ZodNumber;
1356
- omittedBytes: z.ZodNumber;
1357
- contentType: z.ZodLiteral<"application/json">;
1358
- blob: z.ZodOptional<z.ZodObject<{
1359
- blobId: z.ZodString;
1360
- contentHash: z.ZodString;
1361
- size: z.ZodNumber;
1362
- contentType: z.ZodString;
1363
- url: z.ZodOptional<z.ZodString>;
1364
- }, z.core.$strip>>;
1365
- unstoredReason: z.ZodOptional<z.ZodString>;
1366
- }, z.core.$strict>>;
1367
- }, z.core.$strip>, z.ZodObject<{
1368
- type: z.ZodLiteral<"tool_result">;
1369
- tool: z.ZodString;
1370
- mcp: z.ZodOptional<z.ZodObject<{
1371
- server: z.ZodString;
1372
- tool: z.ZodString;
1373
- }, z.core.$strict>>;
1374
- output: z.ZodOptional<z.ZodUnknown>;
1375
- toolCallId: z.ZodOptional<z.ZodString>;
1376
- isError: z.ZodOptional<z.ZodBoolean>;
1377
- spill: z.ZodOptional<z.ZodObject<{
1378
- field: z.ZodEnum<{
1379
- input: "input";
1380
- output: "output";
1381
- }>;
1382
- totalBytes: z.ZodNumber;
1383
- omittedBytes: z.ZodNumber;
1384
- contentType: z.ZodLiteral<"application/json">;
1385
- blob: z.ZodOptional<z.ZodObject<{
1386
- blobId: z.ZodString;
1387
- contentHash: z.ZodString;
1388
- size: z.ZodNumber;
1389
- contentType: z.ZodString;
1390
- url: z.ZodOptional<z.ZodString>;
1391
- }, z.core.$strip>>;
1392
- unstoredReason: z.ZodOptional<z.ZodString>;
1393
- }, z.core.$strict>>;
1394
- }, z.core.$strip>, z.ZodObject<{
1395
- type: z.ZodLiteral<"artifact">;
1396
- name: z.ZodString;
1397
- contentType: z.ZodString;
1398
- }, z.core.$strip>, z.ZodObject<{
1399
- type: z.ZodLiteral<"needs_approval">;
1400
- summary: z.ZodString;
1401
- }, z.core.$strip>, z.ZodObject<{
1402
- type: z.ZodLiteral<"turn_end">;
1403
- }, z.core.$strip>, z.ZodObject<{
1404
- type: z.ZodLiteral<"error">;
1405
- message: z.ZodString;
1406
- }, z.core.$strip>, z.ZodObject<{
1407
- type: z.ZodLiteral<"usage">;
1408
- inputTokens: z.ZodOptional<z.ZodNumber>;
1409
- cachedInputTokens: z.ZodOptional<z.ZodNumber>;
1410
- outputTokens: z.ZodOptional<z.ZodNumber>;
1411
- reasoningTokens: z.ZodOptional<z.ZodNumber>;
1412
- totalTokens: z.ZodOptional<z.ZodNumber>;
1413
- contextTokens: z.ZodOptional<z.ZodNumber>;
1414
- contextWindow: z.ZodOptional<z.ZodNumber>;
1415
- contextSource: z.ZodOptional<z.ZodEnum<{
1416
- estimate: "estimate";
1417
- provider: "provider";
1418
- }>>;
1419
- }, z.core.$strip>], "type">, z.ZodObject<{
1420
- type: z.ZodString;
1421
- }, z.core.$loose>]>>;
1422
- }, z.core.$strip>;
1423
- export type TaskProgressPayload = z.infer<typeof TaskProgressPayloadSchema>;
1424
- /** daemon -> server: an artifact produced by the task, inline or by blob ref. */
1425
- export declare const TaskArtifactPayloadSchema: z.ZodObject<{
1426
- sealed: z.ZodOptional<z.ZodNever>;
1427
- sealing: z.ZodOptional<z.ZodNever>;
1428
- name: z.ZodString;
1429
- contentType: z.ZodString;
1430
- inline: z.ZodOptional<z.ZodString>;
1431
- blobRef: z.ZodOptional<z.ZodObject<{
1432
- blobId: z.ZodString;
1433
- contentHash: z.ZodString;
1434
- size: z.ZodNumber;
1435
- contentType: z.ZodString;
1436
- url: z.ZodOptional<z.ZodString>;
1437
- }, z.core.$strip>>;
1438
- }, z.core.$strip>;
1439
- export type TaskArtifactPayload = z.infer<typeof TaskArtifactPayloadSchema>;
1440
- /**
1441
- * daemon -> server: task is blocked on an out-of-band approval.
1442
- *
1443
- * `approvalId` (M5, additive-minor — docs/protocol.md §5.3): the daemon's own
1444
- * locally-generated identity for THIS SPECIFIC pending approval
1445
- * (`ApprovalRegistry`, `packages/client`'s `approvals.ts`) — included
1446
- * unconditionally by an M5+ daemon, regardless of whether the connected
1447
- * server has advertised the `approval-targeting` capability flag
1448
- * (`version.ts`; see that flag's own doc comment for why no emission gating
1449
- * is needed here — it's a tolerant `z.object()` field, so an older server
1450
- * simply ignores it). Optional purely for wire tolerance with a pre-M5
1451
- * daemon build that never set it at all: a server that never learns an id
1452
- * for a task's current approval can't target a later `approve`/`reject`
1453
- * decision and falls back to resolving "whichever approval is currently
1454
- * pending" — the same behavior every server had before this field existed.
1455
- */
1456
- export declare const TaskAwaitApprovalPayloadSchema: z.ZodObject<{
1457
- sealed: z.ZodOptional<z.ZodNever>;
1458
- sealing: z.ZodOptional<z.ZodNever>;
1459
- summary: z.ZodString;
1460
- approvalId: z.ZodOptional<z.ZodString>;
1461
- }, z.core.$strip>;
1462
- export type TaskAwaitApprovalPayload = z.infer<typeof TaskAwaitApprovalPayloadSchema>;
1463
1316
  /**
1464
1317
  * Hard cap (1 MiB) on a single `task.complete.document` (see
1465
1318
  * {@link TaskCompletePayloadSchema}), measured as the UTF-8 byte length of
@@ -1544,7 +1397,6 @@ export declare const TERMINAL_INFERENCE_USAGE_MAX_TOKENS = 1000000000;
1544
1397
  /** Maximum device-observed elapsed duration retained in one terminal observation (seven days). */
1545
1398
  export declare const TERMINAL_INFERENCE_USAGE_MAX_DURATION_MS = 604800000;
1546
1399
  export declare const TERMINAL_INFERENCE_USAGE_PROVIDER_MAX_LENGTH = 160;
1547
- export declare const TERMINAL_INFERENCE_USAGE_MODEL_MAX_LENGTH = 160;
1548
1400
  export declare const TERMINAL_INFERENCE_USAGE_CLIENT_VERSION_MAX_LENGTH = 128;
1549
1401
  /**
1550
1402
  * A bounded, non-billing observation associated with one terminal runtime
@@ -1646,45 +1498,126 @@ export declare const TerminalAgentHomeMemoryChangeSchema: z.ZodDiscriminatedUnio
1646
1498
  outcome: z.ZodLiteral<"unmeasured">;
1647
1499
  }, z.core.$strict>], "outcome">;
1648
1500
  export type TerminalAgentHomeMemoryChange = z.infer<typeof TerminalAgentHomeMemoryChangeSchema>;
1501
+ /** A closed runtime failure class (#869). `unknown` means the runtime gave no structured evidence. */
1502
+ export declare const RuntimeFailureClassSchema: z.ZodEnum<{
1503
+ auth: "auth";
1504
+ billing: "billing";
1505
+ input_too_large: "input_too_large";
1506
+ invalid_request: "invalid_request";
1507
+ limit_reached: "limit_reached";
1508
+ model_unavailable: "model_unavailable";
1509
+ output_schema: "output_schema";
1510
+ overloaded: "overloaded";
1511
+ provider: "provider";
1512
+ quota: "quota";
1513
+ rate_limited: "rate_limited";
1514
+ runtime_exited: "runtime_exited";
1515
+ unknown: "unknown";
1516
+ }>;
1517
+ export type RuntimeFailureClass = z.infer<typeof RuntimeFailureClassSchema>;
1649
1518
  /**
1650
- * daemon -> server: task finished successfully.
1651
- *
1652
- * `document` (docs/protocol.md §7.2): the OPTIONAL
1653
- * structured terminal result of the task — one JSON value the product on the
1654
- * other side consumes as the task's actual output, as opposed to `summary`
1655
- * (human-readable prose) or `artifactRefs` (files). Deliberately
1656
- * `z.unknown()`: this SDK never understands, validates, or transforms the
1657
- * product's own document schema — that validation belongs to the consumer.
1658
- * The only constraints the wire imposes are the ones
1659
- * {@link checkResultDocument} enforces: it must be PLAIN JSON DATA (equal to
1660
- * its own JSON round trip — see that function for why "stringify succeeded"
1661
- * is not enough), and its canonical JSON UTF-8 encoding must be at most
1662
- * {@link RESULT_DOCUMENT_MAX_BYTES}. An over-cap document is REJECTED here,
1663
- * never truncated (see that constant's own doc comment). A sender puts the
1664
- * check's `canonical` snapshot on the wire, never the original object.
1665
- *
1666
- * Wire v3: every v3 server keeps this field, so no capability flag gates it
1667
- * (the v2 `result-document` flag is gone). For a
1668
- * `terminalProjection.mode: 'result-document'` offer it carries the outcome
1669
- * the daemon validated against the offer's frozen schema
1670
- * (`validateResultOutcome`, `result-schema.ts`, at most
1671
- * `RESULT_OUTCOME_MAX_BYTES`).
1519
+ * The machine-readable failure of a `task.fail` (#869); `reason` stays display
1520
+ * text. `resetsAt` (ISO 8601 UTC) exists only on `quota`, and only when the
1521
+ * runtime reported when the limit resets.
1672
1522
  */
1673
- export declare const TaskCompletePayloadSchema: z.ZodObject<{
1674
- sealed: z.ZodOptional<z.ZodNever>;
1523
+ export declare const TaskFailureSchema: z.ZodUnion<readonly [z.ZodObject<{
1524
+ class: z.ZodLiteral<"quota">;
1525
+ resetsAt: z.ZodOptional<z.ZodISODateTime>;
1526
+ }, z.core.$strict>, z.ZodObject<{
1527
+ class: z.ZodEnum<{
1528
+ auth: "auth";
1529
+ billing: "billing";
1530
+ input_too_large: "input_too_large";
1531
+ invalid_request: "invalid_request";
1532
+ limit_reached: "limit_reached";
1533
+ model_unavailable: "model_unavailable";
1534
+ output_schema: "output_schema";
1535
+ overloaded: "overloaded";
1536
+ provider: "provider";
1537
+ rate_limited: "rate_limited";
1538
+ runtime_exited: "runtime_exited";
1539
+ unknown: "unknown";
1540
+ }>;
1541
+ }, z.core.$strict>]>;
1542
+ export type TaskFailure = z.infer<typeof TaskFailureSchema>;
1543
+ /**
1544
+ * daemon -> server: a pending `task.await_approval` was resolved entirely
1545
+ * LOCALLY on the device — the local control-socket `approvals.resolve` RPC,
1546
+ * a fail-closed `requestApproval` timeout, or a fail-closed eviction/finish
1547
+ * rejection (see `packages/client`'s `task-runner.ts`/`approvals.ts`) —
1548
+ * *without* a wire `task.approve`/`task.reject` ever having been exchanged
1549
+ * for it. Baseline since v4: the daemon reports every local resolution, and
1550
+ * this report is the server's only source for one; the server does not infer
1551
+ * a resolution from later task activity.
1552
+ *
1553
+ * Observability-class tolerance applies (not control/security — see the
1554
+ * freeze rule's asymmetry, `docs/protocol.md`): this is a daemon reporting
1555
+ * what it already did locally, not a payload that grants/denies anything on
1556
+ * its own — the receiving server's own state machine (`TASK_TRANSITIONS`,
1557
+ * `task-state.ts`) is still what decides whether the reported resolution is
1558
+ * legal to apply. Plain `z.object()` (not `.strict()`), same as every other
1559
+ * non-control payload in this file.
1560
+ *
1561
+ * `resolvedBy` is a single-value enum (`'local'`) rather than a bare string:
1562
+ * a later wave could add a DISTINCT value as a gated addition, while the
1563
+ * shape stays closed and typed today.
1564
+ */
1565
+ export declare const TaskApprovalResolvedPayloadSchema: z.ZodObject<{
1566
+ approvalId: z.ZodString;
1567
+ decision: z.ZodEnum<{
1568
+ approve: "approve";
1569
+ reject: "reject";
1570
+ }>;
1571
+ resolvedBy: z.ZodEnum<{
1572
+ local: "local";
1573
+ }>;
1574
+ at: z.ZodISODateTime;
1575
+ }, z.core.$strip>;
1576
+ export type TaskApprovalResolvedPayload = z.infer<typeof TaskApprovalResolvedPayloadSchema>;
1577
+ /**
1578
+ * server -> daemon: sealed steering text. `steerId` names this steer in the
1579
+ * AAD and the content MAC, so the Host cannot replay an earlier steer of the
1580
+ * same task as a new one.
1581
+ */
1582
+ export declare const TaskSteerSealedPayloadSchema: z.ZodObject<{
1583
+ steerId: z.ZodUUID;
1584
+ sealed: z.ZodObject<{
1585
+ v: z.ZodLiteral<1>;
1586
+ suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
1587
+ category: z.ZodLiteral<"task-input">;
1588
+ scope: z.ZodObject<{
1589
+ id: z.ZodString;
1590
+ epoch: z.ZodNumber;
1591
+ keyId: z.ZodString;
1592
+ }, z.core.$strict>;
1593
+ chainHead: z.ZodObject<{
1594
+ seq: z.ZodNumber;
1595
+ hash: z.ZodString;
1596
+ }, z.core.$strict>;
1597
+ sender: z.ZodString;
1598
+ salt: z.ZodString;
1599
+ nonce: z.ZodString;
1600
+ paddedLength: z.ZodNumber;
1601
+ contentMac: z.ZodString;
1602
+ ciphertext: z.ZodOptional<z.ZodString>;
1603
+ ciphertextRef: z.ZodOptional<z.ZodObject<{
1604
+ blobId: z.ZodString;
1605
+ contentHash: z.ZodString;
1606
+ size: z.ZodNumber;
1607
+ contentType: z.ZodString;
1608
+ }, z.core.$strict>>;
1609
+ }, z.core.$strict>;
1610
+ }, z.core.$strict>;
1611
+ export type TaskSteerSealedPayload = z.infer<typeof TaskSteerSealedPayloadSchema>;
1612
+ /**
1613
+ * daemon -> server: `task.complete` of a sealed task. `summary`,
1614
+ * `finalMessage` and `document` are sealed. `artifactRefs` and
1615
+ * `preparedObservation` are not carried in v1.
1616
+ */
1617
+ export declare const TaskCompleteSealedPayloadSchema: z.ZodObject<{
1675
1618
  sealing: z.ZodOptional<z.ZodNever>;
1676
1619
  harnessId: z.ZodOptional<z.ZodString>;
1677
- summary: z.ZodString;
1678
- finalMessage: z.ZodOptional<z.ZodString>;
1679
1620
  sessionRef: z.ZodString;
1680
- artifactRefs: z.ZodOptional<z.ZodArray<z.ZodObject<{
1681
- blobId: z.ZodString;
1682
- contentHash: z.ZodString;
1683
- size: z.ZodNumber;
1684
- contentType: z.ZodString;
1685
- url: z.ZodOptional<z.ZodString>;
1686
- }, z.core.$strip>>>;
1687
- document: z.ZodOptional<z.ZodUnknown>;
1688
1621
  usage: z.ZodOptional<z.ZodObject<{
1689
1622
  runtime: z.ZodEnum<{
1690
1623
  claude: "claude";
@@ -1699,11 +1632,6 @@ export declare const TaskCompletePayloadSchema: z.ZodObject<{
1699
1632
  clientVersion: z.ZodString;
1700
1633
  reportedAt: z.ZodISODateTime;
1701
1634
  }, z.core.$strip>>;
1702
- preparedObservation: z.ZodOptional<z.ZodObject<{
1703
- requestDigest: z.ZodString;
1704
- initialPromptTokens: z.ZodNumber;
1705
- maxPromptTokens: z.ZodNumber;
1706
- }, z.core.$strict>>;
1707
1635
  agentRef: z.ZodOptional<z.ZodObject<{
1708
1636
  agentId: z.ZodString;
1709
1637
  profileRevision: z.ZodString;
@@ -1723,60 +1651,42 @@ export declare const TaskCompletePayloadSchema: z.ZodObject<{
1723
1651
  }, z.core.$strict>, z.ZodObject<{
1724
1652
  outcome: z.ZodLiteral<"unmeasured">;
1725
1653
  }, z.core.$strict>], "outcome">>;
1726
- }, z.core.$strip>;
1727
- export type TaskCompletePayload = z.infer<typeof TaskCompletePayloadSchema>;
1728
- /** A closed runtime failure class (#869). `unknown` means the runtime gave no structured evidence. */
1729
- export declare const RuntimeFailureClassSchema: z.ZodEnum<{
1730
- auth: "auth";
1731
- billing: "billing";
1732
- input_too_large: "input_too_large";
1733
- invalid_request: "invalid_request";
1734
- limit_reached: "limit_reached";
1735
- model_unavailable: "model_unavailable";
1736
- output_schema: "output_schema";
1737
- overloaded: "overloaded";
1738
- provider: "provider";
1739
- quota: "quota";
1740
- rate_limited: "rate_limited";
1741
- runtime_exited: "runtime_exited";
1742
- unknown: "unknown";
1743
- }>;
1744
- export type RuntimeFailureClass = z.infer<typeof RuntimeFailureClassSchema>;
1745
- /**
1746
- * The machine-readable failure of a `task.fail` (#869); `reason` stays display
1747
- * text. `resetsAt` (ISO 8601 UTC) exists only on `quota`, and only when the
1748
- * runtime reported when the limit resets.
1749
- */
1750
- export declare const TaskFailureSchema: z.ZodUnion<readonly [z.ZodObject<{
1751
- class: z.ZodLiteral<"quota">;
1752
- resetsAt: z.ZodOptional<z.ZodISODateTime>;
1753
- }, z.core.$strict>, z.ZodObject<{
1754
- class: z.ZodEnum<{
1755
- auth: "auth";
1756
- billing: "billing";
1757
- input_too_large: "input_too_large";
1758
- invalid_request: "invalid_request";
1759
- limit_reached: "limit_reached";
1760
- model_unavailable: "model_unavailable";
1761
- output_schema: "output_schema";
1762
- overloaded: "overloaded";
1763
- provider: "provider";
1764
- rate_limited: "rate_limited";
1765
- runtime_exited: "runtime_exited";
1766
- unknown: "unknown";
1767
- }>;
1768
- }, z.core.$strict>]>;
1769
- export type TaskFailure = z.infer<typeof TaskFailureSchema>;
1770
- /** daemon -> server: task failed. */
1771
- export declare const TaskFailPayloadSchema: z.ZodObject<{
1772
- sealed: z.ZodOptional<z.ZodNever>;
1654
+ sealed: z.ZodObject<{
1655
+ v: z.ZodLiteral<1>;
1656
+ suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
1657
+ category: z.ZodLiteral<"task-output">;
1658
+ scope: z.ZodObject<{
1659
+ id: z.ZodString;
1660
+ epoch: z.ZodNumber;
1661
+ keyId: z.ZodString;
1662
+ }, z.core.$strict>;
1663
+ chainHead: z.ZodObject<{
1664
+ seq: z.ZodNumber;
1665
+ hash: z.ZodString;
1666
+ }, z.core.$strict>;
1667
+ sender: z.ZodString;
1668
+ salt: z.ZodString;
1669
+ nonce: z.ZodString;
1670
+ paddedLength: z.ZodNumber;
1671
+ contentMac: z.ZodString;
1672
+ ciphertext: z.ZodOptional<z.ZodString>;
1673
+ ciphertextRef: z.ZodOptional<z.ZodObject<{
1674
+ blobId: z.ZodString;
1675
+ contentHash: z.ZodString;
1676
+ size: z.ZodNumber;
1677
+ contentType: z.ZodString;
1678
+ }, z.core.$strict>>;
1679
+ }, z.core.$strict>;
1680
+ }, z.core.$strict>;
1681
+ export type TaskCompleteSealedPayload = z.infer<typeof TaskCompleteSealedPayloadSchema>;
1682
+ /** daemon -> server: `task.fail` of a sealed task. `reason` is sealed; `preparedObservation` is not carried in v1. */
1683
+ export declare const TaskFailSealedPayloadSchema: z.ZodObject<{
1773
1684
  sealing: z.ZodOptional<z.ZodNever>;
1774
1685
  recovery: z.ZodOptional<z.ZodObject<{
1775
1686
  kind: z.ZodLiteral<"daemon_interrupted">;
1776
1687
  offerId: z.ZodUUID;
1777
1688
  }, z.core.$strict>>;
1778
1689
  harnessId: z.ZodOptional<z.ZodString>;
1779
- reason: z.ZodString;
1780
1690
  retryable: z.ZodOptional<z.ZodBoolean>;
1781
1691
  failure: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1782
1692
  class: z.ZodLiteral<"quota">;
@@ -1811,11 +1721,6 @@ export declare const TaskFailPayloadSchema: z.ZodObject<{
1811
1721
  clientVersion: z.ZodString;
1812
1722
  reportedAt: z.ZodISODateTime;
1813
1723
  }, z.core.$strip>>;
1814
- preparedObservation: z.ZodOptional<z.ZodObject<{
1815
- requestDigest: z.ZodString;
1816
- initialPromptTokens: z.ZodNumber;
1817
- maxPromptTokens: z.ZodNumber;
1818
- }, z.core.$strict>>;
1819
1724
  agentRef: z.ZodOptional<z.ZodObject<{
1820
1725
  agentId: z.ZodString;
1821
1726
  profileRevision: z.ZodString;
@@ -1835,176 +1740,159 @@ export declare const TaskFailPayloadSchema: z.ZodObject<{
1835
1740
  }, z.core.$strict>, z.ZodObject<{
1836
1741
  outcome: z.ZodLiteral<"unmeasured">;
1837
1742
  }, z.core.$strict>], "outcome">>;
1838
- }, z.core.$strip>;
1839
- export type TaskFailPayload = z.infer<typeof TaskFailPayloadSchema>;
1743
+ sealed: z.ZodObject<{
1744
+ v: z.ZodLiteral<1>;
1745
+ suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
1746
+ category: z.ZodLiteral<"task-output">;
1747
+ scope: z.ZodObject<{
1748
+ id: z.ZodString;
1749
+ epoch: z.ZodNumber;
1750
+ keyId: z.ZodString;
1751
+ }, z.core.$strict>;
1752
+ chainHead: z.ZodObject<{
1753
+ seq: z.ZodNumber;
1754
+ hash: z.ZodString;
1755
+ }, z.core.$strict>;
1756
+ sender: z.ZodString;
1757
+ salt: z.ZodString;
1758
+ nonce: z.ZodString;
1759
+ paddedLength: z.ZodNumber;
1760
+ contentMac: z.ZodString;
1761
+ ciphertext: z.ZodOptional<z.ZodString>;
1762
+ ciphertextRef: z.ZodOptional<z.ZodObject<{
1763
+ blobId: z.ZodString;
1764
+ contentHash: z.ZodString;
1765
+ size: z.ZodNumber;
1766
+ contentType: z.ZodString;
1767
+ }, z.core.$strict>>;
1768
+ }, z.core.$strict>;
1769
+ }, z.core.$strict>;
1770
+ export type TaskFailSealedPayload = z.infer<typeof TaskFailSealedPayloadSchema>;
1840
1771
  /**
1841
- * daemon -> server: task ended in the `Cancelled` state (M1 gap #6) — either
1842
- * in response to a server-sent `task.cancel`, or a cancellation the daemon
1843
- * observed/decided locally (e.g. a local stop action) that the server didn't
1844
- * initiate. This is the canonical way to report a `Cancelled` outcome; it
1845
- * supersedes the M0 convention of `task.fail({ reason: 'cancelled' })`.
1846
- *
1847
- * This is deliberately its own message rather than folded into `task.fail`
1848
- * (decision: prefer the explicit message — see docs/protocol.md) because
1849
- * `Cancelled` is semantically distinct from `Failed`: one is an intentional
1850
- * stop, the other an error. Overloading `task.fail` with a magic
1851
- * `reason: 'cancelled'` string convention hid that distinction on the wire.
1852
- *
1853
- * Dual-purpose on receipt: if the server already moved its own record to
1854
- * `Cancelled` (it initiated the cancel — M1 gap #3's "server state is
1855
- * authoritative" rule), this is an idempotent no-op ack. If the server
1856
- * hasn't yet (a locally-observed cancellation), this is the authoritative
1857
- * trigger that moves `Claimed`/`Running`/`AwaitApproval -> Cancelled`.
1772
+ * daemon -> server: `task.decline` of a sealed task with a sealed `reason`.
1773
+ * The sealed decline codes go only on the plaintext branch: a device that
1774
+ * cannot open or use the scope key often cannot seal a reply either.
1858
1775
  */
1859
- export declare const TaskCancelledPayloadSchema: z.ZodObject<{
1860
- sealed: z.ZodOptional<z.ZodNever>;
1776
+ export declare const TaskDeclineSealedPayloadSchema: z.ZodObject<{
1861
1777
  sealing: z.ZodOptional<z.ZodNever>;
1862
- harnessId: z.ZodOptional<z.ZodString>;
1863
- reason: z.ZodOptional<z.ZodString>;
1864
- usage: z.ZodOptional<z.ZodObject<{
1865
- runtime: z.ZodEnum<{
1866
- claude: "claude";
1867
- codex: "codex";
1868
- pi: "pi";
1869
- }>;
1870
- provider: z.ZodOptional<z.ZodString>;
1871
- model: z.ZodOptional<z.ZodString>;
1872
- promptTokens: z.ZodOptional<z.ZodNumber>;
1873
- completionTokens: z.ZodOptional<z.ZodNumber>;
1874
- durationMs: z.ZodOptional<z.ZodNumber>;
1875
- clientVersion: z.ZodString;
1876
- reportedAt: z.ZodISODateTime;
1877
- }, z.core.$strip>>;
1778
+ retryable: z.ZodOptional<z.ZodBoolean>;
1878
1779
  agentRef: z.ZodOptional<z.ZodObject<{
1879
1780
  agentId: z.ZodString;
1880
1781
  profileRevision: z.ZodString;
1881
1782
  }, z.core.$strict>>;
1882
- agentHomeProjection: z.ZodOptional<z.ZodObject<{
1883
- profileRevision: z.ZodString;
1884
- projectionHash: z.ZodString;
1783
+ admission: z.ZodOptional<z.ZodObject<{
1784
+ totalMs: z.ZodNumber;
1785
+ agentHomeWaitMs: z.ZodOptional<z.ZodNumber>;
1786
+ messageHelperPreflightMs: z.ZodOptional<z.ZodNumber>;
1787
+ resultHelperPreflightMs: z.ZodOptional<z.ZodNumber>;
1788
+ toolsetProbeMs: z.ZodOptional<z.ZodNumber>;
1789
+ runtimeLaunchMs: z.ZodOptional<z.ZodNumber>;
1885
1790
  }, z.core.$strict>>;
1886
- agentHomeMemoryChange: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1887
- outcome: z.ZodLiteral<"unchanged">;
1888
- }, z.core.$strict>, z.ZodObject<{
1889
- outcome: z.ZodLiteral<"reader-attributed">;
1890
- paths: z.ZodArray<z.ZodString>;
1891
- }, z.core.$strict>, z.ZodObject<{
1892
- outcome: z.ZodLiteral<"unattributed">;
1893
- paths: z.ZodArray<z.ZodString>;
1894
- }, z.core.$strict>, z.ZodObject<{
1895
- outcome: z.ZodLiteral<"unmeasured">;
1896
- }, z.core.$strict>], "outcome">>;
1897
- }, z.core.$strip>;
1898
- export type TaskCancelledPayload = z.infer<typeof TaskCancelledPayloadSchema>;
1899
- /**
1900
- * daemon -> server: a pending `task.await_approval` was resolved entirely
1901
- * LOCALLY on the device — the local control-socket `approvals.resolve` RPC,
1902
- * a fail-closed `requestApproval` timeout, or a fail-closed eviction/finish
1903
- * rejection (see `packages/client`'s `task-runner.ts`/`approvals.ts`) —
1904
- * *without* a wire `task.approve`/`task.reject` ever having been exchanged
1905
- * for it. This is the additive-minor answer to a gap the M4 Phase 3 approval
1906
- * work left open (see the "Deferred additive candidate" note this schema
1907
- * resolves, `docs/protocol.md`): today the server only learns of a local
1908
- * resolution IMPLICITLY, after the fact, once the daemon's next
1909
- * `task.progress`/`task.artifact`/`task.complete` proves the task already
1910
- * moved on (`ConnectionHub.resumeIfImplicitlyApproved`,
1911
- * `packages/server/src/hub.ts`) — a window in which a SaaS-side
1912
- * `TaskHandle.approve()`/`.reject()` can independently decide (and win) the
1913
- * server's own authoritative record before that evidence ever arrives. This
1914
- * message lets the daemon report the local resolution explicitly and
1915
- * immediately, narrowing that window from "until the next progress message"
1916
- * down to ordinary network latency; the implicit-inference path stays as-is,
1917
- * unconditionally, as the compatibility fallback for an old server that
1918
- * never advertises the `approval_resolved` capability flag (`version.ts`) or
1919
- * an old daemon that predates this message entirely.
1920
- *
1921
- * Observability-class tolerance applies (not control/security — see the
1922
- * freeze rule's asymmetry, `docs/protocol.md`): this is a daemon reporting
1923
- * what it already did locally, not a payload that grants/denies anything on
1924
- * its own — the receiving server's own state machine (`TASK_TRANSITIONS`,
1925
- * `task-state.ts`) is still what decides whether the reported resolution is
1926
- * legal to apply. Plain `z.object()` (not `.strict()`), same as every other
1927
- * non-control payload in this file.
1928
- *
1929
- * `resolvedBy` is a single-value enum (`'local'`) rather than a bare string:
1930
- * deliberately future-proof (a later wave could add e.g. `'operator-cli'` as
1931
- * a DISTINCT value without a version bump — a new enum member is additive,
1932
- * same as a new message type or capability flag), while still being a closed,
1933
- * typed shape today rather than an open string a typo could silently widen.
1934
- */
1935
- export declare const TaskApprovalResolvedPayloadSchema: z.ZodObject<{
1936
- approvalId: z.ZodString;
1937
- decision: z.ZodEnum<{
1938
- approve: "approve";
1939
- reject: "reject";
1940
- }>;
1941
- resolvedBy: z.ZodEnum<{
1942
- local: "local";
1943
- }>;
1944
- at: z.ZodISODateTime;
1945
- }, z.core.$strip>;
1946
- export type TaskApprovalResolvedPayload = z.infer<typeof TaskApprovalResolvedPayloadSchema>;
1947
- /** server -> daemon: `task.offer` of a sealed task. */
1948
- export declare const TaskOfferSealedPayloadSchema: z.ZodObject<{
1949
- runtime: z.ZodOptional<z.ZodEnum<{
1950
- claude: "claude";
1951
- codex: "codex";
1952
- pi: "pi";
1791
+ code: z.ZodOptional<z.ZodEnum<{
1792
+ agent_home_reader_busy: "agent_home_reader_busy";
1793
+ agent_home_writer_busy: "agent_home_writer_busy";
1953
1794
  }>>;
1795
+ sealed: z.ZodObject<{
1796
+ v: z.ZodLiteral<1>;
1797
+ suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
1798
+ category: z.ZodLiteral<"task-output">;
1799
+ scope: z.ZodObject<{
1800
+ id: z.ZodString;
1801
+ epoch: z.ZodNumber;
1802
+ keyId: z.ZodString;
1803
+ }, z.core.$strict>;
1804
+ chainHead: z.ZodObject<{
1805
+ seq: z.ZodNumber;
1806
+ hash: z.ZodString;
1807
+ }, z.core.$strict>;
1808
+ sender: z.ZodString;
1809
+ salt: z.ZodString;
1810
+ nonce: z.ZodString;
1811
+ paddedLength: z.ZodNumber;
1812
+ contentMac: z.ZodString;
1813
+ ciphertext: z.ZodOptional<z.ZodString>;
1814
+ ciphertextRef: z.ZodOptional<z.ZodObject<{
1815
+ blobId: z.ZodString;
1816
+ contentHash: z.ZodString;
1817
+ size: z.ZodNumber;
1818
+ contentType: z.ZodString;
1819
+ }, z.core.$strict>>;
1820
+ }, z.core.$strict>;
1821
+ }, z.core.$strict>;
1822
+ export type TaskDeclineSealedPayload = z.infer<typeof TaskDeclineSealedPayloadSchema>;
1823
+ /** daemon -> server: `task.cancelled` of a sealed task. `reason` is sealed. */
1824
+ export declare const TaskCancelledSealedPayloadSchema: z.ZodObject<{
1825
+ sealing: z.ZodOptional<z.ZodNever>;
1954
1826
  harnessId: z.ZodOptional<z.ZodString>;
1955
- dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1956
- lane: z.ZodLiteral<"subscription">;
1957
- runtimeId: z.ZodEnum<{
1827
+ usage: z.ZodOptional<z.ZodObject<{
1828
+ runtime: z.ZodEnum<{
1958
1829
  claude: "claude";
1959
1830
  codex: "codex";
1831
+ pi: "pi";
1960
1832
  }>;
1961
- providerId: z.ZodNull;
1962
- modelId: z.ZodString;
1833
+ provider: z.ZodOptional<z.ZodString>;
1834
+ model: z.ZodOptional<z.ZodString>;
1835
+ promptTokens: z.ZodOptional<z.ZodNumber>;
1836
+ completionTokens: z.ZodOptional<z.ZodNumber>;
1837
+ durationMs: z.ZodOptional<z.ZodNumber>;
1838
+ clientVersion: z.ZodString;
1839
+ reportedAt: z.ZodISODateTime;
1840
+ }, z.core.$strip>>;
1841
+ agentRef: z.ZodOptional<z.ZodObject<{
1842
+ agentId: z.ZodString;
1843
+ profileRevision: z.ZodString;
1844
+ }, z.core.$strict>>;
1845
+ agentHomeProjection: z.ZodOptional<z.ZodObject<{
1846
+ profileRevision: z.ZodString;
1847
+ projectionHash: z.ZodString;
1848
+ }, z.core.$strict>>;
1849
+ agentHomeMemoryChange: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1850
+ outcome: z.ZodLiteral<"unchanged">;
1963
1851
  }, z.core.$strict>, z.ZodObject<{
1964
- lane: z.ZodLiteral<"byok">;
1965
- runtimeId: z.ZodLiteral<"pi">;
1966
- providerId: z.ZodString;
1967
- modelId: z.ZodString;
1852
+ outcome: z.ZodLiteral<"reader-attributed">;
1853
+ paths: z.ZodArray<z.ZodString>;
1968
1854
  }, z.core.$strict>, z.ZodObject<{
1969
- lane: z.ZodLiteral<"byok-profile">;
1970
- runtimeId: z.ZodLiteral<"pi">;
1971
- providerProfile: z.ZodObject<{
1972
- profileRef: z.ZodString;
1973
- profileRevision: z.ZodString;
1974
- profileHash: z.ZodString;
1975
- modelId: z.ZodString;
1976
- requiredCapabilities: z.ZodArray<z.ZodEnum<{
1977
- "image-input": "image-input";
1978
- }>>;
1855
+ outcome: z.ZodLiteral<"unattributed">;
1856
+ paths: z.ZodArray<z.ZodString>;
1857
+ }, z.core.$strict>, z.ZodObject<{
1858
+ outcome: z.ZodLiteral<"unmeasured">;
1859
+ }, z.core.$strict>], "outcome">>;
1860
+ sealed: z.ZodObject<{
1861
+ v: z.ZodLiteral<1>;
1862
+ suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
1863
+ category: z.ZodLiteral<"task-output">;
1864
+ scope: z.ZodObject<{
1865
+ id: z.ZodString;
1866
+ epoch: z.ZodNumber;
1867
+ keyId: z.ZodString;
1979
1868
  }, z.core.$strict>;
1980
- }, z.core.$strict>], "lane">>;
1981
- sessionRef: z.ZodOptional<z.ZodString>;
1982
- workspaceHint: z.ZodOptional<z.ZodString>;
1983
- limits: z.ZodOptional<z.ZodObject<{
1984
- maxDurationMs: z.ZodOptional<z.ZodNumber>;
1985
- maxTokens: z.ZodOptional<z.ZodNumber>;
1986
- }, z.core.$strip>>;
1987
- instruction: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
1988
- blobRef: z.ZodObject<{
1869
+ chainHead: z.ZodObject<{
1870
+ seq: z.ZodNumber;
1871
+ hash: z.ZodString;
1872
+ }, z.core.$strict>;
1873
+ sender: z.ZodString;
1874
+ salt: z.ZodString;
1875
+ nonce: z.ZodString;
1876
+ paddedLength: z.ZodNumber;
1877
+ contentMac: z.ZodString;
1878
+ ciphertext: z.ZodOptional<z.ZodString>;
1879
+ ciphertextRef: z.ZodOptional<z.ZodObject<{
1989
1880
  blobId: z.ZodString;
1990
1881
  contentHash: z.ZodString;
1991
1882
  size: z.ZodNumber;
1992
1883
  contentType: z.ZodString;
1993
- url: z.ZodOptional<z.ZodString>;
1994
- }, z.core.$strip>;
1995
- }, z.core.$strict>]>>;
1996
- sealing: z.ZodObject<{
1997
- scopeId: z.ZodString;
1998
- epoch: z.ZodNumber;
1999
- categories: z.ZodArray<z.ZodEnum<{
2000
- "task-input": "task-input";
2001
- "task-output": "task-output";
2002
- }>>;
1884
+ }, z.core.$strict>>;
2003
1885
  }, z.core.$strict>;
2004
- sealed: z.ZodOptional<z.ZodObject<{
1886
+ }, z.core.$strict>;
1887
+ export type TaskCancelledSealedPayload = z.infer<typeof TaskCancelledSealedPayloadSchema>;
1888
+ /** daemon -> server: `task.progress` of a sealed task. `events` is sealed; `seq` names the batch. */
1889
+ export declare const TaskProgressSealedPayloadSchema: z.ZodObject<{
1890
+ sealing: z.ZodOptional<z.ZodNever>;
1891
+ seq: z.ZodNumber;
1892
+ sealed: z.ZodObject<{
2005
1893
  v: z.ZodLiteral<1>;
2006
1894
  suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
2007
- category: z.ZodLiteral<"task-input">;
1895
+ category: z.ZodLiteral<"task-output">;
2008
1896
  scope: z.ZodObject<{
2009
1897
  id: z.ZodString;
2010
1898
  epoch: z.ZodNumber;
@@ -2026,71 +1914,55 @@ export declare const TaskOfferSealedPayloadSchema: z.ZodObject<{
2026
1914
  size: z.ZodNumber;
2027
1915
  contentType: z.ZodString;
2028
1916
  }, z.core.$strict>>;
2029
- }, z.core.$strict>>;
1917
+ }, z.core.$strict>;
2030
1918
  }, z.core.$strict>;
2031
- export type TaskOfferSealedPayload = z.infer<typeof TaskOfferSealedPayloadSchema>;
2032
- /** server -> daemon: `task.offer_with_toolsets` of a sealed task. */
2033
- export declare const TaskOfferWithToolsetsSealedPayloadSchema: z.ZodObject<{
2034
- runtime: z.ZodOptional<z.ZodEnum<{
2035
- claude: "claude";
2036
- codex: "codex";
2037
- pi: "pi";
2038
- }>>;
2039
- harnessId: z.ZodOptional<z.ZodString>;
2040
- dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2041
- lane: z.ZodLiteral<"subscription">;
2042
- runtimeId: z.ZodEnum<{
2043
- claude: "claude";
2044
- codex: "codex";
2045
- }>;
2046
- providerId: z.ZodNull;
2047
- modelId: z.ZodString;
2048
- }, z.core.$strict>, z.ZodObject<{
2049
- lane: z.ZodLiteral<"byok">;
2050
- runtimeId: z.ZodLiteral<"pi">;
2051
- providerId: z.ZodString;
2052
- modelId: z.ZodString;
2053
- }, z.core.$strict>, z.ZodObject<{
2054
- lane: z.ZodLiteral<"byok-profile">;
2055
- runtimeId: z.ZodLiteral<"pi">;
2056
- providerProfile: z.ZodObject<{
2057
- profileRef: z.ZodString;
2058
- profileRevision: z.ZodString;
2059
- profileHash: z.ZodString;
2060
- modelId: z.ZodString;
2061
- requiredCapabilities: z.ZodArray<z.ZodEnum<{
2062
- "image-input": "image-input";
2063
- }>>;
1919
+ export type TaskProgressSealedPayload = z.infer<typeof TaskProgressSealedPayloadSchema>;
1920
+ /**
1921
+ * daemon -> server: an inline artifact of a sealed task. `inline` is sealed; a
1922
+ * blob artifact is not carried in v1. `artifactId` names the write in the AAD
1923
+ * and the content MAC, because two artifacts of one task may share a `name`.
1924
+ */
1925
+ export declare const TaskArtifactSealedPayloadSchema: z.ZodObject<{
1926
+ sealing: z.ZodOptional<z.ZodNever>;
1927
+ name: z.ZodString;
1928
+ contentType: z.ZodString;
1929
+ artifactId: z.ZodUUID;
1930
+ sealed: z.ZodObject<{
1931
+ v: z.ZodLiteral<1>;
1932
+ suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
1933
+ category: z.ZodLiteral<"task-output">;
1934
+ scope: z.ZodObject<{
1935
+ id: z.ZodString;
1936
+ epoch: z.ZodNumber;
1937
+ keyId: z.ZodString;
2064
1938
  }, z.core.$strict>;
2065
- }, z.core.$strict>], "lane">>;
2066
- sessionRef: z.ZodOptional<z.ZodString>;
2067
- workspaceHint: z.ZodOptional<z.ZodString>;
2068
- limits: z.ZodOptional<z.ZodObject<{
2069
- maxDurationMs: z.ZodOptional<z.ZodNumber>;
2070
- maxTokens: z.ZodOptional<z.ZodNumber>;
2071
- }, z.core.$strip>>;
2072
- requiredToolsets: z.ZodArray<z.ZodString>;
2073
- instruction: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
2074
- blobRef: z.ZodObject<{
1939
+ chainHead: z.ZodObject<{
1940
+ seq: z.ZodNumber;
1941
+ hash: z.ZodString;
1942
+ }, z.core.$strict>;
1943
+ sender: z.ZodString;
1944
+ salt: z.ZodString;
1945
+ nonce: z.ZodString;
1946
+ paddedLength: z.ZodNumber;
1947
+ contentMac: z.ZodString;
1948
+ ciphertext: z.ZodOptional<z.ZodString>;
1949
+ ciphertextRef: z.ZodOptional<z.ZodObject<{
2075
1950
  blobId: z.ZodString;
2076
1951
  contentHash: z.ZodString;
2077
1952
  size: z.ZodNumber;
2078
1953
  contentType: z.ZodString;
2079
- url: z.ZodOptional<z.ZodString>;
2080
- }, z.core.$strip>;
2081
- }, z.core.$strict>]>>;
2082
- sealing: z.ZodObject<{
2083
- scopeId: z.ZodString;
2084
- epoch: z.ZodNumber;
2085
- categories: z.ZodArray<z.ZodEnum<{
2086
- "task-input": "task-input";
2087
- "task-output": "task-output";
2088
- }>>;
1954
+ }, z.core.$strict>>;
2089
1955
  }, z.core.$strict>;
2090
- sealed: z.ZodOptional<z.ZodObject<{
1956
+ }, z.core.$strict>;
1957
+ export type TaskArtifactSealedPayload = z.infer<typeof TaskArtifactSealedPayloadSchema>;
1958
+ /** daemon -> server: `task.await_approval` of a sealed task. `summary` is sealed; `approvalId` is required. */
1959
+ export declare const TaskAwaitApprovalSealedPayloadSchema: z.ZodObject<{
1960
+ sealing: z.ZodOptional<z.ZodNever>;
1961
+ approvalId: z.ZodString;
1962
+ sealed: z.ZodObject<{
2091
1963
  v: z.ZodLiteral<1>;
2092
1964
  suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
2093
- category: z.ZodLiteral<"task-input">;
1965
+ category: z.ZodLiteral<"task-output">;
2094
1966
  scope: z.ZodObject<{
2095
1967
  id: z.ZodString;
2096
1968
  epoch: z.ZodNumber;
@@ -2112,86 +1984,16 @@ export declare const TaskOfferWithToolsetsSealedPayloadSchema: z.ZodObject<{
2112
1984
  size: z.ZodNumber;
2113
1985
  contentType: z.ZodString;
2114
1986
  }, z.core.$strict>>;
2115
- }, z.core.$strict>>;
1987
+ }, z.core.$strict>;
2116
1988
  }, z.core.$strict>;
2117
- export type TaskOfferWithToolsetsSealedPayload = z.infer<typeof TaskOfferWithToolsetsSealedPayloadSchema>;
2118
- /** server -> daemon: `task.offer_for_agent` of a sealed task. */
2119
- export declare const TaskOfferForAgentSealedPayloadSchema: z.ZodObject<{
2120
- agentRef: z.ZodObject<{
2121
- agentId: z.ZodString;
2122
- profileRevision: z.ZodString;
2123
- }, z.core.$strict>;
2124
- homeAccess: z.ZodOptional<z.ZodLiteral<"memory-reader">>;
2125
- agentMemory: z.ZodOptional<z.ZodEnum<{
2126
- none: "none";
2127
- read: "read";
2128
- "read-if-admitted": "read-if-admitted";
2129
- "read-write": "read-write";
2130
- "read-write-if-admitted": "read-write-if-admitted";
2131
- }>>;
2132
- requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
2133
- runtime: z.ZodOptional<z.ZodEnum<{
2134
- claude: "claude";
2135
- codex: "codex";
2136
- pi: "pi";
2137
- }>>;
2138
- harnessId: z.ZodOptional<z.ZodString>;
2139
- dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2140
- lane: z.ZodLiteral<"subscription">;
2141
- runtimeId: z.ZodEnum<{
2142
- claude: "claude";
2143
- codex: "codex";
2144
- }>;
2145
- providerId: z.ZodNull;
2146
- modelId: z.ZodString;
2147
- }, z.core.$strict>, z.ZodObject<{
2148
- lane: z.ZodLiteral<"byok">;
2149
- runtimeId: z.ZodLiteral<"pi">;
2150
- providerId: z.ZodString;
2151
- modelId: z.ZodString;
2152
- }, z.core.$strict>, z.ZodObject<{
2153
- lane: z.ZodLiteral<"byok-profile">;
2154
- runtimeId: z.ZodLiteral<"pi">;
2155
- providerProfile: z.ZodObject<{
2156
- profileRef: z.ZodString;
2157
- profileRevision: z.ZodString;
2158
- profileHash: z.ZodString;
2159
- modelId: z.ZodString;
2160
- requiredCapabilities: z.ZodArray<z.ZodEnum<{
2161
- "image-input": "image-input";
2162
- }>>;
2163
- }, z.core.$strict>;
2164
- }, z.core.$strict>], "lane">>;
2165
- terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2166
- mode: z.ZodLiteral<"none">;
2167
- }, z.core.$strict>, z.ZodObject<{
2168
- mode: z.ZodLiteral<"result-document">;
2169
- contract: z.ZodString;
2170
- schema: z.ZodCustom<import("./result-schema").ResultSchema, import("./result-schema").ResultSchema>;
2171
- }, z.core.$strict>], "mode">>;
2172
- sessionRef: z.ZodOptional<z.ZodString>;
2173
- limits: z.ZodOptional<z.ZodObject<{
2174
- maxDurationMs: z.ZodOptional<z.ZodNumber>;
2175
- maxTokens: z.ZodOptional<z.ZodNumber>;
2176
- }, z.core.$strip>>;
2177
- instruction: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
2178
- blobRef: z.ZodObject<{
2179
- blobId: z.ZodString;
2180
- contentHash: z.ZodString;
2181
- size: z.ZodNumber;
2182
- contentType: z.ZodString;
2183
- url: z.ZodOptional<z.ZodString>;
2184
- }, z.core.$strip>;
2185
- }, z.core.$strict>]>>;
2186
- sealing: z.ZodObject<{
2187
- scopeId: z.ZodString;
2188
- epoch: z.ZodNumber;
2189
- categories: z.ZodArray<z.ZodEnum<{
2190
- "task-input": "task-input";
2191
- "task-output": "task-output";
2192
- }>>;
2193
- }, z.core.$strict>;
2194
- sealed: z.ZodOptional<z.ZodObject<{
1989
+ export type TaskAwaitApprovalSealedPayload = z.infer<typeof TaskAwaitApprovalSealedPayloadSchema>;
1990
+ export declare const TaskSteerPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
1991
+ sealed: z.ZodOptional<z.ZodNever>;
1992
+ sealing: z.ZodOptional<z.ZodNever>;
1993
+ text: z.ZodString;
1994
+ }, z.core.$strip>, z.ZodObject<{
1995
+ steerId: z.ZodUUID;
1996
+ sealed: z.ZodObject<{
2195
1997
  v: z.ZodLiteral<1>;
2196
1998
  suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
2197
1999
  category: z.ZodLiteral<"task-input">;
@@ -2216,125 +2018,220 @@ export declare const TaskOfferForAgentSealedPayloadSchema: z.ZodObject<{
2216
2018
  size: z.ZodNumber;
2217
2019
  contentType: z.ZodString;
2218
2020
  }, z.core.$strict>>;
2219
- }, z.core.$strict>>;
2220
- }, z.core.$strict>;
2221
- export type TaskOfferForAgentSealedPayload = z.infer<typeof TaskOfferForAgentSealedPayloadSchema>;
2222
- /** server -> daemon: `task.offer_for_agent_with_egress` of a sealed task. */
2223
- export declare const TaskOfferForAgentWithEgressSealedPayloadSchema: z.ZodObject<{
2224
- agentRef: z.ZodObject<{
2021
+ }, z.core.$strict>;
2022
+ }, z.core.$strict>]>;
2023
+ export type TaskSteerPayload = z.infer<typeof TaskSteerPayloadSchema>;
2024
+ export declare const TaskDeclinePayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2025
+ sealed: z.ZodOptional<z.ZodNever>;
2026
+ sealing: z.ZodOptional<z.ZodNever>;
2027
+ reason: z.ZodString;
2028
+ retryable: z.ZodOptional<z.ZodBoolean>;
2029
+ agentRef: z.ZodOptional<z.ZodObject<{
2225
2030
  agentId: z.ZodString;
2226
2031
  profileRevision: z.ZodString;
2227
- }, z.core.$strict>;
2228
- homeAccess: z.ZodOptional<z.ZodLiteral<"memory-reader">>;
2229
- agentMemory: z.ZodOptional<z.ZodEnum<{
2230
- none: "none";
2231
- read: "read";
2232
- "read-if-admitted": "read-if-admitted";
2233
- "read-write": "read-write";
2234
- "read-write-if-admitted": "read-write-if-admitted";
2032
+ }, z.core.$strict>>;
2033
+ code: z.ZodOptional<z.ZodEnum<{
2034
+ agent_home_reader_busy: "agent_home_reader_busy";
2035
+ agent_home_writer_busy: "agent_home_writer_busy";
2036
+ sealed_content_mac_mismatch: "sealed_content_mac_mismatch";
2037
+ sealed_key_unavailable: "sealed_key_unavailable";
2038
+ sealed_open_failed: "sealed_open_failed";
2039
+ sealing_policy_mismatch: "sealing_policy_mismatch";
2235
2040
  }>>;
2236
- requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
2237
- runtime: z.ZodOptional<z.ZodEnum<{
2238
- claude: "claude";
2239
- codex: "codex";
2240
- pi: "pi";
2041
+ admission: z.ZodOptional<z.ZodObject<{
2042
+ totalMs: z.ZodNumber;
2043
+ agentHomeWaitMs: z.ZodOptional<z.ZodNumber>;
2044
+ messageHelperPreflightMs: z.ZodOptional<z.ZodNumber>;
2045
+ resultHelperPreflightMs: z.ZodOptional<z.ZodNumber>;
2046
+ toolsetProbeMs: z.ZodOptional<z.ZodNumber>;
2047
+ runtimeLaunchMs: z.ZodOptional<z.ZodNumber>;
2048
+ }, z.core.$strict>>;
2049
+ }, z.core.$strip>, z.ZodObject<{
2050
+ sealing: z.ZodOptional<z.ZodNever>;
2051
+ retryable: z.ZodOptional<z.ZodBoolean>;
2052
+ agentRef: z.ZodOptional<z.ZodObject<{
2053
+ agentId: z.ZodString;
2054
+ profileRevision: z.ZodString;
2055
+ }, z.core.$strict>>;
2056
+ admission: z.ZodOptional<z.ZodObject<{
2057
+ totalMs: z.ZodNumber;
2058
+ agentHomeWaitMs: z.ZodOptional<z.ZodNumber>;
2059
+ messageHelperPreflightMs: z.ZodOptional<z.ZodNumber>;
2060
+ resultHelperPreflightMs: z.ZodOptional<z.ZodNumber>;
2061
+ toolsetProbeMs: z.ZodOptional<z.ZodNumber>;
2062
+ runtimeLaunchMs: z.ZodOptional<z.ZodNumber>;
2063
+ }, z.core.$strict>>;
2064
+ code: z.ZodOptional<z.ZodEnum<{
2065
+ agent_home_reader_busy: "agent_home_reader_busy";
2066
+ agent_home_writer_busy: "agent_home_writer_busy";
2241
2067
  }>>;
2242
- harnessId: z.ZodOptional<z.ZodString>;
2243
- dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2244
- lane: z.ZodLiteral<"subscription">;
2245
- runtimeId: z.ZodEnum<{
2246
- claude: "claude";
2247
- codex: "codex";
2248
- }>;
2249
- providerId: z.ZodNull;
2250
- modelId: z.ZodString;
2251
- }, z.core.$strict>, z.ZodObject<{
2252
- lane: z.ZodLiteral<"byok">;
2253
- runtimeId: z.ZodLiteral<"pi">;
2254
- providerId: z.ZodString;
2255
- modelId: z.ZodString;
2256
- }, z.core.$strict>, z.ZodObject<{
2257
- lane: z.ZodLiteral<"byok-profile">;
2258
- runtimeId: z.ZodLiteral<"pi">;
2259
- providerProfile: z.ZodObject<{
2260
- profileRef: z.ZodString;
2261
- profileRevision: z.ZodString;
2262
- profileHash: z.ZodString;
2263
- modelId: z.ZodString;
2264
- requiredCapabilities: z.ZodArray<z.ZodEnum<{
2265
- "image-input": "image-input";
2266
- }>>;
2068
+ sealed: z.ZodObject<{
2069
+ v: z.ZodLiteral<1>;
2070
+ suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
2071
+ category: z.ZodLiteral<"task-output">;
2072
+ scope: z.ZodObject<{
2073
+ id: z.ZodString;
2074
+ epoch: z.ZodNumber;
2075
+ keyId: z.ZodString;
2267
2076
  }, z.core.$strict>;
2268
- }, z.core.$strict>], "lane">>;
2269
- terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2270
- mode: z.ZodLiteral<"none">;
2271
- }, z.core.$strict>, z.ZodObject<{
2272
- mode: z.ZodLiteral<"result-document">;
2273
- contract: z.ZodString;
2274
- schema: z.ZodCustom<import("./result-schema").ResultSchema, import("./result-schema").ResultSchema>;
2275
- }, z.core.$strict>], "mode">>;
2276
- limits: z.ZodOptional<z.ZodObject<{
2277
- maxDurationMs: z.ZodOptional<z.ZodNumber>;
2278
- maxTokens: z.ZodOptional<z.ZodNumber>;
2279
- }, z.core.$strip>>;
2280
- sessionRef: z.ZodString;
2281
- egressPolicy: z.ZodObject<{
2282
- policyRevision: z.ZodString;
2283
- activity: z.ZodObject<{
2284
- delivery: z.ZodLiteral<"latest-value">;
2285
- maxCoalesceMs: z.ZodNumber;
2286
- maxEventBytes: z.ZodNumber;
2077
+ chainHead: z.ZodObject<{
2078
+ seq: z.ZodNumber;
2079
+ hash: z.ZodString;
2287
2080
  }, z.core.$strict>;
2288
- reliable: z.ZodObject<{
2289
- maxPendingEventsPerAgent: z.ZodNumber;
2290
- maxPendingBytesPerAgent: z.ZodNumber;
2291
- maxPendingBytesPerTenant: z.ZodNumber;
2081
+ sender: z.ZodString;
2082
+ salt: z.ZodString;
2083
+ nonce: z.ZodString;
2084
+ paddedLength: z.ZodNumber;
2085
+ contentMac: z.ZodString;
2086
+ ciphertext: z.ZodOptional<z.ZodString>;
2087
+ ciphertextRef: z.ZodOptional<z.ZodObject<{
2088
+ blobId: z.ZodString;
2089
+ contentHash: z.ZodString;
2090
+ size: z.ZodNumber;
2091
+ contentType: z.ZodString;
2092
+ }, z.core.$strict>>;
2093
+ }, z.core.$strict>;
2094
+ }, z.core.$strict>]>;
2095
+ export type TaskDeclinePayload = z.infer<typeof TaskDeclinePayloadSchema>;
2096
+ export declare const TaskProgressPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2097
+ sealed: z.ZodOptional<z.ZodNever>;
2098
+ sealing: z.ZodOptional<z.ZodNever>;
2099
+ seq: z.ZodNumber;
2100
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
2101
+ type: z.ZodLiteral<"progress">;
2102
+ text: z.ZodString;
2103
+ }, z.core.$strip>, z.ZodObject<{
2104
+ type: z.ZodLiteral<"tool_use">;
2105
+ tool: z.ZodString;
2106
+ mcp: z.ZodOptional<z.ZodObject<{
2107
+ server: z.ZodString;
2108
+ tool: z.ZodString;
2109
+ }, z.core.$strict>>;
2110
+ input: z.ZodOptional<z.ZodUnknown>;
2111
+ toolCallId: z.ZodOptional<z.ZodString>;
2112
+ spill: z.ZodOptional<z.ZodObject<{
2113
+ field: z.ZodEnum<{
2114
+ input: "input";
2115
+ output: "output";
2116
+ }>;
2117
+ totalBytes: z.ZodNumber;
2118
+ omittedBytes: z.ZodNumber;
2119
+ contentType: z.ZodLiteral<"application/json">;
2120
+ blob: z.ZodOptional<z.ZodObject<{
2121
+ blobId: z.ZodString;
2122
+ contentHash: z.ZodString;
2123
+ size: z.ZodNumber;
2124
+ contentType: z.ZodString;
2125
+ url: z.ZodOptional<z.ZodString>;
2126
+ }, z.core.$strip>>;
2127
+ unstoredReason: z.ZodOptional<z.ZodString>;
2128
+ }, z.core.$strict>>;
2129
+ }, z.core.$strip>, z.ZodObject<{
2130
+ type: z.ZodLiteral<"tool_result">;
2131
+ tool: z.ZodString;
2132
+ mcp: z.ZodOptional<z.ZodObject<{
2133
+ server: z.ZodString;
2134
+ tool: z.ZodString;
2135
+ }, z.core.$strict>>;
2136
+ output: z.ZodOptional<z.ZodUnknown>;
2137
+ toolCallId: z.ZodOptional<z.ZodString>;
2138
+ isError: z.ZodOptional<z.ZodBoolean>;
2139
+ spill: z.ZodOptional<z.ZodObject<{
2140
+ field: z.ZodEnum<{
2141
+ input: "input";
2142
+ output: "output";
2143
+ }>;
2144
+ totalBytes: z.ZodNumber;
2145
+ omittedBytes: z.ZodNumber;
2146
+ contentType: z.ZodLiteral<"application/json">;
2147
+ blob: z.ZodOptional<z.ZodObject<{
2148
+ blobId: z.ZodString;
2149
+ contentHash: z.ZodString;
2150
+ size: z.ZodNumber;
2151
+ contentType: z.ZodString;
2152
+ url: z.ZodOptional<z.ZodString>;
2153
+ }, z.core.$strip>>;
2154
+ unstoredReason: z.ZodOptional<z.ZodString>;
2155
+ }, z.core.$strict>>;
2156
+ }, z.core.$strip>, z.ZodObject<{
2157
+ type: z.ZodLiteral<"artifact">;
2158
+ name: z.ZodString;
2159
+ contentType: z.ZodString;
2160
+ }, z.core.$strip>, z.ZodObject<{
2161
+ type: z.ZodLiteral<"turn_end">;
2162
+ }, z.core.$strip>, z.ZodObject<{
2163
+ type: z.ZodLiteral<"error">;
2164
+ message: z.ZodString;
2165
+ }, z.core.$strip>, z.ZodObject<{
2166
+ type: z.ZodLiteral<"usage">;
2167
+ inputTokens: z.ZodOptional<z.ZodNumber>;
2168
+ cachedInputTokens: z.ZodOptional<z.ZodNumber>;
2169
+ outputTokens: z.ZodOptional<z.ZodNumber>;
2170
+ reasoningTokens: z.ZodOptional<z.ZodNumber>;
2171
+ totalTokens: z.ZodOptional<z.ZodNumber>;
2172
+ contextTokens: z.ZodOptional<z.ZodNumber>;
2173
+ contextWindow: z.ZodOptional<z.ZodNumber>;
2174
+ contextSource: z.ZodOptional<z.ZodEnum<{
2175
+ estimate: "estimate";
2176
+ provider: "provider";
2177
+ }>>;
2178
+ model: z.ZodOptional<z.ZodString>;
2179
+ }, z.core.$strip>], "type">, z.ZodObject<{
2180
+ type: z.ZodString;
2181
+ }, z.core.$loose>]>>;
2182
+ }, z.core.$strip>, z.ZodObject<{
2183
+ sealing: z.ZodOptional<z.ZodNever>;
2184
+ seq: z.ZodNumber;
2185
+ sealed: z.ZodObject<{
2186
+ v: z.ZodLiteral<1>;
2187
+ suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
2188
+ category: z.ZodLiteral<"task-output">;
2189
+ scope: z.ZodObject<{
2190
+ id: z.ZodString;
2191
+ epoch: z.ZodNumber;
2192
+ keyId: z.ZodString;
2292
2193
  }, z.core.$strict>;
2293
- transfers: z.ZodObject<{
2294
- workspace: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
2295
- maxBytes: z.ZodNumber;
2296
- allowedMimeTypes: z.ZodArray<z.ZodString>;
2297
- }, z.core.$strict>]>;
2298
- transcript: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
2299
- maxBytes: z.ZodNumber;
2300
- allowedMimeTypes: z.ZodArray<z.ZodString>;
2301
- }, z.core.$strict>]>;
2302
- artifact: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
2303
- maxBytes: z.ZodNumber;
2304
- allowedMimeTypes: z.ZodArray<z.ZodString>;
2305
- }, z.core.$strict>]>;
2194
+ chainHead: z.ZodObject<{
2195
+ seq: z.ZodNumber;
2196
+ hash: z.ZodString;
2306
2197
  }, z.core.$strict>;
2307
- }, z.core.$strict>;
2308
- messageEgress: z.ZodOptional<z.ZodObject<{
2309
- mode: z.ZodLiteral<"required">;
2310
- contract: z.ZodString;
2311
- contentType: z.ZodEnum<{
2312
- "text/markdown": "text/markdown";
2313
- "text/plain": "text/plain";
2314
- }>;
2315
- maxBytes: z.ZodNumber;
2316
- }, z.core.$strict>>;
2317
- instruction: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
2318
- blobRef: z.ZodObject<{
2198
+ sender: z.ZodString;
2199
+ salt: z.ZodString;
2200
+ nonce: z.ZodString;
2201
+ paddedLength: z.ZodNumber;
2202
+ contentMac: z.ZodString;
2203
+ ciphertext: z.ZodOptional<z.ZodString>;
2204
+ ciphertextRef: z.ZodOptional<z.ZodObject<{
2319
2205
  blobId: z.ZodString;
2320
2206
  contentHash: z.ZodString;
2321
2207
  size: z.ZodNumber;
2322
2208
  contentType: z.ZodString;
2323
- url: z.ZodOptional<z.ZodString>;
2324
- }, z.core.$strip>;
2325
- }, z.core.$strict>]>>;
2326
- sealing: z.ZodObject<{
2327
- scopeId: z.ZodString;
2328
- epoch: z.ZodNumber;
2329
- categories: z.ZodArray<z.ZodEnum<{
2330
- "task-input": "task-input";
2331
- "task-output": "task-output";
2332
- }>>;
2209
+ }, z.core.$strict>>;
2333
2210
  }, z.core.$strict>;
2334
- sealed: z.ZodOptional<z.ZodObject<{
2211
+ }, z.core.$strict>]>;
2212
+ export type TaskProgressPayload = z.infer<typeof TaskProgressPayloadSchema>;
2213
+ export declare const TaskArtifactPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2214
+ sealed: z.ZodOptional<z.ZodNever>;
2215
+ sealing: z.ZodOptional<z.ZodNever>;
2216
+ name: z.ZodString;
2217
+ contentType: z.ZodString;
2218
+ inline: z.ZodOptional<z.ZodString>;
2219
+ blobRef: z.ZodOptional<z.ZodObject<{
2220
+ blobId: z.ZodString;
2221
+ contentHash: z.ZodString;
2222
+ size: z.ZodNumber;
2223
+ contentType: z.ZodString;
2224
+ url: z.ZodOptional<z.ZodString>;
2225
+ }, z.core.$strip>>;
2226
+ }, z.core.$strip>, z.ZodObject<{
2227
+ sealing: z.ZodOptional<z.ZodNever>;
2228
+ name: z.ZodString;
2229
+ contentType: z.ZodString;
2230
+ artifactId: z.ZodUUID;
2231
+ sealed: z.ZodObject<{
2335
2232
  v: z.ZodLiteral<1>;
2336
2233
  suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
2337
- category: z.ZodLiteral<"task-input">;
2234
+ category: z.ZodLiteral<"task-output">;
2338
2235
  scope: z.ZodObject<{
2339
2236
  id: z.ZodString;
2340
2237
  epoch: z.ZodNumber;
@@ -2356,127 +2253,21 @@ export declare const TaskOfferForAgentWithEgressSealedPayloadSchema: z.ZodObject
2356
2253
  size: z.ZodNumber;
2357
2254
  contentType: z.ZodString;
2358
2255
  }, z.core.$strict>>;
2359
- }, z.core.$strict>>;
2360
- }, z.core.$strict>;
2361
- export type TaskOfferForAgentWithEgressSealedPayload = z.infer<typeof TaskOfferForAgentWithEgressSealedPayloadSchema>;
2362
- /**
2363
- * server -> daemon: `task.offer_for_agent_with_egress_fresh` of a sealed task.
2364
- * Only this type takes `routineRef`: a routine occurrence is an execution.
2365
- */
2366
- export declare const TaskOfferForAgentWithEgressFreshSealedPayloadSchema: z.ZodObject<{
2367
- agentRef: z.ZodObject<{
2368
- agentId: z.ZodString;
2369
- profileRevision: z.ZodString;
2370
- }, z.core.$strict>;
2371
- homeAccess: z.ZodOptional<z.ZodLiteral<"memory-reader">>;
2372
- agentMemory: z.ZodOptional<z.ZodEnum<{
2373
- none: "none";
2374
- read: "read";
2375
- "read-if-admitted": "read-if-admitted";
2376
- "read-write": "read-write";
2377
- "read-write-if-admitted": "read-write-if-admitted";
2378
- }>>;
2379
- requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
2380
- runtime: z.ZodOptional<z.ZodEnum<{
2381
- claude: "claude";
2382
- codex: "codex";
2383
- pi: "pi";
2384
- }>>;
2385
- harnessId: z.ZodOptional<z.ZodString>;
2386
- dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2387
- lane: z.ZodLiteral<"subscription">;
2388
- runtimeId: z.ZodEnum<{
2389
- claude: "claude";
2390
- codex: "codex";
2391
- }>;
2392
- providerId: z.ZodNull;
2393
- modelId: z.ZodString;
2394
- }, z.core.$strict>, z.ZodObject<{
2395
- lane: z.ZodLiteral<"byok">;
2396
- runtimeId: z.ZodLiteral<"pi">;
2397
- providerId: z.ZodString;
2398
- modelId: z.ZodString;
2399
- }, z.core.$strict>, z.ZodObject<{
2400
- lane: z.ZodLiteral<"byok-profile">;
2401
- runtimeId: z.ZodLiteral<"pi">;
2402
- providerProfile: z.ZodObject<{
2403
- profileRef: z.ZodString;
2404
- profileRevision: z.ZodString;
2405
- profileHash: z.ZodString;
2406
- modelId: z.ZodString;
2407
- requiredCapabilities: z.ZodArray<z.ZodEnum<{
2408
- "image-input": "image-input";
2409
- }>>;
2410
- }, z.core.$strict>;
2411
- }, z.core.$strict>], "lane">>;
2412
- terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2413
- mode: z.ZodLiteral<"none">;
2414
- }, z.core.$strict>, z.ZodObject<{
2415
- mode: z.ZodLiteral<"result-document">;
2416
- contract: z.ZodString;
2417
- schema: z.ZodCustom<import("./result-schema").ResultSchema, import("./result-schema").ResultSchema>;
2418
- }, z.core.$strict>], "mode">>;
2419
- limits: z.ZodOptional<z.ZodObject<{
2420
- maxDurationMs: z.ZodOptional<z.ZodNumber>;
2421
- maxTokens: z.ZodOptional<z.ZodNumber>;
2422
- }, z.core.$strip>>;
2423
- egressPolicy: z.ZodObject<{
2424
- policyRevision: z.ZodString;
2425
- activity: z.ZodObject<{
2426
- delivery: z.ZodLiteral<"latest-value">;
2427
- maxCoalesceMs: z.ZodNumber;
2428
- maxEventBytes: z.ZodNumber;
2429
- }, z.core.$strict>;
2430
- reliable: z.ZodObject<{
2431
- maxPendingEventsPerAgent: z.ZodNumber;
2432
- maxPendingBytesPerAgent: z.ZodNumber;
2433
- maxPendingBytesPerTenant: z.ZodNumber;
2434
- }, z.core.$strict>;
2435
- transfers: z.ZodObject<{
2436
- workspace: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
2437
- maxBytes: z.ZodNumber;
2438
- allowedMimeTypes: z.ZodArray<z.ZodString>;
2439
- }, z.core.$strict>]>;
2440
- transcript: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
2441
- maxBytes: z.ZodNumber;
2442
- allowedMimeTypes: z.ZodArray<z.ZodString>;
2443
- }, z.core.$strict>]>;
2444
- artifact: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
2445
- maxBytes: z.ZodNumber;
2446
- allowedMimeTypes: z.ZodArray<z.ZodString>;
2447
- }, z.core.$strict>]>;
2448
- }, z.core.$strict>;
2449
- }, z.core.$strict>;
2450
- messageEgress: z.ZodOptional<z.ZodObject<{
2451
- mode: z.ZodLiteral<"required">;
2452
- contract: z.ZodString;
2453
- contentType: z.ZodEnum<{
2454
- "text/markdown": "text/markdown";
2455
- "text/plain": "text/plain";
2456
- }>;
2457
- maxBytes: z.ZodNumber;
2458
- }, z.core.$strict>>;
2459
- instruction: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
2460
- blobRef: z.ZodObject<{
2461
- blobId: z.ZodString;
2462
- contentHash: z.ZodString;
2463
- size: z.ZodNumber;
2464
- contentType: z.ZodString;
2465
- url: z.ZodOptional<z.ZodString>;
2466
- }, z.core.$strip>;
2467
- }, z.core.$strict>]>>;
2468
- sealing: z.ZodObject<{
2469
- scopeId: z.ZodString;
2470
- epoch: z.ZodNumber;
2471
- categories: z.ZodArray<z.ZodEnum<{
2472
- "task-input": "task-input";
2473
- "task-output": "task-output";
2474
- }>>;
2475
2256
  }, z.core.$strict>;
2476
- sealed: z.ZodOptional<z.ZodObject<{
2257
+ }, z.core.$strict>]>;
2258
+ export type TaskArtifactPayload = z.infer<typeof TaskArtifactPayloadSchema>;
2259
+ export declare const TaskAwaitApprovalPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2260
+ sealed: z.ZodOptional<z.ZodNever>;
2261
+ sealing: z.ZodOptional<z.ZodNever>;
2262
+ summary: z.ZodString;
2263
+ approvalId: z.ZodString;
2264
+ }, z.core.$strip>, z.ZodObject<{
2265
+ sealing: z.ZodOptional<z.ZodNever>;
2266
+ approvalId: z.ZodString;
2267
+ sealed: z.ZodObject<{
2477
2268
  v: z.ZodLiteral<1>;
2478
2269
  suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
2479
- category: z.ZodLiteral<"task-input">;
2270
+ category: z.ZodLiteral<"task-output">;
2480
2271
  scope: z.ZodObject<{
2481
2272
  id: z.ZodString;
2482
2273
  epoch: z.ZodNumber;
@@ -2498,25 +2289,103 @@ export declare const TaskOfferForAgentWithEgressFreshSealedPayloadSchema: z.ZodO
2498
2289
  size: z.ZodNumber;
2499
2290
  contentType: z.ZodString;
2500
2291
  }, z.core.$strict>>;
2292
+ }, z.core.$strict>;
2293
+ }, z.core.$strict>]>;
2294
+ export type TaskAwaitApprovalPayload = z.infer<typeof TaskAwaitApprovalPayloadSchema>;
2295
+ export declare const TaskCompletePayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2296
+ sealed: z.ZodOptional<z.ZodNever>;
2297
+ sealing: z.ZodOptional<z.ZodNever>;
2298
+ harnessId: z.ZodOptional<z.ZodString>;
2299
+ summary: z.ZodString;
2300
+ finalMessage: z.ZodOptional<z.ZodString>;
2301
+ sessionRef: z.ZodString;
2302
+ artifactRefs: z.ZodOptional<z.ZodArray<z.ZodObject<{
2303
+ blobId: z.ZodString;
2304
+ contentHash: z.ZodString;
2305
+ size: z.ZodNumber;
2306
+ contentType: z.ZodString;
2307
+ url: z.ZodOptional<z.ZodString>;
2308
+ }, z.core.$strip>>>;
2309
+ document: z.ZodOptional<z.ZodUnknown>;
2310
+ usage: z.ZodOptional<z.ZodObject<{
2311
+ runtime: z.ZodEnum<{
2312
+ claude: "claude";
2313
+ codex: "codex";
2314
+ pi: "pi";
2315
+ }>;
2316
+ provider: z.ZodOptional<z.ZodString>;
2317
+ model: z.ZodOptional<z.ZodString>;
2318
+ promptTokens: z.ZodOptional<z.ZodNumber>;
2319
+ completionTokens: z.ZodOptional<z.ZodNumber>;
2320
+ durationMs: z.ZodOptional<z.ZodNumber>;
2321
+ clientVersion: z.ZodString;
2322
+ reportedAt: z.ZodISODateTime;
2323
+ }, z.core.$strip>>;
2324
+ preparedObservation: z.ZodOptional<z.ZodObject<{
2325
+ requestDigest: z.ZodString;
2326
+ initialPromptTokens: z.ZodNumber;
2327
+ maxPromptTokens: z.ZodNumber;
2501
2328
  }, z.core.$strict>>;
2502
- routineRef: z.ZodOptional<z.ZodObject<{
2503
- routineId: z.ZodString;
2504
- definitionVersion: z.ZodNumber;
2505
- notAfter: z.ZodString;
2329
+ agentRef: z.ZodOptional<z.ZodObject<{
2330
+ agentId: z.ZodString;
2331
+ profileRevision: z.ZodString;
2506
2332
  }, z.core.$strict>>;
2507
- }, z.core.$strict>;
2508
- export type TaskOfferForAgentWithEgressFreshSealedPayload = z.infer<typeof TaskOfferForAgentWithEgressFreshSealedPayloadSchema>;
2509
- /**
2510
- * server -> daemon: sealed steering text. `steerId` names this steer in the
2511
- * AAD and the content MAC, so the Host cannot replay an earlier steer of the
2512
- * same task as a new one.
2513
- */
2514
- export declare const TaskSteerSealedPayloadSchema: z.ZodObject<{
2515
- steerId: z.ZodUUID;
2333
+ agentHomeProjection: z.ZodOptional<z.ZodObject<{
2334
+ profileRevision: z.ZodString;
2335
+ projectionHash: z.ZodString;
2336
+ }, z.core.$strict>>;
2337
+ agentHomeMemoryChange: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2338
+ outcome: z.ZodLiteral<"unchanged">;
2339
+ }, z.core.$strict>, z.ZodObject<{
2340
+ outcome: z.ZodLiteral<"reader-attributed">;
2341
+ paths: z.ZodArray<z.ZodString>;
2342
+ }, z.core.$strict>, z.ZodObject<{
2343
+ outcome: z.ZodLiteral<"unattributed">;
2344
+ paths: z.ZodArray<z.ZodString>;
2345
+ }, z.core.$strict>, z.ZodObject<{
2346
+ outcome: z.ZodLiteral<"unmeasured">;
2347
+ }, z.core.$strict>], "outcome">>;
2348
+ }, z.core.$strip>, z.ZodObject<{
2349
+ sealing: z.ZodOptional<z.ZodNever>;
2350
+ harnessId: z.ZodOptional<z.ZodString>;
2351
+ sessionRef: z.ZodString;
2352
+ usage: z.ZodOptional<z.ZodObject<{
2353
+ runtime: z.ZodEnum<{
2354
+ claude: "claude";
2355
+ codex: "codex";
2356
+ pi: "pi";
2357
+ }>;
2358
+ provider: z.ZodOptional<z.ZodString>;
2359
+ model: z.ZodOptional<z.ZodString>;
2360
+ promptTokens: z.ZodOptional<z.ZodNumber>;
2361
+ completionTokens: z.ZodOptional<z.ZodNumber>;
2362
+ durationMs: z.ZodOptional<z.ZodNumber>;
2363
+ clientVersion: z.ZodString;
2364
+ reportedAt: z.ZodISODateTime;
2365
+ }, z.core.$strip>>;
2366
+ agentRef: z.ZodOptional<z.ZodObject<{
2367
+ agentId: z.ZodString;
2368
+ profileRevision: z.ZodString;
2369
+ }, z.core.$strict>>;
2370
+ agentHomeProjection: z.ZodOptional<z.ZodObject<{
2371
+ profileRevision: z.ZodString;
2372
+ projectionHash: z.ZodString;
2373
+ }, z.core.$strict>>;
2374
+ agentHomeMemoryChange: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2375
+ outcome: z.ZodLiteral<"unchanged">;
2376
+ }, z.core.$strict>, z.ZodObject<{
2377
+ outcome: z.ZodLiteral<"reader-attributed">;
2378
+ paths: z.ZodArray<z.ZodString>;
2379
+ }, z.core.$strict>, z.ZodObject<{
2380
+ outcome: z.ZodLiteral<"unattributed">;
2381
+ paths: z.ZodArray<z.ZodString>;
2382
+ }, z.core.$strict>, z.ZodObject<{
2383
+ outcome: z.ZodLiteral<"unmeasured">;
2384
+ }, z.core.$strict>], "outcome">>;
2516
2385
  sealed: z.ZodObject<{
2517
2386
  v: z.ZodLiteral<1>;
2518
2387
  suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
2519
- category: z.ZodLiteral<"task-input">;
2388
+ category: z.ZodLiteral<"task-output">;
2520
2389
  scope: z.ZodObject<{
2521
2390
  id: z.ZodString;
2522
2391
  epoch: z.ZodNumber;
@@ -2539,17 +2408,37 @@ export declare const TaskSteerSealedPayloadSchema: z.ZodObject<{
2539
2408
  contentType: z.ZodString;
2540
2409
  }, z.core.$strict>>;
2541
2410
  }, z.core.$strict>;
2542
- }, z.core.$strict>;
2543
- export type TaskSteerSealedPayload = z.infer<typeof TaskSteerSealedPayloadSchema>;
2544
- /**
2545
- * daemon -> server: `task.complete` of a sealed task. `summary`,
2546
- * `finalMessage` and `document` are sealed. `artifactRefs` and
2547
- * `preparedObservation` are not carried in v1.
2548
- */
2549
- export declare const TaskCompleteSealedPayloadSchema: z.ZodObject<{
2411
+ }, z.core.$strict>]>;
2412
+ export type TaskCompletePayload = z.infer<typeof TaskCompletePayloadSchema>;
2413
+ export declare const TaskFailPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2414
+ sealed: z.ZodOptional<z.ZodNever>;
2550
2415
  sealing: z.ZodOptional<z.ZodNever>;
2416
+ recovery: z.ZodOptional<z.ZodObject<{
2417
+ kind: z.ZodLiteral<"daemon_interrupted">;
2418
+ offerId: z.ZodUUID;
2419
+ }, z.core.$strict>>;
2551
2420
  harnessId: z.ZodOptional<z.ZodString>;
2552
- sessionRef: z.ZodString;
2421
+ reason: z.ZodString;
2422
+ retryable: z.ZodOptional<z.ZodBoolean>;
2423
+ failure: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
2424
+ class: z.ZodLiteral<"quota">;
2425
+ resetsAt: z.ZodOptional<z.ZodISODateTime>;
2426
+ }, z.core.$strict>, z.ZodObject<{
2427
+ class: z.ZodEnum<{
2428
+ auth: "auth";
2429
+ billing: "billing";
2430
+ input_too_large: "input_too_large";
2431
+ invalid_request: "invalid_request";
2432
+ limit_reached: "limit_reached";
2433
+ model_unavailable: "model_unavailable";
2434
+ output_schema: "output_schema";
2435
+ overloaded: "overloaded";
2436
+ provider: "provider";
2437
+ rate_limited: "rate_limited";
2438
+ runtime_exited: "runtime_exited";
2439
+ unknown: "unknown";
2440
+ }>;
2441
+ }, z.core.$strict>]>>;
2553
2442
  usage: z.ZodOptional<z.ZodObject<{
2554
2443
  runtime: z.ZodEnum<{
2555
2444
  claude: "claude";
@@ -2564,6 +2453,11 @@ export declare const TaskCompleteSealedPayloadSchema: z.ZodObject<{
2564
2453
  clientVersion: z.ZodString;
2565
2454
  reportedAt: z.ZodISODateTime;
2566
2455
  }, z.core.$strip>>;
2456
+ preparedObservation: z.ZodOptional<z.ZodObject<{
2457
+ requestDigest: z.ZodString;
2458
+ initialPromptTokens: z.ZodNumber;
2459
+ maxPromptTokens: z.ZodNumber;
2460
+ }, z.core.$strict>>;
2567
2461
  agentRef: z.ZodOptional<z.ZodObject<{
2568
2462
  agentId: z.ZodString;
2569
2463
  profileRevision: z.ZodString;
@@ -2583,36 +2477,7 @@ export declare const TaskCompleteSealedPayloadSchema: z.ZodObject<{
2583
2477
  }, z.core.$strict>, z.ZodObject<{
2584
2478
  outcome: z.ZodLiteral<"unmeasured">;
2585
2479
  }, z.core.$strict>], "outcome">>;
2586
- sealed: z.ZodObject<{
2587
- v: z.ZodLiteral<1>;
2588
- suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
2589
- category: z.ZodLiteral<"task-output">;
2590
- scope: z.ZodObject<{
2591
- id: z.ZodString;
2592
- epoch: z.ZodNumber;
2593
- keyId: z.ZodString;
2594
- }, z.core.$strict>;
2595
- chainHead: z.ZodObject<{
2596
- seq: z.ZodNumber;
2597
- hash: z.ZodString;
2598
- }, z.core.$strict>;
2599
- sender: z.ZodString;
2600
- salt: z.ZodString;
2601
- nonce: z.ZodString;
2602
- paddedLength: z.ZodNumber;
2603
- contentMac: z.ZodString;
2604
- ciphertext: z.ZodOptional<z.ZodString>;
2605
- ciphertextRef: z.ZodOptional<z.ZodObject<{
2606
- blobId: z.ZodString;
2607
- contentHash: z.ZodString;
2608
- size: z.ZodNumber;
2609
- contentType: z.ZodString;
2610
- }, z.core.$strict>>;
2611
- }, z.core.$strict>;
2612
- }, z.core.$strict>;
2613
- export type TaskCompleteSealedPayload = z.infer<typeof TaskCompleteSealedPayloadSchema>;
2614
- /** daemon -> server: `task.fail` of a sealed task. `reason` is sealed; `preparedObservation` is not carried in v1. */
2615
- export declare const TaskFailSealedPayloadSchema: z.ZodObject<{
2480
+ }, z.core.$strip>, z.ZodObject<{
2616
2481
  sealing: z.ZodOptional<z.ZodNever>;
2617
2482
  recovery: z.ZodOptional<z.ZodObject<{
2618
2483
  kind: z.ZodLiteral<"daemon_interrupted">;
@@ -2698,54 +2563,47 @@ export declare const TaskFailSealedPayloadSchema: z.ZodObject<{
2698
2563
  contentType: z.ZodString;
2699
2564
  }, z.core.$strict>>;
2700
2565
  }, z.core.$strict>;
2701
- }, z.core.$strict>;
2702
- export type TaskFailSealedPayload = z.infer<typeof TaskFailSealedPayloadSchema>;
2703
- /**
2704
- * daemon -> server: `task.decline` of a sealed task with a sealed `reason`.
2705
- * The sealed decline codes go only on the plaintext `task.decline`: a device
2706
- * that cannot open or use the scope key often cannot seal a reply either.
2707
- */
2708
- export declare const TaskDeclineSealedPayloadSchema: z.ZodObject<{
2566
+ }, z.core.$strict>]>;
2567
+ export type TaskFailPayload = z.infer<typeof TaskFailPayloadSchema>;
2568
+ export declare const TaskCancelledPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2569
+ sealed: z.ZodOptional<z.ZodNever>;
2709
2570
  sealing: z.ZodOptional<z.ZodNever>;
2710
- retryable: z.ZodOptional<z.ZodBoolean>;
2571
+ harnessId: z.ZodOptional<z.ZodString>;
2572
+ reason: z.ZodOptional<z.ZodString>;
2573
+ usage: z.ZodOptional<z.ZodObject<{
2574
+ runtime: z.ZodEnum<{
2575
+ claude: "claude";
2576
+ codex: "codex";
2577
+ pi: "pi";
2578
+ }>;
2579
+ provider: z.ZodOptional<z.ZodString>;
2580
+ model: z.ZodOptional<z.ZodString>;
2581
+ promptTokens: z.ZodOptional<z.ZodNumber>;
2582
+ completionTokens: z.ZodOptional<z.ZodNumber>;
2583
+ durationMs: z.ZodOptional<z.ZodNumber>;
2584
+ clientVersion: z.ZodString;
2585
+ reportedAt: z.ZodISODateTime;
2586
+ }, z.core.$strip>>;
2711
2587
  agentRef: z.ZodOptional<z.ZodObject<{
2712
2588
  agentId: z.ZodString;
2713
2589
  profileRevision: z.ZodString;
2714
2590
  }, z.core.$strict>>;
2715
- code: z.ZodOptional<z.ZodEnum<{
2716
- agent_home_reader_busy: "agent_home_reader_busy";
2717
- agent_home_writer_busy: "agent_home_writer_busy";
2718
- }>>;
2719
- sealed: z.ZodObject<{
2720
- v: z.ZodLiteral<1>;
2721
- suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
2722
- category: z.ZodLiteral<"task-output">;
2723
- scope: z.ZodObject<{
2724
- id: z.ZodString;
2725
- epoch: z.ZodNumber;
2726
- keyId: z.ZodString;
2727
- }, z.core.$strict>;
2728
- chainHead: z.ZodObject<{
2729
- seq: z.ZodNumber;
2730
- hash: z.ZodString;
2731
- }, z.core.$strict>;
2732
- sender: z.ZodString;
2733
- salt: z.ZodString;
2734
- nonce: z.ZodString;
2735
- paddedLength: z.ZodNumber;
2736
- contentMac: z.ZodString;
2737
- ciphertext: z.ZodOptional<z.ZodString>;
2738
- ciphertextRef: z.ZodOptional<z.ZodObject<{
2739
- blobId: z.ZodString;
2740
- contentHash: z.ZodString;
2741
- size: z.ZodNumber;
2742
- contentType: z.ZodString;
2743
- }, z.core.$strict>>;
2744
- }, z.core.$strict>;
2745
- }, z.core.$strict>;
2746
- export type TaskDeclineSealedPayload = z.infer<typeof TaskDeclineSealedPayloadSchema>;
2747
- /** daemon -> server: `task.cancelled` of a sealed task. `reason` is sealed. */
2748
- export declare const TaskCancelledSealedPayloadSchema: z.ZodObject<{
2591
+ agentHomeProjection: z.ZodOptional<z.ZodObject<{
2592
+ profileRevision: z.ZodString;
2593
+ projectionHash: z.ZodString;
2594
+ }, z.core.$strict>>;
2595
+ agentHomeMemoryChange: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2596
+ outcome: z.ZodLiteral<"unchanged">;
2597
+ }, z.core.$strict>, z.ZodObject<{
2598
+ outcome: z.ZodLiteral<"reader-attributed">;
2599
+ paths: z.ZodArray<z.ZodString>;
2600
+ }, z.core.$strict>, z.ZodObject<{
2601
+ outcome: z.ZodLiteral<"unattributed">;
2602
+ paths: z.ZodArray<z.ZodString>;
2603
+ }, z.core.$strict>, z.ZodObject<{
2604
+ outcome: z.ZodLiteral<"unmeasured">;
2605
+ }, z.core.$strict>], "outcome">>;
2606
+ }, z.core.$strip>, z.ZodObject<{
2749
2607
  sealing: z.ZodOptional<z.ZodNever>;
2750
2608
  harnessId: z.ZodOptional<z.ZodString>;
2751
2609
  usage: z.ZodOptional<z.ZodObject<{
@@ -2807,156 +2665,20 @@ export declare const TaskCancelledSealedPayloadSchema: z.ZodObject<{
2807
2665
  contentType: z.ZodString;
2808
2666
  }, z.core.$strict>>;
2809
2667
  }, z.core.$strict>;
2810
- }, z.core.$strict>;
2811
- export type TaskCancelledSealedPayload = z.infer<typeof TaskCancelledSealedPayloadSchema>;
2812
- /** daemon -> server: `task.progress` of a sealed task. `events` is sealed; `seq` names the batch. */
2813
- export declare const TaskProgressSealedPayloadSchema: z.ZodObject<{
2814
- sealing: z.ZodOptional<z.ZodNever>;
2815
- seq: z.ZodNumber;
2816
- sealed: z.ZodObject<{
2817
- v: z.ZodLiteral<1>;
2818
- suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
2819
- category: z.ZodLiteral<"task-output">;
2820
- scope: z.ZodObject<{
2821
- id: z.ZodString;
2822
- epoch: z.ZodNumber;
2823
- keyId: z.ZodString;
2824
- }, z.core.$strict>;
2825
- chainHead: z.ZodObject<{
2826
- seq: z.ZodNumber;
2827
- hash: z.ZodString;
2828
- }, z.core.$strict>;
2829
- sender: z.ZodString;
2830
- salt: z.ZodString;
2831
- nonce: z.ZodString;
2832
- paddedLength: z.ZodNumber;
2833
- contentMac: z.ZodString;
2834
- ciphertext: z.ZodOptional<z.ZodString>;
2835
- ciphertextRef: z.ZodOptional<z.ZodObject<{
2836
- blobId: z.ZodString;
2837
- contentHash: z.ZodString;
2838
- size: z.ZodNumber;
2839
- contentType: z.ZodString;
2840
- }, z.core.$strict>>;
2841
- }, z.core.$strict>;
2842
- }, z.core.$strict>;
2843
- export type TaskProgressSealedPayload = z.infer<typeof TaskProgressSealedPayloadSchema>;
2844
- /**
2845
- * daemon -> server: an inline artifact of a sealed task. `inline` is sealed; a
2846
- * blob artifact is not carried in v1. `artifactId` names the write in the AAD
2847
- * and the content MAC, because two artifacts of one task may share a `name`.
2848
- */
2849
- export declare const TaskArtifactSealedPayloadSchema: z.ZodObject<{
2850
- sealing: z.ZodOptional<z.ZodNever>;
2851
- name: z.ZodString;
2852
- contentType: z.ZodString;
2853
- artifactId: z.ZodUUID;
2854
- sealed: z.ZodObject<{
2855
- v: z.ZodLiteral<1>;
2856
- suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
2857
- category: z.ZodLiteral<"task-output">;
2858
- scope: z.ZodObject<{
2859
- id: z.ZodString;
2860
- epoch: z.ZodNumber;
2861
- keyId: z.ZodString;
2862
- }, z.core.$strict>;
2863
- chainHead: z.ZodObject<{
2864
- seq: z.ZodNumber;
2865
- hash: z.ZodString;
2866
- }, z.core.$strict>;
2867
- sender: z.ZodString;
2868
- salt: z.ZodString;
2869
- nonce: z.ZodString;
2870
- paddedLength: z.ZodNumber;
2871
- contentMac: z.ZodString;
2872
- ciphertext: z.ZodOptional<z.ZodString>;
2873
- ciphertextRef: z.ZodOptional<z.ZodObject<{
2874
- blobId: z.ZodString;
2875
- contentHash: z.ZodString;
2876
- size: z.ZodNumber;
2877
- contentType: z.ZodString;
2878
- }, z.core.$strict>>;
2879
- }, z.core.$strict>;
2880
- }, z.core.$strict>;
2881
- export type TaskArtifactSealedPayload = z.infer<typeof TaskArtifactSealedPayloadSchema>;
2882
- /** daemon -> server: `task.await_approval` of a sealed task. `summary` is sealed; `approvalId` is required. */
2883
- export declare const TaskAwaitApprovalSealedPayloadSchema: z.ZodObject<{
2884
- sealing: z.ZodOptional<z.ZodNever>;
2885
- approvalId: z.ZodString;
2886
- sealed: z.ZodObject<{
2887
- v: z.ZodLiteral<1>;
2888
- suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
2889
- category: z.ZodLiteral<"task-output">;
2890
- scope: z.ZodObject<{
2891
- id: z.ZodString;
2892
- epoch: z.ZodNumber;
2893
- keyId: z.ZodString;
2894
- }, z.core.$strict>;
2895
- chainHead: z.ZodObject<{
2896
- seq: z.ZodNumber;
2897
- hash: z.ZodString;
2898
- }, z.core.$strict>;
2899
- sender: z.ZodString;
2900
- salt: z.ZodString;
2901
- nonce: z.ZodString;
2902
- paddedLength: z.ZodNumber;
2903
- contentMac: z.ZodString;
2904
- ciphertext: z.ZodOptional<z.ZodString>;
2905
- ciphertextRef: z.ZodOptional<z.ZodObject<{
2906
- blobId: z.ZodString;
2907
- contentHash: z.ZodString;
2908
- size: z.ZodNumber;
2909
- contentType: z.ZodString;
2910
- }, z.core.$strict>>;
2911
- }, z.core.$strict>;
2912
- }, z.core.$strict>;
2913
- export type TaskAwaitApprovalSealedPayload = z.infer<typeof TaskAwaitApprovalSealedPayloadSchema>;
2668
+ }, z.core.$strict>]>;
2669
+ export type TaskCancelledPayload = z.infer<typeof TaskCancelledPayloadSchema>;
2914
2670
  /**
2915
- * Protocol-owned task-opening family; the wire registry consumes these same entries.
2916
- *
2917
- * Each value is written `X as typeof X`, here and in `MESSAGE_PAYLOAD_SCHEMAS`.
2918
- * The assertion is type-only (no runtime code). It makes declaration emit
2919
- * name each schema (`typeof X`) instead of copying its full type, which keeps
2920
- * the published `.d.ts` small. Every new entry follows this rule.
2671
+ * Each value is written `X as typeof X`. The assertion is type-only (no
2672
+ * runtime code). It makes declaration emit name each schema (`typeof X`)
2673
+ * instead of copying its full type, which keeps the published `.d.ts` small.
2674
+ * Every new entry follows this rule. Entries are grouped by direction.
2921
2675
  */
2922
- declare const TASK_OFFER_PAYLOAD_SCHEMAS: {
2923
- readonly 'task.offer': typeof TaskOfferPayloadSchema;
2924
- readonly 'task.offer_with_toolsets': typeof TaskOfferWithToolsetsPayloadSchema;
2925
- readonly 'task.offer_for_agent': typeof TaskOfferForAgentPayloadSchema;
2926
- readonly 'task.offer_for_agent_with_egress': typeof TaskOfferForAgentWithEgressPayloadSchema;
2927
- readonly 'task.offer_for_agent_with_egress_fresh': typeof TaskOfferForAgentWithEgressFreshPayloadSchema;
2928
- readonly 'task.offer_prepared': typeof TaskOfferPreparedPayloadSchema;
2929
- readonly 'task.offer_sealed': typeof TaskOfferSealedPayloadSchema;
2930
- readonly 'task.offer_with_toolsets_sealed': typeof TaskOfferWithToolsetsSealedPayloadSchema;
2931
- readonly 'task.offer_for_agent_sealed': typeof TaskOfferForAgentSealedPayloadSchema;
2932
- readonly 'task.offer_for_agent_with_egress_sealed': typeof TaskOfferForAgentWithEgressSealedPayloadSchema;
2933
- readonly 'task.offer_for_agent_with_egress_fresh_sealed': typeof TaskOfferForAgentWithEgressFreshSealedPayloadSchema;
2934
- };
2935
- export type TaskOfferType = keyof typeof TASK_OFFER_PAYLOAD_SCHEMAS;
2936
- export declare const TASK_OFFER_TYPES: readonly TaskOfferType[];
2937
- /** Classify task-opening offers without duplicating the protocol registry in consumers. */
2938
- export declare function isTaskOfferType(type: string): type is TaskOfferType;
2939
2676
  export declare const MESSAGE_PAYLOAD_SCHEMAS: {
2940
- readonly 'task.offer': typeof TaskOfferPayloadSchema;
2941
- readonly 'task.offer_with_toolsets': typeof TaskOfferWithToolsetsPayloadSchema;
2942
- readonly 'task.offer_for_agent': typeof TaskOfferForAgentPayloadSchema;
2943
- readonly 'task.offer_for_agent_with_egress': typeof TaskOfferForAgentWithEgressPayloadSchema;
2944
- readonly 'task.offer_for_agent_with_egress_fresh': typeof TaskOfferForAgentWithEgressFreshPayloadSchema;
2945
- readonly 'task.offer_prepared': typeof TaskOfferPreparedPayloadSchema;
2946
- readonly 'task.offer_sealed': typeof TaskOfferSealedPayloadSchema;
2947
- readonly 'task.offer_with_toolsets_sealed': typeof TaskOfferWithToolsetsSealedPayloadSchema;
2948
- readonly 'task.offer_for_agent_sealed': typeof TaskOfferForAgentSealedPayloadSchema;
2949
- readonly 'task.offer_for_agent_with_egress_sealed': typeof TaskOfferForAgentWithEgressSealedPayloadSchema;
2950
- readonly 'task.offer_for_agent_with_egress_fresh_sealed': typeof TaskOfferForAgentWithEgressFreshSealedPayloadSchema;
2951
2677
  readonly 'conn.hello': typeof ConnHelloPayloadSchema;
2952
- readonly 'conn.ack': typeof ConnAckPayloadSchema;
2953
- readonly 'agent.egress.reliable': typeof AgentEgressReliablePayloadSchema;
2678
+ readonly 'task.offer': typeof TaskOfferPayloadSchema;
2954
2679
  readonly 'agent.egress.ack': typeof AgentEgressAckPayloadSchema;
2955
- readonly 'agent.message.draft': typeof AgentMessageDraftPayloadSchema;
2956
- readonly 'agent.message.publish': typeof AgentMessagePublishPayloadSchema;
2957
2680
  readonly 'agent.message.disposition': typeof AgentMessageDispositionPayloadSchema;
2958
2681
  readonly 'agent.content.read': typeof AgentContentReadPayloadSchema;
2959
- readonly 'agent.content.receipt': typeof AgentContentReceiptPayloadSchema;
2960
2682
  readonly 'agent.home.projection': typeof AgentHomeProjectionPayloadSchema;
2961
2683
  readonly 'agent.input.preparation': typeof AgentInputPreparationPayloadSchema;
2962
2684
  readonly 'provider.provisioning.available': typeof ProviderProvisioningAvailablePayloadSchema;
@@ -2965,6 +2687,7 @@ export declare const MESSAGE_PAYLOAD_SCHEMAS: {
2965
2687
  readonly 'task.reject': typeof TaskRejectPayloadSchema;
2966
2688
  readonly 'task.cancel': typeof TaskCancelPayloadSchema;
2967
2689
  readonly 'task.steer': typeof TaskSteerPayloadSchema;
2690
+ readonly 'e2ee.key_package.available': typeof E2eeKeyPackageAvailablePayloadSchema;
2968
2691
  readonly 'task.claim': typeof TaskClaimPayloadSchema;
2969
2692
  readonly 'task.started': typeof TaskStartedPayloadSchema;
2970
2693
  readonly 'task.decline': typeof TaskDeclinePayloadSchema;
@@ -2975,15 +2698,10 @@ export declare const MESSAGE_PAYLOAD_SCHEMAS: {
2975
2698
  readonly 'task.fail': typeof TaskFailPayloadSchema;
2976
2699
  readonly 'task.cancelled': typeof TaskCancelledPayloadSchema;
2977
2700
  readonly 'task.approval_resolved': typeof TaskApprovalResolvedPayloadSchema;
2978
- readonly 'task.steer_sealed': typeof TaskSteerSealedPayloadSchema;
2979
- readonly 'task.complete_sealed': typeof TaskCompleteSealedPayloadSchema;
2980
- readonly 'task.fail_sealed': typeof TaskFailSealedPayloadSchema;
2981
- readonly 'task.decline_sealed': typeof TaskDeclineSealedPayloadSchema;
2982
- readonly 'task.cancelled_sealed': typeof TaskCancelledSealedPayloadSchema;
2983
- readonly 'task.progress_sealed': typeof TaskProgressSealedPayloadSchema;
2984
- readonly 'task.artifact_sealed': typeof TaskArtifactSealedPayloadSchema;
2985
- readonly 'task.await_approval_sealed': typeof TaskAwaitApprovalSealedPayloadSchema;
2986
- readonly 'e2ee.key_package.available': typeof E2eeKeyPackageAvailablePayloadSchema;
2701
+ readonly 'agent.egress.reliable': typeof AgentEgressReliablePayloadSchema;
2702
+ readonly 'agent.message.draft': typeof AgentMessageDraftPayloadSchema;
2703
+ readonly 'agent.message.publish': typeof AgentMessagePublishPayloadSchema;
2704
+ readonly 'agent.content.receipt': typeof AgentContentReceiptPayloadSchema;
2987
2705
  };
2988
2706
  export type MessageType = keyof typeof MESSAGE_PAYLOAD_SCHEMAS;
2989
2707
  export declare const MESSAGE_TYPES: MessageType[];
@@ -2992,18 +2710,17 @@ export declare const MESSAGE_TYPES: MessageType[];
2992
2710
  * (`envelope.ts`) to decide which branches require envelope `seq` (M1
2993
2711
  * redelivery cursor).
2994
2712
  */
2995
- export declare const SERVER_TO_DAEMON_TYPES: readonly ["conn.ack", "task.offer", "task.offer_with_toolsets", "task.offer_for_agent", "task.offer_for_agent_with_egress", "task.offer_for_agent_with_egress_fresh", "task.offer_prepared", "agent.egress.ack", "agent.message.disposition", "agent.content.read", "agent.home.projection", "agent.input.preparation", "provider.provisioning.available", "agent.memory.intent.available", "task.approve", "task.reject", "task.cancel", "task.steer", "task.offer_sealed", "task.offer_with_toolsets_sealed", "task.offer_for_agent_sealed", "task.offer_for_agent_with_egress_sealed", "task.offer_for_agent_with_egress_fresh_sealed", "task.steer_sealed", "e2ee.key_package.available"];
2713
+ export declare const SERVER_TO_DAEMON_TYPES: readonly ["task.offer", "agent.egress.ack", "agent.message.disposition", "agent.content.read", "agent.home.projection", "agent.input.preparation", "provider.provisioning.available", "agent.memory.intent.available", "task.approve", "task.reject", "task.cancel", "task.steer", "e2ee.key_package.available"];
2996
2714
  /**
2997
2715
  * Message types the daemon sends to the server — the flip side of
2998
- * {@link SERVER_TO_DAEMON_TYPES}. `conn.hello` is deliberately excluded: it's
2999
- * only ever valid as the first frame of a WS handshake (`ws-server.ts`), not
3000
- * as ongoing inbound traffic through `ConnectionHub.handleInbound`.
2716
+ * {@link SERVER_TO_DAEMON_TYPES}. `conn.hello` is deliberately excluded: the
2717
+ * inbound gate handles a bearer-authenticated `conn.hello` as a capability
2718
+ * snapshot on its own, before the type-allow check.
3001
2719
  *
3002
- * Used by `handleInbound` (`@byok-sdk/server`'s `hub.ts`) as the type-allow gate
3003
- * for every inbound envelope, WS and `POST /byok/messages` alike (finding
2720
+ * Used by `handleInboundEnvelope` (`@byok-sdk/cloud`'s `inbound.ts`) as the
2721
+ * type-allow gate for every inbound `POST /byok/messages` envelope (finding
3004
2722
  * P2): a `type` outside this set — a server -> daemon type arriving inbound,
3005
2723
  * or anything unrecognized — is rejected before it's dispatched to any
3006
2724
  * handler or counted `accepted` on the `/byok/messages` wire.
3007
2725
  */
3008
- export declare const DAEMON_TO_SERVER_TYPES: readonly ["task.claim", "task.started", "task.decline", "task.progress", "task.artifact", "task.await_approval", "task.complete", "task.fail", "task.cancelled", "task.approval_resolved", "agent.egress.reliable", "agent.message.draft", "agent.message.publish", "agent.content.receipt", "task.complete_sealed", "task.fail_sealed", "task.decline_sealed", "task.cancelled_sealed", "task.progress_sealed", "task.artifact_sealed", "task.await_approval_sealed"];
3009
- export {};
2726
+ export declare const DAEMON_TO_SERVER_TYPES: readonly ["task.claim", "task.started", "task.decline", "task.progress", "task.artifact", "task.await_approval", "task.complete", "task.fail", "task.cancelled", "task.approval_resolved", "agent.egress.reliable", "agent.message.draft", "agent.message.publish", "agent.content.receipt"];