@serfab/cadre-core 1.9.0 → 1.11.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 (119) hide show
  1. package/dist/cadre-node.d.ts +148 -44
  2. package/dist/cadre-node.js +363 -139
  3. package/dist/cadre-node.js.map +1 -1
  4. package/dist/control-authorization.d.ts +2 -2
  5. package/dist/control-authorization.js +1 -0
  6. package/dist/control-authorization.js.map +1 -1
  7. package/dist/control-cohort.d.ts +1 -1
  8. package/dist/control-cohort.js +1 -1
  9. package/dist/control-database.d.ts +105 -14
  10. package/dist/control-database.js +242 -73
  11. package/dist/control-database.js.map +1 -1
  12. package/dist/control-formation-recorder.d.ts +6 -6
  13. package/dist/control-formation-recorder.js +7 -8
  14. package/dist/control-formation-recorder.js.map +1 -1
  15. package/dist/control-schema.d.ts +1 -1
  16. package/dist/control-schema.js +1066 -979
  17. package/dist/control-schema.js.map +1 -1
  18. package/dist/control-write-retry.d.ts +21 -15
  19. package/dist/control-write-retry.js +21 -15
  20. package/dist/control-write-retry.js.map +1 -1
  21. package/dist/diagnostics/connection-path.d.ts +1 -18
  22. package/dist/diagnostics/connection-path.js +1 -20
  23. package/dist/diagnostics/connection-path.js.map +1 -1
  24. package/dist/identity-key.d.ts +0 -30
  25. package/dist/identity-key.js +7 -40
  26. package/dist/identity-key.js.map +1 -1
  27. package/dist/index.d.ts +8 -5
  28. package/dist/index.js +12 -6
  29. package/dist/index.js.map +1 -1
  30. package/dist/invitation-bootstrap.d.ts +32 -0
  31. package/dist/invitation-bootstrap.js +30 -0
  32. package/dist/invitation-bootstrap.js.map +1 -0
  33. package/dist/link-budget.d.ts +204 -119
  34. package/dist/link-budget.js +208 -120
  35. package/dist/link-budget.js.map +1 -1
  36. package/dist/membership-connection-gater.d.ts +3 -3
  37. package/dist/membership-connection-gater.js +3 -3
  38. package/dist/peer-dial.d.ts +18 -14
  39. package/dist/peer-dial.js +18 -14
  40. package/dist/peer-dial.js.map +1 -1
  41. package/dist/peer-join-backfill.d.ts +3 -3
  42. package/dist/pending-join-runner.d.ts +186 -0
  43. package/dist/pending-join-runner.js +649 -0
  44. package/dist/pending-join-runner.js.map +1 -0
  45. package/dist/push-fanout.d.ts +1 -1
  46. package/dist/push-fanout.js +1 -1
  47. package/dist/relay-stun.d.ts +24 -0
  48. package/dist/relay-stun.js +51 -0
  49. package/dist/relay-stun.js.map +1 -0
  50. package/dist/seed-bootstrap.d.ts +2 -2
  51. package/dist/seed-bootstrap.js +5 -5
  52. package/dist/strand-addr-protocol.js +2 -2
  53. package/dist/strand-formation-deadlines.d.ts +5 -5
  54. package/dist/strand-formation-deadlines.js +5 -5
  55. package/dist/strand-formation-manager.d.ts +18 -4
  56. package/dist/strand-formation-manager.js +48 -33
  57. package/dist/strand-formation-manager.js.map +1 -1
  58. package/dist/strand-formation-protocol.d.ts +71 -14
  59. package/dist/strand-formation-protocol.js +222 -47
  60. package/dist/strand-formation-protocol.js.map +1 -1
  61. package/dist/strand-formation-rejection.d.ts +94 -0
  62. package/dist/strand-formation-rejection.js +77 -0
  63. package/dist/strand-formation-rejection.js.map +1 -0
  64. package/dist/strand-instance-manager.js +4 -1
  65. package/dist/strand-instance-manager.js.map +1 -1
  66. package/dist/strand-membership-writer.js +32 -32
  67. package/dist/strand-solicitation.d.ts +11 -3
  68. package/dist/strand-solicitation.js +9 -0
  69. package/dist/strand-solicitation.js.map +1 -1
  70. package/dist/types.d.ts +103 -17
  71. package/dist/types.js +5 -9
  72. package/dist/types.js.map +1 -1
  73. package/package.json +22 -22
  74. package/src/cadre-node.ts +8654 -8400
  75. package/src/control-authorization.ts +2 -1
  76. package/src/control-cohort.ts +128 -128
  77. package/src/control-database.ts +303 -82
  78. package/src/control-formation-recorder.ts +353 -354
  79. package/src/control-read-retry.ts +216 -216
  80. package/src/control-schema.ts +1078 -991
  81. package/src/control-write-retry.ts +567 -561
  82. package/src/diagnostics/connection-path.ts +1 -29
  83. package/src/formation-approval.ts +610 -610
  84. package/src/hibernation-manager.ts +638 -638
  85. package/src/identity-key.ts +7 -62
  86. package/src/index.ts +644 -627
  87. package/src/invitation-bootstrap.ts +40 -0
  88. package/src/joined-strand-store.ts +498 -498
  89. package/src/link-budget.ts +684 -583
  90. package/src/membership-connection-gater.ts +570 -570
  91. package/src/node-local-snapshot.ts +298 -298
  92. package/src/peer-dial.ts +315 -311
  93. package/src/peer-join-backfill.ts +710 -710
  94. package/src/pending-join-runner.ts +735 -0
  95. package/src/push-fanout.ts +1 -1
  96. package/src/relay-reservation.ts +1121 -1121
  97. package/src/relay-server.ts +98 -98
  98. package/src/relay-stun.ts +58 -0
  99. package/src/seed-bootstrap.ts +1448 -1448
  100. package/src/strand-addr-protocol.ts +547 -547
  101. package/src/strand-database.ts +287 -287
  102. package/src/strand-first-sync-gate.ts +391 -391
  103. package/src/strand-formation-deadlines.ts +227 -227
  104. package/src/strand-formation-manager.ts +725 -700
  105. package/src/strand-formation-protocol.ts +1036 -802
  106. package/src/strand-formation-rejection.ts +129 -0
  107. package/src/strand-fret-addrs.ts +145 -145
  108. package/src/strand-instance-manager.ts +1789 -1786
  109. package/src/strand-membership-writer.ts +1974 -1974
  110. package/src/strand-network-state-file.ts +40 -40
  111. package/src/strand-network-state.ts +243 -243
  112. package/src/strand-revocation-enforcer.ts +654 -654
  113. package/src/strand-solicitation.ts +532 -519
  114. package/src/strand-wake-protocol.ts +401 -401
  115. package/src/types.ts +2222 -2140
  116. package/dist/diagnostics/webrtc-turn-tracker.d.ts +0 -50
  117. package/dist/diagnostics/webrtc-turn-tracker.js +0 -196
  118. package/dist/diagnostics/webrtc-turn-tracker.js.map +0 -1
  119. package/src/diagnostics/webrtc-turn-tracker.ts +0 -222
package/src/index.ts CHANGED
@@ -1,627 +1,644 @@
1
- // Core types
2
- export * from './types.js';
3
-
4
- // Canonical JSON serialization (shared signing payload format)
5
- export { canonicalJson } from './canonical-json.js';
6
-
7
- // Main CadreNode class
8
- export { CadreNode } from './cadre-node.js';
9
-
10
- // Control database
11
- export { ControlDatabase, MissingHostStrandError, buildAuthorizationMessage, formationVouchMessage, formationConsentMessage, REAPABLE_TABLES, type ReapableTable, type ControlDatabaseConfig, type ControlTable, type RevocableTable, type FormationUsageResult, type MembershipChangeListener, type GuardedDeleteListener, type ControlWriteAbandonedListener, type RevokedRowRef } from './control-database.js';
12
-
13
- // Bounded retry for transient control-write failures (classifier + loop behind
14
- // ControlDatabase.lockedWithRetry; exported so the integration package can drive the
15
- // classifier against real engine errors)
16
- export {
17
- CONTROL_WRITE_ATTEMPTS,
18
- CONTROL_WRITE_RETRY_BUDGET_MS,
19
- SCHEMA_INIT_ATTEMPTS,
20
- SCHEMA_INIT_RETRY_POLICY,
21
- isRetriableControlWriteFailure,
22
- isRetriableSchemaInitFailure,
23
- retryControlWrite,
24
- type ControlWriteRetryOptions
25
- } from './control-write-retry.js';
26
-
27
- // Bounded retry for transient control-read failures (classifier + policy behind
28
- // ControlDatabase.readRows; the loop is shared with the write side via control-retry.ts)
29
- export {
30
- CONTROL_READ_ATTEMPTS,
31
- CONTROL_READ_RETRY_DELAYS_MS,
32
- CONTROL_READ_RETRY_BUDGET_MS,
33
- isRetriableControlReadFailure,
34
- retryControlRead,
35
- type ControlReadRetryOptions
36
- } from './control-read-retry.js';
37
-
38
- // The bounded retry loop both control policies share. Only the abandonment record leaves
39
- // this package: it is the payload of the `control:write-abandoned` node event, so an
40
- // embedding app can type a handler for it.
41
- export type {
42
- ControlRetryAbandonment,
43
- ControlRetryAbandonReason,
44
- ControlRetryAbandonListener
45
- } from './control-retry.js';
46
-
47
- // Control-plane authorization field vector (the domain/action tagging every signer shares)
48
- export { controlAuthorizationFields, type ControlDomain, type ControlAction } from './control-authorization.js';
49
-
50
- // Ed25519 key bridge (libp2p Ed25519 -> base64url keypair)
51
- export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, requireEd25519PublicKeyB64, type Ed25519KeyPair } from './ed25519-key.js';
52
-
53
- // Pluggable key store (backend-agnostic identity/owner key material seam).
54
- // Dependency-free: the interface, error, default slot id, and in-memory backend
55
- // are safe in every (RN/browser/Node) entry graph. The Node FileKeyStore is a
56
- // separate subpath module ('@serfab/cadre-core/key-store-file') so its node:fs
57
- // import never lands here.
58
- export {
59
- InMemoryKeyStore,
60
- KeyStoreAccessError,
61
- DEFAULT_IDENTITY_KEY_ID,
62
- type KeyStore,
63
- type KeyId
64
- } from './key-store.js';
65
-
66
- // The KeyStore-backed identity rule, shared with embedding apps that need the
67
- // node key BEFORE `CadreNode` exists (RN resolves it to sign its ICE-manifest
68
- // request), plus the generic "prove you hold this node key" signer built on it.
69
- export {
70
- loadOrCreateIdentityKey,
71
- peerKeySigner,
72
- type PeerKeySigner
73
- } from './identity-key.js';
74
-
75
- // Node-local trusted-owner anchor: the NON-replicated, per-party record of
76
- // out-of-band-established owner keys (the trust anchor the replicated OwnerKey
77
- // table cannot be). Cross-platform: interface + in-memory store only — the
78
- // file-backed store is the Node-only subpath
79
- // '@serfab/cadre-core/trusted-owner-store-file' (same isolation as
80
- // key-store-file) so node:fs never lands in this graph.
81
- export {
82
- MemoryTrustedOwnerStore,
83
- PersistentTrustedOwnerStore,
84
- type TrustedOwnerStore,
85
- type TrustSource
86
- } from './trusted-owner-store.js';
87
-
88
- // The one platform-specific piece of a persistent node-local store: a single
89
- // durable text slot the embedding app supplies (IndexedDB / SecureStore /
90
- // SQLite / a file). Everything else — envelope, load policy, snapshot write
91
- // chain — is cross-platform in node-local-snapshot.ts.
92
- export type { DurableSlot } from './node-local-snapshot.js';
93
-
94
- // Node-local cold-start bootstrap-peer store: the dial targets retained from an
95
- // applied seed so a node that could not connect on its first try keeps retrying
96
- // across restarts. Same cross-platform split as the trusted-owner anchor above —
97
- // interface + in-memory store here, Node-only file backend behind the subpath
98
- // '@serfab/cadre-core/bootstrap-peer-store-file'.
99
- export {
100
- MemoryBootstrapPeerStore,
101
- PersistentBootstrapPeerStore,
102
- type BootstrapPeerStore,
103
- type BootstrapPeerEntry
104
- } from './bootstrap-peer-store.js';
105
-
106
- // Node-local enrolled-machine count: the machines this party had enrolled the
107
- // last time this node looked, remembered across restarts so the CONTROL node can
108
- // declare a block-repair yardstick at bring-up — which is before the database
109
- // holding the membership rows exists. Same cross-platform split as the two
110
- // records above; Node-only file backend behind the subpath
111
- // '@serfab/cadre-core/enrolled-machine-store-file'. Its load policy deliberately
112
- // DIVERGES from theirs (an unreadable slot cold-starts rather than throwing) —
113
- // see the module comment before unifying the three.
114
- export {
115
- MemoryEnrolledMachineStore,
116
- PersistentEnrolledMachineStore,
117
- type EnrolledMachineStore
118
- } from './enrolled-machine-store.js';
119
-
120
- // Node-local record of the strands this node joined from ANOTHER party and has not yet
121
- // published party-wide, re-offered on every start as `strand:discovered`.
122
- // Cross-platform: its durable form rides the KeyStore seam above (the record carries a
123
- // closed strand's read secret), so there is no file-backed subpath.
124
- export {
125
- MemoryJoinedStrandStore,
126
- KeyStoreJoinedStrandStore,
127
- type JoinedStrandStore,
128
- type JoinedStrandRecord
129
- } from './joined-strand-store.js';
130
-
131
- // Node-local strand network state: per strand, the state Optimystic's db-p2p saves for
132
- // the strand node (its FRET routing table with each peer's signed address record), so a
133
- // restarted strand node re-imports the peers it was talking to. Same cross-platform
134
- // split as the bootstrap-peer store above — interface + in-memory + slot-backed stores
135
- // here, Node-only file backend behind '@serfab/cadre-core/strand-network-state-file'.
136
- export {
137
- MemoryStrandNetworkStateStore,
138
- PersistentStrandNetworkStateStore,
139
- strandNetworkStatePersistence,
140
- type StrandNetworkStateStore
141
- } from './strand-network-state.js';
142
- // The signed address records a running strand node's FRET table holds, as per-peer dial
143
- // addresses: what the periodic refresh re-merges into the node's address book, and a
144
- // diagnostic for "whom could this strand node redial right now?".
145
- export { strandFretPeerAddrs, type FretAddrHost, type FretPeerAddrs } from './strand-fret-addrs.js';
146
-
147
- // Storage scope keys — what `CadreNodeConfig.storage.provider` is called with. A
148
- // strand's key is its strand id; the control database's key carries the party id,
149
- // so two parties on one device never share a control store. Every key stays within
150
- // `[a-z0-9._-]` — lowercase, so distinct keys stay distinct on a case-insensitive
151
- // filesystem: the control key by lowercase hex encoding, a strand's by
152
- // `assertStrandScopeKey`, which every strand launch runs.
153
- export {
154
- controlStorageScope,
155
- isControlStorageScope,
156
- isValidStrandScopeKey,
157
- assertStrandScopeKey,
158
- InvalidStrandIdError
159
- } from './storage-scope.js';
160
-
161
- // Strand database
162
- export { StrandDatabase, type StrandDatabaseConfig } from './strand-database.js';
163
-
164
- // Strand management
165
- export {
166
- StrandWatcher,
167
- type StrandWatcherCallbacks,
168
- type StrandQueryable,
169
- type SAppIdLookup,
170
- type StrandRowWithApp
171
- } from './strand-watcher.js';
172
- export {
173
- StrandInstanceManager,
174
- type StartStrandConfig,
175
- type ResumeStrandOverrides,
176
- getStrandStoragePath,
177
- isAwaitingFirstSync,
178
- liveStrandStatus
179
- } from './strand-instance-manager.js';
180
-
181
- // The joining machine's first-sync write gate: a non-founder launch withholds its
182
- // database (status 'syncing') until the strand's Header has arrived from a peer, so a
183
- // write before the first sync can never fork the strand's tables.
184
- export {
185
- StrandAwaitingFirstSyncError,
186
- DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS,
187
- DEFAULT_STRAND_FIRST_SYNC_POLL_MS,
188
- strandHeaderHeld,
189
- appTablesReadable,
190
- strandFirstSyncComplete,
191
- type StrandFirstSyncConfig
192
- } from './strand-first-sync-gate.js';
193
-
194
- // Peer-join block catch-up (push this network's own blocks to each newly
195
- // connected peer, so a late joiner physically holds pre-join blocks). Shared
196
- // by the strand networks (ungated) and the control network (membership-gated).
197
- export {
198
- PeerJoinBackfill,
199
- DEFAULT_PEER_JOIN_BACKFILL,
200
- MAX_BLOCK_MESSAGE_BYTES,
201
- PEER_JOIN_BACKFILL_WARN_AFTER_FAILURES,
202
- type PeerJoinBackfillConfig,
203
- type PeerJoinBackfillDeps,
204
- type PeerJoinBackfillResult,
205
- type PeerJoinBackfillPushClient
206
- } from './peer-join-backfill.js';
207
-
208
- // Closed-strand revoked-peer enforcement (deny the network nodes of removed
209
- // members at the stream and connection layers, and hang up the sessions they
210
- // already hold — see the module doc for the settled deny-list design, the
211
- // teardown seam, and the fail directions).
212
- export {
213
- StrandRevocationEnforcer,
214
- createRevocationConnectionGater,
215
- readStrandRevocationRows,
216
- DEFAULT_REVOCATION_POLL_INTERVAL_MS,
217
- type StrandRevocationEnforcementConfig,
218
- type StrandRevocationEnforcerDeps,
219
- type StrandRevocationRows,
220
- type StrandMemberPeerBinding,
221
- type StrandRevocationJudge,
222
- type StrandRevocationNetwork,
223
- type RevocationRefreshScheduler
224
- } from './strand-revocation-enforcer.js';
225
-
226
- // Closed-strand membership reconciliation: the bring-up loop that finishes a
227
- // party's join on every machine — redeem the staged formation invitation, then
228
- // write the durable machine→party MemberPeer binding — without ever blocking
229
- // bring-up (see the module doc for the pass ladder and terminal states).
230
- export {
231
- StrandMembershipReconciler,
232
- IDLE_PASSES_BEFORE_ESCALATION,
233
- INITIAL_JOIN_RETRY_INTERVAL_MS,
234
- type StrandMembershipReconcilerDeps,
235
- type StrandMembershipReconciliationConfig,
236
- type PendingMembershipInviteSource
237
- } from './strand-membership-reconciler.js';
238
-
239
- // The timer seam the self-rescheduling strand bring-up loops share (first-sync gate
240
- // probe loop, membership retry ladder) — injected by tests as a hand-cranked clock.
241
- export { defaultTimeoutScheduler, type TimeoutScheduler } from './timeout-scheduler.js';
242
-
243
- // Hibernation
244
- export {
245
- HibernationManager,
246
- type HibernationCallbacks
247
- } from './hibernation-manager.js';
248
-
249
- // Arachnode (stub)
250
- export {
251
- ArachnodeStub,
252
- createArachnodeStub,
253
- type RingConfig
254
- } from './arachnode-stub.js';
255
-
256
- // Enrollment
257
- export {
258
- EnrollmentService,
259
- type MemberVerifier,
260
- type MemberRegistry
261
- } from './enrollment.js';
262
-
263
- // Strand Solicitation
264
- export {
265
- StrandSolicitationService,
266
- createDefaultFormationResponseValidator,
267
- type DisclosureValidator,
268
- type FormationUsageRecorder,
269
- type FormationUsageParams,
270
- type AuthorizedFormationUsage,
271
- type ResolvedHostStrand,
272
- type StrandProvisioner,
273
- type FormationResponseValidator,
274
- type StrandSolicitationServiceOptions
275
- } from './strand-solicitation.js';
276
-
277
- // Formation approval client: asks an invite's ValidationUrl hook whether ONE redemption
278
- // may proceed, and checks the answer against the bytes the control database will verify.
279
- export {
280
- createHttpFormationApprover,
281
- signFormationApproval,
282
- verifyFormationApproval,
283
- FormationApprovalError,
284
- type FormationApprovalRequest,
285
- type FormationVouchFields,
286
- type FormationApproval,
287
- type FormationApprover,
288
- type FormationApprovalFailure
289
- } from './formation-approval.js';
290
-
291
- // DB-backed FormationUsageRecorder (reads/writes the real CadreControl tables)
292
- export { ControlFormationUsageRecorder } from './control-formation-recorder.js';
293
-
294
- // Closed-strand member key generation (ed25519 protobuf, base64) + the
295
- // protobuf->base64url bridge that derives the founding Member/Manager key.
296
- export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-key.js';
297
-
298
- // Strand membership writer (founder bootstrap, invite issuance/consumption,
299
- // manager-admit, member-peer registration, manager rotation, sealing — the sole
300
- // manager permanently freezing admission — + shared signing primitives reused
301
- // across the flows).
302
- export {
303
- signStrandPayload,
304
- verifyStrandPayload,
305
- signStrandApproval,
306
- generateStrandStampId,
307
- bootstrapFounderMembership,
308
- PreSplitStrandIdentityError,
309
- issueInvite,
310
- consumeInvite,
311
- burnInvite,
312
- isStrandMember,
313
- cancelInvite,
314
- listOutstandingInvites,
315
- addMemberByManager,
316
- revokeMember,
317
- leaveStrand,
318
- registerMemberPeer,
319
- listMemberPeers,
320
- removeMemberPeer,
321
- addManager,
322
- admitManager,
323
- removeManager,
324
- sealStrand,
325
- isStrandSealed,
326
- StrandTransactionBusyError,
327
- STRAND_ENGINE,
328
- STRAND_ENGINE_VERSION,
329
- type FounderBootstrapParams,
330
- type IssueInviteParams,
331
- type IssuedInvite,
332
- type ConsumeInviteParams,
333
- type CancelInviteParams,
334
- type OutstandingInvite,
335
- type AddMemberByManagerParams,
336
- type RevokeMemberParams,
337
- type LeaveStrandParams,
338
- type RegisterMemberPeerParams,
339
- type RemoveOwnPeerParams,
340
- type RemoveMemberPeerByManagerParams,
341
- type RemoveMemberPeerParams,
342
- type AddManagerParams,
343
- type AdmitManagerParams,
344
- type RemoveManagerParams,
345
- type SealStrandParams,
346
- type StrandWriteOptions
347
- } from './strand-membership-writer.js';
348
-
349
- // Engine-canonical datetime helper (shared by control + strand signed-write flows
350
- // so a signed timestamp byte-matches the datetime-coerced column the CHECK sees).
351
- export { canonicalDatetime } from './canonical-datetime.js';
352
-
353
- // Strand-DB-backed EnrollmentService backing: concrete MemberRegistry +
354
- // MemberVerifier that write/read the real Strand.* membership tables.
355
- export {
356
- StrandMemberRegistry,
357
- StrandMemberVerifier,
358
- memberRegistrationPayload,
359
- type StrandAdmission
360
- } from './strand-member-registry.js';
361
-
362
- // Seed Bootstrap
363
- export {
364
- SeedBootstrapService,
365
- SEED_PROTOCOL,
366
- ed25519PublicKeyB64FromPeerId,
367
- type SeedBootstrapConfig,
368
- type SeedEventCallbacks
369
- } from './seed-bootstrap.js';
370
-
371
- // Peer Authorization (shared owner-signature digest + offline verifier)
372
- export {
373
- peerAuthorizationDigest,
374
- cadrePeerVoucherDigest,
375
- cadrePeerRemoveDigest,
376
- deviceTokenAddDigest,
377
- deviceTokenRemoveDigest,
378
- formationConsentDigest,
379
- verifyPeerAuthorization,
380
- verifyCadrePeerVoucher,
381
- verifyFormationConsent,
382
- type DeviceTokenAuthorizedRow
383
- } from './peer-authorization.js';
384
-
385
- // Strand Wake (control-network push-wake protocol)
386
- export {
387
- StrandWakeService,
388
- dialWake,
389
- WAKE_PROTOCOL,
390
- DEFAULT_WAKE_DIAL_BUDGET_MS,
391
- type StrandWakeServiceOptions,
392
- type DialWakeOptions
393
- } from './strand-wake-protocol.js';
394
-
395
- // Strand Address (control-network strand-address RPC) — wire types come via
396
- // `export * from './types.js'` (StrandAddrRequest / StrandAddrResponse / StrandAddrStatus).
397
- export {
398
- StrandAddrService,
399
- collectStrandAddrs,
400
- STRAND_ADDR_PROTOCOL,
401
- type StrandAddrServiceOptions,
402
- type StrandAddrPeer,
403
- type CollectStrandAddrsOptions,
404
- type StrandAddrOutcome,
405
- type StrandAddrCollection
406
- } from './strand-addr-protocol.js';
407
-
408
- // Peer-address record (self-published, signed, freshness-stamped CadrePeer row)
409
- export {
410
- peerRecordSignedPayload,
411
- signPeerRecord,
412
- verifyPeerRecordSignature,
413
- isPeerRecordFresh,
414
- isSignalingAddr,
415
- orderSignalingFirst,
416
- withTrailingPeerId,
417
- currentMemberTrustPolicy,
418
- DEFAULT_PEER_RECORD_MAX_AGE_MS,
419
- DEFAULT_PEER_RECORD_HEARTBEAT_MS
420
- } from './peer-record.js';
421
-
422
- // Device-token record (self-published, signed FCM/APNs push token — CadrePeer sibling)
423
- export {
424
- deviceTokenSignedPayload,
425
- signDeviceTokenRecord,
426
- verifyDeviceTokenSignature,
427
- isPushPlatform
428
- } from './device-token.js';
429
-
430
- // Strand-wake payload contract (canonical; shared by the server sender + RN receiver)
431
- export { STRAND_WAKE_TYPE, type StrandWakePayload } from './strand-wake-payload.js';
432
-
433
- // Platform push delivery — the cross-platform `PushNotifier` *contract* only.
434
- // The FCM/APNs implementations (node:http2/node:crypto) and the
435
- // `createPushNotifier` router that builds them live behind the Node-only subpath
436
- // `@serfab/cadre-core/push-node` (`push-node.ts`), never in this graph. A Node
437
- // host constructs a notifier from that subpath and injects the instance into
438
- // `CadreNodeConfig.push.notifier`. These re-exports are type-only (erased at
439
- // emit), so the RN/browser entry graph never pulls the Node modules in.
440
- export type { PushNotifier, PushMessage, PushSendResult } from './push-notifier.js';
441
-
442
- // Push-credential validation + log redaction. Dependency-free (type-only imports),
443
- // so a provisioner (cadre-host / cadre-provider) can reject a partial credential
444
- // set and produce a key-safe log view without pulling the FCM/APNs sender graph.
445
- export { validatePushCredentials, redactPushCredentials, REDACTED } from './push-credentials.js';
446
-
447
- // Server-side push-wake trigger policy + fan-out (who/when to wake). Cross-platform
448
- // clean — it imports only the PushNotifier *type*, so exporting it as a runtime
449
- // value pulls no node:http2/node:crypto edge into the RN/browser graph.
450
- export {
451
- PushFanoutService,
452
- DEFAULT_PUSH_COOLDOWN_MS,
453
- DEFAULT_PUSH_DEBOUNCE_MS,
454
- type PushFanoutOptions,
455
- type FanoutMember
456
- } from './push-fanout.js';
457
-
458
- // Control-cohort dial selection (backbone-preferential, bounded out-degree) +
459
- // the cadence/degree defaults the proactive reconcile routine reads.
460
- export {
461
- selectControlCohortDials,
462
- DEFAULT_CONTROL_COHORT_RECONCILE_MS,
463
- DEFAULT_CONTROL_COHORT_TARGET_DEGREE,
464
- type ControlCohortSelection,
465
- type ControlCohortReconcileResult
466
- } from './control-cohort.js';
467
-
468
- // Dialing one peer from several candidate addresses, each under its own time
469
- // limit, so an address that never answers cannot starve the rest.
470
- export {
471
- dialPeerAddrs,
472
- SelfRelayOnlyError,
473
- tryAddrsInTurn,
474
- directBeforeRelayed,
475
- DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS,
476
- DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS,
477
- CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS,
478
- DEFAULT_PEER_DIAL_BUDGET,
479
- type PeerDialBudget,
480
- type AddrDialer
481
- } from './peer-dial.js';
482
-
483
- // Dial and reservation budgets counted in link round trips rather than fixed milliseconds, so
484
- // one declared assumption about the link moves them all — see `NetworkConfig.linkRoundTripMs`.
485
- export {
486
- DECLARED_LINK_ROUND_TRIP_MS,
487
- RELAYED_DIAL_ROUND_TRIPS,
488
- RELAY_RESERVATION_ROUND_TRIPS,
489
- CIRCUIT_REQUEST_ROUND_TRIPS,
490
- RELAYED_REQUEST_ROUND_TRIPS,
491
- PUSH_TRANSFER_ALLOWANCE_MS,
492
- ADMISSION_DECISION_TIMEOUT_MS,
493
- resolveLinkRoundTripMs,
494
- relayedDialBudgetMs,
495
- relayReservationBudgetMs,
496
- circuitRequestBudgetMs,
497
- relayedRequestBudgetMs,
498
- peerJoinPushBudget,
499
- type PeerJoinPushBudget
500
- } from './link-budget.js';
501
-
502
- // Seed trust policy (trust anchor for incoming seeds)
503
- export {
504
- anchoredTrustPolicy,
505
- pinnedKeyTrustPolicy,
506
- tofuTrustPolicy,
507
- type SeedTrustPolicy,
508
- type SeedTrustContext,
509
- type SeedTrustDecision
510
- } from './seed-trust-policy.js';
511
-
512
- // Schema Verification
513
- export {
514
- signSchema,
515
- verifySchema,
516
- assertSchemaSignature,
517
- SchemaVerificationError
518
- } from './schema-verification.js';
519
-
520
- // Strand Formation transport (native cadre-core protocol)
521
- export {
522
- FormationListener,
523
- dialFormation,
524
- isValidResponderCreatesResult,
525
- isWellFormedMembershipInvite,
526
- sanitizeStrandAddrs,
527
- FORMATION_PROTOCOL,
528
- type FormationParty,
529
- type FormationContactMessage,
530
- type FormationResultMessage,
531
- type FormationProvisionResult,
532
- type FormationStrandInfo,
533
- type FormationDbConnectionInfo,
534
- type FormationListenerOptions,
535
- type FormationDialOptions,
536
- type FormationDialResult,
537
- type ResponderProvisionOutcome
538
- } from './strand-formation-protocol.js';
539
- export { formationDeadlines, type FormationDeadlines } from './strand-formation-deadlines.js';
540
-
541
- // Strand Formation manager (drives the native transport)
542
- export {
543
- StrandFormationManager,
544
- createStrandFormationManager,
545
- MEMBERSHIP_INVITE_TTL_MS,
546
- MEMBERSHIP_INVITE_UNAVAILABLE_REASON,
547
- HOST_STRAND_MUST_BE_RECREATED_REASON,
548
- type MembershipInviteIssuer,
549
- type StrandFormationManagerConfig,
550
- type StrandFormationManagerOptions
551
- } from './strand-formation-manager.js';
552
-
553
- // Control-network inbound connection gate (membership defense-in-depth)
554
- export {
555
- createMembershipConnectionGater,
556
- STRANGER_OPEN_PROTOCOLS,
557
- DEFAULT_ENROLLMENT_WINDOW_MS,
558
- RELAY_ADMISSION_RESERVE_DEADLINE_MS,
559
- RELAY_ADMISSION_CLOSE_TIMEOUT_MS,
560
- MAX_UNAUTHORIZED_RELAY_RESERVATIONS,
561
- UnauthorizedReservationBudget,
562
- type InboundAdmissionPolicy,
563
- type InboundConnectionVerdict
564
- } from './membership-connection-gater.js';
565
-
566
- // Thrown out of `CadreNode.start()` when a `network.relayAddrs` reservation does
567
- // not land on its first attempt — the fail-fast posture of that config field now
568
- // that the control node reserves AFTER control-database bring-up (relay-addrs.ts).
569
- // `UnbindableListenAddressError` is the same posture for the OTHER half of the listen
570
- // config: a `network.listenAddrs` entry whose transport the node will not have refuses
571
- // start instead of being silently dropped by libp2p's transport manager.
572
- //
573
- // `resolveListenAddrs` and `strandNodeAddrs` are the derivations themselves — what a
574
- // `NetworkConfig` actually turns into for the control node and for each strand node.
575
- // Exported so an embedder that hand-writes a `network` block (the React Native and web
576
- // reference apps) can assert on the resulting SHAPE rather than on its own field names,
577
- // which is the difference between a test that proves reachability and one that proves a
578
- // spelling.
579
- export {
580
- RelayReservationFailedError,
581
- UnbindableListenAddressError,
582
- RELAY_SEARCH_LISTEN_ADDR,
583
- resolveListenAddrs
584
- } from './relay-addrs.js';
585
- export { strandNodeAddrs, type StrandNodeAddrs } from './strand-network-config.js';
586
- // The circuit-relay SERVER a node runs, and with which init — one resolution shared by the
587
- // control node and every strand node. Exported alongside the listen derivations above for the
588
- // same reason: an embedder can assert on what its `network` block resolves to.
589
- export {
590
- resolveRelayServer,
591
- PARTY_RELAY_MAX_RESERVATIONS,
592
- PARTY_RELAY_RESERVATION_TTL_MS,
593
- type ResolvedRelayServer,
594
- type ResolvedRelayReservations
595
- } from './relay-server.js';
596
-
597
- // Relay reservation via the bare `/p2p-circuit` search listener — the one route
598
- // every control node takes; `network.relayAddrs` is its fail-fast posture
599
- // (see relay-reservation.ts)
600
- export {
601
- circuitMultiaddrs,
602
- superviseRelayReservation,
603
- DEFAULT_RELAY_RESERVE_TIMEOUT_MS,
604
- DEFAULT_RELAY_RESERVE_POLL_MS,
605
- DEFAULT_RELAY_CHECK_MS,
606
- DEFAULT_RELAY_MIN_BACKOFF_MS,
607
- DEFAULT_RELAY_MAX_BACKOFF_MS,
608
- type RelayReservationStatus,
609
- type RelayReservationState,
610
- type RelayReserveOptions,
611
- type RelayReservationSupervisor,
612
- type RelayReservationSupervisorOptions
613
- } from './relay-reservation.js';
614
-
615
- // Connection-path diagnostics (relayed vs direct classification + summary)
616
- export {
617
- classifyTransport,
618
- classifyConnectionPath,
619
- summarizeConnectionPaths,
620
- emptyConnectionPathSummary,
621
- DEFAULT_SETTLE_WINDOW_MS,
622
- type ConnectionPathKind,
623
- type ConnectionTransport,
624
- type ConnectionPath,
625
- type ConnectionPathSummary,
626
- type ConnectionLike
627
- } from './diagnostics/connection-path.js';
1
+ // Core types
2
+ export * from './types.js';
3
+
4
+ // Canonical JSON serialization (shared signing payload format)
5
+ export { canonicalJson } from './canonical-json.js';
6
+
7
+ // Main CadreNode class
8
+ export { CadreNode } from './cadre-node.js';
9
+
10
+ // Control database
11
+ export { ControlDatabase, MissingHostStrandError, buildAuthorizationMessage, formationVouchMessage, formationConsentMessage, REAPABLE_TABLES, type ReapableTable, type ControlDatabaseConfig, type ControlTable, type RevocableTable, type FormationUsageResult, type MembershipChangeListener, type GuardedDeleteListener, type ControlWriteAbandonedListener, type RevokedRowRef } from './control-database.js';
12
+
13
+ // Bounded retry for transient control-write failures (classifier + loop behind
14
+ // ControlDatabase.lockedWithRetry; exported so the integration package can drive the
15
+ // classifier against real engine errors)
16
+ export {
17
+ CONTROL_WRITE_ATTEMPTS,
18
+ CONTROL_WRITE_RETRY_BUDGET_MS,
19
+ SCHEMA_INIT_ATTEMPTS,
20
+ SCHEMA_INIT_RETRY_POLICY,
21
+ isRetriableControlWriteFailure,
22
+ isRetriableSchemaInitFailure,
23
+ retryControlWrite,
24
+ type ControlWriteRetryOptions
25
+ } from './control-write-retry.js';
26
+
27
+ // Bounded retry for transient control-read failures (classifier + policy behind
28
+ // ControlDatabase.readRows; the loop is shared with the write side via control-retry.ts)
29
+ export {
30
+ CONTROL_READ_ATTEMPTS,
31
+ CONTROL_READ_RETRY_DELAYS_MS,
32
+ CONTROL_READ_RETRY_BUDGET_MS,
33
+ isRetriableControlReadFailure,
34
+ retryControlRead,
35
+ type ControlReadRetryOptions
36
+ } from './control-read-retry.js';
37
+
38
+ // The bounded retry loop both control policies share. Only the abandonment record leaves
39
+ // this package: it is the payload of the `control:write-abandoned` node event, so an
40
+ // embedding app can type a handler for it.
41
+ export type {
42
+ ControlRetryAbandonment,
43
+ ControlRetryAbandonReason,
44
+ ControlRetryAbandonListener
45
+ } from './control-retry.js';
46
+
47
+ // Control-plane authorization field vector (the domain/action tagging every signer shares)
48
+ export { controlAuthorizationFields, type ControlDomain, type ControlAction } from './control-authorization.js';
49
+
50
+ // Ed25519 key bridge (libp2p Ed25519 -> base64url keypair)
51
+ export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, requireEd25519PublicKeyB64, type Ed25519KeyPair } from './ed25519-key.js';
52
+
53
+ // Pluggable key store (backend-agnostic identity/owner key material seam).
54
+ // Dependency-free: the interface, error, default slot id, and in-memory backend
55
+ // are safe in every (RN/browser/Node) entry graph. The Node FileKeyStore is a
56
+ // separate subpath module ('@serfab/cadre-core/key-store-file') so its node:fs
57
+ // import never lands here.
58
+ export {
59
+ InMemoryKeyStore,
60
+ KeyStoreAccessError,
61
+ DEFAULT_IDENTITY_KEY_ID,
62
+ type KeyStore,
63
+ type KeyId
64
+ } from './key-store.js';
65
+
66
+ // The KeyStore-backed identity rule, shared with embedding apps that need the
67
+ // node key BEFORE `CadreNode` exists.
68
+ export { loadOrCreateIdentityKey } from './identity-key.js';
69
+
70
+ // Node-local trusted-owner anchor: the NON-replicated, per-party record of
71
+ // out-of-band-established owner keys (the trust anchor the replicated OwnerKey
72
+ // table cannot be). Cross-platform: interface + in-memory store only — the
73
+ // file-backed store is the Node-only subpath
74
+ // '@serfab/cadre-core/trusted-owner-store-file' (same isolation as
75
+ // key-store-file) so node:fs never lands in this graph.
76
+ export {
77
+ MemoryTrustedOwnerStore,
78
+ PersistentTrustedOwnerStore,
79
+ type TrustedOwnerStore,
80
+ type TrustSource
81
+ } from './trusted-owner-store.js';
82
+
83
+ // The one platform-specific piece of a persistent node-local store: a single
84
+ // durable text slot the embedding app supplies (IndexedDB / SecureStore /
85
+ // SQLite / a file). Everything else — envelope, load policy, snapshot write
86
+ // chain — is cross-platform in node-local-snapshot.ts.
87
+ export type { DurableSlot } from './node-local-snapshot.js';
88
+
89
+ // Node-local cold-start bootstrap-peer store: the dial targets retained from an
90
+ // applied seed so a node that could not connect on its first try keeps retrying
91
+ // across restarts. Same cross-platform split as the trusted-owner anchor above —
92
+ // interface + in-memory store here, Node-only file backend behind the subpath
93
+ // '@serfab/cadre-core/bootstrap-peer-store-file'.
94
+ export {
95
+ MemoryBootstrapPeerStore,
96
+ PersistentBootstrapPeerStore,
97
+ type BootstrapPeerStore,
98
+ type BootstrapPeerEntry
99
+ } from './bootstrap-peer-store.js';
100
+
101
+ // Node-local enrolled-machine count: the machines this party had enrolled the
102
+ // last time this node looked, remembered across restarts so the CONTROL node can
103
+ // declare a block-repair yardstick at bring-up — which is before the database
104
+ // holding the membership rows exists. Same cross-platform split as the two
105
+ // records above; Node-only file backend behind the subpath
106
+ // '@serfab/cadre-core/enrolled-machine-store-file'. Its load policy deliberately
107
+ // DIVERGES from theirs (an unreadable slot cold-starts rather than throwing) —
108
+ // see the module comment before unifying the three.
109
+ export {
110
+ MemoryEnrolledMachineStore,
111
+ PersistentEnrolledMachineStore,
112
+ type EnrolledMachineStore
113
+ } from './enrolled-machine-store.js';
114
+
115
+ // Node-local record of the strands this node joined from ANOTHER party and has not yet
116
+ // published party-wide, re-offered on every start as `strand:discovered`.
117
+ // Cross-platform: its durable form rides the KeyStore seam above (the record carries a
118
+ // closed strand's read secret), so there is no file-backed subpath.
119
+ export {
120
+ MemoryJoinedStrandStore,
121
+ KeyStoreJoinedStrandStore,
122
+ type JoinedStrandStore,
123
+ type JoinedStrandRecord
124
+ } from './joined-strand-store.js';
125
+
126
+ // Node-local strand network state: per strand, the state Optimystic's db-p2p saves for
127
+ // the strand node (its FRET routing table with each peer's signed address record), so a
128
+ // restarted strand node re-imports the peers it was talking to. Same cross-platform
129
+ // split as the bootstrap-peer store above — interface + in-memory + slot-backed stores
130
+ // here, Node-only file backend behind '@serfab/cadre-core/strand-network-state-file'.
131
+ export {
132
+ MemoryStrandNetworkStateStore,
133
+ PersistentStrandNetworkStateStore,
134
+ strandNetworkStatePersistence,
135
+ type StrandNetworkStateStore
136
+ } from './strand-network-state.js';
137
+ // The signed address records a running strand node's FRET table holds, as per-peer dial
138
+ // addresses: what the periodic refresh re-merges into the node's address book, and a
139
+ // diagnostic for "whom could this strand node redial right now?".
140
+ export { strandFretPeerAddrs, type FretAddrHost, type FretPeerAddrs } from './strand-fret-addrs.js';
141
+
142
+ // Storage scope keys — what `CadreNodeConfig.storage.provider` is called with. A
143
+ // strand's key is its strand id; the control database's key carries the party id,
144
+ // so two parties on one device never share a control store. Every key stays within
145
+ // `[a-z0-9._-]` — lowercase, so distinct keys stay distinct on a case-insensitive
146
+ // filesystem: the control key by lowercase hex encoding, a strand's by
147
+ // `assertStrandScopeKey`, which every strand launch runs.
148
+ export {
149
+ controlStorageScope,
150
+ isControlStorageScope,
151
+ isValidStrandScopeKey,
152
+ assertStrandScopeKey,
153
+ InvalidStrandIdError
154
+ } from './storage-scope.js';
155
+
156
+ // Strand database
157
+ export { StrandDatabase, type StrandDatabaseConfig } from './strand-database.js';
158
+
159
+ // Strand management
160
+ export {
161
+ StrandWatcher,
162
+ type StrandWatcherCallbacks,
163
+ type StrandQueryable,
164
+ type SAppIdLookup,
165
+ type StrandRowWithApp
166
+ } from './strand-watcher.js';
167
+ export {
168
+ StrandInstanceManager,
169
+ type StartStrandConfig,
170
+ type ResumeStrandOverrides,
171
+ getStrandStoragePath,
172
+ isAwaitingFirstSync,
173
+ liveStrandStatus
174
+ } from './strand-instance-manager.js';
175
+
176
+ // The joining machine's first-sync write gate: a non-founder launch withholds its
177
+ // database (status 'syncing') until the strand's Header has arrived from a peer, so a
178
+ // write before the first sync can never fork the strand's tables.
179
+ export {
180
+ StrandAwaitingFirstSyncError,
181
+ DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS,
182
+ DEFAULT_STRAND_FIRST_SYNC_POLL_MS,
183
+ strandHeaderHeld,
184
+ appTablesReadable,
185
+ strandFirstSyncComplete,
186
+ type StrandFirstSyncConfig
187
+ } from './strand-first-sync-gate.js';
188
+
189
+ // Peer-join block catch-up (push this network's own blocks to each newly
190
+ // connected peer, so a late joiner physically holds pre-join blocks). Shared
191
+ // by the strand networks (ungated) and the control network (membership-gated).
192
+ export {
193
+ PeerJoinBackfill,
194
+ DEFAULT_PEER_JOIN_BACKFILL,
195
+ MAX_BLOCK_MESSAGE_BYTES,
196
+ PEER_JOIN_BACKFILL_WARN_AFTER_FAILURES,
197
+ type PeerJoinBackfillConfig,
198
+ type PeerJoinBackfillDeps,
199
+ type PeerJoinBackfillResult,
200
+ type PeerJoinBackfillPushClient
201
+ } from './peer-join-backfill.js';
202
+
203
+ // Closed-strand revoked-peer enforcement (deny the network nodes of removed
204
+ // members at the stream and connection layers, and hang up the sessions they
205
+ // already hold — see the module doc for the settled deny-list design, the
206
+ // teardown seam, and the fail directions).
207
+ export {
208
+ StrandRevocationEnforcer,
209
+ createRevocationConnectionGater,
210
+ readStrandRevocationRows,
211
+ DEFAULT_REVOCATION_POLL_INTERVAL_MS,
212
+ type StrandRevocationEnforcementConfig,
213
+ type StrandRevocationEnforcerDeps,
214
+ type StrandRevocationRows,
215
+ type StrandMemberPeerBinding,
216
+ type StrandRevocationJudge,
217
+ type StrandRevocationNetwork,
218
+ type RevocationRefreshScheduler
219
+ } from './strand-revocation-enforcer.js';
220
+
221
+ // Closed-strand membership reconciliation: the bring-up loop that finishes a
222
+ // party's join on every machine — redeem the staged formation invitation, then
223
+ // write the durable machine→party MemberPeer binding — without ever blocking
224
+ // bring-up (see the module doc for the pass ladder and terminal states).
225
+ export {
226
+ StrandMembershipReconciler,
227
+ IDLE_PASSES_BEFORE_ESCALATION,
228
+ INITIAL_JOIN_RETRY_INTERVAL_MS,
229
+ type StrandMembershipReconcilerDeps,
230
+ type StrandMembershipReconciliationConfig,
231
+ type PendingMembershipInviteSource
232
+ } from './strand-membership-reconciler.js';
233
+
234
+ // The timer seam the self-rescheduling strand bring-up loops share (first-sync gate
235
+ // probe loop, membership retry ladder) — injected by tests as a hand-cranked clock.
236
+ export { defaultTimeoutScheduler, type TimeoutScheduler } from './timeout-scheduler.js';
237
+
238
+ // Hibernation
239
+ export {
240
+ HibernationManager,
241
+ type HibernationCallbacks
242
+ } from './hibernation-manager.js';
243
+
244
+ // Arachnode (stub)
245
+ export {
246
+ ArachnodeStub,
247
+ createArachnodeStub,
248
+ type RingConfig
249
+ } from './arachnode-stub.js';
250
+
251
+ // Enrollment
252
+ export {
253
+ EnrollmentService,
254
+ type MemberVerifier,
255
+ type MemberRegistry
256
+ } from './enrollment.js';
257
+
258
+ // Strand Solicitation
259
+ export {
260
+ StrandSolicitationService,
261
+ createDefaultFormationResponseValidator,
262
+ type DisclosureValidator,
263
+ type FormationUsageRecorder,
264
+ type FormationUsageParams,
265
+ type AuthorizedFormationUsage,
266
+ type ResolvedHostStrand,
267
+ type StrandProvisioner,
268
+ type FormationResponseValidator,
269
+ type StrandSolicitationServiceOptions
270
+ } from './strand-solicitation.js';
271
+
272
+ // Formation approval client: asks an invite's ValidationUrl hook whether ONE redemption
273
+ // may proceed, and checks the answer against the bytes the control database will verify.
274
+ export {
275
+ createHttpFormationApprover,
276
+ signFormationApproval,
277
+ verifyFormationApproval,
278
+ FormationApprovalError,
279
+ type FormationApprovalRequest,
280
+ type FormationVouchFields,
281
+ type FormationApproval,
282
+ type FormationApprover,
283
+ type FormationApprovalFailure
284
+ } from './formation-approval.js';
285
+
286
+ // DB-backed FormationUsageRecorder (reads/writes the real CadreControl tables)
287
+ export { ControlFormationUsageRecorder } from './control-formation-recorder.js';
288
+
289
+ // Closed-strand member key generation (ed25519 protobuf, base64) + the
290
+ // protobuf->base64url bridge that derives the founding Member/Manager key.
291
+ export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-key.js';
292
+
293
+ // Strand membership writer (founder bootstrap, invite issuance/consumption,
294
+ // manager-admit, member-peer registration, manager rotation, sealing — the sole
295
+ // manager permanently freezing admission — + shared signing primitives reused
296
+ // across the flows).
297
+ export {
298
+ signStrandPayload,
299
+ verifyStrandPayload,
300
+ signStrandApproval,
301
+ generateStrandStampId,
302
+ bootstrapFounderMembership,
303
+ PreSplitStrandIdentityError,
304
+ issueInvite,
305
+ consumeInvite,
306
+ burnInvite,
307
+ isStrandMember,
308
+ cancelInvite,
309
+ listOutstandingInvites,
310
+ addMemberByManager,
311
+ revokeMember,
312
+ leaveStrand,
313
+ registerMemberPeer,
314
+ listMemberPeers,
315
+ removeMemberPeer,
316
+ addManager,
317
+ admitManager,
318
+ removeManager,
319
+ sealStrand,
320
+ isStrandSealed,
321
+ StrandTransactionBusyError,
322
+ STRAND_ENGINE,
323
+ STRAND_ENGINE_VERSION,
324
+ type FounderBootstrapParams,
325
+ type IssueInviteParams,
326
+ type IssuedInvite,
327
+ type ConsumeInviteParams,
328
+ type CancelInviteParams,
329
+ type OutstandingInvite,
330
+ type AddMemberByManagerParams,
331
+ type RevokeMemberParams,
332
+ type LeaveStrandParams,
333
+ type RegisterMemberPeerParams,
334
+ type RemoveOwnPeerParams,
335
+ type RemoveMemberPeerByManagerParams,
336
+ type RemoveMemberPeerParams,
337
+ type AddManagerParams,
338
+ type AdmitManagerParams,
339
+ type RemoveManagerParams,
340
+ type SealStrandParams,
341
+ type StrandWriteOptions
342
+ } from './strand-membership-writer.js';
343
+
344
+ // Engine-canonical datetime helper (shared by control + strand signed-write flows
345
+ // so a signed timestamp byte-matches the datetime-coerced column the CHECK sees).
346
+ export { canonicalDatetime } from './canonical-datetime.js';
347
+
348
+ // Strand-DB-backed EnrollmentService backing: concrete MemberRegistry +
349
+ // MemberVerifier that write/read the real Strand.* membership tables.
350
+ export {
351
+ StrandMemberRegistry,
352
+ StrandMemberVerifier,
353
+ memberRegistrationPayload,
354
+ type StrandAdmission
355
+ } from './strand-member-registry.js';
356
+
357
+ // Seed Bootstrap
358
+ export {
359
+ SeedBootstrapService,
360
+ SEED_PROTOCOL,
361
+ ed25519PublicKeyB64FromPeerId,
362
+ type SeedBootstrapConfig,
363
+ type SeedEventCallbacks
364
+ } from './seed-bootstrap.js';
365
+
366
+ // Peer Authorization (shared owner-signature digest + offline verifier)
367
+ export {
368
+ peerAuthorizationDigest,
369
+ cadrePeerVoucherDigest,
370
+ cadrePeerRemoveDigest,
371
+ deviceTokenAddDigest,
372
+ deviceTokenRemoveDigest,
373
+ formationConsentDigest,
374
+ verifyPeerAuthorization,
375
+ verifyCadrePeerVoucher,
376
+ verifyFormationConsent,
377
+ type DeviceTokenAuthorizedRow
378
+ } from './peer-authorization.js';
379
+
380
+ // Strand Wake (control-network push-wake protocol)
381
+ export {
382
+ StrandWakeService,
383
+ dialWake,
384
+ WAKE_PROTOCOL,
385
+ DEFAULT_WAKE_DIAL_BUDGET_MS,
386
+ type StrandWakeServiceOptions,
387
+ type DialWakeOptions
388
+ } from './strand-wake-protocol.js';
389
+
390
+ // Strand Address (control-network strand-address RPC) — wire types come via
391
+ // `export * from './types.js'` (StrandAddrRequest / StrandAddrResponse / StrandAddrStatus).
392
+ export {
393
+ StrandAddrService,
394
+ collectStrandAddrs,
395
+ STRAND_ADDR_PROTOCOL,
396
+ type StrandAddrServiceOptions,
397
+ type StrandAddrPeer,
398
+ type CollectStrandAddrsOptions,
399
+ type StrandAddrOutcome,
400
+ type StrandAddrCollection
401
+ } from './strand-addr-protocol.js';
402
+
403
+ // Peer-address record (self-published, signed, freshness-stamped CadrePeer row)
404
+ export {
405
+ peerRecordSignedPayload,
406
+ signPeerRecord,
407
+ verifyPeerRecordSignature,
408
+ isPeerRecordFresh,
409
+ isSignalingAddr,
410
+ orderSignalingFirst,
411
+ withTrailingPeerId,
412
+ currentMemberTrustPolicy,
413
+ DEFAULT_PEER_RECORD_MAX_AGE_MS,
414
+ DEFAULT_PEER_RECORD_HEARTBEAT_MS
415
+ } from './peer-record.js';
416
+
417
+ // Device-token record (self-published, signed FCM/APNs push token — CadrePeer sibling)
418
+ export {
419
+ deviceTokenSignedPayload,
420
+ signDeviceTokenRecord,
421
+ verifyDeviceTokenSignature,
422
+ isPushPlatform
423
+ } from './device-token.js';
424
+
425
+ // Strand-wake payload contract (canonical; shared by the server sender + RN receiver)
426
+ export { STRAND_WAKE_TYPE, type StrandWakePayload } from './strand-wake-payload.js';
427
+
428
+ // Platform push delivery — the cross-platform `PushNotifier` *contract* only.
429
+ // The FCM/APNs implementations (node:http2/node:crypto) and the
430
+ // `createPushNotifier` router that builds them live behind the Node-only subpath
431
+ // `@serfab/cadre-core/push-node` (`push-node.ts`), never in this graph. A Node
432
+ // host constructs a notifier from that subpath and injects the instance into
433
+ // `CadreNodeConfig.push.notifier`. These re-exports are type-only (erased at
434
+ // emit), so the RN/browser entry graph never pulls the Node modules in.
435
+ export type { PushNotifier, PushMessage, PushSendResult } from './push-notifier.js';
436
+
437
+ // Push-credential validation + log redaction. Dependency-free (type-only imports),
438
+ // so a provisioner (cadre-host / cadre-provider) can reject a partial credential
439
+ // set and produce a key-safe log view without pulling the FCM/APNs sender graph.
440
+ export { validatePushCredentials, redactPushCredentials, REDACTED } from './push-credentials.js';
441
+
442
+ // Server-side push-wake trigger policy + fan-out (who/when to wake). Cross-platform
443
+ // clean — it imports only the PushNotifier *type*, so exporting it as a runtime
444
+ // value pulls no node:http2/node:crypto edge into the RN/browser graph.
445
+ export {
446
+ PushFanoutService,
447
+ DEFAULT_PUSH_COOLDOWN_MS,
448
+ DEFAULT_PUSH_DEBOUNCE_MS,
449
+ type PushFanoutOptions,
450
+ type FanoutMember
451
+ } from './push-fanout.js';
452
+
453
+ // Control-cohort dial selection (backbone-preferential, bounded out-degree) +
454
+ // the cadence/degree defaults the proactive reconcile routine reads.
455
+ export {
456
+ selectControlCohortDials,
457
+ DEFAULT_CONTROL_COHORT_RECONCILE_MS,
458
+ DEFAULT_CONTROL_COHORT_TARGET_DEGREE,
459
+ type ControlCohortSelection,
460
+ type ControlCohortReconcileResult
461
+ } from './control-cohort.js';
462
+
463
+ // Dialing one peer from several candidate addresses, each under its own time
464
+ // limit, so an address that never answers cannot starve the rest.
465
+ export {
466
+ dialPeerAddrs,
467
+ SelfRelayOnlyError,
468
+ tryAddrsInTurn,
469
+ directBeforeRelayed,
470
+ DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS,
471
+ DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS,
472
+ CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS,
473
+ DEFAULT_PEER_DIAL_BUDGET,
474
+ type PeerDialBudget,
475
+ type AddrDialer
476
+ } from './peer-dial.js';
477
+
478
+ // Dial and reservation budgets counted in link round trips rather than fixed milliseconds, so
479
+ // one declared assumption about the link moves them all — see `NetworkConfig.linkRoundTripMs`.
480
+ export {
481
+ DECLARED_LINK_ROUND_TRIP_MS,
482
+ CIRCUIT_DIAL_ROUND_TRIPS,
483
+ RELAY_DIAL_ROUND_TRIPS,
484
+ RELAYED_DIAL_ROUND_TRIPS,
485
+ RELAY_RESERVATION_ROUND_TRIPS,
486
+ CIRCUIT_REQUEST_ROUND_TRIPS,
487
+ RELAYED_REQUEST_ROUND_TRIPS,
488
+ PUSH_TRANSFER_ALLOWANCE_MS,
489
+ ADMISSION_DECISION_TIMEOUT_MS,
490
+ resolveLinkRoundTripMs,
491
+ relayedDialBudgetMs,
492
+ relayReservationBudgetMs,
493
+ circuitRequestBudgetMs,
494
+ relayedRequestBudgetMs,
495
+ peerJoinPushBudget,
496
+ type PeerJoinPushBudget,
497
+ DIAL_ADMISSION_DECISIONS,
498
+ optimysticDialLimits,
499
+ type OptimysticDialLimits
500
+ } from './link-budget.js';
501
+
502
+ // Seed trust policy (trust anchor for incoming seeds)
503
+ export {
504
+ anchoredTrustPolicy,
505
+ pinnedKeyTrustPolicy,
506
+ tofuTrustPolicy,
507
+ type SeedTrustPolicy,
508
+ type SeedTrustContext,
509
+ type SeedTrustDecision
510
+ } from './seed-trust-policy.js';
511
+
512
+ // Schema Verification
513
+ export {
514
+ signSchema,
515
+ verifySchema,
516
+ assertSchemaSignature,
517
+ SchemaVerificationError
518
+ } from './schema-verification.js';
519
+
520
+ // Strand Formation transport (native cadre-core protocol)
521
+ export {
522
+ FormationListener,
523
+ dialFormation,
524
+ dialFormationByMachine,
525
+ isValidResponderCreatesResult,
526
+ isWellFormedMembershipInvite,
527
+ sanitizeStrandAddrs,
528
+ FORMATION_PROTOCOL,
529
+ type FormationParty,
530
+ type FormationContactMessage,
531
+ type FormationResultMessage,
532
+ type FormationProvisionResult,
533
+ type FormationStrandInfo,
534
+ type FormationDbConnectionInfo,
535
+ type FormationListenerOptions,
536
+ type FormationDialOptions,
537
+ type FormationDialResult,
538
+ type FormationRejection,
539
+ type FormationTokenCheck,
540
+ type ResponderProvisionOutcome
541
+ } from './strand-formation-protocol.js';
542
+ // How a formation dial fails: a typed refusal (with a fixed code) or no answer at all
543
+ export {
544
+ FormationRejectedError,
545
+ FormationUnreachableError,
546
+ FormationPostApprovalError,
547
+ FORMATION_REJECTION_RETRYABLE,
548
+ isFormationRejectionCode,
549
+ type FormationRejectionCode
550
+ } from './strand-formation-rejection.js';
551
+ export { formationDeadlines, type FormationDeadlines } from './strand-formation-deadlines.js';
552
+ // The pending-join retry loop behind CadreNode.requestJoin (PendingJoinStatus is in types.ts)
553
+ export { PENDING_JOIN_POLL_MS, PENDING_JOIN_MAX_BACKOFF_MS, MAX_PENDING_JOIN_MS } from './pending-join-runner.js';
554
+
555
+ // Strand Formation manager (drives the native transport)
556
+ export {
557
+ StrandFormationManager,
558
+ createStrandFormationManager,
559
+ MEMBERSHIP_INVITE_TTL_MS,
560
+ MEMBERSHIP_INVITE_UNAVAILABLE_REASON,
561
+ HOST_STRAND_MUST_BE_RECREATED_REASON,
562
+ type CadrePeerAddrsSource,
563
+ type MembershipInviteIssuer,
564
+ type StrandFormationManagerConfig,
565
+ type StrandFormationManagerOptions
566
+ } from './strand-formation-manager.js';
567
+
568
+ // Control-network inbound connection gate (membership defense-in-depth)
569
+ export {
570
+ createMembershipConnectionGater,
571
+ STRANGER_OPEN_PROTOCOLS,
572
+ DEFAULT_ENROLLMENT_WINDOW_MS,
573
+ RELAY_ADMISSION_RESERVE_DEADLINE_MS,
574
+ RELAY_ADMISSION_CLOSE_TIMEOUT_MS,
575
+ MAX_UNAUTHORIZED_RELAY_RESERVATIONS,
576
+ UnauthorizedReservationBudget,
577
+ type InboundAdmissionPolicy,
578
+ type InboundConnectionVerdict
579
+ } from './membership-connection-gater.js';
580
+
581
+ // Thrown out of `CadreNode.start()` when a `network.relayAddrs` reservation does
582
+ // not land on its first attempt — the fail-fast posture of that config field now
583
+ // that the control node reserves AFTER control-database bring-up (relay-addrs.ts).
584
+ // `UnbindableListenAddressError` is the same posture for the OTHER half of the listen
585
+ // config: a `network.listenAddrs` entry whose transport the node will not have refuses
586
+ // start instead of being silently dropped by libp2p's transport manager.
587
+ //
588
+ // `resolveListenAddrs` and `strandNodeAddrs` are the derivations themselves — what a
589
+ // `NetworkConfig` actually turns into for the control node and for each strand node.
590
+ // Exported so an embedder that hand-writes a `network` block (the React Native and web
591
+ // reference apps) can assert on the resulting SHAPE rather than on its own field names,
592
+ // which is the difference between a test that proves reachability and one that proves a
593
+ // spelling.
594
+ export {
595
+ RelayReservationFailedError,
596
+ UnbindableListenAddressError,
597
+ RELAY_SEARCH_LISTEN_ADDR,
598
+ resolveListenAddrs
599
+ } from './relay-addrs.js';
600
+ export { strandNodeAddrs, type StrandNodeAddrs } from './strand-network-config.js';
601
+ // STUN for an embedder's WebRTC transport, derived from the relays it already uses: each
602
+ // Sereus relay also answers STUN (`ops/docs/ice-servers.md`).
603
+ export { RELAY_STUN_PORT, relayStunUrl, resolveStunServers, type StunServer } from './relay-stun.js';
604
+ // The circuit-relay SERVER a node runs, and with which init — one resolution shared by the
605
+ // control node and every strand node. Exported alongside the listen derivations above for the
606
+ // same reason: an embedder can assert on what its `network` block resolves to.
607
+ export {
608
+ resolveRelayServer,
609
+ PARTY_RELAY_MAX_RESERVATIONS,
610
+ PARTY_RELAY_RESERVATION_TTL_MS,
611
+ type ResolvedRelayServer,
612
+ type ResolvedRelayReservations
613
+ } from './relay-server.js';
614
+
615
+ // Relay reservation via the bare `/p2p-circuit` search listener — the one route
616
+ // every control node takes; `network.relayAddrs` is its fail-fast posture
617
+ // (see relay-reservation.ts)
618
+ export {
619
+ circuitMultiaddrs,
620
+ superviseRelayReservation,
621
+ DEFAULT_RELAY_RESERVE_TIMEOUT_MS,
622
+ DEFAULT_RELAY_RESERVE_POLL_MS,
623
+ DEFAULT_RELAY_CHECK_MS,
624
+ DEFAULT_RELAY_MIN_BACKOFF_MS,
625
+ DEFAULT_RELAY_MAX_BACKOFF_MS,
626
+ type RelayReservationStatus,
627
+ type RelayReservationState,
628
+ type RelayReserveOptions,
629
+ type RelayReservationSupervisor,
630
+ type RelayReservationSupervisorOptions
631
+ } from './relay-reservation.js';
632
+
633
+ // Connection-path diagnostics (relayed vs direct classification + summary)
634
+ export {
635
+ classifyTransport,
636
+ summarizeConnectionPaths,
637
+ emptyConnectionPathSummary,
638
+ DEFAULT_SETTLE_WINDOW_MS,
639
+ type ConnectionPathKind,
640
+ type ConnectionTransport,
641
+ type ConnectionPath,
642
+ type ConnectionPathSummary,
643
+ type ConnectionLike
644
+ } from './diagnostics/connection-path.js';