@byok-sdk/protocol 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { type RuntimeUnavailableCause } from './constants';
2
3
  import { ProviderProvisioningAvailablePayloadSchema } from './provider-provisioning';
3
4
  import { E2eeKeyPackageAvailablePayloadSchema } from './e2ee-member';
4
5
  import { type PlainJsonCheck } from './plain-json';
@@ -8,6 +9,14 @@ export declare const RuntimeIdSchema: z.ZodEnum<{
8
9
  pi: "pi";
9
10
  }>;
10
11
  export type RuntimeId = z.infer<typeof RuntimeIdSchema>;
12
+ /** A runtime-unavailable cause as this version understands it; unknown reads as `unknown` with the raw token kept. */
13
+ export type RuntimeUnavailableCauseReading = {
14
+ readonly cause: RuntimeUnavailableCause;
15
+ } | {
16
+ readonly cause: 'unknown';
17
+ readonly reportedCause: string;
18
+ };
19
+ export declare function readRuntimeUnavailableCause(cause: string): RuntimeUnavailableCauseReading;
11
20
  /** Wire-safe protocol version number: bounded before JSON reaches a store or comparison. */
12
21
  export declare const ProtocolVersionNumberSchema: z.ZodNumber;
13
22
  /**
@@ -31,8 +40,31 @@ export declare const RuntimeCapabilitiesSchema: z.ZodObject<{
31
40
  approvalInteractive: z.ZodOptional<z.ZodBoolean>;
32
41
  mcpToolsets: z.ZodOptional<z.ZodBoolean>;
33
42
  messageDraft: z.ZodOptional<z.ZodBoolean>;
43
+ toolAuthorizationAuto: z.ZodOptional<z.ZodBoolean>;
44
+ durablePi: z.ZodOptional<z.ZodBoolean>;
45
+ preparedLane: z.ZodOptional<z.ZodBoolean>;
46
+ isolation: z.ZodOptional<z.ZodObject<{
47
+ userContext: z.ZodOptional<z.ZodBoolean>;
48
+ userMcpServers: z.ZodOptional<z.ZodBoolean>;
49
+ sessionPersistence: z.ZodOptional<z.ZodBoolean>;
50
+ }, z.core.$strip>>;
34
51
  }, z.core.$strip>;
35
52
  export type RuntimeCapabilities = z.infer<typeof RuntimeCapabilitiesSchema>;
53
+ /**
54
+ * The effective version policy's verdict, projected for discovery (#1103 D8).
55
+ * Only `state` and the policy's qualified token travel: `matched` and the
56
+ * allow/warn/block spec lists stay local. Absence means **unknown**, never
57
+ * `allow`: an older daemon or an adapter without a policy omits the field.
58
+ */
59
+ export declare const RuntimeVersionPolicyProjectionSchema: z.ZodObject<{
60
+ state: z.ZodEnum<{
61
+ allow: "allow";
62
+ block: "block";
63
+ warn: "warn";
64
+ }>;
65
+ qualifiedVersion: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$strip>;
67
+ export type RuntimeVersionPolicyProjection = z.infer<typeof RuntimeVersionPolicyProjectionSchema>;
36
68
  /**
37
69
  * Runtime detection info reported in `conn.hello`. Supersedes the M0
38
70
  * `agents: unknown` field (M1 gap #4): typed, so the server no longer has to
@@ -52,6 +84,22 @@ export declare const RuntimeInfoSchema: z.ZodObject<{
52
84
  approvalInteractive: z.ZodOptional<z.ZodBoolean>;
53
85
  mcpToolsets: z.ZodOptional<z.ZodBoolean>;
54
86
  messageDraft: z.ZodOptional<z.ZodBoolean>;
87
+ toolAuthorizationAuto: z.ZodOptional<z.ZodBoolean>;
88
+ durablePi: z.ZodOptional<z.ZodBoolean>;
89
+ preparedLane: z.ZodOptional<z.ZodBoolean>;
90
+ isolation: z.ZodOptional<z.ZodObject<{
91
+ userContext: z.ZodOptional<z.ZodBoolean>;
92
+ userMcpServers: z.ZodOptional<z.ZodBoolean>;
93
+ sessionPersistence: z.ZodOptional<z.ZodBoolean>;
94
+ }, z.core.$strip>>;
95
+ }, z.core.$strip>>;
96
+ versionPolicy: z.ZodOptional<z.ZodObject<{
97
+ state: z.ZodEnum<{
98
+ allow: "allow";
99
+ block: "block";
100
+ warn: "warn";
101
+ }>;
102
+ qualifiedVersion: z.ZodOptional<z.ZodString>;
55
103
  }, z.core.$strip>>;
56
104
  }, z.core.$strip>;
57
105
  export type RuntimeInfo = z.infer<typeof RuntimeInfoSchema>;
@@ -67,7 +115,23 @@ export declare const HarnessInfoSchema: z.ZodObject<{
67
115
  approvalInteractive: z.ZodOptional<z.ZodBoolean>;
68
116
  mcpToolsets: z.ZodOptional<z.ZodBoolean>;
69
117
  messageDraft: z.ZodOptional<z.ZodBoolean>;
118
+ toolAuthorizationAuto: z.ZodOptional<z.ZodBoolean>;
119
+ durablePi: z.ZodOptional<z.ZodBoolean>;
120
+ preparedLane: z.ZodOptional<z.ZodBoolean>;
121
+ isolation: z.ZodOptional<z.ZodObject<{
122
+ userContext: z.ZodOptional<z.ZodBoolean>;
123
+ userMcpServers: z.ZodOptional<z.ZodBoolean>;
124
+ sessionPersistence: z.ZodOptional<z.ZodBoolean>;
125
+ }, z.core.$strip>>;
70
126
  }, z.core.$strip>;
127
+ versionPolicy: z.ZodOptional<z.ZodObject<{
128
+ state: z.ZodEnum<{
129
+ allow: "allow";
130
+ block: "block";
131
+ warn: "warn";
132
+ }>;
133
+ qualifiedVersion: z.ZodOptional<z.ZodString>;
134
+ }, z.core.$strip>>;
71
135
  }, z.core.$strip>;
72
136
  export type HarnessInfo = z.infer<typeof HarnessInfoSchema>;
73
137
  export declare const HarnessInventorySchema: z.ZodArray<z.ZodObject<{
@@ -79,8 +143,55 @@ export declare const HarnessInventorySchema: z.ZodArray<z.ZodObject<{
79
143
  approvalInteractive: z.ZodOptional<z.ZodBoolean>;
80
144
  mcpToolsets: z.ZodOptional<z.ZodBoolean>;
81
145
  messageDraft: z.ZodOptional<z.ZodBoolean>;
146
+ toolAuthorizationAuto: z.ZodOptional<z.ZodBoolean>;
147
+ durablePi: z.ZodOptional<z.ZodBoolean>;
148
+ preparedLane: z.ZodOptional<z.ZodBoolean>;
149
+ isolation: z.ZodOptional<z.ZodObject<{
150
+ userContext: z.ZodOptional<z.ZodBoolean>;
151
+ userMcpServers: z.ZodOptional<z.ZodBoolean>;
152
+ sessionPersistence: z.ZodOptional<z.ZodBoolean>;
153
+ }, z.core.$strip>>;
82
154
  }, z.core.$strip>;
155
+ versionPolicy: z.ZodOptional<z.ZodObject<{
156
+ state: z.ZodEnum<{
157
+ allow: "allow";
158
+ block: "block";
159
+ warn: "warn";
160
+ }>;
161
+ qualifiedVersion: z.ZodOptional<z.ZodString>;
162
+ }, z.core.$strip>>;
83
163
  }, z.core.$strip>>;
164
+ /**
165
+ * One non-available runtime or harness in `conn.hello.runtimeUnavailable`
166
+ * (#1103 D8). The id stays in the existing identity domain: a built-in
167
+ * runtime id or a custom harness id. The cause is the append-only
168
+ * vocabulary, and `retryable` carries the same per-cause default a
169
+ * `task.decline` reports. Absence of the whole array means unknown, never
170
+ * "everything is available".
171
+ */
172
+ export declare const RuntimeUnavailableEntrySchema: z.ZodObject<{
173
+ id: z.ZodUnion<readonly [z.ZodEnum<{
174
+ claude: "claude";
175
+ codex: "codex";
176
+ pi: "pi";
177
+ }>, z.ZodString]>;
178
+ cause: z.ZodUnion<readonly [z.ZodEnum<{
179
+ acp_unavailable: "acp_unavailable";
180
+ app_server_unavailable: "app_server_unavailable";
181
+ environment_unavailable: "environment_unavailable";
182
+ none_available: "none_available";
183
+ not_executable: "not_executable";
184
+ not_installed: "not_installed";
185
+ platform_unsupported: "platform_unsupported";
186
+ probe_failed: "probe_failed";
187
+ probe_timeout: "probe_timeout";
188
+ runtime_not_allowed: "runtime_not_allowed";
189
+ runtime_not_configured: "runtime_not_configured";
190
+ version_blocked: "version_blocked";
191
+ }>, z.ZodString]>;
192
+ retryable: z.ZodBoolean;
193
+ }, z.core.$strip>;
194
+ export type RuntimeUnavailableEntry = z.infer<typeof RuntimeUnavailableEntrySchema>;
84
195
  /** Maximum logical toolsets one daemon may advertise as locally configured. */
85
196
  export declare const CONFIGURED_TOOLSETS_MAX_ITEMS = 64;
86
197
  /**
@@ -134,6 +245,22 @@ export declare const ConnHelloPayloadSchema: z.ZodObject<{
134
245
  approvalInteractive: z.ZodOptional<z.ZodBoolean>;
135
246
  mcpToolsets: z.ZodOptional<z.ZodBoolean>;
136
247
  messageDraft: z.ZodOptional<z.ZodBoolean>;
248
+ toolAuthorizationAuto: z.ZodOptional<z.ZodBoolean>;
249
+ durablePi: z.ZodOptional<z.ZodBoolean>;
250
+ preparedLane: z.ZodOptional<z.ZodBoolean>;
251
+ isolation: z.ZodOptional<z.ZodObject<{
252
+ userContext: z.ZodOptional<z.ZodBoolean>;
253
+ userMcpServers: z.ZodOptional<z.ZodBoolean>;
254
+ sessionPersistence: z.ZodOptional<z.ZodBoolean>;
255
+ }, z.core.$strip>>;
256
+ }, z.core.$strip>>;
257
+ versionPolicy: z.ZodOptional<z.ZodObject<{
258
+ state: z.ZodEnum<{
259
+ allow: "allow";
260
+ block: "block";
261
+ warn: "warn";
262
+ }>;
263
+ qualifiedVersion: z.ZodOptional<z.ZodString>;
137
264
  }, z.core.$strip>>;
138
265
  }, z.core.$strip>>>;
139
266
  harnesses: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -145,7 +272,45 @@ export declare const ConnHelloPayloadSchema: z.ZodObject<{
145
272
  approvalInteractive: z.ZodOptional<z.ZodBoolean>;
146
273
  mcpToolsets: z.ZodOptional<z.ZodBoolean>;
147
274
  messageDraft: z.ZodOptional<z.ZodBoolean>;
275
+ toolAuthorizationAuto: z.ZodOptional<z.ZodBoolean>;
276
+ durablePi: z.ZodOptional<z.ZodBoolean>;
277
+ preparedLane: z.ZodOptional<z.ZodBoolean>;
278
+ isolation: z.ZodOptional<z.ZodObject<{
279
+ userContext: z.ZodOptional<z.ZodBoolean>;
280
+ userMcpServers: z.ZodOptional<z.ZodBoolean>;
281
+ sessionPersistence: z.ZodOptional<z.ZodBoolean>;
282
+ }, z.core.$strip>>;
148
283
  }, z.core.$strip>;
284
+ versionPolicy: z.ZodOptional<z.ZodObject<{
285
+ state: z.ZodEnum<{
286
+ allow: "allow";
287
+ block: "block";
288
+ warn: "warn";
289
+ }>;
290
+ qualifiedVersion: z.ZodOptional<z.ZodString>;
291
+ }, z.core.$strip>>;
292
+ }, z.core.$strip>>>;
293
+ runtimeUnavailable: z.ZodOptional<z.ZodArray<z.ZodObject<{
294
+ id: z.ZodUnion<readonly [z.ZodEnum<{
295
+ claude: "claude";
296
+ codex: "codex";
297
+ pi: "pi";
298
+ }>, z.ZodString]>;
299
+ cause: z.ZodUnion<readonly [z.ZodEnum<{
300
+ acp_unavailable: "acp_unavailable";
301
+ app_server_unavailable: "app_server_unavailable";
302
+ environment_unavailable: "environment_unavailable";
303
+ none_available: "none_available";
304
+ not_executable: "not_executable";
305
+ not_installed: "not_installed";
306
+ platform_unsupported: "platform_unsupported";
307
+ probe_failed: "probe_failed";
308
+ probe_timeout: "probe_timeout";
309
+ runtime_not_allowed: "runtime_not_allowed";
310
+ runtime_not_configured: "runtime_not_configured";
311
+ version_blocked: "version_blocked";
312
+ }>, z.ZodString]>;
313
+ retryable: z.ZodBoolean;
149
314
  }, z.core.$strip>>>;
150
315
  configuredToolsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
151
316
  cursor: z.ZodOptional<z.ZodNumber>;
@@ -973,7 +1138,7 @@ export declare const AgentContentReceiptPayloadSchema: z.ZodDiscriminatedUnion<[
973
1138
  }>;
974
1139
  decision: z.ZodLiteral<"denied">;
975
1140
  byteCount: z.ZodLiteral<0>;
976
- reason: z.ZodEnum<{
1141
+ reason: z.ZodUnion<readonly [z.ZodEnum<{
977
1142
  "absolute-target": "absolute-target";
978
1143
  "byte-limit": "byte-limit";
979
1144
  "capability-missing": "capability-missing";
@@ -993,7 +1158,7 @@ export declare const AgentContentReceiptPayloadSchema: z.ZodDiscriminatedUnion<[
993
1158
  "target-missing": "target-missing";
994
1159
  "text-decode-failed": "text-decode-failed";
995
1160
  "text-not-allowlisted": "text-not-allowlisted";
996
- }>;
1161
+ }>, z.ZodString]>;
997
1162
  }, z.core.$strict>], "decision">;
998
1163
  export type AgentContentReceiptPayload = z.infer<typeof AgentContentReceiptPayloadSchema>;
999
1164
  /**
@@ -1295,6 +1460,14 @@ export declare const TaskClaimPayloadSchema: z.ZodObject<{
1295
1460
  approvalInteractive: z.ZodOptional<z.ZodBoolean>;
1296
1461
  mcpToolsets: z.ZodOptional<z.ZodBoolean>;
1297
1462
  messageDraft: z.ZodOptional<z.ZodBoolean>;
1463
+ toolAuthorizationAuto: z.ZodOptional<z.ZodBoolean>;
1464
+ durablePi: z.ZodOptional<z.ZodBoolean>;
1465
+ preparedLane: z.ZodOptional<z.ZodBoolean>;
1466
+ isolation: z.ZodOptional<z.ZodObject<{
1467
+ userContext: z.ZodOptional<z.ZodBoolean>;
1468
+ userMcpServers: z.ZodOptional<z.ZodBoolean>;
1469
+ sessionPersistence: z.ZodOptional<z.ZodBoolean>;
1470
+ }, z.core.$strip>>;
1298
1471
  }, z.core.$strip>>;
1299
1472
  admission: z.ZodOptional<z.ZodObject<{
1300
1473
  totalMs: z.ZodNumber;
@@ -1313,6 +1486,16 @@ export type TaskClaimPayload = z.infer<typeof TaskClaimPayloadSchema>;
1313
1486
  */
1314
1487
  export declare const TaskStartedPayloadSchema: z.ZodObject<{}, z.core.$strip>;
1315
1488
  export type TaskStartedPayload = z.infer<typeof TaskStartedPayloadSchema>;
1489
+ declare const DECLINE_CODES: readonly ["agent_home_writer_busy", "agent_home_reader_busy", "sealed_key_unavailable", "sealed_open_failed", "sealed_content_mac_mismatch", "sealing_policy_mismatch"];
1490
+ export type TaskDeclineCode = (typeof DECLINE_CODES)[number];
1491
+ /** A decline code as this version understands it: one it does not know reads as `unknown`, its raw token kept. */
1492
+ export type TaskDeclineCodeReading = {
1493
+ readonly code: TaskDeclineCode;
1494
+ } | {
1495
+ readonly code: 'unknown';
1496
+ readonly reportedCode: string;
1497
+ };
1498
+ export declare function readDeclineCode(code: string): TaskDeclineCodeReading;
1316
1499
  /**
1317
1500
  * Hard cap (1 MiB) on a single `task.complete.document` (see
1318
1501
  * {@link TaskCompletePayloadSchema}), measured as the UTF-8 byte length of
@@ -1498,7 +1681,7 @@ export declare const TerminalAgentHomeMemoryChangeSchema: z.ZodDiscriminatedUnio
1498
1681
  outcome: z.ZodLiteral<"unmeasured">;
1499
1682
  }, z.core.$strict>], "outcome">;
1500
1683
  export type TerminalAgentHomeMemoryChange = z.infer<typeof TerminalAgentHomeMemoryChangeSchema>;
1501
- /** A closed runtime failure class (#869). `unknown` means the runtime gave no structured evidence. */
1684
+ /** A runtime failure class this version knows (#869). `unknown` means the runtime gave no structured evidence. */
1502
1685
  export declare const RuntimeFailureClassSchema: z.ZodEnum<{
1503
1686
  auth: "auth";
1504
1687
  billing: "billing";
@@ -1519,6 +1702,11 @@ export type RuntimeFailureClass = z.infer<typeof RuntimeFailureClassSchema>;
1519
1702
  * The machine-readable failure of a `task.fail` (#869); `reason` stays display
1520
1703
  * text. `resetsAt` (ISO 8601 UTC) exists only on `quota`, and only when the
1521
1704
  * runtime reported when the limit resets.
1705
+ *
1706
+ * The class is open (#1121): a well-formed class this version does not know,
1707
+ * with whatever fields a newer device put beside it, is accepted and kept
1708
+ * verbatim, so the terminal is still recorded. {@link readTaskFailure} is the
1709
+ * typed reading.
1522
1710
  */
1523
1711
  export declare const TaskFailureSchema: z.ZodUnion<readonly [z.ZodObject<{
1524
1712
  class: z.ZodLiteral<"quota">;
@@ -1538,8 +1726,21 @@ export declare const TaskFailureSchema: z.ZodUnion<readonly [z.ZodObject<{
1538
1726
  runtime_exited: "runtime_exited";
1539
1727
  unknown: "unknown";
1540
1728
  }>;
1541
- }, z.core.$strict>]>;
1729
+ }, z.core.$strict>, z.ZodObject<{
1730
+ class: z.ZodString;
1731
+ }, z.core.$loose>]>;
1542
1732
  export type TaskFailure = z.infer<typeof TaskFailureSchema>;
1733
+ /** A {@link TaskFailure} as this version understands it: a class it does not know reads as `unknown`, its raw token kept. */
1734
+ export type TaskFailureReading = {
1735
+ readonly class: 'quota';
1736
+ readonly resetsAt?: string;
1737
+ } | {
1738
+ readonly class: Exclude<RuntimeFailureClass, 'quota' | 'unknown'>;
1739
+ } | {
1740
+ readonly class: 'unknown';
1741
+ readonly reportedClass?: string;
1742
+ };
1743
+ export declare function readTaskFailure(failure: TaskFailure): TaskFailureReading;
1543
1744
  /**
1544
1745
  * daemon -> server: a pending `task.await_approval` was resolved entirely
1545
1746
  * LOCALLY on the device — the local control-socket `approvals.resolve` RPC,
@@ -1706,7 +1907,9 @@ export declare const TaskFailSealedPayloadSchema: z.ZodObject<{
1706
1907
  runtime_exited: "runtime_exited";
1707
1908
  unknown: "unknown";
1708
1909
  }>;
1709
- }, z.core.$strict>]>>;
1910
+ }, z.core.$strict>, z.ZodObject<{
1911
+ class: z.ZodString;
1912
+ }, z.core.$loose>]>>;
1710
1913
  usage: z.ZodOptional<z.ZodObject<{
1711
1914
  runtime: z.ZodEnum<{
1712
1915
  claude: "claude";
@@ -1780,6 +1983,23 @@ export declare const TaskDeclineSealedPayloadSchema: z.ZodObject<{
1780
1983
  agentId: z.ZodString;
1781
1984
  profileRevision: z.ZodString;
1782
1985
  }, z.core.$strict>>;
1986
+ runtimeUnavailable: z.ZodOptional<z.ZodObject<{
1987
+ cause: z.ZodUnion<readonly [z.ZodEnum<{
1988
+ acp_unavailable: "acp_unavailable";
1989
+ app_server_unavailable: "app_server_unavailable";
1990
+ environment_unavailable: "environment_unavailable";
1991
+ none_available: "none_available";
1992
+ not_executable: "not_executable";
1993
+ not_installed: "not_installed";
1994
+ platform_unsupported: "platform_unsupported";
1995
+ probe_failed: "probe_failed";
1996
+ probe_timeout: "probe_timeout";
1997
+ runtime_not_allowed: "runtime_not_allowed";
1998
+ runtime_not_configured: "runtime_not_configured";
1999
+ version_blocked: "version_blocked";
2000
+ }>, z.ZodString]>;
2001
+ code: z.ZodOptional<z.ZodString>;
2002
+ }, z.core.$strip>>;
1783
2003
  admission: z.ZodOptional<z.ZodObject<{
1784
2004
  totalMs: z.ZodNumber;
1785
2005
  agentHomeWaitMs: z.ZodOptional<z.ZodNumber>;
@@ -1788,10 +2008,10 @@ export declare const TaskDeclineSealedPayloadSchema: z.ZodObject<{
1788
2008
  toolsetProbeMs: z.ZodOptional<z.ZodNumber>;
1789
2009
  runtimeLaunchMs: z.ZodOptional<z.ZodNumber>;
1790
2010
  }, z.core.$strict>>;
1791
- code: z.ZodOptional<z.ZodEnum<{
2011
+ code: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
1792
2012
  agent_home_reader_busy: "agent_home_reader_busy";
1793
2013
  agent_home_writer_busy: "agent_home_writer_busy";
1794
- }>>;
2014
+ }>, z.ZodString]>>;
1795
2015
  sealed: z.ZodObject<{
1796
2016
  v: z.ZodLiteral<1>;
1797
2017
  suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
@@ -2030,14 +2250,31 @@ export declare const TaskDeclinePayloadSchema: z.ZodUnion<readonly [z.ZodObject<
2030
2250
  agentId: z.ZodString;
2031
2251
  profileRevision: z.ZodString;
2032
2252
  }, z.core.$strict>>;
2033
- code: z.ZodOptional<z.ZodEnum<{
2253
+ code: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
2034
2254
  agent_home_reader_busy: "agent_home_reader_busy";
2035
2255
  agent_home_writer_busy: "agent_home_writer_busy";
2036
2256
  sealed_content_mac_mismatch: "sealed_content_mac_mismatch";
2037
2257
  sealed_key_unavailable: "sealed_key_unavailable";
2038
2258
  sealed_open_failed: "sealed_open_failed";
2039
2259
  sealing_policy_mismatch: "sealing_policy_mismatch";
2040
- }>>;
2260
+ }>, z.ZodString]>>;
2261
+ runtimeUnavailable: z.ZodOptional<z.ZodObject<{
2262
+ cause: z.ZodUnion<readonly [z.ZodEnum<{
2263
+ acp_unavailable: "acp_unavailable";
2264
+ app_server_unavailable: "app_server_unavailable";
2265
+ environment_unavailable: "environment_unavailable";
2266
+ none_available: "none_available";
2267
+ not_executable: "not_executable";
2268
+ not_installed: "not_installed";
2269
+ platform_unsupported: "platform_unsupported";
2270
+ probe_failed: "probe_failed";
2271
+ probe_timeout: "probe_timeout";
2272
+ runtime_not_allowed: "runtime_not_allowed";
2273
+ runtime_not_configured: "runtime_not_configured";
2274
+ version_blocked: "version_blocked";
2275
+ }>, z.ZodString]>;
2276
+ code: z.ZodOptional<z.ZodString>;
2277
+ }, z.core.$strip>>;
2041
2278
  admission: z.ZodOptional<z.ZodObject<{
2042
2279
  totalMs: z.ZodNumber;
2043
2280
  agentHomeWaitMs: z.ZodOptional<z.ZodNumber>;
@@ -2053,6 +2290,23 @@ export declare const TaskDeclinePayloadSchema: z.ZodUnion<readonly [z.ZodObject<
2053
2290
  agentId: z.ZodString;
2054
2291
  profileRevision: z.ZodString;
2055
2292
  }, z.core.$strict>>;
2293
+ runtimeUnavailable: z.ZodOptional<z.ZodObject<{
2294
+ cause: z.ZodUnion<readonly [z.ZodEnum<{
2295
+ acp_unavailable: "acp_unavailable";
2296
+ app_server_unavailable: "app_server_unavailable";
2297
+ environment_unavailable: "environment_unavailable";
2298
+ none_available: "none_available";
2299
+ not_executable: "not_executable";
2300
+ not_installed: "not_installed";
2301
+ platform_unsupported: "platform_unsupported";
2302
+ probe_failed: "probe_failed";
2303
+ probe_timeout: "probe_timeout";
2304
+ runtime_not_allowed: "runtime_not_allowed";
2305
+ runtime_not_configured: "runtime_not_configured";
2306
+ version_blocked: "version_blocked";
2307
+ }>, z.ZodString]>;
2308
+ code: z.ZodOptional<z.ZodString>;
2309
+ }, z.core.$strip>>;
2056
2310
  admission: z.ZodOptional<z.ZodObject<{
2057
2311
  totalMs: z.ZodNumber;
2058
2312
  agentHomeWaitMs: z.ZodOptional<z.ZodNumber>;
@@ -2061,10 +2315,10 @@ export declare const TaskDeclinePayloadSchema: z.ZodUnion<readonly [z.ZodObject<
2061
2315
  toolsetProbeMs: z.ZodOptional<z.ZodNumber>;
2062
2316
  runtimeLaunchMs: z.ZodOptional<z.ZodNumber>;
2063
2317
  }, z.core.$strict>>;
2064
- code: z.ZodOptional<z.ZodEnum<{
2318
+ code: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
2065
2319
  agent_home_reader_busy: "agent_home_reader_busy";
2066
2320
  agent_home_writer_busy: "agent_home_writer_busy";
2067
- }>>;
2321
+ }>, z.ZodString]>>;
2068
2322
  sealed: z.ZodObject<{
2069
2323
  v: z.ZodLiteral<1>;
2070
2324
  suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
@@ -2418,7 +2672,7 @@ export declare const TaskFailPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2418
2672
  offerId: z.ZodUUID;
2419
2673
  }, z.core.$strict>>;
2420
2674
  harnessId: z.ZodOptional<z.ZodString>;
2421
- reason: z.ZodString;
2675
+ reason: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
2422
2676
  retryable: z.ZodOptional<z.ZodBoolean>;
2423
2677
  failure: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
2424
2678
  class: z.ZodLiteral<"quota">;
@@ -2438,7 +2692,9 @@ export declare const TaskFailPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2438
2692
  runtime_exited: "runtime_exited";
2439
2693
  unknown: "unknown";
2440
2694
  }>;
2441
- }, z.core.$strict>]>>;
2695
+ }, z.core.$strict>, z.ZodObject<{
2696
+ class: z.ZodString;
2697
+ }, z.core.$loose>]>>;
2442
2698
  usage: z.ZodOptional<z.ZodObject<{
2443
2699
  runtime: z.ZodEnum<{
2444
2700
  claude: "claude";
@@ -2503,7 +2759,9 @@ export declare const TaskFailPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2503
2759
  runtime_exited: "runtime_exited";
2504
2760
  unknown: "unknown";
2505
2761
  }>;
2506
- }, z.core.$strict>]>>;
2762
+ }, z.core.$strict>, z.ZodObject<{
2763
+ class: z.ZodString;
2764
+ }, z.core.$loose>]>>;
2507
2765
  usage: z.ZodOptional<z.ZodObject<{
2508
2766
  runtime: z.ZodEnum<{
2509
2767
  claude: "claude";
@@ -2724,3 +2982,4 @@ export declare const SERVER_TO_DAEMON_TYPES: readonly ["task.offer", "agent.egre
2724
2982
  * handler or counted `accepted` on the `/byok/messages` wire.
2725
2983
  */
2726
2984
  export declare const DAEMON_TO_SERVER_TYPES: readonly ["task.claim", "task.started", "task.decline", "task.progress", "task.artifact", "task.await_approval", "task.complete", "task.fail", "task.cancelled", "task.approval_resolved", "agent.egress.reliable", "agent.message.draft", "agent.message.publish", "agent.content.receipt"];
2985
+ export {};
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+ /** Any well-formed open-vocabulary token, without a membership rule. */
3
+ export declare function openVocabularyToken(): z.ZodString;
4
+ /** A well-formed token that is none of `known`: the raw value a receiver keeps as `reported<Field>`. */
5
+ export declare function unrecognizedToken(known: readonly string[]): z.ZodString;
package/dist/version.d.ts CHANGED
@@ -69,5 +69,5 @@ export declare const AGENT_HOME_READERS_CAPABILITY: 'agent-home-readers';
69
69
  * MCP configuration.
70
70
  */
71
71
  export declare const CUSTOM_HARNESS_CAPABILITY: 'custom-harness';
72
- export declare const CAPABILITY_FLAGS: readonly ['steer', 'blob-upload', 'dispatch-selection', "provider-profile-binding", 'toolset-selection', 'agent-home-contract', "agent-home-readers", "agent-egress-policy", "agent-egress-reliable-ack", "agent-message-egress", "agent-egress-fresh-session", "agent-content-workspace-read", "agent-content-transcript-read", "agent-content-artifact-read", "agent-home-projection", "agent-input-preparation-v9", "terminal-projection-selection", "host-mcp-task-context", "custom-harness", "mailbox-read-ahead", "provider-provisioning.v1", "agent-memory-intent.v1", "agent-memory-selection", "agent-memory-read-if-admitted", "agent-memory-read-write-if-admitted", 'agent-message-draft', "sealed-payload-v1", "sealed-output-ciphertext-ref", "runtime-failure-class"];
72
+ export declare const CAPABILITY_FLAGS: readonly ['steer', 'blob-upload', 'dispatch-selection', "provider-profile-binding", 'toolset-selection', 'agent-home-contract', "agent-home-readers", "agent-egress-policy", "agent-egress-reliable-ack", "agent-message-egress", "agent-egress-fresh-session", "agent-content-workspace-read", "agent-content-transcript-read", "agent-content-artifact-read", "agent-home-projection", "agent-input-preparation-v9", "terminal-projection-selection", "host-mcp-task-context", "custom-harness", "mailbox-read-ahead", "provider-provisioning.v1", "agent-memory-intent.v1", "agent-memory-selection", "agent-memory-read-if-admitted", "agent-memory-read-write-if-admitted", 'agent-message-draft', "sealed-payload-v1", "sealed-output-ciphertext-ref", "runtime-failure-class", "runtime-unavailable-cause"];
73
73
  export type CapabilityFlag = (typeof CAPABILITY_FLAGS)[number];
@@ -36,7 +36,7 @@
36
36
  */
37
37
  import type { MessageType } from './messages';
38
38
  import type { CapabilityFlag } from './version';
39
- type HttpWireSurface = 'ChallengeRequest' | 'ChallengeResponse' | 'TokenRequest' | 'TokenResponse' | 'EventsPollQuery' | 'EventsPollResponse' | 'MessagesSendRequest' | 'MessagesSendResponse';
39
+ type HttpWireSurface = 'ChallengeRequest' | 'ChallengeResponse' | 'TokenRequest' | 'TokenResponse' | 'PairRequest' | 'PairResponse' | 'EventsPollQuery' | 'EventsPollResponse' | 'MessagesSendRequest' | 'MessagesSendResponse' | 'PresencePublishRequest';
40
40
  export type WireAddition = {
41
41
  readonly kind: 'envelope';
42
42
  readonly rule: 'gated';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byok-sdk/protocol",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "description": "BYOK SDK wire protocol: envelope schema, message types, and codec helpers",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -29,6 +29,10 @@
29
29
  "./constants": {
30
30
  "types": "./dist/constants.d.ts",
31
31
  "import": "./dist/constants.js"
32
+ },
33
+ "./agent-memory": {
34
+ "types": "./dist/agent-memory.d.ts",
35
+ "import": "./dist/agent-memory.js"
32
36
  }
33
37
  },
34
38
  "files": [
@@ -49,7 +53,7 @@
49
53
  },
50
54
  "dependencies": {
51
55
  "@cfworker/json-schema": "4.1.1",
52
- "zod": "^4.4.3"
56
+ "zod": "^4.6.6"
53
57
  },
54
58
  "devDependencies": {
55
59
  "byok-protocol-previous": "https://registry.npmjs.org/@byok-sdk/protocol/-/protocol-0.30.2.tgz"
@@ -1,28 +0,0 @@
1
- /**
2
- * The device-level half of the task lane's capability gate (contract §8.1).
3
- *
4
- * Contract §8.1 fixes ONE name, `host-mcp-task-context`, carried on two
5
- * independent channels that must both be in place before a host may route a
6
- * tool invocation through the task lane:
7
- *
8
- * 1. **Deployment level** — the ADR-010 `CapabilityDeclarationSchema` a
9
- * deployment serves (`@byok-sdk/cloud`'s `CLOUD_CAPABILITIES`). §8.2(1)
10
- * governs it: a deployment declares the capability only once it is
11
- * completely implemented.
12
- * 2. **Device level** — this constant: a `conn.hello` capability string a host
13
- * consumes through `declaresCapabilities`. §8.3 governs it: a device whose
14
- * build cannot serve the lane simply does not advertise it, and the host
15
- * answers `unavailable` rather than reaching for the device assertion the
16
- * task lane does not accept.
17
- *
18
- * It lives in `@byok-sdk/protocol` for the same reason every other daemon
19
- * capability flag does: this package is the wire vocabulary both sides compile
20
- * against, and a name spelled twice is a name that can drift. It is registered
21
- * in `CAPABILITY_FLAGS` (`./version`), which is what makes it a value a daemon
22
- * can actually send.
23
- *
24
- * The spelling satisfies `@byok-sdk/core`'s `CAPABILITY_NAME_PATTERN`
25
- * (`/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/`) on purpose: the deployment-level channel
26
- * carries this exact literal, so a name legal in only one of the two channels
27
- * would leave them naming different things.
28
- */