@serfab/cadre-core 0.11.0 → 0.13.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 +3 -2
- 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 +607 -53
- package/dist/cadre-node.js +1268 -157
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-database.d.ts +174 -23
- package/dist/control-database.js +317 -107
- 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 +50 -6
- 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/enrolled-machine-store-file.d.ts +13 -0
- package/dist/enrolled-machine-store-file.js +41 -0
- package/dist/enrolled-machine-store-file.js.map +1 -0
- package/dist/enrolled-machine-store.d.ts +81 -0
- package/dist/enrolled-machine-store.js +225 -0
- package/dist/enrolled-machine-store.js.map +1 -0
- package/dist/file-durable-slot.js +5 -3
- package/dist/file-durable-slot.js.map +1 -1
- package/dist/index.d.ts +10 -6
- package/dist/index.js +39 -12
- package/dist/index.js.map +1 -1
- package/dist/membership-connection-gater.d.ts +226 -26
- package/dist/membership-connection-gater.js +316 -30
- package/dist/membership-connection-gater.js.map +1 -1
- package/dist/node-local-snapshot.d.ts +6 -0
- package/dist/node-local-snapshot.js +7 -1
- package/dist/node-local-snapshot.js.map +1 -1
- package/dist/{strand-backfill.d.ts → peer-join-backfill.d.ts} +49 -20
- package/dist/{strand-backfill.js → peer-join-backfill.js} +146 -56
- package/dist/peer-join-backfill.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 +145 -22
- package/dist/relay-addrs.js +314 -31
- 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-database.d.ts +12 -0
- package/dist/strand-database.js +16 -0
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-formation-manager.d.ts +22 -9
- package/dist/strand-formation-manager.js +20 -12
- package/dist/strand-formation-manager.js.map +1 -1
- package/dist/strand-formation-protocol.d.ts +83 -9
- package/dist/strand-formation-protocol.js +86 -10
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +151 -17
- package/dist/strand-instance-manager.js +237 -32
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-writer.d.ts +118 -14
- package/dist/strand-membership-writer.js +203 -15
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-network-config.d.ts +84 -0
- package/dist/strand-network-config.js +136 -0
- package/dist/strand-network-config.js.map +1 -0
- package/dist/strand-revocation-enforcer.d.ts +392 -0
- package/dist/strand-revocation-enforcer.js +533 -0
- package/dist/strand-revocation-enforcer.js.map +1 -0
- package/dist/strand-solicitation.d.ts +10 -3
- package/dist/strand-solicitation.js +12 -7
- 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/strand-watcher.js +6 -1
- package/dist/strand-watcher.js.map +1 -1
- package/dist/types.d.ts +282 -43
- package/dist/types.js +7 -1
- package/dist/types.js.map +1 -1
- package/package.json +16 -8
- package/src/announce-addrs.ts +93 -0
- package/src/cadre-node.ts +1366 -171
- package/src/control-database.ts +2628 -2406
- package/src/control-read-retry.ts +167 -0
- package/src/control-retry.ts +190 -0
- package/src/control-schema.ts +50 -6
- package/src/control-write-retry.ts +30 -130
- package/src/delegate-admission.ts +17 -15
- package/src/enrolled-machine-store-file.ts +43 -0
- package/src/enrolled-machine-store.ts +280 -0
- package/src/file-durable-slot.ts +5 -3
- package/src/index.ts +477 -407
- package/src/membership-connection-gater.ts +539 -204
- package/src/node-local-snapshot.ts +13 -1
- package/src/peer-addr-book.ts +251 -250
- package/src/{strand-backfill.ts → peer-join-backfill.ts} +187 -75
- package/src/peer-record.ts +33 -0
- package/src/relay-addrs.ts +436 -111
- package/src/relay-reservation.ts +828 -823
- package/src/strand-addr-protocol.ts +17 -0
- package/src/strand-database.ts +17 -0
- package/src/strand-formation-manager.ts +511 -491
- package/src/strand-formation-protocol.ts +808 -692
- package/src/strand-instance-manager.ts +899 -611
- package/src/strand-membership-writer.ts +232 -15
- package/src/strand-network-config.ts +172 -0
- package/src/strand-revocation-enforcer.ts +653 -0
- package/src/strand-solicitation.ts +484 -472
- package/src/strand-wake-protocol.ts +94 -8
- package/src/strand-watcher.ts +319 -314
- package/src/types.ts +1554 -1309
- package/dist/strand-backfill.js.map +0 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node-local, NON-replicated record of how many machines this party had enrolled
|
|
3
|
+
* the last time this node looked — the block-repair corroboration yardstick the
|
|
4
|
+
* CONTROL network declares when its libp2p node is built.
|
|
5
|
+
*
|
|
6
|
+
* ## Why the number has to be remembered rather than read
|
|
7
|
+
*
|
|
8
|
+
* `resolveRepairYardstick` (in `@serfab/quereus-plugin-sereus`'s `cluster-size.ts`
|
|
9
|
+
* — read it first; the arithmetic and both clamps are explained there and are not
|
|
10
|
+
* repeated here) derives the yardstick from the machines that SERVE the network being
|
|
11
|
+
* configured. For the CONTROL network that is the machines enrolled in the party, and
|
|
12
|
+
* exactly so: every enrolled machine runs the control node by construction. (It is NOT
|
|
13
|
+
* the right number for a strand, which runs on a subset — see
|
|
14
|
+
* `StartStrandConfig.servingMachines`. This store is control-network-only, and that
|
|
15
|
+
* scope is a safety property, not an accident.) Optimystic freezes a network's
|
|
16
|
+
* `clusterPolicy` when its libp2p node is built and offers no runtime setter, so the
|
|
17
|
+
* number has to be known at construction time.
|
|
18
|
+
*
|
|
19
|
+
* The control node cannot read it when it needs it. `CadreNode.buildControlNodeOptions`
|
|
20
|
+
* runs inside `start()` BEFORE `createControlNode()`, which is before the
|
|
21
|
+
* `ControlDatabase` holding the `CadrePeer` rows exists — so at the one moment the
|
|
22
|
+
* number is needed, nothing can answer. That deadlock is why the control network
|
|
23
|
+
* declared no yardstick at all and ran at `CONTROL_CLUSTER_POLICY`'s
|
|
24
|
+
* `assumedClusterSize` of 2.
|
|
25
|
+
*
|
|
26
|
+
* This store breaks it the only way a chicken-and-egg is broken: by remembering
|
|
27
|
+
* across the restart. `CadreNode.refreshAuthorizedControlPeers` records the count
|
|
28
|
+
* every time membership is recomputed; `CadreNode.start()` reads it back before the
|
|
29
|
+
* control node is built. A node therefore declares what it last knew, and a party
|
|
30
|
+
* that grows applies the larger number on each node's NEXT launch. Raising the
|
|
31
|
+
* yardstick is the safe direction and a node still holding the old value is running
|
|
32
|
+
* at exactly today's behaviour, so the next natural restart is soon enough — there
|
|
33
|
+
* is deliberately no forced rebuild.
|
|
34
|
+
*
|
|
35
|
+
* ## Why this is NOT a `NodeLocalSnapshot` like its two siblings
|
|
36
|
+
*
|
|
37
|
+
* The trusted-owner anchor (`trusted-owner-store.ts`) and the cold-start
|
|
38
|
+
* bootstrap-peer store (`bootstrap-peer-store.ts`) are the same `{ version,
|
|
39
|
+
* partyId, ... }` envelope over a {@link DurableSlot} this record is, and this
|
|
40
|
+
* module is deliberately symmetrical with them — same injected-backend shape, same
|
|
41
|
+
* `Memory*` / `Persistent*` / `File*` split, same party scoping. It does NOT share
|
|
42
|
+
* their `NodeLocalSnapshot` machinery, for two reasons:
|
|
43
|
+
*
|
|
44
|
+
* - **Shape.** `NodeLocalSnapshot` is a `key -> entry` map with no delete. This
|
|
45
|
+
* record is one integer that must be able to go DOWN after a machine is removed.
|
|
46
|
+
* - **Load policy — the important one.** `NodeLocalSnapshot.open` THROWS when the
|
|
47
|
+
* slot is present but unreadable. That is right for the anchor (a record that
|
|
48
|
+
* cannot be read in full is not a trust anchor) and right for the peer store (a
|
|
49
|
+
* failed read reported as absent would let the next snapshot write destroy a
|
|
50
|
+
* stranded node's only way home). It is WRONG here. Nothing in this record is
|
|
51
|
+
* trust-bearing, it holds nothing that is not recomputed the moment the control
|
|
52
|
+
* database is up, and refusing to start a node over an unreadable *repair hint*
|
|
53
|
+
* is strictly worse than declaring today's 2. So every unreadable, unparsable,
|
|
54
|
+
* foreign-party or junk slot LOGS and COLD-STARTS, yielding `undefined`, which
|
|
55
|
+
* declares nothing, which is byte-for-byte today's behaviour.
|
|
56
|
+
*
|
|
57
|
+
* Do not "unify" the three modules by routing this one through `NodeLocalSnapshot`:
|
|
58
|
+
* that would quietly import the throw, and turn an unreadable hint into a node that
|
|
59
|
+
* will not start.
|
|
60
|
+
*
|
|
61
|
+
* NOTE: writes are serialised in-process only, the same caveat `NodeLocalSnapshot`
|
|
62
|
+
* carries. Two processes (or two browser tabs) sharing ONE slot for ONE party each
|
|
63
|
+
* write their own view and the loser's count is lost. Two same-origin tabs of
|
|
64
|
+
* `reference-app-web` do exactly that — its slot is one key of a shared IndexedDB
|
|
65
|
+
* database, the same last-writer-wins caveat its `node-local-slots.ts` already
|
|
66
|
+
* records for the other two records. Harmless here, unlike there: this value is one
|
|
67
|
+
* integer both tabs re-derive from the same membership rows on their next refresh,
|
|
68
|
+
* so the views reconverge rather than losing an entry nobody rewrites.
|
|
69
|
+
*/
|
|
70
|
+
import debug from 'debug';
|
|
71
|
+
const log = debug('sereus:cadre:enrolled-machine-store');
|
|
72
|
+
/** Envelope version. Guards future migrations; an unknown version cold-starts. */
|
|
73
|
+
const ENVELOPE_VERSION = 1;
|
|
74
|
+
/** Envelope property holding the count. */
|
|
75
|
+
const PAYLOAD_KEY = 'enrolledMachines';
|
|
76
|
+
/**
|
|
77
|
+
* Ephemeral in-memory store — the default when no store is injected via
|
|
78
|
+
* `CadreNodeConfig.enrolledMachines`. A node using this cold-starts on every
|
|
79
|
+
* launch: `count()` is `undefined` at `start()`, so its control node declares
|
|
80
|
+
* nothing and runs at today's behaviour, exactly as before this record existed.
|
|
81
|
+
*/
|
|
82
|
+
export class MemoryEnrolledMachineStore {
|
|
83
|
+
constructor(partyId) {
|
|
84
|
+
this.partyId = partyId;
|
|
85
|
+
}
|
|
86
|
+
count() {
|
|
87
|
+
return this.current;
|
|
88
|
+
}
|
|
89
|
+
async record(count) {
|
|
90
|
+
const accepted = asMachineCount(count);
|
|
91
|
+
if (accepted === undefined) {
|
|
92
|
+
log('refusing to record a non-positive-integer count %o for party %s', count, this.partyId);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
this.current = accepted;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Durable {@link EnrolledMachineStore} over an app-supplied {@link DurableSlot} —
|
|
100
|
+
* the cross-platform half of every persistent backend (the Node
|
|
101
|
+
* `FileEnrolledMachineStore` is this class over a file slot).
|
|
102
|
+
*
|
|
103
|
+
* Construct via {@link open}. Load policy is the module comment's: every failure
|
|
104
|
+
* mode cold-starts, and `open` never rejects.
|
|
105
|
+
*/
|
|
106
|
+
export class PersistentEnrolledMachineStore {
|
|
107
|
+
constructor(slot, partyId, loaded) {
|
|
108
|
+
this.slot = slot;
|
|
109
|
+
this.partyId = partyId;
|
|
110
|
+
/** Serialises persists so the last count recorded is the last one written. */
|
|
111
|
+
this.writeChain = Promise.resolve();
|
|
112
|
+
this.current = loaded;
|
|
113
|
+
this.persisted = loaded;
|
|
114
|
+
}
|
|
115
|
+
/** Load (or cold-start) the party's last recorded machine count from `slot`. */
|
|
116
|
+
static async open(slot, partyId) {
|
|
117
|
+
return new PersistentEnrolledMachineStore(slot, partyId, await loadCount(slot, partyId));
|
|
118
|
+
}
|
|
119
|
+
count() {
|
|
120
|
+
return this.current;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Record the count: visible via {@link count} synchronously, then persisted.
|
|
124
|
+
*
|
|
125
|
+
* Writes are SKIPPED when the slot already holds this number, because the sole
|
|
126
|
+
* caller runs on every committed membership write *and* every timed reconcile
|
|
127
|
+
* pass — a party whose membership is stable would otherwise rewrite the same
|
|
128
|
+
* integer forever. The skip is keyed off {@link persisted} rather than
|
|
129
|
+
* {@link current}, so a write that FAILED is retried by the next refresh instead
|
|
130
|
+
* of being suppressed as "unchanged".
|
|
131
|
+
*/
|
|
132
|
+
record(count) {
|
|
133
|
+
const accepted = asMachineCount(count);
|
|
134
|
+
if (accepted === undefined) {
|
|
135
|
+
log('refusing to record a non-positive-integer count %o for party %s', count, this.partyId);
|
|
136
|
+
return Promise.resolve();
|
|
137
|
+
}
|
|
138
|
+
this.current = accepted;
|
|
139
|
+
if (this.persisted === accepted) {
|
|
140
|
+
return Promise.resolve();
|
|
141
|
+
}
|
|
142
|
+
this.writeChain = this.writeChain.then(() => this.persistCurrent());
|
|
143
|
+
return this.writeChain;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Write whatever {@link current} holds when this link of the chain runs — so a
|
|
147
|
+
* burst of records collapses into one write of the latest value — and never
|
|
148
|
+
* throw (see {@link EnrolledMachineStore.record}).
|
|
149
|
+
*/
|
|
150
|
+
async persistCurrent() {
|
|
151
|
+
const pending = this.current;
|
|
152
|
+
if (pending === undefined || pending === this.persisted) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const envelope = {
|
|
156
|
+
version: ENVELOPE_VERSION,
|
|
157
|
+
partyId: this.partyId,
|
|
158
|
+
[PAYLOAD_KEY]: pending
|
|
159
|
+
};
|
|
160
|
+
try {
|
|
161
|
+
await this.slot.save(JSON.stringify(envelope, null, '\t'));
|
|
162
|
+
this.persisted = pending;
|
|
163
|
+
log('recorded %d enrolled machine(s) for party %s', pending, this.partyId);
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
log('persisting %d enrolled machine(s) for party %s failed (in-memory count stands, retried on the next refresh): %o', pending, this.partyId, error);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A usable machine count, or `undefined`. Anything that is not a positive integer
|
|
172
|
+
* is unknown rather than coerced — `'3'`, `0`, `-1`, `2.5`, `null` and a missing key
|
|
173
|
+
* all cold-start. Coercing here would be the beginning of a parser, and Optimystic
|
|
174
|
+
* itself treats a degenerate declaration as absent, so a rounded value would be a
|
|
175
|
+
* number nobody chose.
|
|
176
|
+
*/
|
|
177
|
+
function asMachineCount(value) {
|
|
178
|
+
return typeof value === 'number' && Number.isInteger(value) && value >= 1 ? value : undefined;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Read the slot into the initial count. EVERY failure — unreadable slot, unparsable
|
|
182
|
+
* JSON, wrong envelope version, foreign `partyId`, junk payload — logs and returns
|
|
183
|
+
* `undefined` (see the module comment for why this record, unlike its two siblings,
|
|
184
|
+
* must not throw on an unreadable slot).
|
|
185
|
+
*/
|
|
186
|
+
async function loadCount(slot, partyId) {
|
|
187
|
+
let text;
|
|
188
|
+
try {
|
|
189
|
+
text = await slot.load();
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
// The deliberate divergence from `NodeLocalSnapshot.open`, which throws here.
|
|
193
|
+
log('slot for party %s is present but unreadable (cold start — this node declares no yardstick): %o', partyId, error);
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
if (text === undefined) {
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
let parsed;
|
|
200
|
+
try {
|
|
201
|
+
parsed = JSON.parse(text);
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
log('corrupt slot for party %s (cold start): %o', partyId, error);
|
|
205
|
+
return undefined;
|
|
206
|
+
}
|
|
207
|
+
if (!isRecord(parsed) || parsed.version !== ENVELOPE_VERSION || parsed.partyId !== partyId) {
|
|
208
|
+
// A non-string partyId cannot equal the requested one, so this covers both a
|
|
209
|
+
// malformed envelope and a slot reused for another party.
|
|
210
|
+
log('slot for party %s has an unknown shape or a foreign partyId (cold start)', partyId);
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
const count = asMachineCount(parsed[PAYLOAD_KEY]);
|
|
214
|
+
if (count === undefined) {
|
|
215
|
+
log('slot for party %s holds an unusable %s value %o (cold start)', partyId, PAYLOAD_KEY, parsed[PAYLOAD_KEY]);
|
|
216
|
+
return undefined;
|
|
217
|
+
}
|
|
218
|
+
log('loaded %d enrolled machine(s) for party %s', count, partyId);
|
|
219
|
+
return count;
|
|
220
|
+
}
|
|
221
|
+
/** A plain JSON object. Arrays excluded: an array envelope is not an envelope. */
|
|
222
|
+
function isRecord(value) {
|
|
223
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=enrolled-machine-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enrolled-machine-store.js","sourceRoot":"","sources":["../src/enrolled-machine-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,GAAG,GAAG,KAAK,CAAC,qCAAqC,CAAC,CAAC;AAEzD,kFAAkF;AAClF,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,2CAA2C;AAC3C,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAiCvC;;;;;GAKG;AACH,MAA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AC,4CAA4C,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAClE,OAAO,KAAK,CAAC;AACd,CAAC;AAED,kFAAkF;AAClF,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* parties without cross-party leakage.
|
|
6
6
|
*
|
|
7
7
|
* This is the whole platform-specific part of the file-backed node-local
|
|
8
|
-
* stores (`trusted-owner-store-file.ts`, `bootstrap-peer-store-file.ts
|
|
9
|
-
* load policy, envelope and write chain
|
|
10
|
-
* `node-local-snapshot.ts
|
|
8
|
+
* stores (`trusted-owner-store-file.ts`, `bootstrap-peer-store-file.ts`,
|
|
9
|
+
* `enrolled-machine-store-file.ts`); the load policy, envelope and write chain
|
|
10
|
+
* are cross-platform — in `node-local-snapshot.ts` for the first two, and in
|
|
11
|
+
* `enrolled-machine-store.ts` for the third, which deliberately does not share
|
|
12
|
+
* that machinery. Like its three importers, this module imports
|
|
11
13
|
* `node:fs/promises`, so it is kept OUT of the package's cross-platform
|
|
12
14
|
* default entry and is not itself an exported subpath.
|
|
13
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-durable-slot.js","sourceRoot":"","sources":["../src/file-durable-slot.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"file-durable-slot.js","sourceRoot":"","sources":["../src/file-durable-slot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,mBAAm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AAM,CAAC,CAAC;IAC1E,CAAC;CACD"}
|
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';
|
|
@@ -10,10 +11,12 @@ export { loadOrCreateIdentityKey, peerKeySigner, type PeerKeySigner } from './id
|
|
|
10
11
|
export { MemoryTrustedOwnerStore, PersistentTrustedOwnerStore, type TrustedOwnerStore, type TrustSource } from './trusted-owner-store.js';
|
|
11
12
|
export type { DurableSlot } from './node-local-snapshot.js';
|
|
12
13
|
export { MemoryBootstrapPeerStore, PersistentBootstrapPeerStore, type BootstrapPeerStore, type BootstrapPeerEntry } from './bootstrap-peer-store.js';
|
|
14
|
+
export { MemoryEnrolledMachineStore, PersistentEnrolledMachineStore, type EnrolledMachineStore } from './enrolled-machine-store.js';
|
|
13
15
|
export { StrandDatabase, type StrandDatabaseConfig } from './strand-database.js';
|
|
14
16
|
export { StrandWatcher, type StrandWatcherCallbacks, type StrandQueryable, type SAppIdLookup, type StrandRowWithApp } from './strand-watcher.js';
|
|
15
17
|
export { StrandInstanceManager, type StartStrandConfig, type ResumeStrandOverrides, getStrandStoragePath } from './strand-instance-manager.js';
|
|
16
|
-
export {
|
|
18
|
+
export { PeerJoinBackfill, DEFAULT_PEER_JOIN_BACKFILL, MAX_BLOCK_MESSAGE_BYTES, type PeerJoinBackfillConfig, type PeerJoinBackfillDeps, type PeerJoinBackfillResult, type PeerJoinBackfillPushClient } from './peer-join-backfill.js';
|
|
19
|
+
export { StrandRevocationEnforcer, createRevocationConnectionGater, readStrandRevocationRows, DEFAULT_REVOCATION_POLL_INTERVAL_MS, type StrandRevocationEnforcementConfig, type StrandRevocationEnforcerDeps, type StrandRevocationRows, type StrandMemberPeerBinding, type StrandRevocationJudge, type StrandRevocationNetwork, type RevocationRefreshScheduler } from './strand-revocation-enforcer.js';
|
|
17
20
|
export { HibernationManager, type HibernationCallbacks } from './hibernation-manager.js';
|
|
18
21
|
export { ArachnodeStub, createArachnodeStub, type RingConfig } from './arachnode-stub.js';
|
|
19
22
|
export { EnrollmentService, type MemberVerifier, type MemberRegistry } from './enrollment.js';
|
|
@@ -21,14 +24,14 @@ export { StrandSolicitationService, createDefaultFormationResponseValidator, typ
|
|
|
21
24
|
export { createHttpFormationApprover, signFormationApproval, verifyFormationApproval, FormationApprovalError, type FormationApprovalRequest, type FormationVouchFields, type FormationApproval, type FormationApprover, type FormationApprovalFailure } from './formation-approval.js';
|
|
22
25
|
export { ControlFormationUsageRecorder } from './control-formation-recorder.js';
|
|
23
26
|
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';
|
|
27
|
+
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
28
|
export { canonicalDatetime } from './canonical-datetime.js';
|
|
26
29
|
export { StrandMemberRegistry, StrandMemberVerifier, memberRegistrationPayload, type StrandAdmission } from './strand-member-registry.js';
|
|
27
30
|
export { SeedBootstrapService, SEED_PROTOCOL, ed25519PublicKeyB64FromPeerId, type SeedBootstrapConfig, type SeedEventCallbacks } from './seed-bootstrap.js';
|
|
28
31
|
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';
|
|
32
|
+
export { StrandWakeService, dialWake, WAKE_PROTOCOL, DEFAULT_WAKE_DIAL_BUDGET_MS, type StrandWakeServiceOptions, type DialWakeOptions } from './strand-wake-protocol.js';
|
|
30
33
|
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';
|
|
34
|
+
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
35
|
export { deviceTokenSignedPayload, signDeviceTokenRecord, verifyDeviceTokenSignature, isPushPlatform } from './device-token.js';
|
|
33
36
|
export { STRAND_WAKE_TYPE, type StrandWakePayload } from './strand-wake-payload.js';
|
|
34
37
|
export type { PushNotifier, PushMessage, PushSendResult } from './push-notifier.js';
|
|
@@ -37,8 +40,9 @@ export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS,
|
|
|
37
40
|
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
41
|
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, type SeedTrustPolicy, type SeedTrustContext, type SeedTrustDecision } from './seed-trust-policy.js';
|
|
39
42
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
40
|
-
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';
|
|
43
|
+
export { FormationListener, dialFormation, isValidResponderCreatesResult, 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';
|
|
41
44
|
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';
|
|
45
|
+
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';
|
|
46
|
+
export { RelayReservationFailedError, UnbindableListenAddressError, RELAY_SEARCH_LISTEN_ADDR } from './relay-addrs.js';
|
|
43
47
|
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
48
|
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)
|
|
@@ -37,14 +40,29 @@ export { MemoryTrustedOwnerStore, PersistentTrustedOwnerStore } from './trusted-
|
|
|
37
40
|
// interface + in-memory store here, Node-only file backend behind the subpath
|
|
38
41
|
// '@serfab/cadre-core/bootstrap-peer-store-file'.
|
|
39
42
|
export { MemoryBootstrapPeerStore, PersistentBootstrapPeerStore } from './bootstrap-peer-store.js';
|
|
43
|
+
// Node-local enrolled-machine count: the machines this party had enrolled the
|
|
44
|
+
// last time this node looked, remembered across restarts so the CONTROL node can
|
|
45
|
+
// declare a block-repair yardstick at bring-up — which is before the database
|
|
46
|
+
// holding the membership rows exists. Same cross-platform split as the two
|
|
47
|
+
// records above; Node-only file backend behind the subpath
|
|
48
|
+
// '@serfab/cadre-core/enrolled-machine-store-file'. Its load policy deliberately
|
|
49
|
+
// DIVERGES from theirs (an unreadable slot cold-starts rather than throwing) —
|
|
50
|
+
// see the module comment before unifying the three.
|
|
51
|
+
export { MemoryEnrolledMachineStore, PersistentEnrolledMachineStore } from './enrolled-machine-store.js';
|
|
40
52
|
// Strand database
|
|
41
53
|
export { StrandDatabase } from './strand-database.js';
|
|
42
54
|
// Strand management
|
|
43
55
|
export { StrandWatcher } from './strand-watcher.js';
|
|
44
56
|
export { StrandInstanceManager, getStrandStoragePath } from './strand-instance-manager.js';
|
|
45
|
-
//
|
|
46
|
-
// connected
|
|
47
|
-
|
|
57
|
+
// Peer-join block catch-up (push this network's own blocks to each newly
|
|
58
|
+
// connected peer, so a late joiner physically holds pre-join blocks). Shared
|
|
59
|
+
// by the strand networks (ungated) and the control network (membership-gated).
|
|
60
|
+
export { PeerJoinBackfill, DEFAULT_PEER_JOIN_BACKFILL, MAX_BLOCK_MESSAGE_BYTES } from './peer-join-backfill.js';
|
|
61
|
+
// Closed-strand revoked-peer enforcement (deny the network nodes of removed
|
|
62
|
+
// members at the stream and connection layers, and hang up the sessions they
|
|
63
|
+
// already hold — see the module doc for the settled deny-list design, the
|
|
64
|
+
// teardown seam, and the fail directions).
|
|
65
|
+
export { StrandRevocationEnforcer, createRevocationConnectionGater, readStrandRevocationRows, DEFAULT_REVOCATION_POLL_INTERVAL_MS } from './strand-revocation-enforcer.js';
|
|
48
66
|
// Hibernation
|
|
49
67
|
export { HibernationManager } from './hibernation-manager.js';
|
|
50
68
|
// Arachnode (stub)
|
|
@@ -62,9 +80,10 @@ export { ControlFormationUsageRecorder } from './control-formation-recorder.js';
|
|
|
62
80
|
// protobuf->base64url bridge that derives the founding Member/Manager key.
|
|
63
81
|
export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-key.js';
|
|
64
82
|
// Strand membership writer (founder bootstrap, invite issuance/consumption,
|
|
65
|
-
// manager-admit, member-peer registration, manager rotation,
|
|
66
|
-
//
|
|
67
|
-
|
|
83
|
+
// manager-admit, member-peer registration, manager rotation, sealing — the sole
|
|
84
|
+
// manager permanently freezing admission — + shared signing primitives reused
|
|
85
|
+
// across the flows).
|
|
86
|
+
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
87
|
// Engine-canonical datetime helper (shared by control + strand signed-write flows
|
|
69
88
|
// so a signed timestamp byte-matches the datetime-coerced column the CHECK sees).
|
|
70
89
|
export { canonicalDatetime } from './canonical-datetime.js';
|
|
@@ -76,12 +95,12 @@ export { SeedBootstrapService, SEED_PROTOCOL, ed25519PublicKeyB64FromPeerId } fr
|
|
|
76
95
|
// Peer Authorization (shared owner-signature digest + offline verifier)
|
|
77
96
|
export { peerAuthorizationDigest, cadrePeerVoucherDigest, cadrePeerRemoveDigest, deviceTokenAddDigest, deviceTokenRemoveDigest, formationConsentDigest, verifyPeerAuthorization, verifyCadrePeerVoucher, verifyFormationConsent } from './peer-authorization.js';
|
|
78
97
|
// Strand Wake (control-network push-wake protocol)
|
|
79
|
-
export { StrandWakeService, dialWake, WAKE_PROTOCOL } from './strand-wake-protocol.js';
|
|
98
|
+
export { StrandWakeService, dialWake, WAKE_PROTOCOL, DEFAULT_WAKE_DIAL_BUDGET_MS } from './strand-wake-protocol.js';
|
|
80
99
|
// Strand Address (control-network strand-address RPC) — wire types come via
|
|
81
100
|
// `export * from './types.js'` (StrandAddrRequest / StrandAddrResponse).
|
|
82
101
|
export { StrandAddrService, collectStrandAddrs, STRAND_ADDR_PROTOCOL } from './strand-addr-protocol.js';
|
|
83
102
|
// 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';
|
|
103
|
+
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
104
|
// Device-token record (self-published, signed FCM/APNs push token — CadrePeer sibling)
|
|
86
105
|
export { deviceTokenSignedPayload, signDeviceTokenRecord, verifyDeviceTokenSignature, isPushPlatform } from './device-token.js';
|
|
87
106
|
// Strand-wake payload contract (canonical; shared by the server sender + RN receiver)
|
|
@@ -102,13 +121,21 @@ export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy } from './se
|
|
|
102
121
|
// Schema Verification
|
|
103
122
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
104
123
|
// Strand Formation transport (native cadre-core protocol)
|
|
105
|
-
export { FormationListener, dialFormation, isValidResponderCreatesResult, FORMATION_PROTOCOL } from './strand-formation-protocol.js';
|
|
124
|
+
export { FormationListener, dialFormation, isValidResponderCreatesResult, sanitizeStrandAddrs, FORMATION_PROTOCOL } from './strand-formation-protocol.js';
|
|
106
125
|
// Strand Formation manager (drives the native transport)
|
|
107
126
|
export { StrandFormationManager, createStrandFormationManager } from './strand-formation-manager.js';
|
|
108
127
|
// 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
|
|
128
|
+
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';
|
|
129
|
+
// Thrown out of `CadreNode.start()` when a `network.relayAddrs` reservation does
|
|
130
|
+
// not land on its first attempt — the fail-fast posture of that config field now
|
|
131
|
+
// that the control node reserves AFTER control-database bring-up (relay-addrs.ts).
|
|
132
|
+
// `UnbindableListenAddressError` is the same posture for the OTHER half of the listen
|
|
133
|
+
// config: a `network.listenAddrs` entry whose transport the node will not have refuses
|
|
134
|
+
// start instead of being silently dropped by libp2p's transport manager.
|
|
135
|
+
export { RelayReservationFailedError, UnbindableListenAddressError, RELAY_SEARCH_LISTEN_ADDR } from './relay-addrs.js';
|
|
136
|
+
// Relay reservation via the bare `/p2p-circuit` search listener — the one route
|
|
137
|
+
// every control node takes; `network.relayAddrs` is its fail-fast posture
|
|
138
|
+
// (see relay-reservation.ts)
|
|
112
139
|
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
140
|
// Connection-path diagnostics (relayed vs direct classification + summary)
|
|
114
141
|
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,EAC7B,oBAAoB,EACpB,wBAAwB,EACxB,8BAA8B,EAC9B,4BAA4B,EAC5B,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAElC,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,8EAA8E;AAC9E,+EAA+E;AAC/E,2BAA2B;AAC3B,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EAGxB,MAAM,gBAAgB,CAAC;AAExB,8EAA8E;AAC9E,8EAA8E;AAC9E,gFAAgF;AAChF,OAAO,EACL,uBAAuB,EACvB,aAAa,EAEd,MAAM,mBAAmB,CAAC;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