@serfab/cadre-core 0.10.0 → 0.12.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 (145) hide show
  1. package/README.md +255 -255
  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 +484 -58
  6. package/dist/cadre-node.js +953 -182
  7. package/dist/cadre-node.js.map +1 -1
  8. package/dist/control-cohort.d.ts +26 -0
  9. package/dist/control-cohort.js +26 -0
  10. package/dist/control-cohort.js.map +1 -1
  11. package/dist/control-database.d.ts +222 -125
  12. package/dist/control-database.js +356 -266
  13. package/dist/control-database.js.map +1 -1
  14. package/dist/control-formation-recorder.d.ts +8 -7
  15. package/dist/control-formation-recorder.js +8 -7
  16. package/dist/control-formation-recorder.js.map +1 -1
  17. package/dist/control-read-retry.d.ts +103 -0
  18. package/dist/control-read-retry.js +145 -0
  19. package/dist/control-read-retry.js.map +1 -0
  20. package/dist/control-retry.d.ts +101 -0
  21. package/dist/control-retry.js +108 -0
  22. package/dist/control-retry.js.map +1 -0
  23. package/dist/control-schema.d.ts +1 -1
  24. package/dist/control-schema.js +805 -774
  25. package/dist/control-schema.js.map +1 -1
  26. package/dist/control-write-retry.d.ts +65 -31
  27. package/dist/control-write-retry.js +33 -103
  28. package/dist/control-write-retry.js.map +1 -1
  29. package/dist/delegate-admission.d.ts +17 -15
  30. package/dist/delegate-admission.js +17 -15
  31. package/dist/delegate-admission.js.map +1 -1
  32. package/dist/index.d.ts +7 -5
  33. package/dist/index.js +18 -9
  34. package/dist/index.js.map +1 -1
  35. package/dist/membership-connection-gater.d.ts +211 -25
  36. package/dist/membership-connection-gater.js +309 -29
  37. package/dist/membership-connection-gater.js.map +1 -1
  38. package/dist/peer-addr-book.d.ts +92 -0
  39. package/dist/peer-addr-book.js +220 -0
  40. package/dist/peer-addr-book.js.map +1 -0
  41. package/dist/peer-record.d.ts +26 -0
  42. package/dist/peer-record.js +32 -0
  43. package/dist/peer-record.js.map +1 -1
  44. package/dist/relay-addrs.d.ts +76 -26
  45. package/dist/relay-addrs.js +115 -27
  46. package/dist/relay-addrs.js.map +1 -1
  47. package/dist/relay-reservation.d.ts +20 -15
  48. package/dist/relay-reservation.js +18 -14
  49. package/dist/relay-reservation.js.map +1 -1
  50. package/dist/seed-bootstrap.d.ts +7 -0
  51. package/dist/seed-bootstrap.js +15 -13
  52. package/dist/seed-bootstrap.js.map +1 -1
  53. package/dist/strand-addr-protocol.js +16 -0
  54. package/dist/strand-addr-protocol.js.map +1 -1
  55. package/dist/strand-backfill.js +13 -4
  56. package/dist/strand-backfill.js.map +1 -1
  57. package/dist/strand-cohort.d.ts +4 -37
  58. package/dist/strand-cohort.js +4 -15
  59. package/dist/strand-cohort.js.map +1 -1
  60. package/dist/strand-database.d.ts +11 -16
  61. package/dist/strand-database.js +19 -7
  62. package/dist/strand-database.js.map +1 -1
  63. package/dist/strand-formation-manager.d.ts +18 -17
  64. package/dist/strand-formation-manager.js +25 -27
  65. package/dist/strand-formation-manager.js.map +1 -1
  66. package/dist/strand-formation-protocol.d.ts +7 -7
  67. package/dist/strand-formation-protocol.js +8 -8
  68. package/dist/strand-formation-protocol.js.map +1 -1
  69. package/dist/strand-instance-manager.d.ts +53 -21
  70. package/dist/strand-instance-manager.js +128 -37
  71. package/dist/strand-instance-manager.js.map +1 -1
  72. package/dist/strand-membership-writer.d.ts +113 -19
  73. package/dist/strand-membership-writer.js +219 -51
  74. package/dist/strand-membership-writer.js.map +1 -1
  75. package/dist/strand-solicitation.d.ts +3 -3
  76. package/dist/strand-solicitation.js +4 -5
  77. package/dist/strand-solicitation.js.map +1 -1
  78. package/dist/strand-wake-protocol.d.ts +47 -2
  79. package/dist/strand-wake-protocol.js +76 -6
  80. package/dist/strand-wake-protocol.js.map +1 -1
  81. package/dist/types.d.ts +107 -54
  82. package/dist/types.js.map +1 -1
  83. package/package.json +8 -7
  84. package/src/announce-addrs.ts +93 -0
  85. package/src/arachnode-stub.ts +159 -159
  86. package/src/bootstrap-peer-store-file.ts +44 -44
  87. package/src/bootstrap-peer-store.ts +172 -172
  88. package/src/cadre-node.ts +1026 -194
  89. package/src/canonical-json.ts +30 -30
  90. package/src/control-authorization.ts +114 -114
  91. package/src/control-cohort.ts +130 -103
  92. package/src/control-database.ts +376 -298
  93. package/src/control-formation-recorder.ts +305 -304
  94. package/src/control-read-retry.ts +167 -0
  95. package/src/control-retry.ts +190 -0
  96. package/src/control-schema.ts +817 -786
  97. package/src/control-stream.ts +205 -205
  98. package/src/control-write-retry.ts +383 -473
  99. package/src/delegate-admission.ts +304 -302
  100. package/src/device-token.ts +94 -94
  101. package/src/diagnostics/connection-path.ts +277 -277
  102. package/src/diagnostics/webrtc-turn-tracker.ts +222 -222
  103. package/src/ed25519-key.ts +134 -134
  104. package/src/enrollment.ts +199 -199
  105. package/src/file-durable-slot.ts +61 -61
  106. package/src/formation-approval.ts +604 -604
  107. package/src/fs-atomic.ts +107 -107
  108. package/src/hibernation-manager.ts +437 -437
  109. package/src/identity-key.ts +109 -109
  110. package/src/index.ts +435 -406
  111. package/src/key-store-file.ts +132 -132
  112. package/src/key-store.ts +99 -99
  113. package/src/membership-connection-gater.ts +368 -39
  114. package/src/node-local-snapshot.ts +260 -260
  115. package/src/peer-addr-book.ts +250 -0
  116. package/src/peer-authorization.ts +259 -259
  117. package/src/peer-record.ts +197 -164
  118. package/src/push-credentials.ts +84 -84
  119. package/src/push-node.ts +64 -64
  120. package/src/push-notifier-apns.ts +247 -247
  121. package/src/push-notifier-fcm.ts +220 -220
  122. package/src/push-notifier-shared.ts +28 -28
  123. package/src/push-notifier.ts +52 -52
  124. package/src/relay-addrs.ts +134 -27
  125. package/src/relay-reservation.ts +22 -17
  126. package/src/seed-bootstrap.ts +15 -15
  127. package/src/seed-trust-policy.ts +140 -140
  128. package/src/strand-addr-protocol.ts +458 -441
  129. package/src/strand-backfill.ts +28 -5
  130. package/src/strand-cohort.ts +38 -77
  131. package/src/strand-database.ts +202 -204
  132. package/src/strand-formation-manager.ts +26 -28
  133. package/src/strand-formation-protocol.ts +692 -692
  134. package/src/strand-instance-manager.ts +636 -553
  135. package/src/strand-member-key.ts +39 -39
  136. package/src/strand-member-registry.ts +182 -182
  137. package/src/strand-membership-writer.ts +1627 -1430
  138. package/src/strand-solicitation.ts +471 -472
  139. package/src/strand-transport-key.ts +58 -58
  140. package/src/strand-wake-payload.ts +32 -32
  141. package/src/strand-wake-protocol.ts +400 -314
  142. package/src/strand-watcher.ts +314 -314
  143. package/src/trusted-owner-store-file.ts +41 -41
  144. package/src/trusted-owner-store.ts +171 -171
  145. package/src/types.ts +1354 -1303
@@ -1,6 +1,6 @@
1
1
  import type { PrivateKey } from '@libp2p/interface';
2
2
  import { type StrandBackfillConfig } from './strand-backfill.js';
3
- import type { StrandInstance, StrandRow, StorageConfig, NetworkConfig, LatencyHint, NodeProfile, SAppConfig, StrandMode } from './types.js';
3
+ import type { StrandInstance, StrandRow, StorageConfig, NetworkConfig, LatencyHint, NodeProfile, SAppConfig } from './types.js';
4
4
  /**
5
5
  * Configuration for starting a strand instance
6
6
  */
@@ -15,12 +15,6 @@ export interface StartStrandConfig {
15
15
  privateKey?: PrivateKey;
16
16
  /** Cohort-derived discovery seed (multiaddr strings). Defaults to [] when omitted. */
17
17
  bootstrapNodes?: string[];
18
- /**
19
- * Lifecycle mode for this strand; selects the default transactor used by the
20
- * StrandDatabase. When omitted, the StrandDatabase falls back to `'networked'`;
21
- * callers (CadreNode) infer it from cohort membership before reaching here.
22
- */
23
- mode?: StrandMode;
24
18
  /**
25
19
  * Require a valid author signature on the sApp schema before bring-up.
26
20
  * Defaults to true (fail closed) when omitted; set false only for dev/test
@@ -48,22 +42,20 @@ export interface StartStrandConfig {
48
42
  * Tuning for the strand peer-join block catch-up ({@link StrandBackfill}),
49
43
  * forwarded from {@link CadreNodeConfig.strandBackfill}. When the strand's
50
44
  * libp2p node connects to a peer this runtime has not yet caught up, every
51
- * block in the strand's own raw store is pushed to it. Runs only on
52
- * `networked` strands with per-strand storage; `{ enabled: false }` restores
53
- * the pre-existing no-backfill behaviour.
45
+ * block in the strand's own raw store is pushed to it. Runs only on strands
46
+ * with per-strand storage; `{ enabled: false }` restores the pre-existing
47
+ * no-backfill behaviour.
54
48
  */
55
49
  backfill?: StrandBackfillConfig;
56
50
  }
57
51
  /**
58
- * Volatile inputs re-resolved when resuming a quiesced strand. These may have
59
- * changed since the strand first launched — the cohort discovery seed grows as
60
- * peers are learned, and cohort membership can push a strand `bootstrap → networked`.
52
+ * Volatile inputs re-resolved when resuming a quiesced strand. The cohort
53
+ * discovery seed is the only one — it grows as peers are learned since the
54
+ * strand first launched.
61
55
  */
62
56
  export interface ResumeStrandOverrides {
63
57
  /** Freshly-resolved cohort discovery seed (multiaddr strings). */
64
58
  bootstrapNodes?: string[];
65
- /** Freshly-resolved lifecycle mode. */
66
- mode?: StrandMode;
67
59
  }
68
60
  /**
69
61
  * Get the isolated storage path for a specific strand.
@@ -101,6 +93,26 @@ export declare class StrandInstanceManager {
101
93
  * missed writes).
102
94
  */
103
95
  private backfills;
96
+ /**
97
+ * The resolved (cache-wrapped) raw storage per strand id — the instance's OWN
98
+ * store, resolved once in `startStrand` and held until `stopStrand` disposes it.
99
+ * Private for the same reason `backfills` is: runtime plumbing, not part of the
100
+ * public {@link StrandInstance}.
101
+ *
102
+ * Deliberately NOT touched by `releaseRuntime`: that is what lets a quiesce →
103
+ * resume cycle rebuild the libp2p node over the SAME store, keeping its
104
+ * write-through cache warm (and, on an in-memory backend, keeping the strand's
105
+ * blocks at all). An entry exists iff `instances` does AND the launch config
106
+ * supplied a storage provider.
107
+ *
108
+ * NOTE: a hibernating strand therefore keeps its store — and its share of the
109
+ * process-wide cache pool — resident for as long as the instance is tracked. That
110
+ * is the point (a warm wake), and the pool evicts under pressure, so the cost is
111
+ * one map entry per hibernating strand today. If a device ever hibernates strands
112
+ * by the hundred, revisit: dropping the store at quiesce and paying for a cold
113
+ * wake becomes the better trade.
114
+ */
115
+ private strandStorages;
104
116
  private stopping;
105
117
  constructor();
106
118
  /**
@@ -126,15 +138,20 @@ export declare class StrandInstanceManager {
126
138
  * of the failure from the rejected promise (and, on the control-discovered
127
139
  * path, from CadreNode's `strand:error` event), not from an error record left
128
140
  * behind in `instances`.
141
+ *
142
+ * The strand's raw storage is resolved HERE, once, and held for the instance's
143
+ * lifetime (see `strandStorages`) — `buildStrandRuntime` only reads it, so a
144
+ * hibernation wake never re-enters the embedder's provider.
129
145
  */
130
146
  startStrand(config: StartStrandConfig): Promise<StrandInstance>;
131
147
  /**
132
148
  * Build (or rebuild) the libp2p node + StrandDatabase for an instance and
133
149
  * attach them, transitioning it to `active`. Shared by `startStrand` (fresh
134
150
  * launch) and `resumeStrand` (rehydrating a quiesced instance). Reads all
135
- * volatile inputs (bootstrapNodes, mode, storage, network, profile,
136
- * privateKey, sApp config) from `config`, so the caller controls the
137
- * cohort-derived values.
151
+ * volatile inputs (bootstrapNodes, network, profile, privateKey, sApp config)
152
+ * from `config`, so the caller controls the cohort-derived values. Storage is the
153
+ * one input it does NOT re-read from `config`: that belongs to the instance and
154
+ * comes from `strandStorages`.
138
155
  */
139
156
  private buildStrandRuntime;
140
157
  /**
@@ -143,8 +160,23 @@ export declare class StrandInstanceManager {
143
160
  * and zeroing connectedPeers. Tolerant of partially-built state — either handle
144
161
  * may be absent — so it doubles as rollback for a failed `buildStrandRuntime`.
145
162
  * Shared by `quiesceStrand`, `stopStrand`, and that rollback path.
163
+ *
164
+ * Leaves `strandStorages` untouched by design — the store outlives the runtime it
165
+ * was built into, which is what makes a resume warm. Only `stopStrand` disposes it.
146
166
  */
147
167
  private releaseRuntime;
168
+ /**
169
+ * Drop the strand's owned store and release this strand's claim on its cache. The
170
+ * wrapper counts holders, so the cache is emptied and unregistered from the shared
171
+ * pool only if no other scope still holds it. Called only where the strand's whole
172
+ * lifetime ends (`stopStrand`, and the failed-launch rollback) — never on a quiesce.
173
+ *
174
+ * A dispose failure is logged, not thrown: the store is already unreferenced here,
175
+ * and failing the stop over a cache-bookkeeping error would leave the caller unable
176
+ * to tear the strand down. `disposeStorageCache` no-ops for an unwrapped store
177
+ * (e.g. `MemoryRawStorage`), so no instanceof test is needed.
178
+ */
179
+ private disposeStrandStorage;
148
180
  /**
149
181
  * Quiesce a strand: release its strand-network resources (stop the libp2p node,
150
182
  * close the StrandDatabase) while RETAINING the instance record — identity,
@@ -158,9 +190,9 @@ export declare class StrandInstanceManager {
158
190
  * Resume a previously-quiesced strand: rebuild its libp2p node + StrandDatabase
159
191
  * from the retained launch config and re-attach them, transitioning it back to
160
192
  * `active`. `overrides` re-applies volatile inputs that may have changed since
161
- * launch (cohort `bootstrapNodes`, lifecycle `mode`) and updates the retained
162
- * config so a later resume reuses the latest values. Returns the live instance
163
- * unchanged if it is already running.
193
+ * launch (the cohort `bootstrapNodes` seed) and updates the retained config so
194
+ * a later resume reuses the latest values. Returns the live instance unchanged
195
+ * if it is already running.
164
196
  */
165
197
  resumeStrand(strandId: string, overrides?: ResumeStrandOverrides): Promise<StrandInstance>;
166
198
  /**
@@ -1,10 +1,12 @@
1
1
  import debug from 'debug';
2
2
  import { createLibp2pNode } from '@optimystic/db-p2p';
3
+ import { wrapStorageWithCache, disposeStorageCache } from '@serfab/quereus-plugin-sereus';
3
4
  import { StrandDatabase } from './strand-database.js';
4
5
  import { StrandBackfill } from './strand-backfill.js';
5
6
  import { assertSchemaSignature } from './schema-verification.js';
6
7
  import { resolveStrandClusterSize, STRAND_CLUSTER_POLICY } from './types.js';
7
8
  import { resolveListenAddrs } from './relay-addrs.js';
9
+ import { resolveAnnounceAddrs } from './announce-addrs.js';
8
10
  const log = debug('sereus:cadre:strand-manager');
9
11
  const timing = debug('sereus:cadre:timing');
10
12
  /**
@@ -41,6 +43,9 @@ export function getStrandStoragePath(basePath, strandId) {
41
43
  * Resolve a storage provider for a specific strand.
42
44
  * If the provider is a factory function, call it with the strandId.
43
45
  *
46
+ * Called only from {@link StrandInstanceManager.startStrand}, which owns the result
47
+ * for the instance's lifetime — see `strandStorages`.
48
+ *
44
49
  * @param provider - Storage provider (instance or factory)
45
50
  * @param strandId - The strand ID to create storage for
46
51
  * @returns The resolved IRawStorage instance, or undefined if no provider
@@ -49,7 +54,11 @@ function resolveStrandStorage(provider, strandId) {
49
54
  if (!provider) {
50
55
  return undefined;
51
56
  }
52
- return typeof provider === 'function' ? provider(strandId) : provider;
57
+ const storage = typeof provider === 'function' ? provider(strandId) : provider;
58
+ // Wrapped in the write-through raw-storage cache (quereus-plugin-sereus's cached-storage.ts).
59
+ // Called ONCE per strand launch — `startStrand` keeps the result for the instance's
60
+ // lifetime — so the wrap survives every runtime rebuild the instance goes through.
61
+ return wrapStorageWithCache(storage, strandId);
53
62
  }
54
63
  /**
55
64
  * Manages individual strand instances - creates and destroys isolated libp2p nodes
@@ -73,6 +82,26 @@ export class StrandInstanceManager {
73
82
  * missed writes).
74
83
  */
75
84
  this.backfills = new Map();
85
+ /**
86
+ * The resolved (cache-wrapped) raw storage per strand id — the instance's OWN
87
+ * store, resolved once in `startStrand` and held until `stopStrand` disposes it.
88
+ * Private for the same reason `backfills` is: runtime plumbing, not part of the
89
+ * public {@link StrandInstance}.
90
+ *
91
+ * Deliberately NOT touched by `releaseRuntime`: that is what lets a quiesce →
92
+ * resume cycle rebuild the libp2p node over the SAME store, keeping its
93
+ * write-through cache warm (and, on an in-memory backend, keeping the strand's
94
+ * blocks at all). An entry exists iff `instances` does AND the launch config
95
+ * supplied a storage provider.
96
+ *
97
+ * NOTE: a hibernating strand therefore keeps its store — and its share of the
98
+ * process-wide cache pool — resident for as long as the instance is tracked. That
99
+ * is the point (a warm wake), and the pool evicts under pressure, so the cost is
100
+ * one map entry per hibernating strand today. If a device ever hibernates strands
101
+ * by the hundred, revisit: dropping the store at quiesce and paying for a cold
102
+ * wake becomes the better trade.
103
+ */
104
+ this.strandStorages = new Map();
76
105
  this.stopping = false;
77
106
  log('StrandInstanceManager created');
78
107
  }
@@ -105,6 +134,10 @@ export class StrandInstanceManager {
105
134
  * of the failure from the rejected promise (and, on the control-discovered
106
135
  * path, from CadreNode's `strand:error` event), not from an error record left
107
136
  * behind in `instances`.
137
+ *
138
+ * The strand's raw storage is resolved HERE, once, and held for the instance's
139
+ * lifetime (see `strandStorages`) — `buildStrandRuntime` only reads it, so a
140
+ * hibernation wake never re-enters the embedder's provider.
108
141
  */
109
142
  async startStrand(config) {
110
143
  const { strandRow, sAppConfig } = config;
@@ -129,6 +162,14 @@ export class StrandInstanceManager {
129
162
  schema: sAppConfig.schema,
130
163
  signature: sAppConfig.signature
131
164
  };
165
+ // Resolve this strand's storage ONCE, before anything is recorded. If a factory
166
+ // function is provided, it is called with the strandId to create strand-specific
167
+ // storage (e.g. strand-isolated directories). A provider that throws therefore
168
+ // fails the launch alongside the schema-signature check, leaving nothing tracked.
169
+ const strandStorage = resolveStrandStorage(config.storage?.provider, strandId);
170
+ if (strandStorage) {
171
+ log('Strand %s using provided storage provider', strandId);
172
+ }
132
173
  // Determine latency hint: sApp config > default
133
174
  const latencyHint = sAppConfig.latencyHint ?? config.defaultLatencyHint;
134
175
  const instance = {
@@ -138,13 +179,13 @@ export class StrandInstanceManager {
138
179
  memberPrivateKey: strandRow.MemberPrivateKey ?? undefined,
139
180
  connectedPeers: 0,
140
181
  lastActivity: new Date(),
141
- latencyHint,
142
- // Seed only — buildStrandRuntime overwrites this with the same resolution,
143
- // so an instance that errors mid-build still reads sensibly.
144
- mode: config.mode ?? 'networked'
182
+ latencyHint
145
183
  };
146
184
  this.instances.set(strandId, instance);
147
185
  this.launchConfigs.set(strandId, config);
186
+ if (strandStorage) {
187
+ this.strandStorages.set(strandId, strandStorage);
188
+ }
148
189
  try {
149
190
  await this.buildStrandRuntime(instance, config);
150
191
  timing('[startStrand:%s] total: %dms', strandId, Math.round(performance.now() - tTotal));
@@ -161,6 +202,9 @@ export class StrandInstanceManager {
161
202
  // reads both, and a config without an instance would strand the config.
162
203
  this.instances.delete(strandId);
163
204
  this.launchConfigs.delete(strandId);
205
+ // The store this launch resolved goes with it: nothing owns it any more, and a
206
+ // retained cache wrapper would be handed back (already retired) on a retry.
207
+ await this.disposeStrandStorage(strandId);
164
208
  throw error;
165
209
  }
166
210
  }
@@ -168,21 +212,17 @@ export class StrandInstanceManager {
168
212
  * Build (or rebuild) the libp2p node + StrandDatabase for an instance and
169
213
  * attach them, transitioning it to `active`. Shared by `startStrand` (fresh
170
214
  * launch) and `resumeStrand` (rehydrating a quiesced instance). Reads all
171
- * volatile inputs (bootstrapNodes, mode, storage, network, profile,
172
- * privateKey, sApp config) from `config`, so the caller controls the
173
- * cohort-derived values.
215
+ * volatile inputs (bootstrapNodes, network, profile, privateKey, sApp config)
216
+ * from `config`, so the caller controls the cohort-derived values. Storage is the
217
+ * one input it does NOT re-read from `config`: that belongs to the instance and
218
+ * comes from `strandStorages`.
174
219
  */
175
220
  async buildStrandRuntime(instance, config) {
176
221
  const strandId = instance.strandId;
177
222
  const { sAppConfig } = config;
178
- const mode = config.mode ?? 'networked';
179
- // Resolve storage for this strand. If a factory function is provided, it is
180
- // called with the strandId to create strand-specific storage (e.g.,
181
- // strand-isolated directories).
182
- const strandStorage = resolveStrandStorage(config.storage?.provider, strandId);
183
- if (strandStorage) {
184
- log('Strand %s using provided storage provider', strandId);
185
- }
223
+ // The store the instance OWNS (resolved once in `startStrand`), not a fresh
224
+ // resolution: a rebuild must reach the same backend through the same warm cache.
225
+ const strandStorage = this.strandStorages.get(strandId);
186
226
  // db-p2p namespaces every one of the node's protocol ids by network name
187
227
  // (`/optimystic/<networkName>/...`), so anything dialing this node's own
188
228
  // services must derive its prefix from the SAME string the node was built
@@ -192,6 +232,14 @@ export class StrandInstanceManager {
192
232
  // Determine relay mode: if explicitly set in config, use that;
193
233
  // otherwise default to true for storage profile nodes.
194
234
  const enableRelay = config.network?.enableRelay ?? (config.profile === 'storage');
235
+ // The CONFIGURED relay route (the default), deliberately NOT the control node's
236
+ // `'search'` route: nothing drives an explicit reservation for a strand node, so
237
+ // a bare `/p2p-circuit` search entry would register a pending reservation that
238
+ // never gets filled and leave the strand node undialable. The ordering hazard
239
+ // that pushed the control node onto the search route does not exist here — a
240
+ // strand node's protocol ids are namespaced `/optimystic/strand-<id>/…`, so a
241
+ // relay dialed from inside `libp2p.start()` is never in the strand's cohort and
242
+ // cannot refuse its database bring-up. See `relay-addrs.ts`.
195
243
  const listenAddrs = resolveListenAddrs(config.network);
196
244
  try {
197
245
  let t0 = performance.now();
@@ -216,25 +264,33 @@ export class StrandInstanceManager {
216
264
  // `/ip4/0.0.0.0/tcp/4001`) would have control + strand nodes racing to
217
265
  // bind one port — EADDRINUSE. Unverified; if a deployment configures a
218
266
  // fixed port and strands fail to start, rewrite the port per node here.
219
- // An inherited `/p2p-circuit` addr, by contrast, is deliberate — it is
220
- // what gives a NAT'd strand node a reachable relay slot — and works
267
+ // An inherited configured `/p2p-circuit` addr, by contrast, is deliberate —
268
+ // it is what gives a NAT'd strand node a reachable relay slot — and works
221
269
  // because the launch path announces this strand's derived peerId to
222
270
  // the relay first (delegate admission; see cadre-node.ts). Those circuit
223
271
  // entries come either from a hand-written `network.listenAddrs` or from
224
- // `network.relayAddrs`, which `resolveListenAddrs` folds into the same list.
272
+ // `network.relayAddrs`, which `resolveListenAddrs` folds into the same list
273
+ // on the configured route this call takes (see the comment above it).
225
274
  ...(listenAddrs && { listenAddrs }),
275
+ // A strand node behind a reverse proxy has the same advertising need as the
276
+ // control node, and inherits the same `NetworkConfig` — so it announces the same
277
+ // addresses.
278
+ //
279
+ // NOTE: an announce addr naming a PORT therefore names the control node's port,
280
+ // not this strand node's — the same second-node-on-one-host problem the listen
281
+ // NOTE above describes, and the reason both belong to one fix. It is currently
282
+ // unreachable: naming a fixed public port means configuring a fixed
283
+ // `listenAddrs` port, and that collides at bind time before any strand node gets
284
+ // far enough to advertise anything. Whatever gives strand nodes their own listen
285
+ // port has to give them their own announce addrs in the same pass, or a strand
286
+ // will advertise an address that reaches the control node. Tracked as an arm of
287
+ // `tickets/backlog/strand-network-nat-relay-reachability.md`.
288
+ ...resolveAnnounceAddrs(config.network),
226
289
  ...(config.network?.connectionGater && { connectionGater: config.network.connectionGater })
227
290
  });
228
291
  timing('[buildStrandRuntime:%s] createLibp2pNode: %dms', strandId, Math.round(performance.now() - t0));
229
292
  instance.libp2pNode = node;
230
- // Assigned on every runtime (re)build — resume re-enters here with
231
- // resumeConfig, so a bootstrap → networked shift refreshes the field.
232
- instance.mode = mode;
233
- // Create and initialize the StrandDatabase. In bootstrap mode the same
234
- // strandStorage instance also backs the optimystic local transactor so
235
- // DML lands on the host's persistent storage (e.g. LevelDB on RN). Sharing
236
- // the instance — not creating a second one over the same id+prefix —
237
- // avoids cache divergence between the libp2p and database paths.
293
+ // Create and initialize the StrandDatabase.
238
294
  //
239
295
  // Attach before initialize so a failed init is cleaned up by
240
296
  // releaseRuntime below (close() is safe on a partially-initialized db).
@@ -244,8 +300,6 @@ export class StrandInstanceManager {
244
300
  sAppConfig,
245
301
  libp2pNode: node,
246
302
  coordinatedRepo: node.coordinatedRepo,
247
- mode,
248
- rawStorage: strandStorage,
249
303
  // Founder bootstrap inputs: the strand's type drives which membership rows
250
304
  // are written, and the closed-strand MemberPrivateKey derives the founding
251
305
  // Member/Manager key. Both come off the control-network strand row.
@@ -258,9 +312,18 @@ export class StrandInstanceManager {
258
312
  timing('[buildStrandRuntime:%s] strandDatabase.initialize: %dms', strandId, Math.round(performance.now() - t0));
259
313
  // Peer-join block catch-up: push this strand's own blocks to each newly
260
314
  // connected peer, so a machine that joined after blocks were committed
261
- // still ends up physically holding them (a bootstrap strand has no mesh
262
- // to catch up, and without per-strand storage there is nothing to copy).
263
- if (mode === 'networked' && strandStorage && config.backfill?.enabled !== false) {
315
+ // still ends up physically holding them (without per-strand storage there
316
+ // is nothing to copy). Armed for EVERY stored strand: `StrandBackfill`
317
+ // only does work when the strand's libp2p node reports a peer connection,
318
+ // so on a device that is genuinely alone it is inert, and arming it at
319
+ // launch is what closes the "founded alone, never replicates" hole — a
320
+ // peer that joins later gets the founder's blocks without any relaunch.
321
+ //
322
+ // NOTE: cost is one StrandBackfill object + one `connection:open` listener
323
+ // per running strand — linear in strand count, negligible at the handful a
324
+ // device or host runs today. If a node ever hosts strands by the hundred,
325
+ // move to one shared listener that dispatches by strand id.
326
+ if (strandStorage && config.backfill?.enabled !== false) {
264
327
  if (node.keyNetwork) {
265
328
  const backfill = new StrandBackfill({
266
329
  strandId,
@@ -298,6 +361,9 @@ export class StrandInstanceManager {
298
361
  * and zeroing connectedPeers. Tolerant of partially-built state — either handle
299
362
  * may be absent — so it doubles as rollback for a failed `buildStrandRuntime`.
300
363
  * Shared by `quiesceStrand`, `stopStrand`, and that rollback path.
364
+ *
365
+ * Leaves `strandStorages` untouched by design — the store outlives the runtime it
366
+ * was built into, which is what makes a resume warm. Only `stopStrand` disposes it.
301
367
  */
302
368
  async releaseRuntime(instance) {
303
369
  // Backfill first — before the database closes and the libp2p node stops — so
@@ -318,6 +384,30 @@ export class StrandInstanceManager {
318
384
  }
319
385
  instance.connectedPeers = 0;
320
386
  }
387
+ /**
388
+ * Drop the strand's owned store and release this strand's claim on its cache. The
389
+ * wrapper counts holders, so the cache is emptied and unregistered from the shared
390
+ * pool only if no other scope still holds it. Called only where the strand's whole
391
+ * lifetime ends (`stopStrand`, and the failed-launch rollback) — never on a quiesce.
392
+ *
393
+ * A dispose failure is logged, not thrown: the store is already unreferenced here,
394
+ * and failing the stop over a cache-bookkeeping error would leave the caller unable
395
+ * to tear the strand down. `disposeStorageCache` no-ops for an unwrapped store
396
+ * (e.g. `MemoryRawStorage`), so no instanceof test is needed.
397
+ */
398
+ async disposeStrandStorage(strandId) {
399
+ const storage = this.strandStorages.get(strandId);
400
+ if (!storage) {
401
+ return;
402
+ }
403
+ this.strandStorages.delete(strandId);
404
+ try {
405
+ await disposeStorageCache(storage);
406
+ }
407
+ catch (error) {
408
+ log('Failed to dispose storage cache for strand %s: %o', strandId, error);
409
+ }
410
+ }
321
411
  /**
322
412
  * Quiesce a strand: release its strand-network resources (stop the libp2p node,
323
413
  * close the StrandDatabase) while RETAINING the instance record — identity,
@@ -344,9 +434,9 @@ export class StrandInstanceManager {
344
434
  * Resume a previously-quiesced strand: rebuild its libp2p node + StrandDatabase
345
435
  * from the retained launch config and re-attach them, transitioning it back to
346
436
  * `active`. `overrides` re-applies volatile inputs that may have changed since
347
- * launch (cohort `bootstrapNodes`, lifecycle `mode`) and updates the retained
348
- * config so a later resume reuses the latest values. Returns the live instance
349
- * unchanged if it is already running.
437
+ * launch (the cohort `bootstrapNodes` seed) and updates the retained config so
438
+ * a later resume reuses the latest values. Returns the live instance unchanged
439
+ * if it is already running.
350
440
  */
351
441
  async resumeStrand(strandId, overrides) {
352
442
  if (this.stopping) {
@@ -369,8 +459,7 @@ export class StrandInstanceManager {
369
459
  // Re-apply volatile inputs and persist them so a subsequent resume reuses them.
370
460
  const resumeConfig = {
371
461
  ...launchConfig,
372
- bootstrapNodes: overrides?.bootstrapNodes ?? launchConfig.bootstrapNodes,
373
- mode: overrides?.mode ?? launchConfig.mode
462
+ bootstrapNodes: overrides?.bootstrapNodes ?? launchConfig.bootstrapNodes
374
463
  };
375
464
  this.launchConfigs.set(strandId, resumeConfig);
376
465
  instance.status = 'starting';
@@ -403,6 +492,8 @@ export class StrandInstanceManager {
403
492
  instance.status = 'stopped';
404
493
  this.instances.delete(strandId);
405
494
  this.launchConfigs.delete(strandId);
495
+ // Storage is released only here — NOT in releaseRuntime, which a quiesce shares.
496
+ await this.disposeStrandStorage(strandId);
406
497
  log('Strand %s stopped successfully', strandId);
407
498
  }
408
499
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"strand-instance-manager.js","sourceRoot":"","sources":["../src/strand-instance-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAoB,M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