@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
@@ -8,11 +8,12 @@ import { type StrandRevocationEnforcementConfig } from './strand-revocation-enfo
8
8
  import { type PendingMembershipInviteSource, type StrandMembershipReconciliationConfig } from './strand-membership-reconciler.js';
9
9
  import type { PartyStrandPeer, PartyStrandPeerSource } from './strand-party-peers.js';
10
10
  import { type StrandFirstSyncConfig } from './strand-first-sync-gate.js';
11
- import type { StrandInstance, StrandRow, StorageConfig, NetworkConfig, LatencyHint, NodeProfile, SAppConfig } from './types.js';
11
+ import type { StrandInstance, StrandRow, StorageConfig, NetworkConfig, LatencyHint, SAppConfig } from './types.js';
12
+ import type { NodeRoles } from './node-roles.js';
12
13
  import { type StrandReactivityConfig } from './strand-reactivity.js';
13
14
  /**
14
- * How often a joining launch that could not build its database, because no seed peer had
15
- * answered, retries the build on its running libp2p node
15
+ * How often a launch that could not build its database, because no machine that can answer for
16
+ * the strand's blocks was reachable, retries the build on its running libp2p node
16
17
  * (`StrandInstanceManager.deferUnreachableJoin`). Each attempt composes a fresh database and
17
18
  * re-reads the schema catalog over the network, so it is spaced well above the first-sync
18
19
  * gate's probe cadence.
@@ -61,7 +62,15 @@ export interface StartStrandConfig {
61
62
  sAppConfig?: SAppConfig;
62
63
  storage?: StorageConfig;
63
64
  network?: NetworkConfig;
64
- profile: NodeProfile;
65
+ /**
66
+ * What this node does, resolved once by the owning {@link CadreNode} (`node-roles.ts`).
67
+ * Retained with the launch config, so a strand woken from hibernation is rebuilt with the
68
+ * same roles. Read here for the FRET tier, Ring Zulu, the relay-server default, the
69
+ * cohort-topic host profile, and — `strandCohortMember` — whether the strand node stores
70
+ * the strand's blocks or is built as a client that reads and writes through the machines
71
+ * that do (`buildStrandRuntime`; `startStrand` resolves no store for a client).
72
+ */
73
+ roles: NodeRoles;
65
74
  defaultLatencyHint: LatencyHint;
66
75
  privateKey?: PrivateKey;
67
76
  /** Cohort-derived discovery seed (multiaddr strings). Defaults to [] when omitted. */
@@ -265,15 +274,16 @@ export interface StartStrandConfig {
265
274
  */
266
275
  onCommitHeld?: (event: StrandCommitHeld) => void;
267
276
  /**
268
- * Offline mode for this strand (docs/strands.md → "Offline mode"), forwarded from
277
+ * Offline mode for this strand (docs/strands/writes.md → "Offline mode"), forwarded from
269
278
  * `CadreNodeConfig.strandOffline`, with where each database built for the launch reports its
270
279
  * queue (`CadreNode` emits them as events). Absent: no database gets an offline queue. The mode
271
280
  * itself is the manager's, per strand ({@link StrandInstanceManager.setOfflineMode}).
272
281
  */
273
282
  offline?: StrandOfflineConfig & StrandOfflineListeners;
274
283
  /**
275
- * Where each database built for the launch reports an `App` schema apply it held back
276
- * (`CadreNode` emits them as events). Retained and isolated like {@link onCommitDurability}.
284
+ * Where each database built for the launch reports an `App` schema apply it held back, and a
285
+ * higher App schema version another member recorded (`CadreNode` emits the first as events and
286
+ * stops the strand on the second). Retained and isolated like {@link onCommitDurability}.
277
287
  */
278
288
  appSchema?: StrandAppSchemaListeners;
279
289
  /**
@@ -353,7 +363,7 @@ export declare class StrandInstanceManager {
353
363
  /**
354
364
  * Retained launch config per strand, captured in `startStrand` and cleared in
355
365
  * `stopStrand`. `resumeStrand` reuses it to rebuild a quiesced strand's runtime
356
- * without the caller re-threading storage/network/profile/key/sApp config.
366
+ * without the caller re-threading storage/network/node-class/key/sApp config.
357
367
  */
358
368
  private launchConfigs;
359
369
  /**
@@ -419,6 +429,13 @@ export declare class StrandInstanceManager {
419
429
  * nobody and a resume redials over the new node.
420
430
  */
421
431
  private peerRedials;
432
+ /**
433
+ * The per-strand background WebRTC upgrade of relayed connections (`webrtc-upgrade.ts`), keyed
434
+ * by strand id. Same lifecycle as {@link peerRedials}: started in `buildStrandRuntime` once
435
+ * the libp2p node exists, stopped first in `releaseRuntime`, so a hibernating strand dials no
436
+ * upgrade and a resume judges the new node's connections with no backoff carried over.
437
+ */
438
+ private webrtcUpgrades;
422
439
  /**
423
440
  * The party's other machines known to hold each strand (`strand-party-machines.ts`), keyed
424
441
  * by strand id, on a node offering offline mode for a launch with a party-machine seam. Same
@@ -474,10 +491,19 @@ export declare class StrandInstanceManager {
474
491
  private transitions;
475
492
  /**
476
493
  * The pending database retry per strand id of a launch whose database could not be built
477
- * because no seed peer had answered yet ({@link deferUnreachableJoin}). Cleared by
494
+ * because no machine that can answer for the strand's blocks was reachable yet
495
+ * ({@link deferUnreachableJoin}). Cleared by
478
496
  * {@link releaseRuntime}, so a stop or a quiesce cancels it.
479
497
  */
480
498
  private unreachableJoinRetries;
499
+ /**
500
+ * Per strand id, the sApp claim ({@link attachSApp}) whose schema the retained launch config
501
+ * carries but no apply has landed yet: the claim found no live database, or its live apply failed
502
+ * for a reason that may pass. Lets a build that refuses that schema fall back to the replica
503
+ * ({@link revertRefusedAttach}). Deleted when a database applies the schema, by that fallback,
504
+ * and when {@link stopStrand} begins.
505
+ */
506
+ private unappliedAttaches;
481
507
  /**
482
508
  * The offline mode set per strand id ({@link setOfflineMode}); a strand absent here runs in its
483
509
  * launch's `initialMode`. Never cleared: the mode belongs to the strand, not to one database, so
@@ -506,6 +532,8 @@ export declare class StrandInstanceManager {
506
532
  * Check if a strand is currently running
507
533
  */
508
534
  hasStrand(strandId: string): boolean;
535
+ /** The sApp config the tracked strand's next build applies (its retained launch config's), or `undefined` for a replica or an untracked strand. */
536
+ launchedSAppConfig(strandId: string): SAppConfig | undefined;
509
537
  /**
510
538
  * Start a new strand instance.
511
539
  *
@@ -539,15 +567,15 @@ export declare class StrandInstanceManager {
539
567
  * Build (or rebuild) the libp2p node + StrandDatabase for an instance and
540
568
  * attach them, transitioning it to `active`. Shared by `startStrand` (fresh
541
569
  * launch) and `resumeStrand` (rehydrating a quiesced instance). Reads all
542
- * volatile inputs (bootstrapNodes, servingMachines, network, profile,
570
+ * volatile inputs (bootstrapNodes, servingMachines, network, roles,
543
571
  * privateKey, sApp config) from `config`, so the caller controls the
544
572
  * cohort-derived values. Storage is the
545
573
  * one input it does NOT re-read from `config`: that belongs to the instance and
546
574
  * comes from `strandStorages`.
547
575
  *
548
- * A database that cannot be built because no seed peer has answered yet does not fail the
549
- * build: the runtime comes up `'syncing'` without it and the database phase alone is
550
- * retried on the same node ({@link deferUnreachableJoin}).
576
+ * A database that cannot be built because no machine that can answer for the strand's blocks
577
+ * was reachable does not fail the build: the runtime comes up `'syncing'` without it and the
578
+ * database phase alone is retried on the same node ({@link deferUnreachableJoin}).
551
579
  */
552
580
  private buildStrandRuntime;
553
581
  /**
@@ -556,10 +584,13 @@ export declare class StrandInstanceManager {
556
584
  * {@link buildStrandRuntime} and again by each {@link retryUnreachableJoin}, with a new
557
585
  * StrandDatabase per attempt.
558
586
  *
559
- * Returns `'awaiting-seed'` when initialize failed only because no seed peer has answered
560
- * (`cohort-unreachable`): that attempt's database is closed and the node keeps running. Any
561
- * other failure throws, with the attempt's database left with its gate for
587
+ * Returns `'awaiting-peer'` when initialize failed only because no machine that can answer for
588
+ * the strand's blocks was reachable: that attempt's database is closed and the node keeps
589
+ * running. Any other failure throws, with the attempt's database left with its gate for
562
590
  * {@link releaseRuntime} to close.
591
+ *
592
+ * A client node's database (`roles.strandCohortMember: false`) is published as soon as it
593
+ * initializes, like a founder's: see the first-sync decision below.
563
594
  */
564
595
  private buildStrandDatabase;
565
596
  /**
@@ -579,9 +610,10 @@ export declare class StrandInstanceManager {
579
610
  /** Ask the launcher for a rebuild when a machine removed from the party is in this runtime's seed. */
580
611
  private watchSeedForRemovedMachines;
581
612
  /**
582
- * The party's other machines known to hold `strandId` with no open connection from its strand
613
+ * The party's other machines known to STORE `strandId` ({@link StrandPartyMachines.machines},
614
+ * clients already dropped) with no open connection from its strand
583
615
  * node: what an offline queue reporting `waitingFor: 'cohort'` may be waiting for
584
- * (`docs/strands.md` → "Waiting for the party's own machines"). Empty for a strand not tracked
616
+ * (`docs/strands/writes.md` → "Waiting for the party's own machines"). Empty for a strand not tracked
585
617
  * or not running here, and on a launch that tracks no party machines.
586
618
  */
587
619
  unreachedPartyMachines(strandId: string): readonly PartyStrandPeer[];
@@ -593,22 +625,31 @@ export declare class StrandInstanceManager {
593
625
  /** Close a database attempt that failed to initialize, and drop its gate if it is still the registered one. */
594
626
  private discardDatabaseAttempt;
595
627
  /**
596
- * Keep a launch `'syncing'` when its database could not be built because no seed peer has
597
- * answered yet, and retry the database build every {@link UNREACHABLE_JOIN_RETRY_MS} on the
598
- * runtime already up.
628
+ * Keep a launch `'syncing'` when its database could not be built because no machine that can
629
+ * answer for the strand's blocks was reachable, and retry the database build every
630
+ * {@link UNREACHABLE_JOIN_RETRY_MS} on the runtime already up. Which launches reach here and
631
+ * why waiting beats refusing: `docs/strands/lifecycle.md` → "A launch with nobody to answer
632
+ * waits". What makes each of them unable to build:
633
+ *
634
+ * - **A joining storage replica whose seed is silent.** Optimystic (since 1.11.0) will not rule
635
+ * a block never-created while any of a node's `bootstrapNodes` is unheard, so a joiner alone
636
+ * with an unreachable seed cannot build even the schema catalog: `strandDb.initialize()` fails
637
+ * `cohort-unreachable`.
638
+ * - **A founder whose cohort is unreachable.** Its membership writes run inside `initialize()`
639
+ * and fail the same way. Normally a founder has no seed (no sibling runs the strand yet) and
640
+ * commits alone, so this is the founder given one.
641
+ * - **A client** (`roles.strandCohortMember: false`) with no serving machine reachable. Its own
642
+ * cohort is empty by construction, so every block its launch touches falls through to
643
+ * `findCoordinator`, which resolves nobody at all: the schema catalog it opens first, and a
644
+ * client founder's membership writes. A node that serves no storage never coordinates a key,
645
+ * however isolated it is, so founding alone is not open to it either.
599
646
  *
600
- * Optimystic (since 1.11.0) will not rule a block never-created while any of a node's
601
- * `bootstrapNodes` is unheard, so a joiner alone with an unreachable seed cannot build even
602
- * the schema catalog: `strandDb.initialize()` fails with `cohort-unreachable`. A founder
603
- * given a seed is refused the same way (normally it has none: no sibling runs the strand yet). Refusing is
604
- * right (building it alone would fork the catalog), but failing the launch would drop the
605
- * strand until the watcher relaunched it, and `addStrand` would reject with a raw Optimystic
606
- * error. Deferring gives a joiner the same contract the first-sync gate gives one that did
647
+ * Deferring gives every one of them the contract the first-sync gate gives a joiner that did
607
648
  * build: the strand stays tracked, {@link whenWritable} waits and rejects with the retryable
608
- * `StrandAwaitingFirstSyncError`, and the launch proceeds once a seed peer answers.
649
+ * `StrandAwaitingFirstSyncError`, and the launch proceeds once a machine answers.
609
650
  *
610
- * The libp2p node, its connections and the background loops stay up meanwhile. A seed peer
611
- * can answer just after the schema read gave up on it — on a slow link it connects and its
651
+ * The libp2p node, its connections and the background loops stay up meanwhile. A peer can
652
+ * answer just after the schema read gave up on it — on a slow link it connects and its
612
653
  * peer-join backfill delivers the whole store — and the retry then builds the database, and
613
654
  * runs the first-sync probe, while that peer is still connected.
614
655
  */
@@ -617,10 +658,18 @@ export declare class StrandInstanceManager {
617
658
  * One retry scheduled by {@link deferUnreachableJoin}: the database phase again, on the
618
659
  * runtime still attached. Skipped when the strand was stopped or released since — a quiesce
619
660
  * releases it and the resume after rebuilds the whole runtime — or already has a database.
620
- * A failure other than an unanswered seed releases the runtime and marks the strand
621
- * `'error'`, as a failed resume does.
661
+ * A failure other than an unreachable machine releases the runtime and marks the strand
662
+ * `'error'`, as a failed resume does, unless it is a refusal of a claim's schema the replica
663
+ * can fall back from ({@link buildJoinDatabaseOrReplica}).
622
664
  */
623
665
  private retryUnreachableJoin;
666
+ /**
667
+ * A deferred join's database phase ({@link buildStrandDatabase}), run once more as the replica
668
+ * when it fails on the schema of a claim that has not applied yet ({@link revertRefusedAttach}).
669
+ * The failed attempt's database is closed first: a failure leaves it registered with its gate.
670
+ * `'released'` when a stop began while it closed.
671
+ */
672
+ private buildJoinDatabaseOrReplica;
624
673
  /** Whether `instance` is still tracked, with `node` still its runtime's libp2p node. */
625
674
  private isCurrentRuntime;
626
675
  /**
@@ -823,6 +872,28 @@ export declare class StrandInstanceManager {
823
872
  private settleTransition;
824
873
  /** Body of {@link resumeStrand}; at most one runs per strand at a time. */
825
874
  private runResume;
875
+ /**
876
+ * {@link buildStrandRuntime}, run once more as the replica when it fails on the schema of a
877
+ * claim that has not applied yet ({@link revertRefusedAttach}). Safe to run twice: a failed
878
+ * build releases both handles before it rejects.
879
+ */
880
+ private buildRuntimeOrReplica;
881
+ /**
882
+ * Undo a claim of a storage replica ({@link attachSApp}) after an apply of its schema was refused
883
+ * (`AppSchemaRefusedError`): the retained launch config drops the sApp, so later rebuilds run the
884
+ * replica, and the instance gets back the replica's unset `sAppInfo` and its latency hint. Only
885
+ * when `error` is such a refusal, `refused` is the claim the strand has not applied yet, and the
886
+ * retained config still carries it, so a config rewritten since is left alone.
887
+ *
888
+ * @returns the replica's launch config, or `undefined` when nothing was undone.
889
+ */
890
+ private revertRefusedAttach;
891
+ /**
892
+ * Forget the unapplied claim of `strandId` once `database`, given the claim's sApp config as
893
+ * `applied`, has applied its schema. An apply still deferred keeps it, since its retry can still be
894
+ * refused by the strand's rows.
895
+ */
896
+ private forgetAppliedAttach;
826
897
  /**
827
898
  * Honor a founder request against an ALREADY-TRACKED strand — the seam that
828
899
  * closes the "whoever launches first decides whether the bootstrap runs" gap:
@@ -866,19 +937,24 @@ export declare class StrandInstanceManager {
866
937
  *
867
938
  * A runtime build in flight (the replica's launch, or a hibernation wake) is waited out
868
939
  * first, so the attach acts on the database that build produced. Then, in order: the
869
- * schema signature is checked before anything changes; the retained launch config takes
870
- * the sApp, so every later rebuild applies it through `composeStrand`; the live database —
871
- * published, or still held by the first-sync gate — gets the schema; and only then does
872
- * the instance record `sAppInfo` and the sApp's latency hint. An instance with no live
873
- * database gets the config alone: a quiesced one applies the schema at its next resume, a
874
- * launch waiting for a seed peer at its next database retry.
940
+ * schema signature, and the refusals the schema's text alone decides (`checkAppSchema`: a
941
+ * `seed` item, an item the parser skipped, a syntax error), are checked before anything
942
+ * changes; the retained launch config takes the sApp, so every later rebuild applies it
943
+ * through `composeStrand`; the live database — published, or still held by the first-sync
944
+ * gate — gets the schema; and only then does the instance record `sAppInfo` and the sApp's
945
+ * latency hint. An instance with no live database gets the config alone: a quiesced one
946
+ * applies the schema at its next resume, a launch waiting for a seed peer at its next
947
+ * database retry, and that build falls back to the replica if the strand's tables and rows
948
+ * refuse the schema ({@link revertRefusedAttach}).
875
949
  *
876
950
  * @returns `'already-attached'` when the instance already runs an sApp — a DIFFERENT one
877
951
  * is logged and left as it is, as a second claim of a claimed strand always has been —
878
952
  * else `'attached'`.
879
953
  * @throws when the strand is not tracked (a caller bug, or a launch that failed while
880
- * this waited on it); when the schema signature is refused, having changed nothing; and
881
- * whatever the live apply throws (e.g. a quiesce closed the database mid-apply) — the
954
+ * this waited on it); when the schema signature or the schema's text is refused, having
955
+ * changed nothing; `AppSchemaRefusedError` when the live apply refuses the schema against
956
+ * the replica's tables and rows, having put the retained config back to the replica's; and
957
+ * whatever else the live apply throws (e.g. a quiesce closed the database mid-apply) — the
882
958
  * retained config then still carries the sApp and `sAppInfo` stays unset, so the next
883
959
  * claim retries the apply.
884
960
  *
@@ -890,11 +966,27 @@ export declare class StrandInstanceManager {
890
966
  attachSApp(strandId: string, sAppConfig: SAppConfig, options?: {
891
967
  requireSignedSchemas?: boolean;
892
968
  }): Promise<'attached' | 'already-attached'>;
969
+ /**
970
+ * The tracked instance and retained config an {@link attachSApp} claim acts on, or
971
+ * `'already-attached'` when the instance already runs an sApp (a claim for a different one is
972
+ * logged and ignored).
973
+ *
974
+ * @throws when the strand is not tracked.
975
+ */
976
+ private claimTarget;
977
+ /**
978
+ * Apply a claim's schema to the replica's live database. A refusal by the replica's tables and
979
+ * rows puts the retained config back to the replica's ({@link revertRefusedAttach}): the replica
980
+ * holds no `App` schema, so the refused apply left nothing to drop. Any other failure leaves the
981
+ * claim retained and unapplied, for the next claim or build to retry.
982
+ */
983
+ private applyClaimedSchema;
893
984
  /**
894
985
  * Whether `strandId` is launched but still waiting for its first sync — a joiner whose
895
986
  * runtime is up while its database is withheld (status `'syncing'`, or `'idle'` after
896
987
  * the hibernation manager's idle timer fired on it), including one whose database build
897
- * waits for a seed peer to answer ({@link deferUnreachableJoin}). `false` for a writable,
988
+ * waits for a machine that can answer for the strand to be reachable
989
+ * ({@link deferUnreachableJoin}). `false` for a writable,
898
990
  * quiesced, or untracked strand. The predicate {@link whenWritable}'s callers gate on.
899
991
  */
900
992
  isAwaitingFirstSync(strandId: string): boolean;