@serfab/cadre-core 0.11.0 → 0.13.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 (121) hide show
  1. package/README.md +3 -2
  2. package/dist/announce-addrs.d.ts +49 -0
  3. package/dist/announce-addrs.js +78 -0
  4. package/dist/announce-addrs.js.map +1 -0
  5. package/dist/cadre-node.d.ts +607 -53
  6. package/dist/cadre-node.js +1268 -157
  7. package/dist/cadre-node.js.map +1 -1
  8. package/dist/control-database.d.ts +174 -23
  9. package/dist/control-database.js +317 -107
  10. package/dist/control-database.js.map +1 -1
  11. package/dist/control-read-retry.d.ts +103 -0
  12. package/dist/control-read-retry.js +145 -0
  13. package/dist/control-read-retry.js.map +1 -0
  14. package/dist/control-retry.d.ts +101 -0
  15. package/dist/control-retry.js +108 -0
  16. package/dist/control-retry.js.map +1 -0
  17. package/dist/control-schema.d.ts +1 -1
  18. package/dist/control-schema.js +50 -6
  19. package/dist/control-schema.js.map +1 -1
  20. package/dist/control-write-retry.d.ts +59 -35
  21. package/dist/control-write-retry.js +21 -92
  22. package/dist/control-write-retry.js.map +1 -1
  23. package/dist/delegate-admission.d.ts +17 -15
  24. package/dist/delegate-admission.js +17 -15
  25. package/dist/delegate-admission.js.map +1 -1
  26. package/dist/enrolled-machine-store-file.d.ts +13 -0
  27. package/dist/enrolled-machine-store-file.js +41 -0
  28. package/dist/enrolled-machine-store-file.js.map +1 -0
  29. package/dist/enrolled-machine-store.d.ts +81 -0
  30. package/dist/enrolled-machine-store.js +225 -0
  31. package/dist/enrolled-machine-store.js.map +1 -0
  32. package/dist/file-durable-slot.js +5 -3
  33. package/dist/file-durable-slot.js.map +1 -1
  34. package/dist/index.d.ts +10 -6
  35. package/dist/index.js +39 -12
  36. package/dist/index.js.map +1 -1
  37. package/dist/membership-connection-gater.d.ts +226 -26
  38. package/dist/membership-connection-gater.js +316 -30
  39. package/dist/membership-connection-gater.js.map +1 -1
  40. package/dist/node-local-snapshot.d.ts +6 -0
  41. package/dist/node-local-snapshot.js +7 -1
  42. package/dist/node-local-snapshot.js.map +1 -1
  43. package/dist/{strand-backfill.d.ts → peer-join-backfill.d.ts} +49 -20
  44. package/dist/{strand-backfill.js → peer-join-backfill.js} +146 -56
  45. package/dist/peer-join-backfill.js.map +1 -0
  46. package/dist/peer-record.d.ts +26 -0
  47. package/dist/peer-record.js +32 -0
  48. package/dist/peer-record.js.map +1 -1
  49. package/dist/relay-addrs.d.ts +145 -22
  50. package/dist/relay-addrs.js +314 -31
  51. package/dist/relay-addrs.js.map +1 -1
  52. package/dist/relay-reservation.d.ts +20 -15
  53. package/dist/relay-reservation.js +18 -14
  54. package/dist/relay-reservation.js.map +1 -1
  55. package/dist/strand-addr-protocol.js +16 -0
  56. package/dist/strand-addr-protocol.js.map +1 -1
  57. package/dist/strand-database.d.ts +12 -0
  58. package/dist/strand-database.js +16 -0
  59. package/dist/strand-database.js.map +1 -1
  60. package/dist/strand-formation-manager.d.ts +22 -9
  61. package/dist/strand-formation-manager.js +20 -12
  62. package/dist/strand-formation-manager.js.map +1 -1
  63. package/dist/strand-formation-protocol.d.ts +83 -9
  64. package/dist/strand-formation-protocol.js +86 -10
  65. package/dist/strand-formation-protocol.js.map +1 -1
  66. package/dist/strand-instance-manager.d.ts +151 -17
  67. package/dist/strand-instance-manager.js +237 -32
  68. package/dist/strand-instance-manager.js.map +1 -1
  69. package/dist/strand-membership-writer.d.ts +118 -14
  70. package/dist/strand-membership-writer.js +203 -15
  71. package/dist/strand-membership-writer.js.map +1 -1
  72. package/dist/strand-network-config.d.ts +84 -0
  73. package/dist/strand-network-config.js +136 -0
  74. package/dist/strand-network-config.js.map +1 -0
  75. package/dist/strand-revocation-enforcer.d.ts +392 -0
  76. package/dist/strand-revocation-enforcer.js +533 -0
  77. package/dist/strand-revocation-enforcer.js.map +1 -0
  78. package/dist/strand-solicitation.d.ts +10 -3
  79. package/dist/strand-solicitation.js +12 -7
  80. package/dist/strand-solicitation.js.map +1 -1
  81. package/dist/strand-wake-protocol.d.ts +47 -2
  82. package/dist/strand-wake-protocol.js +76 -6
  83. package/dist/strand-wake-protocol.js.map +1 -1
  84. package/dist/strand-watcher.js +6 -1
  85. package/dist/strand-watcher.js.map +1 -1
  86. package/dist/types.d.ts +282 -43
  87. package/dist/types.js +7 -1
  88. package/dist/types.js.map +1 -1
  89. package/package.json +16 -8
  90. package/src/announce-addrs.ts +93 -0
  91. package/src/cadre-node.ts +1366 -171
  92. package/src/control-database.ts +2628 -2406
  93. package/src/control-read-retry.ts +167 -0
  94. package/src/control-retry.ts +190 -0
  95. package/src/control-schema.ts +50 -6
  96. package/src/control-write-retry.ts +30 -130
  97. package/src/delegate-admission.ts +17 -15
  98. package/src/enrolled-machine-store-file.ts +43 -0
  99. package/src/enrolled-machine-store.ts +280 -0
  100. package/src/file-durable-slot.ts +5 -3
  101. package/src/index.ts +477 -407
  102. package/src/membership-connection-gater.ts +539 -204
  103. package/src/node-local-snapshot.ts +13 -1
  104. package/src/peer-addr-book.ts +251 -250
  105. package/src/{strand-backfill.ts → peer-join-backfill.ts} +187 -75
  106. package/src/peer-record.ts +33 -0
  107. package/src/relay-addrs.ts +436 -111
  108. package/src/relay-reservation.ts +828 -823
  109. package/src/strand-addr-protocol.ts +17 -0
  110. package/src/strand-database.ts +17 -0
  111. package/src/strand-formation-manager.ts +511 -491
  112. package/src/strand-formation-protocol.ts +808 -692
  113. package/src/strand-instance-manager.ts +899 -611
  114. package/src/strand-membership-writer.ts +232 -15
  115. package/src/strand-network-config.ts +172 -0
  116. package/src/strand-revocation-enforcer.ts +653 -0
  117. package/src/strand-solicitation.ts +484 -472
  118. package/src/strand-wake-protocol.ts +94 -8
  119. package/src/strand-watcher.ts +319 -314
  120. package/src/types.ts +1554 -1309
  121. package/dist/strand-backfill.js.map +0 -1
@@ -192,6 +192,27 @@ async function strandTableCount(db, table) {
192
192
  }
193
193
  return 0;
194
194
  }
195
+ /**
196
+ * Whether any `Strand.Revocation` row has ever retired a `Manager` seat — the
197
+ * exact condition that permanently closes the founding branch of
198
+ * `Manager.Authorized` (see the schema's bootstrap-branch comment). Unfiltered
199
+ * scan + JavaScript comparison, the module's scan-not-seek idiom (rationale on
200
+ * {@link scanMemberPeers}).
201
+ *
202
+ * NOTE: walks the whole append-only `Strand.Revocation` table when no `Manager`
203
+ * tombstone is present (it returns on the first one it finds). Cheap at strand
204
+ * scale; if membership churn ever makes that table large — the growth the
205
+ * `Revocation` schema comment already flags, tracked by `debt-strand-tombstone-reap`
206
+ * — this wants a stored "founding closed" marker rather than a scan per call.
207
+ */
208
+ async function strandHasManagerRevocation(db) {
209
+ for await (const row of db.eval('select TableName from Strand.Revocation')) {
210
+ if (row.TableName === 'Manager') {
211
+ return true;
212
+ }
213
+ }
214
+ return false;
215
+ }
195
216
  /**
196
217
  * Insert the singleton `Strand.Header` if absent.
197
218
  *
@@ -260,12 +281,25 @@ async function insertFounderMemberIfAbsent(db, memberKey, strandId) {
260
281
  * `Manager.OnlyClosed` is a deferred (subquery) check evaluated at commit. The
261
282
  * sequential auto-commit Header→Member→Manager order in
262
283
  * {@link bootstrapFounderMembership} satisfies both.
284
+ *
285
+ * SEALED strands are skipped, not re-founded: a strand whose sole manager has
286
+ * {@link sealStrand}ed also has zero `Manager` rows, but its founding branch is
287
+ * closed for good (the schema's bootstrap branch requires no `Manager`-table
288
+ * `Revocation` row to exist). Attempting the founding insert here would be
289
+ * schema-rejected and turn every founder restart of a sealed strand into a
290
+ * loud failure — so this mirrors the schema's own gate and returns quietly.
291
+ * A crash BETWEEN the founding Member and Manager inserts leaves no Revocation
292
+ * rows at all, so that restart still completes the founding.
263
293
  */
264
294
  async function insertFounderManagerIfAbsent(db, memberKey, strandId) {
265
295
  if (await strandTableCount(db, 'Manager') > 0) {
266
296
  log('Manager already present for strand %s; skipping founder Manager', strandId);
267
297
  return;
268
298
  }
299
+ if (await strandHasManagerRevocation(db)) {
300
+ log('Strand %s has retired a manager seat (sealed); skipping founder Manager', strandId);
301
+ return;
302
+ }
269
303
  await db.exec(`insert into Strand.Manager (MemberKey, Generation, StampId)
270
304
  with context ManagerKey = null, Signature = null
271
305
  values (?, 0, ?)`, [memberKey, generateStrandStampId()]);
@@ -619,8 +653,15 @@ export async function addMemberByManager(db, params) {
619
653
  * A manager must resign its `Manager` row before (or in the same transaction
620
654
  * as) losing membership — `Member.NotAManager` rejects un-membering a key that
621
655
  * still holds a Manager row. And the strand never drops to zero members
622
- * (`Member.MinOneMember`, a local-count floor with the same cross-node caveat
623
- * as `MinOneManager`).
656
+ * (`Member.MinOneMember`, a local-count floor with the cross-node caveat its
657
+ * schema NOTE states).
658
+ *
659
+ * Callers running inside a cadre runtime should follow this write with
660
+ * `CadreNode.refreshRevocationEnforcement(strandId)`. The removed party's
661
+ * machines are refused at the network layer by the strand's revoked-peer gate
662
+ * (`strand-revocation-enforcer.ts`), which polls for membership changes because
663
+ * this bare `Database` handle raises no event the runtime can hook — so without
664
+ * that call the cut lands up to one poll interval (default 30 s) later.
624
665
  *
625
666
  * @param db - The closed strand's database.
626
667
  * @param params - The revoking manager keypair and the target member key.
@@ -659,6 +700,11 @@ export async function revokeMember(db, params) {
659
700
  * The same floors as {@link revokeMember} apply: a manager must resign first
660
701
  * (`NotAManager`) and the last member cannot leave (`MinOneMember`).
661
702
  *
703
+ * Like {@link revokeMember}, a caller inside a cadre runtime should follow this
704
+ * with `CadreNode.refreshRevocationEnforcement(strandId)` — here it is what
705
+ * makes the departing node notice its own departure promptly (the gate emits
706
+ * `strand:revoked` when it finds this node's own peer id revoked).
707
+ *
662
708
  * @param db - The closed strand's database.
663
709
  * @param params - The departing member's own keypair.
664
710
  * @throws If `Member.Authorized`, `Member.NotAManager`, or `Member.MinOneMember`
@@ -874,7 +920,17 @@ async function deleteOwnMemberPeer(db, params, stampId) {
874
920
  where MemberKey = ? and PeerId = ?`, [signature, memberKey, peerId]);
875
921
  await insertRevocation(db, 'MemberPeer', stampId, memberKeyPair);
876
922
  }
877
- /** The manager branch: a manager signs the manager-remove-tagged digest + tombstone. */
923
+ /**
924
+ * The manager branch: a manager signs the manager-remove-tagged digest + tombstone.
925
+ *
926
+ * NOTE: clearing an ORPHANED binding (one whose member was already removed) also
927
+ * forgets the NETWORK DENIAL of that peer id. The orphaned `MemberPeer` row IS
928
+ * the record the strand revoked-peer gate derives its deny set from
929
+ * (`strand-revocation-enforcer.ts`) — the `Strand.Revocation` tombstone keeps
930
+ * only the stamp, not the peer id — so once the orphan is cleared, remaining
931
+ * members' nodes resume answering and dialing that peer. Only clear a binding
932
+ * that should never have existed, or a peer that is truly gone.
933
+ */
878
934
  async function deleteMemberPeerByManager(db, params, stampId) {
879
935
  const { managerKeyPair, memberKey, peerId } = params;
880
936
  const signature = signStrandApproval(['Strand.MemberPeer', 'manager-remove', memberKey, peerId, stampId], managerKeyPair.privateKeyB64);
@@ -1027,13 +1083,19 @@ export async function admitManager(db, params) {
1027
1083
  * — deferred — IS enforced here: a signer that is neither an existing manager nor
1028
1084
  * the target itself is rejected at commit.
1029
1085
  *
1030
- * THE LAST MANAGER CANNOT BE REMOVED. `Manager.MinOneManager` (`check on delete`,
1031
- * deferred, so it sees the POST-delete count) rejects any delete that would leave the
1032
- * strand with zero managers — an admin-less closed strand could never admit anyone
1033
- * again, since `Invite`, `addMemberByManager`, and `addManager` all require a
1034
- * `Manager` row. The bootstrap branch of `Manager.Authorized` is gated to INSERTs
1086
+ * THE SOLE MANAGER CANNOT ORDINARILY RESIGN — it SEALS instead. The `'resign'`
1087
+ * branch of `Manager.Authorized` requires at least one manager in the POST-delete
1088
+ * image, so a resignation that would empty the `Manager` table is schema-rejected;
1089
+ * emptying it deliberately is a distinct, self-signed act — {@link sealStrand} —
1090
+ * that permanently freezes admission. This writer refuses the sole-manager
1091
+ * self-resignation up front with an error naming `sealStrand`; that TS guard is UX,
1092
+ * not the trust boundary — the schema rejects a mis-counted `'resign'` approval
1093
+ * regardless. Reading the count inside a caller-joined transaction is correct: an
1094
+ * add-then-resign hand-off composed in one transaction sees 2 and passes, while
1095
+ * the already-rejected delete-then-add swap sees 1 and is refused here as well as
1096
+ * by the schema. The bootstrap branch of `Manager.Authorized` is gated to INSERTs
1035
1097
  * (`old.MemberKey is null`), so it does not waive the signature check on a delete
1036
- * that drops the count toward the floor: a second-to-last removal is authorized
1098
+ * that drops the count toward zero: a second-to-last removal is authorized
1037
1099
  * exactly like any other.
1038
1100
  *
1039
1101
  * HAND-OFF ORDER: a sole manager transferring control must ADD the successor FIRST
@@ -1042,15 +1104,19 @@ export async function admitManager(db, params) {
1042
1104
  * successor's insert has no other manager to authorize it once the sole manager's
1043
1105
  * row is gone.
1044
1106
  *
1045
- * Cross-node caveat: `MinOneManager` counts rows visible to THIS transaction, so two
1046
- * nodes concurrently removing different managers can each see a survivor and still
1047
- * converge to zero. Noted in the schema; a cross-node floor is not attempted here.
1107
+ * Cross-node caveat: the `'resign'`/`'seal'` branches count rows visible to THIS
1108
+ * transaction, so two nodes concurrently removing different managers can each see
1109
+ * a survivor and still converge to zero — an unintended seal. Noted in the schema
1110
+ * (the `Manager` table's seal-propagation NOTE); a cross-node floor is not
1111
+ * attempted here.
1048
1112
  *
1049
1113
  * @param db - The closed strand's database.
1050
1114
  * @param params - The authorizing keypair and the target manager key.
1051
- * @throws If `Manager.Authorized` rejects (a signer that is neither another existing
1052
- * manager nor the target itself) or `Manager.MinOneManager` rejects (the removal
1053
- * would leave no managers); the whole delete+tombstone transaction rolls back.
1115
+ * @throws If the signer IS the target and it is the sole manager (before writing —
1116
+ * the operation the caller wants is {@link sealStrand}), or if `Manager.Authorized`
1117
+ * rejects (a signer that is neither another existing manager nor the target
1118
+ * itself, or a raw sole-manager `'resign'` whose post-image count is zero); the
1119
+ * whole delete+tombstone transaction rolls back.
1054
1120
  */
1055
1121
  export async function removeManager(db, params) {
1056
1122
  const { byManagerKeyPair, targetManagerKey } = params;
@@ -1060,6 +1126,10 @@ export async function removeManager(db, params) {
1060
1126
  return;
1061
1127
  }
1062
1128
  const tag = byManagerKeyPair.publicKeyB64 === targetManagerKey ? 'resign' : 'remove';
1129
+ if (tag === 'resign' && await strandTableCount(db, 'Manager') === 1) {
1130
+ throw new Error('Cannot resign as the SOLE manager: an ordinary resignation never empties the '
1131
+ + 'Manager table. To permanently freeze admission instead, call sealStrand.');
1132
+ }
1063
1133
  const signature = signStrandApproval(['Strand.Manager', tag, targetManagerKey, target.stampId], byManagerKeyPair.privateKeyB64);
1064
1134
  await inStrandTransaction(db, async () => {
1065
1135
  await db.exec(`delete from Strand.Manager
@@ -1069,4 +1139,122 @@ export async function removeManager(db, params) {
1069
1139
  });
1070
1140
  log('Removed manager %s by %s', targetManagerKey, byManagerKeyPair.publicKeyB64);
1071
1141
  }
1142
+ /**
1143
+ * Seal the strand: the SOLE manager deliberately steps down, permanently freezing
1144
+ * membership.
1145
+ *
1146
+ * A sealed strand has zero `Manager` rows, and every admission path — issuing or
1147
+ * cancelling an invitation, consuming one issued BEFORE the seal
1148
+ * (`ConsumedInvite.NotSealed`), admitting a member, promoting a manager — requires
1149
+ * one, so nobody can ever be let in again. That freeze is a privacy guarantee to
1150
+ * everyone who contributed: no key holds the power to admit a party who would then
1151
+ * read the strand's whole history. Sealing is irreversible — the founding branch
1152
+ * of `Manager.Authorized` closes for good once any manager stamp is retired into
1153
+ * `Strand.Revocation`. What remains possible: members may {@link leaveStrand}
1154
+ * (floored by `MinOneMember`), manage their own `MemberPeer` rows, and file
1155
+ * `Revocation` tombstones.
1156
+ *
1157
+ * The `'seal'` branch of `Manager.Authorized` accepts a self-signed delete only
1158
+ * when the POST-image manager count is ZERO — a distinct action tag from
1159
+ * `'resign'`, so a captured resignation approval can never seal and a raw writer
1160
+ * cannot seal by accident. Like {@link removeManager}, the delete pairs with its
1161
+ * `Strand.Revocation` tombstone in one transaction.
1162
+ *
1163
+ * The TS count/identity checks below are UX guards, not the trust boundary — the
1164
+ * schema rejects a mis-tagged or mis-counted approval regardless of what this
1165
+ * writer (or any raw writer) presents.
1166
+ *
1167
+ * NOTE: a seal approval is a bearer token for its row incarnation, like every other
1168
+ * self-signed approval here — but the `'seal'` branch's post-image count of 0 is
1169
+ * satisfied for EVERY row deleted in the same transaction, so N managers each
1170
+ * presenting a valid `'seal'` approval seal jointly (pinned as an accepted case in
1171
+ * `strand-seal.spec.ts`). Unreachable today: this writer mints a seal signature only
1172
+ * while its caller is the SOLE manager, and spends it immediately, so a second
1173
+ * manager never has one to combine. If seal-approval MINTING is ever split from
1174
+ * spending — offline signing, a two-phase seal, a queued approval — one manager
1175
+ * holding another's unspent seal approval could freeze the strand irreversibly
1176
+ * without its current consent; re-gate here (or narrow the schema branch) then.
1177
+ *
1178
+ * @param db - The closed strand's database.
1179
+ * @param params - The sole manager's own keypair.
1180
+ * @throws If more than one manager exists (the caller wants {@link removeManager}),
1181
+ * or the supplied keypair holds no `Manager` row while one exists, or the strand
1182
+ * holds no `Manager` row and has never retired one (not founded yet — see
1183
+ * {@link isStrandSealed}), or any schema constraint rejects; the whole
1184
+ * delete+tombstone transaction rolls back. A strand that is ALREADY sealed logs
1185
+ * and returns quietly (restart-safe, matching {@link bootstrapFounderMembership}
1186
+ * and {@link removeManager}'s absent-row no-op).
1187
+ */
1188
+ export async function sealStrand(db, params) {
1189
+ const { managerKeyPair } = params;
1190
+ const managerCount = await strandTableCount(db, 'Manager');
1191
+ if (managerCount === 0) {
1192
+ // Zero managers is NOT by itself a seal — a closed strand between its Header
1193
+ // and Manager founding inserts looks identical. The retired `Manager` stamp is
1194
+ // what separates "frozen forever" from "still foundable"; returning quietly on
1195
+ // the latter would report a seal that never happened.
1196
+ if (await strandHasManagerRevocation(db)) {
1197
+ log('Strand already sealed (no Manager rows, manager stamp retired); skipping seal');
1198
+ return;
1199
+ }
1200
+ throw new Error('Cannot seal: the strand holds no Manager row and has never retired one — it is '
1201
+ + 'not founded yet, not sealed. Bootstrap the founding manager first.');
1202
+ }
1203
+ if (managerCount > 1) {
1204
+ throw new Error(`Cannot seal: ${managerCount} managers exist and sealing is the SOLE manager's act. `
1205
+ + 'The other managers must step down first (removeManager).');
1206
+ }
1207
+ const self = await managerRow(db, managerKeyPair.publicKeyB64);
1208
+ if (self == null) {
1209
+ throw new Error('Cannot seal: the supplied keypair does not hold the sole Manager row.');
1210
+ }
1211
+ const signature = signStrandApproval(['Strand.Manager', 'seal', managerKeyPair.publicKeyB64, self.stampId], managerKeyPair.privateKeyB64);
1212
+ await inStrandTransaction(db, async () => {
1213
+ await db.exec(`delete from Strand.Manager
1214
+ with context ManagerKey = ?, Signature = ?
1215
+ where MemberKey = ?`, [managerKeyPair.publicKeyB64, signature, managerKeyPair.publicKeyB64]);
1216
+ await insertRevocation(db, 'Manager', self.stampId, managerKeyPair);
1217
+ });
1218
+ log('Sealed strand: sole manager %s stepped down', managerKeyPair.publicKeyB64);
1219
+ }
1220
+ /**
1221
+ * Whether the strand is `Type = 'c'` (closed). Reads the singleton `Header` via
1222
+ * the same `db.eval` scan idiom as {@link strandTableCount}; a strand with no
1223
+ * `Header` row yet reports `false`.
1224
+ */
1225
+ async function strandIsClosed(db) {
1226
+ for await (const row of db.eval('select Type from Strand.Header')) {
1227
+ return row.Type === 'c';
1228
+ }
1229
+ return false;
1230
+ }
1231
+ /**
1232
+ * Whether the strand is sealed: a CLOSED strand that holds no `Manager` rows AND
1233
+ * has retired at least one `Manager` stamp into `Strand.Revocation`.
1234
+ *
1235
+ * All three conjuncts are load-bearing:
1236
+ * - `Header.Type` — an OPEN strand never holds `Manager` rows at all
1237
+ * (`Manager.OnlyClosed`), so a bare manager-count test would report every open
1238
+ * strand as sealed.
1239
+ * - the manager count — sealing IS the empty `Manager` table.
1240
+ * - the retired `Manager` stamp — "sealed" means admission is frozen FOREVER, and
1241
+ * what makes it permanent is the founding branch of `Manager.Authorized`
1242
+ * refusing to re-seat a generation-0 manager once any `Manager` stamp has been
1243
+ * retired. Without this conjunct a closed strand that is merely NOT FOUNDED YET
1244
+ * reads as sealed: {@link bootstrapFounderMembership} commits `Header`,
1245
+ * `Member` and `Manager` as three sequential statements, so the window between
1246
+ * the first and the last is exactly "closed, zero managers, still foundable".
1247
+ *
1248
+ * Reads locally visible rows — a node that has not yet converged on the seal
1249
+ * still reports `false` (the schema's seal-propagation NOTE).
1250
+ *
1251
+ * @param db - The strand's database.
1252
+ * @returns `true` iff the strand is closed, holds zero `Manager` rows, and has
1253
+ * permanently closed its founding branch.
1254
+ */
1255
+ export async function isStrandSealed(db) {
1256
+ return await strandIsClosed(db)
1257
+ && await strandTableCount(db, 'Manager') === 0
1258
+ && await strandHasManagerRevocation(db);
1259
+ }
1072
1260
  //# sourceMappingURL=strand-membership-writer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"strand-membership-writer.js","sourceRoot":"","sources":["../src/strand-membership-writer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAGxH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,GAAG,GAAG,KAAK,CAAC,gCAAgC,CAAC,CAAC;AAEpD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAO,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,aAAqB;IACtE,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAe,CAAC;IACrE,OAAO,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,CAAW,CAAC;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one more libp2p node per
5
+ * strand, and every one of them is built from the SAME operator-written
6
+ * `NetworkConfig` block. Two of its fields describe a single endpoint on the host
7
+ * and therefore cannot be inherited literally by a second node on that host:
8
+ *
9
+ * - **`listenAddrs` with a fixed port.** `cadre-cli`'s example config ships
10
+ * `/ip4/0.0.0.0/tcp/4001`. The control node binds it first; every strand node
11
+ * then tries to bind the same port and fails with `EADDRINUSE`, so a machine
12
+ * configured with a fixed port could not start any strand at all.
13
+ * - **`announceAddrs` / `appendAnnounceAddrs`.** Any concrete announce entry names
14
+ * a port, and that port is the CONTROL node's. A strand node advertising it
15
+ * sends peers to the control node — and `announceAddrs` REPLACES the advertised
16
+ * set (see `announce-addrs.ts`), so that wrong address would be the ONLY thing
17
+ * the strand node publishes.
18
+ *
19
+ * The reachability model this rests on: **a strand node is not separately dialable
20
+ * at a published fixed address.** It is reached through (a) its ephemeral direct
21
+ * listener plus the addresses peers observe for it, and (b) circuit relay —
22
+ * `network.relayAddrs` resolves to per-relay `<relay>/p2p-circuit` listen entries
23
+ * that strand nodes DO inherit correctly, because the port inside such an entry is
24
+ * the relay's, not a local bind (`relay-addrs.ts`).
25
+ *
26
+ * Everything else in `NetworkConfig` — `relayAddrs`, `transports`,
27
+ * `connectionGater`, `enableRelay` — is inherited by the caller; this module
28
+ * only owns the two host-endpoint fields above. One caveat on `connectionGater`:
29
+ * an OPEN strand's node gets it unchanged, while a CLOSED strand's node composes
30
+ * revoked-peer denial onto it in `strand-instance-manager.ts` (every supplied
31
+ * hook still honored — see `strand-revocation-enforcer.ts`).
32
+ *
33
+ * It does carry one non-address option out with them: the WebSocket transport switch
34
+ * a `/ws` listen entry implies (`relay-addrs.ts` → `resolveTransportOptions`). That is
35
+ * DERIVED from the listen entries rather than inherited, so it has to be computed
36
+ * wherever they are, and a strand node whose listen entries reached libp2p without it
37
+ * would bind no WebSocket listener and report nothing.
38
+ */
39
+ import type { NetworkConfig } from './types.js';
40
+ /**
41
+ * The address-shaped `createLibp2pNode` options a strand node gets, ready to spread
42
+ * into the rest of its options.
43
+ *
44
+ * There is deliberately no announce field here: a strand node announces NOTHING the
45
+ * operator configured, only what libp2p derives for it (its own listeners, observed
46
+ * addresses, and any `/p2p-circuit` address a relay reservation earns).
47
+ *
48
+ * NOTE: accepted tradeoff — a hosted deployment that wants a strand node reachable
49
+ * at its own published public port has no way to say so; the announce config is
50
+ * dropped for strand nodes wholesale rather than per-strand. Nothing needs that
51
+ * today, and the alternative is a per-strand network-config surface. Revisit if a
52
+ * hosted or reverse-proxy deployment ever needs direct-dialable strand nodes.
53
+ */
54
+ export interface StrandNodeAddrs {
55
+ /**
56
+ * Listen entries for this strand node, or `undefined` when the operator
57
+ * configured neither `listenAddrs` nor `relayAddrs` — in which case the caller
58
+ * omits the option and inherits `@optimystic/db-p2p`'s own default.
59
+ */
60
+ listenAddrs?: string[];
61
+ /**
62
+ * The WebSocket transport switch those listen entries imply, present only when one
63
+ * of them names WebSocket (`relay-addrs.ts` → `resolveTransportOptions`). Not an
64
+ * address — it is deliberately `0` and nothing binds it — but it lives here because
65
+ * it is derived from, and must travel with, the listen entries above. Without it a
66
+ * `/ws` strand listen entry binds nothing and libp2p reports nothing.
67
+ */
68
+ wsPort?: number;
69
+ }
70
+ /**
71
+ * The strand-node view of `network`: the control node's resolved listen entries with
72
+ * every fixed direct port rewritten to an ephemeral one, and no announce fields.
73
+ *
74
+ * Validation is unchanged and still fail-fast — `resolveListenAddrs` throws here on a
75
+ * malformed `relayAddrs` entry exactly as it does for the control node.
76
+ *
77
+ * NOTE: announce entries are no longer validated on this path at all; the CONTROL
78
+ * node's own build (`cadre-node.ts`) is the only thing that parses them, and it runs
79
+ * before any strand starts, so a typo still refuses node start today. That is an
80
+ * ORDERING guarantee, not a structural one. Revisit if a strand node is ever built
81
+ * before the control node's libp2p options are resolved — a malformed announce entry
82
+ * would then go unreported until the control node's own build.
83
+ */
84
+ export declare function strandNodeAddrs(network: NetworkConfig | undefined): StrandNodeAddrs;
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Derive the per-STRAND-node view of the machine's one `NetworkConfig`.
3
+ *
4
+ * A cadre machine runs one **control** libp2p node plus one more libp2p node per
5
+ * strand, and every one of them is built from the SAME operator-written
6
+ * `NetworkConfig` block. Two of its fields describe a single endpoint on the host
7
+ * and therefore cannot be inherited literally by a second node on that host:
8
+ *
9
+ * - **`listenAddrs` with a fixed port.** `cadre-cli`'s example config ships
10
+ * `/ip4/0.0.0.0/tcp/4001`. The control node binds it first; every strand node
11
+ * then tries to bind the same port and fails with `EADDRINUSE`, so a machine
12
+ * configured with a fixed port could not start any strand at all.
13
+ * - **`announceAddrs` / `appendAnnounceAddrs`.** Any concrete announce entry names
14
+ * a port, and that port is the CONTROL node's. A strand node advertising it
15
+ * sends peers to the control node — and `announceAddrs` REPLACES the advertised
16
+ * set (see `announce-addrs.ts`), so that wrong address would be the ONLY thing
17
+ * the strand node publishes.
18
+ *
19
+ * The reachability model this rests on: **a strand node is not separately dialable
20
+ * at a published fixed address.** It is reached through (a) its ephemeral direct
21
+ * listener plus the addresses peers observe for it, and (b) circuit relay —
22
+ * `network.relayAddrs` resolves to per-relay `<relay>/p2p-circuit` listen entries
23
+ * that strand nodes DO inherit correctly, because the port inside such an entry is
24
+ * the relay's, not a local bind (`relay-addrs.ts`).
25
+ *
26
+ * Everything else in `NetworkConfig` — `relayAddrs`, `transports`,
27
+ * `connectionGater`, `enableRelay` — is inherited by the caller; this module
28
+ * only owns the two host-endpoint fields above. One caveat on `connectionGater`:
29
+ * an OPEN strand's node gets it unchanged, while a CLOSED strand's node composes
30
+ * revoked-peer denial onto it in `strand-instance-manager.ts` (every supplied
31
+ * hook still honored — see `strand-revocation-enforcer.ts`).
32
+ *
33
+ * It does carry one non-address option out with them: the WebSocket transport switch
34
+ * a `/ws` listen entry implies (`relay-addrs.ts` → `resolveTransportOptions`). That is
35
+ * DERIVED from the listen entries rather than inherited, so it has to be computed
36
+ * wherever they are, and a strand node whose listen entries reached libp2p without it
37
+ * would bind no WebSocket listener and report nothing.
38
+ */
39
+ import { multiaddr } from '@multiformats/multiaddr';
40
+ import { resolveListenAddrs, resolveTransportOptions } from './relay-addrs.js';
41
+ /**
42
+ * The strand-node view of `network`: the control node's resolved listen entries with
43
+ * every fixed direct port rewritten to an ephemeral one, and no announce fields.
44
+ *
45
+ * Validation is unchanged and still fail-fast — `resolveListenAddrs` throws here on a
46
+ * malformed `relayAddrs` entry exactly as it does for the control node.
47
+ *
48
+ * NOTE: announce entries are no longer validated on this path at all; the CONTROL
49
+ * node's own build (`cadre-node.ts`) is the only thing that parses them, and it runs
50
+ * before any strand starts, so a typo still refuses node start today. That is an
51
+ * ORDERING guarantee, not a structural one. Revisit if a strand node is ever built
52
+ * before the control node's libp2p options are resolved — a malformed announce entry
53
+ * would then go unreported until the control node's own build.
54
+ */
55
+ export function strandNodeAddrs(network) {
56
+ // The default `'configured'` relay route, deliberately NOT the control node's
57
+ // `'search'` route: nothing drives an explicit reservation for a strand node, so a
58
+ // bare `/p2p-circuit` search entry would register a pending reservation nobody fills
59
+ // and leave every NAT'd strand node undialable. See `relay-addrs.ts`.
60
+ const listenAddrs = resolveListenAddrs(network);
61
+ if (!listenAddrs) {
62
+ return {};
63
+ }
64
+ // An explicitly empty `listenAddrs` (the React Native "cannot listen" case) stays
65
+ // empty — rewriting must never resurrect a direct listener that was opted out of.
66
+ const rewritten = dedupe(listenAddrs.map(ephemeralPortListenAddr));
67
+ // Classified AFTER the ephemeral rewrite, so the check reads what this strand node
68
+ // will actually bind. Zeroing a port cannot change an entry's transport — only the
69
+ // `tcp`/`udp` component's value moves — so `/ip4/0.0.0.0/tcp/4002/ws` still resolves
70
+ // to WebSocket as `/ip4/0.0.0.0/tcp/0/ws`.
71
+ return { listenAddrs: rewritten, ...resolveTransportOptions(network, rewritten) };
72
+ }
73
+ /**
74
+ * One listen entry with its fixed direct port rewritten to `0`, so the OS assigns a
75
+ * free one per node. Interface and transport choices are preserved — `/ws`, a
76
+ * specific-interface bind, a `/udp/…/quic-v1` stack — since only the port is
77
+ * contended.
78
+ *
79
+ * Passed through UNCHANGED when there is nothing to rewrite, so the operator's exact
80
+ * string survives rather than being round-tripped through the multiaddr normalizer:
81
+ *
82
+ * - a circuit entry (`…/p2p-circuit`), whose embedded port belongs to the RELAY and
83
+ * is not a local bind at all;
84
+ * - a port that is already `0`, or an entry that names no port;
85
+ * - an unparsable entry — libp2p reports a bad listen addr itself, and this helper
86
+ * only ever narrows a port.
87
+ */
88
+ function ephemeralPortListenAddr(listenAddr) {
89
+ let components;
90
+ try {
91
+ components = multiaddr(listenAddr).getComponents();
92
+ }
93
+ catch {
94
+ return listenAddr;
95
+ }
96
+ if (components.some((c) => c.name === 'p2p-circuit')) {
97
+ return listenAddr;
98
+ }
99
+ if (!components.some(isFixedPort)) {
100
+ return listenAddr;
101
+ }
102
+ return multiaddr(components.map(withEphemeralPort)).toString();
103
+ }
104
+ /** A `tcp`/`udp` component naming a port the OS did not choose. */
105
+ function isFixedPort(component) {
106
+ return (component.name === 'tcp' || component.name === 'udp')
107
+ && component.value !== undefined
108
+ && component.value !== '0';
109
+ }
110
+ /**
111
+ * `component` with its port zeroed, or unchanged when it is not a fixed port.
112
+ *
113
+ * Rebuilt field-by-field rather than spread: a parsed component may carry a `bytes`
114
+ * cache, and `componentsToBytes` PREFERS that cache over `value` — a spread would
115
+ * re-encode the old port.
116
+ */
117
+ function withEphemeralPort(component) {
118
+ return isFixedPort(component)
119
+ ? { code: component.code, name: component.name, value: '0' }
120
+ : component;
121
+ }
122
+ /**
123
+ * Exact-string dedupe, first occurrence wins — matching `relay-addrs.ts`. Entries
124
+ * that differed only by port collapse into one after the rewrite, and libp2p would
125
+ * otherwise try to bind the same ephemeral-port entry twice.
126
+ *
127
+ * NOTE: an operator who writes two fixed ports on the same interface and transport
128
+ * (`/ip4/0.0.0.0/tcp/4001` and `…/tcp/4002`) gets ONE strand listener, not two, since
129
+ * the two entries are identical once zeroed. Intended — the ports were the only thing
130
+ * distinguishing them and neither survives. Revisit if a deployment ever needs a
131
+ * strand node to hold a fixed count of direct listeners.
132
+ */
133
+ function dedupe(addrs) {
134
+ return [...new Set(addrs)];
135
+ }
136
+ //# sourceMappingURL=strand-network-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strand-network-config.js","sourceRoot":"","sources":["../src/strand-network-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,SAAS,EAAkB,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAkC/E;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAAC,OAAkC;IAChE,8EAA8E;IAC9E,mFAAmF;IACnF,qFAAqF;IACrF,sEAAsE;IACtE,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,kFAAkF;IAClF,kFAAkF;IAClF,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC;IACnE,mFAAmF;IACnF,mFAAmF;IACnF,qFAAqF;IACrF,2CAA2C;IAC3C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,uBAAuB,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;AACpF,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAS,uBAAuB,CAAC,UAAkB;IACjD,IAAI,UAAuB,CAAC;IAC5B,IAAI,CAAC;QACH,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,aAAa,EAAE,CAAC;IACrD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAA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