@byok-sdk/protocol 0.12.0 → 0.14.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.
package/README.md CHANGED
@@ -3,6 +3,12 @@
3
3
  The frozen v1 BYOK device wire contract: envelope schemas, message payloads,
4
4
  codecs, version negotiation, and golden fixtures.
5
5
 
6
+ `provider-profile-binding` is an additive v1 capability for exact device-local
7
+ BYOK routing. Its `byok-profile` selection contains only `profileRef`, canonical
8
+ decimal `profileRevision`, SHA-256 `profileHash`, `modelId`, and bounded
9
+ `requiredCapabilities`. Endpoint, auth configuration, and credential material
10
+ remain outside the protocol.
11
+
6
12
  `TaskOfferPayload.dispatchSelection` is the optional strict dual-lane target
7
13
  contract: subscription selects Claude/Codex + model, while BYOK selects Pi +
8
14
  provider + model. When present it is authoritative and runtime disagreement
@@ -1,4 +1,62 @@
1
1
  import { z } from 'zod';
2
+ /**
3
+ * Maximum UTF-16 length of {@link AgentEventSpillSchema}'s `unstoredReason`.
4
+ * The reason is a bounded diagnostic string, not a place to inline the
5
+ * content that failed to store: the whole point of a spill descriptor is
6
+ * that the event stays under the daemon's inline-event cap even when the
7
+ * blob upload failed.
8
+ */
9
+ export declare const AGENT_EVENT_SPILL_UNSTORED_REASON_MAX_LENGTH = 512;
10
+ /**
11
+ * Additive descriptor attached to a `tool_use` / `tool_result` event whose
12
+ * `input` / `output` was too large to travel inline and was therefore
13
+ * REPLACED, at the daemon's ingestion boundary, by a bounded head/tail
14
+ * preview (`{ preview: { head, tail } }`). See
15
+ * `packages/client/src/daemon/event-spill.ts` for the producer and
16
+ * `DaemonConfig.maxInlineEventBytes` for the cap.
17
+ *
18
+ * Presence of this field is the ONLY signal that the inline field is a
19
+ * projection rather than the whole value — a consumer that reads
20
+ * `tool_result.output` (or `tool_use.input`) without checking `spill` is
21
+ * reading a preview and calling it the result.
22
+ *
23
+ * Exactly one of `blob` / `unstoredReason` is present, and the union is
24
+ * closed on purpose:
25
+ *
26
+ * - `blob` — the full `JSON.stringify(<field>)` bytes are readable from the
27
+ * blob plane (protocol §7) under that `BlobRef`; `contentHash` is the
28
+ * sha256 of exactly those bytes, so a consumer can verify what it read
29
+ * back is what was omitted.
30
+ * - `unstoredReason` — the omitted bytes are not readable from this event:
31
+ * either the upload failed, or it succeeded but the returned locator did
32
+ * not fit the daemon's inline cap. Either way the content is not reachable
33
+ * through this event; the reason says which. This exists so an unreadable
34
+ * omission is observable rather than silently indistinguishable from a
35
+ * small output.
36
+ *
37
+ * `.strict()` because this is an SDK-authored descriptor with a closed
38
+ * shape, not free-form runtime data: an unrecognized key here means a
39
+ * producer and a consumer disagree about what the omission means, which is
40
+ * exactly the case that must fail loudly.
41
+ */
42
+ export declare const AgentEventSpillSchema: z.ZodObject<{
43
+ field: z.ZodEnum<{
44
+ input: "input";
45
+ output: "output";
46
+ }>;
47
+ totalBytes: z.ZodNumber;
48
+ omittedBytes: z.ZodNumber;
49
+ contentType: z.ZodLiteral<"application/json">;
50
+ blob: z.ZodOptional<z.ZodObject<{
51
+ blobId: z.ZodString;
52
+ contentHash: z.ZodString;
53
+ size: z.ZodNumber;
54
+ contentType: z.ZodString;
55
+ url: z.ZodOptional<z.ZodString>;
56
+ }, z.core.$strip>>;
57
+ unstoredReason: z.ZodOptional<z.ZodString>;
58
+ }, z.core.$strict>;
59
+ export type AgentEventSpill = z.infer<typeof AgentEventSpillSchema>;
2
60
  /**
3
61
  * Normalized event shape that every runtime adapter (pi / claude / codex)
4
62
  * translates its native JSONL output into. This is the interior of a
@@ -12,12 +70,46 @@ export declare const AgentEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
12
70
  tool: z.ZodString;
13
71
  input: z.ZodOptional<z.ZodUnknown>;
14
72
  toolCallId: z.ZodOptional<z.ZodString>;
73
+ spill: z.ZodOptional<z.ZodObject<{
74
+ field: z.ZodEnum<{
75
+ input: "input";
76
+ output: "output";
77
+ }>;
78
+ totalBytes: z.ZodNumber;
79
+ omittedBytes: z.ZodNumber;
80
+ contentType: z.ZodLiteral<"application/json">;
81
+ blob: z.ZodOptional<z.ZodObject<{
82
+ blobId: z.ZodString;
83
+ contentHash: z.ZodString;
84
+ size: z.ZodNumber;
85
+ contentType: z.ZodString;
86
+ url: z.ZodOptional<z.ZodString>;
87
+ }, z.core.$strip>>;
88
+ unstoredReason: z.ZodOptional<z.ZodString>;
89
+ }, z.core.$strict>>;
15
90
  }, z.core.$strip>, z.ZodObject<{
16
91
  type: z.ZodLiteral<"tool_result">;
17
92
  tool: z.ZodString;
18
93
  output: z.ZodOptional<z.ZodUnknown>;
19
94
  toolCallId: z.ZodOptional<z.ZodString>;
20
95
  isError: z.ZodOptional<z.ZodBoolean>;
96
+ spill: z.ZodOptional<z.ZodObject<{
97
+ field: z.ZodEnum<{
98
+ input: "input";
99
+ output: "output";
100
+ }>;
101
+ totalBytes: z.ZodNumber;
102
+ omittedBytes: z.ZodNumber;
103
+ contentType: z.ZodLiteral<"application/json">;
104
+ blob: z.ZodOptional<z.ZodObject<{
105
+ blobId: z.ZodString;
106
+ contentHash: z.ZodString;
107
+ size: z.ZodNumber;
108
+ contentType: z.ZodString;
109
+ url: z.ZodOptional<z.ZodString>;
110
+ }, z.core.$strip>>;
111
+ unstoredReason: z.ZodOptional<z.ZodString>;
112
+ }, z.core.$strict>>;
21
113
  }, z.core.$strip>, z.ZodObject<{
22
114
  type: z.ZodLiteral<"artifact">;
23
115
  name: z.ZodString;
@@ -106,12 +198,46 @@ export declare const AgentEventOrUnknownSchema: z.ZodUnion<readonly [z.ZodDiscri
106
198
  tool: z.ZodString;
107
199
  input: z.ZodOptional<z.ZodUnknown>;
108
200
  toolCallId: z.ZodOptional<z.ZodString>;
201
+ spill: z.ZodOptional<z.ZodObject<{
202
+ field: z.ZodEnum<{
203
+ input: "input";
204
+ output: "output";
205
+ }>;
206
+ totalBytes: z.ZodNumber;
207
+ omittedBytes: z.ZodNumber;
208
+ contentType: z.ZodLiteral<"application/json">;
209
+ blob: z.ZodOptional<z.ZodObject<{
210
+ blobId: z.ZodString;
211
+ contentHash: z.ZodString;
212
+ size: z.ZodNumber;
213
+ contentType: z.ZodString;
214
+ url: z.ZodOptional<z.ZodString>;
215
+ }, z.core.$strip>>;
216
+ unstoredReason: z.ZodOptional<z.ZodString>;
217
+ }, z.core.$strict>>;
109
218
  }, z.core.$strip>, z.ZodObject<{
110
219
  type: z.ZodLiteral<"tool_result">;
111
220
  tool: z.ZodString;
112
221
  output: z.ZodOptional<z.ZodUnknown>;
113
222
  toolCallId: z.ZodOptional<z.ZodString>;
114
223
  isError: z.ZodOptional<z.ZodBoolean>;
224
+ spill: z.ZodOptional<z.ZodObject<{
225
+ field: z.ZodEnum<{
226
+ input: "input";
227
+ output: "output";
228
+ }>;
229
+ totalBytes: z.ZodNumber;
230
+ omittedBytes: z.ZodNumber;
231
+ contentType: z.ZodLiteral<"application/json">;
232
+ blob: z.ZodOptional<z.ZodObject<{
233
+ blobId: z.ZodString;
234
+ contentHash: z.ZodString;
235
+ size: z.ZodNumber;
236
+ contentType: z.ZodString;
237
+ url: z.ZodOptional<z.ZodString>;
238
+ }, z.core.$strip>>;
239
+ unstoredReason: z.ZodOptional<z.ZodString>;
240
+ }, z.core.$strict>>;
115
241
  }, z.core.$strip>, z.ZodObject<{
116
242
  type: z.ZodLiteral<"artifact">;
117
243
  name: z.ZodString;
package/dist/codec.d.ts CHANGED
@@ -11,7 +11,7 @@ import { MESSAGE_PAYLOAD_SCHEMAS, type MessageType } from './messages';
11
11
  export declare function parseMessage(data: unknown): Envelope;
12
12
  /**
13
13
  * Decode a single NDJSON line into a validated {@link Envelope}. Accepts a
14
- * string or raw bytes (e.g. a WebSocket binary frame) — isomorphic, no
14
+ * string or raw bytes (e.g. a binary transport frame) — isomorphic, no
15
15
  * stream handling required of the caller.
16
16
  */
17
17
  export declare function decodeEnvelope(line: string | Uint8Array): Envelope;
@@ -110,6 +110,18 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
110
110
  runtimeId: z.ZodLiteral<"pi">;
111
111
  providerId: z.ZodString;
112
112
  modelId: z.ZodString;
113
+ }, z.core.$strict>, z.ZodObject<{
114
+ lane: z.ZodLiteral<"byok-profile">;
115
+ runtimeId: z.ZodLiteral<"pi">;
116
+ providerProfile: z.ZodObject<{
117
+ profileRef: z.ZodString;
118
+ profileRevision: z.ZodString;
119
+ profileHash: z.ZodString;
120
+ modelId: z.ZodString;
121
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
122
+ "image-input": "image-input";
123
+ }>>;
124
+ }, z.core.$strict>;
113
125
  }, z.core.$strict>], "lane">>;
114
126
  sessionRef: z.ZodOptional<z.ZodString>;
115
127
  workspaceHint: z.ZodOptional<z.ZodString>;
@@ -166,6 +178,18 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
166
178
  runtimeId: z.ZodLiteral<"pi">;
167
179
  providerId: z.ZodString;
168
180
  modelId: z.ZodString;
181
+ }, z.core.$strict>, z.ZodObject<{
182
+ lane: z.ZodLiteral<"byok-profile">;
183
+ runtimeId: z.ZodLiteral<"pi">;
184
+ providerProfile: z.ZodObject<{
185
+ profileRef: z.ZodString;
186
+ profileRevision: z.ZodString;
187
+ profileHash: z.ZodString;
188
+ modelId: z.ZodString;
189
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
190
+ "image-input": "image-input";
191
+ }>>;
192
+ }, z.core.$strict>;
169
193
  }, z.core.$strict>], "lane">>;
170
194
  sessionRef: z.ZodOptional<z.ZodString>;
171
195
  workspaceHint: z.ZodOptional<z.ZodString>;
@@ -228,6 +252,18 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
228
252
  runtimeId: z.ZodLiteral<"pi">;
229
253
  providerId: z.ZodString;
230
254
  modelId: z.ZodString;
255
+ }, z.core.$strict>, z.ZodObject<{
256
+ lane: z.ZodLiteral<"byok-profile">;
257
+ runtimeId: z.ZodLiteral<"pi">;
258
+ providerProfile: z.ZodObject<{
259
+ profileRef: z.ZodString;
260
+ profileRevision: z.ZodString;
261
+ profileHash: z.ZodString;
262
+ modelId: z.ZodString;
263
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
264
+ "image-input": "image-input";
265
+ }>>;
266
+ }, z.core.$strict>;
231
267
  }, z.core.$strict>], "lane">>;
232
268
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
233
269
  mode: z.ZodLiteral<"none">;
@@ -294,6 +330,18 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
294
330
  runtimeId: z.ZodLiteral<"pi">;
295
331
  providerId: z.ZodString;
296
332
  modelId: z.ZodString;
333
+ }, z.core.$strict>, z.ZodObject<{
334
+ lane: z.ZodLiteral<"byok-profile">;
335
+ runtimeId: z.ZodLiteral<"pi">;
336
+ providerProfile: z.ZodObject<{
337
+ profileRef: z.ZodString;
338
+ profileRevision: z.ZodString;
339
+ profileHash: z.ZodString;
340
+ modelId: z.ZodString;
341
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
342
+ "image-input": "image-input";
343
+ }>>;
344
+ }, z.core.$strict>;
297
345
  }, z.core.$strict>], "lane">>;
298
346
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
299
347
  mode: z.ZodLiteral<"none">;
@@ -400,6 +448,18 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
400
448
  runtimeId: z.ZodLiteral<"pi">;
401
449
  providerId: z.ZodString;
402
450
  modelId: z.ZodString;
451
+ }, z.core.$strict>, z.ZodObject<{
452
+ lane: z.ZodLiteral<"byok-profile">;
453
+ runtimeId: z.ZodLiteral<"pi">;
454
+ providerProfile: z.ZodObject<{
455
+ profileRef: z.ZodString;
456
+ profileRevision: z.ZodString;
457
+ profileHash: z.ZodString;
458
+ modelId: z.ZodString;
459
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
460
+ "image-input": "image-input";
461
+ }>>;
462
+ }, z.core.$strict>;
403
463
  }, z.core.$strict>], "lane">>;
404
464
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
405
465
  mode: z.ZodLiteral<"none">;
@@ -676,12 +736,46 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
676
736
  tool: z.ZodString;
677
737
  input: z.ZodOptional<z.ZodUnknown>;
678
738
  toolCallId: z.ZodOptional<z.ZodString>;
739
+ spill: z.ZodOptional<z.ZodObject<{
740
+ field: z.ZodEnum<{
741
+ input: "input";
742
+ output: "output";
743
+ }>;
744
+ totalBytes: z.ZodNumber;
745
+ omittedBytes: z.ZodNumber;
746
+ contentType: z.ZodLiteral<"application/json">;
747
+ blob: z.ZodOptional<z.ZodObject<{
748
+ blobId: z.ZodString;
749
+ contentHash: z.ZodString;
750
+ size: z.ZodNumber;
751
+ contentType: z.ZodString;
752
+ url: z.ZodOptional<z.ZodString>;
753
+ }, z.core.$strip>>;
754
+ unstoredReason: z.ZodOptional<z.ZodString>;
755
+ }, z.core.$strict>>;
679
756
  }, z.core.$strip>, z.ZodObject<{
680
757
  type: z.ZodLiteral<"tool_result">;
681
758
  tool: z.ZodString;
682
759
  output: z.ZodOptional<z.ZodUnknown>;
683
760
  toolCallId: z.ZodOptional<z.ZodString>;
684
761
  isError: z.ZodOptional<z.ZodBoolean>;
762
+ spill: z.ZodOptional<z.ZodObject<{
763
+ field: z.ZodEnum<{
764
+ input: "input";
765
+ output: "output";
766
+ }>;
767
+ totalBytes: z.ZodNumber;
768
+ omittedBytes: z.ZodNumber;
769
+ contentType: z.ZodLiteral<"application/json">;
770
+ blob: z.ZodOptional<z.ZodObject<{
771
+ blobId: z.ZodString;
772
+ contentHash: z.ZodString;
773
+ size: z.ZodNumber;
774
+ contentType: z.ZodString;
775
+ url: z.ZodOptional<z.ZodString>;
776
+ }, z.core.$strip>>;
777
+ unstoredReason: z.ZodOptional<z.ZodString>;
778
+ }, z.core.$strict>>;
685
779
  }, z.core.$strip>, z.ZodObject<{
686
780
  type: z.ZodLiteral<"artifact">;
687
781
  name: z.ZodString;
@@ -3,12 +3,12 @@ import { z } from 'zod';
3
3
  * HTTP-side request/response shapes for the reference server's auth and blob
4
4
  * endpoints (M1 Part B). These are plain HTTP bodies, not wire envelopes —
5
5
  * kept in a separate module from `envelope.ts`/`messages.ts` because they
6
- * never travel over the WSS connection. Documented in full in
7
- * docs/protocol.md ("Auth flows", "Blob flows", "Long-poll fallback").
6
+ * are HTTP request/response bodies rather than mailbox envelopes. Documented
7
+ * in full in docs/protocol.md ("Auth flows", "Blob flows", "Long-poll").
8
8
  *
9
9
  * The wire protocol version (`v:1`) is unaffected by any of this: pairing,
10
- * token renewal, and blob transfer are out-of-band HTTP calls that happen
11
- * before/alongside the WSS connection, not envelope types.
10
+ * token renewal, and blob transfer are separate HTTP calls around the
11
+ * long-poll mailbox lifecycle, not envelope types.
12
12
  */
13
13
  export declare const PairRequestSchema: z.ZodObject<{
14
14
  pairingCode: z.ZodString;
@@ -83,7 +83,7 @@ export type PresencePublishRequest = z.infer<typeof PresencePublishRequestSchema
83
83
  /**
84
84
  * Revocation is server-side only (dashboard/API call on the SaaS's own
85
85
  * device registry) — there is no wire message for it. A revoked device's
86
- * next `/byok/challenge` or `/byok/token` call (or WSS connect) gets a 401;
86
+ * next `/byok/challenge`, `/byok/token`, or authenticated mailbox call gets a 401;
87
87
  * the daemon's only recourse is to re-run `/byok/pair` from scratch.
88
88
  */
89
89
  /** POST /byok/blobs request: declare a blob before uploading it. `contentHash` must be the canonical `sha256:<64 lowercase hex>` form (finding F9) — the server rejects anything else outright, no normalization. */
@@ -203,6 +203,18 @@ export declare const EventsPollResponseSchema: z.ZodObject<{
203
203
  runtimeId: z.ZodLiteral<"pi">;
204
204
  providerId: z.ZodString;
205
205
  modelId: z.ZodString;
206
+ }, z.core.$strict>, z.ZodObject<{
207
+ lane: z.ZodLiteral<"byok-profile">;
208
+ runtimeId: z.ZodLiteral<"pi">;
209
+ providerProfile: z.ZodObject<{
210
+ profileRef: z.ZodString;
211
+ profileRevision: z.ZodString;
212
+ profileHash: z.ZodString;
213
+ modelId: z.ZodString;
214
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
215
+ "image-input": "image-input";
216
+ }>>;
217
+ }, z.core.$strict>;
206
218
  }, z.core.$strict>], "lane">>;
207
219
  sessionRef: z.ZodOptional<z.ZodString>;
208
220
  workspaceHint: z.ZodOptional<z.ZodString>;
@@ -259,6 +271,18 @@ export declare const EventsPollResponseSchema: z.ZodObject<{
259
271
  runtimeId: z.ZodLiteral<"pi">;
260
272
  providerId: z.ZodString;
261
273
  modelId: z.ZodString;
274
+ }, z.core.$strict>, z.ZodObject<{
275
+ lane: z.ZodLiteral<"byok-profile">;
276
+ runtimeId: z.ZodLiteral<"pi">;
277
+ providerProfile: z.ZodObject<{
278
+ profileRef: z.ZodString;
279
+ profileRevision: z.ZodString;
280
+ profileHash: z.ZodString;
281
+ modelId: z.ZodString;
282
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
283
+ "image-input": "image-input";
284
+ }>>;
285
+ }, z.core.$strict>;
262
286
  }, z.core.$strict>], "lane">>;
263
287
  sessionRef: z.ZodOptional<z.ZodString>;
264
288
  workspaceHint: z.ZodOptional<z.ZodString>;
@@ -321,6 +345,18 @@ export declare const EventsPollResponseSchema: z.ZodObject<{
321
345
  runtimeId: z.ZodLiteral<"pi">;
322
346
  providerId: z.ZodString;
323
347
  modelId: z.ZodString;
348
+ }, z.core.$strict>, z.ZodObject<{
349
+ lane: z.ZodLiteral<"byok-profile">;
350
+ runtimeId: z.ZodLiteral<"pi">;
351
+ providerProfile: z.ZodObject<{
352
+ profileRef: z.ZodString;
353
+ profileRevision: z.ZodString;
354
+ profileHash: z.ZodString;
355
+ modelId: z.ZodString;
356
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
357
+ "image-input": "image-input";
358
+ }>>;
359
+ }, z.core.$strict>;
324
360
  }, z.core.$strict>], "lane">>;
325
361
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
326
362
  mode: z.ZodLiteral<"none">;
@@ -387,6 +423,18 @@ export declare const EventsPollResponseSchema: z.ZodObject<{
387
423
  runtimeId: z.ZodLiteral<"pi">;
388
424
  providerId: z.ZodString;
389
425
  modelId: z.ZodString;
426
+ }, z.core.$strict>, z.ZodObject<{
427
+ lane: z.ZodLiteral<"byok-profile">;
428
+ runtimeId: z.ZodLiteral<"pi">;
429
+ providerProfile: z.ZodObject<{
430
+ profileRef: z.ZodString;
431
+ profileRevision: z.ZodString;
432
+ profileHash: z.ZodString;
433
+ modelId: z.ZodString;
434
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
435
+ "image-input": "image-input";
436
+ }>>;
437
+ }, z.core.$strict>;
390
438
  }, z.core.$strict>], "lane">>;
391
439
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
392
440
  mode: z.ZodLiteral<"none">;
@@ -493,6 +541,18 @@ export declare const EventsPollResponseSchema: z.ZodObject<{
493
541
  runtimeId: z.ZodLiteral<"pi">;
494
542
  providerId: z.ZodString;
495
543
  modelId: z.ZodString;
544
+ }, z.core.$strict>, z.ZodObject<{
545
+ lane: z.ZodLiteral<"byok-profile">;
546
+ runtimeId: z.ZodLiteral<"pi">;
547
+ providerProfile: z.ZodObject<{
548
+ profileRef: z.ZodString;
549
+ profileRevision: z.ZodString;
550
+ profileHash: z.ZodString;
551
+ modelId: z.ZodString;
552
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
553
+ "image-input": "image-input";
554
+ }>>;
555
+ }, z.core.$strict>;
496
556
  }, z.core.$strict>], "lane">>;
497
557
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
498
558
  mode: z.ZodLiteral<"none">;
@@ -769,12 +829,46 @@ export declare const EventsPollResponseSchema: z.ZodObject<{
769
829
  tool: z.ZodString;
770
830
  input: z.ZodOptional<z.ZodUnknown>;
771
831
  toolCallId: z.ZodOptional<z.ZodString>;
832
+ spill: z.ZodOptional<z.ZodObject<{
833
+ field: z.ZodEnum<{
834
+ input: "input";
835
+ output: "output";
836
+ }>;
837
+ totalBytes: z.ZodNumber;
838
+ omittedBytes: z.ZodNumber;
839
+ contentType: z.ZodLiteral<"application/json">;
840
+ blob: z.ZodOptional<z.ZodObject<{
841
+ blobId: z.ZodString;
842
+ contentHash: z.ZodString;
843
+ size: z.ZodNumber;
844
+ contentType: z.ZodString;
845
+ url: z.ZodOptional<z.ZodString>;
846
+ }, z.core.$strip>>;
847
+ unstoredReason: z.ZodOptional<z.ZodString>;
848
+ }, z.core.$strict>>;
772
849
  }, z.core.$strip>, z.ZodObject<{
773
850
  type: z.ZodLiteral<"tool_result">;
774
851
  tool: z.ZodString;
775
852
  output: z.ZodOptional<z.ZodUnknown>;
776
853
  toolCallId: z.ZodOptional<z.ZodString>;
777
854
  isError: z.ZodOptional<z.ZodBoolean>;
855
+ spill: z.ZodOptional<z.ZodObject<{
856
+ field: z.ZodEnum<{
857
+ input: "input";
858
+ output: "output";
859
+ }>;
860
+ totalBytes: z.ZodNumber;
861
+ omittedBytes: z.ZodNumber;
862
+ contentType: z.ZodLiteral<"application/json">;
863
+ blob: z.ZodOptional<z.ZodObject<{
864
+ blobId: z.ZodString;
865
+ contentHash: z.ZodString;
866
+ size: z.ZodNumber;
867
+ contentType: z.ZodString;
868
+ url: z.ZodOptional<z.ZodString>;
869
+ }, z.core.$strip>>;
870
+ unstoredReason: z.ZodOptional<z.ZodString>;
871
+ }, z.core.$strict>>;
778
872
  }, z.core.$strip>, z.ZodObject<{
779
873
  type: z.ZodLiteral<"artifact">;
780
874
  name: z.ZodString;
@@ -1213,6 +1307,18 @@ export declare const MessagesSendRequestSchema: z.ZodObject<{
1213
1307
  runtimeId: z.ZodLiteral<"pi">;
1214
1308
  providerId: z.ZodString;
1215
1309
  modelId: z.ZodString;
1310
+ }, z.core.$strict>, z.ZodObject<{
1311
+ lane: z.ZodLiteral<"byok-profile">;
1312
+ runtimeId: z.ZodLiteral<"pi">;
1313
+ providerProfile: z.ZodObject<{
1314
+ profileRef: z.ZodString;
1315
+ profileRevision: z.ZodString;
1316
+ profileHash: z.ZodString;
1317
+ modelId: z.ZodString;
1318
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
1319
+ "image-input": "image-input";
1320
+ }>>;
1321
+ }, z.core.$strict>;
1216
1322
  }, z.core.$strict>], "lane">>;
1217
1323
  sessionRef: z.ZodOptional<z.ZodString>;
1218
1324
  workspaceHint: z.ZodOptional<z.ZodString>;
@@ -1269,6 +1375,18 @@ export declare const MessagesSendRequestSchema: z.ZodObject<{
1269
1375
  runtimeId: z.ZodLiteral<"pi">;
1270
1376
  providerId: z.ZodString;
1271
1377
  modelId: z.ZodString;
1378
+ }, z.core.$strict>, z.ZodObject<{
1379
+ lane: z.ZodLiteral<"byok-profile">;
1380
+ runtimeId: z.ZodLiteral<"pi">;
1381
+ providerProfile: z.ZodObject<{
1382
+ profileRef: z.ZodString;
1383
+ profileRevision: z.ZodString;
1384
+ profileHash: z.ZodString;
1385
+ modelId: z.ZodString;
1386
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
1387
+ "image-input": "image-input";
1388
+ }>>;
1389
+ }, z.core.$strict>;
1272
1390
  }, z.core.$strict>], "lane">>;
1273
1391
  sessionRef: z.ZodOptional<z.ZodString>;
1274
1392
  workspaceHint: z.ZodOptional<z.ZodString>;
@@ -1331,6 +1449,18 @@ export declare const MessagesSendRequestSchema: z.ZodObject<{
1331
1449
  runtimeId: z.ZodLiteral<"pi">;
1332
1450
  providerId: z.ZodString;
1333
1451
  modelId: z.ZodString;
1452
+ }, z.core.$strict>, z.ZodObject<{
1453
+ lane: z.ZodLiteral<"byok-profile">;
1454
+ runtimeId: z.ZodLiteral<"pi">;
1455
+ providerProfile: z.ZodObject<{
1456
+ profileRef: z.ZodString;
1457
+ profileRevision: z.ZodString;
1458
+ profileHash: z.ZodString;
1459
+ modelId: z.ZodString;
1460
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
1461
+ "image-input": "image-input";
1462
+ }>>;
1463
+ }, z.core.$strict>;
1334
1464
  }, z.core.$strict>], "lane">>;
1335
1465
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1336
1466
  mode: z.ZodLiteral<"none">;
@@ -1397,6 +1527,18 @@ export declare const MessagesSendRequestSchema: z.ZodObject<{
1397
1527
  runtimeId: z.ZodLiteral<"pi">;
1398
1528
  providerId: z.ZodString;
1399
1529
  modelId: z.ZodString;
1530
+ }, z.core.$strict>, z.ZodObject<{
1531
+ lane: z.ZodLiteral<"byok-profile">;
1532
+ runtimeId: z.ZodLiteral<"pi">;
1533
+ providerProfile: z.ZodObject<{
1534
+ profileRef: z.ZodString;
1535
+ profileRevision: z.ZodString;
1536
+ profileHash: z.ZodString;
1537
+ modelId: z.ZodString;
1538
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
1539
+ "image-input": "image-input";
1540
+ }>>;
1541
+ }, z.core.$strict>;
1400
1542
  }, z.core.$strict>], "lane">>;
1401
1543
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1402
1544
  mode: z.ZodLiteral<"none">;
@@ -1503,6 +1645,18 @@ export declare const MessagesSendRequestSchema: z.ZodObject<{
1503
1645
  runtimeId: z.ZodLiteral<"pi">;
1504
1646
  providerId: z.ZodString;
1505
1647
  modelId: z.ZodString;
1648
+ }, z.core.$strict>, z.ZodObject<{
1649
+ lane: z.ZodLiteral<"byok-profile">;
1650
+ runtimeId: z.ZodLiteral<"pi">;
1651
+ providerProfile: z.ZodObject<{
1652
+ profileRef: z.ZodString;
1653
+ profileRevision: z.ZodString;
1654
+ profileHash: z.ZodString;
1655
+ modelId: z.ZodString;
1656
+ requiredCapabilities: z.ZodArray<z.ZodEnum<{
1657
+ "image-input": "image-input";
1658
+ }>>;
1659
+ }, z.core.$strict>;
1506
1660
  }, z.core.$strict>], "lane">>;
1507
1661
  terminalProjection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1508
1662
  mode: z.ZodLiteral<"none">;
@@ -1779,12 +1933,46 @@ export declare const MessagesSendRequestSchema: z.ZodObject<{
1779
1933
  tool: z.ZodString;
1780
1934
  input: z.ZodOptional<z.ZodUnknown>;
1781
1935
  toolCallId: z.ZodOptional<z.ZodString>;
1936
+ spill: z.ZodOptional<z.ZodObject<{
1937
+ field: z.ZodEnum<{
1938
+ input: "input";
1939
+ output: "output";
1940
+ }>;
1941
+ totalBytes: z.ZodNumber;
1942
+ omittedBytes: z.ZodNumber;
1943
+ contentType: z.ZodLiteral<"application/json">;
1944
+ blob: z.ZodOptional<z.ZodObject<{
1945
+ blobId: z.ZodString;
1946
+ contentHash: z.ZodString;
1947
+ size: z.ZodNumber;
1948
+ contentType: z.ZodString;
1949
+ url: z.ZodOptional<z.ZodString>;
1950
+ }, z.core.$strip>>;
1951
+ unstoredReason: z.ZodOptional<z.ZodString>;
1952
+ }, z.core.$strict>>;
1782
1953
  }, z.core.$strip>, z.ZodObject<{
1783
1954
  type: z.ZodLiteral<"tool_result">;
1784
1955
  tool: z.ZodString;
1785
1956
  output: z.ZodOptional<z.ZodUnknown>;
1786
1957
  toolCallId: z.ZodOptional<z.ZodString>;
1787
1958
  isError: z.ZodOptional<z.ZodBoolean>;
1959
+ spill: z.ZodOptional<z.ZodObject<{
1960
+ field: z.ZodEnum<{
1961
+ input: "input";
1962
+ output: "output";
1963
+ }>;
1964
+ totalBytes: z.ZodNumber;
1965
+ omittedBytes: z.ZodNumber;
1966
+ contentType: z.ZodLiteral<"application/json">;
1967
+ blob: z.ZodOptional<z.ZodObject<{
1968
+ blobId: z.ZodString;
1969
+ contentHash: z.ZodString;
1970
+ size: z.ZodNumber;
1971
+ contentType: z.ZodString;
1972
+ url: z.ZodOptional<z.ZodString>;
1973
+ }, z.core.$strip>>;
1974
+ unstoredReason: z.ZodOptional<z.ZodString>;
1975
+ }, z.core.$strict>>;
1788
1976
  }, z.core.$strip>, z.ZodObject<{
1789
1977
  type: z.ZodLiteral<"artifact">;
1790
1978
  name: z.ZodString;
@@ -2119,12 +2307,10 @@ export declare const MessagesSendRequestSchema: z.ZodObject<{
2119
2307
  export type MessagesSendRequest = z.infer<typeof MessagesSendRequestSchema>;
2120
2308
  /**
2121
2309
  * `accepted` counts every envelope `ConnectionHub.handleInbound` returned
2122
- * `'accepted'` *or* `'duplicate'` for (finding P2) — a dedup'd replay is a
2123
- * wire-level success (§9's idempotency window), even though no handler ran
2124
- * for it a second time. `rejected` (a type outside `DAEMON_TO_SERVER_TYPES`,
2125
- * or an ownership mismatch — N2) is a separate, additive count: omitted
2126
- * entirely when zero, so a batch with nothing rejected keeps the pre-P2
2127
- * `{ accepted }` shape callers already depend on.
2310
+ * `'accepted'` *or* `'duplicate'` for — a deduped replay is a wire-level
2311
+ * success even though the business mutation did not run a second time.
2312
+ * `rejected` is additive and omitted when zero, preserving frozen v1's
2313
+ * `{ accepted }` response shape.
2128
2314
  */
2129
2315
  export declare const MessagesSendResponseSchema: z.ZodObject<{
2130
2316
  accepted: z.ZodNumber;
@@ -2229,8 +2415,6 @@ export declare const AgentMemoryProjectionCommitResponseSchema: z.ZodObject<{
2229
2415
  }, z.core.$strict>;
2230
2416
  }, z.core.$strict>;
2231
2417
  export type AgentMemoryProjectionCommitResponse = z.infer<typeof AgentMemoryProjectionCommitResponseSchema>;
2232
- /** `GET /byok/ws` — WebSocket upgrade path. */
2233
- export declare const BYOK_WS_PATH = "/byok/ws";
2234
2418
  /** `POST /byok/pair` — one-time device pairing (§6). */
2235
2419
  export declare const BYOK_PAIR_PATH = "/byok/pair";
2236
2420
  /** `POST /byok/challenge` — token-renewal challenge (§6.3). */