@serfab/cadre-core 0.10.0 → 0.12.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/README.md +255 -255
- package/dist/announce-addrs.d.ts +49 -0
- package/dist/announce-addrs.js +78 -0
- package/dist/announce-addrs.js.map +1 -0
- package/dist/cadre-node.d.ts +484 -58
- package/dist/cadre-node.js +953 -182
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-cohort.d.ts +26 -0
- package/dist/control-cohort.js +26 -0
- package/dist/control-cohort.js.map +1 -1
- package/dist/control-database.d.ts +222 -125
- package/dist/control-database.js +356 -266
- package/dist/control-database.js.map +1 -1
- package/dist/control-formation-recorder.d.ts +8 -7
- package/dist/control-formation-recorder.js +8 -7
- package/dist/control-formation-recorder.js.map +1 -1
- package/dist/control-read-retry.d.ts +103 -0
- package/dist/control-read-retry.js +145 -0
- package/dist/control-read-retry.js.map +1 -0
- package/dist/control-retry.d.ts +101 -0
- package/dist/control-retry.js +108 -0
- package/dist/control-retry.js.map +1 -0
- package/dist/control-schema.d.ts +1 -1
- package/dist/control-schema.js +805 -774
- package/dist/control-schema.js.map +1 -1
- package/dist/control-write-retry.d.ts +65 -31
- package/dist/control-write-retry.js +33 -103
- package/dist/control-write-retry.js.map +1 -1
- package/dist/delegate-admission.d.ts +17 -15
- package/dist/delegate-admission.js +17 -15
- package/dist/delegate-admission.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +18 -9
- package/dist/index.js.map +1 -1
- package/dist/membership-connection-gater.d.ts +211 -25
- package/dist/membership-connection-gater.js +309 -29
- package/dist/membership-connection-gater.js.map +1 -1
- package/dist/peer-addr-book.d.ts +92 -0
- package/dist/peer-addr-book.js +220 -0
- package/dist/peer-addr-book.js.map +1 -0
- package/dist/peer-record.d.ts +26 -0
- package/dist/peer-record.js +32 -0
- package/dist/peer-record.js.map +1 -1
- package/dist/relay-addrs.d.ts +76 -26
- package/dist/relay-addrs.js +115 -27
- package/dist/relay-addrs.js.map +1 -1
- package/dist/relay-reservation.d.ts +20 -15
- package/dist/relay-reservation.js +18 -14
- package/dist/relay-reservation.js.map +1 -1
- package/dist/seed-bootstrap.d.ts +7 -0
- package/dist/seed-bootstrap.js +15 -13
- package/dist/seed-bootstrap.js.map +1 -1
- package/dist/strand-addr-protocol.js +16 -0
- package/dist/strand-addr-protocol.js.map +1 -1
- package/dist/strand-backfill.js +13 -4
- package/dist/strand-backfill.js.map +1 -1
- package/dist/strand-cohort.d.ts +4 -37
- package/dist/strand-cohort.js +4 -15
- package/dist/strand-cohort.js.map +1 -1
- package/dist/strand-database.d.ts +11 -16
- package/dist/strand-database.js +19 -7
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-formation-manager.d.ts +18 -17
- package/dist/strand-formation-manager.js +25 -27
- package/dist/strand-formation-manager.js.map +1 -1
- package/dist/strand-formation-protocol.d.ts +7 -7
- package/dist/strand-formation-protocol.js +8 -8
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +53 -21
- package/dist/strand-instance-manager.js +128 -37
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-writer.d.ts +113 -19
- package/dist/strand-membership-writer.js +219 -51
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-solicitation.d.ts +3 -3
- package/dist/strand-solicitation.js +4 -5
- package/dist/strand-solicitation.js.map +1 -1
- package/dist/strand-wake-protocol.d.ts +47 -2
- package/dist/strand-wake-protocol.js +76 -6
- package/dist/strand-wake-protocol.js.map +1 -1
- package/dist/types.d.ts +107 -54
- package/dist/types.js.map +1 -1
- package/package.json +8 -7
- package/src/announce-addrs.ts +93 -0
- package/src/arachnode-stub.ts +159 -159
- package/src/bootstrap-peer-store-file.ts +44 -44
- package/src/bootstrap-peer-store.ts +172 -172
- package/src/cadre-node.ts +1026 -194
- package/src/canonical-json.ts +30 -30
- package/src/control-authorization.ts +114 -114
- package/src/control-cohort.ts +130 -103
- package/src/control-database.ts +376 -298
- package/src/control-formation-recorder.ts +305 -304
- package/src/control-read-retry.ts +167 -0
- package/src/control-retry.ts +190 -0
- package/src/control-schema.ts +817 -786
- package/src/control-stream.ts +205 -205
- package/src/control-write-retry.ts +383 -473
- package/src/delegate-admission.ts +304 -302
- package/src/device-token.ts +94 -94
- package/src/diagnostics/connection-path.ts +277 -277
- package/src/diagnostics/webrtc-turn-tracker.ts +222 -222
- package/src/ed25519-key.ts +134 -134
- package/src/enrollment.ts +199 -199
- package/src/file-durable-slot.ts +61 -61
- package/src/formation-approval.ts +604 -604
- package/src/fs-atomic.ts +107 -107
- package/src/hibernation-manager.ts +437 -437
- package/src/identity-key.ts +109 -109
- package/src/index.ts +435 -406
- package/src/key-store-file.ts +132 -132
- package/src/key-store.ts +99 -99
- package/src/membership-connection-gater.ts +368 -39
- package/src/node-local-snapshot.ts +260 -260
- package/src/peer-addr-book.ts +250 -0
- package/src/peer-authorization.ts +259 -259
- package/src/peer-record.ts +197 -164
- package/src/push-credentials.ts +84 -84
- package/src/push-node.ts +64 -64
- package/src/push-notifier-apns.ts +247 -247
- package/src/push-notifier-fcm.ts +220 -220
- package/src/push-notifier-shared.ts +28 -28
- package/src/push-notifier.ts +52 -52
- package/src/relay-addrs.ts +134 -27
- package/src/relay-reservation.ts +22 -17
- package/src/seed-bootstrap.ts +15 -15
- package/src/seed-trust-policy.ts +140 -140
- package/src/strand-addr-protocol.ts +458 -441
- package/src/strand-backfill.ts +28 -5
- package/src/strand-cohort.ts +38 -77
- package/src/strand-database.ts +202 -204
- package/src/strand-formation-manager.ts +26 -28
- package/src/strand-formation-protocol.ts +692 -692
- package/src/strand-instance-manager.ts +636 -553
- package/src/strand-member-key.ts +39 -39
- package/src/strand-member-registry.ts +182 -182
- package/src/strand-membership-writer.ts +1627 -1430
- package/src/strand-solicitation.ts +471 -472
- package/src/strand-transport-key.ts +58 -58
- package/src/strand-wake-payload.ts +32 -32
- package/src/strand-wake-protocol.ts +400 -314
- package/src/strand-watcher.ts +314 -314
- package/src/trusted-owner-store-file.ts +41 -41
- package/src/trusted-owner-store.ts +171 -171
- package/src/types.ts +1354 -1303
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-schema.js","sourceRoot":"","sources":["../src/control-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG
|
|
1
|
+
{"version":3,"file":"control-schema.js","sourceRoot":"","sources":["../src/control-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAqyBH,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ControlRetryOptions } from './control-retry.js';
|
|
1
2
|
/**
|
|
2
3
|
* Bounded retry for TRANSIENT control-write failures — the classifier and loop behind
|
|
3
4
|
* `ControlDatabase.lockedWithRetry`, the single funnel every local control write passes
|
|
@@ -24,7 +25,9 @@
|
|
|
24
25
|
* list must be safe for all ~19 callers.
|
|
25
26
|
*
|
|
26
27
|
* Lives outside `control-database.ts` so a spec can drive the classifier against real engine
|
|
27
|
-
* errors without importing the whole database class.
|
|
28
|
+
* errors without importing the whole database class. The loop itself lives in
|
|
29
|
+
* `control-retry.ts`, shared with the READ policy (`control-read-retry.ts`) — this module
|
|
30
|
+
* owns the write policies: their classifiers, attempt counts, backoff and budget.
|
|
28
31
|
*/
|
|
29
32
|
/**
|
|
30
33
|
* Attempts allowed per control write: the first, plus two retries of a transiently-failed
|
|
@@ -62,13 +65,58 @@ export declare const SCHEMA_INIT_ATTEMPTS = 5;
|
|
|
62
65
|
* and retry adds ZERO latency to the case where it cannot help.
|
|
63
66
|
*/
|
|
64
67
|
export declare const CONTROL_WRITE_RETRY_BUDGET_MS = 10000;
|
|
68
|
+
/**
|
|
69
|
+
* Is this a transactor aggregate from a phase where nothing can have committed yet?
|
|
70
|
+
*
|
|
71
|
+
* The transactor raises `Some peers did not complete:` from three sites
|
|
72
|
+
* (`db-core/src/transactor/network-transactor.ts`), and only two of them are safe to
|
|
73
|
+
* re-present:
|
|
74
|
+
*
|
|
75
|
+
* - `get` (a block read, which a write body also performs) and `pend` (phase 1) fail before
|
|
76
|
+
* anything commits, so the write is known not to have landed;
|
|
77
|
+
* - `commitBlocks` (phase 2) is REACHABLE here and NOT safe. `commitBlock` throws the
|
|
78
|
+
* aggregate when a header/tail commit got NO response at all — precisely the transient
|
|
79
|
+
* class this retry targets — and that escapes `commit()`, survives `TransactorSource`'s
|
|
80
|
+
* cancel-and-rethrow (cancel reaches PENDING actions only; a peer that already committed
|
|
81
|
+
* stays committed) and `Collection.syncInternal` (which retries StaleFailure RETURN values,
|
|
82
|
+
* not throws), reaching this funnel QuereusError-wrapped. The tail commit is one batch to
|
|
83
|
+
* one coordinator running consensus internally, so a no-response there is INDETERMINATE:
|
|
84
|
+
* the commit may have completed with only the response lost. Re-running the write body over
|
|
85
|
+
* a write that landed turns a success into a constraint failure (e.g.
|
|
86
|
+
* `UNIQUE constraint failed: CadrePeer.PeerId`). Surfacing the transient error instead lets
|
|
87
|
+
* the caller re-read committed state and decide. Commit-phase messages are vetoed by
|
|
88
|
+
* {@link reportsIndeterminateCommit}, not here.
|
|
89
|
+
*
|
|
90
|
+
* The `cause` chain does not discriminate the phases — a commit-phase aggregate carries the
|
|
91
|
+
* same stream-reset/dial error a pend-phase one does. The per-batch DETAIL text does: `get`
|
|
92
|
+
* and `pend` format `<peerId>[block:<id>](<status>)`, `commitBlocks` formats
|
|
93
|
+
* `<peerId>[blocks:<count>](<status>)`. `[block:` cannot occur inside `[blocks:`, so the two
|
|
94
|
+
* tokens are disjoint and separate the phases.
|
|
95
|
+
*
|
|
96
|
+
* NOTE: the discriminator is a formatting detail of another repo. If Optimystic ever reformats
|
|
97
|
+
* those per-batch details, this fails CLOSED — the aggregate stops matching and control writes
|
|
98
|
+
* simply stop being retried, silently losing the absorption rather than doing anything unsafe.
|
|
99
|
+
* The guard against that is live: `control-write-degraded-cohort-member.integration.ts` asserts
|
|
100
|
+
* this classifier against the real degraded-cohort failure object and asserts the `[block:`
|
|
101
|
+
* token on the live aggregate; if it reddens there, an upstream reformat is the first thing to
|
|
102
|
+
* check.
|
|
103
|
+
*
|
|
104
|
+
* An aggregate whose details came out EMPTY (possible when `formatBatchStatuses` has no
|
|
105
|
+
* batches to format) carries neither token, matches nothing here, and is not retried — an
|
|
106
|
+
* unattributable failure is not a proven non-commit.
|
|
107
|
+
*
|
|
108
|
+
* Exported for the READ classifier (`control-read-retry.ts`), which reuses it verbatim: a
|
|
109
|
+
* `get` batch formats the same single-block `[block:` token, and a read can never produce
|
|
110
|
+
* the commit-phase `[blocks:` shape at all.
|
|
111
|
+
*/
|
|
112
|
+
export declare function isUncommittedTransactorAggregate(message: string): boolean;
|
|
65
113
|
/**
|
|
66
114
|
* Did this control write fail because the cluster cohort did not ANSWER — i.e. is
|
|
67
115
|
* re-presenting the SAME signed write a moment later the right response?
|
|
68
116
|
*
|
|
69
|
-
* Classifies by MESSAGE, walking the `cause` chain with
|
|
70
|
-
*
|
|
71
|
-
* recognisable by type. The transactor and the coordinator both throw bare `Error`s, and by
|
|
117
|
+
* Classifies by MESSAGE, walking the `cause` chain with the shared {@link chainMessages}
|
|
118
|
+
* (Quereus' own `unwrapError` underneath) —
|
|
119
|
+
* the failure surface is not recognisable by type. The transactor and the coordinator both throw bare `Error`s, and by
|
|
72
120
|
* the time one reaches `ControlDatabase` it is wrapped in a `QuereusError` (the real chain
|
|
73
121
|
* is `QuereusError` → `Error` → `Error`), so the match must work at any depth. Anything
|
|
74
122
|
* that is not an `Error` is never retried.
|
|
@@ -78,10 +126,12 @@ export declare const CONTROL_WRITE_RETRY_BUDGET_MS = 10000;
|
|
|
78
126
|
* other level looking transient.
|
|
79
127
|
*
|
|
80
128
|
* NOTE: this depends on engine/transactor error TEXT. The messages producible without a
|
|
81
|
-
* network are driven from the REAL engine in `control-formation-
|
|
129
|
+
* network are driven from the REAL engine in `control-formation-seat-budget.spec.ts`, so
|
|
82
130
|
* a rewording reddens a spec rather than silently disabling the retry. The two RETRIABLE
|
|
83
|
-
* messages need a real multi-node cluster to produce
|
|
84
|
-
* `control-write-
|
|
131
|
+
* messages need a real multi-node cluster to produce; the degraded-cohort scenario
|
|
132
|
+
* (`control-write-degraded-cohort-member.integration.ts`) asserts this classifier against
|
|
133
|
+
* both LIVE — the super-majority shortfall from a real silent member, and the transactor
|
|
134
|
+
* aggregate from a real stream reset, which the retry there absorbs end to end.
|
|
85
135
|
*/
|
|
86
136
|
export declare function isRetriableControlWriteFailure(error: unknown): boolean;
|
|
87
137
|
/**
|
|
@@ -93,32 +143,16 @@ export declare function isRetriableControlWriteFailure(error: unknown): boolean;
|
|
|
93
143
|
*/
|
|
94
144
|
export declare function isRetriableSchemaInitFailure(error: unknown): boolean;
|
|
95
145
|
/**
|
|
96
|
-
* Policy and pacing for {@link retryControlWrite}. Production callers pass nothing
|
|
97
|
-
* policy such as {@link SCHEMA_INIT_RETRY_POLICY}); specs inject a recorded
|
|
98
|
-
* delay list, or a fake clock so no test ever waits out a real backoff.
|
|
146
|
+
* Policy and pacing overrides for {@link retryControlWrite}. Production callers pass nothing
|
|
147
|
+
* (or a named policy such as {@link SCHEMA_INIT_RETRY_POLICY}); specs inject a recorded
|
|
148
|
+
* `sleep`, a shorter delay list, or a fake clock so no test ever waits out a real backoff.
|
|
99
149
|
*
|
|
100
|
-
* Every field defaults to the shipped control-write policy
|
|
101
|
-
*
|
|
150
|
+
* Every field defaults to the shipped control-write policy ({@link CONTROL_WRITE_ATTEMPTS},
|
|
151
|
+
* {@link CONTROL_WRITE_RETRY_DELAYS_MS}, {@link isRetriableControlWriteFailure}), so an
|
|
152
|
+
* omitted field is byte-identical to the behaviour before per-call-site policies existed.
|
|
153
|
+
* The field shapes and semantics live on the shared {@link ControlRetryOptions}.
|
|
102
154
|
*/
|
|
103
|
-
export
|
|
104
|
-
/**
|
|
105
|
-
* Total attempts, first included. Default {@link CONTROL_WRITE_ATTEMPTS}, floored at 1 —
|
|
106
|
-
* below that the loop would run the body zero times and rethrow a `lastError` nobody set.
|
|
107
|
-
*/
|
|
108
|
-
attempts?: number;
|
|
109
|
-
/** Backoff base before retry N (last entry repeats). Default {@link CONTROL_WRITE_RETRY_DELAYS_MS}. */
|
|
110
|
-
delaysMs?: readonly number[];
|
|
111
|
-
/**
|
|
112
|
-
* Which failures are transient enough to re-present. Default
|
|
113
|
-
* {@link isRetriableControlWriteFailure}; the only other shipped value is
|
|
114
|
-
* {@link isRetriableSchemaInitFailure}, via {@link SCHEMA_INIT_RETRY_POLICY}.
|
|
115
|
-
*/
|
|
116
|
-
isRetriable?: (error: unknown) => boolean;
|
|
117
|
-
/** The sleep primitive. Default: `setTimeout`. */
|
|
118
|
-
sleep?: (ms: number) => Promise<void>;
|
|
119
|
-
/** Clock for the elapsed-budget check. Default: `Date.now`. */
|
|
120
|
-
now?: () => number;
|
|
121
|
-
}
|
|
155
|
+
export type ControlWriteRetryOptions = ControlRetryOptions;
|
|
122
156
|
/**
|
|
123
157
|
* The one non-default retry policy: `ControlDatabase.loadSchema`'s distributed DDL, which
|
|
124
158
|
* additionally absorbs optimystic's self-coordination grace refusal and gets more attempts over a
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { unwrapError } from '@quereus/quereus';
|
|
3
|
-
const log = debug('sereus:cadre:control-db');
|
|
1
|
+
import { chainMessages, retryControlOperation } from './control-retry.js';
|
|
4
2
|
/**
|
|
5
3
|
* Bounded retry for TRANSIENT control-write failures — the classifier and loop behind
|
|
6
4
|
* `ControlDatabase.lockedWithRetry`, the single funnel every local control write passes
|
|
@@ -27,7 +25,9 @@ const log = debug('sereus:cadre:control-db');
|
|
|
27
25
|
* list must be safe for all ~19 callers.
|
|
28
26
|
*
|
|
29
27
|
* Lives outside `control-database.ts` so a spec can drive the classifier against real engine
|
|
30
|
-
* errors without importing the whole database class.
|
|
28
|
+
* errors without importing the whole database class. The loop itself lives in
|
|
29
|
+
* `control-retry.ts`, shared with the READ policy (`control-read-retry.ts`) — this module
|
|
30
|
+
* owns the write policies: their classifiers, attempt counts, backoff and budget.
|
|
31
31
|
*/
|
|
32
32
|
/**
|
|
33
33
|
* Attempts allowed per control write: the first, plus two retries of a transiently-failed
|
|
@@ -146,15 +146,20 @@ const SUPER_MAJORITY_SHORTFALL_UNANSWERED = /Failed to get super-majority: \d+\/
|
|
|
146
146
|
* NOTE: the discriminator is a formatting detail of another repo. If Optimystic ever reformats
|
|
147
147
|
* those per-batch details, this fails CLOSED — the aggregate stops matching and control writes
|
|
148
148
|
* simply stop being retried, silently losing the absorption rather than doing anything unsafe.
|
|
149
|
-
* The guard against that is
|
|
150
|
-
*
|
|
151
|
-
* reformat is the first thing to
|
|
149
|
+
* The guard against that is live: `control-write-degraded-cohort-member.integration.ts` asserts
|
|
150
|
+
* this classifier against the real degraded-cohort failure object and asserts the `[block:`
|
|
151
|
+
* token on the live aggregate; if it reddens there, an upstream reformat is the first thing to
|
|
152
|
+
* check.
|
|
152
153
|
*
|
|
153
154
|
* An aggregate whose details came out EMPTY (possible when `formatBatchStatuses` has no
|
|
154
155
|
* batches to format) carries neither token, matches nothing here, and is not retried — an
|
|
155
156
|
* unattributable failure is not a proven non-commit.
|
|
157
|
+
*
|
|
158
|
+
* Exported for the READ classifier (`control-read-retry.ts`), which reuses it verbatim: a
|
|
159
|
+
* `get` batch formats the same single-block `[block:` token, and a read can never produce
|
|
160
|
+
* the commit-phase `[blocks:` shape at all.
|
|
156
161
|
*/
|
|
157
|
-
function isUncommittedTransactorAggregate(message) {
|
|
162
|
+
export function isUncommittedTransactorAggregate(message) {
|
|
158
163
|
return TRANSACTOR_AGGREGATE.test(message) && message.includes(SINGLE_BLOCK_BATCH_TOKEN);
|
|
159
164
|
}
|
|
160
165
|
/**
|
|
@@ -201,24 +206,6 @@ const SELF_COORDINATION_GRACE_REFUSAL = /Self-coordination blocked: grace-period
|
|
|
201
206
|
function isSelfCoordinationGraceRefusal(message) {
|
|
202
207
|
return SELF_COORDINATION_GRACE_REFUSAL.test(message);
|
|
203
208
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Every message in the failure's `cause` chain.
|
|
206
|
-
*
|
|
207
|
-
* `unwrapError` declares its `message` as `string`, but it follows `.cause` without checking what
|
|
208
|
-
* that holds — a chain link that is not an `Error` (a stream rejected with a bare string reason,
|
|
209
|
-
* an `AbortSignal.reason` that is a plain object) yields `undefined` there, and calling
|
|
210
|
-
* `.includes` on it would throw a `TypeError` out of this classifier, INSIDE `retryControlWrite`'s
|
|
211
|
-
* catch, replacing the real control-write failure with a confusing one. Non-strings are dropped:
|
|
212
|
-
* a link nobody can read is a link that matches nothing, which is already the conservative answer.
|
|
213
|
-
*
|
|
214
|
-
* NOTE: a cause chain with a CYCLE would spin forever inside `unwrapError` itself. No error in
|
|
215
|
-
* this repo builds one; if a hang ever localises to a control-write failure path, look there.
|
|
216
|
-
*/
|
|
217
|
-
function chainMessages(error) {
|
|
218
|
-
return unwrapError(error)
|
|
219
|
-
.map(({ message }) => message)
|
|
220
|
-
.filter(message => typeof message === 'string');
|
|
221
|
-
}
|
|
222
209
|
/**
|
|
223
210
|
* The error messages that mean "the cohort did not answer AND nothing committed", and nothing
|
|
224
211
|
* else. The observed one-shot failure was `registerSelf()` racing a connection still forming:
|
|
@@ -226,9 +213,8 @@ function chainMessages(error) {
|
|
|
226
213
|
*
|
|
227
214
|
* Deliberately NOT matched: every constraint / authorization failure
|
|
228
215
|
* (`CHECK constraint failed:`, `UNIQUE constraint failed:`) — those reach the same funnel
|
|
229
|
-
* and must be retried zero times
|
|
230
|
-
*
|
|
231
|
-
* classifier and that one are DISJOINT and the two retry loops can never multiply.
|
|
216
|
+
* and must be retried zero times: the cohort REFUSED the write, so re-presenting it
|
|
217
|
+
* re-presents a spent signature and can never commit.
|
|
232
218
|
*/
|
|
233
219
|
const RETRIABLE_CONTROL_WRITE_MATCHERS = [
|
|
234
220
|
isUncommittedTransactorAggregate,
|
|
@@ -260,9 +246,9 @@ const RETRIABLE_SCHEMA_INIT_MATCHERS = [
|
|
|
260
246
|
* Did this control write fail because the cluster cohort did not ANSWER — i.e. is
|
|
261
247
|
* re-presenting the SAME signed write a moment later the right response?
|
|
262
248
|
*
|
|
263
|
-
* Classifies by MESSAGE, walking the `cause` chain with
|
|
264
|
-
*
|
|
265
|
-
* recognisable by type. The transactor and the coordinator both throw bare `Error`s, and by
|
|
249
|
+
* Classifies by MESSAGE, walking the `cause` chain with the shared {@link chainMessages}
|
|
250
|
+
* (Quereus' own `unwrapError` underneath) —
|
|
251
|
+
* the failure surface is not recognisable by type. The transactor and the coordinator both throw bare `Error`s, and by
|
|
266
252
|
* the time one reaches `ControlDatabase` it is wrapped in a `QuereusError` (the real chain
|
|
267
253
|
* is `QuereusError` → `Error` → `Error`), so the match must work at any depth. Anything
|
|
268
254
|
* that is not an `Error` is never retried.
|
|
@@ -272,10 +258,12 @@ const RETRIABLE_SCHEMA_INIT_MATCHERS = [
|
|
|
272
258
|
* other level looking transient.
|
|
273
259
|
*
|
|
274
260
|
* NOTE: this depends on engine/transactor error TEXT. The messages producible without a
|
|
275
|
-
* network are driven from the REAL engine in `control-formation-
|
|
261
|
+
* network are driven from the REAL engine in `control-formation-seat-budget.spec.ts`, so
|
|
276
262
|
* a rewording reddens a spec rather than silently disabling the retry. The two RETRIABLE
|
|
277
|
-
* messages need a real multi-node cluster to produce
|
|
278
|
-
* `control-write-
|
|
263
|
+
* messages need a real multi-node cluster to produce; the degraded-cohort scenario
|
|
264
|
+
* (`control-write-degraded-cohort-member.integration.ts`) asserts this classifier against
|
|
265
|
+
* both LIVE — the super-majority shortfall from a real silent member, and the transactor
|
|
266
|
+
* aggregate from a real stream reset, which the retry there absorbs end to end.
|
|
279
267
|
*/
|
|
280
268
|
export function isRetriableControlWriteFailure(error) {
|
|
281
269
|
return matchesRetriableMessage(error, RETRIABLE_CONTROL_WRITE_MATCHERS);
|
|
@@ -339,73 +327,15 @@ export const SCHEMA_INIT_RETRY_POLICY = {
|
|
|
339
327
|
* so the exact messages downstream code and the degraded-cohort-member scenario assert on
|
|
340
328
|
* survive. A non-retriable failure propagates from the attempt that raised it.
|
|
341
329
|
*/
|
|
342
|
-
export
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
attemptsMade = attemptNumber;
|
|
353
|
-
try {
|
|
354
|
-
const result = await attempt();
|
|
355
|
-
if (attemptNumber > 1) {
|
|
356
|
-
log('Control write committed on attempt %d/%d', attemptNumber, attempts);
|
|
357
|
-
}
|
|
358
|
-
return result;
|
|
359
|
-
}
|
|
360
|
-
catch (error) {
|
|
361
|
-
if (!isRetriable(error)) {
|
|
362
|
-
// The ONLY trace that this funnel saw a failure and declined it. Without it the
|
|
363
|
-
// log is silent either way, so "the classifier vetoed this one" is
|
|
364
|
-
// indistinguishable from "the retry is not wired into this path at all".
|
|
365
|
-
// "here" is load-bearing: this fires for every non-transient failure, and some
|
|
366
|
-
// of them — the lost-use-number constraint failures — ARE retried by the OUTER
|
|
367
|
-
// loop (`ControlDatabase.withUseNumberRetry`) that this one nests inside.
|
|
368
|
-
log('Control write failed non-transiently on attempt %d/%d, not retried here: %s', attemptNumber, attempts, error);
|
|
369
|
-
throw error;
|
|
370
|
-
}
|
|
371
|
-
lastError = error;
|
|
372
|
-
if (attemptNumber === attempts) {
|
|
373
|
-
break;
|
|
374
|
-
}
|
|
375
|
-
const elapsed = now() - start;
|
|
376
|
-
if (elapsed >= CONTROL_WRITE_RETRY_BUDGET_MS) {
|
|
377
|
-
break;
|
|
378
|
-
}
|
|
379
|
-
const delay = jitteredDelay(delays, attemptNumber);
|
|
380
|
-
log('Control write failed transiently (attempt %d/%d), retrying in %d ms: %s', attemptNumber, attempts, delay, error);
|
|
381
|
-
await sleep(delay);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
log('Control write failed after %d/%d attempt(s): %s', attemptsMade, attempts, lastError);
|
|
385
|
-
throw lastError;
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Backoff for the retry that follows attempt `attemptNumber`: the matching base delay
|
|
389
|
-
* (last entry repeats), jittered ±50%, then capped at the list's largest base so no single
|
|
390
|
-
* sleep exceeds it (see {@link CONTROL_WRITE_RETRY_DELAYS_MS} for why). `Math.random` is
|
|
391
|
-
* fine here — the jitter only de-synchronizes concurrent retriers, nothing is derived
|
|
392
|
-
* from it.
|
|
393
|
-
*
|
|
394
|
-
* NOTE: the cap bites on the LAST delay, whose base IS the largest, so ~half of those sleeps
|
|
395
|
-
* land exactly on the cap rather than spread — de-synchronization is only partial there.
|
|
396
|
-
* Harmless while retriers are a handful of party nodes whose attempts already start seconds
|
|
397
|
-
* apart; if a party ever retries in a tight synchronized herd, raise the cap above the
|
|
398
|
-
* largest base instead of jittering about it.
|
|
399
|
-
*/
|
|
400
|
-
function jitteredDelay(delays, attemptNumber) {
|
|
401
|
-
if (delays.length === 0) {
|
|
402
|
-
return 0;
|
|
403
|
-
}
|
|
404
|
-
const base = delays[Math.min(attemptNumber - 1, delays.length - 1)];
|
|
405
|
-
const jittered = base * (0.5 + Math.random());
|
|
406
|
-
return Math.min(jittered, Math.max(...delays));
|
|
407
|
-
}
|
|
408
|
-
function defaultSleep(ms) {
|
|
409
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
330
|
+
export function retryControlWrite(attempt, options = {}) {
|
|
331
|
+
return retryControlOperation(attempt, {
|
|
332
|
+
attempts: CONTROL_WRITE_ATTEMPTS,
|
|
333
|
+
delaysMs: CONTROL_WRITE_RETRY_DELAYS_MS,
|
|
334
|
+
budgetMs: CONTROL_WRITE_RETRY_BUDGET_MS,
|
|
335
|
+
isRetriable: isRetriableControlWriteFailure,
|
|
336
|
+
// The default prefix, named anyway: the degraded-cohort scenario asserts on
|
|
337
|
+
// `Control write [<label>] …` lines byte-for-byte.
|
|
338
|
+
logPrefix: 'Control write',
|
|
339
|
+
}, options);
|
|
410
340
|
}
|
|
411
341
|
//# sourceMappingURL=control-write-retry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-write-retry.js","sourceRoot":"","sources":["../src/control-write-retry.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"control-write-retry.js","sourceRoot":"","sources":["../src/control-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MAAM,wBAAwB,GAAuC;IAC3E,QAAQ,EAAE,oBAAoB;IAC9B,QAAQ,EAAE,2BAA2B;IACrC,WAAW,EAAE,4BAA4B;CACzC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAChC,OAAyB,EACzB,UAAoC,EAAE;IAEtC,OAAO,qBAAqB,CAAC,OAAO,EAAE;QACrC,QAAQ,EAAE,sBAAsB;QAChC,QAAQ,EAAE,6BAA6B;QACvC,QAAQ,EAAE,6BAA6B;QACvC,WAAW,EAAE,8BAA8B;QAC3C,4EAA4E;QAC5E,mDAAmD;QACnD,SAAS,EAAE,eAAe;KAC1B,EAAE,OAAO,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -5,24 +5,26 @@
|
|
|
5
5
|
* A strand node runs as its own libp2p instance with its own transport peerId,
|
|
6
6
|
* derived from the cadre identity key + strandId (`strand-transport-key.ts`).
|
|
7
7
|
* That derivation uses the member's PRIVATE seed by design, so no third party —
|
|
8
|
-
* including a co-cadre relay — can recompute it
|
|
9
|
-
*
|
|
10
|
-
* relay's membership connection gater sees an unknown peerId and denies the
|
|
11
|
-
* connection, which kills the reservation and fails the strand's
|
|
12
|
-
* `libp2p.start()` outright.
|
|
8
|
+
* including a co-cadre relay — can recompute it: a sibling's relay sees an
|
|
9
|
+
* unknown peerId it has no way to place as a member.
|
|
13
10
|
*
|
|
14
|
-
* The resolution (docs/strands.md → "
|
|
11
|
+
* The resolution (docs/strands.md → "Relay willingness"): a party control
|
|
15
12
|
* node running a relay is party-private infrastructure — it relays for its own
|
|
16
13
|
* party's nodes, including the extra transport identities its members' strand
|
|
17
|
-
* nodes run as
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* (`CadreNode.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
14
|
+
* nodes run as. The mechanism is a **member-announced delegate grant**: before
|
|
15
|
+
* a member's control node starts a strand node, it tells its siblings (over the
|
|
16
|
+
* already-authenticated `/sereus/strand-addr/1.0.0` RPC) the derived peerId
|
|
17
|
+
* that strand node will use, and the receiver holds a short-lived, in-memory
|
|
18
|
+
* admission grant for exactly that peerId. The grant is consulted by the
|
|
19
|
+
* connection-level gate (`CadreNode.admitInboundControlConnection`) and by the
|
|
20
|
+
* relay-reservation admission (`CadreNode.admitControlRelayReservation`) — a
|
|
21
|
+
* granted delegate is admitted outright, never drawing on the small
|
|
22
|
+
* unauthorized-reservation budget that unplaced peers share
|
|
23
|
+
* (`membership-connection-gater.ts` → "The relay-reservation seam") and never
|
|
24
|
+
* racing its not-reserving connection deadline. The fail-closed per-stream gate
|
|
25
|
+
* (`authorizeInboundControlStream`) never honors a grant, so a delegate gets
|
|
26
|
+
* the connection and its reservation (all a circuit-relay `hop` needs) and
|
|
27
|
+
* nothing more.
|
|
26
28
|
*
|
|
27
29
|
* A grant is a delegation of trust to an already-trusted member: the receiver
|
|
28
30
|
* cannot verify that the announced peerId really is the member's strand node,
|
|
@@ -5,24 +5,26 @@
|
|
|
5
5
|
* A strand node runs as its own libp2p instance with its own transport peerId,
|
|
6
6
|
* derived from the cadre identity key + strandId (`strand-transport-key.ts`).
|
|
7
7
|
* That derivation uses the member's PRIVATE seed by design, so no third party —
|
|
8
|
-
* including a co-cadre relay — can recompute it
|
|
9
|
-
*
|
|
10
|
-
* relay's membership connection gater sees an unknown peerId and denies the
|
|
11
|
-
* connection, which kills the reservation and fails the strand's
|
|
12
|
-
* `libp2p.start()` outright.
|
|
8
|
+
* including a co-cadre relay — can recompute it: a sibling's relay sees an
|
|
9
|
+
* unknown peerId it has no way to place as a member.
|
|
13
10
|
*
|
|
14
|
-
* The resolution (docs/strands.md → "
|
|
11
|
+
* The resolution (docs/strands.md → "Relay willingness"): a party control
|
|
15
12
|
* node running a relay is party-private infrastructure — it relays for its own
|
|
16
13
|
* party's nodes, including the extra transport identities its members' strand
|
|
17
|
-
* nodes run as
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* (`CadreNode.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
14
|
+
* nodes run as. The mechanism is a **member-announced delegate grant**: before
|
|
15
|
+
* a member's control node starts a strand node, it tells its siblings (over the
|
|
16
|
+
* already-authenticated `/sereus/strand-addr/1.0.0` RPC) the derived peerId
|
|
17
|
+
* that strand node will use, and the receiver holds a short-lived, in-memory
|
|
18
|
+
* admission grant for exactly that peerId. The grant is consulted by the
|
|
19
|
+
* connection-level gate (`CadreNode.admitInboundControlConnection`) and by the
|
|
20
|
+
* relay-reservation admission (`CadreNode.admitControlRelayReservation`) — a
|
|
21
|
+
* granted delegate is admitted outright, never drawing on the small
|
|
22
|
+
* unauthorized-reservation budget that unplaced peers share
|
|
23
|
+
* (`membership-connection-gater.ts` → "The relay-reservation seam") and never
|
|
24
|
+
* racing its not-reserving connection deadline. The fail-closed per-stream gate
|
|
25
|
+
* (`authorizeInboundControlStream`) never honors a grant, so a delegate gets
|
|
26
|
+
* the connection and its reservation (all a circuit-relay `hop` needs) and
|
|
27
|
+
* nothing more.
|
|
26
28
|
*
|
|
27
29
|
* A grant is a delegation of trust to an already-trusted member: the receiver
|
|
28
30
|
* cannot verify that the announced peerId really is the member's strand node,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegate-admission.js","sourceRoot":"","sources":["../src/delegate-admission.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"delegate-admission.js","sourceRoot":"","sources":["../src/delegate-admission.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,GAAG,GAAG,KAAK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C,CAAC;IACzC,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,8BAA8B;IAC7D,OAAO;QACL,WAAW,EAAE,KAAK,CAAC,KAAK;QACxB,SAAS,EAAE,EAAE,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;KACrD,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,IAAY;IACtC,IAAI,CAAC;QACH,OAAO,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,GAAG,CAAC,uCAAuC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { canonicalJson } from './canonical-json.js';
|
|
|
3
3
|
export { CadreNode } from './cadre-node.js';
|
|
4
4
|
export { ControlDatabase, MissingHostStrandError, buildAuthorizationMessage, formationVouchMessage, formationConsentMessage, REAPABLE_TABLES, type ReapableTable, type ControlDatabaseConfig, type ControlTable, type RevocableTable, type FormationUsageResult, type MembershipChangeListener, type GuardedDeleteListener, type RevokedRowRef } from './control-database.js';
|
|
5
5
|
export { CONTROL_WRITE_ATTEMPTS, CONTROL_WRITE_RETRY_BUDGET_MS, SCHEMA_INIT_ATTEMPTS, SCHEMA_INIT_RETRY_POLICY, isRetriableControlWriteFailure, isRetriableSchemaInitFailure, retryControlWrite, type ControlWriteRetryOptions } from './control-write-retry.js';
|
|
6
|
+
export { CONTROL_READ_ATTEMPTS, CONTROL_READ_RETRY_DELAYS_MS, CONTROL_READ_RETRY_BUDGET_MS, isRetriableControlReadFailure, retryControlRead, type ControlReadRetryOptions } from './control-read-retry.js';
|
|
6
7
|
export { controlAuthorizationFields, type ControlDomain, type ControlAction } from './control-authorization.js';
|
|
7
8
|
export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, requireEd25519PublicKeyB64, type Ed25519KeyPair } from './ed25519-key.js';
|
|
8
9
|
export { InMemoryKeyStore, KeyStoreAccessError, DEFAULT_IDENTITY_KEY_ID, type KeyStore, type KeyId } from './key-store.js';
|
|
@@ -21,24 +22,25 @@ export { StrandSolicitationService, createDefaultFormationResponseValidator, typ
|
|
|
21
22
|
export { createHttpFormationApprover, signFormationApproval, verifyFormationApproval, FormationApprovalError, type FormationApprovalRequest, type FormationVouchFields, type FormationApproval, type FormationApprover, type FormationApprovalFailure } from './formation-approval.js';
|
|
22
23
|
export { ControlFormationUsageRecorder } from './control-formation-recorder.js';
|
|
23
24
|
export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-key.js';
|
|
24
|
-
export { signStrandPayload, verifyStrandPayload, signStrandApproval, generateStrandStampId, bootstrapFounderMembership, issueInvite, consumeInvite, cancelInvite, listOutstandingInvites, addMemberByManager, revokeMember, leaveStrand, registerMemberPeer, listMemberPeers, removeMemberPeer, addManager, admitManager, removeManager, STRAND_ENGINE, STRAND_ENGINE_VERSION, type FounderBootstrapParams, type IssueInviteParams, type IssuedInvite, type ConsumeInviteParams, type CancelInviteParams, type OutstandingInvite, type AddMemberByManagerParams, type RevokeMemberParams, type LeaveStrandParams, type RegisterMemberPeerParams, type RemoveOwnPeerParams, type RemoveMemberPeerByManagerParams, type RemoveMemberPeerParams, type AddManagerParams, type AdmitManagerParams, type RemoveManagerParams } from './strand-membership-writer.js';
|
|
25
|
+
export { signStrandPayload, verifyStrandPayload, signStrandApproval, generateStrandStampId, bootstrapFounderMembership, issueInvite, consumeInvite, cancelInvite, listOutstandingInvites, addMemberByManager, revokeMember, leaveStrand, registerMemberPeer, listMemberPeers, removeMemberPeer, addManager, admitManager, removeManager, sealStrand, isStrandSealed, STRAND_ENGINE, STRAND_ENGINE_VERSION, type FounderBootstrapParams, type IssueInviteParams, type IssuedInvite, type ConsumeInviteParams, type CancelInviteParams, type OutstandingInvite, type AddMemberByManagerParams, type RevokeMemberParams, type LeaveStrandParams, type RegisterMemberPeerParams, type RemoveOwnPeerParams, type RemoveMemberPeerByManagerParams, type RemoveMemberPeerParams, type AddManagerParams, type AdmitManagerParams, type RemoveManagerParams, type SealStrandParams } from './strand-membership-writer.js';
|
|
25
26
|
export { canonicalDatetime } from './canonical-datetime.js';
|
|
26
27
|
export { StrandMemberRegistry, StrandMemberVerifier, memberRegistrationPayload, type StrandAdmission } from './strand-member-registry.js';
|
|
27
28
|
export { SeedBootstrapService, SEED_PROTOCOL, ed25519PublicKeyB64FromPeerId, type SeedBootstrapConfig, type SeedEventCallbacks } from './seed-bootstrap.js';
|
|
28
29
|
export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyFormationConsent, type DeviceTokenAuthorizedRow } from './peer-authorization.js';
|
|
29
|
-
export { StrandWakeService, dialWake, WAKE_PROTOCOL, type StrandWakeServiceOptions, type DialWakeOptions } from './strand-wake-protocol.js';
|
|
30
|
+
export { StrandWakeService, dialWake, WAKE_PROTOCOL, DEFAULT_WAKE_DIAL_BUDGET_MS, type StrandWakeServiceOptions, type DialWakeOptions } from './strand-wake-protocol.js';
|
|
30
31
|
export { StrandAddrService, collectStrandAddrs, STRAND_ADDR_PROTOCOL, type StrandAddrServiceOptions, type StrandAddrPeer, type CollectStrandAddrsOptions } from './strand-addr-protocol.js';
|
|
31
|
-
export { peerRecordSignedPayload, signPeerRecord, verifyPeerRecordSignature, isPeerRecordFresh, isSignalingAddr, orderSignalingFirst, currentMemberTrustPolicy, DEFAULT_PEER_RECORD_MAX_AGE_MS, DEFAULT_PEER_RECORD_HEARTBEAT_MS } from './peer-record.js';
|
|
32
|
+
export { peerRecordSignedPayload, signPeerRecord, verifyPeerRecordSignature, isPeerRecordFresh, isSignalingAddr, orderSignalingFirst, withTrailingPeerId, currentMemberTrustPolicy, DEFAULT_PEER_RECORD_MAX_AGE_MS, DEFAULT_PEER_RECORD_HEARTBEAT_MS } from './peer-record.js';
|
|
32
33
|
export { deviceTokenSignedPayload, signDeviceTokenRecord, verifyDeviceTokenSignature, isPushPlatform } from './device-token.js';
|
|
33
34
|
export { STRAND_WAKE_TYPE, type StrandWakePayload } from './strand-wake-payload.js';
|
|
34
35
|
export type { PushNotifier, PushMessage, PushSendResult } from './push-notifier.js';
|
|
35
36
|
export { validatePushCredentials, redactPushCredentials, REDACTED } from './push-credentials.js';
|
|
36
37
|
export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS, type PushFanoutOptions, type FanoutMember } from './push-fanout.js';
|
|
37
|
-
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE, type ControlCohortSelection } from './control-cohort.js';
|
|
38
|
+
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE, type ControlCohortSelection } from './control-cohort.js';
|
|
38
39
|
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, type SeedTrustPolicy, type SeedTrustContext, type SeedTrustDecision } from './seed-trust-policy.js';
|
|
39
40
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
40
41
|
export { FormationListener, dialFormation, isValidResponderCreatesResult, FORMATION_PROTOCOL, type FormationParty, type FormationContactMessage, type FormationResultMessage, type FormationProvisionResult, type FormationStrandInfo, type FormationDbConnectionInfo, type FormationListenerOptions, type FormationDialOptions, type ResponderProvisionOutcome } from './strand-formation-protocol.js';
|
|
41
42
|
export { StrandFormationManager, createStrandFormationManager, type StrandFormationManagerConfig, type StrandFormationManagerOptions } from './strand-formation-manager.js';
|
|
42
|
-
export { createMembershipConnectionGater, STRANGER_OPEN_PROTOCOLS, DEFAULT_ENROLLMENT_WINDOW_MS, ADMISSION_DECISION_TIMEOUT_MS, type InboundAdmissionPolicy } from './membership-connection-gater.js';
|
|
43
|
+
export { createMembershipConnectionGater, STRANGER_OPEN_PROTOCOLS, DEFAULT_ENROLLMENT_WINDOW_MS, ADMISSION_DECISION_TIMEOUT_MS, RELAY_ADMISSION_RESERVE_DEADLINE_MS, MAX_UNAUTHORIZED_RELAY_RESERVATIONS, UNAUTHORIZED_RESERVATION_TTL_MS, UnauthorizedReservationBudget, type InboundAdmissionPolicy, type InboundConnectionVerdict } from './membership-connection-gater.js';
|
|
44
|
+
export { RelayReservationFailedError, RELAY_SEARCH_LISTEN_ADDR } from './relay-addrs.js';
|
|
43
45
|
export { circuitMultiaddrs, superviseRelayReservation, DEFAULT_RELAY_RESERVE_TIMEOUT_MS, DEFAULT_RELAY_RESERVE_POLL_MS, DEFAULT_RELAY_CHECK_MS, DEFAULT_RELAY_MIN_BACKOFF_MS, DEFAULT_RELAY_MAX_BACKOFF_MS, type RelayReservationStatus, type RelayReservationState, type RelayReserveOptions, type RelayReservationSupervisor, type RelayReservationSupervisorOptions } from './relay-reservation.js';
|
|
44
46
|
export { classifyTransport, classifyConnectionPath, summarizeConnectionPaths, emptyConnectionPathSummary, DEFAULT_SETTLE_WINDOW_MS, type ConnectionPathKind, type ConnectionTransport, type ConnectionPath, type ConnectionPathSummary, type ConnectionLike } from './diagnostics/connection-path.js';
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,9 @@ export { ControlDatabase, MissingHostStrandError, buildAuthorizationMessage, for
|
|
|
10
10
|
// ControlDatabase.lockedWithRetry; exported so the integration package can drive the
|
|
11
11
|
// classifier against real engine errors)
|
|
12
12
|
export { CONTROL_WRITE_ATTEMPTS, CONTROL_WRITE_RETRY_BUDGET_MS, SCHEMA_INIT_ATTEMPTS, SCHEMA_INIT_RETRY_POLICY, isRetriableControlWriteFailure, isRetriableSchemaInitFailure, retryControlWrite } from './control-write-retry.js';
|
|
13
|
+
// Bounded retry for transient control-read failures (classifier + policy behind
|
|
14
|
+
// ControlDatabase.readRows; the loop is shared with the write side via control-retry.ts)
|
|
15
|
+
export { CONTROL_READ_ATTEMPTS, CONTROL_READ_RETRY_DELAYS_MS, CONTROL_READ_RETRY_BUDGET_MS, isRetriableControlReadFailure, retryControlRead } from './control-read-retry.js';
|
|
13
16
|
// Control-plane authorization field vector (the domain/action tagging every signer shares)
|
|
14
17
|
export { controlAuthorizationFields } from './control-authorization.js';
|
|
15
18
|
// Ed25519 key bridge (libp2p Ed25519 -> base64url keypair)
|
|
@@ -62,9 +65,10 @@ export { ControlFormationUsageRecorder } from './control-formation-recorder.js';
|
|
|
62
65
|
// protobuf->base64url bridge that derives the founding Member/Manager key.
|
|
63
66
|
export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-key.js';
|
|
64
67
|
// Strand membership writer (founder bootstrap, invite issuance/consumption,
|
|
65
|
-
// manager-admit, member-peer registration, manager rotation,
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
+
// manager-admit, member-peer registration, manager rotation, sealing — the sole
|
|
69
|
+
// manager permanently freezing admission — + shared signing primitives reused
|
|
70
|
+
// across the flows).
|
|
71
|
+
export { signStrandPayload, verifyStrandPayload, signStrandApproval, generateStrandStampId, bootstrapFounderMembership, issueInvite, consumeInvite, cancelInvite, listOutstandingInvites, addMemberByManager, revokeMember, leaveStrand, registerMemberPeer, listMemberPeers, removeMemberPeer, addManager, admitManager, removeManager, sealStrand, isStrandSealed, STRAND_ENGINE, STRAND_ENGINE_VERSION } from './strand-membership-writer.js';
|
|
68
72
|
// Engine-canonical datetime helper (shared by control + strand signed-write flows
|
|
69
73
|
// so a signed timestamp byte-matches the datetime-coerced column the CHECK sees).
|
|
70
74
|
export { canonicalDatetime } from './canonical-datetime.js';
|
|
@@ -76,12 +80,12 @@ export { SeedBootstrapService, SEED_PROTOCOL, ed25519PublicKeyB64FromPeerId } fr
|
|
|
76
80
|
// Peer Authorization (shared owner-signature digest + offline verifier)
|
|
77
81
|
export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyFormationConsent } from './peer-authorization.js';
|
|
78
82
|
// Strand Wake (control-network push-wake protocol)
|
|
79
|
-
export { StrandWakeService, dialWake, WAKE_PROTOCOL } from './strand-wake-protocol.js';
|
|
83
|
+
export { StrandWakeService, dialWake, WAKE_PROTOCOL, DEFAULT_WAKE_DIAL_BUDGET_MS } from './strand-wake-protocol.js';
|
|
80
84
|
// Strand Address (control-network strand-address RPC) — wire types come via
|
|
81
85
|
// `export * from './types.js'` (StrandAddrRequest / StrandAddrResponse).
|
|
82
86
|
export { StrandAddrService, collectStrandAddrs, STRAND_ADDR_PROTOCOL } from './strand-addr-protocol.js';
|
|
83
87
|
// Peer-address record (self-published, signed, freshness-stamped CadrePeer row)
|
|
84
|
-
export { peerRecordSignedPayload, signPeerRecord, verifyPeerRecordSignature, isPeerRecordFresh, isSignalingAddr, orderSignalingFirst, currentMemberTrustPolicy, DEFAULT_PEER_RECORD_MAX_AGE_MS, DEFAULT_PEER_RECORD_HEARTBEAT_MS } from './peer-record.js';
|
|
88
|
+
export { peerRecordSignedPayload, signPeerRecord, verifyPeerRecordSignature, isPeerRecordFresh, isSignalingAddr, orderSignalingFirst, withTrailingPeerId, currentMemberTrustPolicy, DEFAULT_PEER_RECORD_MAX_AGE_MS, DEFAULT_PEER_RECORD_HEARTBEAT_MS } from './peer-record.js';
|
|
85
89
|
// Device-token record (self-published, signed FCM/APNs push token — CadrePeer sibling)
|
|
86
90
|
export { deviceTokenSignedPayload, signDeviceTokenRecord, verifyDeviceTokenSignature, isPushPlatform } from './device-token.js';
|
|
87
91
|
// Strand-wake payload contract (canonical; shared by the server sender + RN receiver)
|
|
@@ -96,7 +100,7 @@ export { validatePushCredentials, redactPushCredentials, REDACTED } from './push
|
|
|
96
100
|
export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS } from './push-fanout.js';
|
|
97
101
|
// Control-cohort dial selection (backbone-preferential, bounded out-degree) +
|
|
98
102
|
// the cadence/degree defaults the proactive reconcile routine reads.
|
|
99
|
-
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE } from './control-cohort.js';
|
|
103
|
+
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE } from './control-cohort.js';
|
|
100
104
|
// Seed trust policy (trust anchor for incoming seeds)
|
|
101
105
|
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy } from './seed-trust-policy.js';
|
|
102
106
|
// Schema Verification
|
|
@@ -106,9 +110,14 @@ export { FormationListener, dialFormation, isValidResponderCreatesResult, FORMAT
|
|
|
106
110
|
// Strand Formation manager (drives the native transport)
|
|
107
111
|
export { StrandFormationManager, createStrandFormationManager } from './strand-formation-manager.js';
|
|
108
112
|
// Control-network inbound connection gate (membership defense-in-depth)
|
|
109
|
-
export { createMembershipConnectionGater, STRANGER_OPEN_PROTOCOLS, DEFAULT_ENROLLMENT_WINDOW_MS, ADMISSION_DECISION_TIMEOUT_MS } from './membership-connection-gater.js';
|
|
110
|
-
//
|
|
111
|
-
// the fail-fast
|
|
113
|
+
export { createMembershipConnectionGater, STRANGER_OPEN_PROTOCOLS, DEFAULT_ENROLLMENT_WINDOW_MS, ADMISSION_DECISION_TIMEOUT_MS, RELAY_ADMISSION_RESERVE_DEADLINE_MS, MAX_UNAUTHORIZED_RELAY_RESERVATIONS, UNAUTHORIZED_RESERVATION_TTL_MS, UnauthorizedReservationBudget } from './membership-connection-gater.js';
|
|
114
|
+
// Thrown out of `CadreNode.start()` when a `network.relayAddrs` reservation does
|
|
115
|
+
// not land on its first attempt — the fail-fast posture of that config field now
|
|
116
|
+
// that the control node reserves AFTER control-database bring-up (relay-addrs.ts).
|
|
117
|
+
export { RelayReservationFailedError, RELAY_SEARCH_LISTEN_ADDR } from './relay-addrs.js';
|
|
118
|
+
// Relay reservation via the bare `/p2p-circuit` search listener — the one route
|
|
119
|
+
// every control node takes; `network.relayAddrs` is its fail-fast posture
|
|
120
|
+
// (see relay-reservation.ts)
|
|
112
121
|
export { circuitMultiaddrs, superviseRelayReservation, DEFAULT_RELAY_RESERVE_TIMEOUT_MS, DEFAULT_RELAY_RESERVE_POLL_MS, DEFAULT_RELAY_CHECK_MS, DEFAULT_RELAY_MIN_BACKOFF_MS, DEFAULT_RELAY_MAX_BACKOFF_MS } from './relay-reservation.js';
|
|
113
122
|
// Connection-path diagnostics (relayed vs direct classification + summary)
|
|
114
123
|
export { classifyTransport, classifyConnectionPath, summarizeConnectionPaths, emptyConnectionPathSummary, DEFAULT_SETTLE_WINDOW_MS } from './diagnostics/connection-path.js';
|
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,EAAoM,MAAM,uBAAuB,CAAC;AAE9W,+EAA+E;AAC/E,qFAAqF;AACrF,yCAAyC;AACzC,OAAO,EACL,sBAAsB,EACtB,6BAA6B,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