@serfab/cadre-core 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +3 -2
  2. package/dist/cadre-node.d.ts +328 -25
  3. package/dist/cadre-node.js +760 -59
  4. package/dist/cadre-node.js.map +1 -1
  5. package/dist/control-database.d.ts +19 -0
  6. package/dist/control-database.js +51 -9
  7. package/dist/control-database.js.map +1 -1
  8. package/dist/control-schema.d.ts +1 -1
  9. package/dist/control-schema.js +30 -2
  10. package/dist/control-schema.js.map +1 -1
  11. package/dist/enrolled-machine-store-file.d.ts +13 -0
  12. package/dist/enrolled-machine-store-file.js +41 -0
  13. package/dist/enrolled-machine-store-file.js.map +1 -0
  14. package/dist/enrolled-machine-store.d.ts +81 -0
  15. package/dist/enrolled-machine-store.js +225 -0
  16. package/dist/enrolled-machine-store.js.map +1 -0
  17. package/dist/file-durable-slot.js +5 -3
  18. package/dist/file-durable-slot.js.map +1 -1
  19. package/dist/index.d.ts +5 -3
  20. package/dist/index.js +23 -5
  21. package/dist/index.js.map +1 -1
  22. package/dist/membership-connection-gater.d.ts +15 -1
  23. package/dist/membership-connection-gater.js +9 -3
  24. package/dist/membership-connection-gater.js.map +1 -1
  25. package/dist/node-local-snapshot.d.ts +6 -0
  26. package/dist/node-local-snapshot.js +7 -1
  27. package/dist/node-local-snapshot.js.map +1 -1
  28. package/dist/{strand-backfill.d.ts → peer-join-backfill.d.ts} +49 -20
  29. package/dist/{strand-backfill.js → peer-join-backfill.js} +133 -52
  30. package/dist/peer-join-backfill.js.map +1 -0
  31. package/dist/relay-addrs.d.ts +73 -0
  32. package/dist/relay-addrs.js +195 -0
  33. package/dist/relay-addrs.js.map +1 -1
  34. package/dist/strand-database.d.ts +12 -0
  35. package/dist/strand-database.js +16 -0
  36. package/dist/strand-database.js.map +1 -1
  37. package/dist/strand-formation-manager.d.ts +12 -0
  38. package/dist/strand-formation-manager.js +10 -3
  39. package/dist/strand-formation-manager.js.map +1 -1
  40. package/dist/strand-formation-protocol.d.ts +76 -2
  41. package/dist/strand-formation-protocol.js +78 -2
  42. package/dist/strand-formation-protocol.js.map +1 -1
  43. package/dist/strand-instance-manager.d.ts +147 -14
  44. package/dist/strand-instance-manager.js +225 -45
  45. package/dist/strand-instance-manager.js.map +1 -1
  46. package/dist/strand-membership-writer.d.ts +12 -0
  47. package/dist/strand-membership-writer.js +23 -1
  48. package/dist/strand-membership-writer.js.map +1 -1
  49. package/dist/strand-network-config.d.ts +84 -0
  50. package/dist/strand-network-config.js +136 -0
  51. package/dist/strand-network-config.js.map +1 -0
  52. package/dist/strand-revocation-enforcer.d.ts +392 -0
  53. package/dist/strand-revocation-enforcer.js +533 -0
  54. package/dist/strand-revocation-enforcer.js.map +1 -0
  55. package/dist/strand-solicitation.d.ts +7 -0
  56. package/dist/strand-solicitation.js +8 -2
  57. package/dist/strand-solicitation.js.map +1 -1
  58. package/dist/strand-watcher.js +6 -1
  59. package/dist/strand-watcher.js.map +1 -1
  60. package/dist/types.d.ts +210 -16
  61. package/dist/types.js +7 -1
  62. package/dist/types.js.map +1 -1
  63. package/package.json +16 -8
  64. package/src/cadre-node.ts +6353 -5603
  65. package/src/control-database.ts +53 -9
  66. package/src/control-schema.ts +30 -2
  67. package/src/enrolled-machine-store-file.ts +43 -0
  68. package/src/enrolled-machine-store.ts +280 -0
  69. package/src/file-durable-slot.ts +5 -3
  70. package/src/index.ts +52 -10
  71. package/src/membership-connection-gater.ts +9 -3
  72. package/src/node-local-snapshot.ts +13 -1
  73. package/src/peer-addr-book.ts +251 -250
  74. package/src/{strand-backfill.ts → peer-join-backfill.ts} +478 -389
  75. package/src/relay-addrs.ts +218 -0
  76. package/src/strand-database.ts +17 -0
  77. package/src/strand-formation-manager.ts +22 -3
  78. package/src/strand-formation-protocol.ts +808 -692
  79. package/src/strand-instance-manager.ts +317 -54
  80. package/src/strand-membership-writer.ts +23 -1
  81. package/src/strand-network-config.ts +172 -0
  82. package/src/strand-revocation-enforcer.ts +653 -0
  83. package/src/strand-solicitation.ts +484 -471
  84. package/src/strand-watcher.ts +319 -314
  85. package/src/types.ts +1554 -1354
  86. package/dist/strand-backfill.js.map +0 -1
@@ -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,QA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C;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"}
package/dist/types.d.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  import type { ConnectionGater, Libp2p, PeerId, PrivateKey } from '@libp2p/interface';
2
2
  import type { IRawStorage, Libp2pTransports } from '@optimystic/db-p2p';
3
3
  import type { IPeerNetwork, IRepo } from '@optimystic/db-core';
4
- import type { StrandBackfillConfig } from './strand-backfill.js';
4
+ import type { PeerJoinBackfillConfig } from './peer-join-backfill.js';
5
+ import type { StrandRevocationEnforcementConfig } from './strand-revocation-enforcer.js';
5
6
  import type { StrandDatabase } from './strand-database.js';
6
7
  import type { SeedTrustPolicy } from './seed-trust-policy.js';
7
8
  import type { KeyStore, KeyId } from './key-store.js';
8
9
  import type { TrustedOwnerStore, TrustSource } from './trusted-owner-store.js';
9
10
  import type { BootstrapPeerStore } from './bootstrap-peer-store.js';
11
+ import type { EnrolledMachineStore } from './enrolled-machine-store.js';
10
12
  import type { PushNotifier } from './push-notifier.js';
11
13
  import type { RevocableTable } from './control-authorization.js';
12
14
  /**
@@ -20,7 +22,7 @@ export interface Libp2pNodeWithRepo extends Libp2p {
20
22
  * `coordinatedRepo` (`libp2p-node-base.ts`). Optional deliberately: the base
21
23
  * factory always assigns it, but it is not part of the upstream node type, so
22
24
  * declaring it required would be a claim this repo cannot enforce. The strand
23
- * backfill (`strand-backfill.ts`) logs once and stays inert when it is absent.
25
+ * backfill (`peer-join-backfill.ts`) logs once and stays inert when it is absent.
24
26
  */
25
27
  keyNetwork?: IPeerNetwork;
26
28
  }
@@ -140,13 +142,36 @@ export interface StorageConfig {
140
142
  * Network configuration for libp2p
141
143
  */
142
144
  export interface NetworkConfig {
145
+ /**
146
+ * Addresses this machine's libp2p nodes bind. Omitted, `@optimystic/db-p2p`'s own
147
+ * default (`/ip4/0.0.0.0/tcp/0`) applies; `[]` means "cannot listen" and is honored
148
+ * as written (React Native hosts rely on that).
149
+ *
150
+ * The machine runs one control node plus one node per strand, so a FIXED port here
151
+ * can only belong to one of them. The control node binds it as configured; each
152
+ * strand node binds the same entry with its port rewritten to `0`, keeping the
153
+ * interface and transport (`/ws`, a specific-interface bind). A
154
+ * `<relay>/p2p-circuit` entry is untouched — the port inside it is the relay's, not
155
+ * a local bind. See `strand-network-config.ts`.
156
+ *
157
+ * **Only TCP, WebSocket (`/ws`, `/wss`) and circuit-relay addresses are bindable**
158
+ * unless {@link transports} supplies the factories for something else. A `/ws` entry
159
+ * switches the WebSocket transport on by itself; anything else — `/quic-v1`,
160
+ * `/webrtc`, `/webtransport` — refuses node start naming the address and the libp2p
161
+ * package it would need, rather than being dropped in silence by libp2p's transport
162
+ * manager. See `relay-addrs.ts` → `resolveTransportOptions`.
163
+ */
143
164
  listenAddrs?: string[];
144
165
  /**
145
166
  * Addresses to advertise to peers **instead of** `listenAddrs` — for a node behind
146
167
  * NAT or a reverse proxy that is reachable at a different address than it binds
147
168
  * (e.g. `mynode.example.com:4001` in front of a `0.0.0.0:4001` listener). Reaches
148
- * libp2p's `addresses.announce` via `@optimystic/db-p2p`'s `NodeOptions.announceAddrs`,
149
- * on this node's control node and on every strand node it runs.
169
+ * libp2p's `addresses.announce` via `@optimystic/db-p2p`'s `NodeOptions.announceAddrs`.
170
+ *
171
+ * **Applies to this machine's CONTROL node only.** Strand nodes drop it: any concrete
172
+ * entry names a port, and that port is the control node's, so a strand node
173
+ * advertising it would send peers to the wrong node (`strand-network-config.ts`).
174
+ * Entries are still validated at node start whichever node ends up using them.
150
175
  *
151
176
  * **A non-empty value REPLACES the advertised set entirely.** Observed addresses,
152
177
  * and the `/p2p-circuit` address earned from a {@link relayAddrs} reservation, are
@@ -177,6 +202,8 @@ export interface NetworkConfig {
177
202
  * advertise. Reaches libp2p's `addresses.appendAnnounce` via
178
203
  * `@optimystic/db-p2p`'s `NodeOptions.appendAnnounceAddrs`.
179
204
  *
205
+ * **Control node only**, on the same terms as {@link announceAddrs}.
206
+ *
180
207
  * **Ignored while {@link announceAddrs} is non-empty** — that is libp2p's own
181
208
  * precedence, applied upstream; this repo does not merge the two locally. Set one
182
209
  * or the other, not both.
@@ -270,8 +297,14 @@ export interface NetworkConfig {
270
297
  * On the CONTROL node this gater is composed with the built-in membership
271
298
  * admission gate (`membership-connection-gater.ts`): every hook supplied here
272
299
  * is honored unchanged, and on inbound encrypted connections a deny from
273
- * either this gater or the membership policy denies. Strand cohort nodes
274
- * receive this gater as-is (their peers are legitimately cross-party).
300
+ * either this gater or the membership policy denies.
301
+ *
302
+ * Strand cohort nodes: an OPEN strand's node receives this gater as-is (its
303
+ * peers are legitimately cross-party). A CLOSED strand's node composes
304
+ * revoked-peer denial onto it (`strand-revocation-enforcer.ts`) — every hook
305
+ * supplied here is still honored unchanged, and on the composed hooks
306
+ * (inbound encrypted connection, outbound peer dial, relay reservation) a
307
+ * deny from either this gater or the revocation check denies.
275
308
  */
276
309
  connectionGater?: ConnectionGater;
277
310
  /**
@@ -352,8 +385,14 @@ export interface ControlNetworkConfig {
352
385
  * by omission); the strand breadth defaults to
353
386
  * {@link CadreNodeConfig.strandClusterSize} while its policy is the fixed
354
387
  * {@link STRAND_CLUSTER_POLICY}.
388
+ *
389
+ * The two `*ClusterPolicy` BUILDERS are the same objects with the block-repair
390
+ * corroboration yardstick declared from the machines enrolled in this party
391
+ * ({@link resolveRepairYardstick}); handed no count, each returns its frozen base
392
+ * constant unchanged. A network picks the derived number up when its libp2p node is
393
+ * built, which for a strand is every wake from hibernation.
355
394
  */
356
- export { MIN_CLUSTER_SIZE, CONTROL_REPLICATION_BREADTH, CONTROL_CLUSTER_POLICY, DEFAULT_STRAND_CLUSTER_SIZE, STRAND_CLUSTER_POLICY, resolveStrandClusterSize } from '@serfab/quereus-plugin-sereus';
395
+ export { MIN_CLUSTER_SIZE, CONTROL_REPLICATION_BREADTH, CONTROL_CLUSTER_POLICY, DEFAULT_STRAND_CLUSTER_SIZE, STRAND_CLUSTER_POLICY, resolveStrandClusterSize, resolveRepairYardstick, controlClusterPolicy, strandClusterPolicy } from '@serfab/quereus-plugin-sereus';
357
396
  /**
358
397
  * Main configuration for a CadreNode
359
398
  */
@@ -414,17 +453,42 @@ export interface CadreNodeConfig {
414
453
  */
415
454
  strandClusterSize?: number;
416
455
  /**
417
- * Tuning for the strand peer-join block catch-up (see `strand-backfill.ts`):
456
+ * Tuning for the strand peer-join block catch-up (see `peer-join-backfill.ts`):
418
457
  * when a strand's libp2p node connects to a peer this runtime has not yet
419
458
  * caught up, every block in the strand's own raw store is pushed to that peer,
420
459
  * so a machine that joined the strand after blocks were committed still ends
421
- * up physically holding them. Applies to every strand this node starts;
422
- * strand-only — the control network has its own row-level re-issue queue
423
- * (`drainPendingControlReplication`). Omit for the defaults
424
- * (`DEFAULT_STRAND_BACKFILL`); `{ enabled: false }` restores the
425
- * no-backfill behaviour.
460
+ * up physically holding them. Applies to every strand this node starts.
461
+ * Omit for the defaults (`DEFAULT_PEER_JOIN_BACKFILL`); `{ enabled: false }`
462
+ * restores the no-backfill behaviour. The control network runs its own,
463
+ * separately tuned catch-up — see {@link controlBackfill}.
464
+ */
465
+ strandBackfill?: PeerJoinBackfillConfig;
466
+ /**
467
+ * Tuning for the CONTROL network's peer-join block catch-up (same module,
468
+ * `peer-join-backfill.ts`, wired in `CadreNode.start`): when the control
469
+ * libp2p node connects to an AUTHORIZED party member this runtime has not yet
470
+ * caught up, every block in the control database's own raw store is pushed to
471
+ * it. This is what makes a control block committed while the writer was alone
472
+ * (collection headers written at genesis above all) physically reach members
473
+ * that joined later — without it, such a member that restarts offline reads
474
+ * the affected tables as empty. Pushes are gated on
475
+ * `CadreNode.isAuthorizedMember`, checked at push time, because the control
476
+ * network's inbound gate deliberately admits non-members in several states
477
+ * (seed delivery, enrollment, bootstrap/relay peers). Omit for the defaults
478
+ * (`DEFAULT_PEER_JOIN_BACKFILL`); `{ enabled: false }` disables it.
426
479
  */
427
- strandBackfill?: StrandBackfillConfig;
480
+ controlBackfill?: PeerJoinBackfillConfig;
481
+ /**
482
+ * Tuning for the CLOSED-strand revoked-peer gate
483
+ * (`strand-revocation-enforcer.ts`), applied to every closed strand this node
484
+ * starts: each strand node materializes the peer ids bound to REMOVED members
485
+ * (orphaned `Strand.MemberPeer` rows) and refuses them at the stream and
486
+ * connection layers, so removing a party cuts the network to its machines
487
+ * rather than only deleting its row. Open strands never arm it. Omit for the
488
+ * defaults (`DEFAULT_REVOCATION_POLL_INTERVAL_MS` refresh cadence);
489
+ * `{ enabled: false }` restores the pre-existing behaviour.
490
+ */
491
+ strandRevocationEnforcement?: StrandRevocationEnforcementConfig;
428
492
  /** Hibernation configuration */
429
493
  hibernation?: HibernationConfig;
430
494
  /** Polling interval for strand watcher in ms (default: 5000) */
@@ -508,6 +572,39 @@ export interface CadreNodeConfig {
508
572
  */
509
573
  store?: BootstrapPeerStore;
510
574
  };
575
+ /**
576
+ * Node-local record of how many machines this party had enrolled the last time
577
+ * this node looked (see `enrolled-machine-store.ts`): the block-repair
578
+ * corroboration yardstick the CONTROL node declares when its libp2p node is
579
+ * built. Sibling of {@link trustedOwners} / {@link bootstrapPeers} — same
580
+ * NON-replicated, per-party, injected-backend shape — and, like
581
+ * {@link bootstrapPeers}, nothing here is trust-bearing: it is a repair hint,
582
+ * recomputed from `CadrePeer` rows the moment the control database is up.
583
+ *
584
+ * It exists only because the control node is created BEFORE that database, so
585
+ * the live count is unreadable at the one moment it is needed; remembering it
586
+ * across the restart is what breaks that deadlock. Absent ⇒ an in-memory store
587
+ * is created at start(), which cold-starts on every launch and therefore
588
+ * declares nothing — byte-for-byte the behaviour before this record existed.
589
+ * No embedder is forced to change.
590
+ *
591
+ * A party that grows applies the larger number on each node's NEXT launch,
592
+ * deliberately: Optimystic freezes the policy at node construction and offers
593
+ * no runtime setter, and a node still holding the old value runs at exactly
594
+ * today's behaviour, so there is no forced rebuild.
595
+ *
596
+ * A new platform needs no new store class: supply a `DurableSlot` for the
597
+ * platform's storage and inject `PersistentEnrolledMachineStore.open(slot, partyId)`.
598
+ */
599
+ enrolledMachines?: {
600
+ /**
601
+ * Injected store instance — e.g. a `FileEnrolledMachineStore` from the
602
+ * Node-only subpath `@serfab/cadre-core/enrolled-machine-store-file`,
603
+ * persisted in the node's state directory. Its `partyId` must match
604
+ * `controlNetwork.partyId`; start() fails closed on a mismatch.
605
+ */
606
+ store?: EnrolledMachineStore;
607
+ };
511
608
  /**
512
609
  * Platform push-delivery for suspended mobile peers. When present, the node's
513
610
  * server fan-out can deliver strand-wake data messages over the platform push
@@ -600,6 +697,17 @@ export interface StrandRow {
600
697
  Id: string;
601
698
  MemberPrivateKey: string | null;
602
699
  Type: 'o' | 'c';
700
+ /**
701
+ * ed25519 (base64url) owner key of the MACHINE that published this row — the
702
+ * signer of the owner-signed `Strand` insert (`== context.OwnerKey`, pinned by
703
+ * the schema's `AuthorizedInsert`). Identifies the founding machine, so a
704
+ * launch with no explicit `founder` flag derives "am I the founder?" by
705
+ * comparing it to the node's own owner key (see `CadreNode.launchStrand`).
706
+ * `null` on a consent-seated strand (the unsigned `FormationUsage` branch
707
+ * records no trustworthy signer). Provenance, not content —
708
+ * `strandRowMismatches` excludes it from the identical-content comparison.
709
+ */
710
+ FounderOwnerKey: string | null;
603
711
  }
604
712
  /**
605
713
  * sApp configuration provided by the hosting application when creating a strand.
@@ -637,11 +745,62 @@ export interface StrandConfig {
637
745
  * paths; the same party that calls {@link CadreNode.publishStrand}). The founder
638
746
  * runs the one-time membership bootstrap at bring-up (writes `Strand.Header`, and
639
747
  * for a closed strand the founding `Member`+`Manager`). A joiner leaves this
640
- * `false`/unset and writes nothing — it receives those rows via Optimystic sync.
641
- * Defaults to `false`.
748
+ * unset and writes nothing — it receives those rows via Optimystic sync.
749
+ *
750
+ * When unset, founder-ness is DERIVED from the row: this node founds iff
751
+ * {@link StrandRow.FounderOwnerKey} equals its own owner key. An explicit
752
+ * `true`/`false` wins over the derivation — the formation/responder flows pass
753
+ * it deliberately, since a consent-seated row carries a null column.
642
754
  */
643
755
  founder?: boolean;
644
756
  }
757
+ /**
758
+ * What {@link CadreNode.foundStrand} needs to publish a strand's control row AND start it
759
+ * locally as its founder — the resumable one-call form of `publishStrand` + `addStrand`.
760
+ *
761
+ * No `strandRow`: the row is the OUTPUT of founding, either freshly published or read back
762
+ * from an interrupted earlier attempt. `StrandConfig` (the join/attach shape) takes one
763
+ * because there the row already exists and came from the control network.
764
+ */
765
+ export interface FoundStrandConfig {
766
+ /** Unique strand identifier. Trimmed; blank is rejected. */
767
+ strandId: string;
768
+ /** `'o'` for open (default) or `'c'` for closed. */
769
+ type?: 'o' | 'c';
770
+ /**
771
+ * Membership key gating a closed strand. Required in practice for `type: 'c'` (the
772
+ * founder bootstrap rejects a null key), and IGNORED when the strand is already
773
+ * published — the stored key wins, so read the resolved key back off the returned
774
+ * instance rather than trusting a freshly minted one.
775
+ */
776
+ memberPrivateKey?: string;
777
+ /** sApp configuration the hosting application provides, as for {@link StrandConfig}. */
778
+ sAppConfig: SAppConfig;
779
+ }
780
+ /**
781
+ * What {@link CadreNode.foundStrand} hands back: the running instance PLUS the `Strand` row
782
+ * the strand actually runs under.
783
+ *
784
+ * The row is returned separately rather than left for the caller to read off the instance
785
+ * because on a resumed founding it is NOT the caller's input — a closed strand adopts the
786
+ * stored `MemberPrivateKey`, discarding a freshly minted one. A caller that must carry the
787
+ * membership key onward (to mint an invitation, say) reads it from HERE.
788
+ */
789
+ export interface FoundStrandResult {
790
+ /** The active local instance, as {@link CadreNode.addStrand} would have returned. */
791
+ instance: StrandInstance;
792
+ /** The live control-plane row: freshly published, or the one already there. */
793
+ strandRow: StrandRow;
794
+ /**
795
+ * Whether THIS machine actually founded (ran / will have run the one-time
796
+ * founder bootstrap). `false` when the resolved row was published by a
797
+ * DIFFERENT machine's owner key — e.g. a sibling won a concurrent founding
798
+ * race — in which case the call attached as a joiner instead, which is the
799
+ * correct outcome (two machines bootstrapping one strand on separate replicas
800
+ * is the double-`Header` hazard).
801
+ */
802
+ founded: boolean;
803
+ }
645
804
  /**
646
805
  * Result of creating a new cadre peer
647
806
  */
@@ -699,6 +858,21 @@ export interface FormStrandResult {
699
858
  * from {@link invitePrivateKey} (the initiator's own generated signing key).
700
859
  */
701
860
  memberPrivateKey?: string;
861
+ /**
862
+ * The responder's live STRAND-network multiaddrs for the formed strand — the only
863
+ * cross-party discovery seed there is, since the strand-addr RPC that resolves a
864
+ * sibling's strand addresses answers own-party callers only.
865
+ *
866
+ * Always an array, frequently EMPTY: the responder discloses none when it holds no
867
+ * live strand node for the strand it just provisioned (the responder-provisions path
868
+ * mints a strand that has not launched yet). `CadreNode.formStrand` records these
869
+ * itself, so an embedding app only needs them to seed a strand it launches OUTSIDE
870
+ * that node.
871
+ *
872
+ * One-shot and in-memory: they are the responder's addresses at the moment of
873
+ * formation and are never re-resolved — see `docs/strands.md`.
874
+ */
875
+ strandAddrs: string[];
702
876
  }
703
877
  /**
704
878
  * Disclosure object provided during strand formation.
@@ -751,6 +925,26 @@ export interface CadreNodeEvents {
751
925
  'strand:waking': {
752
926
  strandId: string;
753
927
  };
928
+ /**
929
+ * Emitted when this node discovers it is no longer a member of a CLOSED
930
+ * strand — its party was removed by a manager, or it left. Detected by the
931
+ * strand's revoked-peer gate (`strand-revocation-enforcer.ts`) seeing this
932
+ * node's own peer id in the revoked set, so it is BEST-EFFORT: it fires only
933
+ * if the removal replicated here before the rest of the strand cut us off,
934
+ * and a node that was already offline may never see it at all.
935
+ *
936
+ * Nothing is stopped or torn down for you. Treat it as "this strand will no
937
+ * longer sync": remaining members refuse this node's streams, dials, and
938
+ * connections, so reads keep working against whatever is stored locally while
939
+ * writes stop propagating. Stopping the strand (`stopStrand`) or deleting its
940
+ * data is the app's decision. Emitted once per removal — re-armed if a manager
941
+ * re-admits this party, so a second removal is reported again — and a
942
+ * hibernation wake rebuilds the gate, which may re-emit for a strand still
943
+ * revoked.
944
+ */
945
+ 'strand:revoked': {
946
+ strandId: string;
947
+ };
754
948
  /**
755
949
  * Emitted when the control network advertises a strand this node has no
756
950
  * registered `sAppConfig` for — i.e. a strand created by another member. The
package/dist/types.js CHANGED
@@ -51,6 +51,12 @@ export const DEFAULT_CHECKIN_WINDOW_MS = 15 * 1000;
51
51
  * by omission); the strand breadth defaults to
52
52
  * {@link CadreNodeConfig.strandClusterSize} while its policy is the fixed
53
53
  * {@link STRAND_CLUSTER_POLICY}.
54
+ *
55
+ * The two `*ClusterPolicy` BUILDERS are the same objects with the block-repair
56
+ * corroboration yardstick declared from the machines enrolled in this party
57
+ * ({@link resolveRepairYardstick}); handed no count, each returns its frozen base
58
+ * constant unchanged. A network picks the derived number up when its libp2p node is
59
+ * built, which for a strand is every wake from hibernation.
54
60
  */
55
- export { MIN_CLUSTER_SIZE, CONTROL_REPLICATION_BREADTH, CONTROL_CLUSTER_POLICY, DEFAULT_STRAND_CLUSTER_SIZE, STRAND_CLUSTER_POLICY, resolveStrandClusterSize } from '@serfab/quereus-plugin-sereus';
61
+ export { MIN_CLUSTER_SIZE, CONTROL_REPLICATION_BREADTH, CONTROL_CLUSTER_POLICY, DEFAULT_STRAND_CLUSTER_SIZE, STRAND_CLUSTER_POLICY, resolveStrandClusterSize, resolveRepairYardstick, controlClusterPolicy, strandClusterPolicy } from '@serfab/quereus-plugin-sereus';
56
62
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA2EA;;;;;;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,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I,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;AA2RF;;;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.12.0",
3
+ "version": "0.13.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",
@@ -32,6 +32,10 @@
32
32
  "types": "./dist/bootstrap-peer-store-file.d.ts",
33
33
  "import": "./dist/bootstrap-peer-store-file.js"
34
34
  },
35
+ "./enrolled-machine-store-file": {
36
+ "types": "./dist/enrolled-machine-store-file.d.ts",
37
+ "import": "./dist/enrolled-machine-store-file.js"
38
+ },
35
39
  "./push-node": {
36
40
  "types": "./dist/push-node.d.ts",
37
41
  "import": "./dist/push-node.js"
@@ -64,13 +68,17 @@
64
68
  "@chainsafe/libp2p-yamux": "^8.0.1",
65
69
  "@libp2p/circuit-relay-v2": "^4.1.3",
66
70
  "@libp2p/identify": "4.0.10",
71
+ "@libp2p/logger": "^6.2.2",
72
+ "@libp2p/peer-store": "^12.0.10",
67
73
  "@libp2p/tcp": "^11.0.10",
68
74
  "@libp2p/webrtc": "6.0.14",
69
75
  "@libp2p/websockets": "^10.1.3",
70
- "@optimystic/db-p2p-storage-fs": "^0.27.0",
76
+ "@optimystic/db-p2p-storage-fs": "^1.0.0-beta.2",
71
77
  "@types/debug": "^4.1.12",
72
78
  "@types/node": "^25.0.10",
73
79
  "@vitest/coverage-v8": "^4.0.17",
80
+ "datastore-core": "^11.0.1",
81
+ "main-event": "^1.0.1",
74
82
  "rimraf": "^6.1.2",
75
83
  "typescript": "^5.9.3",
76
84
  "vitest": "^4.0.17"
@@ -80,12 +88,12 @@
80
88
  "@libp2p/interface": "^3.1.0",
81
89
  "@libp2p/peer-id": "^6.0.4",
82
90
  "@multiformats/multiaddr": "^12.5.1",
83
- "@optimystic/db-core": "^0.27.0",
84
- "@optimystic/db-p2p": "^0.27.0",
85
- "@optimystic/quereus-plugin-crypto": "^0.27.0",
86
- "@optimystic/quereus-plugin-optimystic": "^0.27.0",
87
- "@quereus/quereus": "^4.18.0",
88
- "@serfab/quereus-plugin-sereus": "^0.12.0",
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",
89
97
  "debug": "^4.4.3",
90
98
  "libp2p": "^3.1.3",
91
99
  "uint8arrays": "^5.1.0"