@byok-sdk/protocol 0.32.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.
@@ -626,6 +626,8 @@ export declare const TaskOfferSealedPayloadSchema: z.ZodObject<{
626
626
  scopeId: z.ZodString;
627
627
  epoch: z.ZodNumber;
628
628
  categories: z.ZodArray<z.ZodEnum<{
629
+ "agent-message": "agent-message";
630
+ "memory-projection": "memory-projection";
629
631
  "task-input": "task-input";
630
632
  "task-output": "task-output";
631
633
  }>>;
@@ -899,6 +901,8 @@ export declare const TaskOfferPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
899
901
  scopeId: z.ZodString;
900
902
  epoch: z.ZodNumber;
901
903
  categories: z.ZodArray<z.ZodEnum<{
904
+ "agent-message": "agent-message";
905
+ "memory-projection": "memory-projection";
902
906
  "task-input": "task-input";
903
907
  "task-output": "task-output";
904
908
  }>>;
@@ -978,7 +982,10 @@ export declare const AgentMessageDraftPayloadSchema: z.ZodObject<{
978
982
  overflow: z.ZodOptional<z.ZodLiteral<true>>;
979
983
  }, z.core.$strict>;
980
984
  export type AgentMessageDraftPayload = z.infer<typeof AgentMessageDraftPayloadSchema>;
981
- 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>;
982
989
  agentRef: z.ZodObject<{
983
990
  agentId: z.ZodString;
984
991
  profileRevision: z.ZodString;
@@ -995,8 +1002,116 @@ export declare const AgentMessagePublishPayloadSchema: z.ZodObject<{
995
1002
  contentHash: z.ZodString;
996
1003
  byteCount: z.ZodNumber;
997
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>]>;
998
1112
  export type AgentMessagePublishPayload = z.infer<typeof AgentMessagePublishPayloadSchema>;
999
- 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<{
1000
1115
  agentRef: z.ZodObject<{
1001
1116
  agentId: z.ZodString;
1002
1117
  profileRevision: z.ZodString;
@@ -1005,7 +1120,31 @@ export declare const AgentMessageDispositionPayloadSchema: z.ZodObject<{
1005
1120
  contract: z.ZodString;
1006
1121
  messageId: z.ZodUUID;
1007
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>;
1008
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;
1009
1148
  outcome: z.ZodEnum<{
1010
1149
  accepted: "accepted";
1011
1150
  held: "held";
@@ -1013,7 +1152,48 @@ export declare const AgentMessageDispositionPayloadSchema: z.ZodObject<{
1013
1152
  }>;
1014
1153
  receiptId: z.ZodUUID;
1015
1154
  reasonCode: z.ZodOptional<z.ZodString>;
1155
+ contentMac: z.ZodString;
1156
+ contentHash: z.ZodOptional<z.ZodNever>;
1016
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>]>;
1017
1197
  export type AgentMessageDispositionPayload = z.infer<typeof AgentMessageDispositionPayloadSchema>;
1018
1198
  /** Server -> daemon: one exact, independently-capability-gated content read. */
1019
1199
  export declare const AgentContentReadPayloadSchema: z.ZodObject<{
@@ -1698,10 +1878,17 @@ export declare const RuntimeFailureClassSchema: z.ZodEnum<{
1698
1878
  unknown: "unknown";
1699
1879
  }>;
1700
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>;
1701
1887
  /**
1702
1888
  * The machine-readable failure of a `task.fail` (#869); `reason` stays display
1703
- * text. `resetsAt` (ISO 8601 UTC) exists only on `quota`, and only when the
1704
- * 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).
1705
1892
  *
1706
1893
  * The class is open (#1121): a well-formed class this version does not know,
1707
1894
  * with whatever fields a newer device put beside it, is accepted and kept
@@ -1711,6 +1898,10 @@ export type RuntimeFailureClass = z.infer<typeof RuntimeFailureClassSchema>;
1711
1898
  export declare const TaskFailureSchema: z.ZodUnion<readonly [z.ZodObject<{
1712
1899
  class: z.ZodLiteral<"quota">;
1713
1900
  resetsAt: z.ZodOptional<z.ZodISODateTime>;
1901
+ scope: z.ZodOptional<z.ZodEnum<{
1902
+ account: "account";
1903
+ model: "model";
1904
+ }>>;
1714
1905
  }, z.core.$strict>, z.ZodObject<{
1715
1906
  class: z.ZodEnum<{
1716
1907
  auth: "auth";
@@ -1734,6 +1925,7 @@ export type TaskFailure = z.infer<typeof TaskFailureSchema>;
1734
1925
  export type TaskFailureReading = {
1735
1926
  readonly class: 'quota';
1736
1927
  readonly resetsAt?: string;
1928
+ readonly scope?: RuntimeQuotaScope;
1737
1929
  } | {
1738
1930
  readonly class: Exclude<RuntimeFailureClass, 'quota' | 'unknown'>;
1739
1931
  } | {
@@ -1892,6 +2084,10 @@ export declare const TaskFailSealedPayloadSchema: z.ZodObject<{
1892
2084
  failure: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1893
2085
  class: z.ZodLiteral<"quota">;
1894
2086
  resetsAt: z.ZodOptional<z.ZodISODateTime>;
2087
+ scope: z.ZodOptional<z.ZodEnum<{
2088
+ account: "account";
2089
+ model: "model";
2090
+ }>>;
1895
2091
  }, z.core.$strict>, z.ZodObject<{
1896
2092
  class: z.ZodEnum<{
1897
2093
  auth: "auth";
@@ -2677,6 +2873,10 @@ export declare const TaskFailPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2677
2873
  failure: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
2678
2874
  class: z.ZodLiteral<"quota">;
2679
2875
  resetsAt: z.ZodOptional<z.ZodISODateTime>;
2876
+ scope: z.ZodOptional<z.ZodEnum<{
2877
+ account: "account";
2878
+ model: "model";
2879
+ }>>;
2680
2880
  }, z.core.$strict>, z.ZodObject<{
2681
2881
  class: z.ZodEnum<{
2682
2882
  auth: "auth";
@@ -2744,6 +2944,10 @@ export declare const TaskFailPayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
2744
2944
  failure: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
2745
2945
  class: z.ZodLiteral<"quota">;
2746
2946
  resetsAt: z.ZodOptional<z.ZodISODateTime>;
2947
+ scope: z.ZodOptional<z.ZodEnum<{
2948
+ account: "account";
2949
+ model: "model";
2950
+ }>>;
2747
2951
  }, z.core.$strict>, z.ZodObject<{
2748
2952
  class: z.ZodEnum<{
2749
2953
  auth: "auth";
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Sealed payload v1 on the hosted wire (#654 design §8.1, §8.3, §8.6).
2
+ * Sealed payload on the hosted wire: v1 (#654 design §8.1, §8.3, §8.6) and
3
+ * the v2 categories (#1045).
3
4
  *
4
5
  * Sealed is a property of the payload, not a message type: each sealable
5
6
  * type's payload is a plaintext branch or a sealed branch. The sealed branch is
@@ -19,20 +20,17 @@
19
20
  * length function; a cross-package test keeps the two equal.
20
21
  */
21
22
  import { z } from 'zod';
22
- export { SEALED_SPLIT_TABLE, isSealableMessageType, isSealedPayload } from './sealed-split-table';
23
+ export { SEALED_SPLIT_TABLE, isSealableMessageType, isSealedPayload, sealedMovedFields } from './sealed-split-table';
23
24
  export type { SealableMessageType, SealedDigestRule, SealedSplitEntry } from './sealed-split-table';
24
25
  export declare const SEALED_PAYLOAD_VERSION = 1;
25
26
  /** The only suite v1 admits. A new suite is a new constant and a new capability, never a parser branch. */
26
27
  export declare const SEALED_PAYLOAD_SUITE = "byok-sealed-v1.hkdf-sha256.aes-256-gcm";
27
- /** C1–C4 in canonical order. A task lists its sealing categories in this order. */
28
- export declare const SEALED_PAYLOAD_CATEGORIES: readonly ['task-input', 'agent-message', 'task-output', 'memory-projection'];
29
- export type SealedPayloadCategory = (typeof SEALED_PAYLOAD_CATEGORIES)[number];
30
28
  /**
31
- * The categories a v1 task may seal (D17): task input and task output. Agent
32
- * messages, memory projections, input preparation and drafts come later.
29
+ * C1–C4 in canonical order. A task lists its sealing categories in this order.
30
+ * Input preparation and drafts have no category; they stay plaintext.
33
31
  */
34
- export declare const SEALED_PAYLOAD_V1_CATEGORIES: readonly ['task-input', 'task-output'];
35
- export type SealedPayloadV1Category = (typeof SEALED_PAYLOAD_V1_CATEGORIES)[number];
32
+ export declare const SEALED_PAYLOAD_CATEGORIES: readonly ['task-input', 'agent-message', 'task-output', 'memory-projection'];
33
+ export type SealedPayloadCategory = (typeof SEALED_PAYLOAD_CATEGORIES)[number];
36
34
  /**
37
35
  * Closed `task.decline` codes of a receiver that refuses sealed task input
38
36
  * (§8.3). They are plaintext: a device without the scope key cannot seal a
@@ -64,23 +62,34 @@ export declare const SEALED_TASK_PLAIN_CODES: Readonly<{
64
62
  }>;
65
63
  /**
66
64
  * True when `payload` is a legal plaintext `type` message of a task whose
67
- * output is sealed: each field that the `task-output` sealed branch of `type`
68
- * moves or drops is absent or holds one of {@link SEALED_TASK_PLAIN_CODES}.
69
- * A type that has a sealed output branch and is not listed there is never
70
- * legal. A plaintext decline also names its code as `code`. A type with no
71
- * sealed output branch is always legal.
65
+ * output is sealed under `categories`: each field that the `task-output`
66
+ * sealed branch of `type` moves (with the `movedWith` fields of `categories`)
67
+ * or drops is absent or holds one of {@link SEALED_TASK_PLAIN_CODES}. A type
68
+ * that has a sealed output branch and is not listed there is never legal. A
69
+ * plaintext decline also names its code as `code`. A type with no sealed
70
+ * output branch is always legal.
72
71
  */
73
- export declare function isSealedTaskPlainOutput(type: string, payload: object): boolean;
72
+ export declare function isSealedTaskPlainOutput(type: string, payload: object, categories: readonly SealedPayloadCategory[]): boolean;
74
73
  /** Padded frames above this length travel as a ciphertext blob (§8.6). */
75
74
  export declare const SEALED_INLINE_MAX_PADDED_LENGTH: number;
76
- /** Plaintext limit of every v1 category, in UTF-8 bytes of canonical JSON (D8). */
75
+ /** Plaintext limit of every category, in UTF-8 bytes of canonical JSON (D8). */
77
76
  export declare const SEALED_PAYLOAD_MAX_CONTENT_LENGTH: number;
77
+ /**
78
+ * The largest opened content of a sealed `agent.message.publish` whose body
79
+ * is at most `maxBytes` UTF-8 bytes (#1045 O2): `6 × maxBytes + 11`. At
80
+ * `AGENT_MESSAGE_MAX_BYTES` it is 1,572,875, below
81
+ * {@link SEALED_PAYLOAD_MAX_CONTENT_LENGTH}, so every legal body seals. The
82
+ * device seals within it, and the Host bounds a sealed message's
83
+ * `paddedLength` by `sealedPayloadPaddedLength(4 + this)` for the task's
84
+ * frozen `maxBytes`.
85
+ */
86
+ export declare function sealedAgentMessageMaxContentLength(maxBytes: number): number;
78
87
  /**
79
88
  * The one legal padded length of a frame of `frameLength` bytes
80
89
  * (`4 + contentLength`): the next multiple of 256 up to 16 KiB, Padmé above.
81
90
  */
82
91
  export declare function sealedPayloadPaddedLength(frameLength: number): number;
83
- /** The largest padded length a v1 content may have. */
92
+ /** The largest padded length a sealed content may have. */
84
93
  export declare const SEALED_PAYLOAD_MAX_PADDED_LENGTH: number;
85
94
  /**
86
95
  * The byte length of canonical unpadded base64url, or `undefined`. Canonical
@@ -88,11 +97,13 @@ export declare const SEALED_PAYLOAD_MAX_PADDED_LENGTH: number;
88
97
  * character, so one byte string has exactly one encoding.
89
98
  */
90
99
  export declare function sealedBase64UrlByteLength(value: string): number | undefined;
91
- /** A sealed member of any v1 category. */
100
+ /** A sealed member of any category. */
92
101
  export declare const SealedPayloadSchema: z.ZodObject<{
93
102
  v: z.ZodLiteral<1>;
94
103
  suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
95
104
  category: z.ZodEnum<{
105
+ "agent-message": "agent-message";
106
+ "memory-projection": "memory-projection";
96
107
  "task-input": "task-input";
97
108
  "task-output": "task-output";
98
109
  }>;
@@ -173,15 +184,76 @@ export declare const SealedTaskOutputSchema: z.ZodObject<{
173
184
  contentType: z.ZodString;
174
185
  }, z.core.$strict>>;
175
186
  }, z.core.$strict>;
187
+ /** The sealed member of an `agent.message.publish` (#1045 C2). */
188
+ export declare const SealedAgentMessageSchema: z.ZodObject<{
189
+ v: z.ZodLiteral<1>;
190
+ suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
191
+ category: z.ZodLiteral<"agent-message">;
192
+ scope: z.ZodObject<{
193
+ id: z.ZodString;
194
+ epoch: z.ZodNumber;
195
+ keyId: z.ZodString;
196
+ }, z.core.$strict>;
197
+ chainHead: z.ZodObject<{
198
+ seq: z.ZodNumber;
199
+ hash: z.ZodString;
200
+ }, z.core.$strict>;
201
+ sender: z.ZodString;
202
+ salt: z.ZodString;
203
+ nonce: z.ZodString;
204
+ paddedLength: z.ZodNumber;
205
+ contentMac: z.ZodString;
206
+ ciphertext: z.ZodOptional<z.ZodString>;
207
+ ciphertextRef: z.ZodOptional<z.ZodObject<{
208
+ blobId: z.ZodString;
209
+ contentHash: z.ZodString;
210
+ size: z.ZodNumber;
211
+ contentType: z.ZodString;
212
+ }, z.core.$strict>>;
213
+ }, z.core.$strict>;
214
+ /**
215
+ * The sealed member of a memory projection (#1045 C4). It is inline only
216
+ * (owner decision O2): the Host keeps one latest snapshot per Agent and holds
217
+ * no ciphertext blob for it.
218
+ */
219
+ export declare const SealedMemoryProjectionSchema: z.ZodObject<{
220
+ v: z.ZodLiteral<1>;
221
+ suite: z.ZodLiteral<"byok-sealed-v1.hkdf-sha256.aes-256-gcm">;
222
+ category: z.ZodLiteral<"memory-projection">;
223
+ scope: z.ZodObject<{
224
+ id: z.ZodString;
225
+ epoch: z.ZodNumber;
226
+ keyId: z.ZodString;
227
+ }, z.core.$strict>;
228
+ chainHead: z.ZodObject<{
229
+ seq: z.ZodNumber;
230
+ hash: z.ZodString;
231
+ }, z.core.$strict>;
232
+ sender: z.ZodString;
233
+ salt: z.ZodString;
234
+ nonce: z.ZodString;
235
+ paddedLength: z.ZodNumber;
236
+ contentMac: z.ZodString;
237
+ ciphertext: z.ZodOptional<z.ZodString>;
238
+ ciphertextRef: z.ZodOptional<z.ZodObject<{
239
+ blobId: z.ZodString;
240
+ contentHash: z.ZodString;
241
+ size: z.ZodNumber;
242
+ contentType: z.ZodString;
243
+ }, z.core.$strict>>;
244
+ }, z.core.$strict>;
176
245
  /**
177
246
  * A task's frozen sealing policy (§6.2). The offer carries it in plaintext.
178
247
  * `epoch` is the epoch of the offer's task-input content, and the lowest epoch
179
- * the task accepts.
248
+ * the task accepts. `memory-projection` needs `task-output`: a terminal seals
249
+ * the task's memory-change evidence inside its task-output ciphertext.
180
250
  */
181
251
  export declare const TaskSealingSchema: z.ZodObject<{
182
252
  scopeId: z.ZodString;
183
253
  epoch: z.ZodNumber;
184
254
  categories: z.ZodArray<z.ZodEnum<{
255
+ "agent-message": "agent-message";
256
+ "memory-projection": "memory-projection";
185
257
  "task-input": "task-input";
186
258
  "task-output": "task-output";
187
259
  }>>;
@@ -1,4 +1,4 @@
1
- import type { SealedPayloadV1Category } from './sealed-payload';
1
+ import type { SealedPayloadCategory } from './sealed-payload';
2
2
  /**
3
3
  * How the sealed branch of a type treats one digest field of its plaintext
4
4
  * branch (D16, design §9.3).
@@ -20,7 +20,7 @@ export interface SealedSplitEntry {
20
20
  * and the content MAC bind the wire type as the family.
21
21
  */
22
22
  readonly marker: 'sealing' | 'sealed';
23
- readonly category: SealedPayloadV1Category;
23
+ readonly category: SealedPayloadCategory;
24
24
  /**
25
25
  * Payload fields that, after the envelope `task_id`, name this write in the
26
26
  * AAD and the content MAC (§8.2, §9.1). The sealed branch requires them.
@@ -32,7 +32,17 @@ export interface SealedSplitEntry {
32
32
  * object back and validates the plaintext branch.
33
33
  */
34
34
  readonly moved: readonly string[];
35
- /** Top-level fields of the plaintext branch that the sealed branch drops in v1. */
35
+ /**
36
+ * Top-level fields that also move into this ciphertext when the task's
37
+ * frozen `sealing` names the category (#1045): on a task that seals
38
+ * `memory-projection`, a terminal seals its `agentHomeMemoryChange`. The
39
+ * sealed branch schema cannot see the task's sealing, so the Host and the
40
+ * device check these fields; read them with {@link sealedMovedFields}.
41
+ */
42
+ readonly movedWith?: {
43
+ readonly [category in SealedPayloadCategory]?: readonly string[];
44
+ };
45
+ /** Top-level fields of the plaintext branch that the sealed branch drops. */
36
46
  readonly forbidden: readonly string[];
37
47
  /**
38
48
  * Every path of the plaintext branch whose name contains `digest`, `hash` or
@@ -102,6 +112,9 @@ export declare const SEALED_SPLIT_TABLE: Readonly<{
102
112
  readonly category: 'task-output';
103
113
  readonly identity: readonly [];
104
114
  readonly moved: readonly ["summary", "finalMessage", "document"];
115
+ readonly movedWith: {
116
+ readonly 'memory-projection': readonly ['agentHomeMemoryChange'];
117
+ };
105
118
  readonly forbidden: readonly ["artifactRefs", "preparedObservation"];
106
119
  readonly digests: {
107
120
  readonly 'agentRef.profileRevision': 'plain';
@@ -116,6 +129,9 @@ export declare const SEALED_SPLIT_TABLE: Readonly<{
116
129
  readonly category: 'task-output';
117
130
  readonly identity: readonly [];
118
131
  readonly moved: readonly ["reason"];
132
+ readonly movedWith: {
133
+ readonly 'memory-projection': readonly ['agentHomeMemoryChange'];
134
+ };
119
135
  readonly forbidden: readonly ["preparedObservation"];
120
136
  readonly digests: {
121
137
  readonly 'agentRef.profileRevision': 'plain';
@@ -139,6 +155,9 @@ export declare const SEALED_SPLIT_TABLE: Readonly<{
139
155
  readonly category: 'task-output';
140
156
  readonly identity: readonly [];
141
157
  readonly moved: readonly ["reason"];
158
+ readonly movedWith: {
159
+ readonly 'memory-projection': readonly ['agentHomeMemoryChange'];
160
+ };
142
161
  readonly forbidden: readonly [];
143
162
  readonly digests: {
144
163
  readonly 'agentRef.profileRevision': 'plain';
@@ -179,7 +198,34 @@ export declare const SEALED_SPLIT_TABLE: Readonly<{
179
198
  readonly digests: {};
180
199
  readonly inlineOnly: true;
181
200
  };
201
+ readonly 'agent.message.publish': {
202
+ readonly marker: 'sealed';
203
+ readonly category: 'agent-message';
204
+ readonly identity: readonly ["messageId", "cursor"];
205
+ readonly moved: readonly ["body"];
206
+ readonly forbidden: readonly ["contentHash", "byteCount"];
207
+ readonly digests: {
208
+ readonly 'agentRef.profileRevision': 'plain';
209
+ readonly contentHash: 'forbidden';
210
+ };
211
+ };
212
+ }>;
213
+ /**
214
+ * The receiver capability each category's sealed branches need: the v1
215
+ * categories `sealed-payload-v1`, the #1045 categories `sealed-payload-v2`.
216
+ */
217
+ export declare const SEALED_CATEGORY_CAPABILITY: Readonly<{
218
+ readonly 'task-input': 'sealed-payload-v1';
219
+ readonly 'agent-message': 'sealed-payload-v2';
220
+ readonly 'task-output': 'sealed-payload-v1';
221
+ readonly 'memory-projection': 'sealed-payload-v2';
182
222
  }>;
223
+ /**
224
+ * The top-level fields a `type` message of a task whose frozen `sealing`
225
+ * lists `categories` moves into its ciphertext: the type's `moved` fields and
226
+ * the `movedWith` fields of each listed category.
227
+ */
228
+ export declare function sealedMovedFields(type: SealableMessageType, categories: readonly SealedPayloadCategory[]): readonly string[];
183
229
  /** A message type with a sealed branch. */
184
230
  export type SealableMessageType = keyof typeof SEALED_SPLIT_TABLE;
185
231
  export declare function isSealableMessageType(type: string): type is SealableMessageType;
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", "runtime-unavailable-cause"];
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-payload-v2", "sealed-output-ciphertext-ref", "runtime-failure-class", "runtime-quota-scope", "runtime-unavailable-cause"];
73
73
  export type CapabilityFlag = (typeof CAPABILITY_FLAGS)[number];
@@ -8,9 +8,10 @@
8
8
  *
9
9
  * - `gated`: the sender must not emit the surface unless the receiver
10
10
  * durably advertised `capability`. A field entry applies when the payload
11
- * carries the field (and, with `value`, when the field equals it); a
12
- * dotted field names a nested field, for example `sealed.ciphertextRef`. A type
13
- * entry applies to every message of that type. Server-to-daemon surfaces
11
+ * carries the field (and, with `value`, when the field equals it, or when
12
+ * the field is an array that includes it); a dotted field names a nested
13
+ * field, for example `sealed.ciphertextRef`. A type entry applies to every
14
+ * message of that type. Server-to-daemon surfaces
14
15
  * are gated by a device flag, daemon-to-server surfaces by a server flag.
15
16
  * - `strip-safe`: an optional field an older receiver drops without changing
16
17
  * what it executes or acknowledges.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byok-sdk/protocol",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "description": "BYOK SDK wire protocol: envelope schema, message types, and codec helpers",
5
5
  "type": "module",
6
6
  "license": "MIT",