@byok-sdk/protocol 0.26.0 → 0.27.0-rc.2

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
@@ -1,6 +1,8 @@
1
1
  import { z } from 'zod';
2
+ import { Validator } from '@cfworker/json-schema';
2
3
 
3
- // src/agent-egress.ts
4
+ // src/capability-constants.ts
5
+ var INPUT_PREPARATION_WIRE_VERSION = 9;
4
6
  var AGENT_EGRESS_POLICY_CAPABILITY = "agent-egress-policy";
5
7
  var AGENT_EGRESS_RELIABLE_ACK_CAPABILITY = "agent-egress-reliable-ack";
6
8
  var AGENT_EGRESS_FRESH_SESSION_CAPABILITY = "agent-egress-fresh-session";
@@ -8,6 +10,593 @@ var AGENT_MESSAGE_EGRESS_CAPABILITY = "agent-message-egress";
8
10
  var AGENT_CONTENT_WORKSPACE_READ_CAPABILITY = "agent-content-workspace-read";
9
11
  var AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY = "agent-content-transcript-read";
10
12
  var AGENT_CONTENT_ARTIFACT_READ_CAPABILITY = "agent-content-artifact-read";
13
+ var AGENT_HOME_PROJECTION_CAPABILITY = "agent-home-projection";
14
+ var TERMINAL_PROJECTION_SELECTION_CAPABILITY = "terminal-projection-selection";
15
+ var HOST_MCP_TASK_CONTEXT_CAPABILITY = "host-mcp-task-context";
16
+ var PROVIDER_PROFILE_BINDING_CAPABILITY = "provider-profile-binding";
17
+ var PROVIDER_PROVISIONING_CAPABILITY = "provider-provisioning.v1";
18
+ var AGENT_MEMORY_INTENT_CAPABILITY = "agent-memory-intent.v1";
19
+ var AGENT_MEMORY_PROJECTION_CAPABILITY = "agent.memory.projection";
20
+ var AGENT_INPUT_PREPARATION_CAPABILITY = `agent-input-preparation-v${INPUT_PREPARATION_WIRE_VERSION}`;
21
+ var PREPARED_AGENT_MEMORY_MODES = ["none", "read", "read-write"];
22
+ function isPreparedAgentMemoryMode(value) {
23
+ return typeof value === "string" && PREPARED_AGENT_MEMORY_MODES.some((mode) => mode === value);
24
+ }
25
+
26
+ // src/version.ts
27
+ var MAILBOX_READ_AHEAD_MAX_SEQS = 4096;
28
+ var MAILBOX_READ_AHEAD_CAPABILITY = "mailbox-read-ahead";
29
+ var PROTOCOL_VERSION = 3;
30
+ var STRICT_AGENT_ONLY_CAPABILITY = "strict-agent-only";
31
+ var AGENT_HOME_READERS_CAPABILITY = "agent-home-readers";
32
+ var CUSTOM_HARNESS_CAPABILITY = "custom-harness";
33
+ var CAPABILITY_FLAGS = [
34
+ "steer",
35
+ "blob-upload",
36
+ "interactive-approval",
37
+ "approval_resolved",
38
+ "approval-targeting",
39
+ "dispatch-selection",
40
+ PROVIDER_PROFILE_BINDING_CAPABILITY,
41
+ "toolset-selection",
42
+ "agent-home-contract",
43
+ AGENT_HOME_READERS_CAPABILITY,
44
+ STRICT_AGENT_ONLY_CAPABILITY,
45
+ AGENT_EGRESS_POLICY_CAPABILITY,
46
+ AGENT_EGRESS_RELIABLE_ACK_CAPABILITY,
47
+ AGENT_MESSAGE_EGRESS_CAPABILITY,
48
+ AGENT_EGRESS_FRESH_SESSION_CAPABILITY,
49
+ AGENT_CONTENT_WORKSPACE_READ_CAPABILITY,
50
+ AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY,
51
+ AGENT_CONTENT_ARTIFACT_READ_CAPABILITY,
52
+ AGENT_HOME_PROJECTION_CAPABILITY,
53
+ AGENT_INPUT_PREPARATION_CAPABILITY,
54
+ TERMINAL_PROJECTION_SELECTION_CAPABILITY,
55
+ HOST_MCP_TASK_CONTEXT_CAPABILITY,
56
+ CUSTOM_HARNESS_CAPABILITY,
57
+ MAILBOX_READ_AHEAD_CAPABILITY,
58
+ PROVIDER_PROVISIONING_CAPABILITY,
59
+ AGENT_MEMORY_INTENT_CAPABILITY
60
+ ];
61
+
62
+ // src/task-state.ts
63
+ var TASK_STATES = [
64
+ "Offered",
65
+ "Claimed",
66
+ "Running",
67
+ "AwaitApproval",
68
+ "Complete",
69
+ "Failed",
70
+ "Cancelled"
71
+ ];
72
+ var TASK_TRANSITIONS = {
73
+ Offered: ["Claimed", "Cancelled", "Failed"],
74
+ Claimed: ["Running", "Failed", "Cancelled"],
75
+ Running: ["AwaitApproval", "Complete", "Failed", "Cancelled"],
76
+ AwaitApproval: ["Running", "Failed", "Cancelled"],
77
+ Complete: [],
78
+ Failed: [],
79
+ Cancelled: []
80
+ };
81
+ function canTransition(from, to) {
82
+ return TASK_TRANSITIONS[from].includes(to);
83
+ }
84
+
85
+ // src/wire-additions.ts
86
+ var AGENT_OFFER_FIELDS = (surface) => [
87
+ { kind: "envelope", rule: "gated", surface, field: "dispatchSelection", capability: "dispatch-selection", advertisedBy: "device" },
88
+ { kind: "envelope", rule: "gated", surface, field: "requiredToolsets", capability: "toolset-selection", advertisedBy: "device" },
89
+ { kind: "envelope", rule: "gated", surface, field: "terminalProjection", capability: "terminal-projection-selection", advertisedBy: "device" },
90
+ { kind: "envelope", rule: "gated", surface, field: "homeAccess", capability: "agent-home-readers", advertisedBy: "device" }
91
+ ];
92
+ var EGRESS_OFFER_FIELDS = (surface) => [
93
+ { kind: "envelope", rule: "gated", surface, field: "messageEgress", capability: "agent-message-egress", advertisedBy: "device" },
94
+ ...AGENT_OFFER_FIELDS(surface)
95
+ ];
96
+ var WIRE_ADDITIONS = Object.freeze([
97
+ // Server to daemon: offers.
98
+ { kind: "envelope", rule: "gated", surface: "task.offer", field: "harnessId", capability: "custom-harness", advertisedBy: "device" },
99
+ { kind: "envelope", rule: "gated", surface: "task.offer_with_toolsets", field: "harnessId", capability: "custom-harness", advertisedBy: "device" },
100
+ { kind: "envelope", rule: "gated", surface: "task.offer_for_agent", capability: "agent-home-contract", advertisedBy: "device" },
101
+ ...AGENT_OFFER_FIELDS("task.offer_for_agent"),
102
+ { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress", capability: "agent-home-contract", advertisedBy: "device" },
103
+ { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress", capability: "agent-egress-policy", advertisedBy: "device" },
104
+ { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress", capability: "agent-egress-reliable-ack", advertisedBy: "device" },
105
+ ...EGRESS_OFFER_FIELDS("task.offer_for_agent_with_egress"),
106
+ { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress_fresh", capability: "agent-home-contract", advertisedBy: "device" },
107
+ { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress_fresh", capability: "agent-egress-policy", advertisedBy: "device" },
108
+ { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress_fresh", capability: "agent-egress-reliable-ack", advertisedBy: "device" },
109
+ { kind: "envelope", rule: "gated", surface: "task.offer_for_agent_with_egress_fresh", capability: "agent-egress-fresh-session", advertisedBy: "device" },
110
+ ...EGRESS_OFFER_FIELDS("task.offer_for_agent_with_egress_fresh"),
111
+ { kind: "envelope", rule: "gated", surface: "task.offer_prepared", capability: "agent-home-contract", advertisedBy: "device" },
112
+ { kind: "envelope", rule: "gated", surface: "task.offer_prepared", capability: "agent-input-preparation-v9", advertisedBy: "device" },
113
+ { kind: "envelope", rule: "gated", surface: "task.offer_prepared", capability: "agent-egress-policy", advertisedBy: "device" },
114
+ { kind: "envelope", rule: "gated", surface: "task.offer_prepared", capability: "agent-egress-reliable-ack", advertisedBy: "device" },
115
+ { kind: "envelope", rule: "gated", surface: "task.offer_prepared", capability: "agent-egress-fresh-session", advertisedBy: "device" },
116
+ ...EGRESS_OFFER_FIELDS("task.offer_prepared"),
117
+ // Server to daemon: Agent control messages.
118
+ { kind: "envelope", rule: "gated", surface: "agent.content.read", capability: "agent-home-contract", advertisedBy: "device" },
119
+ { kind: "envelope", rule: "gated", surface: "agent.content.read", capability: "agent-egress-policy", advertisedBy: "device" },
120
+ { kind: "envelope", rule: "gated", surface: "agent.content.read", capability: "agent-egress-reliable-ack", advertisedBy: "device" },
121
+ { kind: "envelope", rule: "gated", surface: "agent.content.read", field: "surface", value: "workspace", capability: "agent-content-workspace-read", advertisedBy: "device" },
122
+ { kind: "envelope", rule: "gated", surface: "agent.content.read", field: "surface", value: "transcript", capability: "agent-content-transcript-read", advertisedBy: "device" },
123
+ { kind: "envelope", rule: "gated", surface: "agent.content.read", field: "surface", value: "artifact", capability: "agent-content-artifact-read", advertisedBy: "device" },
124
+ { kind: "envelope", rule: "gated", surface: "agent.home.projection", capability: "agent-home-contract", advertisedBy: "device" },
125
+ { kind: "envelope", rule: "gated", surface: "agent.home.projection", capability: "agent-home-projection", advertisedBy: "device" },
126
+ { kind: "envelope", rule: "gated", surface: "agent.input.preparation", capability: "agent-home-contract", advertisedBy: "device" },
127
+ { kind: "envelope", rule: "gated", surface: "agent.input.preparation", capability: "agent-input-preparation-v9", advertisedBy: "device" },
128
+ { kind: "envelope", rule: "gated", surface: "provider.provisioning.available", capability: "provider-provisioning.v1", advertisedBy: "device" },
129
+ { kind: "envelope", rule: "gated", surface: "agent.memory.intent.available", capability: "agent-memory-intent.v1", advertisedBy: "device" },
130
+ // Daemon to server.
131
+ { kind: "envelope", rule: "gated", surface: "task.approval_resolved", capability: "approval_resolved", advertisedBy: "server" }
132
+ ]);
133
+ function requiredReceiverCapabilities(type, payload) {
134
+ const fields = payload !== null && typeof payload === "object" ? payload : {};
135
+ const required = [];
136
+ for (const entry of WIRE_ADDITIONS) {
137
+ if (entry.kind !== "envelope" || entry.rule !== "gated" || entry.surface !== type) continue;
138
+ if (entry.field !== void 0) {
139
+ const value = fields[entry.field];
140
+ if (value === void 0) continue;
141
+ if (entry.value !== void 0 && value !== entry.value) continue;
142
+ }
143
+ if (!required.includes(entry.capability)) required.push(entry.capability);
144
+ }
145
+ return required;
146
+ }
147
+ var CONTENT_HASH_RE = /^sha256:[0-9a-f]{64}$/;
148
+ var BlobRefSchema = z.object({
149
+ blobId: z.string(),
150
+ contentHash: z.string().regex(CONTENT_HASH_RE, 'contentHash must be "sha256:<64 lowercase hex>"'),
151
+ size: z.number().int().nonnegative(),
152
+ contentType: z.string(),
153
+ url: z.string().optional()
154
+ });
155
+ var ProviderProfileRefSchema = z.string().min(1).max(64).regex(/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/u, "provider profile refs must be lowercase portable identifiers");
156
+ var ProviderProfileRevisionSchema = z.string().regex(/^(?:0|[1-9][0-9]{0,19})$/u, "provider profile revision must be canonical decimal");
157
+ var ProviderProfileHashSchema = z.string().regex(/^sha256:[0-9a-f]{64}$/u, "provider profile hash must be lowercase sha256");
158
+ var PROVIDER_MODEL_CAPABILITIES = ["image-input"];
159
+ var ProviderModelCapabilitySchema = z.enum(PROVIDER_MODEL_CAPABILITIES);
160
+ var ProviderProfileBindingSchema = z.object({
161
+ profileRef: ProviderProfileRefSchema,
162
+ profileRevision: ProviderProfileRevisionSchema,
163
+ profileHash: ProviderProfileHashSchema,
164
+ modelId: z.string().min(1).max(160).regex(/^[^\u0000\r\n]+$/u),
165
+ requiredCapabilities: z.array(ProviderModelCapabilitySchema).max(8)
166
+ }).strict().superRefine((binding, ctx) => {
167
+ if (new Set(binding.requiredCapabilities).size !== binding.requiredCapabilities.length) {
168
+ ctx.addIssue({ code: "custom", path: ["requiredCapabilities"], message: "duplicate provider capability" });
169
+ }
170
+ });
171
+ var PROVIDER_SECRET_SEALING_KEY_REGISTER_OPERATION = "provider-secret-sealing-key.register";
172
+ var ProviderProvisioningAvailablePayloadSchema = z.object({
173
+ requestId: z.uuid()
174
+ }).strict();
175
+ var PROVIDER_PROVISIONING_OPERATIONS = ["configure", "update_model", "replace_secret", "delete"];
176
+ var ProviderProvisioningOperationSchema = z.enum(PROVIDER_PROVISIONING_OPERATIONS);
177
+ var PROVIDER_PROVISIONING_OPERATION_GENERATION_MAXIMUM = "9223372036854775807";
178
+ var ProviderProvisioningOperationGenerationSchema = z.string().regex(/^[1-9][0-9]{0,18}$/u, "operationGeneration must be a canonical positive decimal string").refine(
179
+ (value) => value.length < PROVIDER_PROVISIONING_OPERATION_GENERATION_MAXIMUM.length || value <= PROVIDER_PROVISIONING_OPERATION_GENERATION_MAXIMUM,
180
+ `operationGeneration must not exceed ${PROVIDER_PROVISIONING_OPERATION_GENERATION_MAXIMUM}`
181
+ );
182
+ var ProviderProvisioningOperationDigestSchema = z.string().regex(/^sha256:[0-9a-f]{64}$/u, "operationDigest must be lowercase sha256");
183
+ var PROVIDER_PROVISIONING_REJECTION_CODES = [
184
+ "request_invalid",
185
+ "request_conflict",
186
+ "request_expired",
187
+ "request_not_yet_valid",
188
+ "request_window_invalid",
189
+ "sealing_key_rotated",
190
+ "enrollment_mismatch",
191
+ "agent_not_placed",
192
+ "config_digest_mismatch",
193
+ "operation_generation_stale",
194
+ "profile_changed",
195
+ "profile_not_found",
196
+ "credential_scope_mismatch",
197
+ "provider_kind_unsupported",
198
+ "pi_model_invalid",
199
+ "capabilities_invalid",
200
+ "seal_open_failed",
201
+ "secret_invalid",
202
+ "local_commit_interrupted",
203
+ "secret_store_unavailable"
204
+ ];
205
+ var ProviderProvisioningRejectionCodeSchema = z.enum(PROVIDER_PROVISIONING_REJECTION_CODES);
206
+ var PROVIDER_PROVISIONING_HOST_TERMINAL_CODES = ["request_expired", "sealing_key_rotated"];
207
+ var ProviderProvisioningProviderStatusSchema = z.object({
208
+ profileRef: ProviderProfileRefSchema,
209
+ providerKind: z.string().min(1).max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/u, "providerKind must be a lowercase portable identifier"),
210
+ modelId: z.string().min(1).max(160).regex(/^[^\u0000\r\n]+$/u),
211
+ capabilities: z.array(ProviderModelCapabilitySchema).max(8),
212
+ secretConfigured: z.boolean()
213
+ }).strict().superRefine((status, ctx) => {
214
+ if (new Set(status.capabilities).size !== status.capabilities.length) {
215
+ ctx.addIssue({ code: "custom", path: ["capabilities"], message: "duplicate provider capability" });
216
+ }
217
+ });
218
+ var PROVIDER_PROVISIONING_KEY_CHECK_RESULTS = [
219
+ "ok",
220
+ "credential_rejected",
221
+ "rate_limited",
222
+ "quota_or_billing",
223
+ "model_not_permitted",
224
+ "provider_error",
225
+ "unreachable",
226
+ "timeout",
227
+ "not_run"
228
+ ];
229
+ var ProviderProvisioningKeyCheckResultSchema = z.enum(PROVIDER_PROVISIONING_KEY_CHECK_RESULTS);
230
+ var ProviderProvisioningKeyCheckSchema = z.object({
231
+ result: ProviderProvisioningKeyCheckResultSchema
232
+ }).strict();
233
+ var completionIdentity = {
234
+ requestId: z.uuid(),
235
+ operation: ProviderProvisioningOperationSchema,
236
+ operationGeneration: ProviderProvisioningOperationGenerationSchema,
237
+ operationDigest: ProviderProvisioningOperationDigestSchema
238
+ };
239
+ var AppliedCompletionSchema = z.object({
240
+ outcome: z.literal("applied"),
241
+ ...completionIdentity,
242
+ providerStatus: ProviderProvisioningProviderStatusSchema.nullable(),
243
+ binding: ProviderProfileBindingSchema.nullable(),
244
+ keyCheck: ProviderProvisioningKeyCheckSchema
245
+ }).strict();
246
+ var RejectedCompletionSchema = z.object({
247
+ outcome: z.literal("rejected"),
248
+ ...completionIdentity,
249
+ code: ProviderProvisioningRejectionCodeSchema
250
+ }).strict();
251
+ var ProviderProvisioningCompletionSchema = z.discriminatedUnion("outcome", [AppliedCompletionSchema, RejectedCompletionSchema]).superRefine((completion, ctx) => {
252
+ if (completion.outcome !== "applied") return;
253
+ const { operation, providerStatus, binding } = completion;
254
+ if (operation === "delete") {
255
+ if (completion.keyCheck.result !== "not_run") {
256
+ ctx.addIssue({ code: "custom", path: ["keyCheck", "result"], message: "an applied delete must report keyCheck not_run" });
257
+ }
258
+ if (providerStatus !== null) {
259
+ ctx.addIssue({ code: "custom", path: ["providerStatus"], message: "an applied delete reports no provider status" });
260
+ }
261
+ if (binding !== null) {
262
+ ctx.addIssue({ code: "custom", path: ["binding"], message: "an applied delete reports no binding" });
263
+ }
264
+ return;
265
+ }
266
+ if (providerStatus === null) {
267
+ ctx.addIssue({ code: "custom", path: ["providerStatus"], message: `an applied ${operation} must report provider status` });
268
+ }
269
+ if (binding === null) {
270
+ ctx.addIssue({ code: "custom", path: ["binding"], message: `an applied ${operation} must report its exact binding` });
271
+ }
272
+ if (providerStatus === null || binding === null) return;
273
+ if (providerStatus.profileRef !== binding.profileRef) {
274
+ ctx.addIssue({ code: "custom", path: ["binding", "profileRef"], message: "binding profileRef must equal providerStatus profileRef" });
275
+ }
276
+ if (providerStatus.modelId !== binding.modelId) {
277
+ ctx.addIssue({ code: "custom", path: ["binding", "modelId"], message: "binding modelId must equal providerStatus modelId" });
278
+ }
279
+ if ((operation === "configure" || operation === "replace_secret") && !providerStatus.secretConfigured) {
280
+ ctx.addIssue({
281
+ code: "custom",
282
+ path: ["providerStatus", "secretConfigured"],
283
+ message: `an applied ${operation} must report a configured secret`
284
+ });
285
+ }
286
+ });
287
+ var PROVIDER_PROVISIONING_DISPOSITIONS = ["recorded", "idempotent", "conflict", "host_terminal"];
288
+ var ProviderProvisioningDispositionSchema = z.enum(PROVIDER_PROVISIONING_DISPOSITIONS);
289
+ var ProviderProvisioningReadbackSchema = z.object({
290
+ tenantId: z.string().min(1),
291
+ deviceId: z.string().min(1),
292
+ requestId: z.uuid(),
293
+ disposition: ProviderProvisioningDispositionSchema,
294
+ completion: ProviderProvisioningCompletionSchema,
295
+ completedAt: z.iso.datetime({ offset: true })
296
+ }).strict().superRefine((readback, ctx) => {
297
+ if (readback.completion.requestId !== readback.requestId) {
298
+ ctx.addIssue({ code: "custom", path: ["completion", "requestId"], message: "completion requestId must equal readback requestId" });
299
+ }
300
+ if (readback.disposition === "host_terminal" && (readback.completion.outcome !== "rejected" || !PROVIDER_PROVISIONING_HOST_TERMINAL_CODES.includes(readback.completion.code))) {
301
+ ctx.addIssue({
302
+ code: "custom",
303
+ path: ["completion"],
304
+ message: `a host_terminal readback must carry a rejected completion with one of: ${PROVIDER_PROVISIONING_HOST_TERMINAL_CODES.join(", ")}`
305
+ });
306
+ }
307
+ });
308
+
309
+ // src/plain-json.ts
310
+ function isSameJsonData(a, b) {
311
+ if (a === null || b === null) return a === b;
312
+ const typeOfA = typeof a;
313
+ if (typeOfA !== typeof b) return false;
314
+ if (typeOfA !== "object") {
315
+ return a === b;
316
+ }
317
+ const aIsArray = Array.isArray(a);
318
+ if (aIsArray !== Array.isArray(b)) return false;
319
+ if (aIsArray) {
320
+ const arrayA = a;
321
+ const arrayB = b;
322
+ if (arrayA.length !== arrayB.length) return false;
323
+ for (let index = 0; index < arrayA.length; index += 1) {
324
+ if (!isSameJsonData(arrayA[index], arrayB[index])) return false;
325
+ }
326
+ return true;
327
+ }
328
+ const objectA = a;
329
+ const objectB = b;
330
+ const keysA = Object.keys(objectA);
331
+ const keysB = Object.keys(objectB);
332
+ if (keysA.length === 0) {
333
+ const prototypeA = Object.getPrototypeOf(objectA);
334
+ if (prototypeA !== Object.prototype && prototypeA !== null) return false;
335
+ }
336
+ if (keysA.length !== keysB.length) return false;
337
+ for (const key of keysA) {
338
+ if (!Object.prototype.hasOwnProperty.call(objectB, key)) return false;
339
+ if (!isSameJsonData(objectA[key], objectB[key])) return false;
340
+ }
341
+ return true;
342
+ }
343
+ function jsonDepthExceeds(value, limit) {
344
+ const stack = [{ node: value, depth: 0 }];
345
+ while (stack.length > 0) {
346
+ const { node, depth } = stack.pop();
347
+ if (node === null || typeof node !== "object") continue;
348
+ const next = depth + 1;
349
+ if (next > limit) return true;
350
+ const children = Array.isArray(node) ? node : Object.values(node);
351
+ for (const child of children) stack.push({ node: child, depth: next });
352
+ }
353
+ return false;
354
+ }
355
+ function canonicalizePlainJson(value, maxBytes, maxDepth) {
356
+ let json;
357
+ try {
358
+ json = JSON.stringify(value);
359
+ } catch {
360
+ return { ok: false, reason: "not-serializable" };
361
+ }
362
+ if (json === void 0) return { ok: false, reason: "not-serializable" };
363
+ const bytes = new TextEncoder().encode(json).length;
364
+ if (bytes > maxBytes) return { ok: false, reason: "over-cap", bytes };
365
+ const canonical = JSON.parse(json);
366
+ if (maxDepth !== void 0 && jsonDepthExceeds(canonical, maxDepth)) return { ok: false, reason: "too-deep", bytes };
367
+ if (!isSameJsonData(value, canonical)) return { ok: false, reason: "not-plain-json" };
368
+ return { ok: true, bytes, canonical };
369
+ }
370
+
371
+ // src/result-schema.ts
372
+ var RESULT_SCHEMA_MAX_BYTES = 16384;
373
+ var RESULT_OUTCOME_MAX_BYTES = 65536;
374
+ var RESULT_SCHEMA_MAX_DEPTH = 32;
375
+ var RESULT_JSON_MAX_DEPTH = 128;
376
+ var RESULT_ISSUES_MAX_COUNT = 20;
377
+ var RESULT_ISSUES_MAX_BYTES = 4096;
378
+ var ISSUE_STRING_MAX_LENGTH = 128;
379
+ var RESULT_SCHEMA_KEYWORDS = Object.freeze([
380
+ "type",
381
+ "properties",
382
+ "required",
383
+ "additionalProperties",
384
+ "items",
385
+ "enum",
386
+ "const",
387
+ "oneOf",
388
+ "minLength",
389
+ "maxLength",
390
+ "minItems",
391
+ "maxItems",
392
+ "minimum",
393
+ "maximum",
394
+ "description"
395
+ ]);
396
+ var RESULT_SCHEMA_INSTANCE_TYPES = Object.freeze([
397
+ "object",
398
+ "array",
399
+ "string",
400
+ "number",
401
+ "integer",
402
+ "boolean",
403
+ "null"
404
+ ]);
405
+ var KEYWORDS = new Set(RESULT_SCHEMA_KEYWORDS);
406
+ var INSTANCE_TYPES = new Set(RESULT_SCHEMA_INSTANCE_TYPES);
407
+ var encoder = new TextEncoder();
408
+ function cut(value) {
409
+ return value.length <= ISSUE_STRING_MAX_LENGTH ? value : `${value.slice(0, ISSUE_STRING_MAX_LENGTH - 1)}\u2026`;
410
+ }
411
+ var IssueSink = class {
412
+ issues = [];
413
+ truncated = false;
414
+ bytes = 2;
415
+ // "[]"
416
+ add(pointer, keyword, message) {
417
+ const issue = { pointer: cut(pointer), keyword: cut(keyword), message: cut(message) };
418
+ const size = encoder.encode(JSON.stringify(issue)).length + (this.issues.length === 0 ? 0 : 1);
419
+ if (this.issues.length >= RESULT_ISSUES_MAX_COUNT || this.bytes + size > RESULT_ISSUES_MAX_BYTES) {
420
+ this.truncated = true;
421
+ return;
422
+ }
423
+ this.issues.push(issue);
424
+ this.bytes += size;
425
+ }
426
+ get empty() {
427
+ return this.issues.length === 0 && !this.truncated;
428
+ }
429
+ };
430
+ function pointerTo(base, token) {
431
+ return `${base}/${String(token).replace(/~/g, "~0").replace(/\//g, "~1")}`;
432
+ }
433
+ function isObject(value) {
434
+ return value !== null && typeof value === "object" && !Array.isArray(value);
435
+ }
436
+ function isNonNegativeInteger(value) {
437
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
438
+ }
439
+ var LONE_SURROGATE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u;
440
+ function hasLoneSurrogate(value) {
441
+ const stack = [value];
442
+ while (stack.length > 0) {
443
+ const node = stack.pop();
444
+ if (typeof node === "string") {
445
+ if (LONE_SURROGATE.test(node)) return true;
446
+ } else if (Array.isArray(node)) {
447
+ for (const member of node) stack.push(member);
448
+ } else if (node !== null && typeof node === "object") {
449
+ for (const [key, member] of Object.entries(node)) {
450
+ if (LONE_SURROGATE.test(key)) return true;
451
+ stack.push(member);
452
+ }
453
+ }
454
+ }
455
+ return false;
456
+ }
457
+ function canonicalDocument(value, maxBytes) {
458
+ const check = canonicalizePlainJson(value, maxBytes, RESULT_JSON_MAX_DEPTH);
459
+ if (check.ok && hasLoneSurrogate(check.canonical)) return { ok: false, reason: "not-plain-json" };
460
+ return check;
461
+ }
462
+ function documentFailure(check, what, maxBytes) {
463
+ const sink = new IssueSink();
464
+ switch (check.reason) {
465
+ case "not-serializable":
466
+ sink.add("", check.reason, `${what} is not JSON-serializable`);
467
+ return { ok: false, reason: check.reason, issues: sink.issues, truncated: false };
468
+ case "not-plain-json":
469
+ sink.add("", check.reason, `${what} is not plain JSON data in well-formed Unicode`);
470
+ return { ok: false, reason: check.reason, issues: sink.issues, truncated: false };
471
+ case "over-cap":
472
+ sink.add("", check.reason, `${what} is ${check.bytes} bytes as canonical JSON (UTF-8); the cap is ${maxBytes}`);
473
+ return { ok: false, reason: check.reason, bytes: check.bytes, issues: sink.issues, truncated: false };
474
+ case "too-deep":
475
+ sink.add("", check.reason, `${what} nests JSON containers deeper than ${RESULT_JSON_MAX_DEPTH}`);
476
+ return { ok: false, reason: check.reason, bytes: check.bytes, issues: sink.issues, truncated: false };
477
+ }
478
+ }
479
+ function checkSubschema(node, pointer, depth, sink) {
480
+ if (!isObject(node)) {
481
+ sink.add(pointer, "schema", "a subschema must be a JSON object");
482
+ return;
483
+ }
484
+ if (depth > RESULT_SCHEMA_MAX_DEPTH) {
485
+ sink.add(pointer, "depth", `subschemas nest deeper than ${RESULT_SCHEMA_MAX_DEPTH} levels`);
486
+ return;
487
+ }
488
+ for (const key of Object.keys(node)) {
489
+ if (!KEYWORDS.has(key)) sink.add(pointerTo(pointer, key), key, "keyword is outside the result schema subset");
490
+ }
491
+ if (depth === 0 && node.type !== "object") {
492
+ sink.add(pointerTo(pointer, "type"), "type", "the root schema must declare type: 'object'");
493
+ }
494
+ if (Object.hasOwn(node, "type")) {
495
+ const type = node.type;
496
+ const valid = typeof type === "string" ? INSTANCE_TYPES.has(type) : Array.isArray(type) && type.length > 0 && type.every((member) => typeof member === "string" && INSTANCE_TYPES.has(member)) && new Set(type).size === type.length;
497
+ if (!valid) sink.add(pointerTo(pointer, "type"), "type", "must be a JSON type name or a non-empty array of unique type names");
498
+ }
499
+ if (Object.hasOwn(node, "properties")) {
500
+ const properties = node.properties;
501
+ const at = pointerTo(pointer, "properties");
502
+ if (!isObject(properties)) sink.add(at, "properties", "must be an object of subschemas");
503
+ else for (const [name, subschema] of Object.entries(properties)) checkSubschema(subschema, pointerTo(at, name), depth + 1, sink);
504
+ }
505
+ if (Object.hasOwn(node, "required")) {
506
+ const required = node.required;
507
+ if (!Array.isArray(required) || !required.every((name) => typeof name === "string") || new Set(required).size !== required.length) {
508
+ sink.add(pointerTo(pointer, "required"), "required", "must be an array of unique property names");
509
+ }
510
+ }
511
+ if (Object.hasOwn(node, "additionalProperties") && node.additionalProperties !== false) {
512
+ sink.add(pointerTo(pointer, "additionalProperties"), "additionalProperties", "only additionalProperties: false is allowed");
513
+ }
514
+ if (Object.hasOwn(node, "items")) {
515
+ if (!isObject(node.items)) sink.add(pointerTo(pointer, "items"), "items", "must be one subschema object");
516
+ else checkSubschema(node.items, pointerTo(pointer, "items"), depth + 1, sink);
517
+ }
518
+ if (Object.hasOwn(node, "enum") && (!Array.isArray(node.enum) || node.enum.length === 0)) {
519
+ sink.add(pointerTo(pointer, "enum"), "enum", "must be a non-empty array");
520
+ }
521
+ if (Object.hasOwn(node, "oneOf")) {
522
+ const oneOf = node.oneOf;
523
+ const at = pointerTo(pointer, "oneOf");
524
+ if (!Array.isArray(oneOf) || oneOf.length === 0) sink.add(at, "oneOf", "must be a non-empty array of subschemas");
525
+ else oneOf.forEach((subschema, index) => checkSubschema(subschema, pointerTo(at, index), depth + 1, sink));
526
+ }
527
+ for (const keyword of ["minLength", "maxLength", "minItems", "maxItems"]) {
528
+ if (Object.hasOwn(node, keyword) && !isNonNegativeInteger(node[keyword])) {
529
+ sink.add(pointerTo(pointer, keyword), keyword, "must be a non-negative integer");
530
+ }
531
+ }
532
+ for (const keyword of ["minimum", "maximum"]) {
533
+ if (Object.hasOwn(node, keyword) && typeof node[keyword] !== "number") {
534
+ sink.add(pointerTo(pointer, keyword), keyword, "must be a number");
535
+ }
536
+ }
537
+ if (Object.hasOwn(node, "description") && typeof node.description !== "string") {
538
+ sink.add(pointerTo(pointer, "description"), "description", "must be a string");
539
+ }
540
+ }
541
+ function checkResultSchema(schema) {
542
+ const document = canonicalDocument(schema, RESULT_SCHEMA_MAX_BYTES);
543
+ if (!document.ok) return documentFailure(document, "the result schema", RESULT_SCHEMA_MAX_BYTES);
544
+ const sink = new IssueSink();
545
+ checkSubschema(document.canonical, "", 0, sink);
546
+ if (!sink.empty) return { ok: false, reason: "not-subset", bytes: document.bytes, issues: sink.issues, truncated: sink.truncated };
547
+ return { ok: true, bytes: document.bytes, canonical: document.canonical };
548
+ }
549
+ function withoutPrototypes(value) {
550
+ if (value === null || typeof value !== "object") return value;
551
+ if (Array.isArray(value)) return value.map(withoutPrototypes);
552
+ const copy = /* @__PURE__ */ Object.create(null);
553
+ for (const [key, member] of Object.entries(value)) {
554
+ Object.defineProperty(copy, key, { value: withoutPrototypes(member), enumerable: true, writable: true, configurable: true });
555
+ }
556
+ return copy;
557
+ }
558
+ function fragmentToPointer(location) {
559
+ return decodeURI(location.startsWith("#") ? location.slice(1) : location);
560
+ }
561
+ function validateResultOutcome(schema, outcome) {
562
+ const admitted = checkResultSchema(schema);
563
+ if (!admitted.ok) {
564
+ return { ok: false, reason: "schema-not-admitted", bytes: admitted.bytes, issues: admitted.issues, truncated: admitted.truncated };
565
+ }
566
+ const document = canonicalDocument(outcome, RESULT_OUTCOME_MAX_BYTES);
567
+ if (!document.ok) return documentFailure(document, "the outcome", RESULT_OUTCOME_MAX_BYTES);
568
+ const validator = new Validator(withoutPrototypes(admitted.canonical), "2020-12", true);
569
+ const result = validator.validate(withoutPrototypes(document.canonical));
570
+ if (result.valid) return { ok: true, bytes: document.bytes, canonical: document.canonical };
571
+ const sink = new IssueSink();
572
+ for (const unit of result.errors) sink.add(fragmentToPointer(unit.instanceLocation), unit.keyword, unit.error);
573
+ return { ok: false, reason: "schema-mismatch", bytes: document.bytes, issues: sink.issues, truncated: sink.truncated };
574
+ }
575
+
576
+ // src/terminal-projection.ts
577
+ var TerminalProjectionContractSchema = z.string().min(1).max(128).regex(/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/u, "terminal projection contracts must be opaque lowercase ids");
578
+ var ResultDocumentSchemaSchema = z.custom().superRefine((value, ctx) => {
579
+ const check = checkResultSchema(value);
580
+ if (check.ok) return;
581
+ for (const issue of check.issues) {
582
+ ctx.addIssue({
583
+ code: "custom",
584
+ message: `result schema ${check.reason} at '${issue.pointer}' (${issue.keyword}): ${issue.message}`,
585
+ params: { reason: check.reason, pointer: issue.pointer, keyword: issue.keyword }
586
+ });
587
+ }
588
+ if (check.truncated) {
589
+ ctx.addIssue({ code: "custom", message: "result schema issues truncated", params: { reason: check.reason, truncated: true } });
590
+ }
591
+ });
592
+ var TerminalProjectionSelectionSchema = z.discriminatedUnion("mode", [
593
+ z.object({ mode: z.literal("none") }).strict(),
594
+ z.object({
595
+ mode: z.literal("result-document"),
596
+ contract: TerminalProjectionContractSchema,
597
+ schema: ResultDocumentSchemaSchema
598
+ }).strict()
599
+ ]);
11
600
  var POLICY_REVISION = z.string().min(1).max(160).regex(/^[^\u0000-\u001f\u007f\r\n]+$/u, "policyRevision must not contain control characters");
12
601
  var POSITIVE_LIMIT = z.number().int().positive().max(2147483647);
13
602
  var AGENT_MESSAGE_MAX_BYTES = 256 * 1024;
@@ -92,31 +681,14 @@ var AgentContentReadDenialReasonSchema = z.enum([
92
681
  ]);
93
682
  var AgentEgressContentHashSchema = z.string().regex(/^sha256:[a-f0-9]{64}$/u, "contentHash must be a lowercase SHA-256 digest");
94
683
  var AgentEgressPolicyRevisionSchema = POLICY_REVISION;
95
- var AGENT_HOME_PROJECTION_CAPABILITY = "agent-home-projection";
96
- var AGENT_HOME_PROJECTION_MAX_BYTES = 64 * 1024;
97
- var AGENT_HOME_PROJECTION_PROFILE_REVISION_MAXIMUM = "9223372036854775807";
98
- var AgentHomeProjectionProfileRevisionSchema = z.string().regex(/^[1-9][0-9]{0,18}$/u, "profileRevision must be a canonical positive decimal string").refine(
99
- (value) => value.length < AGENT_HOME_PROJECTION_PROFILE_REVISION_MAXIMUM.length || value <= AGENT_HOME_PROJECTION_PROFILE_REVISION_MAXIMUM,
100
- `profileRevision must not exceed PostgreSQL BIGINT maximum ${AGENT_HOME_PROJECTION_PROFILE_REVISION_MAXIMUM}`
101
- );
102
- var AgentHomeProjectionHashSchema = AgentEgressContentHashSchema;
103
- var AgentHomeProjectionOutcomeSchema = z.enum(["applied", "idempotent", "stale", "conflict"]);
104
- var AgentHomeProjectionValueSchema = z.json().refine(
105
- (value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= AGENT_HOME_PROJECTION_MAX_BYTES,
106
- `projection must not exceed ${AGENT_HOME_PROJECTION_MAX_BYTES} UTF-8 JSON bytes`
107
- );
108
-
109
- // src/input-preparation-version.ts
110
- var INPUT_PREPARATION_WIRE_VERSION = 9;
111
684
 
112
685
  // src/input-preparation.ts
113
- var AGENT_INPUT_PREPARATION_CAPABILITY = `agent-input-preparation-v${INPUT_PREPARATION_WIRE_VERSION}`;
114
686
  var InputPreparationContentHashSchema = AgentEgressContentHashSchema;
115
687
  var OPAQUE_ID = z.string().min(1).max(512).regex(/^[^\u0000-\u001f\u007f]+$/u, "control identifiers must not contain control characters");
116
688
  var OPAQUE_TEXT = z.string().min(1).max(2048).regex(/^[^\u0000-\u001f\u007f]+$/u, "control text must not contain control characters");
117
689
  var InputPreparationPolicyRevisionSchema = OPAQUE_ID;
118
690
  var InputPreparationProfileIdSchema = OPAQUE_ID;
119
- var PreparedAgentMemoryModeSchema = z.enum(["none", "read", "read-write"]);
691
+ var PreparedAgentMemoryModeSchema = z.enum(PREPARED_AGENT_MEMORY_MODES);
120
692
  var InputPreparationSourceSchema = z.object({ revision: OPAQUE_ID, digest: OPAQUE_ID }).strict();
121
693
  var InputPreparationModelCostSchema = z.object({
122
694
  input: z.number().finite(),
@@ -317,6 +889,7 @@ var InputPreparationArtifactSummarySchema = z.object({
317
889
  toolNames: z.array(OPAQUE_ID)
318
890
  }).strict();
319
891
  var InputPreparationBindingSchema = z.object({
892
+ terminalProjection: TerminalProjectionSelectionSchema.optional(),
320
893
  agentMemory: PreparedAgentMemoryModeSchema,
321
894
  scopeId: OPAQUE_ID,
322
895
  deviceId: OPAQUE_ID,
@@ -325,261 +898,86 @@ var InputPreparationBindingSchema = z.object({
325
898
  profileRevision: OPAQUE_ID,
326
899
  source: InputPreparationSourceSchema,
327
900
  target: InputPreparationCounterTargetSchema,
328
- policyRevision: OPAQUE_ID,
329
- runtime: InputPreparationRuntimeIdentitySchema,
330
- requestDigest: OPAQUE_ID,
331
- /**
332
- * The Host's accounting ruling this preparation was requested under,
333
- * copied verbatim. Absent when the request named none — never filled in,
334
- * and never narrowed to one the device would have chosen.
335
- */
336
- accountingPolicyRef: InputPreparationAccountingPolicyRefSchema.optional()
337
- }).strict();
338
- var InputPreparationReceiptSummarySchema = z.object({
339
- reference: OPAQUE_ID,
340
- state: InputPreparationStateSchema,
341
- binding: InputPreparationBindingSchema,
342
- artifact: InputPreparationArtifactSummarySchema.optional(),
343
- counter: InputPreparationCounterEvidenceSchema.optional(),
344
- ready: z.boolean(),
345
- readinessReasons: z.array(InputPreparationReadinessReasonSchema).max(16),
346
- detail: OPAQUE_ID.optional(),
347
- artifactExpiresAt: z.iso.datetime({ offset: true })
348
- }).strict().superRefine((value, ctx) => {
349
- if (value.ready !== (value.readinessReasons.length === 0)) {
350
- ctx.addIssue({
351
- code: "custom",
352
- path: ["ready"],
353
- message: "ready must be true exactly when readinessReasons is empty"
354
- });
355
- }
356
- });
357
- var InputPreparationReferenceSchema = OPAQUE_ID;
358
- var InputPreparationOfferBindingSchema = z.object({
359
- reference: InputPreparationReferenceSchema,
360
- /** `InputPreparationBindingSchema.requestDigest`, as the receipt reported it. */
361
- requestDigest: OPAQUE_ID,
362
- /** `InputPreparationArtifactSummarySchema.envelopeDigest`, when the receipt carried one. */
363
- artifactDigest: OPAQUE_ID.optional()
364
- }).strict();
365
- var InputPreparationRejectionReasonSchema = z.enum([
366
- "input_preparation_unconfigured",
367
- "bad_request",
368
- "authority_unavailable",
369
- "scope_denied",
370
- "policy_revision_mismatch",
371
- "runtime_identity_unavailable",
372
- "unsupported_input",
373
- "limit_exceeded",
374
- "request_conflict",
375
- "not_found",
376
- "counter_unavailable",
377
- "counter_interrupted",
378
- "durable_write_failed",
379
- "cancelled",
380
- "context_unresolvable",
381
- "context_hash_mismatch",
382
- "toolsets_unobservable",
383
- "deadline_elapsed",
384
- /**
385
- * A repeat of an already-recorded `requestId` arrived after the facts its
386
- * executor fingerprints were frozen against changed — a toolset definition
387
- * revision or a configured server argv. The recorded receipt is not re-derived and no
388
- * server is re-probed; the repeat is refused so the caller mints a new
389
- * preparation instead of silently receiving one bound to stale evidence.
390
- */
391
- "observation_drift",
392
- /**
393
- * The device compiled the input, then found that the `prompt_prepared` frame
394
- * the runtime would have to be handed exceeds the single-frame byte cap that
395
- * runtime enforces. The bound belongs to the runtime, not to the operator's
396
- * retention policy, so it is decided first and nothing is retained: a
397
- * preparation that could never be delivered is not a smaller preparation.
398
- */
399
- "rpc_frame_too_large",
400
- /**
401
- * The device's input-preparation lane is off because its durable record log
402
- * holds a record from an older record schema version. The rest of the
403
- * device runs; this lane refuses until an operator archives that log. No
404
- * record is migrated, read forward or deleted.
405
- */
406
- "input_preparation_record_log_unsupported"
407
- ]);
408
- var TERMINAL_PROJECTION_SELECTION_CAPABILITY = "terminal-projection-selection";
409
- var TerminalProjectionContractSchema = z.string().min(1).max(128).regex(/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/u, "terminal projection contracts must be opaque lowercase ids");
410
- var TerminalProjectionSelectionSchema = z.discriminatedUnion("mode", [
411
- z.object({ mode: z.literal("none") }).strict(),
412
- z.object({
413
- mode: z.literal("result-document"),
414
- contract: TerminalProjectionContractSchema
415
- }).strict()
416
- ]);
417
-
418
- // src/task-assertion.ts
419
- var HOST_MCP_TASK_CONTEXT_CAPABILITY = "host-mcp-task-context";
420
- var PROVIDER_PROFILE_BINDING_CAPABILITY = "provider-profile-binding";
421
- var ProviderProfileRefSchema = z.string().min(1).max(64).regex(/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/u, "provider profile refs must be lowercase portable identifiers");
422
- var ProviderProfileRevisionSchema = z.string().regex(/^(?:0|[1-9][0-9]{0,19})$/u, "provider profile revision must be canonical decimal");
423
- var ProviderProfileHashSchema = z.string().regex(/^sha256:[0-9a-f]{64}$/u, "provider profile hash must be lowercase sha256");
424
- var PROVIDER_MODEL_CAPABILITIES = ["image-input"];
425
- var ProviderModelCapabilitySchema = z.enum(PROVIDER_MODEL_CAPABILITIES);
426
- var ProviderProfileBindingSchema = z.object({
427
- profileRef: ProviderProfileRefSchema,
428
- profileRevision: ProviderProfileRevisionSchema,
429
- profileHash: ProviderProfileHashSchema,
430
- modelId: z.string().min(1).max(160).regex(/^[^\u0000\r\n]+$/u),
431
- requiredCapabilities: z.array(ProviderModelCapabilitySchema).max(8)
432
- }).strict().superRefine((binding, ctx) => {
433
- if (new Set(binding.requiredCapabilities).size !== binding.requiredCapabilities.length) {
434
- ctx.addIssue({ code: "custom", path: ["requiredCapabilities"], message: "duplicate provider capability" });
435
- }
436
- });
437
- var PROVIDER_PROVISIONING_CAPABILITY = "provider-provisioning.v1";
438
- var PROVIDER_SECRET_SEALING_KEY_REGISTER_OPERATION = "provider-secret-sealing-key.register";
439
- var ProviderProvisioningAvailablePayloadSchema = z.object({
440
- requestId: z.uuid()
441
- }).strict();
442
- var PROVIDER_PROVISIONING_OPERATIONS = ["configure", "update_model", "replace_secret", "delete"];
443
- var ProviderProvisioningOperationSchema = z.enum(PROVIDER_PROVISIONING_OPERATIONS);
444
- var PROVIDER_PROVISIONING_OPERATION_GENERATION_MAXIMUM = "9223372036854775807";
445
- var ProviderProvisioningOperationGenerationSchema = z.string().regex(/^[1-9][0-9]{0,18}$/u, "operationGeneration must be a canonical positive decimal string").refine(
446
- (value) => value.length < PROVIDER_PROVISIONING_OPERATION_GENERATION_MAXIMUM.length || value <= PROVIDER_PROVISIONING_OPERATION_GENERATION_MAXIMUM,
447
- `operationGeneration must not exceed ${PROVIDER_PROVISIONING_OPERATION_GENERATION_MAXIMUM}`
448
- );
449
- var ProviderProvisioningOperationDigestSchema = z.string().regex(/^sha256:[0-9a-f]{64}$/u, "operationDigest must be lowercase sha256");
450
- var PROVIDER_PROVISIONING_REJECTION_CODES = [
451
- "request_invalid",
452
- "request_conflict",
453
- "request_expired",
454
- "request_not_yet_valid",
455
- "request_window_invalid",
456
- "sealing_key_rotated",
457
- "enrollment_mismatch",
458
- "agent_not_placed",
459
- "config_digest_mismatch",
460
- "operation_generation_stale",
461
- "profile_changed",
462
- "profile_not_found",
463
- "credential_scope_mismatch",
464
- "provider_kind_unsupported",
465
- "pi_model_invalid",
466
- "capabilities_invalid",
467
- "seal_open_failed",
468
- "secret_invalid",
469
- "local_commit_interrupted",
470
- "secret_store_unavailable"
471
- ];
472
- var ProviderProvisioningRejectionCodeSchema = z.enum(PROVIDER_PROVISIONING_REJECTION_CODES);
473
- var PROVIDER_PROVISIONING_HOST_TERMINAL_CODES = ["request_expired", "sealing_key_rotated"];
474
- var ProviderProvisioningProviderStatusSchema = z.object({
475
- profileRef: ProviderProfileRefSchema,
476
- providerKind: z.string().min(1).max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/u, "providerKind must be a lowercase portable identifier"),
477
- modelId: z.string().min(1).max(160).regex(/^[^\u0000\r\n]+$/u),
478
- capabilities: z.array(ProviderModelCapabilitySchema).max(8),
479
- secretConfigured: z.boolean()
480
- }).strict().superRefine((status, ctx) => {
481
- if (new Set(status.capabilities).size !== status.capabilities.length) {
482
- ctx.addIssue({ code: "custom", path: ["capabilities"], message: "duplicate provider capability" });
483
- }
484
- });
485
- var PROVIDER_PROVISIONING_KEY_CHECK_RESULTS = [
486
- "ok",
487
- "credential_rejected",
488
- "rate_limited",
489
- "quota_or_billing",
490
- "model_not_permitted",
491
- "provider_error",
492
- "unreachable",
493
- "timeout",
494
- "not_run"
495
- ];
496
- var ProviderProvisioningKeyCheckResultSchema = z.enum(PROVIDER_PROVISIONING_KEY_CHECK_RESULTS);
497
- var ProviderProvisioningKeyCheckSchema = z.object({
498
- result: ProviderProvisioningKeyCheckResultSchema
499
- }).strict();
500
- var completionIdentity = {
501
- requestId: z.uuid(),
502
- operation: ProviderProvisioningOperationSchema,
503
- operationGeneration: ProviderProvisioningOperationGenerationSchema,
504
- operationDigest: ProviderProvisioningOperationDigestSchema
505
- };
506
- var AppliedCompletionSchema = z.object({
507
- outcome: z.literal("applied"),
508
- ...completionIdentity,
509
- providerStatus: ProviderProvisioningProviderStatusSchema.nullable(),
510
- binding: ProviderProfileBindingSchema.nullable(),
511
- keyCheck: ProviderProvisioningKeyCheckSchema
512
- }).strict();
513
- var RejectedCompletionSchema = z.object({
514
- outcome: z.literal("rejected"),
515
- ...completionIdentity,
516
- code: ProviderProvisioningRejectionCodeSchema
901
+ policyRevision: OPAQUE_ID,
902
+ runtime: InputPreparationRuntimeIdentitySchema,
903
+ requestDigest: OPAQUE_ID,
904
+ /**
905
+ * The Host's accounting ruling this preparation was requested under,
906
+ * copied verbatim. Absent when the request named none — never filled in,
907
+ * and never narrowed to one the device would have chosen.
908
+ */
909
+ accountingPolicyRef: InputPreparationAccountingPolicyRefSchema.optional()
517
910
  }).strict();
518
- var ProviderProvisioningCompletionSchema = z.discriminatedUnion("outcome", [AppliedCompletionSchema, RejectedCompletionSchema]).superRefine((completion, ctx) => {
519
- if (completion.outcome !== "applied") return;
520
- const { operation, providerStatus, binding } = completion;
521
- if (operation === "delete") {
522
- if (completion.keyCheck.result !== "not_run") {
523
- ctx.addIssue({ code: "custom", path: ["keyCheck", "result"], message: "an applied delete must report keyCheck not_run" });
524
- }
525
- if (providerStatus !== null) {
526
- ctx.addIssue({ code: "custom", path: ["providerStatus"], message: "an applied delete reports no provider status" });
527
- }
528
- if (binding !== null) {
529
- ctx.addIssue({ code: "custom", path: ["binding"], message: "an applied delete reports no binding" });
530
- }
531
- return;
532
- }
533
- if (providerStatus === null) {
534
- ctx.addIssue({ code: "custom", path: ["providerStatus"], message: `an applied ${operation} must report provider status` });
535
- }
536
- if (binding === null) {
537
- ctx.addIssue({ code: "custom", path: ["binding"], message: `an applied ${operation} must report its exact binding` });
538
- }
539
- if (providerStatus === null || binding === null) return;
540
- if (providerStatus.profileRef !== binding.profileRef) {
541
- ctx.addIssue({ code: "custom", path: ["binding", "profileRef"], message: "binding profileRef must equal providerStatus profileRef" });
542
- }
543
- if (providerStatus.modelId !== binding.modelId) {
544
- ctx.addIssue({ code: "custom", path: ["binding", "modelId"], message: "binding modelId must equal providerStatus modelId" });
545
- }
546
- if ((operation === "configure" || operation === "replace_secret") && !providerStatus.secretConfigured) {
547
- ctx.addIssue({
548
- code: "custom",
549
- path: ["providerStatus", "secretConfigured"],
550
- message: `an applied ${operation} must report a configured secret`
551
- });
552
- }
553
- });
554
- var PROVIDER_PROVISIONING_DISPOSITIONS = ["recorded", "idempotent", "conflict", "host_terminal"];
555
- var ProviderProvisioningDispositionSchema = z.enum(PROVIDER_PROVISIONING_DISPOSITIONS);
556
- var ProviderProvisioningReadbackSchema = z.object({
557
- tenantId: z.string().min(1),
558
- deviceId: z.string().min(1),
559
- requestId: z.uuid(),
560
- disposition: ProviderProvisioningDispositionSchema,
561
- completion: ProviderProvisioningCompletionSchema,
562
- completedAt: z.iso.datetime({ offset: true })
563
- }).strict().superRefine((readback, ctx) => {
564
- if (readback.completion.requestId !== readback.requestId) {
565
- ctx.addIssue({ code: "custom", path: ["completion", "requestId"], message: "completion requestId must equal readback requestId" });
566
- }
567
- if (readback.disposition === "host_terminal" && (readback.completion.outcome !== "rejected" || !PROVIDER_PROVISIONING_HOST_TERMINAL_CODES.includes(readback.completion.code))) {
911
+ var InputPreparationReceiptSummarySchema = z.object({
912
+ reference: OPAQUE_ID,
913
+ state: InputPreparationStateSchema,
914
+ binding: InputPreparationBindingSchema,
915
+ artifact: InputPreparationArtifactSummarySchema.optional(),
916
+ counter: InputPreparationCounterEvidenceSchema.optional(),
917
+ ready: z.boolean(),
918
+ readinessReasons: z.array(InputPreparationReadinessReasonSchema).max(16),
919
+ detail: OPAQUE_ID.optional(),
920
+ artifactExpiresAt: z.iso.datetime({ offset: true })
921
+ }).strict().superRefine((value, ctx) => {
922
+ if (value.ready !== (value.readinessReasons.length === 0)) {
568
923
  ctx.addIssue({
569
924
  code: "custom",
570
- path: ["completion"],
571
- message: `a host_terminal readback must carry a rejected completion with one of: ${PROVIDER_PROVISIONING_HOST_TERMINAL_CODES.join(", ")}`
925
+ path: ["ready"],
926
+ message: "ready must be true exactly when readinessReasons is empty"
572
927
  });
573
928
  }
574
929
  });
575
- var CONTENT_HASH_RE = /^sha256:[0-9a-f]{64}$/;
576
- var BlobRefSchema = z.object({
577
- blobId: z.string(),
578
- contentHash: z.string().regex(CONTENT_HASH_RE, 'contentHash must be "sha256:<64 lowercase hex>"'),
579
- size: z.number().int().nonnegative(),
580
- contentType: z.string(),
581
- url: z.string().optional()
582
- });
930
+ var InputPreparationReferenceSchema = OPAQUE_ID;
931
+ var InputPreparationOfferBindingSchema = z.object({
932
+ reference: InputPreparationReferenceSchema,
933
+ /** `InputPreparationBindingSchema.requestDigest`, as the receipt reported it. */
934
+ requestDigest: OPAQUE_ID,
935
+ /** `InputPreparationArtifactSummarySchema.envelopeDigest`, when the receipt carried one. */
936
+ artifactDigest: OPAQUE_ID.optional()
937
+ }).strict();
938
+ var InputPreparationRejectionReasonSchema = z.enum([
939
+ "input_preparation_unconfigured",
940
+ "bad_request",
941
+ "authority_unavailable",
942
+ "scope_denied",
943
+ "policy_revision_mismatch",
944
+ "runtime_identity_unavailable",
945
+ "unsupported_input",
946
+ "limit_exceeded",
947
+ "request_conflict",
948
+ "not_found",
949
+ "counter_unavailable",
950
+ "counter_interrupted",
951
+ "durable_write_failed",
952
+ "cancelled",
953
+ "context_unresolvable",
954
+ "context_hash_mismatch",
955
+ "toolsets_unobservable",
956
+ "deadline_elapsed",
957
+ /**
958
+ * A repeat of an already-recorded `requestId` arrived after the facts its
959
+ * executor fingerprints were frozen against changed — a toolset definition
960
+ * revision or a configured server argv. The recorded receipt is not re-derived and no
961
+ * server is re-probed; the repeat is refused so the caller mints a new
962
+ * preparation instead of silently receiving one bound to stale evidence.
963
+ */
964
+ "observation_drift",
965
+ /**
966
+ * The device compiled the input, then found that the `prompt_prepared` frame
967
+ * the runtime would have to be handed exceeds the single-frame byte cap that
968
+ * runtime enforces. The bound belongs to the runtime, not to the operator's
969
+ * retention policy, so it is decided first and nothing is retained: a
970
+ * preparation that could never be delivered is not a smaller preparation.
971
+ */
972
+ "rpc_frame_too_large",
973
+ /**
974
+ * The device's input-preparation lane is off because its durable record log
975
+ * holds a record from an older record schema version. The rest of the
976
+ * device runs; this lane refuses until an operator archives that log. No
977
+ * record is migrated, read forward or deleted.
978
+ */
979
+ "input_preparation_record_log_unsupported"
980
+ ]);
583
981
  var AGENT_EVENT_SPILL_UNSTORED_REASON_MAX_LENGTH = 512;
584
982
  var AgentEventSpillSchema = z.object({
585
983
  /** Which field of the event was replaced by a preview. */
@@ -661,6 +1059,18 @@ function partitionAgentEvents(events) {
661
1059
  }
662
1060
  return { known, unknown };
663
1061
  }
1062
+ var AGENT_HOME_PROJECTION_MAX_BYTES = 64 * 1024;
1063
+ var AGENT_HOME_PROJECTION_PROFILE_REVISION_MAXIMUM = "9223372036854775807";
1064
+ var AgentHomeProjectionProfileRevisionSchema = z.string().regex(/^[1-9][0-9]{0,18}$/u, "profileRevision must be a canonical positive decimal string").refine(
1065
+ (value) => value.length < AGENT_HOME_PROJECTION_PROFILE_REVISION_MAXIMUM.length || value <= AGENT_HOME_PROJECTION_PROFILE_REVISION_MAXIMUM,
1066
+ `profileRevision must not exceed PostgreSQL BIGINT maximum ${AGENT_HOME_PROJECTION_PROFILE_REVISION_MAXIMUM}`
1067
+ );
1068
+ var AgentHomeProjectionHashSchema = AgentEgressContentHashSchema;
1069
+ var AgentHomeProjectionOutcomeSchema = z.enum(["applied", "idempotent", "stale", "conflict"]);
1070
+ var AgentHomeProjectionValueSchema = z.json().refine(
1071
+ (value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= AGENT_HOME_PROJECTION_MAX_BYTES,
1072
+ `projection must not exceed ${AGENT_HOME_PROJECTION_MAX_BYTES} UTF-8 JSON bytes`
1073
+ );
664
1074
 
665
1075
  // src/messages.ts
666
1076
  var MAX_INLINE_BYTES = 64 * 1024;
@@ -1009,7 +1419,8 @@ var TaskStartedPayloadSchema = z.object({});
1009
1419
  var TaskDeclinePayloadSchema = z.object({
1010
1420
  reason: z.string(),
1011
1421
  retryable: z.boolean().optional(),
1012
- agentRef: AgentRefSchema.optional()
1422
+ agentRef: AgentRefSchema.optional(),
1423
+ code: z.enum(["agent_home_writer_busy", "agent_home_reader_busy"]).optional()
1013
1424
  });
1014
1425
  var TaskProgressPayloadSchema = z.object({
1015
1426
  seq: z.number().int(),
@@ -1028,52 +1439,8 @@ var TaskAwaitApprovalPayloadSchema = z.object({
1028
1439
  approvalId: z.string().optional()
1029
1440
  });
1030
1441
  var RESULT_DOCUMENT_MAX_BYTES = 1048576;
1031
- function isSameJsonData(a, b) {
1032
- if (a === null || b === null) return a === b;
1033
- const typeOfA = typeof a;
1034
- if (typeOfA !== typeof b) return false;
1035
- if (typeOfA !== "object") {
1036
- return a === b;
1037
- }
1038
- const aIsArray = Array.isArray(a);
1039
- if (aIsArray !== Array.isArray(b)) return false;
1040
- if (aIsArray) {
1041
- const arrayA = a;
1042
- const arrayB = b;
1043
- if (arrayA.length !== arrayB.length) return false;
1044
- for (let index = 0; index < arrayA.length; index += 1) {
1045
- if (!isSameJsonData(arrayA[index], arrayB[index])) return false;
1046
- }
1047
- return true;
1048
- }
1049
- const objectA = a;
1050
- const objectB = b;
1051
- const keysA = Object.keys(objectA);
1052
- const keysB = Object.keys(objectB);
1053
- if (keysA.length === 0) {
1054
- const prototypeA = Object.getPrototypeOf(objectA);
1055
- if (prototypeA !== Object.prototype && prototypeA !== null) return false;
1056
- }
1057
- if (keysA.length !== keysB.length) return false;
1058
- for (const key of keysA) {
1059
- if (!Object.prototype.hasOwnProperty.call(objectB, key)) return false;
1060
- if (!isSameJsonData(objectA[key], objectB[key])) return false;
1061
- }
1062
- return true;
1063
- }
1064
1442
  function checkResultDocument(document) {
1065
- let json;
1066
- try {
1067
- json = JSON.stringify(document);
1068
- } catch {
1069
- return { ok: false, reason: "not-serializable" };
1070
- }
1071
- if (json === void 0) return { ok: false, reason: "not-serializable" };
1072
- const bytes = new TextEncoder().encode(json).length;
1073
- if (bytes > RESULT_DOCUMENT_MAX_BYTES) return { ok: false, reason: "over-cap", bytes };
1074
- const canonical = JSON.parse(json);
1075
- if (!isSameJsonData(document, canonical)) return { ok: false, reason: "not-plain-json" };
1076
- return { ok: true, bytes, canonical };
1443
+ return canonicalizePlainJson(document, RESULT_DOCUMENT_MAX_BYTES);
1077
1444
  }
1078
1445
  var TERMINAL_INFERENCE_USAGE_MAX_TOKENS = 1e9;
1079
1446
  var TERMINAL_INFERENCE_USAGE_MAX_DURATION_MS = 6048e5;
@@ -1255,7 +1622,6 @@ var DAEMON_TO_SERVER_TYPES = [
1255
1622
  ];
1256
1623
 
1257
1624
  // src/agent-memory-intent.ts
1258
- var AGENT_MEMORY_INTENT_CAPABILITY = "agent-memory-intent.v1";
1259
1625
  var AGENT_MEMORY_INTENT_CONTENT_MAX_BYTES = 262144;
1260
1626
  var AGENT_MEMORY_INTENT_PATH_MAX_BYTES = 1024;
1261
1627
  var AGENT_MEMORY_INTENT_APPROVAL_REF_MAX_BYTES = 128;
@@ -1267,9 +1633,9 @@ var AgentMemoryIntentApprovalRefSchema = z.string().regex(
1267
1633
  new RegExp(`^[A-Za-z0-9._:-]{1,${AGENT_MEMORY_INTENT_APPROVAL_REF_MAX_BYTES}}$`, "u"),
1268
1634
  `approvalRef must be 1..${AGENT_MEMORY_INTENT_APPROVAL_REF_MAX_BYTES} characters of [A-Za-z0-9._:-]`
1269
1635
  );
1270
- var LONE_SURROGATE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u;
1636
+ var LONE_SURROGATE2 = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u;
1271
1637
  var utf8 = new TextEncoder();
1272
- var AgentMemoryIntentContentSchema = z.string().refine((value) => !LONE_SURROGATE.test(value), "content must be well-formed Unicode (encodable as UTF-8)").refine(
1638
+ var AgentMemoryIntentContentSchema = z.string().refine((value) => !LONE_SURROGATE2.test(value), "content must be well-formed Unicode (encodable as UTF-8)").refine(
1273
1639
  (value) => utf8.encode(value).byteLength <= AGENT_MEMORY_INTENT_CONTENT_MAX_BYTES,
1274
1640
  `content must not exceed ${AGENT_MEMORY_INTENT_CONTENT_MAX_BYTES} UTF-8 bytes`
1275
1641
  );
@@ -1417,44 +1783,6 @@ function agentMemoryIntentFetchResponseSchemaFor(reservation) {
1417
1783
  }
1418
1784
  });
1419
1785
  }
1420
-
1421
- // src/version.ts
1422
- var MAILBOX_READ_AHEAD_MAX_SEQS = 4096;
1423
- var MAILBOX_READ_AHEAD_CAPABILITY = "mailbox-read-ahead";
1424
- var PROTOCOL_VERSION = 2;
1425
- var STRICT_AGENT_ONLY_CAPABILITY = "strict-agent-only";
1426
- var AGENT_HOME_READERS_CAPABILITY = "agent-home-readers";
1427
- var CUSTOM_HARNESS_CAPABILITY = "custom-harness";
1428
- var CAPABILITY_FLAGS = [
1429
- "steer",
1430
- "blob-upload",
1431
- "interactive-approval",
1432
- "approval_resolved",
1433
- "approval-targeting",
1434
- "result-document",
1435
- "dispatch-selection",
1436
- PROVIDER_PROFILE_BINDING_CAPABILITY,
1437
- "toolset-selection",
1438
- "agent-home-contract",
1439
- AGENT_HOME_READERS_CAPABILITY,
1440
- STRICT_AGENT_ONLY_CAPABILITY,
1441
- AGENT_EGRESS_POLICY_CAPABILITY,
1442
- AGENT_EGRESS_RELIABLE_ACK_CAPABILITY,
1443
- AGENT_MESSAGE_EGRESS_CAPABILITY,
1444
- AGENT_EGRESS_FRESH_SESSION_CAPABILITY,
1445
- AGENT_CONTENT_WORKSPACE_READ_CAPABILITY,
1446
- AGENT_CONTENT_TRANSCRIPT_READ_CAPABILITY,
1447
- AGENT_CONTENT_ARTIFACT_READ_CAPABILITY,
1448
- AGENT_HOME_PROJECTION_CAPABILITY,
1449
- AGENT_INPUT_PREPARATION_CAPABILITY,
1450
- TERMINAL_PROJECTION_SELECTION_CAPABILITY,
1451
- HOST_MCP_TASK_CONTEXT_CAPABILITY,
1452
- CUSTOM_HARNESS_CAPABILITY,
1453
- MAILBOX_READ_AHEAD_CAPABILITY,
1454
- PROVIDER_PROVISIONING_CAPABILITY,
1455
- AGENT_MEMORY_INTENT_CAPABILITY
1456
- ];
1457
- var AGENT_MEMORY_PROJECTION_CAPABILITY = "agent.memory.projection";
1458
1786
  var AGENT_MEMORY_PROJECTION_MAX_REDACTED_BYTES = 512 * 1024;
1459
1787
  var AGENT_MEMORY_PROJECTION_MAX_ORDERING_VALUE = 2147483647;
1460
1788
  var OPAQUE_REFERENCE_MAX_BYTES = 512;
@@ -1524,29 +1852,6 @@ var AgentMemoryProjectionReceiptSchema = z.object({
1524
1852
  metering: AgentMemoryProjectionMeteringReceiptSchema
1525
1853
  }).strict();
1526
1854
  var AgentMemoryProjectionEraseResultSchema = z.object({ nextWriterEpoch: AgentMemoryProjectionWriterEpochSchema }).strict();
1527
-
1528
- // src/task-state.ts
1529
- var TASK_STATES = [
1530
- "Offered",
1531
- "Claimed",
1532
- "Running",
1533
- "AwaitApproval",
1534
- "Complete",
1535
- "Failed",
1536
- "Cancelled"
1537
- ];
1538
- var TASK_TRANSITIONS = {
1539
- Offered: ["Claimed", "Cancelled", "Failed"],
1540
- Claimed: ["Running", "Failed", "Cancelled"],
1541
- Running: ["AwaitApproval", "Complete", "Failed", "Cancelled"],
1542
- AwaitApproval: ["Running", "Failed", "Cancelled"],
1543
- Complete: [],
1544
- Failed: [],
1545
- Cancelled: []
1546
- };
1547
- function canTransition(from, to) {
1548
- return TASK_TRANSITIONS[from].includes(to);
1549
- }
1550
1855
  var REQUIRED_TASK_ID = z.string().min(1);
1551
1856
  var OPTIONAL_TASK_ID = REQUIRED_TASK_ID.optional();
1552
1857
  var FORBIDDEN_TASK_ID = z.never().optional();
@@ -1777,16 +2082,36 @@ var EventsPollQuerySchema = z.object({
1777
2082
  /** Last reliably processed seq; the only acknowledgement. Omitted on the first poll. */
1778
2083
  cursor: z.number().int().nonnegative().optional()
1779
2084
  });
2085
+ var ActivityIngressSchema = z.object({
2086
+ activityMaxEvents: z.number().int().positive(),
2087
+ activityMaxBytes: z.number().int().min(2)
2088
+ });
2089
+ var OUTBOUND_REFUSAL_REASONS = ["payload_invalid", "not_permitted", "limit_exceeded", "state_conflict", "unsupported"];
2090
+ function isOutboundRefusalCode(value) {
2091
+ return OUTBOUND_REFUSAL_REASONS.includes(value);
2092
+ }
2093
+ var MessageSendOutcomeSchema = z.object({
2094
+ id: z.uuid(),
2095
+ outcome: z.enum(["accepted", "duplicate", "rejected"]),
2096
+ /** Decodes to an {@link OutboundRefusalReason}; an unrecognized string becomes `unknown`. */
2097
+ reason: z.string().max(64).transform((value) => isOutboundRefusalCode(value) ? value : "unknown").optional()
2098
+ });
1780
2099
  var EventsPollResponseSchema = z.object({
1781
- events: z.array(EnvelopeSchema),
2100
+ /**
2101
+ * Not-yet-decoded entries (#386). This schema decodes the page only; each
2102
+ * entry is decoded on its own with `parseMessage`, so one unknown or invalid
2103
+ * entry stalls its own sequence instead of failing every entry in the page.
2104
+ */
2105
+ events: z.array(z.unknown()),
1782
2106
  cursor: z.number().int(),
1783
2107
  /**
1784
- * Server capabilities for THIS long-poll response. This is the HTTP
1785
- * transport's equivalent of `conn.ack.capabilities`: a new daemon treats
1786
- * absence as no advertised capabilities, so old responders remain
1787
- * fail-closed for gated daemon -> server fields and messages.
2108
+ * Required in v3: the server capabilities for THIS long-poll response, the
2109
+ * HTTP transport's equivalent of `conn.ack.capabilities`. Each page replaces
2110
+ * the daemon's advertisement; an empty list advertises nothing.
1788
2111
  */
1789
- capabilities: z.array(z.string()).optional()
2112
+ capabilities: z.array(z.string()),
2113
+ /** Required in v3: the activity limits that apply to new progress pushes. */
2114
+ ingress: ActivityIngressSchema
1790
2115
  });
1791
2116
  var MAX_MESSAGES_PER_BATCH = 256;
1792
2117
  var MessagesSendRequestSchema = z.object({
@@ -1794,7 +2119,10 @@ var MessagesSendRequestSchema = z.object({
1794
2119
  });
1795
2120
  var MessagesSendResponseSchema = z.object({
1796
2121
  accepted: z.number().int().nonnegative(),
1797
- rejected: z.number().int().nonnegative().optional()
2122
+ rejected: z.number().int().nonnegative().optional(),
2123
+ capabilities: z.array(z.string()).optional(),
2124
+ ingress: ActivityIngressSchema.optional(),
2125
+ outcomes: z.array(MessageSendOutcomeSchema).max(MAX_MESSAGES_PER_BATCH)
1798
2126
  });
1799
2127
  var AgentHomeProjectionCompletionRequestSchema = z.object({
1800
2128
  requestId: z.uuid(),
@@ -1919,6 +2247,6 @@ function byokBlobContentPath(blobId) {
1919
2247
  return `/byok/blobs/${blobId}/content`;
1920
2248
  }
1921
2249
 
1922
- 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_PROJECTION_CAPABILITY, AGENT_MEMORY_PROJECTION_MAX_ORDERING_VALUE, AGENT_MEMORY_PROJECTION_MAX_REDACTED_BYTES, AGENT_MESSAGE_EGRESS_CAPABILITY, AGENT_MESSAGE_MAX_BYTES, AGENT_REF_MAX_BYTES, 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, AgentMessageEgressRequirementSchema, AgentMessageFreshnessCursorSchema, AgentMessagePublishPayloadSchema, AgentMessageServerContextSchema, AgentRefSchema, AgentReliableQuotaPolicySchema, 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, 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, MessagesSendRequestSchema, MessagesSendResponseSchema, PAIR_RESPONSE_TENANT_ID_MAX_LENGTH, 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, RequiredToolsetsSchema, 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, agentMemoryIntentFetchResponseSchemaFor, agentMemoryProjectionBase64UrlByteLength, byokAgentHomeProjectionCompletionPath, byokBlobContentPath, byokBlobFinalizePath, byokBlobUrlPath, byokInputPreparationCompletionPath, byokInputPreparationStatusPath, byokRecordPath, byokSkillPackFilePath, canTransition, checkResultDocument, createEnvelope, decodeEnvelope, encodeEnvelope, isKnownAgentEvent, isServerToDaemonType, isTaskOfferType, parseMessage, partitionAgentEvents };
2250
+ 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_PROJECTION_CAPABILITY, AGENT_MEMORY_PROJECTION_MAX_ORDERING_VALUE, AGENT_MEMORY_PROJECTION_MAX_REDACTED_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, AgentMessageEgressRequirementSchema, AgentMessageFreshnessCursorSchema, AgentMessagePublishPayloadSchema, AgentMessageServerContextSchema, AgentRefSchema, AgentReliableQuotaPolicySchema, 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, 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, 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, byokAgentHomeProjectionCompletionPath, byokBlobContentPath, byokBlobFinalizePath, byokBlobUrlPath, byokInputPreparationCompletionPath, byokInputPreparationStatusPath, byokRecordPath, byokSkillPackFilePath, canTransition, checkResultDocument, checkResultSchema, createEnvelope, decodeEnvelope, encodeEnvelope, isKnownAgentEvent, isPreparedAgentMemoryMode, isServerToDaemonType, isTaskOfferType, parseMessage, partitionAgentEvents, requiredReceiverCapabilities, validateResultOutcome };
1923
2251
  //# sourceMappingURL=index.js.map
1924
2252
  //# sourceMappingURL=index.js.map