@byok-sdk/protocol 0.5.0 → 0.6.1

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.
@@ -0,0 +1,144 @@
1
+ import { z } from 'zod';
2
+ /** Additive daemon capability names. Server/cloud admission consumes these exactly. */
3
+ export declare const AGENT_EGRESS_POLICY_CAPABILITY: 'agent-egress-policy';
4
+ export declare const AGENT_EGRESS_RELIABLE_ACK_CAPABILITY: 'agent-egress-reliable-ack';
5
+ export declare const AGENT_CONTENT_WORKSPACE_READ_CAPABILITY: 'agent-content-workspace-read';
6
+ export declare const AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY: 'agent-content-transcript-read';
7
+ export declare const AGENT_CONTENT_ARTIFACT_READ_CAPABILITY: 'agent-content-artifact-read';
8
+ export declare const AgentContentMimeTypeSchema: z.ZodString;
9
+ /** Explicit MIME and byte policy for one independently-authorized content surface. */
10
+ export declare const ContentReadPolicySchema: z.ZodObject<{
11
+ maxBytes: z.ZodNumber;
12
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
13
+ }, z.core.$strict>;
14
+ export type ContentReadPolicy = z.infer<typeof ContentReadPolicySchema>;
15
+ export declare const AgentEgressActivityPolicySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
16
+ mode: z.ZodLiteral<"metadata-status">;
17
+ delivery: z.ZodLiteral<"latest-value">;
18
+ }, z.core.$strict>, z.ZodObject<{
19
+ mode: z.ZodLiteral<"contentful-trajectory">;
20
+ delivery: z.ZodLiteral<"latest-value">;
21
+ maxCoalesceMs: z.ZodNumber;
22
+ maxEventBytes: z.ZodNumber;
23
+ }, z.core.$strict>], "mode">;
24
+ export type AgentEgressActivityPolicy = z.infer<typeof AgentEgressActivityPolicySchema>;
25
+ export declare const AgentReliableQuotaPolicySchema: z.ZodObject<{
26
+ maxPendingEventsPerAgent: z.ZodNumber;
27
+ maxPendingBytesPerAgent: z.ZodNumber;
28
+ maxPendingBytesPerTenant: z.ZodNumber;
29
+ }, z.core.$strict>;
30
+ export type AgentReliableQuotaPolicy = z.infer<typeof AgentReliableQuotaPolicySchema>;
31
+ /**
32
+ * The only consumable policy shape for Agent egress. Missing/unknown policy
33
+ * is intentionally not represented as a default: callers must select a
34
+ * revision and all three content surfaces independently.
35
+ */
36
+ export declare const AgentEgressPolicySchema: z.ZodObject<{
37
+ policyRevision: z.ZodString;
38
+ activity: z.ZodDiscriminatedUnion<[z.ZodObject<{
39
+ mode: z.ZodLiteral<"metadata-status">;
40
+ delivery: z.ZodLiteral<"latest-value">;
41
+ }, z.core.$strict>, z.ZodObject<{
42
+ mode: z.ZodLiteral<"contentful-trajectory">;
43
+ delivery: z.ZodLiteral<"latest-value">;
44
+ maxCoalesceMs: z.ZodNumber;
45
+ maxEventBytes: z.ZodNumber;
46
+ }, z.core.$strict>], "mode">;
47
+ reliable: z.ZodObject<{
48
+ maxPendingEventsPerAgent: z.ZodNumber;
49
+ maxPendingBytesPerAgent: z.ZodNumber;
50
+ maxPendingBytesPerTenant: z.ZodNumber;
51
+ }, z.core.$strict>;
52
+ transfers: z.ZodObject<{
53
+ workspace: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
54
+ maxBytes: z.ZodNumber;
55
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
56
+ }, z.core.$strict>]>;
57
+ transcript: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
58
+ maxBytes: z.ZodNumber;
59
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
60
+ }, z.core.$strict>]>;
61
+ artifact: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
62
+ maxBytes: z.ZodNumber;
63
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
64
+ }, z.core.$strict>]>;
65
+ }, z.core.$strict>;
66
+ }, z.core.$strict>;
67
+ export type AgentEgressPolicy = z.infer<typeof AgentEgressPolicySchema>;
68
+ /** Delivery stores are semantically distinct; this enum is never a durable boolean. */
69
+ export declare const AgentEgressLaneSchema: z.ZodEnum<{
70
+ "latest-value": "latest-value";
71
+ reliable: "reliable";
72
+ }>;
73
+ export type AgentEgressLane = z.infer<typeof AgentEgressLaneSchema>;
74
+ /** Every refusal/replacement is observable rather than silently degrading to another lane. */
75
+ export declare const AgentEgressDropReasonSchema: z.ZodEnum<{
76
+ ack_mismatch: "ack_mismatch";
77
+ backpressure: "backpressure";
78
+ capability_missing: "capability_missing";
79
+ coalesced: "coalesced";
80
+ disconnected: "disconnected";
81
+ invalid_envelope: "invalid_envelope";
82
+ policy_denied: "policy_denied";
83
+ quota_exceeded: "quota_exceeded";
84
+ sanitizer_rejected: "sanitizer_rejected";
85
+ }>;
86
+ export type AgentEgressDropReason = z.infer<typeof AgentEgressDropReasonSchema>;
87
+ export declare const AgentContentReadSurfaceSchema: z.ZodEnum<{
88
+ artifact: "artifact";
89
+ transcript: "transcript";
90
+ workspace: "workspace";
91
+ }>;
92
+ export type AgentContentReadSurface = z.infer<typeof AgentContentReadSurfaceSchema>;
93
+ /** The product-selected actor is explicit; tenant/device are bound by the authenticated transport. */
94
+ export declare const AgentContentActorKindSchema: z.ZodEnum<{
95
+ agent: "agent";
96
+ system: "system";
97
+ user: "user";
98
+ }>;
99
+ export type AgentContentActorKind = z.infer<typeof AgentContentActorKindSchema>;
100
+ export declare const AgentContentActorSchema: z.ZodObject<{
101
+ kind: z.ZodEnum<{
102
+ agent: "agent";
103
+ system: "system";
104
+ user: "user";
105
+ }>;
106
+ id: z.ZodString;
107
+ }, z.core.$strict>;
108
+ export type AgentContentActor = z.infer<typeof AgentContentActorSchema>;
109
+ /** No byte/text interpretation is inferred from a target name or MIME declaration. */
110
+ export declare const AgentContentDecodeAsSchema: z.ZodEnum<{
111
+ bytes: "bytes";
112
+ utf8: "utf8";
113
+ }>;
114
+ export type AgentContentDecodeAs = z.infer<typeof AgentContentDecodeAsSchema>;
115
+ export declare const AgentContentReadDecisionSchema: z.ZodEnum<{
116
+ allowed: "allowed";
117
+ denied: "denied";
118
+ }>;
119
+ export type AgentContentReadDecision = z.infer<typeof AgentContentReadDecisionSchema>;
120
+ export declare const AgentContentReadDenialReasonSchema: z.ZodEnum<{
121
+ "absolute-target": "absolute-target";
122
+ "byte-limit": "byte-limit";
123
+ "capability-missing": "capability-missing";
124
+ "dot-segment": "dot-segment";
125
+ "identity-mismatch": "identity-mismatch";
126
+ "invalid-request": "invalid-request";
127
+ "mime-not-allowlisted": "mime-not-allowlisted";
128
+ "non-relative-target": "non-relative-target";
129
+ "not-regular-file": "not-regular-file";
130
+ "path-escape": "path-escape";
131
+ "policy-disabled": "policy-disabled";
132
+ "policy-revision-mismatch": "policy-revision-mismatch";
133
+ "root-invalid": "root-invalid";
134
+ "root-not-allowlisted": "root-not-allowlisted";
135
+ "sensitive-name": "sensitive-name";
136
+ symlink: "symlink";
137
+ "target-missing": "target-missing";
138
+ "text-decode-failed": "text-decode-failed";
139
+ "text-not-allowlisted": "text-not-allowlisted";
140
+ }>;
141
+ export type AgentContentReadDenialReason = z.infer<typeof AgentContentReadDenialReasonSchema>;
142
+ /** SHA-256 transport receipt hash, never a content byte projection. */
143
+ export declare const AgentEgressContentHashSchema: z.ZodString;
144
+ export declare const AgentEgressPolicyRevisionSchema: z.ZodString;
package/dist/codec.d.ts CHANGED
@@ -34,6 +34,30 @@ interface EnvelopeShapeOptions {
34
34
  taskId: string;
35
35
  seq: number;
36
36
  };
37
+ 'task.offer_for_agent': {
38
+ taskId: string;
39
+ seq: number;
40
+ };
41
+ 'task.offer_for_agent_with_egress': {
42
+ taskId: string;
43
+ seq: number;
44
+ };
45
+ 'agent.egress.reliable': {
46
+ taskId?: string;
47
+ seq?: number;
48
+ };
49
+ 'agent.egress.ack': {
50
+ taskId?: string;
51
+ seq: number;
52
+ };
53
+ 'agent.content.read': {
54
+ taskId?: string;
55
+ seq: number;
56
+ };
57
+ 'agent.content.receipt': {
58
+ taskId?: string;
59
+ seq?: number;
60
+ };
37
61
  'task.approve': {
38
62
  taskId: string;
39
63
  seq: number;
@@ -29,6 +29,7 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
29
29
  capabilities: z.ZodArray<z.ZodString>;
30
30
  deviceId: z.ZodString;
31
31
  productId: z.ZodString;
32
+ clientVersion: z.ZodOptional<z.ZodString>;
32
33
  runtimes: z.ZodOptional<z.ZodArray<z.ZodObject<{
33
34
  id: z.ZodEnum<{
34
35
  claude: "claude";
@@ -174,6 +175,222 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
174
175
  }, z.core.$strip>>;
175
176
  requiredToolsets: z.ZodArray<z.ZodString>;
176
177
  }, z.core.$strict>;
178
+ }, z.core.$strip>, z.ZodObject<{
179
+ v: z.ZodNumber;
180
+ id: z.ZodUUID;
181
+ ts: z.ZodISODateTime;
182
+ type: z.ZodLiteral<"task.offer_for_agent">;
183
+ task_id: z.ZodString;
184
+ session_ref: z.ZodOptional<z.ZodString>;
185
+ seq: z.ZodNumber;
186
+ payload: z.ZodObject<{
187
+ instruction: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
188
+ blobRef: z.ZodObject<{
189
+ blobId: z.ZodString;
190
+ contentHash: z.ZodString;
191
+ size: z.ZodNumber;
192
+ contentType: z.ZodString;
193
+ url: z.ZodOptional<z.ZodString>;
194
+ }, z.core.$strip>;
195
+ }, z.core.$strict>]>;
196
+ policy: z.ZodObject<{
197
+ mode: z.ZodEnum<{
198
+ auto: "auto";
199
+ confirm: "confirm";
200
+ plan: "plan";
201
+ readonly: "readonly";
202
+ }>;
203
+ allowTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
204
+ denyTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
205
+ workspaceRoot: z.ZodOptional<z.ZodString>;
206
+ network: z.ZodOptional<z.ZodBoolean>;
207
+ }, z.core.$strict>;
208
+ agentRef: z.ZodObject<{
209
+ agentId: z.ZodString;
210
+ profileRevision: z.ZodString;
211
+ }, z.core.$strict>;
212
+ requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
213
+ runtime: z.ZodOptional<z.ZodEnum<{
214
+ claude: "claude";
215
+ codex: "codex";
216
+ pi: "pi";
217
+ }>>;
218
+ dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
219
+ lane: z.ZodLiteral<"subscription">;
220
+ runtimeId: z.ZodEnum<{
221
+ claude: "claude";
222
+ codex: "codex";
223
+ }>;
224
+ providerId: z.ZodNull;
225
+ modelId: z.ZodString;
226
+ }, z.core.$strict>, z.ZodObject<{
227
+ lane: z.ZodLiteral<"byok">;
228
+ runtimeId: z.ZodLiteral<"pi">;
229
+ providerId: z.ZodString;
230
+ modelId: z.ZodString;
231
+ }, z.core.$strict>], "lane">>;
232
+ sessionRef: z.ZodOptional<z.ZodString>;
233
+ limits: z.ZodOptional<z.ZodObject<{
234
+ maxDurationMs: z.ZodOptional<z.ZodNumber>;
235
+ maxTokens: z.ZodOptional<z.ZodNumber>;
236
+ }, z.core.$strip>>;
237
+ }, z.core.$strict>;
238
+ }, z.core.$strip>, z.ZodObject<{
239
+ v: z.ZodNumber;
240
+ id: z.ZodUUID;
241
+ ts: z.ZodISODateTime;
242
+ type: z.ZodLiteral<"task.offer_for_agent_with_egress">;
243
+ task_id: z.ZodString;
244
+ session_ref: z.ZodOptional<z.ZodString>;
245
+ seq: z.ZodNumber;
246
+ payload: z.ZodObject<{
247
+ instruction: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
248
+ blobRef: z.ZodObject<{
249
+ blobId: z.ZodString;
250
+ contentHash: z.ZodString;
251
+ size: z.ZodNumber;
252
+ contentType: z.ZodString;
253
+ url: z.ZodOptional<z.ZodString>;
254
+ }, z.core.$strip>;
255
+ }, z.core.$strict>]>;
256
+ policy: z.ZodObject<{
257
+ mode: z.ZodEnum<{
258
+ auto: "auto";
259
+ confirm: "confirm";
260
+ plan: "plan";
261
+ readonly: "readonly";
262
+ }>;
263
+ allowTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
264
+ denyTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
265
+ workspaceRoot: z.ZodOptional<z.ZodString>;
266
+ network: z.ZodOptional<z.ZodBoolean>;
267
+ }, z.core.$strict>;
268
+ agentRef: z.ZodObject<{
269
+ agentId: z.ZodString;
270
+ profileRevision: z.ZodString;
271
+ }, z.core.$strict>;
272
+ requiredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
273
+ runtime: z.ZodOptional<z.ZodEnum<{
274
+ claude: "claude";
275
+ codex: "codex";
276
+ pi: "pi";
277
+ }>>;
278
+ dispatchSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
279
+ lane: z.ZodLiteral<"subscription">;
280
+ runtimeId: z.ZodEnum<{
281
+ claude: "claude";
282
+ codex: "codex";
283
+ }>;
284
+ providerId: z.ZodNull;
285
+ modelId: z.ZodString;
286
+ }, z.core.$strict>, z.ZodObject<{
287
+ lane: z.ZodLiteral<"byok">;
288
+ runtimeId: z.ZodLiteral<"pi">;
289
+ providerId: z.ZodString;
290
+ modelId: z.ZodString;
291
+ }, z.core.$strict>], "lane">>;
292
+ limits: z.ZodOptional<z.ZodObject<{
293
+ maxDurationMs: z.ZodOptional<z.ZodNumber>;
294
+ maxTokens: z.ZodOptional<z.ZodNumber>;
295
+ }, z.core.$strip>>;
296
+ sessionRef: z.ZodString;
297
+ egressPolicy: z.ZodObject<{
298
+ policyRevision: z.ZodString;
299
+ activity: z.ZodDiscriminatedUnion<[z.ZodObject<{
300
+ mode: z.ZodLiteral<"metadata-status">;
301
+ delivery: z.ZodLiteral<"latest-value">;
302
+ }, z.core.$strict>, z.ZodObject<{
303
+ mode: z.ZodLiteral<"contentful-trajectory">;
304
+ delivery: z.ZodLiteral<"latest-value">;
305
+ maxCoalesceMs: z.ZodNumber;
306
+ maxEventBytes: z.ZodNumber;
307
+ }, z.core.$strict>], "mode">;
308
+ reliable: z.ZodObject<{
309
+ maxPendingEventsPerAgent: z.ZodNumber;
310
+ maxPendingBytesPerAgent: z.ZodNumber;
311
+ maxPendingBytesPerTenant: z.ZodNumber;
312
+ }, z.core.$strict>;
313
+ transfers: z.ZodObject<{
314
+ workspace: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
315
+ maxBytes: z.ZodNumber;
316
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
317
+ }, z.core.$strict>]>;
318
+ transcript: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
319
+ maxBytes: z.ZodNumber;
320
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
321
+ }, z.core.$strict>]>;
322
+ artifact: z.ZodUnion<readonly [z.ZodLiteral<"disabled">, z.ZodObject<{
323
+ maxBytes: z.ZodNumber;
324
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
325
+ }, z.core.$strict>]>;
326
+ }, z.core.$strict>;
327
+ }, z.core.$strict>;
328
+ }, z.core.$strict>;
329
+ }, z.core.$strip>, z.ZodObject<{
330
+ v: z.ZodNumber;
331
+ id: z.ZodUUID;
332
+ ts: z.ZodISODateTime;
333
+ type: z.ZodLiteral<"agent.egress.ack">;
334
+ task_id: z.ZodOptional<z.ZodString>;
335
+ session_ref: z.ZodOptional<z.ZodString>;
336
+ seq: z.ZodNumber;
337
+ payload: z.ZodObject<{
338
+ agentRef: z.ZodObject<{
339
+ agentId: z.ZodString;
340
+ profileRevision: z.ZodString;
341
+ }, z.core.$strict>;
342
+ sessionRef: z.ZodString;
343
+ policyRevision: z.ZodString;
344
+ eventId: z.ZodUUID;
345
+ cursor: z.ZodNumber;
346
+ receiptId: z.ZodUUID;
347
+ }, z.core.$strict>;
348
+ }, z.core.$strip>, z.ZodObject<{
349
+ v: z.ZodNumber;
350
+ id: z.ZodUUID;
351
+ ts: z.ZodISODateTime;
352
+ type: z.ZodLiteral<"agent.content.read">;
353
+ task_id: z.ZodOptional<z.ZodString>;
354
+ session_ref: z.ZodOptional<z.ZodString>;
355
+ seq: z.ZodNumber;
356
+ payload: z.ZodObject<{
357
+ requestId: z.ZodUUID;
358
+ surface: z.ZodEnum<{
359
+ artifact: "artifact";
360
+ transcript: "transcript";
361
+ workspace: "workspace";
362
+ }>;
363
+ actor: z.ZodObject<{
364
+ kind: z.ZodEnum<{
365
+ agent: "agent";
366
+ system: "system";
367
+ user: "user";
368
+ }>;
369
+ id: z.ZodString;
370
+ }, z.core.$strict>;
371
+ agentRef: z.ZodObject<{
372
+ agentId: z.ZodString;
373
+ profileRevision: z.ZodString;
374
+ }, z.core.$strict>;
375
+ sessionRef: z.ZodString;
376
+ runtime: z.ZodEnum<{
377
+ claude: "claude";
378
+ codex: "codex";
379
+ pi: "pi";
380
+ }>;
381
+ cwd: z.ZodString;
382
+ policyRevision: z.ZodString;
383
+ target: z.ZodString;
384
+ mimeType: z.ZodString;
385
+ decodeAs: z.ZodEnum<{
386
+ bytes: "bytes";
387
+ utf8: "utf8";
388
+ }>;
389
+ policy: z.ZodObject<{
390
+ maxBytes: z.ZodNumber;
391
+ allowedMimeTypes: z.ZodArray<z.ZodString>;
392
+ }, z.core.$strict>;
393
+ }, z.core.$strict>;
177
394
  }, z.core.$strip>, z.ZodObject<{
178
395
  v: z.ZodNumber;
179
396
  id: z.ZodUUID;
@@ -230,6 +447,10 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
230
447
  payload: z.ZodObject<{
231
448
  deviceId: z.ZodString;
232
449
  agentId: z.ZodOptional<z.ZodString>;
450
+ agentRef: z.ZodOptional<z.ZodObject<{
451
+ agentId: z.ZodString;
452
+ profileRevision: z.ZodString;
453
+ }, z.core.$strict>>;
233
454
  runtime: z.ZodOptional<z.ZodEnum<{
234
455
  claude: "claude";
235
456
  codex: "codex";
@@ -263,6 +484,10 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
263
484
  payload: z.ZodObject<{
264
485
  reason: z.ZodString;
265
486
  retryable: z.ZodOptional<z.ZodBoolean>;
487
+ agentRef: z.ZodOptional<z.ZodObject<{
488
+ agentId: z.ZodString;
489
+ profileRevision: z.ZodString;
490
+ }, z.core.$strict>>;
266
491
  }, z.core.$strip>;
267
492
  }, z.core.$strip>, z.ZodObject<{
268
493
  v: z.ZodNumber;
@@ -362,6 +587,24 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
362
587
  url: z.ZodOptional<z.ZodString>;
363
588
  }, z.core.$strip>>>;
364
589
  document: z.ZodOptional<z.ZodUnknown>;
590
+ usage: z.ZodOptional<z.ZodObject<{
591
+ runtime: z.ZodEnum<{
592
+ claude: "claude";
593
+ codex: "codex";
594
+ pi: "pi";
595
+ }>;
596
+ provider: z.ZodOptional<z.ZodString>;
597
+ model: z.ZodOptional<z.ZodString>;
598
+ promptTokens: z.ZodOptional<z.ZodNumber>;
599
+ completionTokens: z.ZodOptional<z.ZodNumber>;
600
+ durationMs: z.ZodOptional<z.ZodNumber>;
601
+ clientVersion: z.ZodString;
602
+ reportedAt: z.ZodISODateTime;
603
+ }, z.core.$strip>>;
604
+ agentRef: z.ZodOptional<z.ZodObject<{
605
+ agentId: z.ZodString;
606
+ profileRevision: z.ZodString;
607
+ }, z.core.$strict>>;
365
608
  }, z.core.$strip>;
366
609
  }, z.core.$strip>, z.ZodObject<{
367
610
  v: z.ZodNumber;
@@ -374,6 +617,24 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
374
617
  payload: z.ZodObject<{
375
618
  reason: z.ZodString;
376
619
  retryable: z.ZodOptional<z.ZodBoolean>;
620
+ usage: z.ZodOptional<z.ZodObject<{
621
+ runtime: z.ZodEnum<{
622
+ claude: "claude";
623
+ codex: "codex";
624
+ pi: "pi";
625
+ }>;
626
+ provider: z.ZodOptional<z.ZodString>;
627
+ model: z.ZodOptional<z.ZodString>;
628
+ promptTokens: z.ZodOptional<z.ZodNumber>;
629
+ completionTokens: z.ZodOptional<z.ZodNumber>;
630
+ durationMs: z.ZodOptional<z.ZodNumber>;
631
+ clientVersion: z.ZodString;
632
+ reportedAt: z.ZodISODateTime;
633
+ }, z.core.$strip>>;
634
+ agentRef: z.ZodOptional<z.ZodObject<{
635
+ agentId: z.ZodString;
636
+ profileRevision: z.ZodString;
637
+ }, z.core.$strict>>;
377
638
  }, z.core.$strip>;
378
639
  }, z.core.$strip>, z.ZodObject<{
379
640
  v: z.ZodNumber;
@@ -385,6 +646,24 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
385
646
  seq: z.ZodOptional<z.ZodNumber>;
386
647
  payload: z.ZodObject<{
387
648
  reason: z.ZodOptional<z.ZodString>;
649
+ usage: z.ZodOptional<z.ZodObject<{
650
+ runtime: z.ZodEnum<{
651
+ claude: "claude";
652
+ codex: "codex";
653
+ pi: "pi";
654
+ }>;
655
+ provider: z.ZodOptional<z.ZodString>;
656
+ model: z.ZodOptional<z.ZodString>;
657
+ promptTokens: z.ZodOptional<z.ZodNumber>;
658
+ completionTokens: z.ZodOptional<z.ZodNumber>;
659
+ durationMs: z.ZodOptional<z.ZodNumber>;
660
+ clientVersion: z.ZodString;
661
+ reportedAt: z.ZodISODateTime;
662
+ }, z.core.$strip>>;
663
+ agentRef: z.ZodOptional<z.ZodObject<{
664
+ agentId: z.ZodString;
665
+ profileRevision: z.ZodString;
666
+ }, z.core.$strict>>;
388
667
  }, z.core.$strip>;
389
668
  }, z.core.$strip>, z.ZodObject<{
390
669
  v: z.ZodNumber;
@@ -405,6 +684,139 @@ export declare const EnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
405
684
  }>;
406
685
  at: z.ZodISODateTime;
407
686
  }, z.core.$strip>;
687
+ }, z.core.$strip>, z.ZodObject<{
688
+ v: z.ZodNumber;
689
+ id: z.ZodUUID;
690
+ ts: z.ZodISODateTime;
691
+ type: z.ZodLiteral<"agent.egress.reliable">;
692
+ task_id: z.ZodOptional<z.ZodString>;
693
+ session_ref: z.ZodOptional<z.ZodString>;
694
+ seq: z.ZodOptional<z.ZodNumber>;
695
+ payload: z.ZodObject<{
696
+ agentRef: z.ZodObject<{
697
+ agentId: z.ZodString;
698
+ profileRevision: z.ZodString;
699
+ }, z.core.$strict>;
700
+ sessionRef: z.ZodString;
701
+ policyRevision: z.ZodString;
702
+ eventId: z.ZodUUID;
703
+ cursor: z.ZodNumber;
704
+ payload: z.ZodJSONSchema;
705
+ contentHash: z.ZodString;
706
+ byteCount: z.ZodNumber;
707
+ }, z.core.$strict>;
708
+ }, z.core.$strip>, z.ZodObject<{
709
+ v: z.ZodNumber;
710
+ id: z.ZodUUID;
711
+ ts: z.ZodISODateTime;
712
+ type: z.ZodLiteral<"agent.content.receipt">;
713
+ task_id: z.ZodOptional<z.ZodString>;
714
+ session_ref: z.ZodOptional<z.ZodString>;
715
+ seq: z.ZodOptional<z.ZodNumber>;
716
+ payload: z.ZodDiscriminatedUnion<[z.ZodObject<{
717
+ requestId: z.ZodUUID;
718
+ eventId: z.ZodUUID;
719
+ cursor: z.ZodNumber;
720
+ surface: z.ZodEnum<{
721
+ artifact: "artifact";
722
+ transcript: "transcript";
723
+ workspace: "workspace";
724
+ }>;
725
+ actor: z.ZodObject<{
726
+ kind: z.ZodEnum<{
727
+ agent: "agent";
728
+ system: "system";
729
+ user: "user";
730
+ }>;
731
+ id: z.ZodString;
732
+ }, z.core.$strict>;
733
+ agentRef: z.ZodObject<{
734
+ agentId: z.ZodString;
735
+ profileRevision: z.ZodString;
736
+ }, z.core.$strict>;
737
+ sessionRef: z.ZodString;
738
+ runtime: z.ZodEnum<{
739
+ claude: "claude";
740
+ codex: "codex";
741
+ pi: "pi";
742
+ }>;
743
+ cwd: z.ZodString;
744
+ policyRevision: z.ZodString;
745
+ target: z.ZodString;
746
+ mimeType: z.ZodString;
747
+ decodeAs: z.ZodEnum<{
748
+ bytes: "bytes";
749
+ utf8: "utf8";
750
+ }>;
751
+ decision: z.ZodLiteral<"allowed">;
752
+ byteCount: z.ZodNumber;
753
+ contentHash: z.ZodString;
754
+ blobRef: z.ZodObject<{
755
+ blobId: z.ZodString;
756
+ contentHash: z.ZodString;
757
+ size: z.ZodNumber;
758
+ contentType: z.ZodString;
759
+ url: z.ZodOptional<z.ZodString>;
760
+ }, z.core.$strip>;
761
+ }, z.core.$strict>, z.ZodObject<{
762
+ requestId: z.ZodUUID;
763
+ eventId: z.ZodUUID;
764
+ cursor: z.ZodNumber;
765
+ surface: z.ZodEnum<{
766
+ artifact: "artifact";
767
+ transcript: "transcript";
768
+ workspace: "workspace";
769
+ }>;
770
+ actor: z.ZodObject<{
771
+ kind: z.ZodEnum<{
772
+ agent: "agent";
773
+ system: "system";
774
+ user: "user";
775
+ }>;
776
+ id: z.ZodString;
777
+ }, z.core.$strict>;
778
+ agentRef: z.ZodObject<{
779
+ agentId: z.ZodString;
780
+ profileRevision: z.ZodString;
781
+ }, z.core.$strict>;
782
+ sessionRef: z.ZodString;
783
+ runtime: z.ZodEnum<{
784
+ claude: "claude";
785
+ codex: "codex";
786
+ pi: "pi";
787
+ }>;
788
+ cwd: z.ZodString;
789
+ policyRevision: z.ZodString;
790
+ target: z.ZodString;
791
+ mimeType: z.ZodString;
792
+ decodeAs: z.ZodEnum<{
793
+ bytes: "bytes";
794
+ utf8: "utf8";
795
+ }>;
796
+ decision: z.ZodLiteral<"denied">;
797
+ byteCount: z.ZodLiteral<0>;
798
+ reason: z.ZodEnum<{
799
+ "absolute-target": "absolute-target";
800
+ "byte-limit": "byte-limit";
801
+ "capability-missing": "capability-missing";
802
+ "dot-segment": "dot-segment";
803
+ "identity-mismatch": "identity-mismatch";
804
+ "invalid-request": "invalid-request";
805
+ "mime-not-allowlisted": "mime-not-allowlisted";
806
+ "non-relative-target": "non-relative-target";
807
+ "not-regular-file": "not-regular-file";
808
+ "path-escape": "path-escape";
809
+ "policy-disabled": "policy-disabled";
810
+ "policy-revision-mismatch": "policy-revision-mismatch";
811
+ "root-invalid": "root-invalid";
812
+ "root-not-allowlisted": "root-not-allowlisted";
813
+ "sensitive-name": "sensitive-name";
814
+ symlink: "symlink";
815
+ "target-missing": "target-missing";
816
+ "text-decode-failed": "text-decode-failed";
817
+ "text-not-allowlisted": "text-not-allowlisted";
818
+ }>;
819
+ }, z.core.$strict>], "decision">;
408
820
  }, z.core.$strip>], "type">;
409
821
  export type Envelope = z.infer<typeof EnvelopeSchema>;
410
822
  /** `true` for every message type the server sends to the daemon (envelope `seq` is required for these). */