@serfab/cadre-core 1.4.0 → 1.6.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 (63) hide show
  1. package/dist/cadre-node.d.ts +38 -15
  2. package/dist/cadre-node.js +81 -29
  3. package/dist/cadre-node.js.map +1 -1
  4. package/dist/control-database.d.ts +24 -10
  5. package/dist/control-database.js +48 -16
  6. package/dist/control-database.js.map +1 -1
  7. package/dist/control-read-retry.d.ts +12 -0
  8. package/dist/control-read-retry.js +12 -0
  9. package/dist/control-read-retry.js.map +1 -1
  10. package/dist/control-write-retry.d.ts +5 -4
  11. package/dist/control-write-retry.js +24 -7
  12. package/dist/control-write-retry.js.map +1 -1
  13. package/dist/index.d.ts +3 -2
  14. package/dist/index.js +5 -2
  15. package/dist/index.js.map +1 -1
  16. package/dist/link-budget.d.ts +224 -0
  17. package/dist/link-budget.js +239 -0
  18. package/dist/link-budget.js.map +1 -0
  19. package/dist/peer-dial.d.ts +36 -17
  20. package/dist/peer-dial.js +37 -17
  21. package/dist/peer-dial.js.map +1 -1
  22. package/dist/peer-join-backfill.d.ts +58 -4
  23. package/dist/peer-join-backfill.js +166 -20
  24. package/dist/peer-join-backfill.js.map +1 -1
  25. package/dist/relay-reservation.d.ts +59 -11
  26. package/dist/relay-reservation.js +169 -43
  27. package/dist/relay-reservation.js.map +1 -1
  28. package/dist/seed-bootstrap.js +2 -1
  29. package/dist/seed-bootstrap.js.map +1 -1
  30. package/dist/strand-first-sync-gate.d.ts +105 -22
  31. package/dist/strand-first-sync-gate.js +121 -27
  32. package/dist/strand-first-sync-gate.js.map +1 -1
  33. package/dist/strand-instance-manager.d.ts +27 -2
  34. package/dist/strand-instance-manager.js +60 -13
  35. package/dist/strand-instance-manager.js.map +1 -1
  36. package/dist/strand-membership-reconciler.d.ts +200 -45
  37. package/dist/strand-membership-reconciler.js +302 -86
  38. package/dist/strand-membership-reconciler.js.map +1 -1
  39. package/dist/strand-membership-writer.d.ts +3 -2
  40. package/dist/strand-membership-writer.js +67 -90
  41. package/dist/strand-membership-writer.js.map +1 -1
  42. package/dist/strand-network-config.d.ts +2 -2
  43. package/dist/strand-network-config.js +2 -2
  44. package/dist/types.d.ts +105 -9
  45. package/dist/types.js +20 -4
  46. package/dist/types.js.map +1 -1
  47. package/package.json +8 -8
  48. package/src/cadre-node.ts +7449 -7397
  49. package/src/control-database.ts +48 -16
  50. package/src/control-read-retry.ts +214 -202
  51. package/src/control-write-retry.ts +24 -7
  52. package/src/index.ts +582 -563
  53. package/src/link-budget.ts +264 -0
  54. package/src/peer-dial.ts +39 -17
  55. package/src/peer-join-backfill.ts +648 -478
  56. package/src/relay-reservation.ts +1119 -951
  57. package/src/seed-bootstrap.ts +2 -1
  58. package/src/strand-first-sync-gate.ts +352 -258
  59. package/src/strand-instance-manager.ts +1520 -1458
  60. package/src/strand-membership-reconciler.ts +334 -92
  61. package/src/strand-membership-writer.ts +1962 -1987
  62. package/src/strand-network-config.ts +2 -2
  63. package/src/types.ts +104 -8
package/src/index.ts CHANGED
@@ -1,563 +1,582 @@
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
- // Storage scope keys — what `CadreNodeConfig.storage.provider` is called with. A
121
- // strand's key is its strand id; the control database's key carries the party id,
122
- // so two parties on one device never share a control store. Every key stays within
123
- // `[A-Za-z0-9._-]`: the control key by base64url encoding, a strand's by
124
- // `assertStrandScopeKey`, which every strand launch runs.
125
- export {
126
- controlStorageScope,
127
- isControlStorageScope,
128
- isValidStrandScopeKey,
129
- assertStrandScopeKey,
130
- InvalidStrandIdError
131
- } from './storage-scope.js';
132
-
133
- // Strand database
134
- export { StrandDatabase, type StrandDatabaseConfig } from './strand-database.js';
135
-
136
- // Strand management
137
- export {
138
- StrandWatcher,
139
- type StrandWatcherCallbacks,
140
- type StrandQueryable,
141
- type SAppIdLookup,
142
- type StrandRowWithApp
143
- } from './strand-watcher.js';
144
- export {
145
- StrandInstanceManager,
146
- type StartStrandConfig,
147
- type ResumeStrandOverrides,
148
- getStrandStoragePath,
149
- isAwaitingFirstSync,
150
- liveStrandStatus
151
- } from './strand-instance-manager.js';
152
-
153
- // The joining machine's first-sync write gate: a non-founder launch withholds its
154
- // database (status 'syncing') until the strand's Header has arrived from a peer, so a
155
- // write before the first sync can never fork the strand's tables.
156
- export {
157
- StrandAwaitingFirstSyncError,
158
- DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS,
159
- DEFAULT_STRAND_FIRST_SYNC_POLL_MS,
160
- strandHeaderHeld,
161
- appTablesReadable,
162
- strandFirstSyncComplete,
163
- type StrandFirstSyncConfig
164
- } from './strand-first-sync-gate.js';
165
-
166
- // Peer-join block catch-up (push this network's own blocks to each newly
167
- // connected peer, so a late joiner physically holds pre-join blocks). Shared
168
- // by the strand networks (ungated) and the control network (membership-gated).
169
- export {
170
- PeerJoinBackfill,
171
- DEFAULT_PEER_JOIN_BACKFILL,
172
- MAX_BLOCK_MESSAGE_BYTES,
173
- type PeerJoinBackfillConfig,
174
- type PeerJoinBackfillDeps,
175
- type PeerJoinBackfillResult,
176
- type PeerJoinBackfillPushClient
177
- } from './peer-join-backfill.js';
178
-
179
- // Closed-strand revoked-peer enforcement (deny the network nodes of removed
180
- // members at the stream and connection layers, and hang up the sessions they
181
- // already hold — see the module doc for the settled deny-list design, the
182
- // teardown seam, and the fail directions).
183
- export {
184
- StrandRevocationEnforcer,
185
- createRevocationConnectionGater,
186
- readStrandRevocationRows,
187
- DEFAULT_REVOCATION_POLL_INTERVAL_MS,
188
- type StrandRevocationEnforcementConfig,
189
- type StrandRevocationEnforcerDeps,
190
- type StrandRevocationRows,
191
- type StrandMemberPeerBinding,
192
- type StrandRevocationJudge,
193
- type StrandRevocationNetwork,
194
- type RevocationRefreshScheduler
195
- } from './strand-revocation-enforcer.js';
196
-
197
- // Closed-strand membership reconciliation: the bring-up loop that finishes a
198
- // party's join on every machine — redeem the staged formation invitation, then
199
- // write the durable machine→party MemberPeer binding — without ever blocking
200
- // bring-up (see the module doc for the pass ladder and terminal states).
201
- export {
202
- StrandMembershipReconciler,
203
- IDLE_PASSES_BEFORE_ESCALATION,
204
- INITIAL_JOIN_RETRY_INTERVAL_MS,
205
- type StrandMembershipReconcilerDeps,
206
- type StrandMembershipReconciliationConfig,
207
- type PendingMembershipInviteSource
208
- } from './strand-membership-reconciler.js';
209
-
210
- // The timer seam the self-rescheduling strand bring-up loops share (first-sync gate
211
- // probe loop, membership retry ladder) — injected by tests as a hand-cranked clock.
212
- export { defaultTimeoutScheduler, type TimeoutScheduler } from './timeout-scheduler.js';
213
-
214
- // Hibernation
215
- export {
216
- HibernationManager,
217
- type HibernationCallbacks
218
- } from './hibernation-manager.js';
219
-
220
- // Arachnode (stub)
221
- export {
222
- ArachnodeStub,
223
- createArachnodeStub,
224
- type RingConfig
225
- } from './arachnode-stub.js';
226
-
227
- // Enrollment
228
- export {
229
- EnrollmentService,
230
- type MemberVerifier,
231
- type MemberRegistry
232
- } from './enrollment.js';
233
-
234
- // Strand Solicitation
235
- export {
236
- StrandSolicitationService,
237
- createDefaultFormationResponseValidator,
238
- type DisclosureValidator,
239
- type FormationUsageRecorder,
240
- type ResolvedHostStrand,
241
- type StrandProvisioner,
242
- type FormationResponseValidator,
243
- type StrandSolicitationServiceOptions
244
- } from './strand-solicitation.js';
245
-
246
- // Formation approval client: asks an invite's ValidationUrl hook whether ONE redemption
247
- // may proceed, and checks the answer against the bytes the control database will verify.
248
- export {
249
- createHttpFormationApprover,
250
- signFormationApproval,
251
- verifyFormationApproval,
252
- FormationApprovalError,
253
- type FormationApprovalRequest,
254
- type FormationVouchFields,
255
- type FormationApproval,
256
- type FormationApprover,
257
- type FormationApprovalFailure
258
- } from './formation-approval.js';
259
-
260
- // DB-backed FormationUsageRecorder (reads/writes the real CadreControl tables)
261
- export { ControlFormationUsageRecorder } from './control-formation-recorder.js';
262
-
263
- // Closed-strand member key generation (ed25519 protobuf, base64) + the
264
- // protobuf->base64url bridge that derives the founding Member/Manager key.
265
- export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-key.js';
266
-
267
- // Strand membership writer (founder bootstrap, invite issuance/consumption,
268
- // manager-admit, member-peer registration, manager rotation, sealing — the sole
269
- // manager permanently freezing admission — + shared signing primitives reused
270
- // across the flows).
271
- export {
272
- signStrandPayload,
273
- verifyStrandPayload,
274
- signStrandApproval,
275
- generateStrandStampId,
276
- bootstrapFounderMembership,
277
- PreSplitStrandIdentityError,
278
- issueInvite,
279
- consumeInvite,
280
- burnInvite,
281
- isStrandMember,
282
- cancelInvite,
283
- listOutstandingInvites,
284
- addMemberByManager,
285
- revokeMember,
286
- leaveStrand,
287
- registerMemberPeer,
288
- listMemberPeers,
289
- removeMemberPeer,
290
- addManager,
291
- admitManager,
292
- removeManager,
293
- sealStrand,
294
- isStrandSealed,
295
- StrandTransactionBusyError,
296
- STRAND_ENGINE,
297
- STRAND_ENGINE_VERSION,
298
- type FounderBootstrapParams,
299
- type IssueInviteParams,
300
- type IssuedInvite,
301
- type ConsumeInviteParams,
302
- type CancelInviteParams,
303
- type OutstandingInvite,
304
- type AddMemberByManagerParams,
305
- type RevokeMemberParams,
306
- type LeaveStrandParams,
307
- type RegisterMemberPeerParams,
308
- type RemoveOwnPeerParams,
309
- type RemoveMemberPeerByManagerParams,
310
- type RemoveMemberPeerParams,
311
- type AddManagerParams,
312
- type AdmitManagerParams,
313
- type RemoveManagerParams,
314
- type SealStrandParams,
315
- type StrandWriteOptions
316
- } from './strand-membership-writer.js';
317
-
318
- // Engine-canonical datetime helper (shared by control + strand signed-write flows
319
- // so a signed timestamp byte-matches the datetime-coerced column the CHECK sees).
320
- export { canonicalDatetime } from './canonical-datetime.js';
321
-
322
- // Strand-DB-backed EnrollmentService backing: concrete MemberRegistry +
323
- // MemberVerifier that write/read the real Strand.* membership tables.
324
- export {
325
- StrandMemberRegistry,
326
- StrandMemberVerifier,
327
- memberRegistrationPayload,
328
- type StrandAdmission
329
- } from './strand-member-registry.js';
330
-
331
- // Seed Bootstrap
332
- export {
333
- SeedBootstrapService,
334
- SEED_PROTOCOL,
335
- ed25519PublicKeyB64FromPeerId,
336
- type SeedBootstrapConfig,
337
- type SeedEventCallbacks
338
- } from './seed-bootstrap.js';
339
-
340
- // Peer Authorization (shared owner-signature digest + offline verifier)
341
- export {
342
- peerAuthorizationDigest,
343
- cadrePeerVoucherDigest,
344
- cadrePeerRemoveDigest,
345
- deviceTokenAddDigest,
346
- deviceTokenRemoveDigest,
347
- formationConsentDigest,
348
- verifyPeerAuthorization,
349
- verifyCadrePeerVoucher,
350
- verifyFormationConsent,
351
- type DeviceTokenAuthorizedRow
352
- } from './peer-authorization.js';
353
-
354
- // Strand Wake (control-network push-wake protocol)
355
- export {
356
- StrandWakeService,
357
- dialWake,
358
- WAKE_PROTOCOL,
359
- DEFAULT_WAKE_DIAL_BUDGET_MS,
360
- type StrandWakeServiceOptions,
361
- type DialWakeOptions
362
- } from './strand-wake-protocol.js';
363
-
364
- // Strand Address (control-network strand-address RPC) — wire types come via
365
- // `export * from './types.js'` (StrandAddrRequest / StrandAddrResponse).
366
- export {
367
- StrandAddrService,
368
- collectStrandAddrs,
369
- STRAND_ADDR_PROTOCOL,
370
- type StrandAddrServiceOptions,
371
- type StrandAddrPeer,
372
- type CollectStrandAddrsOptions
373
- } from './strand-addr-protocol.js';
374
-
375
- // Peer-address record (self-published, signed, freshness-stamped CadrePeer row)
376
- export {
377
- peerRecordSignedPayload,
378
- signPeerRecord,
379
- verifyPeerRecordSignature,
380
- isPeerRecordFresh,
381
- isSignalingAddr,
382
- orderSignalingFirst,
383
- withTrailingPeerId,
384
- currentMemberTrustPolicy,
385
- DEFAULT_PEER_RECORD_MAX_AGE_MS,
386
- DEFAULT_PEER_RECORD_HEARTBEAT_MS
387
- } from './peer-record.js';
388
-
389
- // Device-token record (self-published, signed FCM/APNs push token — CadrePeer sibling)
390
- export {
391
- deviceTokenSignedPayload,
392
- signDeviceTokenRecord,
393
- verifyDeviceTokenSignature,
394
- isPushPlatform
395
- } from './device-token.js';
396
-
397
- // Strand-wake payload contract (canonical; shared by the server sender + RN receiver)
398
- export { STRAND_WAKE_TYPE, type StrandWakePayload } from './strand-wake-payload.js';
399
-
400
- // Platform push delivery — the cross-platform `PushNotifier` *contract* only.
401
- // The FCM/APNs implementations (node:http2/node:crypto) and the
402
- // `createPushNotifier` router that builds them live behind the Node-only subpath
403
- // `@serfab/cadre-core/push-node` (`push-node.ts`), never in this graph. A Node
404
- // host constructs a notifier from that subpath and injects the instance into
405
- // `CadreNodeConfig.push.notifier`. These re-exports are type-only (erased at
406
- // emit), so the RN/browser entry graph never pulls the Node modules in.
407
- export type { PushNotifier, PushMessage, PushSendResult } from './push-notifier.js';
408
-
409
- // Push-credential validation + log redaction. Dependency-free (type-only imports),
410
- // so a provisioner (cadre-host / cadre-provider) can reject a partial credential
411
- // set and produce a key-safe log view without pulling the FCM/APNs sender graph.
412
- export { validatePushCredentials, redactPushCredentials, REDACTED } from './push-credentials.js';
413
-
414
- // Server-side push-wake trigger policy + fan-out (who/when to wake). Cross-platform
415
- // clean — it imports only the PushNotifier *type*, so exporting it as a runtime
416
- // value pulls no node:http2/node:crypto edge into the RN/browser graph.
417
- export {
418
- PushFanoutService,
419
- DEFAULT_PUSH_COOLDOWN_MS,
420
- DEFAULT_PUSH_DEBOUNCE_MS,
421
- type PushFanoutOptions,
422
- type FanoutMember
423
- } from './push-fanout.js';
424
-
425
- // Control-cohort dial selection (backbone-preferential, bounded out-degree) +
426
- // the cadence/degree defaults the proactive reconcile routine reads.
427
- export {
428
- selectControlCohortDials,
429
- DEFAULT_CONTROL_COHORT_RECONCILE_MS,
430
- DEFAULT_CONTROL_COHORT_TARGET_DEGREE,
431
- type ControlCohortSelection,
432
- type ControlCohortReconcileResult
433
- } from './control-cohort.js';
434
-
435
- // Dialing one peer from several candidate addresses, each under its own time
436
- // limit, so an address that never answers cannot starve the rest.
437
- export {
438
- dialPeerAddrs,
439
- tryAddrsInTurn,
440
- directBeforeRelayed,
441
- DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS,
442
- DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS,
443
- DEFAULT_PEER_DIAL_BUDGET,
444
- type PeerDialBudget,
445
- type AddrDialer
446
- } from './peer-dial.js';
447
-
448
- // Seed trust policy (trust anchor for incoming seeds)
449
- export {
450
- anchoredTrustPolicy,
451
- pinnedKeyTrustPolicy,
452
- tofuTrustPolicy,
453
- type SeedTrustPolicy,
454
- type SeedTrustContext,
455
- type SeedTrustDecision
456
- } from './seed-trust-policy.js';
457
-
458
- // Schema Verification
459
- export {
460
- signSchema,
461
- verifySchema,
462
- assertSchemaSignature,
463
- SchemaVerificationError
464
- } from './schema-verification.js';
465
-
466
- // Strand Formation transport (native cadre-core protocol)
467
- export {
468
- FormationListener,
469
- dialFormation,
470
- isValidResponderCreatesResult,
471
- isWellFormedMembershipInvite,
472
- sanitizeStrandAddrs,
473
- FORMATION_PROTOCOL,
474
- type FormationParty,
475
- type FormationContactMessage,
476
- type FormationResultMessage,
477
- type FormationProvisionResult,
478
- type FormationStrandInfo,
479
- type FormationDbConnectionInfo,
480
- type FormationListenerOptions,
481
- type FormationDialOptions,
482
- type FormationDialResult,
483
- type ResponderProvisionOutcome
484
- } from './strand-formation-protocol.js';
485
-
486
- // Strand Formation manager (drives the native transport)
487
- export {
488
- StrandFormationManager,
489
- createStrandFormationManager,
490
- MEMBERSHIP_INVITE_TTL_MS,
491
- MEMBERSHIP_INVITE_UNAVAILABLE_REASON,
492
- HOST_STRAND_MUST_BE_RECREATED_REASON,
493
- type StrandFormationManagerConfig,
494
- type StrandFormationManagerOptions
495
- } from './strand-formation-manager.js';
496
-
497
- // Control-network inbound connection gate (membership defense-in-depth)
498
- export {
499
- createMembershipConnectionGater,
500
- STRANGER_OPEN_PROTOCOLS,
501
- DEFAULT_ENROLLMENT_WINDOW_MS,
502
- ADMISSION_DECISION_TIMEOUT_MS,
503
- RELAY_ADMISSION_RESERVE_DEADLINE_MS,
504
- RELAY_ADMISSION_CLOSE_TIMEOUT_MS,
505
- MAX_UNAUTHORIZED_RELAY_RESERVATIONS,
506
- UNAUTHORIZED_RESERVATION_TTL_MS,
507
- UnauthorizedReservationBudget,
508
- type InboundAdmissionPolicy,
509
- type InboundConnectionVerdict
510
- } from './membership-connection-gater.js';
511
-
512
- // Thrown out of `CadreNode.start()` when a `network.relayAddrs` reservation does
513
- // not land on its first attempt — the fail-fast posture of that config field now
514
- // that the control node reserves AFTER control-database bring-up (relay-addrs.ts).
515
- // `UnbindableListenAddressError` is the same posture for the OTHER half of the listen
516
- // config: a `network.listenAddrs` entry whose transport the node will not have refuses
517
- // start instead of being silently dropped by libp2p's transport manager.
518
- //
519
- // `resolveListenAddrs` and `strandNodeAddrs` are the derivations themselves — what a
520
- // `NetworkConfig` actually turns into for the control node and for each strand node.
521
- // Exported so an embedder that hand-writes a `network` block (the React Native and web
522
- // reference apps) can assert on the resulting SHAPE rather than on its own field names,
523
- // which is the difference between a test that proves reachability and one that proves a
524
- // spelling.
525
- export {
526
- RelayReservationFailedError,
527
- UnbindableListenAddressError,
528
- RELAY_SEARCH_LISTEN_ADDR,
529
- resolveListenAddrs
530
- } from './relay-addrs.js';
531
- export { strandNodeAddrs, type StrandNodeAddrs } from './strand-network-config.js';
532
-
533
- // Relay reservation via the bare `/p2p-circuit` search listener — the one route
534
- // every control node takes; `network.relayAddrs` is its fail-fast posture
535
- // (see relay-reservation.ts)
536
- export {
537
- circuitMultiaddrs,
538
- superviseRelayReservation,
539
- DEFAULT_RELAY_RESERVE_TIMEOUT_MS,
540
- DEFAULT_RELAY_RESERVE_POLL_MS,
541
- DEFAULT_RELAY_CHECK_MS,
542
- DEFAULT_RELAY_MIN_BACKOFF_MS,
543
- DEFAULT_RELAY_MAX_BACKOFF_MS,
544
- type RelayReservationStatus,
545
- type RelayReservationState,
546
- type RelayReserveOptions,
547
- type RelayReservationSupervisor,
548
- type RelayReservationSupervisorOptions
549
- } from './relay-reservation.js';
550
-
551
- // Connection-path diagnostics (relayed vs direct classification + summary)
552
- export {
553
- classifyTransport,
554
- classifyConnectionPath,
555
- summarizeConnectionPaths,
556
- emptyConnectionPathSummary,
557
- DEFAULT_SETTLE_WINDOW_MS,
558
- type ConnectionPathKind,
559
- type ConnectionTransport,
560
- type ConnectionPath,
561
- type ConnectionPathSummary,
562
- type ConnectionLike
563
- } 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 (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
+ // Storage scope keys — what `CadreNodeConfig.storage.provider` is called with. A
121
+ // strand's key is its strand id; the control database's key carries the party id,
122
+ // so two parties on one device never share a control store. Every key stays within
123
+ // `[A-Za-z0-9._-]`: the control key by base64url encoding, a strand's by
124
+ // `assertStrandScopeKey`, which every strand launch runs.
125
+ export {
126
+ controlStorageScope,
127
+ isControlStorageScope,
128
+ isValidStrandScopeKey,
129
+ assertStrandScopeKey,
130
+ InvalidStrandIdError
131
+ } from './storage-scope.js';
132
+
133
+ // Strand database
134
+ export { StrandDatabase, type StrandDatabaseConfig } from './strand-database.js';
135
+
136
+ // Strand management
137
+ export {
138
+ StrandWatcher,
139
+ type StrandWatcherCallbacks,
140
+ type StrandQueryable,
141
+ type SAppIdLookup,
142
+ type StrandRowWithApp
143
+ } from './strand-watcher.js';
144
+ export {
145
+ StrandInstanceManager,
146
+ type StartStrandConfig,
147
+ type ResumeStrandOverrides,
148
+ getStrandStoragePath,
149
+ isAwaitingFirstSync,
150
+ liveStrandStatus
151
+ } from './strand-instance-manager.js';
152
+
153
+ // The joining machine's first-sync write gate: a non-founder launch withholds its
154
+ // database (status 'syncing') until the strand's Header has arrived from a peer, so a
155
+ // write before the first sync can never fork the strand's tables.
156
+ export {
157
+ StrandAwaitingFirstSyncError,
158
+ DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS,
159
+ DEFAULT_STRAND_FIRST_SYNC_POLL_MS,
160
+ strandHeaderHeld,
161
+ appTablesReadable,
162
+ strandFirstSyncComplete,
163
+ type StrandFirstSyncConfig
164
+ } from './strand-first-sync-gate.js';
165
+
166
+ // Peer-join block catch-up (push this network's own blocks to each newly
167
+ // connected peer, so a late joiner physically holds pre-join blocks). Shared
168
+ // by the strand networks (ungated) and the control network (membership-gated).
169
+ export {
170
+ PeerJoinBackfill,
171
+ DEFAULT_PEER_JOIN_BACKFILL,
172
+ MAX_BLOCK_MESSAGE_BYTES,
173
+ PEER_JOIN_BACKFILL_WARN_AFTER_FAILURES,
174
+ type PeerJoinBackfillConfig,
175
+ type PeerJoinBackfillDeps,
176
+ type PeerJoinBackfillResult,
177
+ type PeerJoinBackfillPushClient
178
+ } from './peer-join-backfill.js';
179
+
180
+ // Closed-strand revoked-peer enforcement (deny the network nodes of removed
181
+ // members at the stream and connection layers, and hang up the sessions they
182
+ // already hold — see the module doc for the settled deny-list design, the
183
+ // teardown seam, and the fail directions).
184
+ export {
185
+ StrandRevocationEnforcer,
186
+ createRevocationConnectionGater,
187
+ readStrandRevocationRows,
188
+ DEFAULT_REVOCATION_POLL_INTERVAL_MS,
189
+ type StrandRevocationEnforcementConfig,
190
+ type StrandRevocationEnforcerDeps,
191
+ type StrandRevocationRows,
192
+ type StrandMemberPeerBinding,
193
+ type StrandRevocationJudge,
194
+ type StrandRevocationNetwork,
195
+ type RevocationRefreshScheduler
196
+ } from './strand-revocation-enforcer.js';
197
+
198
+ // Closed-strand membership reconciliation: the bring-up loop that finishes a
199
+ // party's join on every machine — redeem the staged formation invitation, then
200
+ // write the durable machine→party MemberPeer binding — without ever blocking
201
+ // bring-up (see the module doc for the pass ladder and terminal states).
202
+ export {
203
+ StrandMembershipReconciler,
204
+ IDLE_PASSES_BEFORE_ESCALATION,
205
+ INITIAL_JOIN_RETRY_INTERVAL_MS,
206
+ type StrandMembershipReconcilerDeps,
207
+ type StrandMembershipReconciliationConfig,
208
+ type PendingMembershipInviteSource
209
+ } from './strand-membership-reconciler.js';
210
+
211
+ // The timer seam the self-rescheduling strand bring-up loops share (first-sync gate
212
+ // probe loop, membership retry ladder) — injected by tests as a hand-cranked clock.
213
+ export { defaultTimeoutScheduler, type TimeoutScheduler } from './timeout-scheduler.js';
214
+
215
+ // Hibernation
216
+ export {
217
+ HibernationManager,
218
+ type HibernationCallbacks
219
+ } from './hibernation-manager.js';
220
+
221
+ // Arachnode (stub)
222
+ export {
223
+ ArachnodeStub,
224
+ createArachnodeStub,
225
+ type RingConfig
226
+ } from './arachnode-stub.js';
227
+
228
+ // Enrollment
229
+ export {
230
+ EnrollmentService,
231
+ type MemberVerifier,
232
+ type MemberRegistry
233
+ } from './enrollment.js';
234
+
235
+ // Strand Solicitation
236
+ export {
237
+ StrandSolicitationService,
238
+ createDefaultFormationResponseValidator,
239
+ type DisclosureValidator,
240
+ type FormationUsageRecorder,
241
+ type ResolvedHostStrand,
242
+ type StrandProvisioner,
243
+ type FormationResponseValidator,
244
+ type StrandSolicitationServiceOptions
245
+ } from './strand-solicitation.js';
246
+
247
+ // Formation approval client: asks an invite's ValidationUrl hook whether ONE redemption
248
+ // may proceed, and checks the answer against the bytes the control database will verify.
249
+ export {
250
+ createHttpFormationApprover,
251
+ signFormationApproval,
252
+ verifyFormationApproval,
253
+ FormationApprovalError,
254
+ type FormationApprovalRequest,
255
+ type FormationVouchFields,
256
+ type FormationApproval,
257
+ type FormationApprover,
258
+ type FormationApprovalFailure
259
+ } from './formation-approval.js';
260
+
261
+ // DB-backed FormationUsageRecorder (reads/writes the real CadreControl tables)
262
+ export { ControlFormationUsageRecorder } from './control-formation-recorder.js';
263
+
264
+ // Closed-strand member key generation (ed25519 protobuf, base64) + the
265
+ // protobuf->base64url bridge that derives the founding Member/Manager key.
266
+ export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-key.js';
267
+
268
+ // Strand membership writer (founder bootstrap, invite issuance/consumption,
269
+ // manager-admit, member-peer registration, manager rotation, sealing — the sole
270
+ // manager permanently freezing admission — + shared signing primitives reused
271
+ // across the flows).
272
+ export {
273
+ signStrandPayload,
274
+ verifyStrandPayload,
275
+ signStrandApproval,
276
+ generateStrandStampId,
277
+ bootstrapFounderMembership,
278
+ PreSplitStrandIdentityError,
279
+ issueInvite,
280
+ consumeInvite,
281
+ burnInvite,
282
+ isStrandMember,
283
+ cancelInvite,
284
+ listOutstandingInvites,
285
+ addMemberByManager,
286
+ revokeMember,
287
+ leaveStrand,
288
+ registerMemberPeer,
289
+ listMemberPeers,
290
+ removeMemberPeer,
291
+ addManager,
292
+ admitManager,
293
+ removeManager,
294
+ sealStrand,
295
+ isStrandSealed,
296
+ StrandTransactionBusyError,
297
+ STRAND_ENGINE,
298
+ STRAND_ENGINE_VERSION,
299
+ type FounderBootstrapParams,
300
+ type IssueInviteParams,
301
+ type IssuedInvite,
302
+ type ConsumeInviteParams,
303
+ type CancelInviteParams,
304
+ type OutstandingInvite,
305
+ type AddMemberByManagerParams,
306
+ type RevokeMemberParams,
307
+ type LeaveStrandParams,
308
+ type RegisterMemberPeerParams,
309
+ type RemoveOwnPeerParams,
310
+ type RemoveMemberPeerByManagerParams,
311
+ type RemoveMemberPeerParams,
312
+ type AddManagerParams,
313
+ type AdmitManagerParams,
314
+ type RemoveManagerParams,
315
+ type SealStrandParams,
316
+ type StrandWriteOptions
317
+ } from './strand-membership-writer.js';
318
+
319
+ // Engine-canonical datetime helper (shared by control + strand signed-write flows
320
+ // so a signed timestamp byte-matches the datetime-coerced column the CHECK sees).
321
+ export { canonicalDatetime } from './canonical-datetime.js';
322
+
323
+ // Strand-DB-backed EnrollmentService backing: concrete MemberRegistry +
324
+ // MemberVerifier that write/read the real Strand.* membership tables.
325
+ export {
326
+ StrandMemberRegistry,
327
+ StrandMemberVerifier,
328
+ memberRegistrationPayload,
329
+ type StrandAdmission
330
+ } from './strand-member-registry.js';
331
+
332
+ // Seed Bootstrap
333
+ export {
334
+ SeedBootstrapService,
335
+ SEED_PROTOCOL,
336
+ ed25519PublicKeyB64FromPeerId,
337
+ type SeedBootstrapConfig,
338
+ type SeedEventCallbacks
339
+ } from './seed-bootstrap.js';
340
+
341
+ // Peer Authorization (shared owner-signature digest + offline verifier)
342
+ export {
343
+ peerAuthorizationDigest,
344
+ cadrePeerVoucherDigest,
345
+ cadrePeerRemoveDigest,
346
+ deviceTokenAddDigest,
347
+ deviceTokenRemoveDigest,
348
+ formationConsentDigest,
349
+ verifyPeerAuthorization,
350
+ verifyCadrePeerVoucher,
351
+ verifyFormationConsent,
352
+ type DeviceTokenAuthorizedRow
353
+ } from './peer-authorization.js';
354
+
355
+ // Strand Wake (control-network push-wake protocol)
356
+ export {
357
+ StrandWakeService,
358
+ dialWake,
359
+ WAKE_PROTOCOL,
360
+ DEFAULT_WAKE_DIAL_BUDGET_MS,
361
+ type StrandWakeServiceOptions,
362
+ type DialWakeOptions
363
+ } from './strand-wake-protocol.js';
364
+
365
+ // Strand Address (control-network strand-address RPC) — wire types come via
366
+ // `export * from './types.js'` (StrandAddrRequest / StrandAddrResponse).
367
+ export {
368
+ StrandAddrService,
369
+ collectStrandAddrs,
370
+ STRAND_ADDR_PROTOCOL,
371
+ type StrandAddrServiceOptions,
372
+ type StrandAddrPeer,
373
+ type CollectStrandAddrsOptions
374
+ } from './strand-addr-protocol.js';
375
+
376
+ // Peer-address record (self-published, signed, freshness-stamped CadrePeer row)
377
+ export {
378
+ peerRecordSignedPayload,
379
+ signPeerRecord,
380
+ verifyPeerRecordSignature,
381
+ isPeerRecordFresh,
382
+ isSignalingAddr,
383
+ orderSignalingFirst,
384
+ withTrailingPeerId,
385
+ currentMemberTrustPolicy,
386
+ DEFAULT_PEER_RECORD_MAX_AGE_MS,
387
+ DEFAULT_PEER_RECORD_HEARTBEAT_MS
388
+ } from './peer-record.js';
389
+
390
+ // Device-token record (self-published, signed FCM/APNs push token — CadrePeer sibling)
391
+ export {
392
+ deviceTokenSignedPayload,
393
+ signDeviceTokenRecord,
394
+ verifyDeviceTokenSignature,
395
+ isPushPlatform
396
+ } from './device-token.js';
397
+
398
+ // Strand-wake payload contract (canonical; shared by the server sender + RN receiver)
399
+ export { STRAND_WAKE_TYPE, type StrandWakePayload } from './strand-wake-payload.js';
400
+
401
+ // Platform push delivery — the cross-platform `PushNotifier` *contract* only.
402
+ // The FCM/APNs implementations (node:http2/node:crypto) and the
403
+ // `createPushNotifier` router that builds them live behind the Node-only subpath
404
+ // `@serfab/cadre-core/push-node` (`push-node.ts`), never in this graph. A Node
405
+ // host constructs a notifier from that subpath and injects the instance into
406
+ // `CadreNodeConfig.push.notifier`. These re-exports are type-only (erased at
407
+ // emit), so the RN/browser entry graph never pulls the Node modules in.
408
+ export type { PushNotifier, PushMessage, PushSendResult } from './push-notifier.js';
409
+
410
+ // Push-credential validation + log redaction. Dependency-free (type-only imports),
411
+ // so a provisioner (cadre-host / cadre-provider) can reject a partial credential
412
+ // set and produce a key-safe log view without pulling the FCM/APNs sender graph.
413
+ export { validatePushCredentials, redactPushCredentials, REDACTED } from './push-credentials.js';
414
+
415
+ // Server-side push-wake trigger policy + fan-out (who/when to wake). Cross-platform
416
+ // clean — it imports only the PushNotifier *type*, so exporting it as a runtime
417
+ // value pulls no node:http2/node:crypto edge into the RN/browser graph.
418
+ export {
419
+ PushFanoutService,
420
+ DEFAULT_PUSH_COOLDOWN_MS,
421
+ DEFAULT_PUSH_DEBOUNCE_MS,
422
+ type PushFanoutOptions,
423
+ type FanoutMember
424
+ } from './push-fanout.js';
425
+
426
+ // Control-cohort dial selection (backbone-preferential, bounded out-degree) +
427
+ // the cadence/degree defaults the proactive reconcile routine reads.
428
+ export {
429
+ selectControlCohortDials,
430
+ DEFAULT_CONTROL_COHORT_RECONCILE_MS,
431
+ DEFAULT_CONTROL_COHORT_TARGET_DEGREE,
432
+ type ControlCohortSelection,
433
+ type ControlCohortReconcileResult
434
+ } from './control-cohort.js';
435
+
436
+ // Dialing one peer from several candidate addresses, each under its own time
437
+ // limit, so an address that never answers cannot starve the rest.
438
+ export {
439
+ dialPeerAddrs,
440
+ tryAddrsInTurn,
441
+ directBeforeRelayed,
442
+ DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS,
443
+ DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS,
444
+ CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS,
445
+ DEFAULT_PEER_DIAL_BUDGET,
446
+ type PeerDialBudget,
447
+ type AddrDialer
448
+ } from './peer-dial.js';
449
+
450
+ // Dial and reservation budgets counted in link round trips rather than fixed milliseconds, so
451
+ // one declared assumption about the link moves them all — see `NetworkConfig.linkRoundTripMs`.
452
+ export {
453
+ DECLARED_LINK_ROUND_TRIP_MS,
454
+ RELAYED_DIAL_ROUND_TRIPS,
455
+ RELAY_RESERVATION_ROUND_TRIPS,
456
+ CIRCUIT_REQUEST_ROUND_TRIPS,
457
+ PUSH_TRANSFER_ALLOWANCE_MS,
458
+ resolveLinkRoundTripMs,
459
+ relayedDialBudgetMs,
460
+ connectionManagerTimeouts,
461
+ relayReservationBudgetMs,
462
+ circuitRequestBudgetMs,
463
+ peerJoinPushBudget,
464
+ type PeerJoinPushBudget
465
+ } from './link-budget.js';
466
+
467
+ // Seed trust policy (trust anchor for incoming seeds)
468
+ export {
469
+ anchoredTrustPolicy,
470
+ pinnedKeyTrustPolicy,
471
+ tofuTrustPolicy,
472
+ type SeedTrustPolicy,
473
+ type SeedTrustContext,
474
+ type SeedTrustDecision
475
+ } from './seed-trust-policy.js';
476
+
477
+ // Schema Verification
478
+ export {
479
+ signSchema,
480
+ verifySchema,
481
+ assertSchemaSignature,
482
+ SchemaVerificationError
483
+ } from './schema-verification.js';
484
+
485
+ // Strand Formation transport (native cadre-core protocol)
486
+ export {
487
+ FormationListener,
488
+ dialFormation,
489
+ isValidResponderCreatesResult,
490
+ isWellFormedMembershipInvite,
491
+ sanitizeStrandAddrs,
492
+ FORMATION_PROTOCOL,
493
+ type FormationParty,
494
+ type FormationContactMessage,
495
+ type FormationResultMessage,
496
+ type FormationProvisionResult,
497
+ type FormationStrandInfo,
498
+ type FormationDbConnectionInfo,
499
+ type FormationListenerOptions,
500
+ type FormationDialOptions,
501
+ type FormationDialResult,
502
+ type ResponderProvisionOutcome
503
+ } from './strand-formation-protocol.js';
504
+
505
+ // Strand Formation manager (drives the native transport)
506
+ export {
507
+ StrandFormationManager,
508
+ createStrandFormationManager,
509
+ MEMBERSHIP_INVITE_TTL_MS,
510
+ MEMBERSHIP_INVITE_UNAVAILABLE_REASON,
511
+ HOST_STRAND_MUST_BE_RECREATED_REASON,
512
+ type StrandFormationManagerConfig,
513
+ type StrandFormationManagerOptions
514
+ } from './strand-formation-manager.js';
515
+
516
+ // Control-network inbound connection gate (membership defense-in-depth)
517
+ export {
518
+ createMembershipConnectionGater,
519
+ STRANGER_OPEN_PROTOCOLS,
520
+ DEFAULT_ENROLLMENT_WINDOW_MS,
521
+ ADMISSION_DECISION_TIMEOUT_MS,
522
+ RELAY_ADMISSION_RESERVE_DEADLINE_MS,
523
+ RELAY_ADMISSION_CLOSE_TIMEOUT_MS,
524
+ MAX_UNAUTHORIZED_RELAY_RESERVATIONS,
525
+ UNAUTHORIZED_RESERVATION_TTL_MS,
526
+ UnauthorizedReservationBudget,
527
+ type InboundAdmissionPolicy,
528
+ type InboundConnectionVerdict
529
+ } from './membership-connection-gater.js';
530
+
531
+ // Thrown out of `CadreNode.start()` when a `network.relayAddrs` reservation does
532
+ // not land on its first attempt — the fail-fast posture of that config field now
533
+ // that the control node reserves AFTER control-database bring-up (relay-addrs.ts).
534
+ // `UnbindableListenAddressError` is the same posture for the OTHER half of the listen
535
+ // config: a `network.listenAddrs` entry whose transport the node will not have refuses
536
+ // start instead of being silently dropped by libp2p's transport manager.
537
+ //
538
+ // `resolveListenAddrs` and `strandNodeAddrs` are the derivations themselves — what a
539
+ // `NetworkConfig` actually turns into for the control node and for each strand node.
540
+ // Exported so an embedder that hand-writes a `network` block (the React Native and web
541
+ // reference apps) can assert on the resulting SHAPE rather than on its own field names,
542
+ // which is the difference between a test that proves reachability and one that proves a
543
+ // spelling.
544
+ export {
545
+ RelayReservationFailedError,
546
+ UnbindableListenAddressError,
547
+ RELAY_SEARCH_LISTEN_ADDR,
548
+ resolveListenAddrs
549
+ } from './relay-addrs.js';
550
+ export { strandNodeAddrs, type StrandNodeAddrs } from './strand-network-config.js';
551
+
552
+ // Relay reservation via the bare `/p2p-circuit` search listener — the one route
553
+ // every control node takes; `network.relayAddrs` is its fail-fast posture
554
+ // (see relay-reservation.ts)
555
+ export {
556
+ circuitMultiaddrs,
557
+ superviseRelayReservation,
558
+ DEFAULT_RELAY_RESERVE_TIMEOUT_MS,
559
+ DEFAULT_RELAY_RESERVE_POLL_MS,
560
+ DEFAULT_RELAY_CHECK_MS,
561
+ DEFAULT_RELAY_MIN_BACKOFF_MS,
562
+ DEFAULT_RELAY_MAX_BACKOFF_MS,
563
+ type RelayReservationStatus,
564
+ type RelayReservationState,
565
+ type RelayReserveOptions,
566
+ type RelayReservationSupervisor,
567
+ type RelayReservationSupervisorOptions
568
+ } from './relay-reservation.js';
569
+
570
+ // Connection-path diagnostics (relayed vs direct classification + summary)
571
+ export {
572
+ classifyTransport,
573
+ classifyConnectionPath,
574
+ summarizeConnectionPaths,
575
+ emptyConnectionPathSummary,
576
+ DEFAULT_SETTLE_WINDOW_MS,
577
+ type ConnectionPathKind,
578
+ type ConnectionTransport,
579
+ type ConnectionPath,
580
+ type ConnectionPathSummary,
581
+ type ConnectionLike
582
+ } from './diagnostics/connection-path.js';