@cello-protocol/daemon 0.0.51 → 0.0.52
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/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/dist/cello-node-transport-dialer.d.ts +0 -59
- package/dist/cello-node-transport-dialer.d.ts.map +0 -1
- package/dist/cello-node-transport-dialer.js +0 -108
- package/dist/cello-node-transport-dialer.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -17,4 +17,6 @@ export { InMemoryManifestVersionStore } from "./manifest-version-store.js";
|
|
|
17
17
|
export { DbManifestVersionStore } from "./manifest-version-store-db.js";
|
|
18
18
|
export { ManifestDirectoryChallengeVerifier, TestDirectoryChallengeVerifier } from "./challenge-verifier.js";
|
|
19
19
|
export { DUAL_SURFACE_VERBS, MCP_ONLY_TOOLS, NON_TOOL_IDENTIFIERS, DEAD_CLI_VERBS, deadCliVerbPattern, RENAMED_AWAY_TOOLS, knownToolNames, toCliGuidance, renderForSurface, type DualSurfaceVerb, type ClientSurface, } from "./vocabulary.js";
|
|
20
|
+
export { NetworkDirectoryNode, bootstrapNetworkKeyShares, runNetworkDkg, runNetworkRefresh, } from "./network-directory-node.js";
|
|
21
|
+
export type { FrostAuthSigner } from "./network-directory-node.js";
|
|
20
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,MAAM,EACN,eAAe,EACf,UAAU,EACV,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,q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C,YAAY,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20,4 +20,10 @@ export { ManifestDirectoryChallengeVerifier, TestDirectoryChallengeVerifier } fr
|
|
|
20
20
|
// registry and the connect shim's audit test derive their names from the SAME table the daemon
|
|
21
21
|
// renders its guidance from, instead of three lists of literals that drift.
|
|
22
22
|
export { DUAL_SURFACE_VERBS, MCP_ONLY_TOOLS, NON_TOOL_IDENTIFIERS, DEAD_CLI_VERBS, deadCliVerbPattern, RENAMED_AWAY_TOOLS, knownToolNames, toCliGuidance, renderForSurface, } from "./vocabulary.js";
|
|
23
|
+
// The FROST/DKG directory-node client. This lives in the daemon because the daemon is the only
|
|
24
|
+
// process that runs a ceremony — it reimplements natively what the retired @cello-protocol/client
|
|
25
|
+
// used to own (daemon.ts: "the daemon never imports @cello-protocol/client"). Exported so
|
|
26
|
+
// trustless-cello's directory tests can drive a real DKG against a real directory without
|
|
27
|
+
// resurrecting the dead client package they used to import this from.
|
|
28
|
+
export { NetworkDirectoryNode, bootstrapNetworkKeyShares, runNetworkDkg, runNetworkRefresh, } from "./network-directory-node.js";
|
|
23
29
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,WAAW,EAAqB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACtG,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,EACzB,uBAAuB,GAExB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAA4D,MAAM,mBAAmB,CAAC;AACzG,OAAO,EAAE,eAAe,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1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cello-protocol/daemon",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.52",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"@signalapp/sqlcipher": "^3.3.5",
|
|
31
31
|
"cbor-x": "^1.6.0",
|
|
32
32
|
"it-length-prefixed": "^10.0.1",
|
|
33
|
-
"@cello-protocol/crypto": "0.0.
|
|
34
|
-
"@cello-protocol/
|
|
35
|
-
"@cello-protocol/
|
|
36
|
-
"@cello-protocol/
|
|
33
|
+
"@cello-protocol/crypto": "0.0.19",
|
|
34
|
+
"@cello-protocol/transport": "0.0.19",
|
|
35
|
+
"@cello-protocol/protocol-types": "0.0.21",
|
|
36
|
+
"@cello-protocol/gateway": "0.0.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^25.6.2",
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CELLO Daemon — cello-node-transport-dialer.ts (CELLO-M7-TRANSPORT-001)
|
|
3
|
-
*
|
|
4
|
-
* CelloNodeTransportDialer — the REAL TransportDialer (CELLO_ENV dev/staging/
|
|
5
|
-
* production). It performs the low-level dial operations the TransportSelector
|
|
6
|
-
* composes, over a live session CelloNode plus the daemon's relay registry.
|
|
7
|
-
*
|
|
8
|
-
* Review finding C1(b): no real TransportDialer existed — only the
|
|
9
|
-
* LocalTransportSelectorStub returned canned results. This is the production
|
|
10
|
-
* implementation the composition root wires when CELLO_ENV is a production
|
|
11
|
-
* variant.
|
|
12
|
-
*
|
|
13
|
-
* ─── Operations ──────────────────────────────────────────────────────────────
|
|
14
|
-
* dialDirect(peerId, addrs, timeoutMs) — dial the counterparty's direct
|
|
15
|
-
* multiaddrs (TCP/QUIC). Each addr is raced against timeoutMs. Throws if every
|
|
16
|
-
* address fails (the selector catches and falls back to relay — AC-006).
|
|
17
|
-
* dialRelay(relayCircuitAddr, peerId) — dial via the relay circuit address.
|
|
18
|
-
* relayCircuitAddr(assignment) — build the circuit address from the
|
|
19
|
-
* daemon's relay registry (NOT the assignment's address fields — AC-006), so
|
|
20
|
-
* the fallback works regardless of transport_mode.
|
|
21
|
-
* attemptDcutr(peerId) — observe whether libp2p's automatic
|
|
22
|
-
* dcutr hole-punch upgraded the relayed connection to direct within a window.
|
|
23
|
-
* Throws if no direct connection appears (non-fatal — selector logs DEBUG).
|
|
24
|
-
*
|
|
25
|
-
* SI-001: this dialer NEVER inspects transport_mode or infers strategy from
|
|
26
|
-
* address format — it only performs the operation the selector asks for. The
|
|
27
|
-
* authoritative transport_mode decision lives entirely in the TransportSelector.
|
|
28
|
-
*/
|
|
29
|
-
import type { SessionAssignment } from "@cello-protocol/protocol-types";
|
|
30
|
-
import type { CelloNode } from "@cello-protocol/transport";
|
|
31
|
-
import type { TransportDialer } from "./transport-selector.js";
|
|
32
|
-
/** A relay endpoint from the daemon's relay registry (populated at directory connect). */
|
|
33
|
-
export interface RelayEndpoint {
|
|
34
|
-
peerId: string;
|
|
35
|
-
multiaddrs: string[];
|
|
36
|
-
}
|
|
37
|
-
export interface CelloNodeTransportDialerOptions {
|
|
38
|
-
/** The session node used to dial the counterparty. */
|
|
39
|
-
node: CelloNode;
|
|
40
|
-
/**
|
|
41
|
-
* The daemon's relay registry — returns the known relay endpoint, or null when
|
|
42
|
-
* no relay is registered. AC-006: the relay address is sourced here, never
|
|
43
|
-
* parsed from the assignment's address fields.
|
|
44
|
-
*/
|
|
45
|
-
relayRegistry: () => RelayEndpoint | null;
|
|
46
|
-
/** How long to wait for the dcutr upgrade to surface a direct connection (ms). */
|
|
47
|
-
dcutrObserveTimeoutMs?: number;
|
|
48
|
-
/** Poll interval while observing for the dcutr upgrade (ms). */
|
|
49
|
-
dcutrPollIntervalMs?: number;
|
|
50
|
-
}
|
|
51
|
-
export declare class CelloNodeTransportDialer implements TransportDialer {
|
|
52
|
-
#private;
|
|
53
|
-
constructor(opts: CelloNodeTransportDialerOptions);
|
|
54
|
-
dialDirect(peerId: string | undefined, addrs: string[], timeoutMs: number): Promise<void>;
|
|
55
|
-
dialRelay(relayCircuitAddr: string, _peerId: string | undefined): Promise<void>;
|
|
56
|
-
relayCircuitAddr(assignment: SessionAssignment): string;
|
|
57
|
-
attemptDcutr(peerId: string | undefined): Promise<void>;
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=cello-node-transport-dialer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cello-node-transport-dialer.d.ts","sourceRoot":"","sources":["../src/cello-node-transport-dialer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,0FAA0F;AAC1F,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,+BAA+B;IAC9C,sDAAsD;IACtD,IAAI,EAAE,SAAS,CAAC;IAChB;;;;OAIG;IACH,aAAa,EAAE,MAAM,aAAa,GAAG,IAAI,CAAC;IAC1C,kFAAkF;IAClF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,gEAAgE;IAChE,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAKD,qBAAa,wBAAyB,YAAW,eAAe;;gBAMlD,IAAI,EAAE,+BAA+B;IAO3C,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBzF,SAAS,CAAC,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrF,gBAAgB,CAAC,UAAU,EAAE,iBAAiB,GAAG,MAAM;IAajD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CA8B9D"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CELLO Daemon — cello-node-transport-dialer.ts (CELLO-M7-TRANSPORT-001)
|
|
3
|
-
*
|
|
4
|
-
* CelloNodeTransportDialer — the REAL TransportDialer (CELLO_ENV dev/staging/
|
|
5
|
-
* production). It performs the low-level dial operations the TransportSelector
|
|
6
|
-
* composes, over a live session CelloNode plus the daemon's relay registry.
|
|
7
|
-
*
|
|
8
|
-
* Review finding C1(b): no real TransportDialer existed — only the
|
|
9
|
-
* LocalTransportSelectorStub returned canned results. This is the production
|
|
10
|
-
* implementation the composition root wires when CELLO_ENV is a production
|
|
11
|
-
* variant.
|
|
12
|
-
*
|
|
13
|
-
* ─── Operations ──────────────────────────────────────────────────────────────
|
|
14
|
-
* dialDirect(peerId, addrs, timeoutMs) — dial the counterparty's direct
|
|
15
|
-
* multiaddrs (TCP/QUIC). Each addr is raced against timeoutMs. Throws if every
|
|
16
|
-
* address fails (the selector catches and falls back to relay — AC-006).
|
|
17
|
-
* dialRelay(relayCircuitAddr, peerId) — dial via the relay circuit address.
|
|
18
|
-
* relayCircuitAddr(assignment) — build the circuit address from the
|
|
19
|
-
* daemon's relay registry (NOT the assignment's address fields — AC-006), so
|
|
20
|
-
* the fallback works regardless of transport_mode.
|
|
21
|
-
* attemptDcutr(peerId) — observe whether libp2p's automatic
|
|
22
|
-
* dcutr hole-punch upgraded the relayed connection to direct within a window.
|
|
23
|
-
* Throws if no direct connection appears (non-fatal — selector logs DEBUG).
|
|
24
|
-
*
|
|
25
|
-
* SI-001: this dialer NEVER inspects transport_mode or infers strategy from
|
|
26
|
-
* address format — it only performs the operation the selector asks for. The
|
|
27
|
-
* authoritative transport_mode decision lives entirely in the TransportSelector.
|
|
28
|
-
*/
|
|
29
|
-
const DEFAULT_DCUTR_OBSERVE_TIMEOUT_MS = 10_000;
|
|
30
|
-
const DEFAULT_DCUTR_POLL_INTERVAL_MS = 250;
|
|
31
|
-
export class CelloNodeTransportDialer {
|
|
32
|
-
#node;
|
|
33
|
-
#relayRegistry;
|
|
34
|
-
#dcutrTimeoutMs;
|
|
35
|
-
#dcutrPollMs;
|
|
36
|
-
constructor(opts) {
|
|
37
|
-
this.#node = opts.node;
|
|
38
|
-
this.#relayRegistry = opts.relayRegistry;
|
|
39
|
-
this.#dcutrTimeoutMs = opts.dcutrObserveTimeoutMs ?? DEFAULT_DCUTR_OBSERVE_TIMEOUT_MS;
|
|
40
|
-
this.#dcutrPollMs = opts.dcutrPollIntervalMs ?? DEFAULT_DCUTR_POLL_INTERVAL_MS;
|
|
41
|
-
}
|
|
42
|
-
async dialDirect(peerId, addrs, timeoutMs) {
|
|
43
|
-
if (addrs.length === 0) {
|
|
44
|
-
throw new Error("no direct addresses to dial");
|
|
45
|
-
}
|
|
46
|
-
let lastError;
|
|
47
|
-
for (const addr of addrs) {
|
|
48
|
-
try {
|
|
49
|
-
await this.#withTimeout(this.#node.dial(addr), timeoutMs, `direct dial to ${addr}`);
|
|
50
|
-
return; // first successful dial wins
|
|
51
|
-
}
|
|
52
|
-
catch (err) {
|
|
53
|
-
lastError = err;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
throw lastError instanceof Error
|
|
57
|
-
? lastError
|
|
58
|
-
: new Error(`direct dial failed for all ${addrs.length} address(es): ${String(lastError)}`);
|
|
59
|
-
}
|
|
60
|
-
async dialRelay(relayCircuitAddr, _peerId) {
|
|
61
|
-
await this.#node.dial(relayCircuitAddr);
|
|
62
|
-
}
|
|
63
|
-
relayCircuitAddr(assignment) {
|
|
64
|
-
const relay = this.#relayRegistry();
|
|
65
|
-
if (!relay || relay.multiaddrs.length === 0) {
|
|
66
|
-
throw new Error("no relay endpoint registered — cannot build relay circuit address");
|
|
67
|
-
}
|
|
68
|
-
const counterparty = assignment.counterparty_session_peer_id;
|
|
69
|
-
if (!counterparty) {
|
|
70
|
-
throw new Error("assignment has no counterparty_session_peer_id for the relay circuit");
|
|
71
|
-
}
|
|
72
|
-
// /<relay-multiaddr>/p2p/<relay-peer-id>/p2p-circuit/p2p/<counterparty-session-peer-id>
|
|
73
|
-
return `${relay.multiaddrs[0]}/p2p/${relay.peerId}/p2p-circuit/p2p/${counterparty}`;
|
|
74
|
-
}
|
|
75
|
-
async attemptDcutr(peerId) {
|
|
76
|
-
if (!peerId) {
|
|
77
|
-
throw new Error("no counterparty peer id to observe dcutr upgrade for");
|
|
78
|
-
}
|
|
79
|
-
// libp2p's dcutr service runs automatically once a relayed connection exists.
|
|
80
|
-
// We observe whether it produced a direct (non-circuit) connection within the
|
|
81
|
-
// window. This is best-effort — failure is non-fatal (SI-003).
|
|
82
|
-
const deadline = Date.now() + this.#dcutrTimeoutMs;
|
|
83
|
-
for (;;) {
|
|
84
|
-
if (this.#node.hasDirectConnectionTo(peerId))
|
|
85
|
-
return;
|
|
86
|
-
if (Date.now() >= deadline) {
|
|
87
|
-
throw new Error(`dcutr did not establish a direct connection to ${peerId} within ${this.#dcutrTimeoutMs}ms`);
|
|
88
|
-
}
|
|
89
|
-
await new Promise((r) => setTimeout(r, this.#dcutrPollMs));
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
async #withTimeout(p, timeoutMs, label) {
|
|
93
|
-
let timer;
|
|
94
|
-
try {
|
|
95
|
-
return await Promise.race([
|
|
96
|
-
p,
|
|
97
|
-
new Promise((_resolve, reject) => {
|
|
98
|
-
timer = setTimeout(() => reject(new Error(`${label} timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
99
|
-
}),
|
|
100
|
-
]);
|
|
101
|
-
}
|
|
102
|
-
finally {
|
|
103
|
-
if (timer)
|
|
104
|
-
clearTimeout(timer);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=cello-node-transport-dialer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cello-node-transport-dialer.js","sourceRoot":"","sources":["../src/cello-node-transport-dialer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AA2BH,MAAM,gCAAgC,GAAG,MAAM,CAAC;AAChD,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAE3C,MAAM,OAAO,wBAAwB;IAC1B,KAAK,CAAY;IACjB,cAAc,CAA6B;IAC3C,eAAe,CAAS;IACxB,YAAY,CAAS;IAE9B,YAAY,IAAqC;QAC/C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,qBAAqB,IAAI,gCAAgC,CAAC;QACtF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,mBAAmB,IAAI,8BAA8B,CAAC;IACjF,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,MAA0B,EAAE,KAAe,EAAE,SAAiB;QAC7E,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,SAAkB,CAAC;QACvB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC;gBACpF,OAAO,CAAC,6BAA6B;YACvC,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC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