@serfab/cadre-core 1.22.0 → 1.24.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 (314) hide show
  1. package/README.md +216 -294
  2. package/dist/arachnode-stub.d.ts +12 -4
  3. package/dist/arachnode-stub.js +15 -8
  4. package/dist/arachnode-stub.js.map +1 -1
  5. package/dist/cadre-invite-protocol.js +5 -4
  6. package/dist/cadre-invite-protocol.js.map +1 -1
  7. package/dist/cadre-node.d.ts +159 -53
  8. package/dist/cadre-node.js +276 -89
  9. package/dist/cadre-node.js.map +1 -1
  10. package/dist/control-authorization.d.ts +14 -2
  11. package/dist/control-authorization.js +8 -3
  12. package/dist/control-authorization.js.map +1 -1
  13. package/dist/control-cohort.d.ts +27 -13
  14. package/dist/control-cohort.js +21 -14
  15. package/dist/control-cohort.js.map +1 -1
  16. package/dist/control-database.d.ts +18 -16
  17. package/dist/control-database.js +57 -22
  18. package/dist/control-database.js.map +1 -1
  19. package/dist/control-protocol-guard.d.ts +1 -1
  20. package/dist/control-protocol-guard.js +7 -3
  21. package/dist/control-protocol-guard.js.map +1 -1
  22. package/dist/control-read-retry.d.ts +49 -11
  23. package/dist/control-read-retry.js +56 -15
  24. package/dist/control-read-retry.js.map +1 -1
  25. package/dist/control-retry.d.ts +32 -3
  26. package/dist/control-retry.js +35 -4
  27. package/dist/control-retry.js.map +1 -1
  28. package/dist/control-schema-version.d.ts +5 -5
  29. package/dist/control-schema-version.js +5 -5
  30. package/dist/control-schema-version.js.map +1 -1
  31. package/dist/control-schema.d.ts +5 -5
  32. package/dist/control-schema.js +1032 -1011
  33. package/dist/control-schema.js.map +1 -1
  34. package/dist/control-write-retry.d.ts +54 -65
  35. package/dist/control-write-retry.js +134 -158
  36. package/dist/control-write-retry.js.map +1 -1
  37. package/dist/delegate-admission.d.ts +1 -1
  38. package/dist/delegate-admission.js +1 -1
  39. package/dist/edge-node/config.d.ts +4 -3
  40. package/dist/edge-node/config.js +11 -9
  41. package/dist/edge-node/config.js.map +1 -1
  42. package/dist/edge-node/dissolve.d.ts +4 -4
  43. package/dist/edge-node/dissolve.js +4 -4
  44. package/dist/edge-node/edge-join.d.ts +1 -1
  45. package/dist/edge-node/edge-join.js +1 -1
  46. package/dist/edge-node/edge-node.js +2 -2
  47. package/dist/edge-node/edge-node.js.map +1 -1
  48. package/dist/edge-node/index.d.ts +1 -0
  49. package/dist/edge-node/index.js +1 -0
  50. package/dist/edge-node/index.js.map +1 -1
  51. package/dist/edge-node/join-credential.d.ts +1 -1
  52. package/dist/edge-node/join-credential.js +1 -1
  53. package/dist/edge-node/lazy-raw-storage.js +12 -0
  54. package/dist/edge-node/lazy-raw-storage.js.map +1 -1
  55. package/dist/edge-node/listen-addrs.d.ts +21 -0
  56. package/dist/edge-node/listen-addrs.js +25 -0
  57. package/dist/edge-node/listen-addrs.js.map +1 -0
  58. package/dist/edge-node/owner-grant.d.ts +1 -1
  59. package/dist/edge-node/owner-grant.js +1 -1
  60. package/dist/edge-node/platform.d.ts +5 -4
  61. package/dist/edge-node/platform.js.map +1 -1
  62. package/dist/edge-node/strand-move.d.ts +1 -1
  63. package/dist/edge-node/strand-move.js +1 -1
  64. package/dist/edge-node/strands.js +27 -11
  65. package/dist/edge-node/strands.js.map +1 -1
  66. package/dist/index.d.ts +7 -5
  67. package/dist/index.js +18 -7
  68. package/dist/index.js.map +1 -1
  69. package/dist/invitation-bootstrap.d.ts +28 -5
  70. package/dist/invitation-bootstrap.js +41 -8
  71. package/dist/invitation-bootstrap.js.map +1 -1
  72. package/dist/link-budget.d.ts +53 -4
  73. package/dist/link-budget.js +58 -5
  74. package/dist/link-budget.js.map +1 -1
  75. package/dist/machine-removal.d.ts +2 -2
  76. package/dist/machine-removal.js +4 -3
  77. package/dist/machine-removal.js.map +1 -1
  78. package/dist/membership-connection-gater.d.ts +2 -2
  79. package/dist/membership-connection-gater.js +2 -2
  80. package/dist/membership-view.d.ts +2 -2
  81. package/dist/membership-view.js +6 -3
  82. package/dist/membership-view.js.map +1 -1
  83. package/dist/node-claim-payload.d.ts +15 -7
  84. package/dist/node-claim-payload.js +25 -9
  85. package/dist/node-claim-payload.js.map +1 -1
  86. package/dist/node-class.d.ts +36 -0
  87. package/dist/node-class.js +26 -0
  88. package/dist/node-class.js.map +1 -0
  89. package/dist/node-default-transports.d.ts +50 -3
  90. package/dist/node-default-transports.js +48 -3
  91. package/dist/node-default-transports.js.map +1 -1
  92. package/dist/node-roles.d.ts +118 -0
  93. package/dist/node-roles.js +142 -0
  94. package/dist/node-roles.js.map +1 -0
  95. package/dist/node-transports.d.ts +6 -2
  96. package/dist/node-transports.js +39 -7
  97. package/dist/node-transports.js.map +1 -1
  98. package/dist/owner-anchor-sync.js +1 -1
  99. package/dist/owner-key-export.js +1 -1
  100. package/dist/owner-key-flows.d.ts +1 -1
  101. package/dist/owner-key-store.js +1 -1
  102. package/dist/owner-signer.js +1 -1
  103. package/dist/peer-authorization.d.ts +3 -1
  104. package/dist/peer-authorization.js +3 -1
  105. package/dist/peer-authorization.js.map +1 -1
  106. package/dist/peer-dial.d.ts +74 -10
  107. package/dist/peer-dial.js +89 -17
  108. package/dist/peer-dial.js.map +1 -1
  109. package/dist/peer-join-backfill.js +4 -4
  110. package/dist/peer-join-backfill.js.map +1 -1
  111. package/dist/peer-record.d.ts +34 -9
  112. package/dist/peer-record.js +66 -13
  113. package/dist/peer-record.js.map +1 -1
  114. package/dist/pending-join-runner.d.ts +1 -1
  115. package/dist/pending-join-runner.js +1 -1
  116. package/dist/provider/client.d.ts +6 -5
  117. package/dist/provider/client.js +3 -3
  118. package/dist/provider/client.js.map +1 -1
  119. package/dist/provider/descriptor.d.ts +1 -1
  120. package/dist/provider/descriptor.js +1 -1
  121. package/dist/provider/oauth.d.ts +1 -1
  122. package/dist/provider/oauth.js +1 -1
  123. package/dist/provider/rent-node.d.ts +4 -3
  124. package/dist/provider/rent-node.js +3 -3
  125. package/dist/provider/rent-node.js.map +1 -1
  126. package/dist/relay-addrs.d.ts +62 -7
  127. package/dist/relay-addrs.js +74 -11
  128. package/dist/relay-addrs.js.map +1 -1
  129. package/dist/relay-reservation.d.ts +1 -1
  130. package/dist/relay-reservation.js +1 -1
  131. package/dist/relay-server.d.ts +6 -5
  132. package/dist/relay-server.js +5 -5
  133. package/dist/relay-server.js.map +1 -1
  134. package/dist/schema-verification.d.ts +13 -10
  135. package/dist/schema-verification.js +32 -24
  136. package/dist/schema-verification.js.map +1 -1
  137. package/dist/sealed-party-key.js +1 -1
  138. package/dist/seed-bootstrap.d.ts +4 -3
  139. package/dist/seed-bootstrap.js +6 -7
  140. package/dist/seed-bootstrap.js.map +1 -1
  141. package/dist/strand-addr-protocol.d.ts +8 -6
  142. package/dist/strand-addr-protocol.js +12 -10
  143. package/dist/strand-addr-protocol.js.map +1 -1
  144. package/dist/strand-app-schema-report.d.ts +16 -2
  145. package/dist/strand-app-schema-report.js +15 -0
  146. package/dist/strand-app-schema-report.js.map +1 -1
  147. package/dist/strand-cohort.d.ts +1 -4
  148. package/dist/strand-cohort.js.map +1 -1
  149. package/dist/strand-commit-durability.d.ts +1 -1
  150. package/dist/strand-database.d.ts +13 -6
  151. package/dist/strand-database.js +17 -9
  152. package/dist/strand-database.js.map +1 -1
  153. package/dist/strand-first-sync-gate.d.ts +3 -2
  154. package/dist/strand-first-sync-gate.js +3 -2
  155. package/dist/strand-first-sync-gate.js.map +1 -1
  156. package/dist/strand-formation-deadlines.d.ts +2 -2
  157. package/dist/strand-formation-deadlines.js +2 -2
  158. package/dist/strand-formation-protocol.d.ts +1 -1
  159. package/dist/strand-formation-protocol.js +51 -16
  160. package/dist/strand-formation-protocol.js.map +1 -1
  161. package/dist/strand-instance-manager.d.ts +134 -42
  162. package/dist/strand-instance-manager.js +331 -76
  163. package/dist/strand-instance-manager.js.map +1 -1
  164. package/dist/strand-membership-reconciler.d.ts +8 -3
  165. package/dist/strand-membership-reconciler.js +8 -3
  166. package/dist/strand-membership-reconciler.js.map +1 -1
  167. package/dist/strand-membership-writer.d.ts +2 -2
  168. package/dist/strand-membership-writer.js +41 -39
  169. package/dist/strand-membership-writer.js.map +1 -1
  170. package/dist/strand-move.js +1 -1
  171. package/dist/strand-network-config.d.ts +15 -5
  172. package/dist/strand-network-config.js +7 -6
  173. package/dist/strand-network-config.js.map +1 -1
  174. package/dist/strand-party-key-rotation.d.ts +7 -3
  175. package/dist/strand-party-key-rotation.js +7 -3
  176. package/dist/strand-party-key-rotation.js.map +1 -1
  177. package/dist/strand-party-machines.d.ts +19 -8
  178. package/dist/strand-party-machines.js +26 -11
  179. package/dist/strand-party-machines.js.map +1 -1
  180. package/dist/strand-party-peers.d.ts +36 -14
  181. package/dist/strand-party-peers.js +24 -15
  182. package/dist/strand-party-peers.js.map +1 -1
  183. package/dist/strand-peer-redial.d.ts +1 -1
  184. package/dist/strand-peer-redial.js +1 -1
  185. package/dist/strand-reactivity.d.ts +20 -17
  186. package/dist/strand-reactivity.js +31 -18
  187. package/dist/strand-reactivity.js.map +1 -1
  188. package/dist/strand-revocation-enforcer.d.ts +3 -3
  189. package/dist/strand-revocation-enforcer.js +3 -3
  190. package/dist/strand-wake-protocol.d.ts +19 -7
  191. package/dist/strand-wake-protocol.js +22 -10
  192. package/dist/strand-wake-protocol.js.map +1 -1
  193. package/dist/strand-watcher.d.ts +1 -1
  194. package/dist/strand-watcher.js +1 -1
  195. package/dist/table-change-watch.js +1 -1
  196. package/dist/types.d.ts +127 -57
  197. package/dist/types.js.map +1 -1
  198. package/dist/webrtc-upgrade.d.ts +254 -0
  199. package/dist/webrtc-upgrade.js +355 -0
  200. package/dist/webrtc-upgrade.js.map +1 -0
  201. package/package.json +9 -9
  202. package/src/announce-addrs.ts +93 -93
  203. package/src/arachnode-stub.ts +18 -10
  204. package/src/bootstrap-peer-store-file.ts +44 -44
  205. package/src/bootstrap-peer-store.ts +214 -214
  206. package/src/cadre-invite-protocol.ts +741 -740
  207. package/src/cadre-node.ts +12462 -12252
  208. package/src/claim-proof.ts +147 -147
  209. package/src/control-authorization.ts +290 -276
  210. package/src/control-cohort.ts +223 -204
  211. package/src/control-database.ts +72 -28
  212. package/src/control-formation-recorder.ts +359 -359
  213. package/src/control-protocol-guard.ts +370 -366
  214. package/src/control-read-retry.ts +222 -180
  215. package/src/control-retry.ts +36 -4
  216. package/src/control-schema-version.ts +301 -301
  217. package/src/control-schema.ts +1108 -1087
  218. package/src/control-write-retry.ts +639 -669
  219. package/src/delegate-admission.ts +351 -351
  220. package/src/describe-thrown.ts +60 -60
  221. package/src/ed25519-key.ts +185 -185
  222. package/src/edge-node/config.ts +13 -10
  223. package/src/edge-node/dissolve.ts +252 -252
  224. package/src/edge-node/edge-join.ts +320 -320
  225. package/src/edge-node/edge-node.ts +1095 -1095
  226. package/src/edge-node/index.ts +60 -59
  227. package/src/edge-node/join-credential.ts +16 -16
  228. package/src/edge-node/lazy-raw-storage.ts +194 -178
  229. package/src/edge-node/listen-addrs.ts +26 -0
  230. package/src/edge-node/node-local.ts +84 -84
  231. package/src/edge-node/options.ts +195 -195
  232. package/src/edge-node/owner-grant.ts +63 -63
  233. package/src/edge-node/platform.ts +5 -4
  234. package/src/edge-node/strand-move.ts +266 -266
  235. package/src/edge-node/strands.ts +27 -12
  236. package/src/enrolled-machine-store-file.ts +43 -43
  237. package/src/enrolled-machine-store.ts +280 -280
  238. package/src/fetch-impl.ts +23 -23
  239. package/src/file-durable-slot.ts +64 -64
  240. package/src/file-safe-name.ts +32 -32
  241. package/src/formation-approval.ts +604 -604
  242. package/src/formation-token.ts +63 -63
  243. package/src/fs-atomic.ts +92 -92
  244. package/src/index.ts +987 -957
  245. package/src/invitation-bootstrap.ts +152 -118
  246. package/src/joined-strand-store.ts +553 -553
  247. package/src/key-store-file.ts +142 -142
  248. package/src/link-budget.ts +61 -5
  249. package/src/machine-removal.ts +211 -210
  250. package/src/member-redemption.ts +643 -643
  251. package/src/membership-connection-gater.ts +650 -650
  252. package/src/membership-view.ts +147 -144
  253. package/src/node-claim-payload.ts +34 -12
  254. package/src/node-class.ts +47 -0
  255. package/src/node-default-transports.ts +65 -3
  256. package/src/node-roles.ts +220 -0
  257. package/src/node-transports.ts +86 -49
  258. package/src/owner-anchor-sync.ts +172 -172
  259. package/src/owner-grant-protocol.ts +547 -547
  260. package/src/owner-key-export.ts +348 -348
  261. package/src/owner-key-flows.ts +109 -109
  262. package/src/owner-key-store.ts +1 -1
  263. package/src/owner-keys.ts +179 -179
  264. package/src/owner-signer.ts +92 -92
  265. package/src/peer-addr-book.ts +252 -252
  266. package/src/peer-authorization.ts +584 -582
  267. package/src/peer-dial.ts +698 -605
  268. package/src/peer-join-backfill.ts +961 -961
  269. package/src/peer-record.ts +71 -16
  270. package/src/pending-join-runner.ts +798 -798
  271. package/src/primary-lan-address.ts +47 -47
  272. package/src/provider/client.ts +327 -326
  273. package/src/provider/descriptor.ts +129 -129
  274. package/src/provider/index.ts +59 -59
  275. package/src/provider/oauth.ts +285 -285
  276. package/src/provider/rent-node.ts +276 -275
  277. package/src/relay-addrs.ts +90 -12
  278. package/src/relay-reservation.ts +1 -1
  279. package/src/relay-server.ts +99 -98
  280. package/src/schema-verification.ts +38 -23
  281. package/src/sealed-party-key.ts +190 -190
  282. package/src/seed-bootstrap.ts +8 -11
  283. package/src/seed-trust-policy.ts +353 -353
  284. package/src/self-address-update.ts +19 -19
  285. package/src/strand-addr-protocol.ts +17 -14
  286. package/src/strand-app-schema-report.ts +147 -122
  287. package/src/strand-cohort.ts +1 -5
  288. package/src/strand-commit-durability.ts +165 -165
  289. package/src/strand-database.ts +522 -510
  290. package/src/strand-first-sync-gate.ts +3 -2
  291. package/src/strand-formation-deadlines.ts +227 -227
  292. package/src/strand-formation-manager.ts +731 -731
  293. package/src/strand-formation-protocol.ts +1174 -1138
  294. package/src/strand-fret-addrs.ts +179 -179
  295. package/src/strand-instance-manager.ts +381 -85
  296. package/src/strand-membership-reconciler.ts +1315 -1310
  297. package/src/strand-membership-writer.ts +2152 -2150
  298. package/src/strand-move.ts +1 -1
  299. package/src/strand-network-config.ts +16 -6
  300. package/src/strand-offline.ts +178 -178
  301. package/src/strand-party-key-rotation.ts +440 -436
  302. package/src/strand-party-machines.ts +308 -293
  303. package/src/strand-party-peers.ts +151 -129
  304. package/src/strand-peer-redial.ts +1 -1
  305. package/src/strand-reactivity.ts +36 -19
  306. package/src/strand-revocation-enforcer.ts +758 -758
  307. package/src/strand-wake-protocol.ts +406 -394
  308. package/src/strand-watcher.ts +1 -1
  309. package/src/table-change-watch.ts +285 -285
  310. package/src/timed-step.ts +28 -28
  311. package/src/timeout-scheduler.ts +29 -29
  312. package/src/trusted-owner-store.ts +242 -242
  313. package/src/types.ts +3182 -3112
  314. package/src/webrtc-upgrade.ts +439 -0
@@ -26,7 +26,7 @@
26
26
  import debug from 'debug';
27
27
  import { decodeLengthPrefixedFrame } from './seed-bootstrap.js';
28
28
  import { exchangeFrame, readStreamToEnd, replyAndClose } from './control-stream.js';
29
- import { dialAddr, tryAddrsInTurn } from './peer-dial.js';
29
+ import { dialAddr, tryAddrsInTurn, webrtcLast } from './peer-dial.js';
30
30
  import { relayedRequestBudgetMs } from './link-budget.js';
31
31
  const log = debug('sereus:cadre:strand-wake');
32
32
  /** Protocol id for control-network push-wake (parallel to `/sereus/seed/1.0.0`). */
@@ -50,13 +50,19 @@ const MAX_WAKE_SIZE = 64 * 1024;
50
50
  * inside this deadline and is not counted. In steady state those reads touch only held blocks and do not consult the
51
51
  * cohort. If a wake or address request is seen timing out while the receiver's membership read
52
52
  * is consulting, count one membership decision in this deadline or answer the check from the
53
- * materialized authorized-peer snapshot. See docs/cadre-consistency.md → "Deadlines Over
54
- * Optimystic's Reads and Commits".
53
+ * materialized authorized-peer snapshot. See docs/network/deadlines.md → "Deadlines over
54
+ * Optimystic's reads and commits".
55
55
  */
56
56
  export const DEFAULT_WAKE_TIMEOUT_MS = relayedRequestBudgetMs();
57
57
  /**
58
- * Whole attempts one {@link dialWake} call budgets for: a stale signaling address, then the
58
+ * Whole attempts one {@link dialWake} call budgets for: a stale relayed address, then the
59
59
  * direct address that works.
60
+ *
61
+ * Two RELAYED OR DIRECT attempts. {@link dialWake} moves every address that needs ICE after its
62
+ * relay hop behind them ({@link webrtcLast}), because such an address answers nothing for about
63
+ * 23 s when ICE cannot connect — so without that ordering one of these two attempts could be
64
+ * spent on an address nothing is waiting for, and a target whose first relay reservation has
65
+ * rotated would never be reached at its second relay.
60
66
  */
61
67
  export const WAKE_DIAL_ATTEMPTS = 2;
62
68
  /**
@@ -75,7 +81,7 @@ export const WAKE_DIAL_ATTEMPTS = 2;
75
81
  * `DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS` in `peer-dial.ts`, though not the same
76
82
  * count: that one is sized to fit several dead addresses ahead of a working one,
77
83
  * while a wake target is expected to be awake and reachable on its first or second
78
- * address. Two whole attempts so a reachable peer whose signaling address is stale
84
+ * address. Two whole attempts so a reachable peer whose relayed address is stale
79
85
  * still gets a genuine try at its direct one; a peer needing longer than that is
80
86
  * not "asleep and reachable", which is the only case a wake is for. The last
81
87
  * attempt inside the budget gets whatever remains of it, so the call returns at
@@ -227,24 +233,30 @@ export class StrandWakeService {
227
233
  * Sender side: dial a target's control-network address(es), send a
228
234
  * {@link WakeRequest} over `WAKE_PROTOCOL`, and return the peer's {@link WakeAck}.
229
235
  *
230
- * Tries each candidate address in order (signaling/relay first, as produced by
236
+ * Tries each candidate address in order (relayed first, as produced by
231
237
  * `CadreNode.resolvePeerAddrs`) until one dials, so a NAT'd peer is reachable via
232
238
  * its circuit-relay address. Each attempt is bounded by `timeoutMs` and the call
233
239
  * as a whole by `budgetMs` (see {@link DEFAULT_WAKE_DIAL_BUDGET_MS}); a candidate
234
240
  * the budget leaves no room for is reported as untried rather than silently
235
241
  * dropped.
236
242
  *
243
+ * The caller's order is kept but for one rule enforced here, at the site that owns the budget:
244
+ * an address that needs ICE after its relay hop goes last ({@link webrtcLast}), whatever order
245
+ * the caller gave. Only that rule is applied — unlike `dialPeerAddrs`, this does NOT hoist
246
+ * direct addresses ahead of relayed ones, because a hibernating machine is usually reachable
247
+ * only through its relay and its direct addresses blackhole.
248
+ *
237
249
  * Throws if no address is dialable — with an error naming EVERY candidate and
238
250
  * why it failed, not merely the last one ({@link tryAddrsInTurn}). That
239
251
  * distinction is not cosmetic: with only the last candidate's message the
240
- * failure that mattered (usually the signaling address, tried first) is
252
+ * failure that mattered (usually the relayed address, tried first) is
241
253
  * invisible outside a debug log, and the surfaced message points at whichever
242
254
  * address happened to be tried last.
243
255
  *
244
256
  * The candidate loop is deliberately explicit rather than one
245
257
  * `dialProtocol(addrs)` call. libp2p sorts any multi-address dial with
246
258
  * `defaultAddressSorter`, whose `circuitRelayAddressesLast` pass would demote
247
- * exactly the signaling address this ordering puts first — silently inverting
259
+ * exactly the relayed address this ordering puts first — silently inverting
248
260
  * it, with no per-dial sorter override to opt out of. For the same reason this
249
261
  * does not use `dialPeerAddrs`, which puts relayed addresses last.
250
262
  *
@@ -265,7 +277,7 @@ export async function dialWake(node, addrs, request, options = {}) {
265
277
  };
266
278
  // The attempt's signal aborts the in-flight dialProtocol and resets the live
267
279
  // stream, so neither the connect nor the ack-read leaks.
268
- return await tryAddrsInTurn(addrs, budget, 'Wake dial', (addr, signal, attemptMs) => sendWake(node, addr, protocolId, request, attemptMs, signal));
280
+ return await tryAddrsInTurn(webrtcLast(addrs), budget, 'Wake dial', (addr, signal, attemptMs) => sendWake(node, addr, protocolId, request, attemptMs, signal));
269
281
  }
270
282
  /**
271
283
  * Dial one address, open one stream, send the request, half-close, and read the ack.
@@ -280,7 +292,7 @@ export async function dialWake(node, addrs, request, options = {}) {
280
292
  async function sendWake(node, addr, protocolId, request, timeoutMs, signal) {
281
293
  const connection = await dialAddr(node, addr, signal, 'Wake dial');
282
294
  // `runOnLimitedConnection: true`: the target may be reachable only over a
283
- // circuit-relay connection (the signaling-first addr), which libp2p marks
295
+ // circuit-relay connection (the relayed addr tried first), which libp2p marks
284
296
  // "limited". The wake exchange is a single tiny request→ack well within the
285
297
  // relay's data/duration cap, so opening it on the limited connection is safe
286
298
  // and is the whole point of dialing the relay address.
@@ -1 +1 @@
1
- {"version":3,"file":"strand-wake-protocol.js","sourceRoot":"","sources":["../src/strand-wake-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAsB,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACxG,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,GAAG,GAAG,KAAK,CAAC,0BAA0B,CAAC,CAAC;AAE9C,oFAAoF;AACpF,MAAM,CAAC,MAAM,aAAa,GAAG,2BAA2B,CAAC;AAEzD;;;;GAIG;AACH,MAAM,aAAa,GAAG,EAAE,GAAG,IAAI,CAAC;AAEhC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,sBAAsB,EAAE,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,kBAAkB,GAAG,uBAAuB,CAAC;AAExF,sFAAsF;AACtF,uNAAuN;AACvN,MAAM,4BAA4B,GAAG,KAAM,CAAC;AAE5C,iFAAiF;AACjF,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAEzC;;;;;GAKG;AACH,KAAK,UAAU,SAAS,CAAI,MAAqB,EAAE,SAAiB;IAClE,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK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AW,CAAC,CAAC;IACnE,0EAA0E;IAC1E,8EAA8E;IAC9E,4EAA4E;IAC5E,6EAA6E;IAC7E,uDAAuD;IACvD,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAEnG,MAAM,GAAG,GAAG,MAAM,aAAa,CAC7B,SAAqC,EACrC,MAAM,EACN,OAAO,EACP,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAU,MAAM,EAAE,SAAS,CAAC,EACjD,8BAA8B,CAC/B,CAAC;IAEF,GAAG,CAAC,yCAAyC,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC;IACjG,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -2,7 +2,7 @@ import type { TableChangeWatch, TableChangeWatchOptions } from './table-change-w
2
2
  import type { StrandFilter, StrandRow } from './types.js';
3
3
  /**
4
4
  * Default backstop: the longest the watcher goes without re-reading when no change to
5
- * `Strand` or `JoinedStrand` is heard (`docs/architecture.md` → "Table change subscriptions"
5
+ * `Strand` or `JoinedStrand` is heard (`docs/cadre/control-convergence.md` → "Table change subscriptions"
6
6
  * says what the change subscription misses).
7
7
  *
8
8
  * NOTE: on a cadre larger than `CONTROL_REPLICATION_BREADTH` (16), a machine outside the
@@ -12,7 +12,7 @@ const log = debug('sereus:cadre:strand-watcher');
12
12
  const MAX_RETRY_BACKOFF_MS = 5 * 60 * 1000;
13
13
  /**
14
14
  * Default backstop: the longest the watcher goes without re-reading when no change to
15
- * `Strand` or `JoinedStrand` is heard (`docs/architecture.md` → "Table change subscriptions"
15
+ * `Strand` or `JoinedStrand` is heard (`docs/cadre/control-convergence.md` → "Table change subscriptions"
16
16
  * says what the change subscription misses).
17
17
  *
18
18
  * NOTE: on a cadre larger than `CONTROL_REPLICATION_BREADTH` (16), a machine outside the
@@ -11,7 +11,7 @@
11
11
  * and arms a timer, and runs are single-flight: changes inside the coalescing window share
12
12
  * one run, a change during a run produces exactly one follow-up run, and a consumer's own
13
13
  * `trigger` (start, retry backoff) and the backstop go through the same rule.
14
- * `docs/architecture.md` → "Table change subscriptions" says what the seam does not hear,
14
+ * `docs/cadre/control-convergence.md` → "Table change subscriptions" says what the seam does not hear,
15
15
  * which is why consumers keep a backstop.
16
16
  */
17
17
  import debug from 'debug';
package/dist/types.d.ts CHANGED
@@ -19,7 +19,8 @@ import type { StrandNetworkStateStore } from './strand-network-state.js';
19
19
  import type { EnrolledMachineStore } from './enrolled-machine-store.js';
20
20
  import type { JoinedStrandStore } from './joined-strand-store.js';
21
21
  import type { PushNotifier } from './push-notifier.js';
22
- import type { CadreInviteSignedFields, OwnerGrantSignedFields, RevocableTable } from './control-authorization.js';
22
+ import type { CadreInviteSignedFields, OwnerGrantSignedFields, RevocableTable, StrandPeerRole } from './control-authorization.js';
23
+ export type { StrandPeerRole } from './control-authorization.js';
23
24
  import type { FoundingInvite } from './control-database.js';
24
25
  import type { CadreInvitation } from './cadre-invite-protocol.js';
25
26
  import type { OwnerGrantBundle } from './owner-grant-protocol.js';
@@ -27,12 +28,20 @@ import type { RedemptionAddressOutcome } from './member-redemption.js';
27
28
  import type { ControlRetryAbandonment } from './control-retry.js';
28
29
  import type { FormationRejectionCode } from './strand-formation-rejection.js';
29
30
  import type { ListenTransportOptions } from './relay-addrs.js';
31
+ import type { NodeClass, PublishedProfile } from './node-class.js';
32
+ import type { NodeRoles } from './node-roles.js';
30
33
  /**
31
- * Extended Libp2p node with the coordinatedRepo attached by db-p2p's
32
- * createLibp2pNode after node creation (not surfaced on the base Libp2p type).
34
+ * Extended Libp2p node with the attachments db-p2p's createLibp2pNode adds after node
35
+ * creation (not surfaced on the base Libp2p type).
33
36
  */
34
37
  export interface Libp2pNodeWithRepo extends Libp2p {
35
- coordinatedRepo: IRepo;
38
+ /**
39
+ * The repo this node coordinates writes to its own blocks through. Optional because a
40
+ * **client** node (`servesBlocks: false`, built for a strand on a node whose
41
+ * `strandCohortMember` role is off) stores no blocks and so carries none; the control node
42
+ * always has one, and `createControlNode` throws if it does not.
43
+ */
44
+ coordinatedRepo?: IRepo;
36
45
  /**
37
46
  * The node's key-addressed peer network, attached by db-p2p's factory alongside
38
47
  * `coordinatedRepo` (`libp2p-node-base.ts`). Optional deliberately: the base
@@ -68,10 +77,6 @@ export interface Libp2pNodeWithRepo extends Libp2p {
68
77
  */
69
78
  reportBlockHeld?: (blockId: string, rev: number, peerId: string) => Promise<void>;
70
79
  }
71
- /**
72
- * Node profile determines storage participation
73
- */
74
- export type NodeProfile = 'transaction' | 'storage';
75
80
  /**
76
81
  * Strand filter configuration - determines which strands this node participates in
77
82
  */
@@ -170,7 +175,7 @@ export declare const HIBERNATION_TIMEOUTS: Record<LatencyHint, HibernationTimeou
170
175
  */
171
176
  export type RawStorageProvider = IRawStorage | ((scope: string) => IRawStorage);
172
177
  /**
173
- * Storage configuration for storage profile nodes
178
+ * Storage configuration for a node that stores blocks
174
179
  */
175
180
  export interface StorageConfig {
176
181
  /**
@@ -344,10 +349,28 @@ export interface NetworkConfig {
344
349
  * `strand-instance-manager.ts`).
345
350
  */
346
351
  requireRelay?: boolean;
352
+ /**
353
+ * STUN servers for this node's WebRTC transport, as a comma-separated list of `stun:`
354
+ * URLs, overriding the ones derived from {@link relayAddrs}. Read on the path that derives
355
+ * a transport list here — a Node host's `/webrtc` listen entry (`relay-addrs.ts` →
356
+ * `resolveTransportOptions`), which is `cadre-cli`'s `network.webrtc`. The phone and browser
357
+ * apps build their own transports, so they call `resolveStunServers` (`relay-stun.ts`)
358
+ * themselves with the same spelling, from `EXPO_PUBLIC_STUN_URLS` / `VITE_STUN_URLS`.
359
+ *
360
+ * Omitted, each relay in {@link relayAddrs} supplies one `stun:<relay host>:3478`, since
361
+ * a Sereus relay answers STUN on that fixed port. Set this for a relay that answers STUN
362
+ * somewhere else, or to point ICE at a STUN server that is not a relay. An empty or
363
+ * whitespace-only value falls back to the relays, so a launcher passing an unset variable
364
+ * through changes nothing.
365
+ *
366
+ * Ignored by a node with no WebRTC transport, which is every node that neither supplies
367
+ * {@link transports} carrying one nor asks for a `/webrtc` listen entry.
368
+ */
369
+ stunUrls?: string;
347
370
  /**
348
371
  * Enable circuit relay server - allows this node to relay connections for other peers.
349
- * When undefined, defaults to true for storage profile nodes (they typically have
350
- * better connectivity and uptime), false for transaction profile nodes.
372
+ * When undefined, defaults to the resolved `roles.alwaysOn`: an always-on machine has the
373
+ * connectivity and uptime to be a relay, anything else does not.
351
374
  */
352
375
  enableRelay?: boolean;
353
376
  /**
@@ -774,8 +797,20 @@ export interface CadreNodeConfig {
774
797
  identityKeyId?: KeyId;
775
798
  /** Control network connection settings */
776
799
  controlNetwork: ControlNetworkConfig;
777
- /** Node profile: transaction-only or storage */
778
- profile: NodeProfile;
800
+ /** What kind of machine this node runs on ({@link NodeClass}): a device, or an always-on server. */
801
+ nodeClass: NodeClass;
802
+ /**
803
+ * Per-role overrides of what {@link nodeClass} means — each of the four decisions the class
804
+ * would otherwise settle on its own, settable one at a time. A role left out takes the
805
+ * class's preset; a misnamed role, or a value outside a role's own set, throws at
806
+ * construction rather than falling back to the preset. See {@link NodeRoles} for what each role does and
807
+ * `node-roles.ts` → `NODE_ROLE_PRESETS` for the two presets.
808
+ *
809
+ * `strandCohortMember: false` runs every strand as a client that stores none of its blocks
810
+ * (`docs/cadre/node.md` → "Node classes"); together with an explicit {@link hostUnclaimedStrands}
811
+ * `true` it is refused at construction, since a replica that stores nothing is a contradiction.
812
+ */
813
+ roles?: Partial<NodeRoles>;
779
814
  /** Which strands to participate in */
780
815
  strandFilter?: StrandFilter;
781
816
  /**
@@ -789,11 +824,15 @@ export interface CadreNodeConfig {
789
824
  * The strand is still announced as `strand:discovered` (once) and stays in
790
825
  * `getDiscoveredStrands()` until an app claims it. A replica is always a joiner.
791
826
  *
792
- * Default: `profile === 'storage'` — always-on machines host replicas, phones
793
- * (`'transaction'`) keep today's announce-only behaviour.
827
+ * Default: the resolved `roles.alwaysOn` on a node that holds strand blocks — an always-on
828
+ * machine hosts replicas, anything else keeps the announce-only behaviour — and `false` on a
829
+ * node whose `strandCohortMember` role is off, which can store nothing for a replica to
830
+ * serve. An explicit value here still wins, so a phone can be told to host replicas and an
831
+ * always-on machine told not to; an explicit `true` with `strandCohortMember: false` is
832
+ * refused at construction (`node-roles.ts` → `resolveHostUnclaimedStrands`).
794
833
  */
795
834
  hostUnclaimedStrands?: boolean;
796
- /** Storage configuration (only for storage profile) */
835
+ /** Storage configuration (only for a node that stores blocks) */
797
836
  storage?: StorageConfig;
798
837
  /** Network configuration */
799
838
  network?: NetworkConfig;
@@ -846,7 +885,7 @@ export interface CadreNodeConfig {
846
885
  * group a notification is rooted at. Enabling registers Optimystic's change-notification
847
886
  * protocol handlers on the strand node, which the closed-strand per-stream gate does not
848
887
  * cover, and each watched table registers again on every node build. Both
849
- * are spelled out in `docs/strands.md` → "Change notifications (reactivity)". The control
888
+ * are spelled out in `docs/strands/app-schema.md` → "Change notifications". The control
850
889
  * node never gets it.
851
890
  */
852
891
  strandReactivity?: StrandReactivityConfig;
@@ -912,7 +951,7 @@ export interface CadreNodeConfig {
912
951
  */
913
952
  strandFirstSync?: StrandFirstSyncConfig;
914
953
  /**
915
- * Offline mode on this node's strands (docs/strands.md → "Offline mode"): with it, an app can
954
+ * Offline mode on this node's strands (docs/strands/writes.md → "Offline mode"): with it, an app can
916
955
  * switch a strand so that a commit resolves once the transaction is queued on this machine
917
956
  * (`CadreNode.setStrandOfflineMode`), and the queue is saved in `journal` so it survives a
918
957
  * restart. Absent: no strand gets a queue, and `setStrandOfflineMode` throws
@@ -1165,6 +1204,7 @@ export type StrandStatus = 'starting' | 'syncing' | 'active' | 'idle' | 'hiberna
1165
1204
  export interface SAppInfo {
1166
1205
  id: string;
1167
1206
  version: string;
1207
+ schemaVersion: number;
1168
1208
  schema: string;
1169
1209
  signature?: string;
1170
1210
  }
@@ -1335,12 +1375,19 @@ export interface PendingJoinStatus {
1335
1375
  export interface SAppConfig {
1336
1376
  /** Public key of the sApp author */
1337
1377
  id: string;
1338
- /** Version of the sApp */
1378
+ /** Version of the sApp: its release string, which may change without a schema change */
1339
1379
  version: string;
1380
+ /**
1381
+ * Version of `schema`: a positive integer the app raises with every change to it. A strand
1382
+ * refuses an app whose number is below the highest it has seen (docs/strands/app-schema.md → "Every
1383
+ * member on the same schema version"). The author's signature covers it, so a host cannot
1384
+ * choose it.
1385
+ */
1386
+ schemaVersion: number;
1340
1387
  /** The declarative schema DDL */
1341
1388
  schema: string;
1342
1389
  /**
1343
- * Author's signature over the schema for verification. Required under the
1390
+ * Author's signature over `schema`, `version` and `schemaVersion` for verification. Required under the
1344
1391
  * default `requireSignedSchemas` node policy — a config without it is rejected
1345
1392
  * before strand bring-up. Optional in the type because authoring/serialization
1346
1393
  * must represent an as-yet-unsigned config; omitting it is honored only when
@@ -1597,7 +1644,7 @@ export interface FormStrandResult {
1597
1644
  * that node.
1598
1645
  *
1599
1646
  * One-shot and in-memory: they are the responder's addresses at the moment of
1600
- * formation and are never re-resolved — see `docs/strands.md`.
1647
+ * formation and are never re-resolved — see `docs/network/strand-addressing.md`.
1601
1648
  */
1602
1649
  strandAddrs: string[];
1603
1650
  }
@@ -1619,9 +1666,9 @@ export interface StrandFormationDisclosure {
1619
1666
  * Arachnode ring participation stub - will be implemented when arachnode is built
1620
1667
  */
1621
1668
  export interface ArachnodeConfig {
1622
- /** Enable Arachnode subsystem (Ring Zulu + storage rings). Storage-profile only. */
1669
+ /** Enable Arachnode subsystem (Ring Zulu + storage rings). `'server'` nodes only. */
1623
1670
  enableRingZulu: boolean;
1624
- /** Storage ring participation (storage profile only) */
1671
+ /** Storage ring participation (`'server'` nodes only) */
1625
1672
  storageRing?: {
1626
1673
  /** Which ring to participate in based on capacity */
1627
1674
  ring: number;
@@ -1644,7 +1691,9 @@ export interface CadreNodeEvents {
1644
1691
  * watcher retries emits this on every failed attempt. A launch that fails with an
1645
1692
  * `AppSchemaRefusedError` (found through wrapping errors by `appSchemaRefusalOf`), meaning the
1646
1693
  * app's schema can never apply to the tables the strand holds, is not retried until the app
1647
- * claims the strand again with {@link CadreNode.addStrand}, so it emits this once.
1694
+ * claims the strand again with {@link CadreNode.addStrand}, so it emits this once. Its subclass
1695
+ * `AppSchemaOutdatedError` means the strand records a higher `schemaVersion` than the app's: the
1696
+ * app must update.
1648
1697
  */
1649
1698
  'strand:error': {
1650
1699
  strandId: string;
@@ -1678,7 +1727,7 @@ export interface CadreNodeEvents {
1678
1727
  * returns: keep handlers short. Covers every commit on the strand database, cadre-core's own
1679
1728
  * membership writes included, so filter by the ids you hold — the `StampId()` a
1680
1729
  * `returning StampId() as Tx` statement gave you. The same record is readable afterwards with
1681
- * `StrandDatabase.commitDurability(tx)`. See docs/strands.md, "A commit's durability".
1730
+ * `StrandDatabase.commitDurability(tx)`. See docs/strands/writes.md, "A commit's durability".
1682
1731
  */
1683
1732
  'strand:commit-durability': StrandCommitDurability;
1684
1733
  /**
@@ -1695,7 +1744,7 @@ export interface CadreNodeEvents {
1695
1744
  * and every rebuild, unlike a listener on `StrandDatabase.offline`. A restored transaction's
1696
1745
  * `queued` status after a restart is not emitted: it was delivered before anything subscribed, so
1697
1746
  * read `offline.entries()` on the `strand:queue-state` that publication emits. A drained commit
1698
- * also emits `strand:commit-durability` as an online one does. See docs/strands.md, "Offline mode".
1747
+ * also emits `strand:commit-durability` as an online one does. See docs/strands/writes.md, "Offline mode".
1699
1748
  */
1700
1749
  'strand:offline-status': StrandOfflineStatus;
1701
1750
  /**
@@ -1707,7 +1756,7 @@ export interface CadreNodeEvents {
1707
1756
  * Emitted when a strand's database is published while its `App` schema apply is held back, by
1708
1757
  * queued offline transactions or by a strand cohort it could not reach (`waitingFor`), and
1709
1758
  * `StrandDatabase.appSchemaState()` reads `'waiting-for-queue'` or `'waiting-for-cohort'`. What the
1710
- * database runs meanwhile is in docs/strands.md → "An app schema upgrade waits for the queue or the
1759
+ * database runs meanwhile is in docs/strands/app-schema.md → "An app schema upgrade waits for the queue or the
1711
1760
  * cohort". A retry that fails for another reason is emitted as `strand:error`; a cancelled one emits
1712
1761
  * nothing.
1713
1762
  */
@@ -1768,7 +1817,7 @@ export interface CadreNodeEvents {
1768
1817
  * Emitted on the machine that replaced the party's membership key in a closed strand, once
1769
1818
  * the control record names the new key: a machine removed from the cadre is left holding a
1770
1819
  * key that is no longer a member there, and every machine's revoked-peer gate denies it on
1771
- * the rows alone (docs/architecture.md → "Removing a machine"). Every other machine of the
1820
+ * the rows alone (docs/cadre/membership.md → "Removing a machine"). Every other machine of the
1772
1821
  * party learns the new key from the replicated `StrandPartyKey` row and re-keys its running
1773
1822
  * strand without an event.
1774
1823
  */
@@ -1778,7 +1827,7 @@ export interface CadreNodeEvents {
1778
1827
  /**
1779
1828
  * Emitted when a party key replacement cannot be finished here: the party's current key holds
1780
1829
  * no `Strand.Manager` row in the strand, so it cannot seat the new key, and the strand's host
1781
- * has to re-invite the party, or its manager admit the new key by hand (docs/strands.md →
1830
+ * has to re-invite the party, or its manager admit the new key by hand (docs/strands/keys.md →
1782
1831
  * "Replacing the party's key"). Once per pending key; the `PendingStrandPartyKey` row stays,
1783
1832
  * the membership reconciler redeems the host's invitation under the new key when it arrives,
1784
1833
  * and `MachineRemovalResult.strands` reports the same strand as `needs-another-party`.
@@ -1825,7 +1874,7 @@ export interface CadreNodeEvents {
1825
1874
  * `addStrand` has resolved).
1826
1875
  *
1827
1876
  * On a node that hosts storage replicas ({@link CadreNodeConfig.hostUnclaimedStrands},
1828
- * the default for `profile: 'storage'`) the event still fires once, and the node launches
1877
+ * the default on an always-on node) the event still fires once, and the node launches
1829
1878
  * the strand as a replica right after it — so there `getStrands().has(id)` soon turns
1830
1879
  * true for a strand no app has claimed; an unclaimed instance has no `sAppInfo`. A
1831
1880
  * launch that fails is retried by the watcher without a second `strand:discovered`.
@@ -1914,7 +1963,7 @@ export interface CadreNodeEvents {
1914
1963
  *
1915
1964
  * This is the logical shape of a `CadreControl.CadrePeer` row. A node publishes
1916
1965
  * its own record (signing with the ed25519 key behind its PeerId); any node can
1917
- * resolve another member's current signaling/relay multiaddrs from only its
1966
+ * resolve another member's current relayed and direct multiaddrs from only its
1918
1967
  * PeerId by reading the record, re-verifying the self-signature against
1919
1968
  * `publicKey`, checking freshness, and applying a trust gate.
1920
1969
  *
@@ -1929,16 +1978,16 @@ export interface PeerAddressRecord {
1929
1978
  peerId: string;
1930
1979
  /** ed25519 public key (base64url) whose libp2p identity IS `peerId`. */
1931
1980
  publicKey: string;
1932
- /** Current dialable multiaddrs, signaling (`/p2p-circuit`) first. */
1981
+ /** Current dialable multiaddrs, relayed first and WebRTC last (`orderRelayedFirst` in `peer-record.ts`). */
1933
1982
  addrs: string[];
1934
1983
  /** epoch ms — freshness; strictly increasing per peer. */
1935
1984
  updatedAt: number;
1936
1985
  /**
1937
- * The publisher's own {@link CadreNodeConfig.profile}: `'transaction'` is an app (phone,
1938
- * browser), `'storage'` an always-on node. Null on a row the machine has not yet
1939
- * self-published (an owner or an invitation seated it).
1986
+ * Whether the publisher is always on, in the stored form the column holds
1987
+ * ({@link PublishedProfile}: `'storage'` yes, `'transaction'` no). Null on a row the machine
1988
+ * has not yet self-published (an owner or an invitation seated it).
1940
1989
  */
1941
- profile: NodeProfile | null;
1990
+ profile: PublishedProfile | null;
1942
1991
  /** ed25519 self-signature over the signed payload, base64url. */
1943
1992
  sig: string;
1944
1993
  }
@@ -1966,8 +2015,8 @@ export interface CadrePeerRow {
1966
2015
  multiaddr: string | null;
1967
2016
  /** The machine's freshness stamp (epoch ms); 0 when it has never self-published. */
1968
2017
  updatedAt: number;
1969
- /** The machine's self-declared node profile; null until it self-publishes. */
1970
- profile: NodeProfile | null;
2018
+ /** Whether the machine declared itself always on, stored form; null until it self-publishes. */
2019
+ profile: PublishedProfile | null;
1971
2020
  /** The machine's self-signature over its address record (`peerRecordSignedPayload`); null until it self-publishes. */
1972
2021
  sig: string | null;
1973
2022
  /** Single-use anti-replay nonce the voucher signature, or the usage row, is bound to. */
@@ -2100,7 +2149,7 @@ export interface OwnerGrantChain {
2100
2149
  * One machine of the cadre as `CadreNode.listMachines` reports it: a live `CadrePeer` row. An
2101
2150
  * owner key is not a machine; `CadreNode.listOwnerKeys` lists those.
2102
2151
  *
2103
- * `profile` and `lastPublishedAt` are the machine's own claim only when the row's
2152
+ * `alwaysOn` and `lastPublishedAt` are the machine's own claim only when the row's
2104
2153
  * self-signature verifies; both are null otherwise, so an owner re-vouch that bumped
2105
2154
  * `UpdatedAt` without re-signing, or a row the machine never published, reports nothing
2106
2155
  * rather than someone else's stamp.
@@ -2113,9 +2162,9 @@ export interface CadreMachine {
2113
2162
  isSelf: boolean;
2114
2163
  /** Passes this node's authorized-membership predicate now (`CadreNode.listAuthorizedMembers`; always false for self, which that set excludes). */
2115
2164
  trusted: boolean;
2116
- /** The machine's self-published node profile; null until it publishes, or when its signature does not verify. */
2117
- profile: NodeProfile | null;
2118
- /** `UpdatedAt` of its self-signed record, re-stamped while it runs; null on the same terms as `profile`. */
2165
+ /** Whether the machine says it is always on; null until it publishes, or when its signature does not verify. */
2166
+ alwaysOn: boolean | null;
2167
+ /** `UpdatedAt` of its self-signed record, re-stamped while it runs; null on the same terms as `alwaysOn`. */
2119
2168
  lastPublishedAt: number | null;
2120
2169
  /** `CadrePeer.VouchOwner`: the owner key that vouched it, or the issuer of the invitation that admitted it. */
2121
2170
  vouchedBy: string | null;
@@ -2164,7 +2213,7 @@ export interface MachineRemovalPlan {
2164
2213
  }
2165
2214
  /**
2166
2215
  * Where one closed strand's party key is replaced when a machine is removed
2167
- * (docs/architecture.md → "Removing a machine").
2216
+ * (docs/cadre/membership.md → "Removing a machine").
2168
2217
  */
2169
2218
  export interface StrandKeyRotationPlan {
2170
2219
  strandId: string;
@@ -2174,7 +2223,7 @@ export interface StrandKeyRotationPlan {
2174
2223
  * hibernating strand is reported `here` before its manager seat can be read; the removal
2175
2224
  * wakes it, and the outcome says what it found.
2176
2225
  * - `another-party`: the strand runs here, but the party holds no manager seat, so the strand's
2177
- * host has to re-invite the party, or its manager admit the new key by hand (docs/strands.md →
2226
+ * host has to re-invite the party, or its manager admit the new key by hand (docs/strands/keys.md →
2178
2227
  * "Replacing the party's key"); the replacement then finishes on an owner machine of this party.
2179
2228
  * - `later`: the strand does not run on this node (not launched here, excluded by its strand
2180
2229
  * filter, or still syncing), so the replacement waits for an owner machine that runs it.
@@ -2211,11 +2260,11 @@ export interface StrandKeyRotationOutcome {
2211
2260
  * control swap waits for a reachable sibling. Any owner machine running the strand finishes it.
2212
2261
  * - `needs-another-party`: the party holds no manager seat in the strand, so it cannot seat
2213
2262
  * its new key itself; the row stays pending until the strand's host re-invites the party, or
2214
- * its manager admits the new key by hand (docs/strands.md → "Replacing the party's key").
2263
+ * its manager admits the new key by hand (docs/strands/keys.md → "Replacing the party's key").
2215
2264
  */
2216
2265
  outcome: 'rotated' | 'pending' | 'needs-another-party';
2217
2266
  }
2218
- /** One closed strand whose membership key replacement has not finished (docs/architecture.md → "Removing a machine"). */
2267
+ /** One closed strand whose membership key replacement has not finished (docs/cadre/membership.md → "Removing a machine"). */
2219
2268
  export interface PendingPartyKeyRotation {
2220
2269
  strandId: string;
2221
2270
  /** The key the party is moving to, public half (base64url): what another party's manager admits by hand. */
@@ -2224,11 +2273,20 @@ export interface PendingPartyKeyRotation {
2224
2273
  superseded: string[];
2225
2274
  /**
2226
2275
  * Who can move the replacement forward from here, judged from this machine's view of the strand.
2227
- * - `another-party`: the strand runs here, the party holds no manager seat and `publicKey` is not a member, so another party's manager has to admit it: a fresh invitation to the strand redeemed on an owner device of this party, or the key admitted by hand.
2276
+ * - `another-party`: the strand runs here, the party holds no manager seat and `publicKey` is not a member, so another party's manager has to admit it: a fresh invitation to the strand redeemed on an owner device of this party the new key is sealed to (`sealedTo`), or the key admitted by hand.
2228
2277
  * - `sealed`: the strand has no managers at all and `publicKey` is not a member; nobody can admit it, and the removed machine stays a member until the strand is re-formed.
2229
- * - `owner-machine`: an owner device of this party that runs the strand finishes it (the strand does not run here, the party holds a manager seat, or `publicKey` is already a member), which this machine may or may not be. Also the answer when a read here fails.
2278
+ * - `owner-machine`: an owner device of this party the new key is sealed to (`sealedTo`) that runs the strand finishes it (the strand does not run here, the party holds a manager seat, or `publicKey` is already a member), which this machine may or may not be. Also the answer when a read here fails.
2230
2279
  */
2231
2280
  waitingOn: 'another-party' | 'sealed' | 'owner-machine';
2281
+ /**
2282
+ * The machines of this cadre the new key is sealed to: control peer ids, each a live machine
2283
+ * (`listMachines`) or this node, in no particular order. Only these can redeem the host's
2284
+ * invitation under the new key or finish the replacement, and only those of them that hold an
2285
+ * owner key. A machine admitted after the removal is never one. Empty when every machine it
2286
+ * was sealed to has left the cadre, or the row's envelope does not decode; removing a machine
2287
+ * then writes a replacement sealed to the machines present.
2288
+ */
2289
+ sealedTo: string[];
2232
2290
  }
2233
2291
  /** Why `CadreNode.removeOwner` refuses by name (`OwnerKeyRemovalRefusedError.code`). */
2234
2292
  export type OwnerKeyRemovalRefusal =
@@ -2284,7 +2342,7 @@ export interface OwnerKeyRemovalResult {
2284
2342
  /**
2285
2343
  * This node's own removal from its cadre, as it learned it: the `CadrePeer` tombstone naming
2286
2344
  * its peer id, read after it had seen its own live row (`CadreNode.removedFromCadre`, the
2287
- * `cadre:removed` event; "Removing a machine" in docs/architecture.md).
2345
+ * `cadre:removed` event; "Removing a machine" in docs/cadre/membership.md).
2288
2346
  */
2289
2347
  export interface CadreRemoval {
2290
2348
  /** The cadre this node was removed from (`CadreNode.partyId`). */
@@ -2341,8 +2399,9 @@ export interface OwnerGrantRedemptionResult {
2341
2399
  }
2342
2400
  /**
2343
2401
  * One `CadreControl.StrandPeer` row: a machine's own signed statement of the peer id it uses
2344
- * in one strand. {@link ControlDatabase.queryStrandPeers} returns only rows whose `sig`
2345
- * verifies; whether `peerId` is a live or removed machine is its caller's question.
2402
+ * in one strand, and of whether it serves the strand. {@link ControlDatabase.queryStrandPeers}
2403
+ * returns only rows whose `sig` verifies; whether `peerId` is a live or removed machine is its
2404
+ * caller's question.
2346
2405
  */
2347
2406
  export interface StrandPeerRow {
2348
2407
  strandId: string;
@@ -2350,7 +2409,9 @@ export interface StrandPeerRow {
2350
2409
  peerId: string;
2351
2410
  /** That machine's peer id in the strand's own network (`strandTransportKey`). */
2352
2411
  strandPeerId: string;
2353
- /** The machine's signature over the `'add'` digest (`strandPeerAddDigest`). */
2412
+ /** `'client'` when the machine stores none of the strand, null when it serves it. Fixed when the row is written. */
2413
+ role: StrandPeerRole | null;
2414
+ /** The machine's signature over the `'add'` digest (`strandPeerAddDigest`), in the form `role` selects. */
2354
2415
  sig: string;
2355
2416
  }
2356
2417
  /**
@@ -2418,7 +2479,11 @@ export interface ResolveOpts {
2418
2479
  * {@link DEFAULT_PEER_RECORD_MAX_AGE_MS}.
2419
2480
  */
2420
2481
  maxAgeMs?: number;
2421
- /** Return only `/p2p-circuit` signaling addrs (the WebRTC dial input). */
2482
+ /**
2483
+ * Return only the addresses that reach the peer through a relay hop — the plain relayed
2484
+ * shape and the WebRTC one alike ({@link isSignalingAddr}). The survivors keep the
2485
+ * relayed-first, WebRTC-last order every resolve applies.
2486
+ */
2422
2487
  signalingOnly?: boolean;
2423
2488
  /**
2424
2489
  * Pluggable trust gate, evaluated after signature + freshness pass. Defaults
@@ -2566,7 +2631,7 @@ export interface SeedPeer {
2566
2631
  multiaddrs: string[];
2567
2632
  /**
2568
2633
  * Dial this peer first: the machine that minted the seed (or answered the redemption) and
2569
- * every always-on machine (`CadrePeer.Profile = 'storage'`). A dial hint only — it grants
2634
+ * every machine that published itself as always on. A dial hint only — it grants
2570
2635
  * nothing, and says nothing about owner keys (`projectSeedPeers`).
2571
2636
  */
2572
2637
  preferred: boolean;
@@ -2724,8 +2789,9 @@ export interface StrandAddrResponse {
2724
2789
  /** Echoes the requested strand id; always empty on an `unavailable` reply. */
2725
2790
  strandId: string;
2726
2791
  /**
2727
- * Dialable strand-network multiaddr strings (signaling/`p2p-circuit` first);
2728
- * empty unless `status` is `ok` and the responder runs that strand.
2792
+ * Dialable strand-network multiaddr strings, relayed first and WebRTC last
2793
+ * (`orderRelayedFirst` in `peer-record.ts`); empty unless `status` is `ok` and
2794
+ * the responder runs that strand.
2729
2795
  */
2730
2796
  multiaddrs: string[];
2731
2797
  }
@@ -2807,7 +2873,11 @@ export interface CreateCadreInvitationOptions {
2807
2873
  * closed?". A minting machine that is itself always on can therefore read `issuer-only`.
2808
2874
  */
2809
2875
  export type CadreInvitationReach =
2810
- /** Another machine has a relayed (`/p2p-circuit`), public-name or public-IP WebSocket address. */
2876
+ /**
2877
+ * Another machine has a relayed (`/p2p-circuit`), public-name or public-IP WebSocket address.
2878
+ * A WebRTC address counts: its relay carries the signalling from any network. Whether ICE then
2879
+ * finds a path is a separate matter this does not judge — see `cadreInvitationReach`.
2880
+ */
2811
2881
  'anywhere'
2812
2882
  /** Other machines are named, but only at private or loopback addresses: works on their network only. */
2813
2883
  | 'local-network'
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAqHA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA6C;IAC5E,QAAQ,EAAE;QACR,WAAW,EAAE,QAAQ,EAAS,aAAa;QAC3C,gBAAgB,EAAE,QAAQ,EAAI,kBAAkB;QAChD,eAAe,EAAE,QAAQ,EAAK,MAAM;QACpC,oBAAoB,EAAE,CAAC;QACvB,kBAAkB,EAAE,QAAQ,CAAE,MAAM;KACrC;IACD,WAAW,EAAE;QACX,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAI,YAAY;QAC1C,gBAAgB,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,wBAAwB;QAC1D,eAAe,EAAE,EAAE,GAAG,IAAI,EAAI,mBAAmB;QACjD,oBAAo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