@vapi-network/core 0.11.0 → 0.12.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 +188 -178
- package/dist/cloud-backup.js +7 -1
- package/dist/cloud-backup.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +154 -7
- package/dist/index.js.map +3 -3
- package/dist/link-state.d.ts +21 -0
- package/dist/link-state.d.ts.map +1 -0
- package/dist/remote-account.d.ts +29 -0
- package/dist/remote-account.d.ts.map +1 -0
- package/dist/router-client.d.ts +3 -1
- package/dist/router-client.d.ts.map +1 -1
- package/dist/router-client.js +10 -3
- package/dist/router-client.js.map +1 -1
- package/dist/secret-store.d.ts.map +1 -1
- package/dist/support-report.d.ts +1 -1
- package/dist/vault-setup.d.ts +13 -0
- package/dist/vault-setup.d.ts.map +1 -0
- package/dist/wallet-store.d.ts +5 -0
- package/dist/wallet-store.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export * from "./run-budget.js";
|
|
|
37
37
|
export * from "./searches.js";
|
|
38
38
|
export * from "./secret-store.js";
|
|
39
39
|
export * from "./siblings.js";
|
|
40
|
+
export * from "./link-state.js";
|
|
40
41
|
export * from "./stats.js";
|
|
41
42
|
export * from "./spend-policy.js";
|
|
42
43
|
export * from "./spend-cap-exceeded.js";
|
|
@@ -49,10 +50,12 @@ export * from "./transfer.js";
|
|
|
49
50
|
export * from "./siwx.js";
|
|
50
51
|
export * from "./svm.js";
|
|
51
52
|
export * from "./vault-key.js";
|
|
53
|
+
export * from "./vault-setup.js";
|
|
52
54
|
export { readVaultFileUnlocked, VaultError, type StoredVaultFile, type VaultAccount, type VaultErrorCode, } from "./vault.js";
|
|
53
55
|
export * from "./wallet.js";
|
|
54
56
|
export * from "./wallet-store.js";
|
|
55
57
|
export * from "./x402.js";
|
|
58
|
+
export * from "./remote-account.js";
|
|
56
59
|
export * from "./x402-pay.js";
|
|
57
60
|
export { ARC_MAINNET_CAIP2, BROWSER_ENABLED_X402_NETWORK_CONFIG, CANONICAL_X402_USDC_NETWORKS, getCanonicalX402Usdc, SOLANA_DEVNET_CAIP2, type CanonicalX402UsdcIdentity, type CanonicalX402UsdcNetwork, type X402NetworkConfig, type X402TokenDomain, } from "./x402-networks.js";
|
|
58
61
|
//# 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,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,cAAc,EACd,6BAA6B,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChF,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,UAAU,EACV,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1F,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAClG,cAAc,YAAY,CAAC;AAC3B,c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Y,CAAC;AACpB,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,OAAO,EACL,iBAAiB,EACjB,mCAAmC,EACnC,4BAA4B,EAC5B,oBAAoB,EACpB,mBAAmB,EACnB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -69738,7 +69738,7 @@ var POWERSHELL_MISSING = [
|
|
|
69738
69738
|
].join(" ");
|
|
69739
69739
|
function secretStore(options = {}) {
|
|
69740
69740
|
const platform2 = options.platform ?? process.platform;
|
|
69741
|
-
const run = options.run ?? spawnRunner;
|
|
69741
|
+
const run = options.run ?? (async (file2, args, input2) => await spawnRunner(platform2, file2, args, input2));
|
|
69742
69742
|
const env = options.env ?? process.env;
|
|
69743
69743
|
const installed = options.installed ?? ((file2) => binaryInstalled(file2, env));
|
|
69744
69744
|
if (platform2 === "darwin") return keychainStore(platform2, run);
|
|
@@ -69932,6 +69932,7 @@ function windowsDataProtectionStore(platform2, run, env, installed) {
|
|
|
69932
69932
|
].join("\n");
|
|
69933
69933
|
const execute = async (script2) => {
|
|
69934
69934
|
const result = await run(powershell, WINDOWS_POWERSHELL_ARGS, `${script2}
|
|
69935
|
+
|
|
69935
69936
|
`);
|
|
69936
69937
|
requirePowerShell(result);
|
|
69937
69938
|
return result;
|
|
@@ -70094,17 +70095,25 @@ function binaryInstalled(file2, env) {
|
|
|
70094
70095
|
if (isAbsolute(file2) || win32.isAbsolute(file2)) return existsSync(file2);
|
|
70095
70096
|
return (env.PATH ?? "").split(delimiter).some((directory) => existsSync(join6(directory, file2)));
|
|
70096
70097
|
}
|
|
70098
|
+
var SAFE_FAILURE_DETAILS = [
|
|
70099
|
+
"Cannot autolaunch D-Bus without X11 $DISPLAY",
|
|
70100
|
+
"Cannot autolaunch D-Bus",
|
|
70101
|
+
"The name org.freedesktop.secrets was not provided by any .service files",
|
|
70102
|
+
"Cannot create an item in a locked collection",
|
|
70103
|
+
"User interaction is not allowed.",
|
|
70104
|
+
"Access to the path is denied."
|
|
70105
|
+
];
|
|
70097
70106
|
function requireSuccess(result, what) {
|
|
70098
70107
|
if (result.code === 0) return;
|
|
70099
|
-
const detail =
|
|
70108
|
+
const detail = SAFE_FAILURE_DETAILS.find((reason) => result.stderr.includes(reason));
|
|
70100
70109
|
throw new KeystoreError(
|
|
70101
|
-
`Could not ${what}${result.code === null ? "" : ` (exit ${result.code})`}.${detail
|
|
70110
|
+
`Could not ${what}${result.code === null ? "" : ` (exit ${result.code})`}.${detail === void 0 ? "" : ` ${detail}`}`
|
|
70102
70111
|
);
|
|
70103
70112
|
}
|
|
70104
70113
|
function withoutTrailingNewline(value) {
|
|
70105
70114
|
return value.replace(/\r?\n$/u, "");
|
|
70106
70115
|
}
|
|
70107
|
-
var spawnRunner = async (file2, args, input2) => await new Promise((resolve2) => {
|
|
70116
|
+
var spawnRunner = async (platform2, file2, args, input2) => await new Promise((resolve2) => {
|
|
70108
70117
|
let stdout = "";
|
|
70109
70118
|
let stderr2 = "";
|
|
70110
70119
|
let settled = false;
|
|
@@ -70114,7 +70123,7 @@ var spawnRunner = async (file2, args, input2) => await new Promise((resolve2) =>
|
|
|
70114
70123
|
resolve2(outcome);
|
|
70115
70124
|
};
|
|
70116
70125
|
const child = spawn(file2, [...args], {
|
|
70117
|
-
detached:
|
|
70126
|
+
detached: platform2 !== "win32",
|
|
70118
70127
|
stdio: ["pipe", "pipe", "pipe"],
|
|
70119
70128
|
windowsHide: true
|
|
70120
70129
|
});
|
|
@@ -71083,7 +71092,7 @@ async function loadOrCreateDeviceKey(args) {
|
|
|
71083
71092
|
await args.secrets.set(VAULT_KEY_ACCOUNT, key.toString("base64"));
|
|
71084
71093
|
return key;
|
|
71085
71094
|
} catch (error61) {
|
|
71086
|
-
throw asVaultError2(error61,
|
|
71095
|
+
throw asVaultError2(error61, deviceKeyFailureMessage(error61, args.secrets.platform));
|
|
71087
71096
|
}
|
|
71088
71097
|
});
|
|
71089
71098
|
}
|
|
@@ -71341,6 +71350,12 @@ function parseJson(value) {
|
|
|
71341
71350
|
function asVaultError2(error61, message) {
|
|
71342
71351
|
return error61 instanceof VaultError ? error61 : new VaultError("corrupt", message, { cause: error61 });
|
|
71343
71352
|
}
|
|
71353
|
+
var HEADLESS_LINUX_HINT = "A server, container or GitHub Codespace usually has no keyring. Run vapi on your own computer, or connect Claude from https://api.vapinetwork.ai/connect.";
|
|
71354
|
+
function deviceKeyFailureMessage(error61, platform2) {
|
|
71355
|
+
if (!(error61 instanceof KeystoreError)) return "Unable to load or create the device vault key.";
|
|
71356
|
+
const detail = `Unable to load or create the device vault key: ${error61.message.replace(/\.$/u, "")}.`;
|
|
71357
|
+
return platform2 === "linux" ? `${detail} ${HEADLESS_LINUX_HINT}` : detail;
|
|
71358
|
+
}
|
|
71344
71359
|
|
|
71345
71360
|
// src/vault-migrate.ts
|
|
71346
71361
|
import {
|
|
@@ -71689,6 +71704,17 @@ var WalletStore = class _WalletStore {
|
|
|
71689
71704
|
);
|
|
71690
71705
|
return account?.address ?? (await readKeystoreSummary(this.pathFor(target))).address;
|
|
71691
71706
|
}
|
|
71707
|
+
/**
|
|
71708
|
+
* Creates the vault without deriving an account, for apps that create every
|
|
71709
|
+
* account by name. Refuses when a vault already exists in this home.
|
|
71710
|
+
*/
|
|
71711
|
+
async createEmptyVault() {
|
|
71712
|
+
if (await this.readVaultUnlocked() !== void 0) {
|
|
71713
|
+
throw new KeystoreError("A vault already exists in this home.");
|
|
71714
|
+
}
|
|
71715
|
+
await this.openVault({ create: true });
|
|
71716
|
+
this.dropVaultCache();
|
|
71717
|
+
}
|
|
71692
71718
|
async create(name, passphrase, options = {}) {
|
|
71693
71719
|
void passphrase;
|
|
71694
71720
|
void options.enableSolana;
|
|
@@ -77159,7 +77185,7 @@ function createRunBudget(args) {
|
|
|
77159
77185
|
import { mkdir as mkdir15, writeFile as writeFile8 } from "node:fs/promises";
|
|
77160
77186
|
import { arch, platform, release } from "node:os";
|
|
77161
77187
|
import { join as join13 } from "node:path";
|
|
77162
|
-
var VAPI_CLIENT_VERSION = "0.
|
|
77188
|
+
var VAPI_CLIENT_VERSION = "0.12.1";
|
|
77163
77189
|
async function createSupportReport(options) {
|
|
77164
77190
|
const message = options.message.trim();
|
|
77165
77191
|
if (!message) throw new Error("Support report message must not be empty.");
|
|
@@ -79275,6 +79301,54 @@ var SpendPolicy = class {
|
|
|
79275
79301
|
}
|
|
79276
79302
|
};
|
|
79277
79303
|
|
|
79304
|
+
// src/link-state.ts
|
|
79305
|
+
async function linkStates(args) {
|
|
79306
|
+
const origin = new URL(args.apiBase).origin;
|
|
79307
|
+
await args.store.reload();
|
|
79308
|
+
const states = /* @__PURE__ */ new Map();
|
|
79309
|
+
const candidates = [];
|
|
79310
|
+
for (const name of args.store.names()) {
|
|
79311
|
+
const link2 = args.store.entry(name)?.link;
|
|
79312
|
+
const address2 = await args.store.readAddress(name);
|
|
79313
|
+
const hasTokens = args.secrets.available && await args.secrets.has(agentSecretAccounts(name).tokens).catch(() => false);
|
|
79314
|
+
if (link2 === void 0 || new URL(link2.apiBase).origin !== origin || address2 === void 0 || !hasTokens) {
|
|
79315
|
+
states.set(name, "not_linked");
|
|
79316
|
+
continue;
|
|
79317
|
+
}
|
|
79318
|
+
states.set(name, "linked");
|
|
79319
|
+
candidates.push({ name, owner: getAddress(link2.owner), address: getAddress(address2) });
|
|
79320
|
+
}
|
|
79321
|
+
for (const source of candidates) {
|
|
79322
|
+
let result;
|
|
79323
|
+
try {
|
|
79324
|
+
result = await fetchSiblings({
|
|
79325
|
+
apiBase: args.apiBase,
|
|
79326
|
+
account: source.name,
|
|
79327
|
+
secrets: args.secrets,
|
|
79328
|
+
wallets: args.store,
|
|
79329
|
+
...args.fetchImpl === void 0 ? {} : { fetchImpl: args.fetchImpl },
|
|
79330
|
+
...args.now === void 0 ? {} : { now: args.now }
|
|
79331
|
+
});
|
|
79332
|
+
} catch (error61) {
|
|
79333
|
+
if (error61 instanceof SiblingsError && error61.code === "not_linked") {
|
|
79334
|
+
states.set(source.name, "revoked");
|
|
79335
|
+
continue;
|
|
79336
|
+
}
|
|
79337
|
+
return states;
|
|
79338
|
+
}
|
|
79339
|
+
const owner = result.owner === null ? source.owner : getAddress(result.owner);
|
|
79340
|
+
for (const candidate of candidates) {
|
|
79341
|
+
if (candidate.owner !== owner) continue;
|
|
79342
|
+
const sibling = result.siblings.find(
|
|
79343
|
+
(entry) => getAddress(entry.address) === candidate.address
|
|
79344
|
+
);
|
|
79345
|
+
states.set(candidate.name, sibling?.status === "active" ? "linked" : "revoked");
|
|
79346
|
+
}
|
|
79347
|
+
return states;
|
|
79348
|
+
}
|
|
79349
|
+
return states;
|
|
79350
|
+
}
|
|
79351
|
+
|
|
79278
79352
|
// src/stats.ts
|
|
79279
79353
|
var STATS_RANGES = ["24h", "7d", "30d"];
|
|
79280
79354
|
var OUTCOMES = [
|
|
@@ -81594,6 +81668,37 @@ function isRecord4(value) {
|
|
|
81594
81668
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
81595
81669
|
}
|
|
81596
81670
|
|
|
81671
|
+
// src/vault-setup.ts
|
|
81672
|
+
import { rm as rm2 } from "node:fs/promises";
|
|
81673
|
+
import { join as join16 } from "node:path";
|
|
81674
|
+
async function createVault2(home, options) {
|
|
81675
|
+
if (options.password === "") {
|
|
81676
|
+
throw new KeystoreError("A password cannot be empty.");
|
|
81677
|
+
}
|
|
81678
|
+
const store = await WalletStore.open(home, {
|
|
81679
|
+
secrets: options.secrets,
|
|
81680
|
+
...options.now === void 0 ? {} : { now: options.now }
|
|
81681
|
+
});
|
|
81682
|
+
const hadDeviceKey = options.password !== void 0 && await options.secrets.has(VAULT_KEY_ACCOUNT);
|
|
81683
|
+
await store.createEmptyVault();
|
|
81684
|
+
if (options.password !== void 0) {
|
|
81685
|
+
const path = join16(home, "vault.json");
|
|
81686
|
+
try {
|
|
81687
|
+
await protectVault({
|
|
81688
|
+
path,
|
|
81689
|
+
secrets: options.secrets,
|
|
81690
|
+
password: options.password
|
|
81691
|
+
});
|
|
81692
|
+
} catch (error61) {
|
|
81693
|
+
await Promise.allSettled([
|
|
81694
|
+
rm2(path, { force: true }),
|
|
81695
|
+
...hadDeviceKey ? [] : [options.secrets.remove(VAULT_KEY_ACCOUNT)]
|
|
81696
|
+
]);
|
|
81697
|
+
throw error61;
|
|
81698
|
+
}
|
|
81699
|
+
}
|
|
81700
|
+
}
|
|
81701
|
+
|
|
81597
81702
|
// src/wallet.ts
|
|
81598
81703
|
var LocalWallet = class {
|
|
81599
81704
|
constructor(account, policy) {
|
|
@@ -81620,6 +81725,44 @@ var LocalWallet = class {
|
|
|
81620
81725
|
return await readUsdcBalance({ network, configured, address: address2 });
|
|
81621
81726
|
}
|
|
81622
81727
|
};
|
|
81728
|
+
|
|
81729
|
+
// src/remote-account.ts
|
|
81730
|
+
var RemoteAccountError = class extends Error {
|
|
81731
|
+
constructor(code, message) {
|
|
81732
|
+
super(message);
|
|
81733
|
+
this.code = code;
|
|
81734
|
+
this.name = "RemoteAccountError";
|
|
81735
|
+
}
|
|
81736
|
+
code;
|
|
81737
|
+
};
|
|
81738
|
+
var notPermitted = (what) => new RemoteAccountError("not_permitted", `${what} is not permitted through vAPI Desktop.`);
|
|
81739
|
+
function remotePaymentAccount(args) {
|
|
81740
|
+
const base = toAccount({
|
|
81741
|
+
address: args.address,
|
|
81742
|
+
async signMessage({ message }) {
|
|
81743
|
+
const text = typeof message === "string" ? message : JSON.stringify(message);
|
|
81744
|
+
return await args.request({ kind: "message", wallet: args.wallet, message: text });
|
|
81745
|
+
},
|
|
81746
|
+
async signTransaction() {
|
|
81747
|
+
throw notPermitted("Raw transaction signing");
|
|
81748
|
+
},
|
|
81749
|
+
async signTypedData(typedData) {
|
|
81750
|
+
return await args.request({ kind: "typedData", wallet: args.wallet, typedData });
|
|
81751
|
+
}
|
|
81752
|
+
});
|
|
81753
|
+
const account = {
|
|
81754
|
+
...base,
|
|
81755
|
+
publicKey: args.publicKey,
|
|
81756
|
+
source: "privateKey",
|
|
81757
|
+
async sign() {
|
|
81758
|
+
throw notPermitted("Hash signing");
|
|
81759
|
+
},
|
|
81760
|
+
async signAuthorization() {
|
|
81761
|
+
throw notPermitted("EIP-7702 authorization");
|
|
81762
|
+
}
|
|
81763
|
+
};
|
|
81764
|
+
return account;
|
|
81765
|
+
}
|
|
81623
81766
|
export {
|
|
81624
81767
|
AGENT_GRANTS,
|
|
81625
81768
|
AGENT_MARKER_VARIABLES,
|
|
@@ -81683,6 +81826,7 @@ export {
|
|
|
81683
81826
|
RESTORE_GAP_LIMIT,
|
|
81684
81827
|
ROUTER_TOPUP_TIERS,
|
|
81685
81828
|
RUN_ID_PATTERN,
|
|
81829
|
+
RemoteAccountError,
|
|
81686
81830
|
RunBudgetError,
|
|
81687
81831
|
SECRET_STORE_SERVICE,
|
|
81688
81832
|
SIBLINGS_DEFAULT_TIMEOUT_MS,
|
|
@@ -81769,6 +81913,7 @@ export {
|
|
|
81769
81913
|
createRunId,
|
|
81770
81914
|
createSIWxMessage,
|
|
81771
81915
|
createSupportReport,
|
|
81916
|
+
createVault2 as createVault,
|
|
81772
81917
|
decideFunding,
|
|
81773
81918
|
decideRelease,
|
|
81774
81919
|
decodePaymentRequiredHeader,
|
|
@@ -81830,6 +81975,7 @@ export {
|
|
|
81830
81975
|
isWalletName,
|
|
81831
81976
|
leaveSwarm,
|
|
81832
81977
|
linkRouterAllowanceUsd,
|
|
81978
|
+
linkStates,
|
|
81833
81979
|
listAccounts,
|
|
81834
81980
|
listAgentProfiles,
|
|
81835
81981
|
listServicesResponseSchema,
|
|
@@ -81906,6 +82052,7 @@ export {
|
|
|
81906
82052
|
receiptWallet,
|
|
81907
82053
|
receiptsToCsv,
|
|
81908
82054
|
releaseSpend,
|
|
82055
|
+
remotePaymentAccount,
|
|
81909
82056
|
removeAgentProfile,
|
|
81910
82057
|
renameReceiptWallet,
|
|
81911
82058
|
requireRpcUrl,
|