@serfab/cadre-core 0.13.0 → 1.1.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 (131) hide show
  1. package/README.md +20 -6
  2. package/dist/bootstrap-peer-store-file.js +2 -2
  3. package/dist/bootstrap-peer-store.d.ts +32 -12
  4. package/dist/bootstrap-peer-store.js +41 -15
  5. package/dist/bootstrap-peer-store.js.map +1 -1
  6. package/dist/cadre-node.d.ts +558 -80
  7. package/dist/cadre-node.js +1060 -170
  8. package/dist/cadre-node.js.map +1 -1
  9. package/dist/control-authorization.d.ts +2 -2
  10. package/dist/control-authorization.js +1 -0
  11. package/dist/control-authorization.js.map +1 -1
  12. package/dist/control-cohort.d.ts +13 -26
  13. package/dist/control-cohort.js +0 -26
  14. package/dist/control-cohort.js.map +1 -1
  15. package/dist/control-database.d.ts +299 -44
  16. package/dist/control-database.js +469 -69
  17. package/dist/control-database.js.map +1 -1
  18. package/dist/control-read-retry.d.ts +40 -11
  19. package/dist/control-read-retry.js +48 -15
  20. package/dist/control-read-retry.js.map +1 -1
  21. package/dist/control-retry.d.ts +58 -3
  22. package/dist/control-retry.js +58 -3
  23. package/dist/control-retry.js.map +1 -1
  24. package/dist/control-schema.d.ts +1 -1
  25. package/dist/control-schema.js +103 -19
  26. package/dist/control-schema.js.map +1 -1
  27. package/dist/control-write-retry.d.ts +80 -11
  28. package/dist/control-write-retry.js +176 -29
  29. package/dist/control-write-retry.js.map +1 -1
  30. package/dist/enrolled-machine-store.js +2 -2
  31. package/dist/index.d.ts +14 -7
  32. package/dist/index.js +33 -6
  33. package/dist/index.js.map +1 -1
  34. package/dist/node-local-snapshot.d.ts +15 -7
  35. package/dist/node-local-snapshot.js +23 -8
  36. package/dist/node-local-snapshot.js.map +1 -1
  37. package/dist/peer-dial.d.ts +143 -0
  38. package/dist/peer-dial.js +176 -0
  39. package/dist/peer-dial.js.map +1 -0
  40. package/dist/relay-addrs.d.ts +90 -52
  41. package/dist/relay-addrs.js +91 -59
  42. package/dist/relay-addrs.js.map +1 -1
  43. package/dist/relay-reservation.d.ts +71 -3
  44. package/dist/relay-reservation.js +116 -8
  45. package/dist/relay-reservation.js.map +1 -1
  46. package/dist/seed-bootstrap.d.ts +30 -1
  47. package/dist/seed-bootstrap.js +62 -17
  48. package/dist/seed-bootstrap.js.map +1 -1
  49. package/dist/storage-scope.d.ts +62 -0
  50. package/dist/storage-scope.js +75 -0
  51. package/dist/storage-scope.js.map +1 -0
  52. package/dist/strand-database.d.ts +34 -16
  53. package/dist/strand-database.js +38 -24
  54. package/dist/strand-database.js.map +1 -1
  55. package/dist/strand-first-sync-gate.d.ts +152 -0
  56. package/dist/strand-first-sync-gate.js +208 -0
  57. package/dist/strand-first-sync-gate.js.map +1 -0
  58. package/dist/strand-formation-manager.d.ts +87 -5
  59. package/dist/strand-formation-manager.js +109 -5
  60. package/dist/strand-formation-manager.js.map +1 -1
  61. package/dist/strand-formation-protocol.d.ts +21 -1
  62. package/dist/strand-formation-protocol.js +30 -0
  63. package/dist/strand-formation-protocol.js.map +1 -1
  64. package/dist/strand-instance-manager.d.ts +243 -6
  65. package/dist/strand-instance-manager.js +470 -37
  66. package/dist/strand-instance-manager.js.map +1 -1
  67. package/dist/strand-member-key.d.ts +20 -12
  68. package/dist/strand-member-key.js +20 -12
  69. package/dist/strand-member-key.js.map +1 -1
  70. package/dist/strand-member-registry.js +3 -0
  71. package/dist/strand-member-registry.js.map +1 -1
  72. package/dist/strand-membership-reconciler.d.ts +361 -0
  73. package/dist/strand-membership-reconciler.js +548 -0
  74. package/dist/strand-membership-reconciler.js.map +1 -0
  75. package/dist/strand-membership-writer.d.ts +131 -11
  76. package/dist/strand-membership-writer.js +396 -134
  77. package/dist/strand-membership-writer.js.map +1 -1
  78. package/dist/strand-network-config.d.ts +46 -14
  79. package/dist/strand-network-config.js +79 -23
  80. package/dist/strand-network-config.js.map +1 -1
  81. package/dist/strand-solicitation.d.ts +10 -1
  82. package/dist/strand-solicitation.js +5 -0
  83. package/dist/strand-solicitation.js.map +1 -1
  84. package/dist/strand-wake-protocol.d.ts +11 -7
  85. package/dist/strand-wake-protocol.js +20 -52
  86. package/dist/strand-wake-protocol.js.map +1 -1
  87. package/dist/strand-watcher.js +6 -0
  88. package/dist/strand-watcher.js.map +1 -1
  89. package/dist/timed-step.d.ts +12 -0
  90. package/dist/timed-step.js +28 -0
  91. package/dist/timed-step.js.map +1 -0
  92. package/dist/timeout-scheduler.d.ts +19 -0
  93. package/dist/timeout-scheduler.js +22 -0
  94. package/dist/timeout-scheduler.js.map +1 -0
  95. package/dist/types.d.ts +262 -30
  96. package/dist/types.js.map +1 -1
  97. package/package.json +8 -8
  98. package/src/bootstrap-peer-store-file.ts +2 -2
  99. package/src/bootstrap-peer-store.ts +69 -27
  100. package/src/cadre-node.ts +7301 -6353
  101. package/src/control-authorization.ts +2 -1
  102. package/src/control-cohort.ts +122 -130
  103. package/src/control-database.ts +537 -69
  104. package/src/control-read-retry.ts +202 -167
  105. package/src/control-retry.ts +297 -190
  106. package/src/control-schema.ts +103 -19
  107. package/src/control-write-retry.ts +533 -383
  108. package/src/enrolled-machine-store.ts +2 -2
  109. package/src/index.ts +83 -6
  110. package/src/node-local-snapshot.ts +25 -8
  111. package/src/peer-dial.ts +215 -0
  112. package/src/relay-addrs.ts +458 -436
  113. package/src/relay-reservation.ts +951 -828
  114. package/src/seed-bootstrap.ts +76 -18
  115. package/src/storage-scope.ts +78 -0
  116. package/src/strand-database.ts +50 -27
  117. package/src/strand-first-sync-gate.ts +258 -0
  118. package/src/strand-formation-manager.ts +140 -5
  119. package/src/strand-formation-protocol.ts +43 -1
  120. package/src/strand-instance-manager.ts +577 -37
  121. package/src/strand-member-key.ts +20 -12
  122. package/src/strand-member-registry.ts +3 -0
  123. package/src/strand-membership-reconciler.ts +680 -0
  124. package/src/strand-membership-writer.ts +527 -189
  125. package/src/strand-network-config.ts +102 -24
  126. package/src/strand-solicitation.ts +16 -1
  127. package/src/strand-wake-protocol.ts +21 -66
  128. package/src/strand-watcher.ts +6 -0
  129. package/src/timed-step.ts +28 -0
  130. package/src/timeout-scheduler.ts +28 -0
  131. package/src/types.ts +1789 -1554
@@ -204,6 +204,30 @@ class FrameReader {
204
204
  // ── Result validation ────────────────────────────────────────────────────────
205
205
  /** Matches the placeholder cadre addrs (`cadre-a-1.local`, …) of the removed strand-proto transport. */
206
206
  const PLACEHOLDER_CADRE_ADDR = /^cadre-[ab]-\d+\.local$/;
207
+ /**
208
+ * Both halves of a {@link StrandMembershipInvite} are base64url ed25519 key encodings —
209
+ * 43 chars for 32 bytes. The bound is deliberately loose (a future encoding change must
210
+ * not silently strand joiners) while still capping what a hostile responder can make the
211
+ * initiator retain.
212
+ */
213
+ const MAX_MEMBERSHIP_INVITE_KEY_LENGTH = 256;
214
+ const BASE64URL_KEY = /^[A-Za-z0-9_-]+$/;
215
+ /**
216
+ * Is `value` a well-formed {@link StrandMembershipInvite} — exactly two bounded
217
+ * base64url strings? The initiator-side shape check for the one attacker-influenced
218
+ * OBJECT the formation result carries (`strandAddrs` gets the equivalent treatment in
219
+ * {@link sanitizeStrandAddrs}): a malformed field from a hostile responder must fail
220
+ * validation, never crash the initiator or be carried into the joiner's invite cache.
221
+ * `undefined` is NOT well-formed — absence is legal on the result and callers gate on
222
+ * presence first.
223
+ */
224
+ export function isWellFormedMembershipInvite(value) {
225
+ if (typeof value !== 'object' || value === null)
226
+ return false;
227
+ const { inviteKey, invitePrivateKey } = value;
228
+ const wellFormedKey = (key) => typeof key === 'string' && key.length > 0 && key.length <= MAX_MEMBERSHIP_INVITE_KEY_LENGTH && BASE64URL_KEY.test(key);
229
+ return wellFormedKey(inviteKey) && wellFormedKey(invitePrivateKey);
230
+ }
207
231
  /**
208
232
  * Structural check on a `responderCreates` result: the responder must have approved,
209
233
  * disclosed a non-empty real identity + cadre (not the legacy `cadre-*.local`
@@ -232,6 +256,12 @@ export function isValidResponderCreatesResult(response) {
232
256
  return false;
233
257
  if (provision.strand.createdBy !== 'responder')
234
258
  return false;
259
+ // Optional, but when present it must be well-formed: a malformed invitation is a
260
+ // membership the joiner can never redeem, so reject the result rather than accept a
261
+ // formation that would leave a half-member.
262
+ if (provision.membershipInvite !== undefined && !isWellFormedMembershipInvite(provision.membershipInvite)) {
263
+ return false;
264
+ }
235
265
  return true;
236
266
  }
237
267
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"strand-formation-protocol.js","sourceRoot":"","sources":["../src/strand-formation-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAsB,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,oFAAoF;AACpF,sCAAsC;AACtC,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAEpE,MAAM,GAAG,GAAG,KAAK,CAAC,8BAA8B,CAAC,CAAC;AAElD,yFAAyF;AACzF,MAAM,CAAC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;AAE5D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAEpD,4CAA4C;AAC5C,MAAM,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,0CAA0C;AAC1C,MAAM,0BAA0B,GAAG,KAAM,CAAC;AAC1C,yDAAyD;AACzD,MAAM,uBAAuB,GAAG,IAAK,CAAC;AACtC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,4BAA4B,GAAG,KAAM,CAAC;AAC5C;;;;;;;;GAQG;AACH,MAAM,yBAAy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C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,kBAAkB,EAAE,0BAA0B,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAA0B,CAAC,CAAC;YAChI,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBACvB,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,CAAC,MAAM,IAAI,oBAAoB,EAAE,CAAC,CAAC;YACpF,CAAC;YACD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YACpD,IAAI,CAAC,EAAE;gBAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;YAE/D,IAAI,CAAC,QAAQ,CAAC,eAAe;gBAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;YACrG,kFAAkF;YAClF,0DAA0D;YAC1D,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,eAAe,EAAE,WAAW,EAAE,mBAAmB,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACzG,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC;gBAAC,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;QACtD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,7 +1,32 @@
1
1
  import type { PrivateKey } from '@libp2p/interface';
2
2
  import { type PeerJoinBackfillConfig } from './peer-join-backfill.js';
3
3
  import { type StrandRevocationEnforcementConfig } from './strand-revocation-enforcer.js';
4
+ import { type PendingMembershipInviteSource, type StrandMembershipReconciliationConfig } from './strand-membership-reconciler.js';
5
+ import { type StrandFirstSyncConfig } from './strand-first-sync-gate.js';
4
6
  import type { StrandInstance, StrandRow, StorageConfig, NetworkConfig, LatencyHint, NodeProfile, SAppConfig } from './types.js';
7
+ /**
8
+ * Whether a tracked instance is launched but waiting for its first sync: the runtime is
9
+ * up (`libp2pNode` set) while the database is still withheld (`database` unset). That
10
+ * is the first-sync gate's state regardless of what `status` says — the hibernation
11
+ * manager's idle timer can flip a long-gated joiner to `'idle'` without changing it.
12
+ *
13
+ * NOTE: `status` is therefore not the source of truth for "gated": a joiner that reaches
14
+ * nobody for `idleTimeout` (5 min at the interactive hint) reads `'idle'`, then
15
+ * `'hibernating'`, while still holding no database. Harmless today — every decision the
16
+ * runtime makes goes through this predicate, {@link StrandInstanceManager.publishDatabase}
17
+ * announces on the idle-flipped instance exactly as on a `'syncing'` one, and an app that
18
+ * shows "waiting for the other member" on `'syncing'` merely sees "idle" instead after
19
+ * five minutes. If an app ever needs the gated LABEL to survive the idle flip, make the
20
+ * hibernation manager's idle transition preserve `'syncing'` rather than adding a flag.
21
+ */
22
+ export declare function isAwaitingFirstSync(instance: StrandInstance): boolean;
23
+ /**
24
+ * The status a LIVE instance (runtime rebuilt or woken) should report: `'active'` once its
25
+ * database is published, `'syncing'` while the first-sync gate still withholds it. Every
26
+ * site that would otherwise write `'active'` after a build or a wake goes through this,
27
+ * so a gated joiner never reads as writable.
28
+ */
29
+ export declare function liveStrandStatus(instance: StrandInstance): 'active' | 'syncing';
5
30
  /**
6
31
  * Configuration for starting a strand instance
7
32
  */
@@ -33,6 +58,17 @@ export interface StartStrandConfig {
33
58
  * never through a repeat `startStrand`.
34
59
  */
35
60
  founder?: boolean;
61
+ /**
62
+ * THIS party's own strand membership private key (base64 protobuf) for a closed
63
+ * strand — the identity the founder bootstrap derives `Member.Key` /
64
+ * `Manager.MemberKey` from. Resolved by the caller (`CadreNode.launchStrand`: an
65
+ * explicit attach-time key, else the control-layer `StrandPartyKey` row, healed by
66
+ * mint-on-launch for the founding machine) and retained with the launch config, so a
67
+ * hibernation wake rebuilds under the same identity. Deliberately NOT the strand
68
+ * row's shared `MemberPrivateKey` (see `StrandDatabaseConfig.partyMemberPrivateKey`).
69
+ * Absent for open strands, and for joiners with no persisted party key.
70
+ */
71
+ partyMemberPrivateKey?: string;
36
72
  /**
37
73
  * Number of nodes Optimystic is told this strand's replication cluster should
38
74
  * have. Same rule as {@link CadreNodeConfig.strandClusterSize}, which CadreNode
@@ -91,6 +127,26 @@ export interface StartStrandConfig {
91
127
  * (a removed party's peers keep being served).
92
128
  */
93
129
  revocationEnforcement?: StrandRevocationEnforcementConfig;
130
+ /**
131
+ * The staged formation membership invitation for THIS strand — the seam the
132
+ * bring-up membership reconciler (`strand-membership-reconciler.ts`) reads to
133
+ * redeem the party's `Strand.Member` seat, and clears once the invitation is
134
+ * spent, burned, or dead. `CadreNode.launchStrand` wires it over its in-memory
135
+ * `pendingMembershipInvites` map; read lazily per pass, so a re-formation that
136
+ * replaces the entry between passes is picked up. Only consulted for closed
137
+ * strands launched with a {@link partyMemberPrivateKey}; harmless otherwise.
138
+ */
139
+ pendingMembershipInvite?: PendingMembershipInviteSource;
140
+ /**
141
+ * Tuning for the CLOSED-strand membership reconciler, forwarded from
142
+ * {@link CadreNodeConfig.strandMembershipReconciliation}. Armed only for
143
+ * closed strands launched with a {@link partyMemberPrivateKey};
144
+ * `{ enabled: false }` disarms the loop (test fixtures that hand-drive the
145
+ * membership writers). When it names no `pollIntervalMs` the reconciler
146
+ * mirrors {@link revocationEnforcement}'s cadence — as its IDLE cadence and
147
+ * the cap of its unfinished-join retry ladder, not as a flat retry interval.
148
+ */
149
+ membershipReconciliation?: StrandMembershipReconciliationConfig;
94
150
  /**
95
151
  * Called when THIS node's own peer id turns up in the strand's revoked set —
96
152
  * this node's party was removed from the closed strand, or left it. Fires once
@@ -101,6 +157,37 @@ export interface StartStrandConfig {
101
157
  * this node's behalf — what to do about it is the app's call.
102
158
  */
103
159
  onSelfRevoked?: (strandId: string) => void;
160
+ /**
161
+ * Tuning for the JOINING machine's first-sync write gate (`strand-first-sync-gate.ts`),
162
+ * forwarded from {@link CadreNodeConfig.strandFirstSync}: the Header probe cadence while
163
+ * a non-founder launch is `'syncing'`, and the default budget {@link whenWritable} waits
164
+ * before rejecting. Founders and machines that already hold the Header are never gated.
165
+ */
166
+ firstSync?: StrandFirstSyncConfig;
167
+ /**
168
+ * Called when a launch that came up `'syncing'` (see {@link firstSync}) becomes
169
+ * writable: the strand's `Strand.Header` arrived from a peer — or a founder request
170
+ * ran the bootstrap against the gated database — and `instance.database` is now set.
171
+ * Never called for a launch that was writable when `startStrand`/`resumeStrand`
172
+ * resolved. `CadreNode` wires it to its `strand:writable` event. Retained with the
173
+ * launch config, so a hibernation resume that comes up gated announces too.
174
+ */
175
+ onWritable?: (strandId: string) => void;
176
+ /**
177
+ * Re-announce this strand's delegate peer id (`delegatePeerId` — the strand
178
+ * node's own transport peer id) to ONE relay (`relayAddr`, a direct dial addr
179
+ * with a trailing `/p2p/<relayPeerId>`), unthrottled. Awaited before every
180
+ * relay-reservation RE-drive of that relay — never before the first attempt,
181
+ * which the launch/resume seed pass has already announced for.
182
+ *
183
+ * Why: a party control node running the relay server admits the strand node on
184
+ * an in-memory delegate grant that a relay restart drops, so a re-drive that did
185
+ * not re-announce first would be denied at the relay's gate. `CadreNode` wires
186
+ * its own control-mesh announce here; a throw or rejection is logged by the
187
+ * supervisor and the re-drive still runs. Retained with the launch config, so a
188
+ * hibernation wake's rebuilt supervisors carry it too.
189
+ */
190
+ announceDelegateToRelay?: (strandId: string, relayAddr: string, delegatePeerId: string) => Promise<void>;
104
191
  }
105
192
  /**
106
193
  * Volatile inputs re-resolved when resuming a quiesced strand — the ones that can
@@ -167,6 +254,45 @@ export declare class StrandInstanceManager {
167
254
  * resume rebuilds it with a fresh (initially empty, fail-open) snapshot.
168
255
  */
169
256
  private revocationEnforcers;
257
+ /**
258
+ * The per-strand membership reconciler (closed strands launched with a party
259
+ * key only), keyed by strand id. Same lifecycle rationale as {@link backfills}:
260
+ * created in `buildStrandRuntime`, stopped and dropped in `releaseRuntime`, so
261
+ * quiesce → resume rebuilds it and re-runs the idempotent join ladder (redeem a
262
+ * staged invitation, write this machine's own `MemberPeer` binding) from scratch.
263
+ */
264
+ private membershipReconcilers;
265
+ /**
266
+ * The per-strand first-sync gate (`strand-first-sync-gate.ts`), keyed by strand id:
267
+ * holds a launch's `StrandDatabase` while it is NOT yet published on the instance.
268
+ * Present from the moment the database object exists in `buildStrandRuntime` until
269
+ * {@link publishDatabase} hands it to the app — so it doubles as the rollback handle
270
+ * for a failed `initialize()` — and, for a joiner that holds no `Strand.Header` yet,
271
+ * for as long as the launch stays `'syncing'`. Same lifecycle as {@link backfills}:
272
+ * stopped (its database closed) and dropped in `releaseRuntime`, so a quiesce →
273
+ * resume rebuild re-probes over the same store. An entry and `instance.database`
274
+ * are mutually exclusive.
275
+ */
276
+ private firstSyncGates;
277
+ /**
278
+ * Callers blocked in {@link whenWritable}, keyed by strand id. Resolved by
279
+ * {@link publishDatabase}, rejected by {@link stopStrand}; each waiter also carries
280
+ * its own timeout. Deliberately NOT cleared by `releaseRuntime`: a waiter outlives a
281
+ * quiesce → resume cycle, since the rebuild is what may finally publish the database.
282
+ */
283
+ private writableWaiters;
284
+ /**
285
+ * The per-strand relay-reservation supervisors — ONE PER CONFIGURED RELAY, each
286
+ * over the node's own bare `/p2p-circuit` listener for that relay
287
+ * (`strand-network-config.ts`) — keyed by strand id. Same lifecycle rationale as
288
+ * {@link backfills}: started in `buildStrandRuntime` right after the libp2p node
289
+ * exists, stopped FIRST and dropped in `releaseRuntime` (before the database
290
+ * closes and the node stops, so no re-drive dials a node being torn down), so
291
+ * quiesce → resume rebuilds them over the new node. What makes a strand node's
292
+ * lost relay slot come back on its own — the control node has the same loop in
293
+ * `CadreNode.reserveRelays`.
294
+ */
295
+ private relaySupervisors;
170
296
  /**
171
297
  * The resolved (cache-wrapped) raw storage per strand id — the instance's OWN
172
298
  * store, resolved once in `startStrand` and held until `stopStrand` disposes it.
@@ -230,16 +356,36 @@ export declare class StrandInstanceManager {
230
356
  */
231
357
  private buildStrandRuntime;
232
358
  /**
233
- * Release an instance's strand-network runtime: close the StrandDatabase, then
234
- * stop the libp2p node (construction order in reverse), clearing both fields
235
- * and zeroing connectedPeers. Tolerant of partially-built state — either handle
236
- * may be absent — so it doubles as rollback for a failed `buildStrandRuntime`.
237
- * Shared by `quiesceStrand`, `stopStrand`, and that rollback path.
359
+ * Release an instance's strand-network runtime: stop the relay supervisors and
360
+ * the other background loops, close the StrandDatabase, then stop the libp2p
361
+ * node (construction order in reverse), clearing both fields and zeroing
362
+ * connectedPeers. Tolerant of partially-built state — either handle may be
363
+ * absent — so it doubles as rollback for a failed `buildStrandRuntime`. Shared
364
+ * by `quiesceStrand`, `stopStrand`, and that rollback path.
238
365
  *
239
366
  * Leaves `strandStorages` untouched by design — the store outlives the runtime it
240
367
  * was built into, which is what makes a resume warm. Only `stopStrand` disposes it.
241
368
  */
242
369
  private releaseRuntime;
370
+ /**
371
+ * One {@link superviseRelayReservation} per relay dial addr, each over exactly
372
+ * that relay so "held" is judged per relay (`circuitMultiaddrsVia`) and losing
373
+ * one relay re-drives only that one. Default timings — the control node's (2 s
374
+ * doubling to 60 s between failed attempts, a 5 s liveness check while held).
375
+ *
376
+ * Each supervisor's `beforeRedrive` is the caller's
377
+ * {@link StartStrandConfig.announceDelegateToRelay} for THIS relay and THIS
378
+ * node's peer id, so a re-drive after a relay restart is preceded by a fresh
379
+ * delegate grant on the relay about to be dialed. Returns `[]` when no relay is
380
+ * configured — the strand then simply has no circuit listener to fill.
381
+ */
382
+ private startRelaySupervisors;
383
+ /**
384
+ * Wait for every relay supervisor's first attempt to settle, concurrently, and log
385
+ * the ones that landed nothing. Never throws — a strand whose relay is unreachable
386
+ * at launch still comes up, with its supervisors retrying in the background.
387
+ */
388
+ private awaitFirstRelayAttempts;
243
389
  /**
244
390
  * Drop the strand's owned store and release this strand's claim on its cache. The
245
391
  * wrapper counts holders, so the cache is emptied and unregistered from the shared
@@ -270,6 +416,31 @@ export declare class StrandInstanceManager {
270
416
  * finished.
271
417
  */
272
418
  refreshRevocationEnforcement(strandId: string): Promise<void>;
419
+ /**
420
+ * Best-effort removal of THIS machine's own `Strand.MemberPeer` binding — the
421
+ * self arm of `removeMemberPeer`, signed with the retained launch config's party
422
+ * key. Called by `CadreNode.unpublishStrand` BEFORE the local stop, while the
423
+ * strand database and transport are still live: after the unpublish commits, the
424
+ * party's `StrandPartyKey` control row is gone, so no restart could ever sign
425
+ * this removal again — the in-memory retained key is the last chance.
426
+ *
427
+ * Never throws. Quiet no-op for a strand that is untracked, open, or launched
428
+ * without a party key; a quiesced (hibernating) strand, or a strand whose write
429
+ * quorum is already unreachable, leaves the stale binding behind with a log —
430
+ * it grants nothing today (admission is not allowlist-gated) and only
431
+ * mis-credits diversity. The strand's own membership reconciler is stopped —
432
+ * and its in-flight pass awaited — FIRST, so a pass that was already past its
433
+ * own stopped check cannot re-register the binding this is about to clear.
434
+ *
435
+ * NOTE: deliberately NOT handled here (or anywhere yet): clearing the bindings
436
+ * of a machine removed from the CADRE at the control layer, or of a party's
437
+ * OTHER machines when the party unpublishes — the party still holds the key on
438
+ * every surviving machine and can clear from any of them, and the stale rows
439
+ * grant nothing while admission is deny-list only. Revisit when
440
+ * `feat-strand-member-allowlist-admission` lands and a stale binding starts
441
+ * granting admission rather than merely mis-crediting diversity.
442
+ */
443
+ clearOwnMemberPeerBinding(strandId: string): Promise<void>;
273
444
  /**
274
445
  * Quiesce a strand: release its strand-network resources (stop the libp2p node,
275
446
  * close the StrandDatabase) while RETAINING the instance record — identity,
@@ -307,10 +478,71 @@ export declare class StrandInstanceManager {
307
478
  * database), so the bootstrap could not run here: the CALLER must wake the
308
479
  * strand (`CadreNode.wakeStrand`, which owns the hibernation bookkeeping this
309
480
  * manager does not) so the rebuild — which now founds — runs it.
481
+ * @param resolvePartyKey - Asked for the party's own membership key when (and only
482
+ * when) a CLOSED strand's retained config carries none — the instance was launched
483
+ * as a joiner before its `StrandPartyKey` row existed or replicated. The resolved
484
+ * key is retained alongside the founder flip so the bootstrap (now, or on the
485
+ * caller's wake for `'needs-resume'`) can seat the founding Member/Manager.
310
486
  * @throws when the strand is not tracked — this seam exists only for the
311
487
  * tracked-instance launch path; an untracked id is a caller bug.
488
+ * @throws whatever the live bootstrap throws (e.g. `PreSplitStrandIdentityError`),
489
+ * after {@link withdrawFounderRequest} — so a retry re-attempts the founding rather
490
+ * than resolving `'already-founder'` over an instance that never founded. A caller
491
+ * whose `'needs-resume'` wake fails owes the same withdrawal.
492
+ */
493
+ foundExistingStrand(strandId: string, resolvePartyKey?: () => Promise<string | undefined>): Promise<'already-founder' | 'bootstrapped' | 'needs-resume'>;
494
+ /**
495
+ * Whether `strandId` is launched but still waiting for its first sync — a joiner whose
496
+ * runtime is up while its database is withheld (status `'syncing'`, or `'idle'` after
497
+ * the hibernation manager's idle timer fired on it). `false` for a writable, quiesced,
498
+ * or untracked strand. The predicate {@link whenWritable}'s callers gate on.
312
499
  */
313
- foundExistingStrand(strandId: string): Promise<'already-founder' | 'bootstrapped' | 'needs-resume'>;
500
+ isAwaitingFirstSync(strandId: string): boolean;
501
+ /**
502
+ * Resolve once the strand's database is published to the app — immediately for a
503
+ * writable strand — or reject with {@link StrandAwaitingFirstSyncError} after
504
+ * `timeoutMs` (default: the retained launch config's `firstSync.timeoutMs`, else
505
+ * {@link DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS}). The rejection is RETRYABLE: nothing is
506
+ * torn down, the gate keeps probing, and a later call waits afresh. A quiesced
507
+ * (hibernating) strand is not woken here — the wait spans a resume, so a caller that
508
+ * wants one wakes it (`CadreNode.wakeStrand`) and waits. Rejects immediately for an
509
+ * untracked strand, and whenever the strand is stopped while a wait is pending.
510
+ */
511
+ whenWritable(strandId: string, options?: {
512
+ timeoutMs?: number;
513
+ }): Promise<StrandInstance>;
514
+ /**
515
+ * Hand a launch's database to the app: set `instance.database`, retire the gate that
516
+ * held it, release every {@link whenWritable} waiter, and — when the launch had already
517
+ * been reported gated — flip it `'active'` and announce it through the retained config's
518
+ * `onWritable`. "Reported gated" is any status but `'starting'`: `'syncing'`, or the
519
+ * `'idle'` the hibernation manager's idle timer flips a long-gated joiner to (see
520
+ * {@link isAwaitingFirstSync}) — the Header arriving after that flip must announce too,
521
+ * or an app hanging on `strand:writable` never learns the strand opened. A publish that
522
+ * lands while the instance is still `'starting'` (the Header arrived during the rest of
523
+ * bring-up) announces nothing: `startStrand` / `resumeStrand` are about to report the
524
+ * strand `'active'`, and `strand:writable` is defined as the follow-up to a gated
525
+ * launch, never a duplicate of `strand:started`.
526
+ *
527
+ * It is also the one seam where a WITHHELD database becomes available, so it kicks the
528
+ * membership reconciler: on a gated launch that loop's own immediate pass ran while
529
+ * `instance.database` was still unset, found no database, and would otherwise not try
530
+ * again until its retry timer fired. A launch that was never gated publishes here BEFORE
531
+ * the reconciler is constructed, so there is nothing registered to kick and the loop's own
532
+ * immediate pass already sees the database — which is why the kick needs no `wasGated`
533
+ * test of its own.
534
+ */
535
+ private publishDatabase;
536
+ /** Reject every {@link whenWritable} waiter for a strand that is going away. */
537
+ private rejectWritableWaiters;
538
+ /**
539
+ * Undo {@link foundExistingStrand}'s founder flip after the founding it promised
540
+ * failed, so the retained config again says what this instance actually runs as (a
541
+ * joiner) and the next founder request re-attempts the bootstrap. The resolved party
542
+ * key stays retained — it is this party's identity for the strand either way. No-op
543
+ * when the strand is untracked or its config does not found.
544
+ */
545
+ withdrawFounderRequest(strandId: string): void;
314
546
  /**
315
547
  * Run the (idempotent) founder bootstrap against a tracked strand's LIVE
316
548
  * database, independently of what the retained launch config says.
@@ -323,6 +555,11 @@ export declare class StrandInstanceManager {
323
555
  * and is the only thing that makes "founding resolves once the Header is
324
556
  * written" true on that path.
325
557
  *
558
+ * A strand still `'syncing'` (its database withheld behind the first-sync gate) is
559
+ * founded through the gate: the bootstrap writes the Header this machine was waiting
560
+ * to receive, so a successful run publishes the database and the strand goes
561
+ * `'active'` — the one legitimate way a joiner launch becomes writable without a peer.
562
+ *
326
563
  * @throws when the strand is not tracked, or is still quiesced (no live
327
564
  * database) — both mean the bootstrap did NOT run, which a founder request
328
565
  * must never swallow.