@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
@@ -1 +1 @@
1
- {"version":3,"file":"strand-watcher.js","sourceRoot":"","sources":["../src/strand-watcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,GAAG,GAAG,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAUjD;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AA0C3C;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IAwBxB,YACE,SAA0B,EAC1B,SAAiC,EACjC,SAAuB,EAAE,IAAI,EAAE,KAAK,EAAE,EACtC,eAAuB,IAAI,EAC3B,YAA2B,EAC3B,MAAoB,IAAI,CAAC,GAAG;QAftB,iBAAY,GAA2B,IAAI,GAAG,EAAE,CAAC;QACzD,wFAAwF;QAChF,gBAAW,GAAgB,IAAI,GAAG,EAAE,CAAC;QAC7C,gFAAgF;QACxE,kBAAa,GAAoC,IAAI,GAAG,EAAE,CAAC;QAC3D,cAAS,GAA0C,IAAI,CAAC;QACxD,qBAAgB,GAAyC,IAAI,CAAC;QAC9D,YAAO,GAAG,KAAK,CAAC;QAUtB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,GAAG,CAAC,uDAAuD,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IACrF,CAAC;IAED;;;;OAIG;IACK,cAAc,CAAC,MAAiB;QACtC,QAAQ,IAAI,CAAC,MAAM,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0E;QAC1E,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC,GAAG,EAAE;YACtC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,EAAE,GAAG,CAAC,CAAC;QAER,GAAG,CAAC,uBAAuB,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO;QACT,CAAC;QAED,GAAG,CAAC,wBAAwB,CAAC,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAErB,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1B,YAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACpC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC/B,CAAC;QAED,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC9B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACxB,CAAC;QAED,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAC3B,GAAG,CAAC,uBAAuB,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,eAAe;QACb,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS;QACb,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Await one step of a longer operation between two `sereus:cadre:timing` lines:
3
+ * `[<scope>:<id>] <step>: start` before it, then `<step>: <n>ms` — or
4
+ * `<step>: failed after <n>ms` — once it settles. The start line is what matters on a
5
+ * device: a step that never settles leaves a start with no matching end, so a trace
6
+ * names the step that hung rather than only the last one that finished.
7
+ *
8
+ * The text is built here rather than passed as `%s`/`%d` arguments: `debug`'s browser
9
+ * build, which React Native bundles, leaves placeholders for the console to fill, and
10
+ * RN's console prints them unfilled, so a device trace would read `[%s:%s] %s: start`.
11
+ */
12
+ export declare function timedStep<T>(scope: string, id: string, step: string, op: () => Promise<T>): Promise<T>;
@@ -0,0 +1,28 @@
1
+ import debug from 'debug';
2
+ const timing = debug('sereus:cadre:timing');
3
+ /**
4
+ * Await one step of a longer operation between two `sereus:cadre:timing` lines:
5
+ * `[<scope>:<id>] <step>: start` before it, then `<step>: <n>ms` — or
6
+ * `<step>: failed after <n>ms` — once it settles. The start line is what matters on a
7
+ * device: a step that never settles leaves a start with no matching end, so a trace
8
+ * names the step that hung rather than only the last one that finished.
9
+ *
10
+ * The text is built here rather than passed as `%s`/`%d` arguments: `debug`'s browser
11
+ * build, which React Native bundles, leaves placeholders for the console to fill, and
12
+ * RN's console prints them unfilled, so a device trace would read `[%s:%s] %s: start`.
13
+ */
14
+ export async function timedStep(scope, id, step, op) {
15
+ const label = `[${scope}:${id}] ${step}`;
16
+ timing(`${label}: start`);
17
+ const t0 = performance.now();
18
+ try {
19
+ const result = await op();
20
+ timing(`${label}: ${Math.round(performance.now() - t0)}ms`);
21
+ return result;
22
+ }
23
+ catch (error) {
24
+ timing(`${label}: failed after ${Math.round(performance.now() - t0)}ms`);
25
+ throw error;
26
+ }
27
+ }
28
+ //# sourceMappingURL=timed-step.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timed-step.js","sourceRoot":"","sources":["../src/timed-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAI,KAAa,EAAE,EAAU,EAAE,IAAY,EAAE,EAAoB;IAC/F,MAAM,KAAK,GAAG,IAAI,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;IACzC,MAAM,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC;IAC1B,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAC7B,IAAI,CAAC;QACJ,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QAC5D,OAAO,MAAM,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,CAAC,GAAG,KAAK,kBAAkB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QACzE,MAAM,KAAK,CAAC;IACb,CAAC;AACF,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The timer seam shared by the strand bring-up loops that re-arm themselves one step at a
3
+ * time — the first-sync write gate's probe loop (`strand-first-sync-gate.ts`) and the
4
+ * membership reconciler's retry ladder (`strand-membership-reconciler.ts`). `setTimeout`
5
+ * rather than a repeating interval because the next step is armed only once the previous
6
+ * one settles, so a slow network read never stacks steps behind it, and because the delay
7
+ * can differ per step.
8
+ *
9
+ * Tests inject a hand-cranked clock; production omits it and gets real timers, `unref`'d so
10
+ * a loop that is only waiting never holds a Node process open (the call is optional —
11
+ * browsers and React Native return a plain handle with no `unref`).
12
+ */
13
+ /** Timer seam for a self-rescheduling loop; omit for real (unref'd) timeouts. */
14
+ export interface TimeoutScheduler {
15
+ setTimeout(fn: () => void, ms: number): unknown;
16
+ clearTimeout(handle: unknown): void;
17
+ }
18
+ /** Real timers, `unref`'d where the runtime supports it. */
19
+ export declare const defaultTimeoutScheduler: TimeoutScheduler;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The timer seam shared by the strand bring-up loops that re-arm themselves one step at a
3
+ * time — the first-sync write gate's probe loop (`strand-first-sync-gate.ts`) and the
4
+ * membership reconciler's retry ladder (`strand-membership-reconciler.ts`). `setTimeout`
5
+ * rather than a repeating interval because the next step is armed only once the previous
6
+ * one settles, so a slow network read never stacks steps behind it, and because the delay
7
+ * can differ per step.
8
+ *
9
+ * Tests inject a hand-cranked clock; production omits it and gets real timers, `unref`'d so
10
+ * a loop that is only waiting never holds a Node process open (the call is optional —
11
+ * browsers and React Native return a plain handle with no `unref`).
12
+ */
13
+ /** Real timers, `unref`'d where the runtime supports it. */
14
+ export const defaultTimeoutScheduler = {
15
+ setTimeout: (fn, ms) => {
16
+ const handle = setTimeout(fn, ms);
17
+ handle.unref?.();
18
+ return handle;
19
+ },
20
+ clearTimeout: (handle) => clearTimeout(handle)
21
+ };
22
+ //# sourceMappingURL=timeout-scheduler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeout-scheduler.js","sourceRoot":"","sources":["../src/timeout-scheduler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,uBAAuB,GAAqB;IACvD,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;QACrB,MAAM,MAAM,GAAG,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACjC,MAAiC,CAAC,KAAK,EAAE,EAAE,CAAC;QAC7C,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAA4C,CAAC;CACrF,CAAC"}
package/dist/types.d.ts CHANGED
@@ -3,6 +3,8 @@ import type { IRawStorage, Libp2pTransports } from '@optimystic/db-p2p';
3
3
  import type { IPeerNetwork, IRepo } from '@optimystic/db-core';
4
4
  import type { PeerJoinBackfillConfig } from './peer-join-backfill.js';
5
5
  import type { StrandRevocationEnforcementConfig } from './strand-revocation-enforcer.js';
6
+ import type { StrandMembershipReconciliationConfig } from './strand-membership-reconciler.js';
7
+ import type { StrandFirstSyncConfig } from './strand-first-sync-gate.js';
6
8
  import type { StrandDatabase } from './strand-database.js';
7
9
  import type { SeedTrustPolicy } from './seed-trust-policy.js';
8
10
  import type { KeyStore, KeyId } from './key-store.js';
@@ -11,6 +13,7 @@ import type { BootstrapPeerStore } from './bootstrap-peer-store.js';
11
13
  import type { EnrolledMachineStore } from './enrolled-machine-store.js';
12
14
  import type { PushNotifier } from './push-notifier.js';
13
15
  import type { RevocableTable } from './control-authorization.js';
16
+ import type { ControlRetryAbandonment } from './control-retry.js';
14
17
  /**
15
18
  * Extended Libp2p node with the coordinatedRepo attached by db-p2p's
16
19
  * createLibp2pNode after node creation (not surfaced on the base Libp2p type).
@@ -85,12 +88,27 @@ export interface HibernationTimeouts {
85
88
  export declare const HIBERNATION_TIMEOUTS: Record<LatencyHint, HibernationTimeouts>;
86
89
  /**
87
90
  * Storage provider - either an `IRawStorage` instance or a factory function.
88
- * Factory functions are useful for creating strand-specific storage instances.
91
+ * Factory functions are useful for creating per-scope storage instances.
89
92
  *
90
- * **Called once per scope per runtime lifetime.** The scopes are the literal string
91
- * `'control'` (once per `CadreNode.start()`) and each strand id (once per
92
- * `startStrand`). Hibernation — `quiesceStrand` then `resumeStrand` — reuses the
93
- * store already resolved for that strand and does NOT re-enter this callback.
93
+ * **The argument is an opaque scope key.** Use it directly as a file name, directory
94
+ * name or database name: every key cadre-core mints stays within `[A-Za-z0-9._-]`, so
95
+ * no escaping is needed and none should be assumed. Do not parse it;
96
+ * `controlStorageScope` / `isControlStorageScope` (`storage-scope.ts`) are the
97
+ * supported way to mint and recognize the control key. The strand arm of that charset
98
+ * rule is intended but not yet checked — a strand id replicated in from another node
99
+ * in the party reaches this callback verbatim; see
100
+ * `tickets/backlog/bug-strand-scope-key-charset-unenforced`.
101
+ *
102
+ * **Called once per scope per runtime lifetime.** The scopes are the control database
103
+ * (once per `CadreNode.start()`) and each strand id (once per `startStrand`).
104
+ * Hibernation — `quiesceStrand` then `resumeStrand` — reuses the store already
105
+ * resolved for that strand and does NOT re-enter this callback.
106
+ *
107
+ * **The control scope is party-specific.** It is `controlStorageScope(partyId)`, not a
108
+ * fixed string, because the control database holds one party's own records — its
109
+ * strands, owner keys, peers, invitations, revocations. Two parties on one device ask
110
+ * for two different keys and MUST get two different stores, or a node started for one
111
+ * party reads the other's rows as its own.
94
112
  *
95
113
  * It IS re-entered for a scope after that scope's runtime has stopped
96
114
  * (`stopStrand`, or a `stop()` then `start()` cycle on one `CadreNode`), so it must
@@ -100,33 +118,40 @@ export declare const HIBERNATION_TIMEOUTS: Record<LatencyHint, HibernationTimeou
100
118
  * cadre-core disposes only its own cache wrapper — it never closes the store you
101
119
  * returned. Closing the underlying handle stays the embedder's job.
102
120
  *
103
- * Either form is safe with a persistent backend. One instance handed to every scope
121
+ * **The single-instance form shares data across scopes by construction** — one store
122
+ * for every strand AND for every party's control database. An embedder that can serve
123
+ * more than one party must use the factory form. One instance handed to every scope
104
124
  * also shares ONE cache wrapper (`wrapStorageWithCache` memoizes per inner instance),
105
125
  * which counts its holders: a scope stopping releases only its own claim, and the
106
- * wrapper is retired when the last scope releases it. The factory form is still the
107
- * better default for a different reason — it partitions each strand's data, which
126
+ * wrapper is retired when the last scope releases it. The factory form is the better
127
+ * default for the further reason that it partitions each strand's data, which
108
128
  * simplifies cleanup.
109
129
  */
110
- export type RawStorageProvider = IRawStorage | ((strandId: string) => IRawStorage);
130
+ export type RawStorageProvider = IRawStorage | ((scope: string) => IRawStorage);
111
131
  /**
112
132
  * Storage configuration for storage profile nodes
113
133
  */
114
134
  export interface StorageConfig {
115
135
  /**
116
136
  * Storage provider - either an IRawStorage instance or a factory function.
117
- * See {@link RawStorageProvider} for how often cadre-core calls it.
137
+ * See {@link RawStorageProvider} for how often cadre-core calls it, and for why
138
+ * the single-instance form cannot serve more than one party.
139
+ *
140
+ * The `scope` a factory receives is an opaque key already safe as a path or
141
+ * database-name segment (always within `[A-Za-z0-9._-]`), so each example below
142
+ * interpolates it directly.
118
143
  *
119
144
  * For Node.js environments, use FileRawStorage from @optimystic/db-p2p-storage-fs:
120
145
  * ```typescript
121
146
  * import { FileRawStorage } from '@optimystic/db-p2p-storage-fs';
122
- * storage: { provider: (strandId) => new FileRawStorage(`./data/${strandId}`) }
147
+ * storage: { provider: (scope) => new FileRawStorage(`./data/${scope}`) }
123
148
  * ```
124
149
  *
125
150
  * For React Native, use the appropriate storage from @optimystic/db-p2p-storage-rn:
126
151
  * ```typescript
127
152
  * import { LevelDBRawStorage } from '@optimystic/db-p2p-storage-rn';
128
153
  * // `db` is an open LevelDB handle (see `openOptimysticRNDb` over `rn-leveldb`)
129
- * storage: { provider: (strandId) => new LevelDBRawStorage(openDb(`sereus-${strandId}`)) }
154
+ * storage: { provider: (scope) => new LevelDBRawStorage(openDb(`sereus-${scope}`)) }
130
155
  * ```
131
156
  *
132
157
  * For in-memory storage (testing):
@@ -224,8 +249,9 @@ export interface NetworkConfig {
224
249
  * because a listener that dials its relay from inside `libp2p.start()` put a
225
250
  * sibling in this node's cohort before its own database existed, and a sibling
226
251
  * that had not yet replicated this node's membership row refused the bring-up.
227
- * STRAND nodes inherit the older per-relay `<relay>/p2p-circuit` listener, which
228
- * has no such ordering hazard. A relay named here also becomes a
252
+ * STRAND nodes take the same search shape, one bare listener plus one reservation
253
+ * supervisor PER relay, fail-soft (`strand-network-config.ts`,
254
+ * `strand-instance-manager.ts`). A relay named here also becomes a
229
255
  * delegate-announce target, so this node's strand nodes may reserve on it too
230
256
  * (see `delegate-admission.ts`).
231
257
  *
@@ -235,11 +261,46 @@ export interface NetworkConfig {
235
261
  * must not acquire a listener by accident.
236
262
  *
237
263
  * FAIL-FAST both ways: a malformed entry throws at node start rather than being
238
- * silently dropped, and a first reservation attempt that lands no
239
- * `/p2p-circuit` address throws `RelayReservationFailedError` out of `start()`.
240
- * The fail-soft posture over the same machinery is `CadreNode.reserveRelays()`.
264
+ * silently dropped, and — while {@link requireRelay} stays at its default —
265
+ * a first reservation attempt that lands no `/p2p-circuit` address throws
266
+ * `RelayReservationFailedError` out of `start()`. The fail-soft posture over
267
+ * the same machinery is `CadreNode.reserveRelays()`.
241
268
  */
242
269
  relayAddrs?: string[];
270
+ /**
271
+ * Must a relay named in {@link relayAddrs} have granted a reservation before
272
+ * `start()` is allowed to succeed? Default `true`: an operator who names a
273
+ * relay is telling this machine it has no other reachability, so a relay
274
+ * that will not have us on the first attempt should stop the boot loudly
275
+ * rather than leave a node nobody can reach.
276
+ *
277
+ * Set `false` for a node that must still boot with no network — a phone or a
278
+ * browser tab. The first attempt is still driven at the same point in
279
+ * `start()`; a lost reservation just logs instead of throwing, and the
280
+ * retry supervisor keeps trying in the background exactly as it does after a
281
+ * `CadreNode.reserveRelays()` call. A caller on this posture cannot infer
282
+ * dialability from `start()` resolving — read
283
+ * {@link CadreNode.getRelayReservationState} to find out.
284
+ *
285
+ * It buys a node that BOOTS, not a node that boots fast: `start()` still waits
286
+ * out that first attempt, which costs the drive's whole timeout
287
+ * (`DEFAULT_RELAY_RESERVE_TIMEOUT_MS`, 10 s) against a relay that is unreachable
288
+ * rather than merely refusing (`relay-reservation.ts` polls to the deadline, in
289
+ * case libp2p's own discovery lands a reservation independently).
290
+ *
291
+ * Softens only the RESERVATION half of {@link relayAddrs}'s fail-fast
292
+ * contract. A malformed `relayAddrs` entry still throws at config
293
+ * resolution regardless of this setting — a typo is an operator error
294
+ * whatever the posture — and a hand-written `<relay>/p2p-circuit` entry in
295
+ * {@link listenAddrs} is still rejected on the control node, since that
296
+ * rejection is about the listener shape, not about whether reachability is
297
+ * required.
298
+ *
299
+ * Has no effect on STRAND nodes, which are already fail-soft over
300
+ * `relayAddrs` regardless of this field (`strand-network-config.ts`,
301
+ * `strand-instance-manager.ts`).
302
+ */
303
+ requireRelay?: boolean;
243
304
  /**
244
305
  * Enable circuit relay server - allows this node to relay connections for other peers.
245
306
  * When undefined, defaults to true for storage profile nodes (they typically have
@@ -314,7 +375,8 @@ export interface NetworkConfig {
314
375
  * Every field is optional; omit for the defaults
315
376
  * ({@link DEFAULT_CONTROL_COHORT_TARGET_DEGREE} /
316
377
  * {@link DEFAULT_CONTROL_COHORT_RECONCILE_MS} /
317
- * {@link DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS} / `STRAND_PEER_ADDR_REFRESH_MS`).
378
+ * {@link DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS} /
379
+ * {@link DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS} / `STRAND_PEER_ADDR_REFRESH_MS`).
318
380
  */
319
381
  controlCohort?: {
320
382
  /**
@@ -329,12 +391,20 @@ export interface NetworkConfig {
329
391
  */
330
392
  reconcileMs?: number;
331
393
  /**
332
- * Budget for ONE sibling's proactive dial, in ms. Bounds a pass at
333
- * (dialed siblings) × this, instead of leaving it to each address's own
334
- * libp2p attempt timeout multiplied by address fan-out and relay hops.
335
- * Defaults to {@link DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS}.
394
+ * Limit on dialing ONE peer — all of its candidate addresses together — in
395
+ * ms. Bounds a reconcile pass at (dialed siblings) × this. The same limit
396
+ * applies to the owner dials of `applySeed` and to `dialInvite`. Defaults to
397
+ * {@link DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS}.
336
398
  */
337
399
  dialTimeoutMs?: number;
400
+ /**
401
+ * Limit on ONE candidate address's dial attempt, in ms, inside
402
+ * {@link dialTimeoutMs}. Each address is dialed on its own under this limit,
403
+ * so an address that never answers cannot use up the time the peer's other
404
+ * addresses needed. Defaults to
405
+ * {@link DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS}.
406
+ */
407
+ perAddressDialTimeoutMs?: number;
338
408
  /**
339
409
  * How often each running strand re-resolves its siblings' strand-network
340
410
  * addresses into its own libp2p address book — a step of the reconcile pass,
@@ -489,6 +559,36 @@ export interface CadreNodeConfig {
489
559
  * `{ enabled: false }` restores the pre-existing behaviour.
490
560
  */
491
561
  strandRevocationEnforcement?: StrandRevocationEnforcementConfig;
562
+ /**
563
+ * Tuning for the CLOSED-strand membership reconciler
564
+ * (`strand-membership-reconciler.ts`), applied to every closed strand this
565
+ * node launches with a party identity key: at bring-up each machine redeems a
566
+ * pending formation invitation (seating the party's `Strand.Member` row) and
567
+ * writes its own machine→party `Strand.MemberPeer` binding, retrying in the
568
+ * background without blocking bring-up. `pollIntervalMs` is the IDLE cadence
569
+ * (how often a machine nobody has admitted re-checks) and the cap of the
570
+ * unfinished-join retry ladder, NOT the retry cadence itself — an unfinished
571
+ * join retries from 1 s, doubling. Omit for the defaults (it mirrors
572
+ * {@link strandRevocationEnforcement}'s `pollIntervalMs`);
573
+ * `{ enabled: false }` disarms the loop — for test fixtures that hand-drive
574
+ * the membership writers and assert exact row sets.
575
+ */
576
+ strandMembershipReconciliation?: StrandMembershipReconciliationConfig;
577
+ /**
578
+ * Tuning for the JOINING machine's first-sync write gate
579
+ * (`strand-first-sync-gate.ts`), applied to every strand this node launches as a
580
+ * non-founder: the strand's database is withheld from the app (`StrandInstance.database`
581
+ * unset, status `'syncing'`) until the strand's `Strand.Header` has been received from
582
+ * another member and every `App` table has been read once, because a machine that writes
583
+ * to a table it has never fetched creates a private copy of it that never merges.
584
+ * `timeoutMs` bounds how long {@link CadreNode.addStrand} waits before rejecting with
585
+ * `StrandAwaitingFirstSyncError` (retryable — the launch stays up and keeps probing);
586
+ * `pollIntervalMs` is the probe cadence. Omit for the defaults (`DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS`, 30 s;
587
+ * `DEFAULT_STRAND_FIRST_SYNC_POLL_MS`, 500 ms). There is deliberately no way to disable
588
+ * the gate: a machine that already holds the Header is never gated, so nothing that works
589
+ * today is blocked by it.
590
+ */
591
+ strandFirstSync?: StrandFirstSyncConfig;
492
592
  /** Hibernation configuration */
493
593
  hibernation?: HibernationConfig;
494
594
  /** Polling interval for strand watcher in ms (default: 5000) */
@@ -634,9 +734,16 @@ export interface CadreNodeConfig {
634
734
  };
635
735
  }
636
736
  /**
637
- * Status of a strand instance
737
+ * Status of a strand instance.
738
+ *
739
+ * `'syncing'` is a JOINING machine whose runtime is up (strand libp2p node, background
740
+ * loops) but whose database is held back from the app until the strand's `Strand.Header`
741
+ * has been received from another member — see `strand-first-sync-gate.ts`. In that state
742
+ * `StrandInstance.database` is unset; the instance goes `'active'` (and `CadreNode` emits
743
+ * `strand:writable`) the moment the Header is readable. A founder, or a machine that has
744
+ * synced this strand before (restart, hibernation resume), never passes through it.
638
745
  */
639
- export type StrandStatus = 'starting' | 'active' | 'idle' | 'hibernating' | 'stopping' | 'stopped' | 'error';
746
+ export type StrandStatus = 'starting' | 'syncing' | 'active' | 'idle' | 'hibernating' | 'stopping' | 'stopped' | 'error';
640
747
  /**
641
748
  * App information from strand header
642
749
  */
@@ -653,9 +760,15 @@ export interface StrandInstance {
653
760
  strandId: string;
654
761
  status: StrandStatus;
655
762
  sAppInfo?: SAppInfo;
656
- /** The libp2p node for this strand (only when active/idle) */
763
+ /** The libp2p node for this strand (only when live: syncing/active/idle) */
657
764
  libp2pNode?: Libp2p;
658
- /** The Quereus database for this strand (only when active/idle) */
765
+ /**
766
+ * The Quereus database for this strand — set only while the strand is live AND
767
+ * this machine may write to it. A joining machine that has not yet received the
768
+ * strand's `Strand.Header` from another member runs with `libp2pNode` set and this
769
+ * unset (status `'syncing'`); it is published when the Header arrives
770
+ * (`strand:writable`). Unset while hibernating.
771
+ */
659
772
  database?: StrandDatabase;
660
773
  /** Membership info for closed strands */
661
774
  memberKey?: string;
@@ -753,6 +866,30 @@ export interface StrandConfig {
753
866
  * it deliberately, since a consent-seated row carries a null column.
754
867
  */
755
868
  founder?: boolean;
869
+ /**
870
+ * THIS party's own strand membership private key (base64 protobuf, as
871
+ * `generateStrandMemberKey` mints) for a CLOSED strand — the identity whose public
872
+ * key seats the founding `Member`/`Manager`. The explicit sibling of
873
+ * {@link founder}: normally the launch reads it from the party's control-layer
874
+ * `StrandPartyKey` row (minting one on the founding machine when absent), and an
875
+ * explicit value here WINS over that read — for callers whose row carries no
876
+ * founder provenance to heal against (an explicit `founder: true` over a hand-built
877
+ * row, as the test harness does). Deliberately NOT
878
+ * {@link StrandRow.MemberPrivateKey}, the strand-wide read secret every joining
879
+ * party receives — that key derives nobody's identity.
880
+ */
881
+ partyMemberPrivateKey?: string;
882
+ /**
883
+ * Whether {@link CadreNode.addStrand} waits for a JOINING machine's first sync before it
884
+ * resolves. Default `true`: the returned instance is writable (`database` set, status
885
+ * `'active'`), or the call rejects with `StrandAwaitingFirstSyncError` after
886
+ * `CadreNodeConfig.strandFirstSync.timeoutMs` — retryable, the launch stays up. `false`
887
+ * returns as soon as the runtime is launched, possibly `'syncing'` with no `database`;
888
+ * the caller then wires its own peers (a hand-dialed test fixture) and awaits
889
+ * {@link CadreNode.whenStrandWritable} or the `strand:writable` event. A founder, or a
890
+ * machine that already holds the strand's `Strand.Header`, is never gated either way.
891
+ */
892
+ awaitFirstSync?: boolean;
756
893
  }
757
894
  /**
758
895
  * What {@link CadreNode.foundStrand} needs to publish a strand's control row AND start it
@@ -776,6 +913,14 @@ export interface FoundStrandConfig {
776
913
  memberPrivateKey?: string;
777
914
  /** sApp configuration the hosting application provides, as for {@link StrandConfig}. */
778
915
  sAppConfig: SAppConfig;
916
+ /**
917
+ * Forwarded to the attach ({@link StrandConfig.awaitFirstSync}). Matters only when the
918
+ * call ATTACHES rather than founds — the stored row was published by a sibling machine
919
+ * that won the founding race — in which case this machine is a joiner whose database
920
+ * is withheld until that sibling's `Strand.Header` reaches it; default `true` waits
921
+ * for that inside the call. A founding launch is never gated.
922
+ */
923
+ awaitFirstSync?: boolean;
779
924
  }
780
925
  /**
781
926
  * What {@link CadreNode.foundStrand} hands back: the running instance PLUS the `Strand` row
@@ -841,6 +986,26 @@ export interface OpenInvitation {
841
986
  /** Bootstrap addresses to contact the inviter's cadre */
842
987
  bootstrap: string[];
843
988
  }
989
+ /**
990
+ * A single-use strand membership invitation carried on a closed-strand formation
991
+ * result: the `Strand.Invite` keypair the responder (the host strand's founder party)
992
+ * issued for this redemption. The joiner spends it — `consumeInvite` on its own strand
993
+ * replica — to seat a `Strand.Member` row under its OWN party key, so joining no longer
994
+ * hands out the founder's identity. Structurally identical to
995
+ * `strand-membership-writer`'s `IssuedInvite`; declared here so the wire/type layer does
996
+ * not import the writer.
997
+ */
998
+ export interface StrandMembershipInvite {
999
+ /** The invite ed25519 PUBLIC key (base64url) — the `Strand.Invite.Key` row. */
1000
+ inviteKey: string;
1001
+ /**
1002
+ * The invite ed25519 PRIVATE seed (base64url). A single-use bearer credential:
1003
+ * whoever holds it can `consumeInvite` exactly once. Same sensitivity class and
1004
+ * handling as `memberPrivateKey` — delivered only inside the validated,
1005
+ * post-approval formation result, never written to either side's control DB.
1006
+ */
1007
+ invitePrivateKey: string;
1008
+ }
844
1009
  /**
845
1010
  * Result of forming a strand via open invitation
846
1011
  */
@@ -858,6 +1023,15 @@ export interface FormStrandResult {
858
1023
  * from {@link invitePrivateKey} (the initiator's own generated signing key).
859
1024
  */
860
1025
  memberPrivateKey?: string;
1026
+ /**
1027
+ * The joiner's own single-use membership invitation into the (closed, bound) host
1028
+ * strand — see {@link StrandMembershipInvite}. Present only when the responder's
1029
+ * host strand is closed and its runtime issued one; absent for open strands and the
1030
+ * responder-provisions (unbound) path. `CadreNode.formStrand` itself persists the
1031
+ * joiner's party key and caches this invitation for the strand bring-up to redeem,
1032
+ * so an embedding app normally never touches it.
1033
+ */
1034
+ membershipInvite?: StrandMembershipInvite;
861
1035
  /**
862
1036
  * The responder's live STRAND-network multiaddrs for the formed strand — the only
863
1037
  * cross-party discovery seed there is, since the strand-addr RPC that resolves a
@@ -925,6 +1099,18 @@ export interface CadreNodeEvents {
925
1099
  'strand:waking': {
926
1100
  strandId: string;
927
1101
  };
1102
+ /**
1103
+ * Emitted when a strand that came up `'syncing'` — a joining machine whose database was
1104
+ * withheld until it received the strand's `Strand.Header` from another member — becomes
1105
+ * writable: `StrandInstance.database` is now set and the status is `'active'`. A strand
1106
+ * whose `strand:started` already reported `'active'` (a founder, or a machine that had
1107
+ * synced before) never emits this. The event form of what {@link CadreNode.addStrand}
1108
+ * awaits; an app that attaches without waiting (`awaitFirstSync: false`, or a strand the
1109
+ * watcher auto-launched) hangs its "waiting for the other member" screen on the pair.
1110
+ */
1111
+ 'strand:writable': {
1112
+ strandId: string;
1113
+ };
928
1114
  /**
929
1115
  * Emitted when this node discovers it is no longer a member of a CLOSED
930
1116
  * strand — its party was removed by a manager, or it left. Detected by the
@@ -947,10 +1133,28 @@ export interface CadreNodeEvents {
947
1133
  };
948
1134
  /**
949
1135
  * Emitted when the control network advertises a strand this node has no
950
- * registered `sAppConfig` for — i.e. a strand created by another member. The
951
- * hosting app decides whether to join it (register a config + `addStrand`,
952
- * e.g. via a chat `joinChatStrand` helper). Carries the full {@link StrandRow}
953
- * so the app can join without re-querying the control DB.
1136
+ * registered `sAppConfig` for — i.e. a strand created by another member, or
1137
+ * one this node ran in a previous session (sApp configs are in-memory only and
1138
+ * do not survive `stop()`). The hosting app decides whether to join it
1139
+ * (register a config + `addStrand`, e.g. via a chat `joinChatStrand` helper).
1140
+ * Carries the full {@link StrandRow} so the app can join without re-querying
1141
+ * the control DB.
1142
+ *
1143
+ * **Fired exactly ONCE per strand per session, and it can fire before your
1144
+ * listener is attached.** The strand watcher's first poll runs inside
1145
+ * `CadreNode.start()` (100 ms after the watcher starts), so every strand
1146
+ * already stored for this party is normally offered while the embedding app is
1147
+ * still inside its own `start()` await. The watcher then records the strand as
1148
+ * seen and no later poll re-offers it, so a listener attached a moment late
1149
+ * misses those strands for the life of the process.
1150
+ *
1151
+ * So an app that auto-joins discovered strands must **subscribe first, then
1152
+ * drain `CadreNode.getDiscoveredStrands()`** — the map of strands no local
1153
+ * config claims. In that order a strand discovered between the two steps is
1154
+ * handled twice rather than not at all, which is why the join handler needs to
1155
+ * be idempotent (guard on an in-flight set, not only on
1156
+ * `getStrands().has(id)` — the strand manager tracks an instance only once
1157
+ * `addStrand` has resolved).
954
1158
  */
955
1159
  'strand:discovered': {
956
1160
  strandId: string;
@@ -958,6 +1162,25 @@ export interface CadreNodeEvents {
958
1162
  };
959
1163
  'control:connected': void;
960
1164
  'control:disconnected': void;
1165
+ /**
1166
+ * Emitted when the control-write retry funnel GAVE UP on a local control write — the
1167
+ * classifier declined the failure as non-transient, or every attempt (or the elapsed
1168
+ * budget) ran out. One event per abandoned write, carrying the operation label, how far
1169
+ * it got, why it stopped and the error.
1170
+ *
1171
+ * Exists because an abandoned BACKGROUND write is otherwise invisible: the node's own
1172
+ * self-address republish, the post-connect drain and the replication drain all fire
1173
+ * their writes unawaited with a `debug`-only catch, and that namespace is off unless
1174
+ * something enabled it — so the write is lost and nobody is told. A FOREGROUND write's
1175
+ * caller sees the rethrown error as well as this event.
1176
+ *
1177
+ * What an app does with it is its own call; the node itself only escalates ONE case to
1178
+ * the operator (a self-address republish that has been failing longer than a peer
1179
+ * record stays fresh, at which point other machines are already discarding this node's
1180
+ * address). Treat the rest as telemetry — a control write that was lost, not a strand
1181
+ * or connection state change.
1182
+ */
1183
+ 'control:write-abandoned': ControlRetryAbandonment;
961
1184
  /** Emitted when a seed is received via the seed protocol */
962
1185
  'seed:received': {
963
1186
  partyId: string;
@@ -1031,6 +1254,8 @@ export type CadrePeerVoucherFields = Pick<CadrePeerRow, 'peerId' | 'stampId' | '
1031
1254
  * `ControlDatabase.queryRevocations`: the identity triple plus the `ReissuedAt`
1032
1255
  * counter an owner bumps (`ControlDatabase.reissueRevocations`) to re-write — and
1033
1256
  * therefore re-broadcast — a tombstone that committed while the node was alone.
1257
+ * Never the ledger marker: that row names no guarded table, and `queryRevocations`
1258
+ * skips it, which is what keeps `tableName` a {@link RevocableTable}.
1034
1259
  */
1035
1260
  export interface RevocationRow {
1036
1261
  /** Which guarded table's stamp was retired. */
@@ -1042,6 +1267,13 @@ export interface RevocationRow {
1042
1267
  /** Monotonic re-issue counter; carries no semantics (see the schema comment). */
1043
1268
  reissuedAt: number;
1044
1269
  }
1270
+ /**
1271
+ * Outcome of `ControlDatabase.openRevocationLedger`: `'opened'` when this call filed the
1272
+ * singleton `Revocation` ledger marker, `'already-open'` when it was already filed (seen
1273
+ * by the in-lock guard, or filed first by another owner and refused on the primary key).
1274
+ * Either way the marker exists afterwards.
1275
+ */
1276
+ export type RevocationLedgerOpenResult = 'opened' | 'already-open';
1045
1277
  /**
1046
1278
  * Outcome of {@link CadreNode.registerSelf}, surfaced so callers (e.g. the CLI
1047
1279
  * `--owner` branch) can log what happened:
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA6EA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA6C;IAC5E,QAAQ,EAAE;QACR,WAAW,EAAE,QAAQ,EAAS,aAAa;QAC3C,gBAAgB,EAAE,QAAQ,EAAI,kBAAkB;QAChD,eAAe,EAAE,QAAQ,EAAK,MAAM;QACpC,oBAAoB,EAAE,CAAC;QACvB,kBAAkB,EAAE,QAAQ,CAAE,MAAM;KACrC;IACD,WAAW,EAAE;QACX,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAI,YAAY;QAC1C,gBAAgB,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,wBAAwB;QAC1D,eAAe,EAAE,EAAE,GAAG,IAAI,EAAI,mBAAmB;QACjD,oBAAoB,EAAE,CAAC;QACvB,kBAAkB,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,eAAe;KACnD;IACD,UAAU,EAAE;QACV,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAI,WAAW;QACzC,gBAAgB,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAG,uBAAuB;QACzD,eA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,eAAe,EAAE,EAAE,GAAG,IAAI,EAAI,mBAAmB;QACjD,oBAAoB,EAAE,CAAC;QACvB,kBAAkB,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,eAAe;KACnD;IACD,UAAU,EAAE;QACV,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAI,WAAW;QACzC,gBAAgB,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAG,uBAAuB;QACzD,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAI,kBAAkB;QACpD,oBAAoB,EAAE,CAAC;QACvB,kBAAkB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,gBAAgB;KACxD;IACD,OAAO,EAAE;QACP,WAAW,EAAE,EAAE,GAAG,IAAI,EAAQ,aAAa;QAC3C,gBAAgB,EAAE,EAAE,GAAG,IAAI,EAAG,wBAAwB;QACtD,eAAe,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAG,eAAe;QACjD,oBAAoB,EAAE,CAAC;QACvB,kBAAkB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,eAAe;KAC5D;CACF,CAAC;AA8VF;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,IAAI,CAAC;AAYnD;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,EAC3B,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,+BAA+B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serfab/cadre-core",
3
- "version": "0.13.0",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "Core library for Sereus cadre nodes - manages control networks and strand participation",
6
6
  "main": "dist/index.js",
@@ -73,7 +73,7 @@
73
73
  "@libp2p/tcp": "^11.0.10",
74
74
  "@libp2p/webrtc": "6.0.14",
75
75
  "@libp2p/websockets": "^10.1.3",
76
- "@optimystic/db-p2p-storage-fs": "^1.0.0-beta.2",
76
+ "@optimystic/db-p2p-storage-fs": "^1.1.0",
77
77
  "@types/debug": "^4.1.12",
78
78
  "@types/node": "^25.0.10",
79
79
  "@vitest/coverage-v8": "^4.0.17",
@@ -88,12 +88,12 @@
88
88
  "@libp2p/interface": "^3.1.0",
89
89
  "@libp2p/peer-id": "^6.0.4",
90
90
  "@multiformats/multiaddr": "^12.5.1",
91
- "@optimystic/db-core": "^1.0.0-beta.2",
92
- "@optimystic/db-p2p": "^1.0.0-beta.2",
93
- "@optimystic/quereus-plugin-crypto": "^1.0.0-beta.2",
94
- "@optimystic/quereus-plugin-optimystic": "^1.0.0-beta.2",
95
- "@quereus/quereus": "^4.19.0",
96
- "@serfab/quereus-plugin-sereus": "^0.13.0",
91
+ "@optimystic/db-core": "^1.1.0",
92
+ "@optimystic/db-p2p": "^1.1.0",
93
+ "@optimystic/quereus-plugin-crypto": "^1.1.0",
94
+ "@optimystic/quereus-plugin-optimystic": "^1.1.0",
95
+ "@quereus/quereus": "^4.19.4",
96
+ "@serfab/quereus-plugin-sereus": "^1.1.0",
97
97
  "debug": "^4.4.3",
98
98
  "libp2p": "^3.1.3",
99
99
  "uint8arrays": "^5.1.0"
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Node-only file-backed {@link BootstrapPeerStore}: one JSON file per party under
3
3
  * a configured directory (the node's state directory — `cadre-cli` passes
4
- * `ResolvedConfig.nodeStateDir`), holding the node-local, non-replicated
5
- * cold-start dial targets a seed nominated.
4
+ * `ResolvedConfig.nodeStateDir`), holding the node-local, non-replicated dial
5
+ * targets learned out of band (a seed's owner peers, and nodes this node added).
6
6
  *
7
7
  * Nothing but the file itself lives here: the envelope, load policy, per-entry
8
8
  * validation (shape only — never signatures; see the `bootstrap-peer-store.ts`