@vapi-network/cli 0.2.3 → 0.5.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 +11 -3
- package/dist/agent.d.ts +14 -0
- package/dist/check.d.ts +46 -0
- package/dist/cli.d.ts +133 -1
- package/dist/cli.js +33724 -3269
- package/dist/cli.js.map +3 -3
- package/dist/identity.d.ts +30 -0
- package/dist/index.js +33709 -3268
- package/dist/index.js.map +3 -3
- package/dist/login.d.ts +8 -0
- package/dist/publish-client.d.ts +193 -0
- package/dist/router.d.ts +2 -0
- package/dist/stake.d.ts +3 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@vapi-network/cli`
|
|
2
2
|
|
|
3
|
-
The command
|
|
4
|
-
|
|
3
|
+
The command implementations behind the `vapi` binary of
|
|
4
|
+
[vAPI Network](https://github.com/vAPI-Network/vapi-network): wallet management,
|
|
5
|
+
discovery, payment, receipts, the OS secret store and the MCP launcher. The
|
|
6
|
+
wallet key stays encrypted on the local machine and every x402 payment is signed
|
|
7
|
+
locally.
|
|
8
|
+
|
|
9
|
+
Two entry points: `@vapi-network/cli` exports `runCli` and the `HELP` text for
|
|
10
|
+
embedding, and `@vapi-network/cli/cli` is the executable itself.
|
|
5
11
|
|
|
6
12
|
Most users should install or run the unscoped `vapi-network` package instead.
|
|
13
|
+
See the [root README](https://github.com/vAPI-Network/vapi-network#readme) for
|
|
14
|
+
the full command reference.
|
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { listAgentProfiles, readAgentProfile, readSpendLedgerRows, removeAgentProfile, writeAgentProfile } from "@vapi-network/core";
|
|
2
|
+
import { createAgentRunDeps, getWallet, runAgent } from "@vapi-network/mcp";
|
|
3
|
+
import { type CliDependencies, type CliIo } from "./cli.js";
|
|
4
|
+
export type AgentCommandDependencies = {
|
|
5
|
+
readAgentProfile?: typeof readAgentProfile;
|
|
6
|
+
writeAgentProfile?: typeof writeAgentProfile;
|
|
7
|
+
listAgentProfiles?: typeof listAgentProfiles;
|
|
8
|
+
removeAgentProfile?: typeof removeAgentProfile;
|
|
9
|
+
readSpendLedgerRows?: typeof readSpendLedgerRows;
|
|
10
|
+
createAgentRunDeps?: typeof createAgentRunDeps;
|
|
11
|
+
runAgent?: typeof runAgent;
|
|
12
|
+
getWallet?: typeof getWallet;
|
|
13
|
+
};
|
|
14
|
+
export declare function agentCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<number>;
|
package/dist/check.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vapi check <url>`: a free, local x402 conformance doctor. It asks the URL
|
|
3
|
+
* for its price the way a client would, without paying, and grades the 402
|
|
4
|
+
* rule by rule, including its advertised extensions; then it looks for the
|
|
5
|
+
* origin's discovery document and an OpenAPI description beside the checked
|
|
6
|
+
* path, at the origin root, or through the origin's API catalog. No wallet is
|
|
7
|
+
* opened, nothing is signed, and no registry is called: every request goes to
|
|
8
|
+
* the origin being checked.
|
|
9
|
+
*
|
|
10
|
+
* Offer issue codes use the registry's snake_case `probe.conformance`
|
|
11
|
+
* vocabulary, so `vapi check` and `vapi inspect` speak one language. The local
|
|
12
|
+
* extensions finding does not change that registry-shaped record.
|
|
13
|
+
*/
|
|
14
|
+
import { type ListingConformance } from "@vapi-network/core";
|
|
15
|
+
export type CheckResult = "pass" | "warn" | "fail";
|
|
16
|
+
export type CheckRule = {
|
|
17
|
+
rule: string;
|
|
18
|
+
result: CheckResult;
|
|
19
|
+
detail: string;
|
|
20
|
+
issues: string[];
|
|
21
|
+
};
|
|
22
|
+
export type CheckReport = {
|
|
23
|
+
url: string;
|
|
24
|
+
method: string;
|
|
25
|
+
status: number;
|
|
26
|
+
/** Which payment protocol the 402 speaks; absent when the response is not a 402 or carries neither. */
|
|
27
|
+
transport?: "x402" | "mpp";
|
|
28
|
+
/** The same record the registry keeps per listing; null when there is no offer to grade. */
|
|
29
|
+
conformance: ListingConformance | null;
|
|
30
|
+
/** Known x402 extensions advertised by the declared offer, in a stable order. */
|
|
31
|
+
extensions: string[];
|
|
32
|
+
rules: CheckRule[];
|
|
33
|
+
summary: Record<CheckResult, number>;
|
|
34
|
+
};
|
|
35
|
+
export type MppChallenge = {
|
|
36
|
+
intent?: string;
|
|
37
|
+
method?: string;
|
|
38
|
+
};
|
|
39
|
+
export declare function checkX402(target: URL, options: {
|
|
40
|
+
method: string;
|
|
41
|
+
fetchImpl: typeof fetch;
|
|
42
|
+
}): Promise<CheckReport>;
|
|
43
|
+
/** One line per rule, then the tally. */
|
|
44
|
+
export declare function formatCheckReport(report: CheckReport): string;
|
|
45
|
+
/** Finds the MPP scheme and keeps only the challenge fields used in check output. */
|
|
46
|
+
export declare function parseMppChallenge(headerValue: string | null): MppChallenge | undefined;
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,10 +1,142 @@
|
|
|
1
|
-
|
|
1
|
+
import { sweepBack, WalletStore, type AuditEvent, type ListingVerification, type SecretStore, type VapiConfig, type VapiPaymentAccount, type WalletEntry, type WalletName } from "@vapi-network/core";
|
|
2
|
+
import { type pollDeviceLink, type startDeviceLink } from "@vapi-network/core/agent-link";
|
|
3
|
+
import type { buyRouterBalance, listRouterModels, ownerStake, rotateRouterKey, routerChat, routerCredentials, routerUsage } from "@vapi-network/core/router-client";
|
|
4
|
+
import { type AgentCommandDependencies } from "./agent.js";
|
|
5
|
+
export declare const HELP = "vAPI Network\n\nUsage:\n vapi init [--networks <base,arc,solana>] [--json]\n vapi wallet list [--json]\n vapi wallet create <name> [--networks <base,arc,solana>] [--label <text>] [--json]\n vapi wallet use <name> [--json]\n vapi wallet rename <old> <new> [--json]\n vapi wallet remove <name> [--force] [--json]\n vapi wallet restore <name> [--json]\n vapi wallet caps <name> [--per-call <usd>] [--per-day <usd>] [--json]\n vapi fund [--amount <usd>] [--wallet <name>] [--json]\n vapi accounts [--enable <solana|arc>] [--wallet <name>] [--json]\n vapi search [query] [--kind <kind>] [--network <caip2>] [--limit <n>] [--cursor <cursor>] [--include-unverified] [--json]\n vapi inspect <id> [--endpoint <name>] [--json]\n vapi pay <id-or-url> [--method <method>] [--endpoint <name>] [--body <json>] [--content-type <type>] [--network <caip2>] [--expected-pay-to <address>] [--max <amount>] [--wallet <name>] [--json]\n vapi pay --resume <receipt-id> [--json]\n vapi check <url> [--method <method>] [--json]\n vapi balance [--wallet <name>] [--json]\n vapi receipts [--limit <n>] [--wallet <name>] [--all-wallets] [--json]\n vapi receipts export --format <json|csv> [--range <24h|7d|30d>] [--wallet <name>] [--all-wallets]\n vapi stats [--range <24h|7d|30d>] [--wallet <name>] [--all-wallets] [--json]\n vapi sweep [<address>] [--network <caip2>] [--wallet <name>] [--json]\n vapi agent create <name> --model <id> --instructions <file> [--call-budget <usd>] [--max-per-call <usd>] [--router-budget <usd>] [--approve-above <usd>] [--include-unverified] [--max-steps <n>] [--json]\n vapi agent run <name> \"<task>\" [--json]\n vapi agent list [--json]\n vapi agent pause <name> [--json]\n vapi agent resume <name> [--json]\n vapi agent revoke <name> [--json]\n vapi login [--wallet <name>] [--label <name>] [--publish] [--no-browser] [--json]\n vapi logout [--wallet <name>] [--json]\n vapi whoami [--wallet <name>] [--json]\n vapi router models [--wallet <name>] [--json]\n vapi router usage [--wallet <name>] [--json]\n vapi router chat --model <id> [--system <text>] [--max-tokens <n>] \"<prompt>\" [--wallet <name>] [--json]\n vapi router buy <1|5|20|50> [--wallet <name>] [--json]\n vapi router buy --auto <1|5|20|50> --below <usd> [--wallet <name>] [--json]\n vapi router buy --auto off [--wallet <name>] [--json]\n vapi router key [--rotate] [--wallet <name>] [--json]\n vapi stake status [--wallet <name>] [--json]\n vapi stake open [--wallet <name>] [--no-browser] [--json]\n vapi export-key [--network <caip2>] [--wallet <name>] [--json]\n vapi backup [--wallet <name>] [--json]\n vapi import (--phrase | --key) [--wallet <name>] [--networks <base,arc,solana>] [--replace] [--force] [--json]\n vapi passphrase [--wallet <name>] [--json]\n vapi unlock [--wallet <name>] [--json]\n vapi lock [--wallet <name> | --all] [--json]\n vapi report \"<what happened>\" [--include-addresses] [--send] [--json]\n vapi auth set-key [--json]\n vapi auth status [--json]\n vapi auth clear [--json]\n vapi publish <url> [--method <method>] [--mode <origin|endpoint|openapi>] [--name <text>] [--description <text>] [--category <ai|data|crypto|compute|search>] [--select <names>] [--wallet <name>] [--yes] [--resume] [--json]\n vapi publish activate <slug> [--json]\n vapi publish verify-request <slug> [--json]\n vapi publish list [--json]\n vapi claim <origin> [--wallet <name>] [--json]\n vapi mcp [--wallet <name>] [--json]\n vapi serve [--json]\n vapi version [--json]\n vapi help [--json]\n\nEvery command that touches a wallet takes `--wallet <name>`, falls back to `VAPI_WALLET`, then to the default set by `vapi wallet use`, and names the wallet it used on its first line.\n\n`vapi search` answers with vAPI-verified listings plus the mirrored external catalogs. `--include-unverified` also returns self-listed APIs that passed vAPI's automated x402 probe but were never reviewed; every result is tagged `[verified]`, `[requested]`, `[unverified]` or `[external]`.\n\n`vapi check <url>` grades an x402 API's 402 without paying: status, transport, declared version and its required fields, the exact scheme, canonical USDC, payTo, maxTimeoutSeconds, advertised extensions, and the origin's /.well-known/x402. It looks for OpenAPI beside the checked path, at /openapi.json, then through same-origin service-desc links in /.well-known/api-catalog. No wallet, no payment, no registry call. It exits 1 when a rule fails. A 402 that answers with Stripe/Tempo's MPP challenge (WWW-Authenticate: Payment) is recognised and reported as transport mpp; vapi pay cannot pay it.\n\n`vapi pay --resume <receipt-id>` answers the one question a lost response leaves: did that payment settle? It reads the signed authorization's state on-chain \u2014 settled, expired, or still pending \u2014 and never pays.\n\n`vapi fund` opens the funding page: card via Coinbase (needs a Coinbase account; US guest checkout), send from MetaMask/Coinbase Wallet/WalletConnect, or bridge from another chain.\n\n`vapi unlock` keeps one wallet's passphrase in the OS secret store \u2014 the macOS Keychain, or libsecret on Linux \u2014 so an agent can pay without `VAPI_KEYSTORE_PASSWORD` in its configuration. `vapi lock` takes it out again. Unlock order: `VAPI_KEYSTORE_PASSWORD`, then the secret store, then a prompt on a terminal. Windows still needs the variable.\n\n`vapi backup` and `vapi export-key` print a secret, so they run only on a real terminal, never for an agent, and ask you to type the wallet name first. Set `VAPI_NO_SECRETS=1` to switch them off entirely. Every export and every wallet change is logged to ~/.vapi/audit.log.\n\n`vapi publish <url>` lists an API you own. vAPI probes the URL \u2014 an origin, one endpoint, or an OpenAPI document \u2014 you choose which endpoints to list, and your wallet signs one line naming where the payouts go. Listing is permissionless: a listing that passed the probe goes live with `vapi publish activate <slug>`, and `vapi publish verify-request <slug>` asks for the review that puts it in the default search. Deploying the FeeSplitter that receives the payouts is a wallet transaction and stays in the console. A catalog of more than 20 endpoints is listed as several listings of up to 20, with one result line per endpoint; `--resume` skips every endpoint this key already lists.\n\n`vapi claim <origin>` takes ownership of the listings vAPI indexed from your API. The wallet their payments go to signs one line, `Claim the vAPI Call listings served from <origin>`; the listings stay paid directly to that wallet, and `vapi publish list` shows them.\n\n`vapi auth set-key` types the registry API key once, on a terminal, into the same OS secret store as the passphrase. A key is a secret: it is never an argument, `VAPI_API_KEY` is the route for CI, and no agent or MCP tool can reach it.\n\nWith no command, vapi shows this help. The MCP server starts only with `vapi mcp`.";
|
|
2
6
|
export type CliIo = {
|
|
3
7
|
stdout(message: string): void;
|
|
4
8
|
stderr(message: string): void;
|
|
5
9
|
};
|
|
10
|
+
/** Every secret the CLI reads is read here, so tests never touch a terminal. */
|
|
11
|
+
export type CliPrompts = {
|
|
12
|
+
/** Reads one line from the terminal without echoing it. */
|
|
13
|
+
secret(prompt: string): Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Reads one visible line, for a typed confirmation such as a wallet name.
|
|
16
|
+
* Never used for a secret, so it may echo.
|
|
17
|
+
*/
|
|
18
|
+
line?(prompt: string): Promise<string>;
|
|
19
|
+
};
|
|
6
20
|
export type CliDependencies = {
|
|
7
21
|
fetchImpl?: typeof fetch;
|
|
22
|
+
prompts?: CliPrompts;
|
|
23
|
+
/** Whether a person is watching. Only then is a recovery phrase shown. */
|
|
24
|
+
interactive?: boolean;
|
|
25
|
+
/** The environment this run sees: wallet selection and agent detection. */
|
|
26
|
+
env?: NodeJS.ProcessEnv;
|
|
27
|
+
/** The OS secret store `vapi unlock` and `vapi lock` act on. */
|
|
28
|
+
secretStore?: SecretStore;
|
|
29
|
+
/** Injected clock, so a signed message is reproducible in a test. */
|
|
30
|
+
now?: () => Date;
|
|
31
|
+
/** Device-link operations, injected so tests never touch the account service. */
|
|
32
|
+
agentLink?: {
|
|
33
|
+
startDeviceLink?: typeof startDeviceLink;
|
|
34
|
+
pollDeviceLink?: typeof pollDeviceLink;
|
|
35
|
+
forgetAgentLink?: typeof import("@vapi-network/core/agent-link").forgetAgentLink;
|
|
36
|
+
};
|
|
37
|
+
/** Router operations, injected so CLI tests never make service requests. */
|
|
38
|
+
router?: {
|
|
39
|
+
listRouterModels?: typeof listRouterModels;
|
|
40
|
+
routerUsage?: typeof routerUsage;
|
|
41
|
+
routerChat?: typeof routerChat;
|
|
42
|
+
buyRouterBalance?: typeof buyRouterBalance;
|
|
43
|
+
rotateRouterKey?: typeof rotateRouterKey;
|
|
44
|
+
ownerStake?: typeof ownerStake;
|
|
45
|
+
routerCredentials?: typeof routerCredentials;
|
|
46
|
+
};
|
|
47
|
+
/** Agent profile and run operations, injected so tests stay local and deterministic. */
|
|
48
|
+
agent?: AgentCommandDependencies;
|
|
49
|
+
/** Reads stdin to EOF for `vapi router chat ... -`. */
|
|
50
|
+
readStdin?: () => Promise<string>;
|
|
51
|
+
/** Opens one public URL in the platform browser. */
|
|
52
|
+
openUrl?: (url: string) => boolean;
|
|
53
|
+
/** Moves a wallet balance, injected for deterministic sweep command tests. */
|
|
54
|
+
sweepBack?: typeof sweepBack;
|
|
55
|
+
};
|
|
56
|
+
export declare class UsageError extends Error {
|
|
57
|
+
}
|
|
58
|
+
export declare function getEnvironment(dependencies: CliDependencies): NodeJS.ProcessEnv;
|
|
59
|
+
/** The wallet one invocation acts on, resolved before any passphrase is read. */
|
|
60
|
+
export type WalletTarget = {
|
|
61
|
+
store: WalletStore;
|
|
62
|
+
name: WalletName;
|
|
63
|
+
path: string;
|
|
64
|
+
entry: WalletEntry;
|
|
65
|
+
address?: string;
|
|
8
66
|
};
|
|
67
|
+
/** Opens the store and picks the wallet in one step, for the usual command. */
|
|
68
|
+
export declare function targetWallet(parsed: {
|
|
69
|
+
one(name: string): string | undefined;
|
|
70
|
+
}, dependencies: CliDependencies): Promise<WalletTarget>;
|
|
71
|
+
/** The OS secret store this run uses: the machine's, or the one a test injects. */
|
|
72
|
+
export declare function getSecretStore(dependencies: CliDependencies): SecretStore;
|
|
73
|
+
/** Opens the selected wallet, and keeps the passphrase for callers that need it. */
|
|
74
|
+
export declare function unlockTarget(target: WalletTarget, dependencies: CliDependencies): Promise<{
|
|
75
|
+
account: VapiPaymentAccount;
|
|
76
|
+
passphrase: string;
|
|
77
|
+
}>;
|
|
78
|
+
/** One audit line. The home is the wallet store's, so `VAPI_HOME` is honoured. */
|
|
79
|
+
export declare function recordAudit(dependencies: CliDependencies, event: AuditEvent, options?: {
|
|
80
|
+
wallet?: string;
|
|
81
|
+
detail?: string;
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* The gate in front of `vapi backup` and `vapi export-key`: refuse, log the
|
|
85
|
+
* attempt, and say which stream or which variable decided it. Nothing is
|
|
86
|
+
* printed to stdout, so a caller capturing it gets nothing either way.
|
|
87
|
+
*/
|
|
88
|
+
export declare function requireSecretsAllowed(dependencies: CliDependencies, event: AuditEvent, wallet: string | undefined, options?: {
|
|
89
|
+
refusal?: string;
|
|
90
|
+
forcedReason?: string;
|
|
91
|
+
}): Promise<void>;
|
|
9
92
|
/** Run one CLI invocation and return its process exit code. */
|
|
10
93
|
export declare function runCli(argv?: string[], io?: CliIo, dependencies?: CliDependencies): Promise<number>;
|
|
94
|
+
/**
|
|
95
|
+
* Creates another wallet on this machine, with the same custody notice, the
|
|
96
|
+
* same passphrase confirmation and the same one-time phrase as `vapi init`.
|
|
97
|
+
* No network call: a fresh wallet has nothing to look up.
|
|
98
|
+
*/
|
|
99
|
+
export declare function walletCreateCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
|
|
100
|
+
/** Per-wallet spend caps, in US dollars, converted to atomic USDC on the way in. */
|
|
101
|
+
export declare function walletCapsCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* The registry behind the configured discovery URLs. `VAPI_REGISTRY_URL` has
|
|
104
|
+
* already moved those by the time the config is loaded, so deriving the base
|
|
105
|
+
* from them follows the env override, a self-hosted registry and a mount
|
|
106
|
+
* prefix alike. A hand-edited discovery URL falls back to the shipped default.
|
|
107
|
+
*/
|
|
108
|
+
export declare function registryBaseUrl(config: VapiConfig): string;
|
|
109
|
+
/**
|
|
110
|
+
* The short word for how far a listing got through vAPI review. A mirrored
|
|
111
|
+
* external row is called `external` rather than `unverified`: vAPI reviewed
|
|
112
|
+
* nothing it merely mirrored, and saying "unverified" would read as a verdict
|
|
113
|
+
* on a catalog vAPI never claimed to judge.
|
|
114
|
+
*/
|
|
115
|
+
export declare function verificationTag(listing: {
|
|
116
|
+
verification?: ListingVerification;
|
|
117
|
+
external?: boolean;
|
|
118
|
+
}): "verified" | "requested" | "unverified" | "external";
|
|
119
|
+
/**
|
|
120
|
+
* One line, above the result, when the listing that was just paid is not
|
|
121
|
+
* vAPI-verified. It never blocks and never prompts: the payment has already
|
|
122
|
+
* happened, and the point is that the next one is an informed choice.
|
|
123
|
+
*/
|
|
124
|
+
export declare function verificationNotice(verification: ListingVerification | undefined): string[];
|
|
125
|
+
/**
|
|
126
|
+
* Open a funding URL without ever failing the command: a headless or locked-down
|
|
127
|
+
* machine simply keeps the printed link.
|
|
128
|
+
*/
|
|
129
|
+
export declare function openInBrowser(url: string): boolean;
|
|
130
|
+
type ArgumentSpec = {
|
|
131
|
+
valueOptions: Set<string>;
|
|
132
|
+
booleanOptions?: Set<string>;
|
|
133
|
+
repeatableOptions?: Set<string>;
|
|
134
|
+
maximumPositionals: number;
|
|
135
|
+
};
|
|
136
|
+
export declare function parseArguments(argv: string[], spec: ArgumentSpec): {
|
|
137
|
+
positionals: string[];
|
|
138
|
+
one: (name: string) => string | undefined;
|
|
139
|
+
many: (name: string) => string[];
|
|
140
|
+
has: (name: string) => boolean;
|
|
141
|
+
};
|
|
142
|
+
export {};
|