@byok-sdk/protocol 0.29.0 → 0.30.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.
package/dist/index.js CHANGED
@@ -18,7 +18,27 @@ var PROVIDER_PROVISIONING_CAPABILITY = "provider-provisioning.v1";
18
18
  var AGENT_MEMORY_INTENT_CAPABILITY = "agent-memory-intent.v1";
19
19
  var AGENT_MEMORY_PROJECTION_CAPABILITY = "agent.memory.projection";
20
20
  var AGENT_MEMORY_SELECTION_CAPABILITY = "agent-memory-selection";
21
+ var AGENT_MEMORY_READ_IF_ADMITTED_CAPABILITY = "agent-memory-read-if-admitted";
22
+ var AGENT_MEMORY_READ_WRITE_IF_ADMITTED_CAPABILITY = "agent-memory-read-write-if-admitted";
21
23
  var AGENT_INPUT_PREPARATION_CAPABILITY = `agent-input-preparation-v${INPUT_PREPARATION_WIRE_VERSION}`;
24
+ var SEALED_PAYLOAD_CAPABILITY = "sealed-payload-v1";
25
+ var SEALED_OUTPUT_CIPHERTEXT_REF_CAPABILITY = "sealed-output-ciphertext-ref";
26
+ var RUNTIME_FAILURE_CLASS_CAPABILITY = "runtime-failure-class";
27
+ var RUNTIME_FAILURE_CLASSES = [
28
+ "auth",
29
+ "quota",
30
+ "rate_limited",
31
+ "billing",
32
+ "model_unavailable",
33
+ "input_too_large",
34
+ "invalid_request",
35
+ "overloaded",
36
+ "provider",
37
+ "runtime_exited",
38
+ "limit_reached",
39
+ "output_schema",
40
+ "unknown"
41
+ ];
22
42
  var PREPARED_AGENT_MEMORY_MODES = ["none", "read", "read-write"];
23
43
  function isPreparedAgentMemoryMode(value) {
24
44
  return typeof value === "string" && PREPARED_AGENT_MEMORY_MODES.some((mode) => mode === value);
@@ -59,7 +79,12 @@ var CAPABILITY_FLAGS = [
59
79
  PROVIDER_PROVISIONING_CAPABILITY,
60
80
  AGENT_MEMORY_INTENT_CAPABILITY,
61
81
  AGENT_MEMORY_SELECTION_CAPABILITY,
62
- "agent-message-draft"
82
+ AGENT_MEMORY_READ_IF_ADMITTED_CAPABILITY,
83
+ AGENT_MEMORY_READ_WRITE_IF_ADMITTED_CAPABILITY,
84
+ "agent-message-draft",
85
+ SEALED_PAYLOAD_CAPABILITY,
86
+ SEALED_OUTPUT_CIPHERTEXT_REF_CAPABILITY,
87
+ RUNTIME_FAILURE_CLASS_CAPABILITY
63
88
  ];
64
89
 
65
90
  // src/task-state.ts
@@ -90,6 +115,95 @@ var AGENT_MEMORY_MAX_SNAPSHOT_BYTES = 1024 * 1024;
90
115
  var AGENT_MEMORY_MAX_SNAPSHOT_FILES = 128;
91
116
  var RUNTIME_IDS = Object.freeze(["pi", "claude", "codex"]);
92
117
 
118
+ // src/sealed-split-table.ts
119
+ var OFFER_DIGESTS = {
120
+ "instruction.blobRef.contentHash": "sealed",
121
+ "dispatchSelection.providerProfile.profileRevision": "plain",
122
+ "dispatchSelection.providerProfile.profileHash": "plain"
123
+ };
124
+ var AGENT_OFFER_DIGESTS = { ...OFFER_DIGESTS, "agentRef.profileRevision": "plain" };
125
+ var EGRESS_OFFER_DIGESTS = { ...AGENT_OFFER_DIGESTS, "egressPolicy.policyRevision": "plain" };
126
+ var TERMINAL_DIGESTS = {
127
+ "agentRef.profileRevision": "plain",
128
+ "agentHomeProjection.profileRevision": "plain",
129
+ "agentHomeProjection.projectionHash": "plain"
130
+ };
131
+ var sealedOffer = (plainType, digests) => ({ plainType, category: "task-input", identity: [], moved: ["instruction"], forbidden: [], digests });
132
+ var SEALED_SPLIT_TABLE = Object.freeze({
133
+ "task.offer_sealed": sealedOffer("task.offer", OFFER_DIGESTS),
134
+ "task.offer_with_toolsets_sealed": sealedOffer("task.offer_with_toolsets", OFFER_DIGESTS),
135
+ "task.offer_for_agent_sealed": sealedOffer("task.offer_for_agent", AGENT_OFFER_DIGESTS),
136
+ "task.offer_for_agent_with_egress_sealed": sealedOffer("task.offer_for_agent_with_egress", EGRESS_OFFER_DIGESTS),
137
+ "task.offer_for_agent_with_egress_fresh_sealed": sealedOffer("task.offer_for_agent_with_egress_fresh", EGRESS_OFFER_DIGESTS),
138
+ "task.steer_sealed": { plainType: "task.steer", category: "task-input", identity: ["steerId"], moved: ["text"], forbidden: [], digests: {} },
139
+ "task.complete_sealed": {
140
+ plainType: "task.complete",
141
+ category: "task-output",
142
+ identity: [],
143
+ moved: ["summary", "finalMessage", "document"],
144
+ forbidden: ["artifactRefs", "preparedObservation"],
145
+ digests: {
146
+ ...TERMINAL_DIGESTS,
147
+ "artifactRefs[].contentHash": "forbidden",
148
+ "preparedObservation.requestDigest": "forbidden"
149
+ }
150
+ },
151
+ "task.fail_sealed": {
152
+ plainType: "task.fail",
153
+ category: "task-output",
154
+ identity: [],
155
+ moved: ["reason"],
156
+ forbidden: ["preparedObservation"],
157
+ digests: { ...TERMINAL_DIGESTS, "preparedObservation.requestDigest": "forbidden" }
158
+ },
159
+ "task.decline_sealed": {
160
+ plainType: "task.decline",
161
+ category: "task-output",
162
+ identity: [],
163
+ moved: ["reason"],
164
+ forbidden: [],
165
+ digests: { "agentRef.profileRevision": "plain" }
166
+ },
167
+ "task.cancelled_sealed": {
168
+ plainType: "task.cancelled",
169
+ category: "task-output",
170
+ identity: [],
171
+ moved: ["reason"],
172
+ forbidden: [],
173
+ digests: TERMINAL_DIGESTS
174
+ },
175
+ "task.progress_sealed": {
176
+ plainType: "task.progress",
177
+ category: "task-output",
178
+ identity: ["seq"],
179
+ moved: ["events"],
180
+ forbidden: [],
181
+ digests: { "events[].spill.blob.contentHash": "sealed" },
182
+ inlineOnly: true
183
+ },
184
+ "task.artifact_sealed": {
185
+ plainType: "task.artifact",
186
+ category: "task-output",
187
+ identity: ["artifactId"],
188
+ moved: ["inline"],
189
+ forbidden: ["blobRef"],
190
+ digests: { "blobRef.contentHash": "forbidden" },
191
+ limits: { inline: 2 * 1024 * 1024 }
192
+ },
193
+ "task.await_approval_sealed": {
194
+ plainType: "task.await_approval",
195
+ category: "task-output",
196
+ identity: ["approvalId"],
197
+ moved: ["summary"],
198
+ forbidden: [],
199
+ digests: {},
200
+ inlineOnly: true
201
+ }
202
+ });
203
+ function isSealedMessageType(type) {
204
+ return Object.hasOwn(SEALED_SPLIT_TABLE, type);
205
+ }
206
+
93
207
  // src/wire-additions.ts
94
208
  var AGENT_OFFER_FIELDS = (surface) => [
95
209
  { kind: "envelope", rule: "gated", surface, field: "dispatchSelection", capability: "dispatch-selection", advertisedBy: "device" },
@@ -101,24 +215,46 @@ var EGRESS_OFFER_FIELDS = (surface) => [
101
215
  { kind: "envelope", rule: "gated", surface, field: "messageEgress", capability: "agent-message-egress", advertisedBy: "device" },
102
216
  ...AGENT_OFFER_FIELDS(surface)
103
217
  ];
104
- var WIRE_ADDITIONS = Object.freeze([
218
+ function sealedRows(plainRows) {
219
+ return Object.keys(SEALED_SPLIT_TABLE).flatMap((surface) => {
220
+ const { plainType, moved, forbidden } = SEALED_SPLIT_TABLE[surface];
221
+ const dropped = [...moved, ...forbidden];
222
+ const advertisedBy = SEALED_SPLIT_TABLE[surface].category === "task-input" ? "device" : "server";
223
+ const inherited = plainRows.flatMap((row) => {
224
+ if (row.kind !== "envelope" || row.surface !== plainType) return [];
225
+ if (row.field !== void 0 && dropped.includes(row.field.split(/[.[]/u)[0])) return [];
226
+ return [{ ...row, surface }];
227
+ });
228
+ const entry = SEALED_SPLIT_TABLE[surface];
229
+ const byReference = advertisedBy === "server" && entry.inlineOnly !== true ? [{ kind: "envelope", rule: "gated", surface, field: "sealed.ciphertextRef", capability: "sealed-output-ciphertext-ref", advertisedBy }] : [];
230
+ return [{ kind: "envelope", rule: "gated", surface, capability: "sealed-payload-v1", advertisedBy }, ...inherited, ...byReference];
231
+ });
232
+ }
233
+ var SEALED_DECLINE_CODE = (value) => ({ kind: "envelope", rule: "gated", surface: "task.decline", field: "code", value, capability: "sealed-payload-v1", advertisedBy: "server" });
234
+ var PLAIN_ROWS = [
105
235
  // Server to daemon: offers.
106
236
  { kind: "envelope", rule: "gated", surface: "task.offer", field: "harnessId", capability: "custom-harness", advertisedBy: "device" },
107
237
  { kind: "envelope", rule: "gated", surface: "task.offer_with_toolsets", field: "harnessId", capability: "custom-harness", advertisedBy: "device" },
108
238
  { kind: "envelope", rule: "gated", surface: "task.offer_for_agent", capability: "agent-home-contract", advertisedBy: "device" },
109
239
  ...AGENT_OFFER_FIELDS("task.offer_for_agent"),
110
240
  { kind: "envelope", rule: "gated", surface: "task.offer_for_agent", field: "agentMemory", capability: "agent-memory-selection", advertisedBy: "device" },
241
+ { kind: "envelope", rule: "gated", surface: "task.offer_for_agent", field: "agentMemory", value: "read-if-admitted", capability: "agent-memory-read-if-admitted", advertisedBy: "device" },
242
+ { kind: "envelope", rule: "gated", surface: "task.offer_for_agent", field: "agentMemory", value: "read-write-if-admitted", capability: "agent-memory-read-write-if-admitted", advertisedBy: "device" },
111
243
  { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress", capability: "agent-home-contract", advertisedBy: "device" },
112
244
  { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress", capability: "agent-egress-policy", advertisedBy: "device" },
113
245
  { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress", capability: "agent-egress-reliable-ack", advertisedBy: "device" },
114
246
  ...EGRESS_OFFER_FIELDS("task.offer_for_agent_with_egress"),
115
247
  { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress", field: "agentMemory", capability: "agent-memory-selection", advertisedBy: "device" },
248
+ { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress", field: "agentMemory", value: "read-if-admitted", capability: "agent-memory-read-if-admitted", advertisedBy: "device" },
249
+ { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress", field: "agentMemory", value: "read-write-if-admitted", capability: "agent-memory-read-write-if-admitted", advertisedBy: "device" },
116
250
  { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress_fresh", capability: "agent-home-contract", advertisedBy: "device" },
117
251
  { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress_fresh", capability: "agent-egress-policy", advertisedBy: "device" },
118
252
  { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress_fresh", capability: "agent-egress-reliable-ack", advertisedBy: "device" },
119
253
  { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress_fresh", capability: "agent-egress-fresh-session", advertisedBy: "device" },
120
254
  ...EGRESS_OFFER_FIELDS("task.offer_for_agent_with_egress_fresh"),
121
255
  { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress_fresh", field: "agentMemory", capability: "agent-memory-selection", advertisedBy: "device" },
256
+ { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress_fresh", field: "agentMemory", value: "read-if-admitted", capability: "agent-memory-read-if-admitted", advertisedBy: "device" },
257
+ { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress_fresh", field: "agentMemory", value: "read-write-if-admitted", capability: "agent-memory-read-write-if-admitted", advertisedBy: "device" },
122
258
  { kind: "envelope", rule: "gated", surface: "task.offer_prepared", capability: "agent-home-contract", advertisedBy: "device" },
123
259
  { kind: "envelope", rule: "gated", surface: "task.offer_prepared", capability: "agent-input-preparation-v9", advertisedBy: "device" },
124
260
  { kind: "envelope", rule: "gated", surface: "task.offer_prepared", capability: "agent-egress-policy", advertisedBy: "device" },
@@ -138,6 +274,7 @@ var WIRE_ADDITIONS = Object.freeze([
138
274
  { kind: "envelope", rule: "gated", surface: "agent.input.preparation", capability: "agent-input-preparation-v9", advertisedBy: "device" },
139
275
  { kind: "envelope", rule: "gated", surface: "provider.provisioning.available", capability: "provider-provisioning.v1", advertisedBy: "device" },
140
276
  { kind: "envelope", rule: "gated", surface: "agent.memory.intent.available", capability: "agent-memory-intent.v1", advertisedBy: "device" },
277
+ { kind: "envelope", rule: "gated", surface: "e2ee.key_package.available", capability: "sealed-payload-v1", advertisedBy: "device" },
141
278
  // One optional runtime capability, shared by discovery and the claim snapshot.
142
279
  { kind: "envelope", rule: "strip-safe", surface: "conn.hello", field: "runtimes[].capabilities.messageDraft" },
143
280
  { kind: "envelope", rule: "strip-safe", surface: "conn.hello", field: "harnesses[].capabilities.messageDraft" },
@@ -146,7 +283,16 @@ var WIRE_ADDITIONS = Object.freeze([
146
283
  { kind: "envelope", rule: "strip-safe", surface: "task.progress", field: "events[].mcp" },
147
284
  // Daemon to server.
148
285
  { kind: "envelope", rule: "gated", surface: "agent.message.draft", capability: "agent-message-draft", advertisedBy: "server" },
149
- { kind: "envelope", rule: "gated", surface: "task.approval_resolved", capability: "approval_resolved", advertisedBy: "server" }
286
+ { kind: "envelope", rule: "gated", surface: "task.approval_resolved", capability: "approval_resolved", advertisedBy: "server" },
287
+ { kind: "envelope", rule: "gated", surface: "task.fail", field: "failure", capability: "runtime-failure-class", advertisedBy: "server" }
288
+ ];
289
+ var WIRE_ADDITIONS = Object.freeze([
290
+ ...PLAIN_ROWS,
291
+ ...sealedRows(PLAIN_ROWS),
292
+ SEALED_DECLINE_CODE("sealed_key_unavailable"),
293
+ SEALED_DECLINE_CODE("sealed_open_failed"),
294
+ SEALED_DECLINE_CODE("sealed_content_mac_mismatch"),
295
+ SEALED_DECLINE_CODE("sealing_policy_mismatch")
150
296
  ]);
151
297
  function requiredReceiverCapabilities(type, payload) {
152
298
  const fields = payload !== null && typeof payload === "object" ? payload : {};
@@ -154,7 +300,10 @@ function requiredReceiverCapabilities(type, payload) {
154
300
  for (const entry of WIRE_ADDITIONS) {
155
301
  if (entry.kind !== "envelope" || entry.rule !== "gated" || entry.surface !== type) continue;
156
302
  if (entry.field !== void 0) {
157
- const value = fields[entry.field];
303
+ const value = entry.field.split(".").reduce(
304
+ (parent, segment) => parent !== null && typeof parent === "object" ? parent[segment] : void 0,
305
+ fields
306
+ );
158
307
  if (value === void 0) continue;
159
308
  if (entry.value !== void 0 && value !== entry.value) continue;
160
309
  }
@@ -170,6 +319,154 @@ var BlobRefSchema = z.object({
170
319
  contentType: z.string(),
171
320
  url: z.string().optional()
172
321
  });
322
+ var SEALED_PAYLOAD_VERSION = 1;
323
+ var SEALED_PAYLOAD_SUITE = "byok-sealed-v1.hkdf-sha256.aes-256-gcm";
324
+ var SEALED_PAYLOAD_CATEGORIES = ["task-input", "agent-message", "task-output", "memory-projection"];
325
+ var SEALED_PAYLOAD_V1_CATEGORIES = ["task-input", "task-output"];
326
+ var SEALED_DECLINE_CODES = [
327
+ "sealed_key_unavailable",
328
+ "sealed_open_failed",
329
+ "sealed_content_mac_mismatch",
330
+ "sealing_policy_mismatch"
331
+ ];
332
+ var SEALED_TASK_PLAIN_CODES = Object.freeze({
333
+ "task.fail": { reason: ["daemon_interrupted", "sealed_key_unavailable"] },
334
+ "task.decline": { reason: SEALED_DECLINE_CODES },
335
+ "task.cancelled": { reason: [] }
336
+ });
337
+ function isSealedTaskPlainOutput(type, payload) {
338
+ const codes = Object.hasOwn(SEALED_TASK_PLAIN_CODES, type) ? SEALED_TASK_PLAIN_CODES[type] : {};
339
+ const fields = Object.values(SEALED_SPLIT_TABLE).filter((entry) => entry.category === "task-output" && entry.plainType === type).flatMap((entry) => [...entry.moved, ...entry.forbidden]);
340
+ if (fields.length > 0 && !Object.hasOwn(SEALED_TASK_PLAIN_CODES, type)) return false;
341
+ const record = payload;
342
+ for (const field of fields) {
343
+ const value = record[field];
344
+ if (value !== void 0 && !(typeof value === "string" && (codes[field] ?? []).includes(value))) return false;
345
+ }
346
+ return type !== "task.decline" || record.reason === void 0 || record.code === record.reason;
347
+ }
348
+ var SEALED_INLINE_MAX_PADDED_LENGTH = 256 * 1024;
349
+ var SEALED_PAYLOAD_MAX_CONTENT_LENGTH = 2 * 1024 * 1024;
350
+ var AEAD_TAG_BYTES = 16;
351
+ var FRAME_HEADER_BYTES = 4;
352
+ var ALIGNED_FRAME_LIMIT = 16 * 1024;
353
+ var FRAME_ALIGNMENT = 256;
354
+ var SALT_BYTES = 32;
355
+ var NONCE_BYTES = 12;
356
+ function floorLog2(value) {
357
+ let exponent = 0;
358
+ for (let remaining = value; remaining >= 2; remaining = Math.floor(remaining / 2)) exponent += 1;
359
+ return exponent;
360
+ }
361
+ function sealedPayloadPaddedLength(frameLength) {
362
+ if (!Number.isSafeInteger(frameLength) || frameLength < FRAME_HEADER_BYTES) {
363
+ throw new RangeError("Sealed frame length must be a safe integer of at least 4");
364
+ }
365
+ if (frameLength <= ALIGNED_FRAME_LIMIT) return Math.ceil(frameLength / FRAME_ALIGNMENT) * FRAME_ALIGNMENT;
366
+ const exponent = floorLog2(frameLength);
367
+ const step = 2 ** (exponent - (floorLog2(exponent) + 1));
368
+ return Math.ceil(frameLength / step) * step;
369
+ }
370
+ var SEALED_PAYLOAD_MAX_PADDED_LENGTH = sealedPayloadPaddedLength(
371
+ FRAME_HEADER_BYTES + SEALED_PAYLOAD_MAX_CONTENT_LENGTH
372
+ );
373
+ function isLegalPaddedLength(value) {
374
+ return Number.isSafeInteger(value) && value >= FRAME_ALIGNMENT && value <= SEALED_PAYLOAD_MAX_PADDED_LENGTH && sealedPayloadPaddedLength(value) === value;
375
+ }
376
+ var BASE64URL_VALUE = /^[A-Za-z0-9_-]*$/u;
377
+ var BASE64URL_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
378
+ function sealedBase64UrlByteLength(value) {
379
+ if (!BASE64URL_VALUE.test(value)) return void 0;
380
+ const tail = value.length % 4;
381
+ if (tail === 1) return void 0;
382
+ if (tail !== 0) {
383
+ const last = BASE64URL_ALPHABET.indexOf(value[value.length - 1]);
384
+ const unusedBits = tail === 2 ? 15 : 3;
385
+ if ((last & unusedBits) !== 0) return void 0;
386
+ }
387
+ return Math.floor(value.length / 4) * 3 + (tail === 0 ? 0 : tail - 1);
388
+ }
389
+ function base64UrlOf(bytes) {
390
+ return z.string().refine((value) => sealedBase64UrlByteLength(value) === bytes, `must be canonical unpadded base64url of ${bytes} bytes`);
391
+ }
392
+ var PositiveIntegerSchema = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
393
+ function sealedPayloadSchema(category) {
394
+ return z.object({
395
+ v: z.literal(SEALED_PAYLOAD_VERSION),
396
+ suite: z.literal(SEALED_PAYLOAD_SUITE),
397
+ category,
398
+ scope: z.object({
399
+ id: z.string().min(1),
400
+ epoch: PositiveIntegerSchema,
401
+ keyId: z.string().regex(/^[A-Za-z0-9_-]{22}$/u)
402
+ }).strict(),
403
+ chainHead: z.object({
404
+ seq: PositiveIntegerSchema,
405
+ hash: z.string().regex(CONTENT_HASH_RE)
406
+ }).strict(),
407
+ sender: z.string().regex(/^[A-Za-z0-9_-]{43}$/u),
408
+ salt: base64UrlOf(SALT_BYTES),
409
+ nonce: base64UrlOf(NONCE_BYTES),
410
+ paddedLength: PositiveIntegerSchema.refine(isLegalPaddedLength, "must be a legal padded frame length within the v1 limit"),
411
+ contentMac: z.string().regex(/^hmac-sha256:[0-9a-f]{64}$/u),
412
+ ciphertext: z.string().optional(),
413
+ /** The ciphertext blob. A presigned `url` is transport detail and never part of a sealed member. */
414
+ ciphertextRef: BlobRefSchema.omit({ url: true }).strict().optional()
415
+ }).strict().superRefine((sealed, ctx) => {
416
+ const ciphertextLength = sealed.paddedLength + AEAD_TAG_BYTES;
417
+ const inline = sealed.paddedLength <= SEALED_INLINE_MAX_PADDED_LENGTH;
418
+ if (inline) {
419
+ if (sealed.ciphertextRef !== void 0 || sealed.ciphertext === void 0) {
420
+ ctx.addIssue({ code: "custom", path: ["ciphertext"], message: `a padded length up to ${SEALED_INLINE_MAX_PADDED_LENGTH} carries inline ciphertext only` });
421
+ } else if (sealedBase64UrlByteLength(sealed.ciphertext) !== ciphertextLength) {
422
+ ctx.addIssue({ code: "custom", path: ["ciphertext"], message: "ciphertext must be canonical base64url of paddedLength + 16 bytes" });
423
+ }
424
+ return;
425
+ }
426
+ if (sealed.ciphertext !== void 0 || sealed.ciphertextRef === void 0) {
427
+ ctx.addIssue({ code: "custom", path: ["ciphertextRef"], message: `a padded length above ${SEALED_INLINE_MAX_PADDED_LENGTH} carries ciphertextRef only` });
428
+ } else if (sealed.ciphertextRef.size !== ciphertextLength) {
429
+ ctx.addIssue({ code: "custom", path: ["ciphertextRef", "size"], message: "ciphertextRef size must equal paddedLength + 16" });
430
+ }
431
+ });
432
+ }
433
+ var SealedPayloadSchema = sealedPayloadSchema(z.enum(SEALED_PAYLOAD_V1_CATEGORIES));
434
+ var SealedTaskInputSchema = sealedPayloadSchema(z.literal("task-input"));
435
+ var SealedTaskOutputSchema = sealedPayloadSchema(z.literal("task-output"));
436
+ function isCanonicalCategoryList(categories) {
437
+ return categories.every((category, index) => index === 0 || SEALED_PAYLOAD_CATEGORIES.indexOf(categories[index - 1]) < SEALED_PAYLOAD_CATEGORIES.indexOf(category));
438
+ }
439
+ var TaskSealingSchema = z.object({
440
+ scopeId: z.string().min(1),
441
+ epoch: PositiveIntegerSchema,
442
+ categories: z.array(z.enum(SEALED_PAYLOAD_V1_CATEGORIES)).min(1).refine(isCanonicalCategoryList, "categories must be unique and in canonical order")
443
+ }).strict();
444
+ var CanonicalInstantSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u).refine((value) => {
445
+ const instant = Date.parse(value);
446
+ return Number.isFinite(instant) && new Date(instant).toISOString() === value;
447
+ }, "must be a canonical UTC instant");
448
+ var RoutineRefSchema = z.object({
449
+ routineId: z.string().min(1),
450
+ definitionVersion: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
451
+ notAfter: CanonicalInstantSchema
452
+ }).strict();
453
+ function sealedOfferRule(payload, ctx) {
454
+ const { instruction, sealing, sealed, routineRef } = payload;
455
+ if (!sealing.categories.includes("task-input")) {
456
+ if (routineRef !== void 0) ctx.addIssue({ code: "custom", path: ["routineRef"], message: "a routine template is sealed task input, so routineRef needs a task that seals task-input" });
457
+ if (sealed !== void 0) ctx.addIssue({ code: "custom", path: ["sealed"], message: "a task that does not seal task-input carries no sealed member" });
458
+ if (instruction === void 0) ctx.addIssue({ code: "custom", path: ["instruction"], message: "a task that does not seal task-input carries a plaintext instruction" });
459
+ return;
460
+ }
461
+ if (sealed === void 0) {
462
+ ctx.addIssue({ code: "custom", path: ["sealed"], message: "a task that seals task-input carries the sealed instruction" });
463
+ return;
464
+ }
465
+ if (instruction !== void 0) ctx.addIssue({ code: "custom", path: ["instruction"], message: "a sealed instruction never travels in plaintext too" });
466
+ if (sealed.scope.id !== sealing.scopeId || sealed.scope.epoch !== sealing.epoch) {
467
+ ctx.addIssue({ code: "custom", path: ["sealed", "scope"], message: "the offer task-input must be sealed under the task scope at the task epoch" });
468
+ }
469
+ }
173
470
  var ProviderProfileRefSchema = z.string().min(1).max(64).regex(/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/u, "provider profile refs must be lowercase portable identifiers");
174
471
  var ProviderProfileRevisionSchema = z.string().regex(/^(?:0|[1-9][0-9]{0,19})$/u, "provider profile revision must be canonical decimal");
175
472
  var ProviderProfileHashSchema = z.string().regex(/^sha256:[0-9a-f]{64}$/u, "provider profile hash must be lowercase sha256");
@@ -1177,6 +1474,87 @@ var AgentHomeProjectionValueSchema = z.json().refine(
1177
1474
  (value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= AGENT_HOME_PROJECTION_MAX_BYTES,
1178
1475
  `projection must not exceed ${AGENT_HOME_PROJECTION_MAX_BYTES} UTF-8 JSON bytes`
1179
1476
  );
1477
+ var E2EE_MEMBER_CHAIN_APPEND_MAX_ENTRIES = 64;
1478
+ var E2EE_MEMBER_CHAIN_ENTRY_MAX_BYTES = 65536;
1479
+ var E2EE_MEMBER_CHAIN_READ_MAX_ENTRIES = 256;
1480
+ var E2EE_SCOPE_KEY_PACKAGE_PUT_MAX = 256;
1481
+ var E2EE_SCOPE_ID_MAX_LENGTH = 512;
1482
+ var E2EE_MEMBER_KEY_REGISTER_OPERATION = "e2ee-member-key.register";
1483
+ var E2EE_MEMBER_CHAIN_APPEND_OPERATION = "e2ee-member-chain.append";
1484
+ var E2EE_SCOPE_KEY_PACKAGE_PUT_OPERATION = "e2ee-scope-key-package.put";
1485
+ function base64UrlBytes(bytes) {
1486
+ const length = Math.ceil(bytes * 4 / 3);
1487
+ const last = ["[A-Za-z0-9_-]", "[AQgw]", "[AEIMQUYcgkosw048]"][bytes % 3];
1488
+ return z.string().regex(new RegExp(`^[A-Za-z0-9_-]{${length - 1}}${last}$`, "u"));
1489
+ }
1490
+ var MemberIdSchema = z.string().regex(/^[A-Za-z0-9_-]{43}$/u);
1491
+ var PositiveSafeIntegerSchema = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
1492
+ var SignatureSchema = base64UrlBytes(64);
1493
+ var P256PublicJwkSchema = z.strictObject({
1494
+ kty: z.literal("EC"),
1495
+ crv: z.literal("P-256"),
1496
+ x: base64UrlBytes(32),
1497
+ y: base64UrlBytes(32)
1498
+ });
1499
+ var E2eeMemberKeyBundleSchema = z.strictObject({
1500
+ v: z.literal(1),
1501
+ memberId: MemberIdSchema,
1502
+ signingPublicJwk: P256PublicJwkSchema,
1503
+ kemPublicJwk: P256PublicJwkSchema,
1504
+ kemEpoch: PositiveSafeIntegerSchema,
1505
+ kemSig: SignatureSchema,
1506
+ deviceId: z.string().min(1).optional()
1507
+ });
1508
+ var E2EE_MEMBER_CHAIN_OPS = ["add", "remove", "rotate", "scope-policy", "shred"];
1509
+ var E2eeScopeShredSubjectSchema = z.strictObject({ scopeId: z.string().min(1) });
1510
+ var E2eeMemberChainEntrySchema = z.strictObject({
1511
+ v: z.literal(1),
1512
+ tenantId: z.string().min(1),
1513
+ seq: PositiveSafeIntegerSchema,
1514
+ prev: z.union([z.null(), z.string().regex(CONTENT_HASH_RE)]),
1515
+ op: z.enum(E2EE_MEMBER_CHAIN_OPS),
1516
+ subject: z.custom(
1517
+ (value) => value !== null && typeof value === "object" && !Array.isArray(value)
1518
+ ),
1519
+ signer: MemberIdSchema,
1520
+ sig: SignatureSchema
1521
+ }).refine((entry) => entry.seq === 1 === (entry.prev === null), {
1522
+ path: ["prev"],
1523
+ message: "the first entry, and only the first, has no prev"
1524
+ }).refine((entry) => entry.op !== "shred" || E2eeScopeShredSubjectSchema.safeParse(entry.subject).success, {
1525
+ path: ["subject"],
1526
+ message: "a shred subject is exactly { scopeId }"
1527
+ });
1528
+ var E2eeScopeKeyPackageSchema = z.strictObject({
1529
+ v: z.literal(1),
1530
+ tenantId: z.string().min(1),
1531
+ scopeId: z.string().min(1),
1532
+ epoch: PositiveSafeIntegerSchema,
1533
+ keyId: z.string().regex(/^[A-Za-z0-9_-]{22}$/u),
1534
+ recipient: MemberIdSchema,
1535
+ sender: MemberIdSchema,
1536
+ enc: base64UrlBytes(65),
1537
+ ciphertext: base64UrlBytes(48),
1538
+ sig: SignatureSchema
1539
+ });
1540
+ var E2eePairingMacSchema = base64UrlBytes(32);
1541
+ var E2eeMemberKeyRegisterRequestSchema = z.strictObject({
1542
+ member: E2eeMemberKeyBundleSchema.refine((member) => member.deviceId !== void 0, {
1543
+ message: "a device member names its deviceId"
1544
+ }),
1545
+ mac: E2eePairingMacSchema
1546
+ });
1547
+ var E2eeClientPairingMacSchema = z.strictObject({
1548
+ mac: E2eePairingMacSchema,
1549
+ member: E2eeMemberKeyBundleSchema.refine((member) => member.deviceId === void 0, {
1550
+ message: "a client member has no deviceId"
1551
+ }),
1552
+ chainHead: z.strictObject({ seq: PositiveSafeIntegerSchema, hash: z.string().regex(CONTENT_HASH_RE) })
1553
+ });
1554
+ var E2eeKeyPackageAvailablePayloadSchema = z.strictObject({
1555
+ scopeId: z.string().min(1).max(E2EE_SCOPE_ID_MAX_LENGTH),
1556
+ epoch: PositiveSafeIntegerSchema
1557
+ });
1180
1558
 
1181
1559
  // src/messages.ts
1182
1560
  var MAX_INLINE_BYTES = 64 * 1024;
@@ -1283,7 +1661,9 @@ var DispatchSelectionSchema = z.discriminatedUnion("lane", [
1283
1661
  providerProfile: ProviderProfileBindingSchema
1284
1662
  }).strict()
1285
1663
  ]);
1664
+ var NO_SEALED_MEMBER = { sealed: z.never().optional(), sealing: z.never().optional() };
1286
1665
  var TaskOfferPayloadSchema = z.object({
1666
+ ...NO_SEALED_MEMBER,
1287
1667
  instruction: z.union([z.string(), InstructionBlobRefSchema]),
1288
1668
  runtime: RuntimeIdSchema.optional(),
1289
1669
  harnessId: HarnessIdSchema.optional(),
@@ -1300,11 +1680,17 @@ var TaskOfferWithToolsetsPayloadSchema = TaskOfferPayloadSchema.extend({
1300
1680
  requiredToolsets: RequiredToolsetsSchema
1301
1681
  }).strict();
1302
1682
  var AgentHomeAccessSchema = z.literal("memory-reader");
1683
+ var AgentMemorySelectionSchema = z.enum([
1684
+ ...PreparedAgentMemoryModeSchema.options,
1685
+ "read-if-admitted",
1686
+ "read-write-if-admitted"
1687
+ ]);
1303
1688
  var TaskOfferForAgentPayloadSchema = z.object({
1689
+ ...NO_SEALED_MEMBER,
1304
1690
  instruction: z.union([z.string(), InstructionBlobRefSchema]),
1305
1691
  agentRef: AgentRefSchema,
1306
1692
  homeAccess: AgentHomeAccessSchema.optional(),
1307
- agentMemory: PreparedAgentMemoryModeSchema.optional(),
1693
+ agentMemory: AgentMemorySelectionSchema.optional(),
1308
1694
  requiredToolsets: RequiredToolsetsSchema.optional(),
1309
1695
  runtime: RuntimeIdSchema.optional(),
1310
1696
  harnessId: HarnessIdSchema.optional(),
@@ -1524,6 +1910,7 @@ var TaskCancelPayloadSchema = z.object({
1524
1910
  reason: z.string().optional()
1525
1911
  });
1526
1912
  var TaskSteerPayloadSchema = z.object({
1913
+ ...NO_SEALED_MEMBER,
1527
1914
  text: z.string()
1528
1915
  });
1529
1916
  var TaskClaimPayloadSchema = z.object({
@@ -1535,17 +1922,25 @@ var TaskClaimPayloadSchema = z.object({
1535
1922
  capabilities: RuntimeCapabilitiesSchema.optional()
1536
1923
  });
1537
1924
  var TaskStartedPayloadSchema = z.object({});
1538
- var TaskDeclinePayloadSchema = z.object({
1925
+ var HOME_DECLINE_CODES = ["agent_home_writer_busy", "agent_home_reader_busy"];
1926
+ var DeclineFields = z.object({
1927
+ ...NO_SEALED_MEMBER,
1539
1928
  reason: z.string(),
1540
1929
  retryable: z.boolean().optional(),
1541
1930
  agentRef: AgentRefSchema.optional(),
1542
- code: z.enum(["agent_home_writer_busy", "agent_home_reader_busy"]).optional()
1931
+ code: z.enum([...HOME_DECLINE_CODES, ...SEALED_DECLINE_CODES]).optional()
1543
1932
  });
1933
+ var TaskDeclinePayloadSchema = DeclineFields.refine(
1934
+ (p) => !SEALED_DECLINE_CODES.includes(p.code) || p.reason === p.code && p.retryable !== true,
1935
+ { message: "a sealed code needs reason === code, not retryable" }
1936
+ );
1544
1937
  var TaskProgressPayloadSchema = z.object({
1938
+ ...NO_SEALED_MEMBER,
1545
1939
  seq: z.number().int(),
1546
1940
  events: z.array(AgentEventOrUnknownSchema)
1547
1941
  });
1548
1942
  var TaskArtifactPayloadSchema = z.object({
1943
+ ...NO_SEALED_MEMBER,
1549
1944
  name: z.string(),
1550
1945
  contentType: z.string(),
1551
1946
  inline: z.string().refine(isWithinInlineByteLimit, {
@@ -1554,6 +1949,7 @@ var TaskArtifactPayloadSchema = z.object({
1554
1949
  blobRef: BlobRefSchema.optional()
1555
1950
  });
1556
1951
  var TaskAwaitApprovalPayloadSchema = z.object({
1952
+ ...NO_SEALED_MEMBER,
1557
1953
  summary: z.string(),
1558
1954
  approvalId: z.string().optional()
1559
1955
  });
@@ -1610,6 +2006,7 @@ var TerminalAgentHomeMemoryChangeSchema = z.discriminatedUnion("outcome", [
1610
2006
  z.object({ outcome: z.literal("unmeasured") }).strict()
1611
2007
  ]);
1612
2008
  var TaskCompletePayloadSchema = z.object({
2009
+ ...NO_SEALED_MEMBER,
1613
2010
  harnessId: HarnessIdSchema.optional(),
1614
2011
  summary: z.string(),
1615
2012
  /**
@@ -1633,12 +2030,20 @@ var TaskCompletePayloadSchema = z.object({
1633
2030
  agentHomeProjection: TerminalAgentHomeProjectionSchema.optional(),
1634
2031
  agentHomeMemoryChange: TerminalAgentHomeMemoryChangeSchema.optional()
1635
2032
  });
2033
+ var RuntimeFailureClassSchema = z.enum(RUNTIME_FAILURE_CLASSES);
2034
+ var TaskFailureSchema = z.union([
2035
+ z.object({ class: z.literal("quota"), resetsAt: z.iso.datetime().optional() }).strict(),
2036
+ z.object({ class: RuntimeFailureClassSchema.exclude(["quota"]) }).strict()
2037
+ ]);
1636
2038
  var TaskFailPayloadSchema = z.object({
2039
+ ...NO_SEALED_MEMBER,
1637
2040
  /** Local interruption observation bound to the immutable offer; does not assert a cloud claim. */
1638
2041
  recovery: z.object({ kind: z.literal("daemon_interrupted"), offerId: z.uuid() }).strict().optional(),
1639
2042
  harnessId: HarnessIdSchema.optional(),
1640
2043
  reason: z.string(),
1641
2044
  retryable: z.boolean().optional(),
2045
+ /** Gated on the server's `runtime-failure-class` flag. Plaintext on `task.fail_sealed`. */
2046
+ failure: TaskFailureSchema.optional(),
1642
2047
  usage: TerminalInferenceUsageSchema.optional(),
1643
2048
  /** Present on a prepared Execution that observed provider usage before failing. */
1644
2049
  preparedObservation: TerminalPreparedObservationSchema.optional(),
@@ -1647,6 +2052,7 @@ var TaskFailPayloadSchema = z.object({
1647
2052
  agentHomeMemoryChange: TerminalAgentHomeMemoryChangeSchema.optional()
1648
2053
  });
1649
2054
  var TaskCancelledPayloadSchema = z.object({
2055
+ ...NO_SEALED_MEMBER,
1650
2056
  harnessId: HarnessIdSchema.optional(),
1651
2057
  reason: z.string().optional(),
1652
2058
  usage: TerminalInferenceUsageSchema.optional(),
@@ -1660,13 +2066,42 @@ var TaskApprovalResolvedPayloadSchema = z.object({
1660
2066
  resolvedBy: z.enum(["local"]),
1661
2067
  at: z.iso.datetime({ offset: true })
1662
2068
  });
2069
+ var SEALED_OFFER_FIELDS = {
2070
+ instruction: z.union([z.string(), InstructionBlobRefSchema]).optional(),
2071
+ sealing: TaskSealingSchema,
2072
+ sealed: SealedTaskInputSchema.optional()
2073
+ };
2074
+ var TaskOfferSealedPayloadSchema = TaskOfferPayloadSchema.extend(SEALED_OFFER_FIELDS).strict().superRefine(sealedOfferRule);
2075
+ var TaskOfferWithToolsetsSealedPayloadSchema = TaskOfferWithToolsetsPayloadSchema.extend(SEALED_OFFER_FIELDS).strict().superRefine(sealedOfferRule);
2076
+ var TaskOfferForAgentSealedPayloadSchema = TaskOfferForAgentPayloadSchema.extend(SEALED_OFFER_FIELDS).strict().superRefine(sealedOfferRule);
2077
+ var TaskOfferForAgentWithEgressSealedPayloadSchema = TaskOfferForAgentWithEgressPayloadSchema.extend(SEALED_OFFER_FIELDS).strict().superRefine(sealedOfferRule);
2078
+ var TaskOfferForAgentWithEgressFreshSealedPayloadSchema = TaskOfferForAgentWithEgressFreshPayloadSchema.extend({ ...SEALED_OFFER_FIELDS, routineRef: RoutineRefSchema.optional() }).strict().superRefine(sealedOfferRule);
2079
+ var TaskSteerSealedPayloadSchema = z.object({ steerId: z.uuid(), sealed: SealedTaskInputSchema }).strict();
2080
+ var TaskCompleteSealedPayloadSchema = TaskCompletePayloadSchema.omit({
2081
+ summary: true,
2082
+ finalMessage: true,
2083
+ document: true,
2084
+ artifactRefs: true,
2085
+ preparedObservation: true
2086
+ }).extend({ sealed: SealedTaskOutputSchema }).strict();
2087
+ var TaskFailSealedPayloadSchema = TaskFailPayloadSchema.omit({ reason: true, preparedObservation: true }).extend({ sealed: SealedTaskOutputSchema }).strict();
2088
+ var TaskDeclineSealedPayloadSchema = DeclineFields.omit({ reason: true }).extend({ code: z.enum(HOME_DECLINE_CODES).optional(), sealed: SealedTaskOutputSchema }).strict();
2089
+ var TaskCancelledSealedPayloadSchema = TaskCancelledPayloadSchema.omit({ reason: true }).extend({ sealed: SealedTaskOutputSchema }).strict();
2090
+ var TaskProgressSealedPayloadSchema = TaskProgressPayloadSchema.omit({ events: true }).extend({ sealed: SealedTaskOutputSchema }).strict();
2091
+ var TaskArtifactSealedPayloadSchema = TaskArtifactPayloadSchema.omit({ inline: true, blobRef: true }).extend({ artifactId: z.uuid(), sealed: SealedTaskOutputSchema }).strict();
2092
+ var TaskAwaitApprovalSealedPayloadSchema = TaskAwaitApprovalPayloadSchema.omit({ summary: true }).extend({ approvalId: z.string().min(1), sealed: SealedTaskOutputSchema }).strict();
1663
2093
  var TASK_OFFER_PAYLOAD_SCHEMAS = {
1664
2094
  "task.offer": TaskOfferPayloadSchema,
1665
2095
  "task.offer_with_toolsets": TaskOfferWithToolsetsPayloadSchema,
1666
2096
  "task.offer_for_agent": TaskOfferForAgentPayloadSchema,
1667
2097
  "task.offer_for_agent_with_egress": TaskOfferForAgentWithEgressPayloadSchema,
1668
2098
  "task.offer_for_agent_with_egress_fresh": TaskOfferForAgentWithEgressFreshPayloadSchema,
1669
- "task.offer_prepared": TaskOfferPreparedPayloadSchema
2099
+ "task.offer_prepared": TaskOfferPreparedPayloadSchema,
2100
+ "task.offer_sealed": TaskOfferSealedPayloadSchema,
2101
+ "task.offer_with_toolsets_sealed": TaskOfferWithToolsetsSealedPayloadSchema,
2102
+ "task.offer_for_agent_sealed": TaskOfferForAgentSealedPayloadSchema,
2103
+ "task.offer_for_agent_with_egress_sealed": TaskOfferForAgentWithEgressSealedPayloadSchema,
2104
+ "task.offer_for_agent_with_egress_fresh_sealed": TaskOfferForAgentWithEgressFreshSealedPayloadSchema
1670
2105
  };
1671
2106
  var TASK_OFFER_TYPES = Object.freeze(
1672
2107
  Object.keys(TASK_OFFER_PAYLOAD_SCHEMAS)
@@ -1702,7 +2137,16 @@ var MESSAGE_PAYLOAD_SCHEMAS = {
1702
2137
  "task.complete": TaskCompletePayloadSchema,
1703
2138
  "task.fail": TaskFailPayloadSchema,
1704
2139
  "task.cancelled": TaskCancelledPayloadSchema,
1705
- "task.approval_resolved": TaskApprovalResolvedPayloadSchema
2140
+ "task.approval_resolved": TaskApprovalResolvedPayloadSchema,
2141
+ "task.steer_sealed": TaskSteerSealedPayloadSchema,
2142
+ "task.complete_sealed": TaskCompleteSealedPayloadSchema,
2143
+ "task.fail_sealed": TaskFailSealedPayloadSchema,
2144
+ "task.decline_sealed": TaskDeclineSealedPayloadSchema,
2145
+ "task.cancelled_sealed": TaskCancelledSealedPayloadSchema,
2146
+ "task.progress_sealed": TaskProgressSealedPayloadSchema,
2147
+ "task.artifact_sealed": TaskArtifactSealedPayloadSchema,
2148
+ "task.await_approval_sealed": TaskAwaitApprovalSealedPayloadSchema,
2149
+ "e2ee.key_package.available": E2eeKeyPackageAvailablePayloadSchema
1706
2150
  };
1707
2151
  var MESSAGE_TYPES = Object.keys(MESSAGE_PAYLOAD_SCHEMAS);
1708
2152
  var SERVER_TO_DAEMON_TYPES = [
@@ -1723,7 +2167,14 @@ var SERVER_TO_DAEMON_TYPES = [
1723
2167
  "task.approve",
1724
2168
  "task.reject",
1725
2169
  "task.cancel",
1726
- "task.steer"
2170
+ "task.steer",
2171
+ "task.offer_sealed",
2172
+ "task.offer_with_toolsets_sealed",
2173
+ "task.offer_for_agent_sealed",
2174
+ "task.offer_for_agent_with_egress_sealed",
2175
+ "task.offer_for_agent_with_egress_fresh_sealed",
2176
+ "task.steer_sealed",
2177
+ "e2ee.key_package.available"
1727
2178
  ];
1728
2179
  var DAEMON_TO_SERVER_TYPES = [
1729
2180
  "task.claim",
@@ -1739,7 +2190,14 @@ var DAEMON_TO_SERVER_TYPES = [
1739
2190
  "agent.egress.reliable",
1740
2191
  "agent.message.draft",
1741
2192
  "agent.message.publish",
1742
- "agent.content.receipt"
2193
+ "agent.content.receipt",
2194
+ "task.complete_sealed",
2195
+ "task.fail_sealed",
2196
+ "task.decline_sealed",
2197
+ "task.cancelled_sealed",
2198
+ "task.progress_sealed",
2199
+ "task.artifact_sealed",
2200
+ "task.await_approval_sealed"
1743
2201
  ];
1744
2202
 
1745
2203
  // src/agent-memory-intent.ts
@@ -2035,7 +2493,24 @@ var EnvelopeSchema = z.discriminatedUnion("type", [
2035
2493
  envelopeShape("agent.egress.reliable", OPTIONAL_TASK_ID, OPTIONAL_SEQ),
2036
2494
  envelopeShape("agent.message.draft", REQUIRED_TASK_ID, OPTIONAL_SEQ),
2037
2495
  envelopeShape("agent.message.publish", REQUIRED_TASK_ID, OPTIONAL_SEQ),
2038
- envelopeShape("agent.content.receipt", OPTIONAL_TASK_ID, OPTIONAL_SEQ)
2496
+ envelopeShape("agent.content.receipt", OPTIONAL_TASK_ID, OPTIONAL_SEQ),
2497
+ // Sealed payload v1 (#654). Appended last, so every released branch keeps
2498
+ // its position in the union.
2499
+ envelopeShape("task.offer_sealed", REQUIRED_TASK_ID, REQUIRED_SEQ),
2500
+ envelopeShape("task.offer_with_toolsets_sealed", REQUIRED_TASK_ID, REQUIRED_SEQ),
2501
+ envelopeShape("task.offer_for_agent_sealed", REQUIRED_TASK_ID, REQUIRED_SEQ),
2502
+ envelopeShape("task.offer_for_agent_with_egress_sealed", REQUIRED_TASK_ID, REQUIRED_SEQ),
2503
+ envelopeShape("task.offer_for_agent_with_egress_fresh_sealed", REQUIRED_TASK_ID, REQUIRED_SEQ),
2504
+ envelopeShape("task.steer_sealed", REQUIRED_TASK_ID, REQUIRED_SEQ),
2505
+ envelopeShape("task.complete_sealed", REQUIRED_TASK_ID, OPTIONAL_SEQ),
2506
+ envelopeShape("task.fail_sealed", REQUIRED_TASK_ID, OPTIONAL_SEQ),
2507
+ envelopeShape("task.decline_sealed", REQUIRED_TASK_ID, OPTIONAL_SEQ),
2508
+ envelopeShape("task.cancelled_sealed", REQUIRED_TASK_ID, OPTIONAL_SEQ),
2509
+ envelopeShape("task.progress_sealed", REQUIRED_TASK_ID, OPTIONAL_SEQ),
2510
+ envelopeShape("task.artifact_sealed", REQUIRED_TASK_ID, OPTIONAL_SEQ),
2511
+ envelopeShape("task.await_approval_sealed", REQUIRED_TASK_ID, OPTIONAL_SEQ),
2512
+ // E2EE key package notice (#654 E2c-3), appended for the same reason.
2513
+ envelopeShape("e2ee.key_package.available", FORBIDDEN_TASK_ID, REQUIRED_SEQ)
2039
2514
  ]);
2040
2515
  function isServerToDaemonType(type) {
2041
2516
  return SERVER_TO_DAEMON_TYPES.includes(type);
@@ -2236,6 +2711,7 @@ var EventsPollResponseSchema = z.object({
2236
2711
  ingress: ActivityIngressSchema
2237
2712
  });
2238
2713
  var MAX_MESSAGES_PER_BATCH = 256;
2714
+ var MESSAGES_SEND_MAX_BODY_BYTES = 2 * 1024 * 1024;
2239
2715
  var MessagesSendRequestSchema = z.object({
2240
2716
  messages: z.array(EnvelopeSchema).max(MAX_MESSAGES_PER_BATCH)
2241
2717
  });
@@ -2350,6 +2826,10 @@ var BYOK_RECORD_ROUTE = "/byok/records/:kind/:key";
2350
2826
  function byokRecordPath(kind, key) {
2351
2827
  return `/byok/records/${encodeURIComponent(kind)}/${encodeURIComponent(key)}`;
2352
2828
  }
2829
+ var BYOK_E2EE_MEMBER_KEY_PATH = "/byok/e2ee/member-key";
2830
+ var BYOK_E2EE_CHAIN_PATH = "/byok/e2ee/chain";
2831
+ var BYOK_E2EE_KEY_PACKAGES_PATH = "/byok/e2ee/key-packages";
2832
+ var BYOK_E2EE_PAIRING_MAC_PATH = "/byok/e2ee/pairing-mac";
2353
2833
  var BYOK_SKILL_PACKS_PATH = "/byok/skill-packs";
2354
2834
  var BYOK_SKILL_PACK_FILE_ROUTE = "/byok/skill-packs/:name/files/:path";
2355
2835
  function byokSkillPackFilePath(name, path) {
@@ -2558,6 +3038,6 @@ function composeBotTurnOutcomeSchema(fragments, required = []) {
2558
3038
  return admitted.canonical;
2559
3039
  }
2560
3040
 
2561
- export { AGENT_CONTENT_ARTIFACT_READ_CAPABILITY, AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY, AGENT_CONTENT_WORKSPACE_READ_CAPABILITY, AGENT_EGRESS_FRESH_SESSION_CAPABILITY, AGENT_EGRESS_POLICY_CAPABILITY, AGENT_EGRESS_RELIABLE_ACK_CAPABILITY, AGENT_EVENT_SPILL_UNSTORED_REASON_MAX_LENGTH, AGENT_HOME_MEMORY_DIGEST_MAX_BYTES, AGENT_HOME_MEMORY_DIGEST_MAX_FILES, AGENT_HOME_MEMORY_PATH_MAX_LENGTH, AGENT_HOME_PROJECTION_CAPABILITY, AGENT_HOME_PROJECTION_MAX_BYTES, AGENT_HOME_PROJECTION_PROFILE_REVISION_MAXIMUM, AGENT_HOME_READERS_CAPABILITY, AGENT_INPUT_PREPARATION_CAPABILITY, AGENT_MEMORY_INTENT_APPROVAL_REF_MAX_BYTES, AGENT_MEMORY_INTENT_CAPABILITY, AGENT_MEMORY_INTENT_CONTENT_MAX_BYTES, AGENT_MEMORY_INTENT_FETCH_DISPOSITIONS, AGENT_MEMORY_INTENT_FETCH_DISPOSITIONS_BY_RESERVATION, AGENT_MEMORY_INTENT_HOST_TERMINAL_CODES, AGENT_MEMORY_INTENT_OPERATIONS, AGENT_MEMORY_INTENT_PATH_MAX_BYTES, AGENT_MEMORY_INTENT_READBACK_DISPOSITIONS, AGENT_MEMORY_INTENT_REJECTION_CODES, AGENT_MEMORY_INTENT_RESERVATIONS, AGENT_MEMORY_MAX_SNAPSHOT_BYTES, AGENT_MEMORY_MAX_SNAPSHOT_FILES, AGENT_MEMORY_PROJECTION_CAPABILITY, AGENT_MEMORY_PROJECTION_MAX_ORDERING_VALUE, AGENT_MEMORY_PROJECTION_MAX_REDACTED_BYTES, AGENT_MEMORY_SELECTION_CAPABILITY, AGENT_MESSAGE_DRAFT_FRAME_MAX_BYTES, AGENT_MESSAGE_EGRESS_CAPABILITY, AGENT_MESSAGE_MAX_BYTES, AGENT_REF_MAX_BYTES, ActivityIngressSchema, AgentContentActorKindSchema, AgentContentActorSchema, AgentContentDecodeAsSchema, AgentContentMimeTypeSchema, AgentContentReadDecisionSchema, AgentContentReadDenialReasonSchema, AgentContentReadPayloadSchema, AgentContentReadSurfaceSchema, AgentContentReceiptPayloadSchema, AgentEgressAckPayloadSchema, AgentEgressActivityPolicySchema, AgentEgressContentHashSchema, AgentEgressDropReasonSchema, AgentEgressLaneSchema, AgentEgressPolicyRevisionSchema, AgentEgressPolicySchema, AgentEgressReliablePayloadSchema, AgentEventOrUnknownSchema, AgentEventSchema, AgentEventSpillSchema, AgentHomeAccessSchema, AgentHomeProjectionAgentRefSchema, AgentHomeProjectionCompletionRequestSchema, AgentHomeProjectionHashSchema, AgentHomeProjectionOutcomeSchema, AgentHomeProjectionPayloadSchema, AgentHomeProjectionProfileRevisionSchema, AgentHomeProjectionReadbackSchema, AgentHomeProjectionStatusSchema, AgentHomeProjectionValueSchema, AgentInputPreparationPayloadSchema, AgentMemoryIntentApprovalRefSchema, AgentMemoryIntentAvailablePayloadSchema, AgentMemoryIntentCompletionSchema, AgentMemoryIntentContentSchema, AgentMemoryIntentFetchRequestSchema, AgentMemoryIntentFetchResponseSchema, AgentMemoryIntentFileObservationSchema, AgentMemoryIntentHostTerminalCodeSchema, AgentMemoryIntentOperationDigestSchema, AgentMemoryIntentOperationSchema, AgentMemoryIntentPathSchema, AgentMemoryIntentReadbackDispositionSchema, AgentMemoryIntentReadbackSchema, AgentMemoryIntentRejectionCodeSchema, AgentMemoryIntentReservationSchema, AgentMemoryIntentRevisionSchema, AgentMemoryIntentV1Schema, AgentMemoryProjectionCommitRequestSchema, AgentMemoryProjectionCommitResponseSchema, AgentMemoryProjectionEraseResultSchema, AgentMemoryProjectionGrantRefSchema, AgentMemoryProjectionMeteringReceiptSchema, AgentMemoryProjectionMutationSchema, AgentMemoryProjectionReceiptSchema, AgentMemoryProjectionSessionRefSchema, AgentMemoryProjectionSnapshotSchema, AgentMemoryProjectionSourceSeqSchema, AgentMemoryProjectionWriterEpochSchema, AgentMessageContentTypeSchema, AgentMessageContractSchema, AgentMessageDestinationBindingSchema, AgentMessageDispositionPayloadSchema, AgentMessageDraftPayloadSchema, AgentMessageEgressRequirementSchema, AgentMessageFreshnessCursorSchema, AgentMessagePublishPayloadSchema, AgentMessageServerContextSchema, AgentRefSchema, AgentReliableQuotaPolicySchema, BOT_TURN_OUTCOME_CONTRACT, BOT_TURN_OUTCOME_LIMITS, BYOK_ACTIVITY_PATH, BYOK_AGENT_HOME_PROJECTIONS_PATH, BYOK_AGENT_HOME_PROJECTION_COMPLETION_ROUTE, BYOK_AGENT_MEMORY_PROJECTIONS_PATH, BYOK_BLOBS_PATH, BYOK_BLOB_CONTENT_ROUTE, BYOK_BLOB_FINALIZE_ROUTE, BYOK_BLOB_URL_ROUTE, BYOK_BOARD_CLAIM_ROUTE, BYOK_BOARD_PATH, BYOK_BOARD_STATUS_ROUTE, BYOK_BOARD_STREAM_PATH, BYOK_BOARD_UNCLAIM_ROUTE, BYOK_CAPABILITIES_PATH, BYOK_CHALLENGE_PATH, BYOK_EVENTS_PATH, BYOK_INPUT_PREPARATIONS_PATH, BYOK_INPUT_PREPARATION_COMPLETION_ROUTE, BYOK_INPUT_PREPARATION_STATUS_ROUTE, BYOK_MESSAGES_PATH, BYOK_PAIR_PATH, BYOK_PRESENCE_PATH, BYOK_RECORDS_PATH, BYOK_RECORD_ROUTE, BYOK_SKILL_PACKS_PATH, BYOK_SKILL_PACK_FILE_ROUTE, BYOK_TOKEN_PATH, BlobDownloadUrlResponseSchema, BlobRefSchema, BotTurnOutcomeSchemaError, CAPABILITY_FLAGS, CONFIGURED_TOOLSETS_MAX_ITEMS, CONTENT_HASH_RE, CUSTOM_HARNESS_CAPABILITY, ChallengeRequestSchema, ChallengeResponseSchema, ConfiguredToolsetsSchema, ConnAckPayloadSchema, ConnHelloPayloadSchema, ContentReadPolicySchema, CreateBlobRequestSchema, CreateBlobResponseSchema, DAEMON_TO_SERVER_TYPES, DispatchSelectionSchema, EnvelopeParseError, EnvelopeSchema, EnvelopeValidationError, EventsPollQuerySchema, EventsPollResponseSchema, HOST_MCP_TASK_CONTEXT_CAPABILITY, HarnessIdSchema, HarnessInfoSchema, HarnessInventorySchema, INPUT_PREPARATION_WIRE_VERSION, InputPreparationAccountingPolicyRefSchema, InputPreparationArtifactSummarySchema, InputPreparationBindingSchema, InputPreparationCompletionRequestSchema, InputPreparationContentHashSchema, InputPreparationContextDocumentSchema, InputPreparationCounterEvidenceSchema, InputPreparationCounterProviderEvidenceSchema, InputPreparationCounterTargetSchema, InputPreparationHostCanonicalAssistantMessageSchema, InputPreparationMessageSchema, InputPreparationModelCostSchema, InputPreparationModelSchema, InputPreparationOfferBindingSchema, InputPreparationOptionsSchema, InputPreparationPolicyRevisionSchema, InputPreparationProfileIdSchema, InputPreparationProjectionSchema, InputPreparationPromptSnapshotSchema, InputPreparationReadbackSchema, InputPreparationReadinessReasonSchema, InputPreparationReceiptSummarySchema, InputPreparationReferenceSchema, InputPreparationRejectionReasonSchema, InputPreparationResidualKeySchema, InputPreparationResidualValueClassSchema, InputPreparationRuntimeIdentitySchema, InputPreparationSelectionSchema, InputPreparationSourceSchema, InputPreparationStateSchema, InputPreparationStatusQuerySchema, InputPreparationStatusSchema, InputPreparationUserMessageSchema, KNOWN_AGENT_EVENT_TYPES, MAILBOX_READ_AHEAD_CAPABILITY, MAILBOX_READ_AHEAD_MAX_SEQS, MAX_MESSAGES_PER_BATCH, MESSAGE_PAYLOAD_SCHEMAS, MESSAGE_TYPES, MessageSendOutcomeSchema, MessagesSendRequestSchema, MessagesSendResponseSchema, OUTBOUND_REFUSAL_REASONS, PAIR_RESPONSE_TENANT_ID_MAX_LENGTH, PREPARED_AGENT_MEMORY_MODES, PROTOCOL_VERSION, PROVIDER_MODEL_CAPABILITIES, PROVIDER_PROFILE_BINDING_CAPABILITY, PROVIDER_PROVISIONING_CAPABILITY, PROVIDER_PROVISIONING_DISPOSITIONS, PROVIDER_PROVISIONING_HOST_TERMINAL_CODES, PROVIDER_PROVISIONING_KEY_CHECK_RESULTS, PROVIDER_PROVISIONING_OPERATIONS, PROVIDER_PROVISIONING_OPERATION_GENERATION_MAXIMUM, PROVIDER_PROVISIONING_REJECTION_CODES, PROVIDER_SECRET_SEALING_KEY_REGISTER_OPERATION, PairRequestSchema, PairResponseSchema, PairResponseTenantIdSchema, PreparedAgentMemoryModeSchema, PresencePublishRequestSchema, ProtocolError, ProtocolVersionNumberSchema, ProviderModelCapabilitySchema, ProviderProfileBindingSchema, ProviderProfileHashSchema, ProviderProfileRefSchema, ProviderProfileRevisionSchema, ProviderProvisioningAvailablePayloadSchema, ProviderProvisioningCompletionSchema, ProviderProvisioningDispositionSchema, ProviderProvisioningKeyCheckResultSchema, ProviderProvisioningKeyCheckSchema, ProviderProvisioningOperationDigestSchema, ProviderProvisioningOperationGenerationSchema, ProviderProvisioningOperationSchema, ProviderProvisioningProviderStatusSchema, ProviderProvisioningReadbackSchema, ProviderProvisioningRejectionCodeSchema, RESULT_DOCUMENT_MAX_BYTES, RESULT_ISSUES_MAX_BYTES, RESULT_ISSUES_MAX_COUNT, RESULT_JSON_MAX_DEPTH, RESULT_OUTCOME_MAX_BYTES, RESULT_SCHEMA_INSTANCE_TYPES, RESULT_SCHEMA_KEYWORDS, RESULT_SCHEMA_MAX_BYTES, RESULT_SCHEMA_MAX_DEPTH, ROUTINE_DAYS_OF_WEEK, RUNTIME_IDS, RequiredToolsetsSchema, ResultDocumentSchemaSchema, RuntimeCapabilitiesSchema, RuntimeIdSchema, RuntimeInfoSchema, SERVER_TO_DAEMON_TYPES, STRICT_AGENT_ONLY_CAPABILITY, TASK_OFFER_TYPES, TASK_STATES, TASK_TRANSITIONS, TERMINAL_INFERENCE_USAGE_CLIENT_VERSION_MAX_LENGTH, TERMINAL_INFERENCE_USAGE_MAX_DURATION_MS, TERMINAL_INFERENCE_USAGE_MAX_TOKENS, TERMINAL_INFERENCE_USAGE_MODEL_MAX_LENGTH, TERMINAL_INFERENCE_USAGE_PROVIDER_MAX_LENGTH, TERMINAL_PROJECTION_SELECTION_CAPABILITY, TaskApprovalResolvedPayloadSchema, TaskApprovePayloadSchema, TaskArtifactPayloadSchema, TaskAwaitApprovalPayloadSchema, TaskCancelPayloadSchema, TaskCancelledPayloadSchema, TaskClaimPayloadSchema, TaskCompletePayloadSchema, TaskDeclinePayloadSchema, TaskFailPayloadSchema, TaskOfferForAgentPayloadSchema, TaskOfferForAgentWithEgressFreshPayloadSchema, TaskOfferForAgentWithEgressPayloadSchema, TaskOfferPayloadSchema, TaskOfferPreparedPayloadSchema, TaskOfferWithToolsetsPayloadSchema, TaskProgressPayloadSchema, TaskRejectPayloadSchema, TaskStartedPayloadSchema, TaskSteerPayloadSchema, TerminalAgentHomeMemoryChangeSchema, TerminalAgentHomeProjectionSchema, TerminalInferenceUsageSchema, TerminalPreparedObservationSchema, TerminalProjectionContractSchema, TerminalProjectionSelectionSchema, TokenRequestSchema, TokenResponseSchema, ToolsetIdSchema, UnknownAgentEventSchema, UnknownMessageTypeError, WIRE_ADDITIONS, agentMemoryIntentFetchResponseSchemaFor, agentMemoryProjectionBase64UrlByteLength, botTurnOutcomeFragments, byokAgentHomeProjectionCompletionPath, byokBlobContentPath, byokBlobFinalizePath, byokBlobUrlPath, byokInputPreparationCompletionPath, byokInputPreparationStatusPath, byokRecordPath, byokSkillPackFilePath, canTransition, checkResultDocument, checkResultSchema, composeBotTurnOutcomeSchema, createEnvelope, decodeEnvelope, encodeEnvelope, isKnownAgentEvent, isPreparedAgentMemoryMode, isServerToDaemonType, isTaskOfferType, parseMessage, partitionAgentEvents, requiredReceiverCapabilities, resultOutcomeMaxBytes, validateResultOutcome };
3041
+ export { AGENT_CONTENT_ARTIFACT_READ_CAPABILITY, AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY, AGENT_CONTENT_WORKSPACE_READ_CAPABILITY, AGENT_EGRESS_FRESH_SESSION_CAPABILITY, AGENT_EGRESS_POLICY_CAPABILITY, AGENT_EGRESS_RELIABLE_ACK_CAPABILITY, AGENT_EVENT_SPILL_UNSTORED_REASON_MAX_LENGTH, AGENT_HOME_MEMORY_DIGEST_MAX_BYTES, AGENT_HOME_MEMORY_DIGEST_MAX_FILES, AGENT_HOME_MEMORY_PATH_MAX_LENGTH, AGENT_HOME_PROJECTION_CAPABILITY, AGENT_HOME_PROJECTION_MAX_BYTES, AGENT_HOME_PROJECTION_PROFILE_REVISION_MAXIMUM, AGENT_HOME_READERS_CAPABILITY, AGENT_INPUT_PREPARATION_CAPABILITY, AGENT_MEMORY_INTENT_APPROVAL_REF_MAX_BYTES, AGENT_MEMORY_INTENT_CAPABILITY, AGENT_MEMORY_INTENT_CONTENT_MAX_BYTES, AGENT_MEMORY_INTENT_FETCH_DISPOSITIONS, AGENT_MEMORY_INTENT_FETCH_DISPOSITIONS_BY_RESERVATION, AGENT_MEMORY_INTENT_HOST_TERMINAL_CODES, AGENT_MEMORY_INTENT_OPERATIONS, AGENT_MEMORY_INTENT_PATH_MAX_BYTES, AGENT_MEMORY_INTENT_READBACK_DISPOSITIONS, AGENT_MEMORY_INTENT_REJECTION_CODES, AGENT_MEMORY_INTENT_RESERVATIONS, AGENT_MEMORY_MAX_SNAPSHOT_BYTES, AGENT_MEMORY_MAX_SNAPSHOT_FILES, AGENT_MEMORY_PROJECTION_CAPABILITY, AGENT_MEMORY_PROJECTION_MAX_ORDERING_VALUE, AGENT_MEMORY_PROJECTION_MAX_REDACTED_BYTES, AGENT_MEMORY_READ_IF_ADMITTED_CAPABILITY, AGENT_MEMORY_READ_WRITE_IF_ADMITTED_CAPABILITY, AGENT_MEMORY_SELECTION_CAPABILITY, AGENT_MESSAGE_DRAFT_FRAME_MAX_BYTES, AGENT_MESSAGE_EGRESS_CAPABILITY, AGENT_MESSAGE_MAX_BYTES, AGENT_REF_MAX_BYTES, ActivityIngressSchema, AgentContentActorKindSchema, AgentContentActorSchema, AgentContentDecodeAsSchema, AgentContentMimeTypeSchema, AgentContentReadDecisionSchema, AgentContentReadDenialReasonSchema, AgentContentReadPayloadSchema, AgentContentReadSurfaceSchema, AgentContentReceiptPayloadSchema, AgentEgressAckPayloadSchema, AgentEgressActivityPolicySchema, AgentEgressContentHashSchema, AgentEgressDropReasonSchema, AgentEgressLaneSchema, AgentEgressPolicyRevisionSchema, AgentEgressPolicySchema, AgentEgressReliablePayloadSchema, AgentEventOrUnknownSchema, AgentEventSchema, AgentEventSpillSchema, AgentHomeAccessSchema, AgentHomeProjectionAgentRefSchema, AgentHomeProjectionCompletionRequestSchema, AgentHomeProjectionHashSchema, AgentHomeProjectionOutcomeSchema, AgentHomeProjectionPayloadSchema, AgentHomeProjectionProfileRevisionSchema, AgentHomeProjectionReadbackSchema, AgentHomeProjectionStatusSchema, AgentHomeProjectionValueSchema, AgentInputPreparationPayloadSchema, AgentMemoryIntentApprovalRefSchema, AgentMemoryIntentAvailablePayloadSchema, AgentMemoryIntentCompletionSchema, AgentMemoryIntentContentSchema, AgentMemoryIntentFetchRequestSchema, AgentMemoryIntentFetchResponseSchema, AgentMemoryIntentFileObservationSchema, AgentMemoryIntentHostTerminalCodeSchema, AgentMemoryIntentOperationDigestSchema, AgentMemoryIntentOperationSchema, AgentMemoryIntentPathSchema, AgentMemoryIntentReadbackDispositionSchema, AgentMemoryIntentReadbackSchema, AgentMemoryIntentRejectionCodeSchema, AgentMemoryIntentReservationSchema, AgentMemoryIntentRevisionSchema, AgentMemoryIntentV1Schema, AgentMemoryProjectionCommitRequestSchema, AgentMemoryProjectionCommitResponseSchema, AgentMemoryProjectionEraseResultSchema, AgentMemoryProjectionGrantRefSchema, AgentMemoryProjectionMeteringReceiptSchema, AgentMemoryProjectionMutationSchema, AgentMemoryProjectionReceiptSchema, AgentMemoryProjectionSessionRefSchema, AgentMemoryProjectionSnapshotSchema, AgentMemoryProjectionSourceSeqSchema, AgentMemoryProjectionWriterEpochSchema, AgentMemorySelectionSchema, AgentMessageContentTypeSchema, AgentMessageContractSchema, AgentMessageDestinationBindingSchema, AgentMessageDispositionPayloadSchema, AgentMessageDraftPayloadSchema, AgentMessageEgressRequirementSchema, AgentMessageFreshnessCursorSchema, AgentMessagePublishPayloadSchema, AgentMessageServerContextSchema, AgentRefSchema, AgentReliableQuotaPolicySchema, BOT_TURN_OUTCOME_CONTRACT, BOT_TURN_OUTCOME_LIMITS, BYOK_ACTIVITY_PATH, BYOK_AGENT_HOME_PROJECTIONS_PATH, BYOK_AGENT_HOME_PROJECTION_COMPLETION_ROUTE, BYOK_AGENT_MEMORY_PROJECTIONS_PATH, BYOK_BLOBS_PATH, BYOK_BLOB_CONTENT_ROUTE, BYOK_BLOB_FINALIZE_ROUTE, BYOK_BLOB_URL_ROUTE, BYOK_BOARD_CLAIM_ROUTE, BYOK_BOARD_PATH, BYOK_BOARD_STATUS_ROUTE, BYOK_BOARD_STREAM_PATH, BYOK_BOARD_UNCLAIM_ROUTE, BYOK_CAPABILITIES_PATH, BYOK_CHALLENGE_PATH, BYOK_E2EE_CHAIN_PATH, BYOK_E2EE_KEY_PACKAGES_PATH, BYOK_E2EE_MEMBER_KEY_PATH, BYOK_E2EE_PAIRING_MAC_PATH, BYOK_EVENTS_PATH, BYOK_INPUT_PREPARATIONS_PATH, BYOK_INPUT_PREPARATION_COMPLETION_ROUTE, BYOK_INPUT_PREPARATION_STATUS_ROUTE, BYOK_MESSAGES_PATH, BYOK_PAIR_PATH, BYOK_PRESENCE_PATH, BYOK_RECORDS_PATH, BYOK_RECORD_ROUTE, BYOK_SKILL_PACKS_PATH, BYOK_SKILL_PACK_FILE_ROUTE, BYOK_TOKEN_PATH, BlobDownloadUrlResponseSchema, BlobRefSchema, BotTurnOutcomeSchemaError, CAPABILITY_FLAGS, CONFIGURED_TOOLSETS_MAX_ITEMS, CONTENT_HASH_RE, CUSTOM_HARNESS_CAPABILITY, ChallengeRequestSchema, ChallengeResponseSchema, ConfiguredToolsetsSchema, ConnAckPayloadSchema, ConnHelloPayloadSchema, ContentReadPolicySchema, CreateBlobRequestSchema, CreateBlobResponseSchema, DAEMON_TO_SERVER_TYPES, DispatchSelectionSchema, E2EE_MEMBER_CHAIN_APPEND_MAX_ENTRIES, E2EE_MEMBER_CHAIN_APPEND_OPERATION, E2EE_MEMBER_CHAIN_ENTRY_MAX_BYTES, E2EE_MEMBER_CHAIN_OPS, E2EE_MEMBER_CHAIN_READ_MAX_ENTRIES, E2EE_MEMBER_KEY_REGISTER_OPERATION, E2EE_SCOPE_ID_MAX_LENGTH, E2EE_SCOPE_KEY_PACKAGE_PUT_MAX, E2EE_SCOPE_KEY_PACKAGE_PUT_OPERATION, E2eeClientPairingMacSchema, E2eeKeyPackageAvailablePayloadSchema, E2eeMemberChainEntrySchema, E2eeMemberKeyBundleSchema, E2eeMemberKeyRegisterRequestSchema, E2eePairingMacSchema, E2eeScopeKeyPackageSchema, EnvelopeParseError, EnvelopeSchema, EnvelopeValidationError, EventsPollQuerySchema, EventsPollResponseSchema, HOST_MCP_TASK_CONTEXT_CAPABILITY, HarnessIdSchema, HarnessInfoSchema, HarnessInventorySchema, INPUT_PREPARATION_WIRE_VERSION, InputPreparationAccountingPolicyRefSchema, InputPreparationArtifactSummarySchema, InputPreparationBindingSchema, InputPreparationCompletionRequestSchema, InputPreparationContentHashSchema, InputPreparationContextDocumentSchema, InputPreparationCounterEvidenceSchema, InputPreparationCounterProviderEvidenceSchema, InputPreparationCounterTargetSchema, InputPreparationHostCanonicalAssistantMessageSchema, InputPreparationMessageSchema, InputPreparationModelCostSchema, InputPreparationModelSchema, InputPreparationOfferBindingSchema, InputPreparationOptionsSchema, InputPreparationPolicyRevisionSchema, InputPreparationProfileIdSchema, InputPreparationProjectionSchema, InputPreparationPromptSnapshotSchema, InputPreparationReadbackSchema, InputPreparationReadinessReasonSchema, InputPreparationReceiptSummarySchema, InputPreparationReferenceSchema, InputPreparationRejectionReasonSchema, InputPreparationResidualKeySchema, InputPreparationResidualValueClassSchema, InputPreparationRuntimeIdentitySchema, InputPreparationSelectionSchema, InputPreparationSourceSchema, InputPreparationStateSchema, InputPreparationStatusQuerySchema, InputPreparationStatusSchema, InputPreparationUserMessageSchema, KNOWN_AGENT_EVENT_TYPES, MAILBOX_READ_AHEAD_CAPABILITY, MAILBOX_READ_AHEAD_MAX_SEQS, MAX_MESSAGES_PER_BATCH, MESSAGES_SEND_MAX_BODY_BYTES, MESSAGE_PAYLOAD_SCHEMAS, MESSAGE_TYPES, MessageSendOutcomeSchema, MessagesSendRequestSchema, MessagesSendResponseSchema, OUTBOUND_REFUSAL_REASONS, PAIR_RESPONSE_TENANT_ID_MAX_LENGTH, PREPARED_AGENT_MEMORY_MODES, PROTOCOL_VERSION, PROVIDER_MODEL_CAPABILITIES, PROVIDER_PROFILE_BINDING_CAPABILITY, PROVIDER_PROVISIONING_CAPABILITY, PROVIDER_PROVISIONING_DISPOSITIONS, PROVIDER_PROVISIONING_HOST_TERMINAL_CODES, PROVIDER_PROVISIONING_KEY_CHECK_RESULTS, PROVIDER_PROVISIONING_OPERATIONS, PROVIDER_PROVISIONING_OPERATION_GENERATION_MAXIMUM, PROVIDER_PROVISIONING_REJECTION_CODES, PROVIDER_SECRET_SEALING_KEY_REGISTER_OPERATION, PairRequestSchema, PairResponseSchema, PairResponseTenantIdSchema, PreparedAgentMemoryModeSchema, PresencePublishRequestSchema, ProtocolError, ProtocolVersionNumberSchema, ProviderModelCapabilitySchema, ProviderProfileBindingSchema, ProviderProfileHashSchema, ProviderProfileRefSchema, ProviderProfileRevisionSchema, ProviderProvisioningAvailablePayloadSchema, ProviderProvisioningCompletionSchema, ProviderProvisioningDispositionSchema, ProviderProvisioningKeyCheckResultSchema, ProviderProvisioningKeyCheckSchema, ProviderProvisioningOperationDigestSchema, ProviderProvisioningOperationGenerationSchema, ProviderProvisioningOperationSchema, ProviderProvisioningProviderStatusSchema, ProviderProvisioningReadbackSchema, ProviderProvisioningRejectionCodeSchema, RESULT_DOCUMENT_MAX_BYTES, RESULT_ISSUES_MAX_BYTES, RESULT_ISSUES_MAX_COUNT, RESULT_JSON_MAX_DEPTH, RESULT_OUTCOME_MAX_BYTES, RESULT_SCHEMA_INSTANCE_TYPES, RESULT_SCHEMA_KEYWORDS, RESULT_SCHEMA_MAX_BYTES, RESULT_SCHEMA_MAX_DEPTH, ROUTINE_DAYS_OF_WEEK, RUNTIME_FAILURE_CLASSES, RUNTIME_FAILURE_CLASS_CAPABILITY, RUNTIME_IDS, RequiredToolsetsSchema, ResultDocumentSchemaSchema, RuntimeCapabilitiesSchema, RuntimeFailureClassSchema, RuntimeIdSchema, RuntimeInfoSchema, SEALED_DECLINE_CODES, SEALED_INLINE_MAX_PADDED_LENGTH, SEALED_OUTPUT_CIPHERTEXT_REF_CAPABILITY, SEALED_PAYLOAD_CAPABILITY, SEALED_PAYLOAD_CATEGORIES, SEALED_PAYLOAD_MAX_CONTENT_LENGTH, SEALED_PAYLOAD_MAX_PADDED_LENGTH, SEALED_PAYLOAD_SUITE, SEALED_PAYLOAD_V1_CATEGORIES, SEALED_PAYLOAD_VERSION, SEALED_SPLIT_TABLE, SEALED_TASK_PLAIN_CODES, SERVER_TO_DAEMON_TYPES, STRICT_AGENT_ONLY_CAPABILITY, SealedPayloadSchema, SealedTaskInputSchema, SealedTaskOutputSchema, TASK_OFFER_TYPES, TASK_STATES, TASK_TRANSITIONS, TERMINAL_INFERENCE_USAGE_CLIENT_VERSION_MAX_LENGTH, TERMINAL_INFERENCE_USAGE_MAX_DURATION_MS, TERMINAL_INFERENCE_USAGE_MAX_TOKENS, TERMINAL_INFERENCE_USAGE_MODEL_MAX_LENGTH, TERMINAL_INFERENCE_USAGE_PROVIDER_MAX_LENGTH, TERMINAL_PROJECTION_SELECTION_CAPABILITY, TaskApprovalResolvedPayloadSchema, TaskApprovePayloadSchema, TaskArtifactPayloadSchema, TaskAwaitApprovalPayloadSchema, TaskCancelPayloadSchema, TaskCancelledPayloadSchema, TaskClaimPayloadSchema, TaskCompletePayloadSchema, TaskDeclinePayloadSchema, TaskFailPayloadSchema, TaskFailureSchema, TaskOfferForAgentPayloadSchema, TaskOfferForAgentWithEgressFreshPayloadSchema, TaskOfferForAgentWithEgressPayloadSchema, TaskOfferPayloadSchema, TaskOfferPreparedPayloadSchema, TaskOfferWithToolsetsPayloadSchema, TaskProgressPayloadSchema, TaskRejectPayloadSchema, TaskSealingSchema, TaskStartedPayloadSchema, TaskSteerPayloadSchema, TerminalAgentHomeMemoryChangeSchema, TerminalAgentHomeProjectionSchema, TerminalInferenceUsageSchema, TerminalPreparedObservationSchema, TerminalProjectionContractSchema, TerminalProjectionSelectionSchema, TokenRequestSchema, TokenResponseSchema, ToolsetIdSchema, UnknownAgentEventSchema, UnknownMessageTypeError, WIRE_ADDITIONS, agentMemoryIntentFetchResponseSchemaFor, agentMemoryProjectionBase64UrlByteLength, botTurnOutcomeFragments, byokAgentHomeProjectionCompletionPath, byokBlobContentPath, byokBlobFinalizePath, byokBlobUrlPath, byokInputPreparationCompletionPath, byokInputPreparationStatusPath, byokRecordPath, byokSkillPackFilePath, canTransition, checkResultDocument, checkResultSchema, composeBotTurnOutcomeSchema, createEnvelope, decodeEnvelope, encodeEnvelope, isKnownAgentEvent, isPreparedAgentMemoryMode, isSealedMessageType, isSealedTaskPlainOutput, isServerToDaemonType, isTaskOfferType, parseMessage, partitionAgentEvents, requiredReceiverCapabilities, resultOutcomeMaxBytes, sealedBase64UrlByteLength, sealedPayloadPaddedLength, validateResultOutcome };
2562
3042
  //# sourceMappingURL=index.js.map
2563
3043
  //# sourceMappingURL=index.js.map