@serfab/cadre-core 1.8.0 → 1.10.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.
- package/dist/cadre-node.d.ts +301 -121
- package/dist/cadre-node.js +588 -244
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-authorization.d.ts +2 -2
- package/dist/control-authorization.js +1 -0
- package/dist/control-authorization.js.map +1 -1
- package/dist/control-cohort.d.ts +1 -1
- package/dist/control-cohort.js +1 -1
- package/dist/control-database.d.ts +105 -14
- package/dist/control-database.js +242 -73
- package/dist/control-database.js.map +1 -1
- package/dist/control-formation-recorder.d.ts +6 -6
- package/dist/control-formation-recorder.js +7 -8
- package/dist/control-formation-recorder.js.map +1 -1
- package/dist/control-schema.d.ts +1 -1
- package/dist/control-schema.js +90 -3
- package/dist/control-schema.js.map +1 -1
- package/dist/control-write-retry.d.ts +21 -15
- package/dist/control-write-retry.js +21 -15
- package/dist/control-write-retry.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +16 -13
- package/dist/index.js.map +1 -1
- package/dist/invitation-bootstrap.d.ts +32 -0
- package/dist/invitation-bootstrap.js +30 -0
- package/dist/invitation-bootstrap.js.map +1 -0
- package/dist/link-budget.d.ts +204 -119
- package/dist/link-budget.js +208 -120
- package/dist/link-budget.js.map +1 -1
- package/dist/membership-connection-gater.d.ts +3 -3
- package/dist/membership-connection-gater.js +3 -3
- package/dist/node-local-snapshot.d.ts +6 -4
- package/dist/node-local-snapshot.js +7 -3
- package/dist/node-local-snapshot.js.map +1 -1
- package/dist/peer-dial.d.ts +18 -14
- package/dist/peer-dial.js +18 -14
- package/dist/peer-dial.js.map +1 -1
- package/dist/peer-join-backfill.d.ts +3 -12
- package/dist/peer-join-backfill.js +2 -3
- package/dist/peer-join-backfill.js.map +1 -1
- package/dist/pending-join-runner.d.ts +186 -0
- package/dist/pending-join-runner.js +649 -0
- package/dist/pending-join-runner.js.map +1 -0
- package/dist/push-fanout.d.ts +1 -1
- package/dist/push-fanout.js +1 -1
- package/dist/seed-bootstrap.d.ts +2 -2
- package/dist/seed-bootstrap.js +1 -1
- package/dist/strand-addr-protocol.js +2 -2
- package/dist/strand-formation-deadlines.d.ts +5 -5
- package/dist/strand-formation-deadlines.js +5 -5
- package/dist/strand-formation-manager.d.ts +18 -4
- package/dist/strand-formation-manager.js +48 -33
- package/dist/strand-formation-manager.js.map +1 -1
- package/dist/strand-formation-protocol.d.ts +71 -25
- package/dist/strand-formation-protocol.js +225 -51
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-formation-rejection.d.ts +94 -0
- package/dist/strand-formation-rejection.js +77 -0
- package/dist/strand-formation-rejection.js.map +1 -0
- package/dist/strand-fret-addrs.d.ts +54 -0
- package/dist/strand-fret-addrs.js +108 -0
- package/dist/strand-fret-addrs.js.map +1 -0
- package/dist/strand-instance-manager.d.ts +9 -38
- package/dist/strand-instance-manager.js +17 -74
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-network-state-file.d.ts +12 -0
- package/dist/strand-network-state-file.js +38 -0
- package/dist/strand-network-state-file.js.map +1 -0
- package/dist/strand-network-state.d.ts +111 -0
- package/dist/strand-network-state.js +191 -0
- package/dist/strand-network-state.js.map +1 -0
- package/dist/strand-solicitation.d.ts +11 -3
- package/dist/strand-solicitation.js +9 -0
- package/dist/strand-solicitation.js.map +1 -1
- package/dist/types.d.ts +123 -40
- package/dist/types.js +5 -9
- package/dist/types.js.map +1 -1
- package/package.json +25 -24
- package/src/cadre-node.ts +637 -251
- package/src/control-authorization.ts +117 -116
- package/src/control-cohort.ts +1 -1
- package/src/control-database.ts +303 -82
- package/src/control-formation-recorder.ts +8 -9
- package/src/control-schema.ts +90 -3
- package/src/control-write-retry.ts +21 -15
- package/src/index.ts +36 -56
- package/src/invitation-bootstrap.ts +40 -0
- package/src/link-budget.ts +221 -120
- package/src/membership-connection-gater.ts +3 -3
- package/src/node-local-snapshot.ts +12 -7
- package/src/peer-dial.ts +18 -14
- package/src/peer-join-backfill.ts +5 -6
- package/src/pending-join-runner.ts +735 -0
- package/src/push-fanout.ts +1 -1
- package/src/seed-bootstrap.ts +2 -2
- package/src/strand-addr-protocol.ts +2 -2
- package/src/strand-formation-deadlines.ts +5 -5
- package/src/strand-formation-manager.ts +62 -37
- package/src/strand-formation-protocol.ts +1036 -803
- package/src/strand-formation-rejection.ts +129 -0
- package/src/strand-fret-addrs.ts +145 -0
- package/src/strand-instance-manager.ts +24 -97
- package/src/strand-network-state-file.ts +40 -0
- package/src/strand-network-state.ts +243 -0
- package/src/strand-solicitation.ts +17 -4
- package/src/types.ts +119 -40
- package/dist/strand-peer-book-file.d.ts +0 -12
- package/dist/strand-peer-book-file.js +0 -37
- package/dist/strand-peer-book-file.js.map +0 -1
- package/dist/strand-peer-book-protocol.d.ts +0 -168
- package/dist/strand-peer-book-protocol.js +0 -356
- package/dist/strand-peer-book-protocol.js.map +0 -1
- package/dist/strand-peer-book-swap.d.ts +0 -104
- package/dist/strand-peer-book-swap.js +0 -284
- package/dist/strand-peer-book-swap.js.map +0 -1
- package/dist/strand-peer-book.d.ts +0 -159
- package/dist/strand-peer-book.js +0 -361
- package/dist/strand-peer-book.js.map +0 -1
- package/dist/strand-peer-observer.d.ts +0 -88
- package/dist/strand-peer-observer.js +0 -180
- package/dist/strand-peer-observer.js.map +0 -1
- package/src/strand-peer-book-file.ts +0 -39
- package/src/strand-peer-book-protocol.ts +0 -466
- package/src/strand-peer-book-swap.ts +0 -338
- package/src/strand-peer-book.ts +0 -475
- package/src/strand-peer-observer.ts +0 -235
|
@@ -72,11 +72,12 @@ export const SCHEMA_INIT_ATTEMPTS = 5;
|
|
|
72
72
|
* This budget — not the attempt count — is what makes the policy safe to sit under every
|
|
73
73
|
* control write. A transient failure (stream reset while a connection is still forming)
|
|
74
74
|
* surfaces in well under a second, so it is retried and the loop adds at most ~2.2 s. A
|
|
75
|
-
* genuinely silent cohort member
|
|
76
|
-
* response-deadline attempts, 10.5 s each at the default declared link
|
|
77
|
-
*
|
|
78
|
-
* already exceeds this budget
|
|
79
|
-
*
|
|
75
|
+
* genuinely silent cohort member costs ~21 s per consensus round (two `ClusterClient`
|
|
76
|
+
* response-deadline attempts, 10.5 s each at the default declared link): one pend round plus
|
|
77
|
+
* the cancel discharge's three rounds, about 84 s for one write in
|
|
78
|
+
* `control-write-degraded-cohort-member.integration.ts`, which already exceeds this budget
|
|
79
|
+
* when attempt 1 returns — so that case is surfaced immediately and retry adds ZERO latency
|
|
80
|
+
* to the case where it cannot help.
|
|
80
81
|
*
|
|
81
82
|
* It cuts the loop off by design, so it does not grow with the link: its job is to end the
|
|
82
83
|
* retries of slow attempts, and the caller gets the last attempt's error unchanged. An attempt
|
|
@@ -87,16 +88,21 @@ export const SCHEMA_INIT_ATTEMPTS = 5;
|
|
|
87
88
|
* (10.5 s at the default declared link) still gets none. See `docs/cadre-consistency.md` →
|
|
88
89
|
* "Deadlines Over Optimystic's Reads and Commits".
|
|
89
90
|
*
|
|
90
|
-
* NOTE: a failed commit attempt
|
|
91
|
-
* (optimystic `TransactorSource.transact`'s catch
|
|
92
|
-
* `
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
91
|
+
* NOTE: a failed commit attempt also pays a cancel discharge before its error returns
|
|
92
|
+
* (optimystic `TransactorSource.transact`'s catch) — bounded by six rounds and
|
|
93
|
+
* `abortOrCancelTimeoutMs`, which every collection this repo opens sets to the larger of 5 s
|
|
94
|
+
* and the RPC dial deadline: 42.5 s at the default declared link (`optimysticDialLimits` in
|
|
95
|
+
* `link-budget.ts`;
|
|
96
|
+
* `../optimystic/packages/quereus-plugin-optimystic/src/optimystic-adapter/collection-factory.ts`).
|
|
97
|
+
* One cancel that runs its full budget therefore ends the retries on its own, cutting the
|
|
98
|
+
* three-attempt policy to however many attempts came before it. A cancel only runs that long
|
|
99
|
+
* when a peer stays silent, and that attempt has already spent its pend round past this
|
|
100
|
+
* budget, so the cut loses nothing there. After a transient fault the cancel is either
|
|
101
|
+
* answered or gives up after its six rounds against a dead transport, in about a second
|
|
102
|
+
* either way (optimystic `NetworkTransactor.MAX_CANCEL_ROUNDS`). Not observed — every
|
|
103
|
+
* measured round of the transient-reset case committed on attempt 3 of 3 — so this is a
|
|
104
|
+
* condition to watch, not work to do: if that case ever starts failing with
|
|
105
|
+
* `failed after 2/3 attempt(s)`, the cancel discharge is where the time went.
|
|
100
106
|
*/
|
|
101
107
|
// eslint-disable-next-line no-restricted-syntax -- cuts off by design: it ends the retries of slow attempts rather than waiting them out; see docs/cadre-consistency.md → "Deadlines Over Optimystic's Reads and Commits"
|
|
102
108
|
export const CONTROL_WRITE_RETRY_BUDGET_MS = 10000;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-write-retry.js","sourceRoot":"","sources":["../src/control-write-retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9G,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"control-write-retry.js","sourceRoot":"","sources":["../src/control-write-retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9G,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAA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AS,EAAE,eAAe;KAC1B,EAAE,OAAO,CAAC,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,10 +14,8 @@ export type { DurableSlot } from './node-local-snapshot.js';
|
|
|
14
14
|
export { MemoryBootstrapPeerStore, PersistentBootstrapPeerStore, type BootstrapPeerStore, type BootstrapPeerEntry } from './bootstrap-peer-store.js';
|
|
15
15
|
export { MemoryEnrolledMachineStore, PersistentEnrolledMachineStore, type EnrolledMachineStore } from './enrolled-machine-store.js';
|
|
16
16
|
export { MemoryJoinedStrandStore, KeyStoreJoinedStrandStore, type JoinedStrandStore, type JoinedStrandRecord } from './joined-strand-store.js';
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export { STRAND_PEER_BOOK_PROTOCOL, SIGNED_STRAND_PEER_ENTRY_VERSION, STRAND_PEER_ISSUED_AT_SKEW_MS, MAX_BOOK_FRAME_SIZE, StrandPeerBookService, exchangeStrandPeerBook, signStrandPeerEntry, signedStrandPeerEntryPayload, verifySignedStrandPeerEntry, verifyStrandPeerBookFrame, trimBookFrameToFit, assertBookFrameFits, type SignedStrandPeerEntry, type StrandPeerBookFrame, type StrandPeerEntryVerdict, type StrandPeerBookServiceDeps, type ExchangeStrandPeerBookOptions } from './strand-peer-book-protocol.js';
|
|
20
|
-
export { StrandPeerBookSwap, STRAND_PEER_BOOK_SWAP_THROTTLE_MS, OWN_ENTRY_RESIGN_DEBOUNCE_MS, type StrandPeerBookSwapDeps, type StrandPeerBookSwapOptions } from './strand-peer-book-swap.js';
|
|
17
|
+
export { MemoryStrandNetworkStateStore, PersistentStrandNetworkStateStore, strandNetworkStatePersistence, type StrandNetworkStateStore } from './strand-network-state.js';
|
|
18
|
+
export { strandFretPeerAddrs, type FretAddrHost, type FretPeerAddrs } from './strand-fret-addrs.js';
|
|
21
19
|
export { controlStorageScope, isControlStorageScope, isValidStrandScopeKey, assertStrandScopeKey, InvalidStrandIdError } from './storage-scope.js';
|
|
22
20
|
export { StrandDatabase, type StrandDatabaseConfig } from './strand-database.js';
|
|
23
21
|
export { StrandWatcher, type StrandWatcherCallbacks, type StrandQueryable, type SAppIdLookup, type StrandRowWithApp } from './strand-watcher.js';
|
|
@@ -49,12 +47,14 @@ export { validatePushCredentials, redactPushCredentials, REDACTED } from './push
|
|
|
49
47
|
export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS, type PushFanoutOptions, type FanoutMember } from './push-fanout.js';
|
|
50
48
|
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE, type ControlCohortSelection, type ControlCohortReconcileResult } from './control-cohort.js';
|
|
51
49
|
export { dialPeerAddrs, SelfRelayOnlyError, tryAddrsInTurn, directBeforeRelayed, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS, CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS, DEFAULT_PEER_DIAL_BUDGET, type PeerDialBudget, type AddrDialer } from './peer-dial.js';
|
|
52
|
-
export { DECLARED_LINK_ROUND_TRIP_MS, RELAYED_DIAL_ROUND_TRIPS, RELAY_RESERVATION_ROUND_TRIPS, CIRCUIT_REQUEST_ROUND_TRIPS, RELAYED_REQUEST_ROUND_TRIPS, PUSH_TRANSFER_ALLOWANCE_MS, ADMISSION_DECISION_TIMEOUT_MS, resolveLinkRoundTripMs, relayedDialBudgetMs, relayReservationBudgetMs, circuitRequestBudgetMs, relayedRequestBudgetMs, peerJoinPushBudget, type PeerJoinPushBudget } from './link-budget.js';
|
|
50
|
+
export { DECLARED_LINK_ROUND_TRIP_MS, CIRCUIT_DIAL_ROUND_TRIPS, RELAY_DIAL_ROUND_TRIPS, RELAYED_DIAL_ROUND_TRIPS, RELAY_RESERVATION_ROUND_TRIPS, CIRCUIT_REQUEST_ROUND_TRIPS, RELAYED_REQUEST_ROUND_TRIPS, PUSH_TRANSFER_ALLOWANCE_MS, ADMISSION_DECISION_TIMEOUT_MS, resolveLinkRoundTripMs, relayedDialBudgetMs, relayReservationBudgetMs, circuitRequestBudgetMs, relayedRequestBudgetMs, peerJoinPushBudget, type PeerJoinPushBudget, DIAL_ADMISSION_DECISIONS, optimysticDialLimits, type OptimysticDialLimits } from './link-budget.js';
|
|
53
51
|
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, type SeedTrustPolicy, type SeedTrustContext, type SeedTrustDecision } from './seed-trust-policy.js';
|
|
54
52
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
55
|
-
export { FormationListener, dialFormation, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL, type FormationParty, type FormationContactMessage, type FormationResultMessage, type FormationProvisionResult, type FormationStrandInfo, type FormationDbConnectionInfo, type FormationListenerOptions, type FormationDialOptions, type FormationDialResult, type ResponderProvisionOutcome } from './strand-formation-protocol.js';
|
|
53
|
+
export { FormationListener, dialFormation, dialFormationByMachine, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL, type FormationParty, type FormationContactMessage, type FormationResultMessage, type FormationProvisionResult, type FormationStrandInfo, type FormationDbConnectionInfo, type FormationListenerOptions, type FormationDialOptions, type FormationDialResult, type FormationRejection, type FormationTokenCheck, type ResponderProvisionOutcome } from './strand-formation-protocol.js';
|
|
54
|
+
export { FormationRejectedError, FormationUnreachableError, FormationPostApprovalError, FORMATION_REJECTION_RETRYABLE, isFormationRejectionCode, type FormationRejectionCode } from './strand-formation-rejection.js';
|
|
56
55
|
export { formationDeadlines, type FormationDeadlines } from './strand-formation-deadlines.js';
|
|
57
|
-
export {
|
|
56
|
+
export { PENDING_JOIN_POLL_MS, PENDING_JOIN_MAX_BACKOFF_MS, MAX_PENDING_JOIN_MS } from './pending-join-runner.js';
|
|
57
|
+
export { StrandFormationManager, createStrandFormationManager, MEMBERSHIP_INVITE_TTL_MS, MEMBERSHIP_INVITE_UNAVAILABLE_REASON, HOST_STRAND_MUST_BE_RECREATED_REASON, type CadrePeerAddrsSource, type MembershipInviteIssuer, type StrandFormationManagerConfig, type StrandFormationManagerOptions } from './strand-formation-manager.js';
|
|
58
58
|
export { createMembershipConnectionGater, STRANGER_OPEN_PROTOCOLS, DEFAULT_ENROLLMENT_WINDOW_MS, RELAY_ADMISSION_RESERVE_DEADLINE_MS, RELAY_ADMISSION_CLOSE_TIMEOUT_MS, MAX_UNAUTHORIZED_RELAY_RESERVATIONS, UnauthorizedReservationBudget, type InboundAdmissionPolicy, type InboundConnectionVerdict } from './membership-connection-gater.js';
|
|
59
59
|
export { RelayReservationFailedError, UnbindableListenAddressError, RELAY_SEARCH_LISTEN_ADDR, resolveListenAddrs } from './relay-addrs.js';
|
|
60
60
|
export { strandNodeAddrs, type StrandNodeAddrs } from './strand-network-config.js';
|
package/dist/index.js
CHANGED
|
@@ -54,17 +54,16 @@ export { MemoryEnrolledMachineStore, PersistentEnrolledMachineStore } from './en
|
|
|
54
54
|
// Cross-platform: its durable form rides the KeyStore seam above (the record carries a
|
|
55
55
|
// closed strand's read secret), so there is no file-backed subpath.
|
|
56
56
|
export { MemoryJoinedStrandStore, KeyStoreJoinedStrandStore } from './joined-strand-store.js';
|
|
57
|
-
// Node-local strand
|
|
58
|
-
//
|
|
59
|
-
// re-
|
|
60
|
-
// above — interface + in-memory + slot-backed stores
|
|
61
|
-
//
|
|
62
|
-
export {
|
|
63
|
-
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
export {
|
|
67
|
-
export { StrandPeerBookSwap, STRAND_PEER_BOOK_SWAP_THROTTLE_MS, OWN_ENTRY_RESIGN_DEBOUNCE_MS } from './strand-peer-book-swap.js';
|
|
57
|
+
// Node-local strand network state: per strand, the state Optimystic's db-p2p saves for
|
|
58
|
+
// the strand node (its FRET routing table with each peer's signed address record), so a
|
|
59
|
+
// restarted strand node re-imports the peers it was talking to. Same cross-platform
|
|
60
|
+
// split as the bootstrap-peer store above — interface + in-memory + slot-backed stores
|
|
61
|
+
// here, Node-only file backend behind '@serfab/cadre-core/strand-network-state-file'.
|
|
62
|
+
export { MemoryStrandNetworkStateStore, PersistentStrandNetworkStateStore, strandNetworkStatePersistence } from './strand-network-state.js';
|
|
63
|
+
// The signed address records a running strand node's FRET table holds, as per-peer dial
|
|
64
|
+
// addresses: what the periodic refresh re-merges into the node's address book, and a
|
|
65
|
+
// diagnostic for "whom could this strand node redial right now?".
|
|
66
|
+
export { strandFretPeerAddrs } from './strand-fret-addrs.js';
|
|
68
67
|
// Storage scope keys — what `CadreNodeConfig.storage.provider` is called with. A
|
|
69
68
|
// strand's key is its strand id; the control database's key carries the party id,
|
|
70
69
|
// so two parties on one device never share a control store. Every key stays within
|
|
@@ -156,14 +155,18 @@ export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_
|
|
|
156
155
|
export { dialPeerAddrs, SelfRelayOnlyError, tryAddrsInTurn, directBeforeRelayed, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS, CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS, DEFAULT_PEER_DIAL_BUDGET } from './peer-dial.js';
|
|
157
156
|
// Dial and reservation budgets counted in link round trips rather than fixed milliseconds, so
|
|
158
157
|
// one declared assumption about the link moves them all — see `NetworkConfig.linkRoundTripMs`.
|
|
159
|
-
export { DECLARED_LINK_ROUND_TRIP_MS, RELAYED_DIAL_ROUND_TRIPS, RELAY_RESERVATION_ROUND_TRIPS, CIRCUIT_REQUEST_ROUND_TRIPS, RELAYED_REQUEST_ROUND_TRIPS, PUSH_TRANSFER_ALLOWANCE_MS, ADMISSION_DECISION_TIMEOUT_MS, resolveLinkRoundTripMs, relayedDialBudgetMs, relayReservationBudgetMs, circuitRequestBudgetMs, relayedRequestBudgetMs, peerJoinPushBudget } from './link-budget.js';
|
|
158
|
+
export { DECLARED_LINK_ROUND_TRIP_MS, CIRCUIT_DIAL_ROUND_TRIPS, RELAY_DIAL_ROUND_TRIPS, RELAYED_DIAL_ROUND_TRIPS, RELAY_RESERVATION_ROUND_TRIPS, CIRCUIT_REQUEST_ROUND_TRIPS, RELAYED_REQUEST_ROUND_TRIPS, PUSH_TRANSFER_ALLOWANCE_MS, ADMISSION_DECISION_TIMEOUT_MS, resolveLinkRoundTripMs, relayedDialBudgetMs, relayReservationBudgetMs, circuitRequestBudgetMs, relayedRequestBudgetMs, peerJoinPushBudget, DIAL_ADMISSION_DECISIONS, optimysticDialLimits } from './link-budget.js';
|
|
160
159
|
// Seed trust policy (trust anchor for incoming seeds)
|
|
161
160
|
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy } from './seed-trust-policy.js';
|
|
162
161
|
// Schema Verification
|
|
163
162
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
164
163
|
// Strand Formation transport (native cadre-core protocol)
|
|
165
|
-
export { FormationListener, dialFormation, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL } from './strand-formation-protocol.js';
|
|
164
|
+
export { FormationListener, dialFormation, dialFormationByMachine, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL } from './strand-formation-protocol.js';
|
|
165
|
+
// How a formation dial fails: a typed refusal (with a fixed code) or no answer at all
|
|
166
|
+
export { FormationRejectedError, FormationUnreachableError, FormationPostApprovalError, FORMATION_REJECTION_RETRYABLE, isFormationRejectionCode } from './strand-formation-rejection.js';
|
|
166
167
|
export { formationDeadlines } from './strand-formation-deadlines.js';
|
|
168
|
+
// The pending-join retry loop behind CadreNode.requestJoin (PendingJoinStatus is in types.ts)
|
|
169
|
+
export { PENDING_JOIN_POLL_MS, PENDING_JOIN_MAX_BACKOFF_MS, MAX_PENDING_JOIN_MS } from './pending-join-runner.js';
|
|
167
170
|
// Strand Formation manager (drives the native transport)
|
|
168
171
|
export { StrandFormationManager, createStrandFormationManager, MEMBERSHIP_INVITE_TTL_MS, MEMBERSHIP_INVITE_UNAVAILABLE_REASON, HOST_STRAND_MUST_BE_RECREATED_REASON } from './strand-formation-manager.js';
|
|
169
172
|
// Control-network inbound connection gate (membership defense-in-depth)
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,YAAY,CAAC;AAE3B,+DAA+D;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,uBAAuB;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,mBAAmB;AACnB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,eAAe,EAAwO,MAAM,uBAAuB,CAAC;AAElZ,+EAA+E;AAC/E,qFAAqF;AACrF,yCAAyC;AACzC,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,oBAAoB,EACpB,wBAAwB,EACxB,8BAA8B,EAC9B,4BAA4B,EAC5B,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAElC,gFAAgF;AAChF,yFAAyF;AACzF,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AAWjC,2FAA2F;AAC3F,OAAO,EAAE,0BAA0B,EAA0C,MAAM,4BAA4B,CAAC;AAEhH,2DAA2D;AAC3D,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,0BAA0B,EAAuB,MAAM,kBAAkB,CAAC;AAE1I,2EAA2E;AAC3E,gFAAgF;AAChF,8EA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,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which of the inviting party's other machines an open invitation names, so a joiner can still
|
|
3
|
+
* form while the machine that minted it is offline. The minting machine's own addresses go
|
|
4
|
+
* first and are not chosen here (`CadreNode.createOpenInvitation`).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* At most this many of the party's other machines are named, each with at most
|
|
8
|
+
* {@link INVITATION_ADDRS_PER_SIBLING} addresses: 12 extra addresses of roughly 100–200
|
|
9
|
+
* characters, base64url-encoded into an invitation shared as text.
|
|
10
|
+
*
|
|
11
|
+
* NOTE: if invitations are ever carried in a QR code, lower these caps or name the machines by
|
|
12
|
+
* peer id only.
|
|
13
|
+
* NOTE: the per-machine cap keeps the record's order (relay first, then direct addresses as the
|
|
14
|
+
* machine published them, loopback included). If a sibling with many interfaces is seen to have
|
|
15
|
+
* its reachable address cut, rank loopback and private addresses last before slicing.
|
|
16
|
+
*/
|
|
17
|
+
export declare const INVITATION_SIBLING_MACHINES = 3;
|
|
18
|
+
export declare const INVITATION_ADDRS_PER_SIBLING = 4;
|
|
19
|
+
/** One other machine of the party whose signed address record resolved. */
|
|
20
|
+
export interface InvitationSibling {
|
|
21
|
+
peerId: string;
|
|
22
|
+
/** The record's `UpdatedAt`: when the machine last published its addresses. */
|
|
23
|
+
updatedAt: number;
|
|
24
|
+
/** Relay (signaling) addresses first, each ending in `/p2p/<peerId>`. */
|
|
25
|
+
addrs: string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The addresses of the siblings an invitation names. Machines this node is connected to right
|
|
29
|
+
* now come first, since a live connection is the best evidence that a machine is up; a record
|
|
30
|
+
* shows only that it was up within the freshness window. Within each half, newest record first.
|
|
31
|
+
*/
|
|
32
|
+
export declare function selectInvitationSiblingAddrs(siblings: InvitationSibling[], connected: ReadonlySet<string>): string[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which of the inviting party's other machines an open invitation names, so a joiner can still
|
|
3
|
+
* form while the machine that minted it is offline. The minting machine's own addresses go
|
|
4
|
+
* first and are not chosen here (`CadreNode.createOpenInvitation`).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* At most this many of the party's other machines are named, each with at most
|
|
8
|
+
* {@link INVITATION_ADDRS_PER_SIBLING} addresses: 12 extra addresses of roughly 100–200
|
|
9
|
+
* characters, base64url-encoded into an invitation shared as text.
|
|
10
|
+
*
|
|
11
|
+
* NOTE: if invitations are ever carried in a QR code, lower these caps or name the machines by
|
|
12
|
+
* peer id only.
|
|
13
|
+
* NOTE: the per-machine cap keeps the record's order (relay first, then direct addresses as the
|
|
14
|
+
* machine published them, loopback included). If a sibling with many interfaces is seen to have
|
|
15
|
+
* its reachable address cut, rank loopback and private addresses last before slicing.
|
|
16
|
+
*/
|
|
17
|
+
export const INVITATION_SIBLING_MACHINES = 3;
|
|
18
|
+
export const INVITATION_ADDRS_PER_SIBLING = 4;
|
|
19
|
+
/**
|
|
20
|
+
* The addresses of the siblings an invitation names. Machines this node is connected to right
|
|
21
|
+
* now come first, since a live connection is the best evidence that a machine is up; a record
|
|
22
|
+
* shows only that it was up within the freshness window. Within each half, newest record first.
|
|
23
|
+
*/
|
|
24
|
+
export function selectInvitationSiblingAddrs(siblings, connected) {
|
|
25
|
+
return [...siblings]
|
|
26
|
+
.sort((a, b) => Number(connected.has(b.peerId)) - Number(connected.has(a.peerId)) || b.updatedAt - a.updatedAt)
|
|
27
|
+
.slice(0, INVITATION_SIBLING_MACHINES)
|
|
28
|
+
.flatMap((sibling) => sibling.addrs.slice(0, INVITATION_ADDRS_PER_SIBLING));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=invitation-bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invitation-bootstrap.js","sourceRoot":"","sources":["../src/invitation-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAC7C,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAW9C;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAAC,QAA6B,EAAE,SAA8B;IACzG,OAAO,CAAC,GAAG,QAAQ,CAAC;SAClB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;SAC9G,KAAK,CAAC,CAAC,EAAE,2BAA2B,CAAC;SACrC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,4BAA4B,CAAC,CAAC,CAAC;AAC9E,CAAC"}
|