@byok-sdk/protocol 0.31.0 → 0.33.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>;
@@ -461,6 +626,8 @@ export declare const TaskOfferSealedPayloadSchema: z.ZodObject<{
461
626
  scopeId: z.ZodString;
462
627
  epoch: z.ZodNumber;
463
628
  categories: z.ZodArray<z.ZodEnum<{
629
+ "agent-message": "agent-message";
630
+ "memory-projection": "memory-projection";
464
631
  "task-input": "task-input";
465
632
  "task-output": "task-output";
466
633
  }>>;
@@ -734,6 +901,8 @@ export declare const TaskOfferPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
734
901
  scopeId: z.ZodString;
735
902
  epoch: z.ZodNumber;
736
903
  categories: z.ZodArray<z.ZodEnum<{
904
+ "agent-message": "agent-message";
905
+ "memory-projection": "memory-projection";
737
906
  "task-input": "task-input";
738
907
  "task-output": "task-output";
739
908
  }>>;
@@ -813,7 +982,10 @@ export declare const AgentMessageDraftPayloadSchema: z.ZodObject<{
813
982
  overflow: z.ZodOptional<z.ZodLiteral<true>>;
814
983
  }, z.core.$strict>;
815
984
  export type AgentMessageDraftPayload = z.infer<typeof AgentMessageDraftPayloadSchema>;
816
- export declare const AgentMessagePublishPayloadSchema: z.ZodObject<{
985
+ /** Daemon -> server: one Agent message in plaintext. */
986
+ export declare const AgentMessagePublishPlainPayloadSchema: z.ZodObject<{
987
+ sealed: z.ZodOptional<z.ZodNever>;
988
+ sealing: z.ZodOptional<z.ZodNever>;
817
989
  agentRef: z.ZodObject<{
818
990
  agentId: z.ZodString;
819
991
  profileRevision: z.ZodString;
@@ -830,8 +1002,116 @@ export declare const AgentMessagePublishPayloadSchema: z.ZodObject<{
830
1002
  contentHash: z.ZodString;
831
1003
  byteCount: z.ZodNumber;
832
1004
  }, z.core.$strict>;
1005
+ export type AgentMessagePublishPlainPayload = z.infer<typeof AgentMessagePublishPlainPayloadSchema>;
1006
+ /**
1007
+ * Daemon -> server: one Agent message of a task whose `sealing` lists
1008
+ * `agent-message` (#1045 C2). `body` is sealed; `contentHash` and
1009
+ * `byteCount` are not carried, and `messageId` and `cursor` name the write in
1010
+ * the AAD and the content MAC. Gated on `sealed-payload-v2`.
1011
+ */
1012
+ export declare const AgentMessagePublishSealedPayloadSchema: z.ZodObject<{
1013
+ agentRef: z.ZodObject<{
1014
+ agentId: z.ZodString;
1015
+ profileRevision: z.ZodString;
1016
+ }, z.core.$strict>;
1017
+ sessionRef: z.ZodString;
1018
+ contract: z.ZodString;
1019
+ messageId: z.ZodUUID;
1020
+ cursor: z.ZodNumber;
1021
+ contentType: z.ZodEnum<{
1022
+ "text/markdown": "text/markdown";
1023
+ "text/plain": "text/plain";
1024
+ }>;
1025
+ sealed: z.ZodObject<{
1026
+ v: z.ZodLiteral<1>;
1027
+ suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
1028
+ category: z.ZodLiteral<"agent-message">;
1029
+ scope: z.ZodObject<{
1030
+ id: z.ZodString;
1031
+ epoch: z.ZodNumber;
1032
+ keyId: z.ZodString;
1033
+ }, z.core.$strict>;
1034
+ chainHead: z.ZodObject<{
1035
+ seq: z.ZodNumber;
1036
+ hash: z.ZodString;
1037
+ }, z.core.$strict>;
1038
+ sender: z.ZodString;
1039
+ salt: z.ZodString;
1040
+ nonce: z.ZodString;
1041
+ paddedLength: z.ZodNumber;
1042
+ contentMac: z.ZodString;
1043
+ ciphertext: z.ZodOptional<z.ZodString>;
1044
+ ciphertextRef: z.ZodOptional<z.ZodObject<{
1045
+ blobId: z.ZodString;
1046
+ contentHash: z.ZodString;
1047
+ size: z.ZodNumber;
1048
+ contentType: z.ZodString;
1049
+ }, z.core.$strict>>;
1050
+ }, z.core.$strict>;
1051
+ }, z.core.$strict>;
1052
+ export type AgentMessagePublishSealedPayload = z.infer<typeof AgentMessagePublishSealedPayloadSchema>;
1053
+ /** Narrow with `payload.sealed !== undefined`; the plaintext branch's `sealed` is `never`. */
1054
+ export declare const AgentMessagePublishPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
1055
+ sealed: z.ZodOptional<z.ZodNever>;
1056
+ sealing: z.ZodOptional<z.ZodNever>;
1057
+ agentRef: z.ZodObject<{
1058
+ agentId: z.ZodString;
1059
+ profileRevision: z.ZodString;
1060
+ }, z.core.$strict>;
1061
+ sessionRef: z.ZodString;
1062
+ contract: z.ZodString;
1063
+ messageId: z.ZodUUID;
1064
+ cursor: z.ZodNumber;
1065
+ contentType: z.ZodEnum<{
1066
+ "text/markdown": "text/markdown";
1067
+ "text/plain": "text/plain";
1068
+ }>;
1069
+ body: z.ZodString;
1070
+ contentHash: z.ZodString;
1071
+ byteCount: z.ZodNumber;
1072
+ }, z.core.$strict>, z.ZodObject<{
1073
+ agentRef: z.ZodObject<{
1074
+ agentId: z.ZodString;
1075
+ profileRevision: z.ZodString;
1076
+ }, z.core.$strict>;
1077
+ sessionRef: z.ZodString;
1078
+ contract: z.ZodString;
1079
+ messageId: z.ZodUUID;
1080
+ cursor: z.ZodNumber;
1081
+ contentType: z.ZodEnum<{
1082
+ "text/markdown": "text/markdown";
1083
+ "text/plain": "text/plain";
1084
+ }>;
1085
+ sealed: z.ZodObject<{
1086
+ v: z.ZodLiteral<1>;
1087
+ suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
1088
+ category: z.ZodLiteral<"agent-message">;
1089
+ scope: z.ZodObject<{
1090
+ id: z.ZodString;
1091
+ epoch: z.ZodNumber;
1092
+ keyId: z.ZodString;
1093
+ }, z.core.$strict>;
1094
+ chainHead: z.ZodObject<{
1095
+ seq: z.ZodNumber;
1096
+ hash: z.ZodString;
1097
+ }, z.core.$strict>;
1098
+ sender: z.ZodString;
1099
+ salt: z.ZodString;
1100
+ nonce: z.ZodString;
1101
+ paddedLength: z.ZodNumber;
1102
+ contentMac: z.ZodString;
1103
+ ciphertext: z.ZodOptional<z.ZodString>;
1104
+ ciphertextRef: z.ZodOptional<z.ZodObject<{
1105
+ blobId: z.ZodString;
1106
+ contentHash: z.ZodString;
1107
+ size: z.ZodNumber;
1108
+ contentType: z.ZodString;
1109
+ }, z.core.$strict>>;
1110
+ }, z.core.$strict>;
1111
+ }, z.core.$strict>]>;
833
1112
  export type AgentMessagePublishPayload = z.infer<typeof AgentMessagePublishPayloadSchema>;
834
- export declare const AgentMessageDispositionPayloadSchema: z.ZodObject<{
1113
+ /** Server -> daemon: the disposition of a plaintext message, naming its `contentHash`. */
1114
+ export declare const AgentMessageDispositionPlainPayloadSchema: z.ZodObject<{
835
1115
  agentRef: z.ZodObject<{
836
1116
  agentId: z.ZodString;
837
1117
  profileRevision: z.ZodString;
@@ -840,7 +1120,31 @@ export declare const AgentMessageDispositionPayloadSchema: z.ZodObject<{
840
1120
  contract: z.ZodString;
841
1121
  messageId: z.ZodUUID;
842
1122
  cursor: z.ZodNumber;
1123
+ outcome: z.ZodEnum<{
1124
+ accepted: "accepted";
1125
+ held: "held";
1126
+ refused: "refused";
1127
+ }>;
1128
+ receiptId: z.ZodUUID;
1129
+ reasonCode: z.ZodOptional<z.ZodString>;
843
1130
  contentHash: z.ZodString;
1131
+ contentMac: z.ZodOptional<z.ZodNever>;
1132
+ }, z.core.$strict>;
1133
+ export type AgentMessageDispositionPlainPayload = z.infer<typeof AgentMessageDispositionPlainPayloadSchema>;
1134
+ /**
1135
+ * Server -> daemon: the disposition of a sealed message (#1045 C2). It names
1136
+ * the message by its sealed member's `contentMac`, because the sealed message
1137
+ * carries no `contentHash`. Gated on `sealed-payload-v2`.
1138
+ */
1139
+ export declare const AgentMessageDispositionSealedPayloadSchema: z.ZodObject<{
1140
+ agentRef: z.ZodObject<{
1141
+ agentId: z.ZodString;
1142
+ profileRevision: z.ZodString;
1143
+ }, z.core.$strict>;
1144
+ sessionRef: z.ZodString;
1145
+ contract: z.ZodString;
1146
+ messageId: z.ZodUUID;
1147
+ cursor: z.ZodNumber;
844
1148
  outcome: z.ZodEnum<{
845
1149
  accepted: "accepted";
846
1150
  held: "held";
@@ -848,7 +1152,48 @@ export declare const AgentMessageDispositionPayloadSchema: z.ZodObject<{
848
1152
  }>;
849
1153
  receiptId: z.ZodUUID;
850
1154
  reasonCode: z.ZodOptional<z.ZodString>;
1155
+ contentMac: z.ZodString;
1156
+ contentHash: z.ZodOptional<z.ZodNever>;
851
1157
  }, z.core.$strict>;
1158
+ export type AgentMessageDispositionSealedPayload = z.infer<typeof AgentMessageDispositionSealedPayloadSchema>;
1159
+ /** Narrow with `payload.contentMac !== undefined`. */
1160
+ export declare const AgentMessageDispositionPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
1161
+ agentRef: z.ZodObject<{
1162
+ agentId: z.ZodString;
1163
+ profileRevision: z.ZodString;
1164
+ }, z.core.$strict>;
1165
+ sessionRef: z.ZodString;
1166
+ contract: z.ZodString;
1167
+ messageId: z.ZodUUID;
1168
+ cursor: z.ZodNumber;
1169
+ outcome: z.ZodEnum<{
1170
+ accepted: "accepted";
1171
+ held: "held";
1172
+ refused: "refused";
1173
+ }>;
1174
+ receiptId: z.ZodUUID;
1175
+ reasonCode: z.ZodOptional<z.ZodString>;
1176
+ contentHash: z.ZodString;
1177
+ contentMac: z.ZodOptional<z.ZodNever>;
1178
+ }, z.core.$strict>, z.ZodObject<{
1179
+ agentRef: z.ZodObject<{
1180
+ agentId: z.ZodString;
1181
+ profileRevision: z.ZodString;
1182
+ }, z.core.$strict>;
1183
+ sessionRef: z.ZodString;
1184
+ contract: z.ZodString;
1185
+ messageId: z.ZodUUID;
1186
+ cursor: z.ZodNumber;
1187
+ outcome: z.ZodEnum<{
1188
+ accepted: "accepted";
1189
+ held: "held";
1190
+ refused: "refused";
1191
+ }>;
1192
+ receiptId: z.ZodUUID;
1193
+ reasonCode: z.ZodOptional<z.ZodString>;
1194
+ contentMac: z.ZodString;
1195
+ contentHash: z.ZodOptional<z.ZodNever>;
1196
+ }, z.core.$strict>]>;
852
1197
  export type AgentMessageDispositionPayload = z.infer<typeof AgentMessageDispositionPayloadSchema>;
853
1198
  /** Server -> daemon: one exact, independently-capability-gated content read. */
854
1199
  export declare const AgentContentReadPayloadSchema: z.ZodObject<{
@@ -973,7 +1318,7 @@ export declare const AgentContentReceiptPayloadSchema: z.ZodDiscriminatedUnion<[
973
1318
  }>;
974
1319
  decision: z.ZodLiteral<"denied">;
975
1320
  byteCount: z.ZodLiteral<0>;
976
- reason: z.ZodEnum<{
1321
+ reason: z.ZodUnion<readonly [z.ZodEnum<{
977
1322
  "absolute-target": "absolute-target";
978
1323
  "byte-limit": "byte-limit";
979
1324
  "capability-missing": "capability-missing";
@@ -993,7 +1338,7 @@ export declare const AgentContentReceiptPayloadSchema: z.ZodDiscriminatedUnion<[
993
1338
  "target-missing": "target-missing";
994
1339
  "text-decode-failed": "text-decode-failed";
995
1340
  "text-not-allowlisted": "text-not-allowlisted";
996
- }>;
1341
+ }>, z.ZodString]>;
997
1342
  }, z.core.$strict>], "decision">;
998
1343
  export type AgentContentReceiptPayload = z.infer<typeof AgentContentReceiptPayloadSchema>;
999
1344
  /**
@@ -1295,6 +1640,14 @@ export declare const TaskClaimPayloadSchema: z.ZodObject<{
1295
1640
  approvalInteractive: z.ZodOptional<z.ZodBoolean>;
1296
1641
  mcpToolsets: z.ZodOptional<z.ZodBoolean>;
1297
1642
  messageDraft: z.ZodOptional<z.ZodBoolean>;
1643
+ toolAuthorizationAuto: z.ZodOptional<z.ZodBoolean>;
1644
+ durablePi: z.ZodOptional<z.ZodBoolean>;
1645
+ preparedLane: z.ZodOptional<z.ZodBoolean>;
1646
+ isolation: z.ZodOptional<z.ZodObject<{
1647
+ userContext: z.ZodOptional<z.ZodBoolean>;
1648
+ userMcpServers: z.ZodOptional<z.ZodBoolean>;
1649
+ sessionPersistence: z.ZodOptional<z.ZodBoolean>;
1650
+ }, z.core.$strip>>;
1298
1651
  }, z.core.$strip>>;
1299
1652
  admission: z.ZodOptional<z.ZodObject<{
1300
1653
  totalMs: z.ZodNumber;
@@ -1313,6 +1666,16 @@ export type TaskClaimPayload = z.infer<typeof TaskClaimPayloadSchema>;
1313
1666
  */
1314
1667
  export declare const TaskStartedPayloadSchema: z.ZodObject<{}, z.core.$strip>;
1315
1668
  export type TaskStartedPayload = z.infer<typeof TaskStartedPayloadSchema>;
1669
+ 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"];
1670
+ export type TaskDeclineCode = (typeof DECLINE_CODES)[number];
1671
+ /** A decline code as this version understands it: one it does not know reads as `unknown`, its raw token kept. */
1672
+ export type TaskDeclineCodeReading = {
1673
+ readonly code: TaskDeclineCode;
1674
+ } | {
1675
+ readonly code: 'unknown';
1676
+ readonly reportedCode: string;
1677
+ };
1678
+ export declare function readDeclineCode(code: string): TaskDeclineCodeReading;
1316
1679
  /**
1317
1680
  * Hard cap (1 MiB) on a single `task.complete.document` (see
1318
1681
  * {@link TaskCompletePayloadSchema}), measured as the UTF-8 byte length of
@@ -1498,7 +1861,7 @@ export declare const TerminalAgentHomeMemoryChangeSchema: z.ZodDiscriminatedUnio
1498
1861
  outcome: z.ZodLiteral<"unmeasured">;
1499
1862
  }, z.core.$strict>], "outcome">;
1500
1863
  export type TerminalAgentHomeMemoryChange = z.infer<typeof TerminalAgentHomeMemoryChangeSchema>;
1501
- /** A closed runtime failure class (#869). `unknown` means the runtime gave no structured evidence. */
1864
+ /** A runtime failure class this version knows (#869). `unknown` means the runtime gave no structured evidence. */
1502
1865
  export declare const RuntimeFailureClassSchema: z.ZodEnum<{
1503
1866
  auth: "auth";
1504
1867
  billing: "billing";
@@ -1515,14 +1878,30 @@ export declare const RuntimeFailureClassSchema: z.ZodEnum<{
1515
1878
  unknown: "unknown";
1516
1879
  }>;
1517
1880
  export type RuntimeFailureClass = z.infer<typeof RuntimeFailureClassSchema>;
1881
+ /** Whether a `quota` limit covers the whole account or one model (#1271). */
1882
+ export declare const RuntimeQuotaScopeSchema: z.ZodEnum<{
1883
+ account: "account";
1884
+ model: "model";
1885
+ }>;
1886
+ export type RuntimeQuotaScope = z.infer<typeof RuntimeQuotaScopeSchema>;
1518
1887
  /**
1519
1888
  * The machine-readable failure of a `task.fail` (#869); `reason` stays display
1520
- * text. `resetsAt` (ISO 8601 UTC) exists only on `quota`, and only when the
1521
- * runtime reported when the limit resets.
1889
+ * text. `resetsAt` (ISO 8601 UTC) and `scope` exist only on `quota`, and only
1890
+ * when the runtime reported them. `scope` is gated on the server's
1891
+ * `runtime-quota-scope` flag (#1271).
1892
+ *
1893
+ * The class is open (#1121): a well-formed class this version does not know,
1894
+ * with whatever fields a newer device put beside it, is accepted and kept
1895
+ * verbatim, so the terminal is still recorded. {@link readTaskFailure} is the
1896
+ * typed reading.
1522
1897
  */
1523
1898
  export declare const TaskFailureSchema: z.ZodUnion<readonly [z.ZodObject<{
1524
1899
  class: z.ZodLiteral<"quota">;
1525
1900
  resetsAt: z.ZodOptional<z.ZodISODateTime>;
1901
+ scope: z.ZodOptional<z.ZodEnum<{
1902
+ account: "account";
1903
+ model: "model";
1904
+ }>>;
1526
1905
  }, z.core.$strict>, z.ZodObject<{
1527
1906
  class: z.ZodEnum<{
1528
1907
  auth: "auth";
@@ -1538,8 +1917,22 @@ export declare const TaskFailureSchema: z.ZodUnion<readonly [z.ZodObject<{
1538
1917
  runtime_exited: "runtime_exited";
1539
1918
  unknown: "unknown";
1540
1919
  }>;
1541
- }, z.core.$strict>]>;
1920
+ }, z.core.$strict>, z.ZodObject<{
1921
+ class: z.ZodString;
1922
+ }, z.core.$loose>]>;
1542
1923
  export type TaskFailure = z.infer<typeof TaskFailureSchema>;
1924
+ /** A {@link TaskFailure} as this version understands it: a class it does not know reads as `unknown`, its raw token kept. */
1925
+ export type TaskFailureReading = {
1926
+ readonly class: 'quota';
1927
+ readonly resetsAt?: string;
1928
+ readonly scope?: RuntimeQuotaScope;
1929
+ } | {
1930
+ readonly class: Exclude<RuntimeFailureClass, 'quota' | 'unknown'>;
1931
+ } | {
1932
+ readonly class: 'unknown';
1933
+ readonly reportedClass?: string;
1934
+ };
1935
+ export declare function readTaskFailure(failure: TaskFailure): TaskFailureReading;
1543
1936
  /**
1544
1937
  * daemon -> server: a pending `task.await_approval` was resolved entirely
1545
1938
  * LOCALLY on the device — the local control-socket `approvals.resolve` RPC,
@@ -1691,6 +2084,10 @@ export declare const TaskFailSealedPayloadSchema: z.ZodObject<{
1691
2084
  failure: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1692
2085
  class: z.ZodLiteral<"quota">;
1693
2086
  resetsAt: z.ZodOptional<z.ZodISODateTime>;
2087
+ scope: z.ZodOptional<z.ZodEnum<{
2088
+ account: "account";
2089
+ model: "model";
2090
+ }>>;
1694
2091
  }, z.core.$strict>, z.ZodObject<{
1695
2092
  class: z.ZodEnum<{
1696
2093
  auth: "auth";
@@ -1706,7 +2103,9 @@ export declare const TaskFailSealedPayloadSchema: z.ZodObject<{
1706
2103
  runtime_exited: "runtime_exited";
1707
2104
  unknown: "unknown";
1708
2105
  }>;
1709
- }, z.core.$strict>]>>;
2106
+ }, z.core.$strict>, z.ZodObject<{
2107
+ class: z.ZodString;
2108
+ }, z.core.$loose>]>>;
1710
2109
  usage: z.ZodOptional<z.ZodObject<{
1711
2110
  runtime: z.ZodEnum<{
1712
2111
  claude: "claude";
@@ -1780,6 +2179,23 @@ export declare const TaskDeclineSealedPayloadSchema: z.ZodObject<{
1780
2179
  agentId: z.ZodString;
1781
2180
  profileRevision: z.ZodString;
1782
2181
  }, z.core.$strict>>;
2182
+ runtimeUnavailable: z.ZodOptional<z.ZodObject<{
2183
+ cause: z.ZodUnion<readonly [z.ZodEnum<{
2184
+ acp_unavailable: "acp_unavailable";
2185
+ app_server_unavailable: "app_server_unavailable";
2186
+ environment_unavailable: "environment_unavailable";
2187
+ none_available: "none_available";
2188
+ not_executable: "not_executable";
2189
+ not_installed: "not_installed";
2190
+ platform_unsupported: "platform_unsupported";
2191
+ probe_failed: "probe_failed";
2192
+ probe_timeout: "probe_timeout";
2193
+ runtime_not_allowed: "runtime_not_allowed";
2194
+ runtime_not_configured: "runtime_not_configured";
2195
+ version_blocked: "version_blocked";
2196
+ }>, z.ZodString]>;
2197
+ code: z.ZodOptional<z.ZodString>;
2198
+ }, z.core.$strip>>;
1783
2199
  admission: z.ZodOptional<z.ZodObject<{
1784
2200
  totalMs: z.ZodNumber;
1785
2201
  agentHomeWaitMs: z.ZodOptional<z.ZodNumber>;
@@ -1788,10 +2204,10 @@ export declare const TaskDeclineSealedPayloadSchema: z.ZodObject<{
1788
2204
  toolsetProbeMs: z.ZodOptional<z.ZodNumber>;
1789
2205
  runtimeLaunchMs: z.ZodOptional<z.ZodNumber>;
1790
2206
  }, z.core.$strict>>;
1791
- code: z.ZodOptional<z.ZodEnum<{
2207
+ code: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
1792
2208
  agent_home_reader_busy: "agent_home_reader_busy";
1793
2209
  agent_home_writer_busy: "agent_home_writer_busy";
1794
- }>>;
2210
+ }>, z.ZodString]>>;
1795
2211
  sealed: z.ZodObject<{
1796
2212
  v: z.ZodLiteral<1>;
1797
2213
  suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
@@ -2030,14 +2446,31 @@ export declare const TaskDeclinePayloadSchema: z.ZodUnion<readonly [z.ZodObject<
2030
2446
  agentId: z.ZodString;
2031
2447
  profileRevision: z.ZodString;
2032
2448
  }, z.core.$strict>>;
2033
- code: z.ZodOptional<z.ZodEnum<{
2449
+ code: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
2034
2450
  agent_home_reader_busy: "agent_home_reader_busy";
2035
2451
  agent_home_writer_busy: "agent_home_writer_busy";
2036
2452
  sealed_content_mac_mismatch: "sealed_content_mac_mismatch";
2037
2453
  sealed_key_unavailable: "sealed_key_unavailable";
2038
2454
  sealed_open_failed: "sealed_open_failed";
2039
2455
  sealing_policy_mismatch: "sealing_policy_mismatch";
2040
- }>>;
2456
+ }>, z.ZodString]>>;
2457
+ runtimeUnavailable: z.ZodOptional<z.ZodObject<{
2458
+ cause: z.ZodUnion<readonly [z.ZodEnum<{
2459
+ acp_unavailable: "acp_unavailable";
2460
+ app_server_unavailable: "app_server_unavailable";
2461
+ environment_unavailable: "environment_unavailable";
2462
+ none_available: "none_available";
2463
+ not_executable: "not_executable";
2464
+ not_installed: "not_installed";
2465
+ platform_unsupported: "platform_unsupported";
2466
+ probe_failed: "probe_failed";
2467
+ probe_timeout: "probe_timeout";
2468
+ runtime_not_allowed: "runtime_not_allowed";
2469
+ runtime_not_configured: "runtime_not_configured";
2470
+ version_blocked: "version_blocked";
2471
+ }>, z.ZodString]>;
2472
+ code: z.ZodOptional<z.ZodString>;
2473
+ }, z.core.$strip>>;
2041
2474
  admission: z.ZodOptional<z.ZodObject<{
2042
2475
  totalMs: z.ZodNumber;
2043
2476
  agentHomeWaitMs: z.ZodOptional<z.ZodNumber>;
@@ -2053,6 +2486,23 @@ export declare const TaskDeclinePayloadSchema: z.ZodUnion<readonly [z.ZodObject<
2053
2486
  agentId: z.ZodString;
2054
2487
  profileRevision: z.ZodString;
2055
2488
  }, z.core.$strict>>;
2489
+ runtimeUnavailable: z.ZodOptional<z.ZodObject<{
2490
+ cause: z.ZodUnion<readonly [z.ZodEnum<{
2491
+ acp_unavailable: "acp_unavailable";
2492
+ app_server_unavailable: "app_server_unavailable";
2493
+ environment_unavailable: "environment_unavailable";
2494
+ none_available: "none_available";
2495
+ not_executable: "not_executable";
2496
+ not_installed: "not_installed";
2497
+ platform_unsupported: "platform_unsupported";
2498
+ probe_failed: "probe_failed";
2499
+ probe_timeout: "probe_timeout";
2500
+ runtime_not_allowed: "runtime_not_allowed";
2501
+ runtime_not_configured: "runtime_not_configured";
2502
+ version_blocked: "version_blocked";
2503
+ }>, z.ZodString]>;
2504
+ code: z.ZodOptional<z.ZodString>;
2505
+ }, z.core.$strip>>;
2056
2506
  admission: z.ZodOptional<z.ZodObject<{
2057
2507
  totalMs: z.ZodNumber;
2058
2508
  agentHomeWaitMs: z.ZodOptional<z.ZodNumber>;
@@ -2061,10 +2511,10 @@ export declare const TaskDeclinePayloadSchema: z.ZodUnion<readonly [z.ZodObject<
2061
2511
  toolsetProbeMs: z.ZodOptional<z.ZodNumber>;
2062
2512
  runtimeLaunchMs: z.ZodOptional<z.ZodNumber>;
2063
2513
  }, z.core.$strict>>;
2064
- code: z.ZodOptional<z.ZodEnum<{
2514
+ code: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
2065
2515
  agent_home_reader_busy: "agent_home_reader_busy";
2066
2516
  agent_home_writer_busy: "agent_home_writer_busy";
2067
- }>>;
2517
+ }>, z.ZodString]>>;
2068
2518
  sealed: z.ZodObject<{
2069
2519
  v: z.ZodLiteral<1>;
2070
2520
  suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
@@ -2418,11 +2868,15 @@ export declare const TaskFailPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2418
2868
  offerId: z.ZodUUID;
2419
2869
  }, z.core.$strict>>;
2420
2870
  harnessId: z.ZodOptional<z.ZodString>;
2421
- reason: z.ZodString;
2871
+ reason: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
2422
2872
  retryable: z.ZodOptional<z.ZodBoolean>;
2423
2873
  failure: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
2424
2874
  class: z.ZodLiteral<"quota">;
2425
2875
  resetsAt: z.ZodOptional<z.ZodISODateTime>;
2876
+ scope: z.ZodOptional<z.ZodEnum<{
2877
+ account: "account";
2878
+ model: "model";
2879
+ }>>;
2426
2880
  }, z.core.$strict>, z.ZodObject<{
2427
2881
  class: z.ZodEnum<{
2428
2882
  auth: "auth";
@@ -2438,7 +2892,9 @@ export declare const TaskFailPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2438
2892
  runtime_exited: "runtime_exited";
2439
2893
  unknown: "unknown";
2440
2894
  }>;
2441
- }, z.core.$strict>]>>;
2895
+ }, z.core.$strict>, z.ZodObject<{
2896
+ class: z.ZodString;
2897
+ }, z.core.$loose>]>>;
2442
2898
  usage: z.ZodOptional<z.ZodObject<{
2443
2899
  runtime: z.ZodEnum<{
2444
2900
  claude: "claude";
@@ -2488,6 +2944,10 @@ export declare const TaskFailPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2488
2944
  failure: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
2489
2945
  class: z.ZodLiteral<"quota">;
2490
2946
  resetsAt: z.ZodOptional<z.ZodISODateTime>;
2947
+ scope: z.ZodOptional<z.ZodEnum<{
2948
+ account: "account";
2949
+ model: "model";
2950
+ }>>;
2491
2951
  }, z.core.$strict>, z.ZodObject<{
2492
2952
  class: z.ZodEnum<{
2493
2953
  auth: "auth";
@@ -2503,7 +2963,9 @@ export declare const TaskFailPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2503
2963
  runtime_exited: "runtime_exited";
2504
2964
  unknown: "unknown";
2505
2965
  }>;
2506
- }, z.core.$strict>]>>;
2966
+ }, z.core.$strict>, z.ZodObject<{
2967
+ class: z.ZodString;
2968
+ }, z.core.$loose>]>>;
2507
2969
  usage: z.ZodOptional<z.ZodObject<{
2508
2970
  runtime: z.ZodEnum<{
2509
2971
  claude: "claude";
@@ -2724,3 +3186,4 @@ export declare const SERVER_TO_DAEMON_TYPES: readonly ["task.offer", "agent.egre
2724
3186
  * handler or counted `accepted` on the `/byok/messages` wire.
2725
3187
  */
2726
3188
  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"];
3189
+ export {};