@kubun/plugin-p2p 0.10.1 → 0.12.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.
Files changed (201) hide show
  1. package/lib/context/delegation.js +130 -1
  2. package/lib/context/group.js +1646 -1
  3. package/lib/context/hub.js +151 -1
  4. package/lib/context/join.js +115 -1
  5. package/lib/context/peer.d.ts +92 -0
  6. package/lib/context/peer.js +1216 -0
  7. package/lib/context/require-admin.d.ts +57 -0
  8. package/lib/context/require-admin.js +57 -0
  9. package/lib/context/sync.d.ts +12 -0
  10. package/lib/context/sync.js +252 -1
  11. package/lib/context/types.d.ts +58 -22
  12. package/lib/context/types.js +48 -1
  13. package/lib/groups/access-default-token.d.ts +44 -0
  14. package/lib/groups/access-default-token.js +103 -0
  15. package/lib/groups/admin-roster.d.ts +55 -0
  16. package/lib/groups/admin-roster.js +69 -0
  17. package/lib/groups/anchor-store.d.ts +15 -0
  18. package/lib/groups/anchor-store.js +37 -0
  19. package/lib/groups/app-cursor-store.d.ts +17 -0
  20. package/lib/groups/app-cursor-store.js +34 -0
  21. package/lib/groups/broadcast-codec.js +6 -1
  22. package/lib/groups/broadcast.d.ts +238 -106
  23. package/lib/groups/broadcast.js +702 -1
  24. package/lib/groups/catalog-token.d.ts +50 -0
  25. package/lib/groups/catalog-token.js +96 -0
  26. package/lib/groups/circle-projection.d.ts +90 -0
  27. package/lib/groups/circle-projection.js +202 -0
  28. package/lib/groups/circle-reducers.d.ts +139 -0
  29. package/lib/groups/circle-reducers.js +128 -0
  30. package/lib/groups/commit-adoption.d.ts +77 -0
  31. package/lib/groups/commit-adoption.js +108 -0
  32. package/lib/groups/commit-journal.d.ts +14 -0
  33. package/lib/groups/commit-journal.js +65 -0
  34. package/lib/groups/control-request.d.ts +66 -0
  35. package/lib/groups/control-request.js +101 -0
  36. package/lib/groups/events.d.ts +19 -2
  37. package/lib/groups/events.js +10 -1
  38. package/lib/groups/group-anchor.d.ts +24 -0
  39. package/lib/groups/group-anchor.js +22 -0
  40. package/lib/groups/group-crypto.d.ts +42 -0
  41. package/lib/groups/group-crypto.js +159 -0
  42. package/lib/groups/group-handle-registry.d.ts +138 -9
  43. package/lib/groups/group-handle-registry.js +533 -1
  44. package/lib/groups/group-handlers.d.ts +30 -0
  45. package/lib/groups/group-handlers.js +218 -0
  46. package/lib/groups/group-health-monitor.d.ts +11 -0
  47. package/lib/groups/group-health-monitor.js +139 -1
  48. package/lib/groups/group-mls.d.ts +66 -0
  49. package/lib/groups/group-mls.js +696 -0
  50. package/lib/groups/group-peer-manager.d.ts +301 -0
  51. package/lib/groups/group-peer-manager.js +1336 -0
  52. package/lib/groups/group-protocols.d.ts +754 -0
  53. package/lib/groups/group-protocols.js +448 -0
  54. package/lib/groups/invite-payload.d.ts +49 -1
  55. package/lib/groups/invite-payload.js +26 -1
  56. package/lib/groups/join-request-identity.d.ts +21 -0
  57. package/lib/groups/join-request-identity.js +43 -0
  58. package/lib/groups/join-utils.d.ts +61 -0
  59. package/lib/groups/join-utils.js +366 -1
  60. package/lib/groups/ledger-affected-events.d.ts +20 -0
  61. package/lib/groups/ledger-affected-events.js +85 -0
  62. package/lib/groups/ledger-commit-fold.d.ts +107 -0
  63. package/lib/groups/ledger-commit-fold.js +167 -0
  64. package/lib/groups/ledger-ingest.d.ts +124 -0
  65. package/lib/groups/ledger-ingest.js +212 -0
  66. package/lib/groups/ledger.d.ts +44 -0
  67. package/lib/groups/ledger.js +30 -0
  68. package/lib/groups/manager.d.ts +217 -85
  69. package/lib/groups/manager.js +798 -1
  70. package/lib/groups/mls-codec.d.ts +28 -7
  71. package/lib/groups/mls-codec.js +33 -1
  72. package/lib/groups/mls-encryptor.d.ts +2 -2
  73. package/lib/groups/mls-encryptor.js +33 -1
  74. package/lib/groups/mls-group-handle.d.ts +37 -2
  75. package/lib/groups/mls-group-handle.js +18 -1
  76. package/lib/groups/mls-json.js +17 -1
  77. package/lib/groups/mls-receive-errors.d.ts +27 -0
  78. package/lib/groups/mls-receive-errors.js +39 -0
  79. package/lib/groups/mls-state.d.ts +6 -4
  80. package/lib/groups/mls-state.js +79 -1
  81. package/lib/groups/peer-presence.d.ts +90 -0
  82. package/lib/groups/peer-presence.js +295 -0
  83. package/lib/groups/peer-selection.d.ts +37 -0
  84. package/lib/groups/peer-selection.js +72 -0
  85. package/lib/groups/roster-projection.d.ts +53 -0
  86. package/lib/groups/roster-projection.js +65 -0
  87. package/lib/groups/store-received-grant.d.ts +7 -3
  88. package/lib/groups/store-received-grant.js +161 -1
  89. package/lib/groups/store-received-revocation.d.ts +19 -16
  90. package/lib/groups/store-received-revocation.js +83 -1
  91. package/lib/hub/ack-backoff.d.ts +22 -0
  92. package/lib/hub/ack-backoff.js +88 -0
  93. package/lib/hub/http-client.d.ts +18 -10
  94. package/lib/hub/http-client.js +15 -1
  95. package/lib/hub/hub-like.d.ts +75 -0
  96. package/lib/hub/hub-like.js +1022 -0
  97. package/lib/hub/loopback-log-hub.d.ts +20 -0
  98. package/lib/hub/loopback-log-hub.js +178 -0
  99. package/lib/hub/manager.d.ts +25 -40
  100. package/lib/hub/manager.js +155 -1
  101. package/lib/hub/peer-scoped-hub-view.d.ts +35 -0
  102. package/lib/hub/peer-scoped-hub-view.js +92 -0
  103. package/lib/hub/sender-scoped-hub-view.d.ts +41 -0
  104. package/lib/hub/sender-scoped-hub-view.js +59 -0
  105. package/lib/hub/server-did.d.ts +67 -0
  106. package/lib/hub/server-did.js +131 -0
  107. package/lib/hub/wiring.d.ts +77 -51
  108. package/lib/hub/wiring.js +189 -1
  109. package/lib/index.d.ts +58 -22
  110. package/lib/index.js +563 -1
  111. package/lib/peer/connection-registry.d.ts +45 -0
  112. package/lib/peer/connection-registry.js +52 -0
  113. package/lib/peer/handlers.d.ts +69 -0
  114. package/lib/peer/handlers.js +110 -0
  115. package/lib/protocol.d.ts +214 -1
  116. package/lib/protocol.js +519 -1
  117. package/lib/schema.d.ts +3 -1
  118. package/lib/schema.js +1150 -39
  119. package/lib/sync/access-default-sender.d.ts +23 -0
  120. package/lib/sync/access-default-sender.js +80 -0
  121. package/lib/sync/authorize.d.ts +58 -4
  122. package/lib/sync/authorize.js +114 -1
  123. package/lib/sync/broadcast-queue.d.ts +3 -4
  124. package/lib/sync/broadcast-queue.js +182 -1
  125. package/lib/sync/broadcast-sender.js +179 -1
  126. package/lib/sync/catalog-scope.d.ts +8 -7
  127. package/lib/sync/catalog-scope.js +84 -1
  128. package/lib/sync/errors.d.ts +12 -2
  129. package/lib/sync/errors.js +29 -1
  130. package/lib/sync/forwarder.d.ts +13 -19
  131. package/lib/sync/forwarder.js +271 -1
  132. package/lib/sync/handlers.js +200 -1
  133. package/lib/sync/hub-tunnel-sync-listener.d.ts +19 -5
  134. package/lib/sync/hub-tunnel-sync-listener.js +261 -1
  135. package/lib/sync/hub-tunnel-sync-provider.d.ts +34 -14
  136. package/lib/sync/hub-tunnel-sync-provider.js +113 -1
  137. package/lib/sync/merkle-apply.d.ts +5 -0
  138. package/lib/sync/merkle-apply.js +194 -1
  139. package/lib/sync/merkle-channel.d.ts +11 -3
  140. package/lib/sync/merkle-channel.js +0 -0
  141. package/lib/sync/merkle-tree.js +120 -1
  142. package/lib/sync/peer-registry.d.ts +15 -11
  143. package/lib/sync/peer-registry.js +82 -1
  144. package/lib/sync/receive-access-gate.js +24 -1
  145. package/lib/sync/scope-resolver.js +41 -1
  146. package/lib/sync/sync-client.d.ts +14 -4
  147. package/lib/sync/sync-client.js +254 -1
  148. package/lib/sync/sync-manager.d.ts +24 -6
  149. package/lib/sync/sync-manager.js +301 -1
  150. package/lib/sync/tunnel-listeners.d.ts +52 -0
  151. package/lib/sync/tunnel-listeners.js +175 -0
  152. package/lib/sync/tunnel-observability.d.ts +25 -0
  153. package/lib/sync/tunnel-observability.js +63 -0
  154. package/lib/sync/tunnel-topics.d.ts +20 -0
  155. package/lib/sync/tunnel-topics.js +28 -0
  156. package/lib/types.d.ts +704 -22
  157. package/lib/types.js +1 -1
  158. package/lib/util/handler-error.d.ts +16 -0
  159. package/lib/util/handler-error.js +64 -0
  160. package/lib/util/mutex.d.ts +14 -1
  161. package/lib/util/mutex.js +44 -1
  162. package/lib/utils.js +21 -1
  163. package/package.json +58 -47
  164. package/lib/groups/broadcast-service.d.ts +0 -263
  165. package/lib/groups/broadcast-service.js +0 -1
  166. package/lib/groups/rejoin-codec.d.ts +0 -14
  167. package/lib/groups/rejoin-codec.js +0 -1
  168. package/lib/groups/wire-frame.d.ts +0 -34
  169. package/lib/groups/wire-frame.js +0 -1
  170. package/lib/hub/circle-catchup-requester.d.ts +0 -58
  171. package/lib/hub/circle-catchup-requester.js +0 -1
  172. package/lib/hub/circle-catchup-responder.d.ts +0 -50
  173. package/lib/hub/circle-catchup-responder.js +0 -1
  174. package/lib/hub/connection-pool.d.ts +0 -43
  175. package/lib/hub/connection-pool.js +0 -1
  176. package/lib/hub/did-observing-transport.d.ts +0 -64
  177. package/lib/hub/did-observing-transport.js +0 -1
  178. package/lib/hub/epoch-stale-detector.d.ts +0 -18
  179. package/lib/hub/epoch-stale-detector.js +0 -1
  180. package/lib/hub/errors.d.ts +0 -30
  181. package/lib/hub/errors.js +0 -1
  182. package/lib/hub/forward-remote-broadcast.d.ts +0 -15
  183. package/lib/hub/forward-remote-broadcast.js +0 -1
  184. package/lib/hub/group-channel.d.ts +0 -89
  185. package/lib/hub/group-channel.js +0 -1
  186. package/lib/hub/hub-connection.d.ts +0 -96
  187. package/lib/hub/hub-connection.js +0 -1
  188. package/lib/hub/receive-handler.d.ts +0 -51
  189. package/lib/hub/receive-handler.js +0 -1
  190. package/lib/hub/rejoin-manager.d.ts +0 -78
  191. package/lib/hub/rejoin-manager.js +0 -1
  192. package/lib/hub/rejoin-responder.d.ts +0 -32
  193. package/lib/hub/rejoin-responder.js +0 -1
  194. package/lib/hub/relay-manager.d.ts +0 -142
  195. package/lib/hub/relay-manager.js +0 -1
  196. package/lib/hub/send-handler.d.ts +0 -40
  197. package/lib/hub/send-handler.js +0 -1
  198. package/lib/hub/tunnel-inbox.d.ts +0 -20
  199. package/lib/hub/tunnel-inbox.js +0 -1
  200. package/lib/hub/wait-for-gate.d.ts +0 -14
  201. package/lib/hub/wait-for-gate.js +0 -1
@@ -0,0 +1,754 @@
1
+ import type { FromSchema } from '@sozai/schema';
2
+ /**
3
+ * App-lane group-rpc protocols carried over a group's rotating broadcast topics.
4
+ * Each peer is group-scoped (its topics encode the group), so payloads omit
5
+ * `groupID` — the handler already knows which group it serves. Loopback drop is
6
+ * automatic: the hub fans a publish to subscribers minus the sender, so a peer
7
+ * never receives its own broadcast.
8
+ *
9
+ * Procedure kinds map to the broadcast surface: `event` is fire-and-forget
10
+ * (`dispatch`); `request` is correlated (`request` for the first reply,
11
+ * `gather` for every reply within a window).
12
+ */
13
+ /**
14
+ * Control plane: membership ledger, delegation, and advisory leave. All are
15
+ * self-authenticating at the payload level (signed tokens / HLC-stamped
16
+ * records), so the lane provides ordering + delivery, not authorization.
17
+ */
18
+ export declare const controlProtocol: {
19
+ readonly 'control/ledgerCatchup': {
20
+ readonly type: "request";
21
+ readonly retain: "ephemeral";
22
+ readonly description: "Ask current members for the group control ledger to backfill missed entries. Gathered: each member replies with its entries; the requester re-verifies every token.";
23
+ readonly param: {
24
+ readonly type: "object";
25
+ readonly properties: {};
26
+ readonly additionalProperties: false;
27
+ };
28
+ readonly result: {
29
+ readonly type: "object";
30
+ readonly properties: {
31
+ readonly entries: {
32
+ readonly type: "array";
33
+ readonly items: {
34
+ readonly type: "string";
35
+ };
36
+ readonly description: "Signed control-ledger entry tokens.";
37
+ };
38
+ };
39
+ readonly required: readonly ["entries"];
40
+ readonly additionalProperties: false;
41
+ };
42
+ };
43
+ readonly 'control/policyCatchup': {
44
+ readonly type: "request";
45
+ readonly retain: "ephemeral";
46
+ readonly description: "Ask current members to restate their OWN model access-defaults, for a member whose read position fell below the hub retention floor and can no longer read the frames that carried them. Gathered: each member replies with signed tokens for its own rules; the requester verifies every token and applies it under the same sender-bound LWW rules as a live frame.";
47
+ readonly param: {
48
+ readonly type: "object";
49
+ readonly properties: {};
50
+ readonly additionalProperties: false;
51
+ };
52
+ readonly result: {
53
+ readonly type: "object";
54
+ readonly properties: {
55
+ readonly defaults: {
56
+ readonly type: "array";
57
+ readonly items: {
58
+ readonly type: "string";
59
+ };
60
+ readonly description: "Signed access-default set tokens, one per rule the responder owns.";
61
+ };
62
+ };
63
+ readonly required: readonly ["defaults"];
64
+ readonly additionalProperties: false;
65
+ };
66
+ };
67
+ readonly 'control/delegationShare': {
68
+ readonly type: "event";
69
+ readonly retain: "log";
70
+ readonly description: "Distribute a minted document/write capability token to group co-members.";
71
+ readonly data: {
72
+ readonly type: "object";
73
+ readonly properties: {
74
+ readonly token: {
75
+ readonly type: "string";
76
+ readonly description: "Stringified capability JWT.";
77
+ };
78
+ readonly hlc: {
79
+ readonly type: "string";
80
+ readonly description: "Grantor-stamped HLC, mirroring the issued row.";
81
+ };
82
+ };
83
+ readonly required: readonly ["token", "hlc"];
84
+ readonly additionalProperties: false;
85
+ };
86
+ };
87
+ readonly 'control/delegationRevoke': {
88
+ readonly type: "event";
89
+ readonly retain: "log";
90
+ readonly description: "Distribute a signed revocation record for a previously minted capability.";
91
+ readonly data: {
92
+ readonly type: "object";
93
+ readonly properties: {
94
+ readonly token: {
95
+ readonly type: "string";
96
+ readonly description: "Stringified signed revocation JWT.";
97
+ };
98
+ readonly hlc: {
99
+ readonly type: "string";
100
+ readonly description: "Revoker-stamped HLC, mirroring the stored row.";
101
+ };
102
+ };
103
+ readonly required: readonly ["token", "hlc"];
104
+ readonly additionalProperties: false;
105
+ };
106
+ };
107
+ readonly 'control/accessDefaultSet': {
108
+ readonly type: "event";
109
+ readonly retain: "log";
110
+ readonly description: "Distribute a member's own model access-default to co-members. `auth` is the signed statement; every other field mirrors it so the receiver can rebuild the frame before verifying.";
111
+ readonly data: {
112
+ readonly type: "object";
113
+ readonly properties: {
114
+ readonly modelID: {
115
+ readonly type: "string";
116
+ };
117
+ readonly permissionType: {
118
+ readonly type: "string";
119
+ readonly enum: readonly ["read", "write"];
120
+ };
121
+ readonly rule: {
122
+ readonly type: "object";
123
+ readonly properties: {
124
+ readonly level: {
125
+ readonly type: "string";
126
+ };
127
+ readonly allowedDIDs: {
128
+ readonly type: readonly ["array", "null"];
129
+ readonly items: {
130
+ readonly type: "string";
131
+ };
132
+ };
133
+ readonly allowedCircles: {
134
+ readonly type: readonly ["array", "null"];
135
+ readonly items: {
136
+ readonly type: "string";
137
+ };
138
+ };
139
+ readonly allowedGroups: {
140
+ readonly type: readonly ["array", "null"];
141
+ readonly items: {
142
+ readonly type: "string";
143
+ };
144
+ };
145
+ };
146
+ readonly required: readonly ["level", "allowedDIDs", "allowedCircles", "allowedGroups"];
147
+ readonly additionalProperties: false;
148
+ };
149
+ readonly ownerDID: {
150
+ readonly type: "string";
151
+ readonly description: "Claimed owner; checked against the `auth` issuer.";
152
+ };
153
+ readonly hlc: {
154
+ readonly type: "string";
155
+ readonly description: "Owner-stamped LWW anchor, mirroring the stored row.";
156
+ };
157
+ readonly auth: {
158
+ readonly type: "string";
159
+ readonly description: "Signed access-default token.";
160
+ };
161
+ };
162
+ readonly required: readonly ["modelID", "permissionType", "rule", "ownerDID", "hlc", "auth"];
163
+ readonly additionalProperties: false;
164
+ };
165
+ };
166
+ readonly 'control/accessDefaultRemove': {
167
+ readonly type: "event";
168
+ readonly retain: "log";
169
+ readonly description: "Distribute a member's own model access-default removal to co-members.";
170
+ readonly data: {
171
+ readonly type: "object";
172
+ readonly properties: {
173
+ readonly modelID: {
174
+ readonly type: "string";
175
+ };
176
+ readonly permissionTypes: {
177
+ readonly type: "array";
178
+ readonly items: {
179
+ readonly type: "string";
180
+ readonly enum: readonly ["read", "write"];
181
+ };
182
+ };
183
+ readonly ownerDID: {
184
+ readonly type: "string";
185
+ readonly description: "Claimed owner; checked against the `auth` issuer.";
186
+ };
187
+ readonly hlc: {
188
+ readonly type: "string";
189
+ readonly description: "Owner-stamped LWW anchor for the removal.";
190
+ };
191
+ readonly auth: {
192
+ readonly type: "string";
193
+ readonly description: "Signed access-default removal token.";
194
+ };
195
+ };
196
+ readonly required: readonly ["modelID", "permissionTypes", "ownerDID", "hlc", "auth"];
197
+ readonly additionalProperties: false;
198
+ };
199
+ };
200
+ readonly 'control/groupLeaveRequest': {
201
+ readonly type: "event";
202
+ readonly retain: "ephemeral";
203
+ readonly description: "Advisory voluntary-leave notice. Not authoritative — an admin must issue a real removeMember; receivers surface it as an event and never tombstone on it.";
204
+ readonly data: {
205
+ readonly type: "object";
206
+ readonly properties: {
207
+ readonly memberDID: {
208
+ readonly type: "string";
209
+ readonly description: "DID of the member announcing departure.";
210
+ };
211
+ readonly hlc: {
212
+ readonly type: "string";
213
+ };
214
+ };
215
+ readonly required: readonly ["memberDID", "hlc"];
216
+ readonly additionalProperties: false;
217
+ };
218
+ };
219
+ };
220
+ /**
221
+ * Sync plane: document mutation broadcasts. Each entry carries a signed mutation
222
+ * JWT the receiver verifies before applying, so the lane is transport only.
223
+ */
224
+ export declare const syncProtocol: {
225
+ readonly 'sync/mutationApply': {
226
+ readonly type: "event";
227
+ readonly retain: "ephemeral";
228
+ readonly description: "Broadcast a batch of signed document mutations to group members.";
229
+ readonly data: {
230
+ readonly type: "object";
231
+ readonly properties: {
232
+ readonly entries: {
233
+ readonly type: "array";
234
+ readonly items: {
235
+ readonly type: "object";
236
+ readonly properties: {
237
+ readonly mutationJWT: {
238
+ readonly type: "string";
239
+ };
240
+ readonly docID: {
241
+ readonly type: "string";
242
+ };
243
+ readonly version: {
244
+ readonly type: "string";
245
+ readonly description: "HLC string identifying this version.";
246
+ };
247
+ readonly modelID: {
248
+ readonly type: "string";
249
+ };
250
+ };
251
+ readonly required: readonly ["mutationJWT", "docID", "version", "modelID"];
252
+ readonly additionalProperties: false;
253
+ };
254
+ };
255
+ };
256
+ readonly required: readonly ["entries"];
257
+ readonly additionalProperties: false;
258
+ };
259
+ };
260
+ };
261
+ export declare const peerProtocol: {
262
+ readonly 'peer/announce': {
263
+ readonly type: "event";
264
+ readonly retain: "log";
265
+ readonly description: "Advertise this device to its co-members: display label, availability class, and the exact capabilities it answers on. The announcer is taken from the authenticated sender, so the body names nobody.";
266
+ readonly data: {
267
+ readonly type: "object";
268
+ readonly properties: {
269
+ readonly label: {
270
+ readonly type: "string";
271
+ readonly description: "Self-declared display hint, Bluetooth-style. Rendered beside the DID, never read as an identity.";
272
+ };
273
+ readonly availability: {
274
+ readonly type: "string";
275
+ readonly enum: readonly ["always-on", "interactive", "mobile"];
276
+ readonly description: "Steers automatic selection only; it never refuses to serve.";
277
+ };
278
+ readonly capabilities: {
279
+ readonly type: "array";
280
+ readonly items: {
281
+ readonly type: "object";
282
+ readonly properties: {
283
+ readonly protocol: {
284
+ readonly type: "string";
285
+ };
286
+ readonly version: {
287
+ readonly type: "number";
288
+ };
289
+ readonly transports: {
290
+ readonly type: readonly ["array", "null"];
291
+ readonly items: {
292
+ readonly type: "string";
293
+ };
294
+ readonly description: "Addressing hints for a capability the hub tunnel does not already reach. Null for one it does.";
295
+ };
296
+ };
297
+ readonly required: readonly ["protocol", "version", "transports"];
298
+ readonly additionalProperties: false;
299
+ };
300
+ readonly description: "Matched EXACTLY on protocol AND version.";
301
+ };
302
+ readonly hlc: {
303
+ readonly type: "string";
304
+ readonly description: "Announcer-stamped LWW anchor for its own projection row.";
305
+ };
306
+ };
307
+ readonly required: readonly ["label", "availability", "capabilities", "hlc"];
308
+ readonly additionalProperties: false;
309
+ };
310
+ };
311
+ readonly 'peer/query': {
312
+ readonly type: "request";
313
+ readonly retain: "ephemeral";
314
+ readonly description: "Ask who is reachable right now, optionally narrowed to devices answering named protocols. Gathered: every matching device replies with its own advertisement within the window. A result is \"who answered\", never \"who exists\".";
315
+ readonly param: {
316
+ readonly type: "object";
317
+ readonly properties: {
318
+ readonly protocols: {
319
+ readonly type: readonly ["array", "null"];
320
+ readonly items: {
321
+ readonly type: "string";
322
+ };
323
+ readonly description: "Only devices answering one of these reply. Null means any. Nullable-and-required, as the announce body's `transports` is.";
324
+ };
325
+ };
326
+ readonly required: readonly ["protocols"];
327
+ readonly additionalProperties: false;
328
+ };
329
+ readonly result: {
330
+ readonly type: "object";
331
+ readonly properties: {
332
+ readonly label: {
333
+ readonly type: "string";
334
+ readonly description: "Self-declared display hint, Bluetooth-style. Rendered beside the DID, never read as an identity.";
335
+ };
336
+ readonly availability: {
337
+ readonly type: "string";
338
+ readonly enum: readonly ["always-on", "interactive", "mobile"];
339
+ readonly description: "Steers automatic selection only; it never refuses to serve.";
340
+ };
341
+ readonly capabilities: {
342
+ readonly type: "array";
343
+ readonly items: {
344
+ readonly type: "object";
345
+ readonly properties: {
346
+ readonly protocol: {
347
+ readonly type: "string";
348
+ };
349
+ readonly version: {
350
+ readonly type: "number";
351
+ };
352
+ readonly transports: {
353
+ readonly type: readonly ["array", "null"];
354
+ readonly items: {
355
+ readonly type: "string";
356
+ };
357
+ readonly description: "Addressing hints for a capability the hub tunnel does not already reach. Null for one it does.";
358
+ };
359
+ };
360
+ readonly required: readonly ["protocol", "version", "transports"];
361
+ readonly additionalProperties: false;
362
+ };
363
+ readonly description: "Matched EXACTLY on protocol AND version.";
364
+ };
365
+ readonly hlc: {
366
+ readonly type: "string";
367
+ readonly description: "Announcer-stamped LWW anchor for its own projection row.";
368
+ };
369
+ };
370
+ readonly required: readonly ["label", "availability", "capabilities", "hlc"];
371
+ readonly additionalProperties: false;
372
+ };
373
+ };
374
+ };
375
+ export type ControlProtocol = typeof controlProtocol;
376
+ export type SyncProtocol = typeof syncProtocol;
377
+ export type PeerProtocol = typeof peerProtocol;
378
+ export type LedgerCatchupResult = FromSchema<(typeof controlProtocol)['control/ledgerCatchup']['result']>;
379
+ export type DelegationShareData = FromSchema<(typeof controlProtocol)['control/delegationShare']['data']>;
380
+ export type DelegationRevokeData = FromSchema<(typeof controlProtocol)['control/delegationRevoke']['data']>;
381
+ export type AccessDefaultSetData = FromSchema<(typeof controlProtocol)['control/accessDefaultSet']['data']>;
382
+ export type AccessDefaultRemoveData = FromSchema<(typeof controlProtocol)['control/accessDefaultRemove']['data']>;
383
+ export type GroupLeaveRequestData = FromSchema<(typeof controlProtocol)['control/groupLeaveRequest']['data']>;
384
+ export type MutationApplyData = FromSchema<(typeof syncProtocol)['sync/mutationApply']['data']>;
385
+ export type PeerAnnounceData = FromSchema<(typeof peerProtocol)['peer/announce']['data']>;
386
+ export type PeerQueryParam = FromSchema<(typeof peerProtocol)['peer/query']['param']>;
387
+ /**
388
+ * A gather reply. The same type as {@link PeerAnnounceData} by construction —
389
+ * both read one schema object — not by two declarations agreeing.
390
+ */
391
+ export type PeerQueryResult = FromSchema<(typeof peerProtocol)['peer/query']['result']>;
392
+ /** One of `always-on`, `interactive`, `mobile`. */
393
+ export type PeerAvailability = PeerAnnounceData['availability'];
394
+ export type PeerCapability = PeerAnnounceData['capabilities'][number];
395
+ /**
396
+ * The app-lane protocols, keyed for `createGroupPeer({ protocols })`. Each key
397
+ * names its own topic, so adding one moves no existing lane.
398
+ */
399
+ export declare const groupProtocols: {
400
+ control: {
401
+ readonly 'control/ledgerCatchup': {
402
+ readonly type: "request";
403
+ readonly retain: "ephemeral";
404
+ readonly description: "Ask current members for the group control ledger to backfill missed entries. Gathered: each member replies with its entries; the requester re-verifies every token.";
405
+ readonly param: {
406
+ readonly type: "object";
407
+ readonly properties: {};
408
+ readonly additionalProperties: false;
409
+ };
410
+ readonly result: {
411
+ readonly type: "object";
412
+ readonly properties: {
413
+ readonly entries: {
414
+ readonly type: "array";
415
+ readonly items: {
416
+ readonly type: "string";
417
+ };
418
+ readonly description: "Signed control-ledger entry tokens.";
419
+ };
420
+ };
421
+ readonly required: readonly ["entries"];
422
+ readonly additionalProperties: false;
423
+ };
424
+ };
425
+ readonly 'control/policyCatchup': {
426
+ readonly type: "request";
427
+ readonly retain: "ephemeral";
428
+ readonly description: "Ask current members to restate their OWN model access-defaults, for a member whose read position fell below the hub retention floor and can no longer read the frames that carried them. Gathered: each member replies with signed tokens for its own rules; the requester verifies every token and applies it under the same sender-bound LWW rules as a live frame.";
429
+ readonly param: {
430
+ readonly type: "object";
431
+ readonly properties: {};
432
+ readonly additionalProperties: false;
433
+ };
434
+ readonly result: {
435
+ readonly type: "object";
436
+ readonly properties: {
437
+ readonly defaults: {
438
+ readonly type: "array";
439
+ readonly items: {
440
+ readonly type: "string";
441
+ };
442
+ readonly description: "Signed access-default set tokens, one per rule the responder owns.";
443
+ };
444
+ };
445
+ readonly required: readonly ["defaults"];
446
+ readonly additionalProperties: false;
447
+ };
448
+ };
449
+ readonly 'control/delegationShare': {
450
+ readonly type: "event";
451
+ readonly retain: "log";
452
+ readonly description: "Distribute a minted document/write capability token to group co-members.";
453
+ readonly data: {
454
+ readonly type: "object";
455
+ readonly properties: {
456
+ readonly token: {
457
+ readonly type: "string";
458
+ readonly description: "Stringified capability JWT.";
459
+ };
460
+ readonly hlc: {
461
+ readonly type: "string";
462
+ readonly description: "Grantor-stamped HLC, mirroring the issued row.";
463
+ };
464
+ };
465
+ readonly required: readonly ["token", "hlc"];
466
+ readonly additionalProperties: false;
467
+ };
468
+ };
469
+ readonly 'control/delegationRevoke': {
470
+ readonly type: "event";
471
+ readonly retain: "log";
472
+ readonly description: "Distribute a signed revocation record for a previously minted capability.";
473
+ readonly data: {
474
+ readonly type: "object";
475
+ readonly properties: {
476
+ readonly token: {
477
+ readonly type: "string";
478
+ readonly description: "Stringified signed revocation JWT.";
479
+ };
480
+ readonly hlc: {
481
+ readonly type: "string";
482
+ readonly description: "Revoker-stamped HLC, mirroring the stored row.";
483
+ };
484
+ };
485
+ readonly required: readonly ["token", "hlc"];
486
+ readonly additionalProperties: false;
487
+ };
488
+ };
489
+ readonly 'control/accessDefaultSet': {
490
+ readonly type: "event";
491
+ readonly retain: "log";
492
+ readonly description: "Distribute a member's own model access-default to co-members. `auth` is the signed statement; every other field mirrors it so the receiver can rebuild the frame before verifying.";
493
+ readonly data: {
494
+ readonly type: "object";
495
+ readonly properties: {
496
+ readonly modelID: {
497
+ readonly type: "string";
498
+ };
499
+ readonly permissionType: {
500
+ readonly type: "string";
501
+ readonly enum: readonly ["read", "write"];
502
+ };
503
+ readonly rule: {
504
+ readonly type: "object";
505
+ readonly properties: {
506
+ readonly level: {
507
+ readonly type: "string";
508
+ };
509
+ readonly allowedDIDs: {
510
+ readonly type: readonly ["array", "null"];
511
+ readonly items: {
512
+ readonly type: "string";
513
+ };
514
+ };
515
+ readonly allowedCircles: {
516
+ readonly type: readonly ["array", "null"];
517
+ readonly items: {
518
+ readonly type: "string";
519
+ };
520
+ };
521
+ readonly allowedGroups: {
522
+ readonly type: readonly ["array", "null"];
523
+ readonly items: {
524
+ readonly type: "string";
525
+ };
526
+ };
527
+ };
528
+ readonly required: readonly ["level", "allowedDIDs", "allowedCircles", "allowedGroups"];
529
+ readonly additionalProperties: false;
530
+ };
531
+ readonly ownerDID: {
532
+ readonly type: "string";
533
+ readonly description: "Claimed owner; checked against the `auth` issuer.";
534
+ };
535
+ readonly hlc: {
536
+ readonly type: "string";
537
+ readonly description: "Owner-stamped LWW anchor, mirroring the stored row.";
538
+ };
539
+ readonly auth: {
540
+ readonly type: "string";
541
+ readonly description: "Signed access-default token.";
542
+ };
543
+ };
544
+ readonly required: readonly ["modelID", "permissionType", "rule", "ownerDID", "hlc", "auth"];
545
+ readonly additionalProperties: false;
546
+ };
547
+ };
548
+ readonly 'control/accessDefaultRemove': {
549
+ readonly type: "event";
550
+ readonly retain: "log";
551
+ readonly description: "Distribute a member's own model access-default removal to co-members.";
552
+ readonly data: {
553
+ readonly type: "object";
554
+ readonly properties: {
555
+ readonly modelID: {
556
+ readonly type: "string";
557
+ };
558
+ readonly permissionTypes: {
559
+ readonly type: "array";
560
+ readonly items: {
561
+ readonly type: "string";
562
+ readonly enum: readonly ["read", "write"];
563
+ };
564
+ };
565
+ readonly ownerDID: {
566
+ readonly type: "string";
567
+ readonly description: "Claimed owner; checked against the `auth` issuer.";
568
+ };
569
+ readonly hlc: {
570
+ readonly type: "string";
571
+ readonly description: "Owner-stamped LWW anchor for the removal.";
572
+ };
573
+ readonly auth: {
574
+ readonly type: "string";
575
+ readonly description: "Signed access-default removal token.";
576
+ };
577
+ };
578
+ readonly required: readonly ["modelID", "permissionTypes", "ownerDID", "hlc", "auth"];
579
+ readonly additionalProperties: false;
580
+ };
581
+ };
582
+ readonly 'control/groupLeaveRequest': {
583
+ readonly type: "event";
584
+ readonly retain: "ephemeral";
585
+ readonly description: "Advisory voluntary-leave notice. Not authoritative — an admin must issue a real removeMember; receivers surface it as an event and never tombstone on it.";
586
+ readonly data: {
587
+ readonly type: "object";
588
+ readonly properties: {
589
+ readonly memberDID: {
590
+ readonly type: "string";
591
+ readonly description: "DID of the member announcing departure.";
592
+ };
593
+ readonly hlc: {
594
+ readonly type: "string";
595
+ };
596
+ };
597
+ readonly required: readonly ["memberDID", "hlc"];
598
+ readonly additionalProperties: false;
599
+ };
600
+ };
601
+ };
602
+ sync: {
603
+ readonly 'sync/mutationApply': {
604
+ readonly type: "event";
605
+ readonly retain: "ephemeral";
606
+ readonly description: "Broadcast a batch of signed document mutations to group members.";
607
+ readonly data: {
608
+ readonly type: "object";
609
+ readonly properties: {
610
+ readonly entries: {
611
+ readonly type: "array";
612
+ readonly items: {
613
+ readonly type: "object";
614
+ readonly properties: {
615
+ readonly mutationJWT: {
616
+ readonly type: "string";
617
+ };
618
+ readonly docID: {
619
+ readonly type: "string";
620
+ };
621
+ readonly version: {
622
+ readonly type: "string";
623
+ readonly description: "HLC string identifying this version.";
624
+ };
625
+ readonly modelID: {
626
+ readonly type: "string";
627
+ };
628
+ };
629
+ readonly required: readonly ["mutationJWT", "docID", "version", "modelID"];
630
+ readonly additionalProperties: false;
631
+ };
632
+ };
633
+ };
634
+ readonly required: readonly ["entries"];
635
+ readonly additionalProperties: false;
636
+ };
637
+ };
638
+ };
639
+ peer: {
640
+ readonly 'peer/announce': {
641
+ readonly type: "event";
642
+ readonly retain: "log";
643
+ readonly description: "Advertise this device to its co-members: display label, availability class, and the exact capabilities it answers on. The announcer is taken from the authenticated sender, so the body names nobody.";
644
+ readonly data: {
645
+ readonly type: "object";
646
+ readonly properties: {
647
+ readonly label: {
648
+ readonly type: "string";
649
+ readonly description: "Self-declared display hint, Bluetooth-style. Rendered beside the DID, never read as an identity.";
650
+ };
651
+ readonly availability: {
652
+ readonly type: "string";
653
+ readonly enum: readonly ["always-on", "interactive", "mobile"];
654
+ readonly description: "Steers automatic selection only; it never refuses to serve.";
655
+ };
656
+ readonly capabilities: {
657
+ readonly type: "array";
658
+ readonly items: {
659
+ readonly type: "object";
660
+ readonly properties: {
661
+ readonly protocol: {
662
+ readonly type: "string";
663
+ };
664
+ readonly version: {
665
+ readonly type: "number";
666
+ };
667
+ readonly transports: {
668
+ readonly type: readonly ["array", "null"];
669
+ readonly items: {
670
+ readonly type: "string";
671
+ };
672
+ readonly description: "Addressing hints for a capability the hub tunnel does not already reach. Null for one it does.";
673
+ };
674
+ };
675
+ readonly required: readonly ["protocol", "version", "transports"];
676
+ readonly additionalProperties: false;
677
+ };
678
+ readonly description: "Matched EXACTLY on protocol AND version.";
679
+ };
680
+ readonly hlc: {
681
+ readonly type: "string";
682
+ readonly description: "Announcer-stamped LWW anchor for its own projection row.";
683
+ };
684
+ };
685
+ readonly required: readonly ["label", "availability", "capabilities", "hlc"];
686
+ readonly additionalProperties: false;
687
+ };
688
+ };
689
+ readonly 'peer/query': {
690
+ readonly type: "request";
691
+ readonly retain: "ephemeral";
692
+ readonly description: "Ask who is reachable right now, optionally narrowed to devices answering named protocols. Gathered: every matching device replies with its own advertisement within the window. A result is \"who answered\", never \"who exists\".";
693
+ readonly param: {
694
+ readonly type: "object";
695
+ readonly properties: {
696
+ readonly protocols: {
697
+ readonly type: readonly ["array", "null"];
698
+ readonly items: {
699
+ readonly type: "string";
700
+ };
701
+ readonly description: "Only devices answering one of these reply. Null means any. Nullable-and-required, as the announce body's `transports` is.";
702
+ };
703
+ };
704
+ readonly required: readonly ["protocols"];
705
+ readonly additionalProperties: false;
706
+ };
707
+ readonly result: {
708
+ readonly type: "object";
709
+ readonly properties: {
710
+ readonly label: {
711
+ readonly type: "string";
712
+ readonly description: "Self-declared display hint, Bluetooth-style. Rendered beside the DID, never read as an identity.";
713
+ };
714
+ readonly availability: {
715
+ readonly type: "string";
716
+ readonly enum: readonly ["always-on", "interactive", "mobile"];
717
+ readonly description: "Steers automatic selection only; it never refuses to serve.";
718
+ };
719
+ readonly capabilities: {
720
+ readonly type: "array";
721
+ readonly items: {
722
+ readonly type: "object";
723
+ readonly properties: {
724
+ readonly protocol: {
725
+ readonly type: "string";
726
+ };
727
+ readonly version: {
728
+ readonly type: "number";
729
+ };
730
+ readonly transports: {
731
+ readonly type: readonly ["array", "null"];
732
+ readonly items: {
733
+ readonly type: "string";
734
+ };
735
+ readonly description: "Addressing hints for a capability the hub tunnel does not already reach. Null for one it does.";
736
+ };
737
+ };
738
+ readonly required: readonly ["protocol", "version", "transports"];
739
+ readonly additionalProperties: false;
740
+ };
741
+ readonly description: "Matched EXACTLY on protocol AND version.";
742
+ };
743
+ readonly hlc: {
744
+ readonly type: "string";
745
+ readonly description: "Announcer-stamped LWW anchor for its own projection row.";
746
+ };
747
+ };
748
+ readonly required: readonly ["label", "availability", "capabilities", "hlc"];
749
+ readonly additionalProperties: false;
750
+ };
751
+ };
752
+ };
753
+ };
754
+ export type GroupProtocols = typeof groupProtocols;