@serfab/cadre-core 0.11.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/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 +281 -30
- package/dist/cadre-node.js +513 -103
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-database.d.ts +155 -23
- package/dist/control-database.js +272 -104
- package/dist/control-database.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 +20 -4
- package/dist/control-schema.js.map +1 -1
- package/dist/control-write-retry.d.ts +59 -35
- package/dist/control-write-retry.js +21 -92
- 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 +6 -4
- package/dist/index.js +17 -8
- 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-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/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-formation-manager.d.ts +10 -9
- package/dist/strand-formation-manager.js +10 -9
- 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 +4 -3
- package/dist/strand-instance-manager.js +31 -6
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-writer.d.ts +106 -14
- package/dist/strand-membership-writer.js +180 -14
- 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 +74 -29
- package/dist/types.js.map +1 -1
- package/package.json +8 -8
- package/src/announce-addrs.ts +93 -0
- package/src/cadre-node.ts +5603 -5158
- package/src/control-database.ts +2584 -2406
- package/src/control-read-retry.ts +167 -0
- package/src/control-retry.ts +190 -0
- package/src/control-schema.ts +20 -4
- package/src/control-write-retry.ts +30 -130
- package/src/delegate-admission.ts +17 -15
- package/src/index.ts +435 -407
- package/src/membership-connection-gater.ts +533 -204
- package/src/peer-record.ts +33 -0
- package/src/relay-addrs.ts +218 -111
- package/src/relay-reservation.ts +828 -823
- package/src/strand-addr-protocol.ts +17 -0
- package/src/strand-backfill.ts +389 -366
- package/src/strand-formation-manager.ts +492 -491
- package/src/strand-formation-protocol.ts +8 -8
- package/src/strand-instance-manager.ts +636 -611
- package/src/strand-membership-writer.ts +209 -14
- package/src/strand-solicitation.ts +6 -7
- package/src/strand-wake-protocol.ts +94 -8
- package/src/types.ts +74 -29
|
@@ -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
|
|
@@ -154,8 +154,12 @@ const SUPER_MAJORITY_SHORTFALL_UNANSWERED = /Failed to get super-majority: \d+\/
|
|
|
154
154
|
* An aggregate whose details came out EMPTY (possible when `formatBatchStatuses` has no
|
|
155
155
|
* batches to format) carries neither token, matches nothing here, and is not retried — an
|
|
156
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.
|
|
157
161
|
*/
|
|
158
|
-
function isUncommittedTransactorAggregate(message) {
|
|
162
|
+
export function isUncommittedTransactorAggregate(message) {
|
|
159
163
|
return TRANSACTOR_AGGREGATE.test(message) && message.includes(SINGLE_BLOCK_BATCH_TOKEN);
|
|
160
164
|
}
|
|
161
165
|
/**
|
|
@@ -202,24 +206,6 @@ const SELF_COORDINATION_GRACE_REFUSAL = /Self-coordination blocked: grace-period
|
|
|
202
206
|
function isSelfCoordinationGraceRefusal(message) {
|
|
203
207
|
return SELF_COORDINATION_GRACE_REFUSAL.test(message);
|
|
204
208
|
}
|
|
205
|
-
/**
|
|
206
|
-
* Every message in the failure's `cause` chain.
|
|
207
|
-
*
|
|
208
|
-
* `unwrapError` declares its `message` as `string`, but it follows `.cause` without checking what
|
|
209
|
-
* that holds — a chain link that is not an `Error` (a stream rejected with a bare string reason,
|
|
210
|
-
* an `AbortSignal.reason` that is a plain object) yields `undefined` there, and calling
|
|
211
|
-
* `.includes` on it would throw a `TypeError` out of this classifier, INSIDE `retryControlWrite`'s
|
|
212
|
-
* catch, replacing the real control-write failure with a confusing one. Non-strings are dropped:
|
|
213
|
-
* a link nobody can read is a link that matches nothing, which is already the conservative answer.
|
|
214
|
-
*
|
|
215
|
-
* NOTE: a cause chain with a CYCLE would spin forever inside `unwrapError` itself. No error in
|
|
216
|
-
* this repo builds one; if a hang ever localises to a control-write failure path, look there.
|
|
217
|
-
*/
|
|
218
|
-
function chainMessages(error) {
|
|
219
|
-
return unwrapError(error)
|
|
220
|
-
.map(({ message }) => message)
|
|
221
|
-
.filter(message => typeof message === 'string');
|
|
222
|
-
}
|
|
223
209
|
/**
|
|
224
210
|
* The error messages that mean "the cohort did not answer AND nothing committed", and nothing
|
|
225
211
|
* else. The observed one-shot failure was `registerSelf()` racing a connection still forming:
|
|
@@ -260,7 +246,8 @@ 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
|
|
249
|
+
* Classifies by MESSAGE, walking the `cause` chain with the shared {@link chainMessages}
|
|
250
|
+
* (Quereus' own `unwrapError` underneath) —
|
|
264
251
|
* the failure surface is not recognisable by type. The transactor and the coordinator both throw bare `Error`s, and by
|
|
265
252
|
* the time one reaches `ControlDatabase` it is wrapped in a `QuereusError` (the real chain
|
|
266
253
|
* is `QuereusError` → `Error` → `Error`), so the match must work at any depth. Anything
|
|
@@ -340,73 +327,15 @@ export const SCHEMA_INIT_RETRY_POLICY = {
|
|
|
340
327
|
* so the exact messages downstream code and the degraded-cohort-member scenario assert on
|
|
341
328
|
* survive. A non-retriable failure propagates from the attempt that raised it.
|
|
342
329
|
*/
|
|
343
|
-
export
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
let lastError;
|
|
354
|
-
let attemptsMade = 0;
|
|
355
|
-
for (let attemptNumber = 1; attemptNumber <= attempts; attemptNumber++) {
|
|
356
|
-
attemptsMade = attemptNumber;
|
|
357
|
-
try {
|
|
358
|
-
const result = await attempt();
|
|
359
|
-
if (attemptNumber > 1) {
|
|
360
|
-
log('Control write%s committed on attempt %d/%d', tag, attemptNumber, attempts);
|
|
361
|
-
}
|
|
362
|
-
return result;
|
|
363
|
-
}
|
|
364
|
-
catch (error) {
|
|
365
|
-
if (!isRetriable(error)) {
|
|
366
|
-
// The ONLY trace that this funnel saw a failure and declined it. Without it the
|
|
367
|
-
// log is silent either way, so "the classifier vetoed this one" is
|
|
368
|
-
// indistinguishable from "the retry is not wired into this path at all".
|
|
369
|
-
log('Control write%s failed non-transiently on attempt %d/%d, not retried here: %s', tag, attemptNumber, attempts, error);
|
|
370
|
-
throw error;
|
|
371
|
-
}
|
|
372
|
-
lastError = error;
|
|
373
|
-
if (attemptNumber === attempts) {
|
|
374
|
-
break;
|
|
375
|
-
}
|
|
376
|
-
const elapsed = now() - start;
|
|
377
|
-
if (elapsed >= CONTROL_WRITE_RETRY_BUDGET_MS) {
|
|
378
|
-
break;
|
|
379
|
-
}
|
|
380
|
-
const delay = jitteredDelay(delays, attemptNumber);
|
|
381
|
-
log('Control write%s failed transiently (attempt %d/%d), retrying in %d ms: %s', tag, attemptNumber, attempts, delay, error);
|
|
382
|
-
await sleep(delay);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
log('Control write%s failed after %d/%d attempt(s): %s', tag, attemptsMade, attempts, lastError);
|
|
386
|
-
throw lastError;
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Backoff for the retry that follows attempt `attemptNumber`: the matching base delay
|
|
390
|
-
* (last entry repeats), jittered ±50%, then capped at the list's largest base so no single
|
|
391
|
-
* sleep exceeds it (see {@link CONTROL_WRITE_RETRY_DELAYS_MS} for why). `Math.random` is
|
|
392
|
-
* fine here — the jitter only de-synchronizes concurrent retriers, nothing is derived
|
|
393
|
-
* from it.
|
|
394
|
-
*
|
|
395
|
-
* NOTE: the cap bites on the LAST delay, whose base IS the largest, so ~half of those sleeps
|
|
396
|
-
* land exactly on the cap rather than spread — de-synchronization is only partial there.
|
|
397
|
-
* Harmless while retriers are a handful of party nodes whose attempts already start seconds
|
|
398
|
-
* apart; if a party ever retries in a tight synchronized herd, raise the cap above the
|
|
399
|
-
* largest base instead of jittering about it.
|
|
400
|
-
*/
|
|
401
|
-
function jitteredDelay(delays, attemptNumber) {
|
|
402
|
-
if (delays.length === 0) {
|
|
403
|
-
return 0;
|
|
404
|
-
}
|
|
405
|
-
const base = delays[Math.min(attemptNumber - 1, delays.length - 1)];
|
|
406
|
-
const jittered = base * (0.5 + Math.random());
|
|
407
|
-
return Math.min(jittered, Math.max(...delays));
|
|
408
|
-
}
|
|
409
|
-
function defaultSleep(ms) {
|
|
410
|
-
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);
|
|
411
340
|
}
|
|
412
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-write-retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,KAAM,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,6BAA6B,GAAsB,CAAC,GAAG,EAAE,IAAK,CAAC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,2BAA2B,GAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAK,EAAE,IAAK,CAAC,CAAC;AAEhF,+FAA+F;AAC/F,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAE5D;;;GAGG;AACH,MAAM,wBAAwB,GAAG,SAAS,CAAC;AAE3C;;;GAGG;AACH,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,mCAAmC,GACxC,+EAA+E,CAAC;AAEjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,gCAAgC,CAAC,OAAe;IAC/D,OAAO,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC;AACz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1C,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7E,CAAC;AAcD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,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":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AU,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC;IACzE,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU,GAAG,CAAC,CAAC,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,14 +22,14 @@ 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';
|
|
@@ -39,6 +40,7 @@ export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, type SeedTr
|
|
|
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)
|
|
@@ -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;AA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