@vapi-network/core 0.15.0 → 0.15.2
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 +1 -1
- package/dist/agent-link.d.ts +6 -0
- package/dist/agent-link.d.ts.map +1 -1
- package/dist/agent-link.js +76 -9
- package/dist/agent-link.js.map +1 -1
- package/dist/atomic-file.d.ts +1 -0
- package/dist/atomic-file.d.ts.map +1 -1
- package/dist/backup.js +7 -5
- package/dist/backup.js.map +1 -1
- package/dist/cloud-backup.js +81 -13
- package/dist/cloud-backup.js.map +2 -2
- package/dist/docs.d.ts.map +1 -1
- package/dist/index.js +230 -82
- package/dist/index.js.map +2 -2
- package/dist/net-guard.d.ts +17 -0
- package/dist/net-guard.d.ts.map +1 -1
- package/dist/router-client.d.ts.map +1 -1
- package/dist/router-client.js +163 -70
- package/dist/router-client.js.map +2 -2
- package/dist/secrets.js +20 -9
- package/dist/secrets.js.map +1 -1
- package/dist/support-report.d.ts +1 -1
- package/dist/tasks.js +79 -11
- package/dist/tasks.js.map +2 -2
- package/dist/transfer.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/net-guard.d.ts
CHANGED
|
@@ -10,4 +10,21 @@ export declare function createPublicFetch(options: {
|
|
|
10
10
|
lookup?: LookupFn;
|
|
11
11
|
}): typeof fetch;
|
|
12
12
|
export declare function pinnedLookup(lookup: LookupFn): LookupFunction;
|
|
13
|
+
/**
|
|
14
|
+
* A request the guard refused before connecting. `reason` is `unresolved` when
|
|
15
|
+
* the hostname's DNS lookup failed or timed out, and `blocked` otherwise.
|
|
16
|
+
*/
|
|
17
|
+
export declare class NetworkGuardError extends Error {
|
|
18
|
+
readonly reason: "blocked" | "unresolved";
|
|
19
|
+
constructor(message: string, reason: "blocked" | "unresolved");
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Says why a request to `url` never got an answer, in words that are safe to
|
|
23
|
+
* print: the host, and a Node system error code such as `ECONNREFUSED`, never
|
|
24
|
+
* the error's own message. When the proxy variable for the URL's protocol is
|
|
25
|
+
* set it adds how Node.js treats it: the proxy is used only with
|
|
26
|
+
* `NODE_USE_ENV_PROXY=1`, and the host must still resolve on this machine
|
|
27
|
+
* because the guard looks it up first.
|
|
28
|
+
*/
|
|
29
|
+
export declare function describeNetworkFailure(error: unknown, url: URL, env?: NodeJS.ProcessEnv): string;
|
|
13
30
|
//# sourceMappingURL=net-guard.d.ts.map
|
package/dist/net-guard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"net-guard.d.ts","sourceRoot":"","sources":["../src/net-guard.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAGrD,MAAM,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAO/D,wBAAsB,eAAe,CACnC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE;IAAE,mBAAmB,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/E,OAAO,CAAC,IAAI,CAAC,CA0Cf;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,QAAQ,CAAC;CACnB,GAAG,OAAO,KAAK,CAmDf;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,GAAG,cAAc,CAoB7D"}
|
|
1
|
+
{"version":3,"file":"net-guard.d.ts","sourceRoot":"","sources":["../src/net-guard.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAGrD,MAAM,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAO/D,wBAAsB,eAAe,CACnC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE;IAAE,mBAAmB,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/E,OAAO,CAAC,IAAI,CAAC,CA0Cf;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,QAAQ,CAAC;CACnB,GAAG,OAAO,KAAK,CAmDf;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,GAAG,cAAc,CAoB7D;AAyHD;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAGxC,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,YAAY;gBADzC,OAAO,EAAE,MAAM,EACN,MAAM,EAAE,SAAS,GAAG,YAAY;CAK5C;AAgBD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,GAAG,EACR,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,CA6BR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-client.d.ts","sourceRoot":"","sources":["../src/router-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"router-client.d.ts","sourceRoot":"","sources":["../src/router-client.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAI7C,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGxD,OAAO,EAA6C,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,M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C;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,CAAC;AAE7B,gGAAgG;AAChG,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,qBAAqB,EAC9B,OAAO,GAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAAC,GAAG,CAAC,EAAE,IAAI,CAAA;CAAO,GACvE,OAAO,CAAC,uBAAuB,CAAC,CA+BlC;AA+DD,qEAAqE;AACrE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,qBAAqB;;;;;;;;;;;;;;;EAiBnE;AAmCD,wBAAsB,UAAU,CAC9B,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAsKrB;AA6SD,wBAAsB,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8D3E;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CAwBD;AAED,sGAAsG;AACtG,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,gBAAgB,EACtB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CAAO,GAChD,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAa9C"}
|
package/dist/router-client.js
CHANGED
|
@@ -36714,12 +36714,12 @@ async function removeStaleLock(path) {
|
|
|
36714
36714
|
const pid = lockOwnerPid(owner);
|
|
36715
36715
|
if (pid !== void 0 && processIsAlive(pid)) return;
|
|
36716
36716
|
await atomicFileTestHooks?.beforeStaleLockBreak?.(path);
|
|
36717
|
-
await removeOwnedLock(path, [owner]);
|
|
36717
|
+
await removeOwnedLock(path, [owner], true);
|
|
36718
36718
|
} catch (error61) {
|
|
36719
36719
|
if (!hasCode(error61, "ENOENT")) throw error61;
|
|
36720
36720
|
}
|
|
36721
36721
|
}
|
|
36722
|
-
async function removeOwnedLock(path, owners) {
|
|
36722
|
+
async function removeOwnedLock(path, owners, staleDeadOwner = false) {
|
|
36723
36723
|
const tombPath = `${path}.stale.${randomBytes2(16).toString("hex")}`;
|
|
36724
36724
|
try {
|
|
36725
36725
|
await rename(path, tombPath);
|
|
@@ -36728,7 +36728,7 @@ async function removeOwnedLock(path, owners) {
|
|
|
36728
36728
|
await removeOwnedTombs(path, owners);
|
|
36729
36729
|
const currentOwner = await readFile(path, "utf8").catch(() => void 0);
|
|
36730
36730
|
if (currentOwner !== void 0 && owners.includes(currentOwner)) {
|
|
36731
|
-
await removeOwnedLock(path, owners);
|
|
36731
|
+
await removeOwnedLock(path, owners, staleDeadOwner);
|
|
36732
36732
|
}
|
|
36733
36733
|
return;
|
|
36734
36734
|
}
|
|
@@ -36737,6 +36737,7 @@ async function removeOwnedLock(path, owners) {
|
|
|
36737
36737
|
let pendingError;
|
|
36738
36738
|
let renamedOwner;
|
|
36739
36739
|
try {
|
|
36740
|
+
await atomicFileTestHooks?.afterLockRename?.(tombPath);
|
|
36740
36741
|
renamedOwner = await readFile(tombPath, "utf8");
|
|
36741
36742
|
if (!owners.includes(renamedOwner) && !lockOwnerReleased(renamedOwner)) {
|
|
36742
36743
|
await atomicFileTestHooks?.afterMismatchedLockRename?.(path);
|
|
@@ -36745,6 +36746,7 @@ async function removeOwnedLock(path, owners) {
|
|
|
36745
36746
|
await atomicFileTestHooks?.afterMismatchedLockRestore?.(path);
|
|
36746
36747
|
}
|
|
36747
36748
|
} catch (error61) {
|
|
36749
|
+
if (hasCode(error61, "ENOENT")) return;
|
|
36748
36750
|
pendingError = error61;
|
|
36749
36751
|
}
|
|
36750
36752
|
try {
|
|
@@ -36753,7 +36755,7 @@ async function removeOwnedLock(path, owners) {
|
|
|
36753
36755
|
} catch (error61) {
|
|
36754
36756
|
if (!tombUnlinkTolerated(
|
|
36755
36757
|
error61,
|
|
36756
|
-
renamedOwner !== void 0 && lockOwnerReleased(renamedOwner) && owners.includes(renamedOwner)
|
|
36758
|
+
renamedOwner !== void 0 && (lockOwnerReleased(renamedOwner) || staleDeadOwner) && owners.includes(renamedOwner)
|
|
36757
36759
|
) && pendingError === void 0) {
|
|
36758
36760
|
pendingError = error61;
|
|
36759
36761
|
}
|
|
@@ -36950,7 +36952,7 @@ async function assertPublicUrl(url2, options) {
|
|
|
36950
36952
|
options.timeoutMs ?? 5e3
|
|
36951
36953
|
);
|
|
36952
36954
|
} catch {
|
|
36953
|
-
throw guardError(url2);
|
|
36955
|
+
throw guardError(url2, "unresolved");
|
|
36954
36956
|
}
|
|
36955
36957
|
if (addresses.length === 0 || addresses.some(isNonPublicAddress)) {
|
|
36956
36958
|
throw guardError(url2);
|
|
@@ -37105,11 +37107,68 @@ function isNonPublicIpv6(hextets) {
|
|
|
37105
37107
|
const isDocumentation = first === 8193 && hextets[1] === 3512;
|
|
37106
37108
|
return isUnspecified || isLoopback || isUniqueLocal || isLinkLocal || isSiteLocal || isMulticast || isDocumentation;
|
|
37107
37109
|
}
|
|
37108
|
-
|
|
37109
|
-
|
|
37110
|
-
|
|
37110
|
+
var NetworkGuardError = class extends Error {
|
|
37111
|
+
constructor(message, reason) {
|
|
37112
|
+
super(message);
|
|
37113
|
+
this.reason = reason;
|
|
37114
|
+
this.name = "NetworkGuardError";
|
|
37115
|
+
}
|
|
37116
|
+
reason;
|
|
37117
|
+
};
|
|
37118
|
+
function guardError(url2, reason = "blocked") {
|
|
37119
|
+
return new NetworkGuardError(
|
|
37120
|
+
`URL hostname ${JSON.stringify(url2.hostname)} is not allowed; private or internal destinations require allowPrivateNetwork true in the vAPI config.`,
|
|
37121
|
+
reason
|
|
37111
37122
|
);
|
|
37112
37123
|
}
|
|
37124
|
+
var PROXY_VARIABLES = {
|
|
37125
|
+
"https:": ["HTTPS_PROXY", "https_proxy"],
|
|
37126
|
+
"http:": ["HTTP_PROXY", "http_proxy"]
|
|
37127
|
+
};
|
|
37128
|
+
var SYSTEM_ERROR_CODE = /^[A-Z][A-Z0-9_]{1,39}$/u;
|
|
37129
|
+
function describeNetworkFailure(error61, url2, env = process.env) {
|
|
37130
|
+
const host = url2.host;
|
|
37131
|
+
let reason;
|
|
37132
|
+
const guard = guardReason(error61);
|
|
37133
|
+
if (guard !== void 0) {
|
|
37134
|
+
reason = guard === "unresolved" ? `the DNS lookup for ${host} failed` : `${host} is not a public address`;
|
|
37135
|
+
} else if (isTimeout(error61)) {
|
|
37136
|
+
reason = `the connection to ${host} timed out`;
|
|
37137
|
+
} else {
|
|
37138
|
+
const code = systemErrorCode(error61);
|
|
37139
|
+
reason = `could not connect to ${host}${code === void 0 ? "" : ` (${code})`}`;
|
|
37140
|
+
}
|
|
37141
|
+
const proxy = (PROXY_VARIABLES[url2.protocol] ?? []).find(
|
|
37142
|
+
(name) => (env[name] ?? "").trim() !== ""
|
|
37143
|
+
);
|
|
37144
|
+
let hint = "";
|
|
37145
|
+
if (proxy !== void 0) {
|
|
37146
|
+
if (env.NODE_USE_ENV_PROXY !== "1") {
|
|
37147
|
+
hint = ` ${proxy} is set, but Node.js uses it only with NODE_USE_ENV_PROXY=1 (Node.js 22.21 or later): run the command again with NODE_USE_ENV_PROXY=1.`;
|
|
37148
|
+
} else if (guard === "unresolved") {
|
|
37149
|
+
hint = ` vapi looks ${host} up on this machine before it uses the proxy in ${proxy}, so the name must resolve here too.`;
|
|
37150
|
+
} else if (guard === void 0) {
|
|
37151
|
+
hint = ` NODE_USE_ENV_PROXY=1 and ${proxy} are set, so the proxy may have refused the connection.`;
|
|
37152
|
+
}
|
|
37153
|
+
}
|
|
37154
|
+
return `${reason}.${hint}`;
|
|
37155
|
+
}
|
|
37156
|
+
function guardReason(error61) {
|
|
37157
|
+
if (!(error61 instanceof Error) || error61.name !== "NetworkGuardError") return void 0;
|
|
37158
|
+
const reason = error61.reason;
|
|
37159
|
+
return reason === "blocked" || reason === "unresolved" ? reason : void 0;
|
|
37160
|
+
}
|
|
37161
|
+
function isTimeout(error61) {
|
|
37162
|
+
return error61 instanceof Error && (error61.name === "TimeoutError" || error61.name === "AbortError");
|
|
37163
|
+
}
|
|
37164
|
+
function systemErrorCode(error61) {
|
|
37165
|
+
for (let current = error61, depth = 0; current instanceof Error && depth < 3; depth += 1) {
|
|
37166
|
+
const code = current.code;
|
|
37167
|
+
if (typeof code === "string" && SYSTEM_ERROR_CODE.test(code)) return code;
|
|
37168
|
+
current = current.cause;
|
|
37169
|
+
}
|
|
37170
|
+
return void 0;
|
|
37171
|
+
}
|
|
37113
37172
|
|
|
37114
37173
|
// src/networks.ts
|
|
37115
37174
|
var USDC_DECIMALS = 6;
|
|
@@ -37866,7 +37925,7 @@ async function withCredentialLockFile(lockPath, operation) {
|
|
|
37866
37925
|
try {
|
|
37867
37926
|
return await operation();
|
|
37868
37927
|
} finally {
|
|
37869
|
-
await handle.close();
|
|
37928
|
+
await handle.close().catch(() => void 0);
|
|
37870
37929
|
await unlink2(lockPath).catch(() => void 0);
|
|
37871
37930
|
}
|
|
37872
37931
|
}
|
|
@@ -37923,16 +37982,25 @@ function withBearer(init, accessToken) {
|
|
|
37923
37982
|
async function safeFetch(fetchImpl, input2, init) {
|
|
37924
37983
|
try {
|
|
37925
37984
|
return await fetchImpl(input2, init);
|
|
37926
|
-
} catch {
|
|
37927
|
-
throw httpError(
|
|
37985
|
+
} catch (error61) {
|
|
37986
|
+
throw httpError(`The vAPI agent link request failed: ${networkFailure(error61, input2)}`);
|
|
37928
37987
|
}
|
|
37929
37988
|
}
|
|
37930
37989
|
async function safeAgentFetch(fetchImpl, input2, init) {
|
|
37931
37990
|
try {
|
|
37932
37991
|
return await fetchImpl(input2, init);
|
|
37992
|
+
} catch (error61) {
|
|
37993
|
+
throw httpError(`The vAPI agent request failed: ${networkFailure(error61, input2)}`);
|
|
37994
|
+
}
|
|
37995
|
+
}
|
|
37996
|
+
function networkFailure(error61, input2) {
|
|
37997
|
+
let url2;
|
|
37998
|
+
try {
|
|
37999
|
+
url2 = new URL(input2 instanceof Request ? input2.url : input2);
|
|
37933
38000
|
} catch {
|
|
37934
|
-
|
|
38001
|
+
return "the request did not reach vAPI.";
|
|
37935
38002
|
}
|
|
38003
|
+
return describeNetworkFailure(error61, url2);
|
|
37936
38004
|
}
|
|
37937
38005
|
function notLinkedError() {
|
|
37938
38006
|
return new AgentLinkError("not_linked", "Run vapi login first.");
|
|
@@ -38498,7 +38566,7 @@ async function withLedgerLock(path, operation) {
|
|
|
38498
38566
|
try {
|
|
38499
38567
|
return await operation();
|
|
38500
38568
|
} finally {
|
|
38501
|
-
await handle.close();
|
|
38569
|
+
await handle.close().catch(() => void 0);
|
|
38502
38570
|
await unlink4(lockPath).catch(() => void 0);
|
|
38503
38571
|
}
|
|
38504
38572
|
}
|
|
@@ -44839,13 +44907,32 @@ async function transferBetweenAccounts(args) {
|
|
|
44839
44907
|
if (existing !== void 0 && existing.transfer?.status !== "failed") {
|
|
44840
44908
|
throw transferError("authorization_invalid");
|
|
44841
44909
|
}
|
|
44842
|
-
|
|
44843
|
-
|
|
44844
|
-
|
|
44845
|
-
|
|
44846
|
-
|
|
44847
|
-
|
|
44848
|
-
|
|
44910
|
+
try {
|
|
44911
|
+
await appendTransferReceipt(context, request, {
|
|
44912
|
+
receiptId,
|
|
44913
|
+
status: "unknown",
|
|
44914
|
+
txHash: null,
|
|
44915
|
+
replayed: false,
|
|
44916
|
+
reservedOn
|
|
44917
|
+
});
|
|
44918
|
+
} catch (error61) {
|
|
44919
|
+
let persisted;
|
|
44920
|
+
try {
|
|
44921
|
+
persisted = await findTransferReceipt(context, nonce);
|
|
44922
|
+
} catch {
|
|
44923
|
+
authorizationPersisted = true;
|
|
44924
|
+
}
|
|
44925
|
+
if (persisted !== void 0 && persisted.transfer?.status !== "failed") {
|
|
44926
|
+
authorizationPersisted = true;
|
|
44927
|
+
}
|
|
44928
|
+
if (!authorizationPersisted) throw error61;
|
|
44929
|
+
return transferResult(context, {
|
|
44930
|
+
status: "unknown",
|
|
44931
|
+
txHash: null,
|
|
44932
|
+
nonce: request.authorization.nonce,
|
|
44933
|
+
replayed: false
|
|
44934
|
+
});
|
|
44935
|
+
}
|
|
44849
44936
|
try {
|
|
44850
44937
|
await syncReceipts(context.receiptsPath);
|
|
44851
44938
|
} catch (error61) {
|
|
@@ -46777,7 +46864,7 @@ var RunBudgetError = class extends Error {
|
|
|
46777
46864
|
};
|
|
46778
46865
|
|
|
46779
46866
|
// src/support-report.ts
|
|
46780
|
-
var VAPI_CLIENT_VERSION = "0.15.
|
|
46867
|
+
var VAPI_CLIENT_VERSION = "0.15.2";
|
|
46781
46868
|
|
|
46782
46869
|
// src/x402-pay.ts
|
|
46783
46870
|
var X402PaymentError = class extends Error {
|
|
@@ -48503,26 +48590,28 @@ async function ensureBalanceRouterKey(deps, paidLink) {
|
|
|
48503
48590
|
if (!parsed.success) {
|
|
48504
48591
|
throw new RouterClientError("http", "The Router balance key response was invalid.");
|
|
48505
48592
|
}
|
|
48506
|
-
|
|
48507
|
-
|
|
48508
|
-
|
|
48509
|
-
|
|
48510
|
-
|
|
48511
|
-
|
|
48512
|
-
|
|
48513
|
-
|
|
48514
|
-
|
|
48515
|
-
|
|
48516
|
-
|
|
48517
|
-
|
|
48518
|
-
|
|
48519
|
-
|
|
48520
|
-
|
|
48521
|
-
|
|
48522
|
-
|
|
48523
|
-
|
|
48524
|
-
|
|
48525
|
-
|
|
48593
|
+
await withCredentialPublishLock(deps.wallets, deps.wallet, async () => {
|
|
48594
|
+
const currentLink = await linkedWallet(deps);
|
|
48595
|
+
if (!sameAgentLink(currentLink, paidLink)) {
|
|
48596
|
+
throw new RouterClientError(
|
|
48597
|
+
"http",
|
|
48598
|
+
"The agent link changed while fetching the Router balance key."
|
|
48599
|
+
);
|
|
48600
|
+
}
|
|
48601
|
+
const returnedBase = validRouterBaseUrl(parsed.data.router_base_url);
|
|
48602
|
+
const expectedBase = validRouterBaseUrl(link2.routerBaseUrl ?? DEFAULT_ROUTER_BASE_URL);
|
|
48603
|
+
if (returnedBase !== expectedBase) {
|
|
48604
|
+
throw new RouterClientError(
|
|
48605
|
+
"http",
|
|
48606
|
+
"The Router balance key response named an unexpected Router base URL."
|
|
48607
|
+
);
|
|
48608
|
+
}
|
|
48609
|
+
try {
|
|
48610
|
+
await deps.secrets.set(account, parsed.data.router_key);
|
|
48611
|
+
} catch {
|
|
48612
|
+
throw new RouterClientError("http", "The Router balance key could not be stored safely.");
|
|
48613
|
+
}
|
|
48614
|
+
});
|
|
48526
48615
|
}
|
|
48527
48616
|
);
|
|
48528
48617
|
}
|
|
@@ -48563,12 +48652,14 @@ async function routerBalanceCredentialSnapshot(deps) {
|
|
|
48563
48652
|
async function removeRejectedBalanceKey(deps, rejected) {
|
|
48564
48653
|
if (!deps.secrets.available) return;
|
|
48565
48654
|
await withAgentCredentialLock(deps.wallets, rejected.clientId, async () => {
|
|
48566
|
-
|
|
48567
|
-
|
|
48568
|
-
|
|
48569
|
-
|
|
48570
|
-
await deps.secrets.
|
|
48571
|
-
|
|
48655
|
+
await withCredentialPublishLock(deps.wallets, deps.wallet, async () => {
|
|
48656
|
+
const link2 = await linkedWallet(deps);
|
|
48657
|
+
if (link2.clientId !== rejected.clientId) return;
|
|
48658
|
+
const account = agentSecretAccounts(deps.wallet).routerBalance;
|
|
48659
|
+
if (await deps.secrets.get(account) === rejected.routerKey) {
|
|
48660
|
+
await deps.secrets.remove(account);
|
|
48661
|
+
}
|
|
48662
|
+
});
|
|
48572
48663
|
});
|
|
48573
48664
|
}
|
|
48574
48665
|
async function routerAccessToken(deps) {
|
|
@@ -48656,32 +48747,34 @@ async function rotateRouterKey(deps) {
|
|
|
48656
48747
|
validRouterBaseUrl(parsed.data.router_base_url);
|
|
48657
48748
|
try {
|
|
48658
48749
|
await withAgentCredentialLock(deps.wallets, link2.clientId, async () => {
|
|
48659
|
-
|
|
48660
|
-
|
|
48661
|
-
|
|
48662
|
-
|
|
48663
|
-
|
|
48664
|
-
|
|
48665
|
-
|
|
48666
|
-
previousKey = await deps.secrets.get(account);
|
|
48667
|
-
await deps.secrets.set(account, parsed.data.router_key);
|
|
48668
|
-
} catch {
|
|
48669
|
-
throw new RouterClientError("http", "The Router key could not be stored safely.");
|
|
48670
|
-
}
|
|
48671
|
-
try {
|
|
48672
|
-
await deps.wallets.setLink(deps.wallet, {
|
|
48673
|
-
...currentLink,
|
|
48674
|
-
routerBaseUrl: parsed.data.router_base_url
|
|
48675
|
-
});
|
|
48676
|
-
} catch {
|
|
48750
|
+
await withCredentialPublishLock(deps.wallets, deps.wallet, async () => {
|
|
48751
|
+
const currentLink = await linkedWallet(deps);
|
|
48752
|
+
if (!sameAgentLink(currentLink, link2)) {
|
|
48753
|
+
throw new RouterClientError("http", "The agent link changed during Router key rotation.");
|
|
48754
|
+
}
|
|
48755
|
+
const account = agentSecretAccounts(deps.wallet).routerStake;
|
|
48756
|
+
let previousKey;
|
|
48677
48757
|
try {
|
|
48678
|
-
|
|
48679
|
-
|
|
48758
|
+
previousKey = await deps.secrets.get(account);
|
|
48759
|
+
await deps.secrets.set(account, parsed.data.router_key);
|
|
48680
48760
|
} catch {
|
|
48681
|
-
|
|
48761
|
+
throw new RouterClientError("http", "The Router key could not be stored safely.");
|
|
48682
48762
|
}
|
|
48683
|
-
|
|
48684
|
-
|
|
48763
|
+
try {
|
|
48764
|
+
await deps.wallets.setLink(deps.wallet, {
|
|
48765
|
+
...currentLink,
|
|
48766
|
+
routerBaseUrl: parsed.data.router_base_url
|
|
48767
|
+
});
|
|
48768
|
+
} catch {
|
|
48769
|
+
try {
|
|
48770
|
+
if (previousKey === void 0) await deps.secrets.remove(account);
|
|
48771
|
+
else await deps.secrets.set(account, previousKey);
|
|
48772
|
+
} catch {
|
|
48773
|
+
await deps.wallets.clearLink(deps.wallet).catch(() => void 0);
|
|
48774
|
+
}
|
|
48775
|
+
throw new RouterClientError("http", "The Router key could not be stored safely.");
|
|
48776
|
+
}
|
|
48777
|
+
});
|
|
48685
48778
|
});
|
|
48686
48779
|
} catch (error61) {
|
|
48687
48780
|
if (error61 instanceof RouterClientError) throw error61;
|