@vapi-network/core 0.15.0 → 0.15.1
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 +3 -2
- package/dist/agent-link.js.map +1 -1
- package/dist/backup.js +1 -1
- package/dist/backup.js.map +1 -1
- package/dist/cloud-backup.js +2 -2
- package/dist/cloud-backup.js.map +1 -1
- package/dist/docs.d.ts.map +1 -1
- package/dist/index.js +149 -71
- package/dist/index.js.map +2 -2
- package/dist/router-client.d.ts.map +1 -1
- package/dist/router-client.js +84 -59
- package/dist/router-client.js.map +1 -1
- package/dist/secrets.js +1 -1
- package/dist/secrets.js.map +1 -1
- package/dist/support-report.d.ts +1 -1
- package/dist/tasks.js +2 -2
- package/dist/tasks.js.map +1 -1
- package/dist/transfer.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,qBAA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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
|
@@ -37866,7 +37866,7 @@ async function withCredentialLockFile(lockPath, operation) {
|
|
|
37866
37866
|
try {
|
|
37867
37867
|
return await operation();
|
|
37868
37868
|
} finally {
|
|
37869
|
-
await handle.close();
|
|
37869
|
+
await handle.close().catch(() => void 0);
|
|
37870
37870
|
await unlink2(lockPath).catch(() => void 0);
|
|
37871
37871
|
}
|
|
37872
37872
|
}
|
|
@@ -38498,7 +38498,7 @@ async function withLedgerLock(path, operation) {
|
|
|
38498
38498
|
try {
|
|
38499
38499
|
return await operation();
|
|
38500
38500
|
} finally {
|
|
38501
|
-
await handle.close();
|
|
38501
|
+
await handle.close().catch(() => void 0);
|
|
38502
38502
|
await unlink4(lockPath).catch(() => void 0);
|
|
38503
38503
|
}
|
|
38504
38504
|
}
|
|
@@ -44839,13 +44839,32 @@ async function transferBetweenAccounts(args) {
|
|
|
44839
44839
|
if (existing !== void 0 && existing.transfer?.status !== "failed") {
|
|
44840
44840
|
throw transferError("authorization_invalid");
|
|
44841
44841
|
}
|
|
44842
|
-
|
|
44843
|
-
|
|
44844
|
-
|
|
44845
|
-
|
|
44846
|
-
|
|
44847
|
-
|
|
44848
|
-
|
|
44842
|
+
try {
|
|
44843
|
+
await appendTransferReceipt(context, request, {
|
|
44844
|
+
receiptId,
|
|
44845
|
+
status: "unknown",
|
|
44846
|
+
txHash: null,
|
|
44847
|
+
replayed: false,
|
|
44848
|
+
reservedOn
|
|
44849
|
+
});
|
|
44850
|
+
} catch (error61) {
|
|
44851
|
+
let persisted;
|
|
44852
|
+
try {
|
|
44853
|
+
persisted = await findTransferReceipt(context, nonce);
|
|
44854
|
+
} catch {
|
|
44855
|
+
authorizationPersisted = true;
|
|
44856
|
+
}
|
|
44857
|
+
if (persisted !== void 0 && persisted.transfer?.status !== "failed") {
|
|
44858
|
+
authorizationPersisted = true;
|
|
44859
|
+
}
|
|
44860
|
+
if (!authorizationPersisted) throw error61;
|
|
44861
|
+
return transferResult(context, {
|
|
44862
|
+
status: "unknown",
|
|
44863
|
+
txHash: null,
|
|
44864
|
+
nonce: request.authorization.nonce,
|
|
44865
|
+
replayed: false
|
|
44866
|
+
});
|
|
44867
|
+
}
|
|
44849
44868
|
try {
|
|
44850
44869
|
await syncReceipts(context.receiptsPath);
|
|
44851
44870
|
} catch (error61) {
|
|
@@ -46777,7 +46796,7 @@ var RunBudgetError = class extends Error {
|
|
|
46777
46796
|
};
|
|
46778
46797
|
|
|
46779
46798
|
// src/support-report.ts
|
|
46780
|
-
var VAPI_CLIENT_VERSION = "0.15.
|
|
46799
|
+
var VAPI_CLIENT_VERSION = "0.15.1";
|
|
46781
46800
|
|
|
46782
46801
|
// src/x402-pay.ts
|
|
46783
46802
|
var X402PaymentError = class extends Error {
|
|
@@ -48503,26 +48522,28 @@ async function ensureBalanceRouterKey(deps, paidLink) {
|
|
|
48503
48522
|
if (!parsed.success) {
|
|
48504
48523
|
throw new RouterClientError("http", "The Router balance key response was invalid.");
|
|
48505
48524
|
}
|
|
48506
|
-
|
|
48507
|
-
|
|
48508
|
-
|
|
48509
|
-
|
|
48510
|
-
|
|
48511
|
-
|
|
48512
|
-
|
|
48513
|
-
|
|
48514
|
-
|
|
48515
|
-
|
|
48516
|
-
|
|
48517
|
-
|
|
48518
|
-
|
|
48519
|
-
|
|
48520
|
-
|
|
48521
|
-
|
|
48522
|
-
|
|
48523
|
-
|
|
48524
|
-
|
|
48525
|
-
|
|
48525
|
+
await withCredentialPublishLock(deps.wallets, deps.wallet, async () => {
|
|
48526
|
+
const currentLink = await linkedWallet(deps);
|
|
48527
|
+
if (!sameAgentLink(currentLink, paidLink)) {
|
|
48528
|
+
throw new RouterClientError(
|
|
48529
|
+
"http",
|
|
48530
|
+
"The agent link changed while fetching the Router balance key."
|
|
48531
|
+
);
|
|
48532
|
+
}
|
|
48533
|
+
const returnedBase = validRouterBaseUrl(parsed.data.router_base_url);
|
|
48534
|
+
const expectedBase = validRouterBaseUrl(link2.routerBaseUrl ?? DEFAULT_ROUTER_BASE_URL);
|
|
48535
|
+
if (returnedBase !== expectedBase) {
|
|
48536
|
+
throw new RouterClientError(
|
|
48537
|
+
"http",
|
|
48538
|
+
"The Router balance key response named an unexpected Router base URL."
|
|
48539
|
+
);
|
|
48540
|
+
}
|
|
48541
|
+
try {
|
|
48542
|
+
await deps.secrets.set(account, parsed.data.router_key);
|
|
48543
|
+
} catch {
|
|
48544
|
+
throw new RouterClientError("http", "The Router balance key could not be stored safely.");
|
|
48545
|
+
}
|
|
48546
|
+
});
|
|
48526
48547
|
}
|
|
48527
48548
|
);
|
|
48528
48549
|
}
|
|
@@ -48563,12 +48584,14 @@ async function routerBalanceCredentialSnapshot(deps) {
|
|
|
48563
48584
|
async function removeRejectedBalanceKey(deps, rejected) {
|
|
48564
48585
|
if (!deps.secrets.available) return;
|
|
48565
48586
|
await withAgentCredentialLock(deps.wallets, rejected.clientId, async () => {
|
|
48566
|
-
|
|
48567
|
-
|
|
48568
|
-
|
|
48569
|
-
|
|
48570
|
-
await deps.secrets.
|
|
48571
|
-
|
|
48587
|
+
await withCredentialPublishLock(deps.wallets, deps.wallet, async () => {
|
|
48588
|
+
const link2 = await linkedWallet(deps);
|
|
48589
|
+
if (link2.clientId !== rejected.clientId) return;
|
|
48590
|
+
const account = agentSecretAccounts(deps.wallet).routerBalance;
|
|
48591
|
+
if (await deps.secrets.get(account) === rejected.routerKey) {
|
|
48592
|
+
await deps.secrets.remove(account);
|
|
48593
|
+
}
|
|
48594
|
+
});
|
|
48572
48595
|
});
|
|
48573
48596
|
}
|
|
48574
48597
|
async function routerAccessToken(deps) {
|
|
@@ -48656,32 +48679,34 @@ async function rotateRouterKey(deps) {
|
|
|
48656
48679
|
validRouterBaseUrl(parsed.data.router_base_url);
|
|
48657
48680
|
try {
|
|
48658
48681
|
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 {
|
|
48682
|
+
await withCredentialPublishLock(deps.wallets, deps.wallet, async () => {
|
|
48683
|
+
const currentLink = await linkedWallet(deps);
|
|
48684
|
+
if (!sameAgentLink(currentLink, link2)) {
|
|
48685
|
+
throw new RouterClientError("http", "The agent link changed during Router key rotation.");
|
|
48686
|
+
}
|
|
48687
|
+
const account = agentSecretAccounts(deps.wallet).routerStake;
|
|
48688
|
+
let previousKey;
|
|
48677
48689
|
try {
|
|
48678
|
-
|
|
48679
|
-
|
|
48690
|
+
previousKey = await deps.secrets.get(account);
|
|
48691
|
+
await deps.secrets.set(account, parsed.data.router_key);
|
|
48680
48692
|
} catch {
|
|
48681
|
-
|
|
48693
|
+
throw new RouterClientError("http", "The Router key could not be stored safely.");
|
|
48682
48694
|
}
|
|
48683
|
-
|
|
48684
|
-
|
|
48695
|
+
try {
|
|
48696
|
+
await deps.wallets.setLink(deps.wallet, {
|
|
48697
|
+
...currentLink,
|
|
48698
|
+
routerBaseUrl: parsed.data.router_base_url
|
|
48699
|
+
});
|
|
48700
|
+
} catch {
|
|
48701
|
+
try {
|
|
48702
|
+
if (previousKey === void 0) await deps.secrets.remove(account);
|
|
48703
|
+
else await deps.secrets.set(account, previousKey);
|
|
48704
|
+
} catch {
|
|
48705
|
+
await deps.wallets.clearLink(deps.wallet).catch(() => void 0);
|
|
48706
|
+
}
|
|
48707
|
+
throw new RouterClientError("http", "The Router key could not be stored safely.");
|
|
48708
|
+
}
|
|
48709
|
+
});
|
|
48685
48710
|
});
|
|
48686
48711
|
} catch (error61) {
|
|
48687
48712
|
if (error61 instanceof RouterClientError) throw error61;
|