@kubun/plugin-p2p 0.11.0 → 0.12.1

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 (156) hide show
  1. package/lib/context/group.js +1073 -746
  2. package/lib/context/hub.js +2 -1
  3. package/lib/context/join.js +50 -15
  4. package/lib/context/peer.d.ts +92 -0
  5. package/lib/context/peer.js +1216 -0
  6. package/lib/context/require-admin.d.ts +57 -0
  7. package/lib/context/require-admin.js +57 -0
  8. package/lib/context/sync.d.ts +12 -0
  9. package/lib/context/sync.js +234 -1
  10. package/lib/context/types.d.ts +56 -20
  11. package/lib/context/types.js +23 -3
  12. package/lib/groups/access-default-token.d.ts +44 -0
  13. package/lib/groups/access-default-token.js +103 -0
  14. package/lib/groups/admin-roster.d.ts +42 -117
  15. package/lib/groups/admin-roster.js +53 -168
  16. package/lib/groups/anchor-store.d.ts +15 -0
  17. package/lib/groups/anchor-store.js +37 -0
  18. package/lib/groups/app-cursor-store.d.ts +17 -0
  19. package/lib/groups/app-cursor-store.js +34 -0
  20. package/lib/groups/broadcast.d.ts +199 -81
  21. package/lib/groups/broadcast.js +443 -368
  22. package/lib/groups/catalog-token.d.ts +50 -0
  23. package/lib/groups/catalog-token.js +96 -0
  24. package/lib/groups/circle-projection.d.ts +32 -64
  25. package/lib/groups/circle-projection.js +95 -181
  26. package/lib/groups/circle-reducers.d.ts +71 -110
  27. package/lib/groups/circle-reducers.js +57 -127
  28. package/lib/groups/commit-adoption.d.ts +77 -0
  29. package/lib/groups/commit-adoption.js +108 -0
  30. package/lib/groups/commit-journal.d.ts +14 -0
  31. package/lib/groups/commit-journal.js +65 -0
  32. package/lib/groups/control-request.d.ts +66 -0
  33. package/lib/groups/control-request.js +101 -0
  34. package/lib/groups/events.d.ts +14 -1
  35. package/lib/groups/group-anchor.d.ts +18 -57
  36. package/lib/groups/group-anchor.js +15 -100
  37. package/lib/groups/group-crypto.d.ts +36 -13
  38. package/lib/groups/group-crypto.js +124 -50
  39. package/lib/groups/group-handle-registry.d.ts +106 -36
  40. package/lib/groups/group-handle-registry.js +351 -61
  41. package/lib/groups/group-handlers.d.ts +5 -4
  42. package/lib/groups/group-handlers.js +155 -29
  43. package/lib/groups/group-health-monitor.d.ts +1 -1
  44. package/lib/groups/group-health-monitor.js +1 -1
  45. package/lib/groups/group-mls.d.ts +35 -4
  46. package/lib/groups/group-mls.js +594 -62
  47. package/lib/groups/group-peer-manager.d.ts +212 -19
  48. package/lib/groups/group-peer-manager.js +1061 -69
  49. package/lib/groups/group-protocols.d.ts +485 -28
  50. package/lib/groups/group-protocols.js +289 -15
  51. package/lib/groups/invite-payload.d.ts +48 -0
  52. package/lib/groups/join-request-identity.d.ts +21 -0
  53. package/lib/groups/join-request-identity.js +43 -0
  54. package/lib/groups/join-utils.d.ts +60 -0
  55. package/lib/groups/join-utils.js +262 -0
  56. package/lib/groups/ledger-affected-events.d.ts +11 -6
  57. package/lib/groups/ledger-affected-events.js +15 -26
  58. package/lib/groups/ledger-commit-fold.d.ts +107 -0
  59. package/lib/groups/ledger-commit-fold.js +167 -0
  60. package/lib/groups/ledger-ingest.d.ts +124 -0
  61. package/lib/groups/ledger-ingest.js +212 -0
  62. package/lib/groups/ledger.d.ts +44 -0
  63. package/lib/groups/ledger.js +30 -0
  64. package/lib/groups/manager.d.ts +202 -19
  65. package/lib/groups/manager.js +623 -106
  66. package/lib/groups/mls-codec.d.ts +27 -6
  67. package/lib/groups/mls-codec.js +30 -15
  68. package/lib/groups/mls-encryptor.js +9 -6
  69. package/lib/groups/mls-group-handle.d.ts +37 -2
  70. package/lib/groups/mls-group-handle.js +12 -4
  71. package/lib/groups/mls-receive-errors.d.ts +0 -2
  72. package/lib/groups/mls-receive-errors.js +3 -6
  73. package/lib/groups/mls-state.d.ts +5 -3
  74. package/lib/groups/mls-state.js +27 -4
  75. package/lib/groups/peer-presence.d.ts +90 -0
  76. package/lib/groups/peer-presence.js +295 -0
  77. package/lib/groups/peer-selection.d.ts +37 -0
  78. package/lib/groups/peer-selection.js +72 -0
  79. package/lib/groups/roster-projection.d.ts +53 -0
  80. package/lib/groups/roster-projection.js +65 -0
  81. package/lib/groups/store-received-grant.d.ts +4 -3
  82. package/lib/groups/store-received-grant.js +80 -35
  83. package/lib/groups/store-received-revocation.d.ts +16 -13
  84. package/lib/groups/store-received-revocation.js +23 -22
  85. package/lib/hub/http-client.d.ts +10 -27
  86. package/lib/hub/http-client.js +2 -19
  87. package/lib/hub/hub-like.d.ts +57 -6
  88. package/lib/hub/hub-like.js +539 -52
  89. package/lib/hub/loopback-log-hub.d.ts +20 -0
  90. package/lib/hub/loopback-log-hub.js +178 -0
  91. package/lib/hub/manager.d.ts +25 -40
  92. package/lib/hub/manager.js +51 -94
  93. package/lib/hub/peer-scoped-hub-view.d.ts +35 -0
  94. package/lib/hub/peer-scoped-hub-view.js +92 -0
  95. package/lib/hub/sender-scoped-hub-view.d.ts +41 -0
  96. package/lib/hub/sender-scoped-hub-view.js +59 -0
  97. package/lib/hub/server-did.d.ts +67 -0
  98. package/lib/hub/server-did.js +131 -0
  99. package/lib/hub/wiring.d.ts +71 -14
  100. package/lib/hub/wiring.js +80 -23
  101. package/lib/index.d.ts +48 -13
  102. package/lib/index.js +257 -86
  103. package/lib/peer/connection-registry.d.ts +45 -0
  104. package/lib/peer/connection-registry.js +52 -0
  105. package/lib/peer/handlers.d.ts +69 -0
  106. package/lib/peer/handlers.js +110 -0
  107. package/lib/protocol.d.ts +213 -0
  108. package/lib/protocol.js +268 -0
  109. package/lib/schema.d.ts +2 -1
  110. package/lib/schema.js +805 -131
  111. package/lib/sync/access-default-sender.d.ts +23 -0
  112. package/lib/sync/access-default-sender.js +80 -0
  113. package/lib/sync/authorize.d.ts +57 -3
  114. package/lib/sync/authorize.js +45 -4
  115. package/lib/sync/broadcast-queue.d.ts +3 -4
  116. package/lib/sync/broadcast-queue.js +2 -3
  117. package/lib/sync/catalog-scope.d.ts +8 -7
  118. package/lib/sync/catalog-scope.js +55 -39
  119. package/lib/sync/errors.d.ts +9 -0
  120. package/lib/sync/errors.js +10 -0
  121. package/lib/sync/forwarder.d.ts +13 -19
  122. package/lib/sync/forwarder.js +13 -19
  123. package/lib/sync/handlers.js +54 -14
  124. package/lib/sync/hub-tunnel-sync-listener.d.ts +16 -6
  125. package/lib/sync/hub-tunnel-sync-listener.js +126 -37
  126. package/lib/sync/hub-tunnel-sync-provider.d.ts +31 -11
  127. package/lib/sync/hub-tunnel-sync-provider.js +68 -19
  128. package/lib/sync/merkle-channel.d.ts +9 -1
  129. package/lib/sync/merkle-channel.js +0 -0
  130. package/lib/sync/peer-registry.d.ts +14 -10
  131. package/lib/sync/peer-registry.js +0 -25
  132. package/lib/sync/sync-client.d.ts +11 -1
  133. package/lib/sync/sync-client.js +72 -10
  134. package/lib/sync/sync-manager.d.ts +22 -4
  135. package/lib/sync/sync-manager.js +39 -10
  136. package/lib/sync/tunnel-listeners.d.ts +52 -0
  137. package/lib/sync/tunnel-listeners.js +175 -0
  138. package/lib/sync/tunnel-observability.d.ts +25 -0
  139. package/lib/sync/tunnel-observability.js +63 -0
  140. package/lib/sync/tunnel-topics.d.ts +20 -0
  141. package/lib/sync/tunnel-topics.js +28 -0
  142. package/lib/types.d.ts +699 -28
  143. package/lib/types.js +0 -1
  144. package/lib/util/handler-error.d.ts +16 -0
  145. package/lib/util/handler-error.js +64 -0
  146. package/lib/util/mutex.d.ts +14 -1
  147. package/lib/util/mutex.js +37 -3
  148. package/package.json +59 -52
  149. package/lib/groups/ledger-entry.d.ts +0 -37
  150. package/lib/groups/ledger-entry.js +0 -56
  151. package/lib/groups/ledger-fold.d.ts +0 -56
  152. package/lib/groups/ledger-fold.js +0 -53
  153. package/lib/hub/did-observing-transport.d.ts +0 -75
  154. package/lib/hub/did-observing-transport.js +0 -126
  155. package/lib/hub/errors.d.ts +0 -24
  156. package/lib/hub/errors.js +0 -33
@@ -16,24 +16,34 @@ import type { FromSchema } from '@sozai/schema';
16
16
  * records), so the lane provides ordering + delivery, not authorization.
17
17
  */
18
18
  export declare const controlProtocol: {
19
- readonly 'control/ledgerEntry': {
20
- readonly type: "event";
21
- readonly description: "A self-signed control-ledger entry appended by its author.";
22
- readonly data: {
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: {
23
29
  readonly type: "object";
24
30
  readonly properties: {
25
- readonly token: {
26
- readonly type: "string";
27
- readonly description: "Signed control-ledger entry token.";
31
+ readonly entries: {
32
+ readonly type: "array";
33
+ readonly items: {
34
+ readonly type: "string";
35
+ };
36
+ readonly description: "Signed control-ledger entry tokens.";
28
37
  };
29
38
  };
30
- readonly required: readonly ["token"];
39
+ readonly required: readonly ["entries"];
31
40
  readonly additionalProperties: false;
32
41
  };
33
42
  };
34
- readonly 'control/ledgerCatchup': {
43
+ readonly 'control/policyCatchup': {
35
44
  readonly type: "request";
36
- 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.";
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.";
37
47
  readonly param: {
38
48
  readonly type: "object";
39
49
  readonly properties: {};
@@ -42,20 +52,21 @@ export declare const controlProtocol: {
42
52
  readonly result: {
43
53
  readonly type: "object";
44
54
  readonly properties: {
45
- readonly entries: {
55
+ readonly defaults: {
46
56
  readonly type: "array";
47
57
  readonly items: {
48
58
  readonly type: "string";
49
59
  };
50
- readonly description: "Signed control-ledger entry tokens.";
60
+ readonly description: "Signed access-default set tokens, one per rule the responder owns.";
51
61
  };
52
62
  };
53
- readonly required: readonly ["entries"];
63
+ readonly required: readonly ["defaults"];
54
64
  readonly additionalProperties: false;
55
65
  };
56
66
  };
57
67
  readonly 'control/delegationShare': {
58
68
  readonly type: "event";
69
+ readonly retain: "log";
59
70
  readonly description: "Distribute a minted document/write capability token to group co-members.";
60
71
  readonly data: {
61
72
  readonly type: "object";
@@ -75,6 +86,7 @@ export declare const controlProtocol: {
75
86
  };
76
87
  readonly 'control/delegationRevoke': {
77
88
  readonly type: "event";
89
+ readonly retain: "log";
78
90
  readonly description: "Distribute a signed revocation record for a previously minted capability.";
79
91
  readonly data: {
80
92
  readonly type: "object";
@@ -92,8 +104,102 @@ export declare const controlProtocol: {
92
104
  readonly additionalProperties: false;
93
105
  };
94
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
+ };
95
200
  readonly 'control/groupLeaveRequest': {
96
201
  readonly type: "event";
202
+ readonly retain: "ephemeral";
97
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.";
98
204
  readonly data: {
99
205
  readonly type: "object";
@@ -118,6 +224,7 @@ export declare const controlProtocol: {
118
224
  export declare const syncProtocol: {
119
225
  readonly 'sync/mutationApply': {
120
226
  readonly type: "event";
227
+ readonly retain: "ephemeral";
121
228
  readonly description: "Broadcast a batch of signed document mutations to group members.";
122
229
  readonly data: {
123
230
  readonly type: "object";
@@ -151,35 +258,174 @@ export declare const syncProtocol: {
151
258
  };
152
259
  };
153
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
+ };
154
375
  export type ControlProtocol = typeof controlProtocol;
155
376
  export type SyncProtocol = typeof syncProtocol;
156
- export type LedgerEntryData = FromSchema<(typeof controlProtocol)['control/ledgerEntry']['data']>;
377
+ export type PeerProtocol = typeof peerProtocol;
157
378
  export type LedgerCatchupResult = FromSchema<(typeof controlProtocol)['control/ledgerCatchup']['result']>;
158
379
  export type DelegationShareData = FromSchema<(typeof controlProtocol)['control/delegationShare']['data']>;
159
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']>;
160
383
  export type GroupLeaveRequestData = FromSchema<(typeof controlProtocol)['control/groupLeaveRequest']['data']>;
161
384
  export type MutationApplyData = FromSchema<(typeof syncProtocol)['sync/mutationApply']['data']>;
162
- /** The two app-lane protocols, keyed for `createGroupPeer({ protocols })`. */
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
+ */
163
399
  export declare const groupProtocols: {
164
400
  control: {
165
- readonly 'control/ledgerEntry': {
166
- readonly type: "event";
167
- readonly description: "A self-signed control-ledger entry appended by its author.";
168
- readonly data: {
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: {
169
411
  readonly type: "object";
170
412
  readonly properties: {
171
- readonly token: {
172
- readonly type: "string";
173
- readonly description: "Signed control-ledger entry token.";
413
+ readonly entries: {
414
+ readonly type: "array";
415
+ readonly items: {
416
+ readonly type: "string";
417
+ };
418
+ readonly description: "Signed control-ledger entry tokens.";
174
419
  };
175
420
  };
176
- readonly required: readonly ["token"];
421
+ readonly required: readonly ["entries"];
177
422
  readonly additionalProperties: false;
178
423
  };
179
424
  };
180
- readonly 'control/ledgerCatchup': {
425
+ readonly 'control/policyCatchup': {
181
426
  readonly type: "request";
182
- 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.";
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.";
183
429
  readonly param: {
184
430
  readonly type: "object";
185
431
  readonly properties: {};
@@ -188,20 +434,21 @@ export declare const groupProtocols: {
188
434
  readonly result: {
189
435
  readonly type: "object";
190
436
  readonly properties: {
191
- readonly entries: {
437
+ readonly defaults: {
192
438
  readonly type: "array";
193
439
  readonly items: {
194
440
  readonly type: "string";
195
441
  };
196
- readonly description: "Signed control-ledger entry tokens.";
442
+ readonly description: "Signed access-default set tokens, one per rule the responder owns.";
197
443
  };
198
444
  };
199
- readonly required: readonly ["entries"];
445
+ readonly required: readonly ["defaults"];
200
446
  readonly additionalProperties: false;
201
447
  };
202
448
  };
203
449
  readonly 'control/delegationShare': {
204
450
  readonly type: "event";
451
+ readonly retain: "log";
205
452
  readonly description: "Distribute a minted document/write capability token to group co-members.";
206
453
  readonly data: {
207
454
  readonly type: "object";
@@ -221,6 +468,7 @@ export declare const groupProtocols: {
221
468
  };
222
469
  readonly 'control/delegationRevoke': {
223
470
  readonly type: "event";
471
+ readonly retain: "log";
224
472
  readonly description: "Distribute a signed revocation record for a previously minted capability.";
225
473
  readonly data: {
226
474
  readonly type: "object";
@@ -238,8 +486,102 @@ export declare const groupProtocols: {
238
486
  readonly additionalProperties: false;
239
487
  };
240
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
+ };
241
582
  readonly 'control/groupLeaveRequest': {
242
583
  readonly type: "event";
584
+ readonly retain: "ephemeral";
243
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.";
244
586
  readonly data: {
245
587
  readonly type: "object";
@@ -260,6 +602,7 @@ export declare const groupProtocols: {
260
602
  sync: {
261
603
  readonly 'sync/mutationApply': {
262
604
  readonly type: "event";
605
+ readonly retain: "ephemeral";
263
606
  readonly description: "Broadcast a batch of signed document mutations to group members.";
264
607
  readonly data: {
265
608
  readonly type: "object";
@@ -293,5 +636,119 @@ export declare const groupProtocols: {
293
636
  };
294
637
  };
295
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
+ };
296
753
  };
297
754
  export type GroupProtocols = typeof groupProtocols;