@vapi-network/cli 0.5.0 → 0.8.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 CHANGED
@@ -10,5 +10,14 @@ Two entry points: `@vapi-network/cli` exports `runCli` and the `HELP` text for
10
10
  embedding, and `@vapi-network/cli/cli` is the executable itself.
11
11
 
12
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.
13
+
14
+ ## Exports
15
+
16
+ | Name | What it is | Since |
17
+ | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
18
+ | `CliDependencies` | type CliDependencies = { fetchImpl?: typeof fetch; prompts?: CliPrompts; interactive?: boolean; env?: NodeJS.ProcessEnv; secretStore?: SecretStore; now?: () => Date; agentLink?: { startDeviceLink?: typeof startDeviceLink; pollDeviceLink?: typeof pollDeviceL... | 0.5.0 or earlier |
19
+ | `CliIo` | type CliIo = { stdout(message: string): void; stderr(message: string): void; } | 0.5.0 or earlier |
20
+ | `HELP` | constant 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 renam... | 0.5.0 or earlier |
21
+ | `runCli` | function (argv = process.argv.slice(2), io: CliIo = processIo, dependencies: CliDependencies = {}): Promise<number> | 0.5.0 or earlier |
22
+
23
+ See the [root README](https://github.com/vAPI-Network/vapi-network/blob/main/README.md#cli-reference) for the full command reference.
@@ -0,0 +1,11 @@
1
+ import { type CliDependencies, type CliIo } from "./cli.js";
2
+ export declare function accountsCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<number>;
3
+ export declare function accountsListCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
4
+ export declare function accountsAddCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
5
+ export declare function accountsImportCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
6
+ export declare function accountsRenameCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
7
+ export declare function accountsUseCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
8
+ export declare function accountsRemoveCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
9
+ export declare function accountsRestoreCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
10
+ export declare function accountsCapsCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
11
+ export declare function accountsDistributeCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<number>;
package/dist/agent.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { listAgentProfiles, readAgentProfile, readSpendLedgerRows, removeAgentProfile, writeAgentProfile } from "@vapi-network/core";
2
- import { createAgentRunDeps, getWallet, runAgent } from "@vapi-network/mcp";
1
+ import { listAgentProfiles, readAgentProfile, readSpendLedgerRows, removeAgentProfile, writeAgentProfile, type AgentProfile, type RunBudget } from "@vapi-network/core";
2
+ import { createAgentRunDeps, getWallet, runAgent, type AgentEvent, type RunAgentDeps } from "@vapi-network/mcp";
3
3
  import { type CliDependencies, type CliIo } from "./cli.js";
4
4
  export type AgentCommandDependencies = {
5
5
  readAgentProfile?: typeof readAgentProfile;
@@ -12,3 +12,24 @@ export type AgentCommandDependencies = {
12
12
  getWallet?: typeof getWallet;
13
13
  };
14
14
  export declare function agentCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<number>;
15
+ export declare function buildAgentRunDeps(input: {
16
+ profile: AgentProfile;
17
+ runId: string;
18
+ budget?: RunBudget;
19
+ allowanceExpiresAt?: Date;
20
+ runMeta?: {
21
+ swarm?: string;
22
+ member?: string;
23
+ parentRunId?: string;
24
+ };
25
+ approvals: "tty" | "decline";
26
+ onEvent?: (event: AgentEvent) => void;
27
+ json: boolean;
28
+ io: CliIo;
29
+ dependencies: CliDependencies;
30
+ }): Promise<RunAgentDeps>;
31
+ export declare function positiveUsdOption(value: string, option: string): {
32
+ text: string;
33
+ number: number;
34
+ atomic: string;
35
+ };
package/dist/cli.d.ts CHANGED
@@ -1,8 +1,11 @@
1
- import { sweepBack, WalletStore, type AuditEvent, type ListingVerification, type SecretStore, type VapiConfig, type VapiPaymentAccount, type WalletEntry, type WalletName } from "@vapi-network/core";
1
+ import { drainCeilingSweeps, sweepAboveCeiling, sweepBack, WalletStore, type AuditEvent, type CeilingBalanceReader, type CeilingSiblingsFetcher, type CeilingTransfer, type DistributeArgs, type ListingVerification, type SecretStore, type SwarmCapitalDeps, type VapiConfig, type VapiPaymentAccount, type WalletBalanceReader, type WalletEntry, type WalletName, type TransferArgs } from "@vapi-network/core";
2
2
  import { type pollDeviceLink, type startDeviceLink } from "@vapi-network/core/agent-link";
3
3
  import type { buyRouterBalance, listRouterModels, ownerStake, rotateRouterKey, routerChat, routerCredentials, routerUsage } from "@vapi-network/core/router-client";
4
+ import { type Runtime, type RuntimeKind, type runSwarm } from "@vapi-network/mcp";
4
5
  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`.";
6
+ import { type RuntimeRequest } from "./runtime-local.js";
7
+ import { type RailwayExec } from "./runtime-railway.js";
8
+ export declare const HELP = "vAPI Network\n\nUsage:\n vapi init [--networks <base,arc,solana>] [--json]\n vapi setup [--no-cloud-backup] [--json]\n vapi accounts [--all] [--json]\n vapi accounts add <name> [--label <text>] [--no-link] [--json]\n vapi accounts import <name> [--keystore <path> | --key-file <path>] [--label <text>] [--json]\n vapi accounts rename <old> <new> [--json]\n vapi accounts use <name> [--json]\n vapi accounts remove <name> [--force] [--json]\n vapi accounts restore <name> [--json]\n vapi accounts caps <name> [--per-call <usd>] [--per-day <usd>] [--ceiling <usd|off>] [--json]\n vapi accounts distribute <amount> --from <account> [--to <a,b,c>] [--network base|arc] [--json]\n vapi accounts distribute --resume <id> [--replace-expired-restored] [--bind-legacy-addresses] [--json]\n vapi accounts distribute --cancel <id> [--replace-expired-restored] [--json]\n vapi swarm create <name> [--agents <n>|--roles <a,b,c>] [--fund <usd> --from <account>] [--strategy <targets|even|weights>] [--targets <role=usd,...>] [--caps <perCall>/<perDay>] [--treasury-caps <perCall>/<perDay>] [--network <base|arc>] [--model <id>] [--no-wait] [--json]\n vapi swarm add <name> <role> [--json]\n vapi swarm remove <name> <member> [--json]\n vapi swarm fund <name> <usd> [--from <account>] [--json]\n vapi swarm rebalance <name> [--targets <role=usd,...>] [--json]\n vapi swarm status <name> [--json]\n vapi swarm dissolve <name> [--json]\n vapi swarm run <name> \"<task>\" [--mode lead|each] [--lead <member>] [--budget <usd>] [--draw <usd>] [--detach] [--runtime local|railway] [--result-file <path>] [--json]\n vapi swarm run <name> \"<task>\" --mode each --runtime railway --checkpoint <name> --allow-remote-key [--budget <usd>] [--keep-sandbox] [--json]\n vapi swarm runs <name> [--json]\n vapi swarm stop <name> [<runId>|--all] [--confirm-worker-stopped] [--json]\n vapi send <amount> --from <account> --to <account|owner|0x\u2026> [--network base|arc] [--resume <nonce>] [--json]\n vapi fund [--amount <usd>] [--account <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>] [--account <name>] [--json]\n vapi pay --resume <receipt-id> [--json]\n vapi check <url> [--method <method>] [--json]\n vapi balance [--account <name>] [--json]\n vapi receipts [--limit <n>] [--account <name>] [--all-wallets] [--json]\n vapi receipts export --format <json|csv> [--range <24h|7d|30d>] [--account <name>] [--all-wallets]\n vapi stats [--range <24h|7d|30d>] [--account <name>] [--all-wallets] [--json]\n vapi sweep [<address>] [--network <caip2>] [--account <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>\" [--budget <usd>] [--detach] [--runtime local] [--result-file <path>] [--json]\n vapi agent run --bundle-env <VAR> (\"<task>\" | --task-base64url <text>) [--budget <usd>] [--result-file <path>] [--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 [--account <name>] [--label <name>] [--publish] [--no-browser] [--json]\n vapi logout [--account <name>] [--json]\n vapi whoami [--account <name>] [--json]\n vapi router models [--account <name>] [--json]\n vapi router usage [--account <name>] [--json]\n vapi router chat --model <id> [--system <text>] [--max-tokens <n>] \"<prompt>\" [--account <name>] [--json]\n vapi router buy <1|5|20|50> [--account <name>] [--json]\n vapi router buy --auto <1|5|20|50> --below <usd> [--account <name>] [--json]\n vapi router buy --auto off [--account <name>] [--json]\n vapi router key [--rotate] [--account <name>] [--json]\n vapi stake status [--account <name>] [--json]\n vapi stake open [--account <name>] [--no-browser] [--json]\n vapi export-key [--network <caip2>] [--account <name>] [--json]\n vapi backup [--account <name>] [--cloud [off]] [--json]\n vapi restore [--from-owner [--owner <0x\u2026>]] [--json]\n vapi import (--phrase | --key) [--account <name>] [--networks <base,arc,solana>] [--replace] [--force] [--json]\n vapi passphrase [--account <name>] [--json]\n vapi vault protect [--json]\n vapi vault unprotect [--json]\n vapi vault lock [--json]\n vapi vault unlock [--json]\n vapi vault status [--json]\n vapi unlock [--account <name>] [--json]\n vapi lock [--account <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>] [--account <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> [--account <name>] [--json]\n vapi mcp [--account <name>] [--json]\n vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--json]\n vapi serve [--json]\n vapi version [--json]\n vapi help [--json]\n\nEvery command that touches a wallet takes `--account <name>`, falls back to `VAPI_WALLET`, then to the default account set by `vapi accounts 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 vault protect` adds a password to the device vault. `vapi vault unlock` opens it on this device for 8 hours; for unattended use, set `VAPI_VAULT_PASSWORD`. `vapi unlock` and `vapi lock` remain aliases for one release.\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. `vapi backup --cloud` keeps an encrypted vault copy that only the owner can approve for recovery. `vapi restore` rebuilds the vault from the phrase and re-derives accounts until an unused address. Set `VAPI_NO_SECRETS=1` to switch exports 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 the status screen; vapi help prints this text. The MCP server starts only with `vapi mcp`; `vapi mcp install <app>` writes that app's MCP config and prints the file it touched.";
6
9
  export type CliIo = {
7
10
  stdout(message: string): void;
8
11
  stderr(message: string): void;
@@ -22,12 +25,23 @@ export type CliDependencies = {
22
25
  prompts?: CliPrompts;
23
26
  /** Whether a person is watching. Only then is a recovery phrase shown. */
24
27
  interactive?: boolean;
28
+ /** Whether stdin is a terminal, independently of redirected stdout. */
29
+ stdinIsTTY?: boolean;
25
30
  /** The environment this run sees: wallet selection and agent detection. */
26
31
  env?: NodeJS.ProcessEnv;
32
+ /**
33
+ * Runtime adapter selection, injected so CLI tests never spawn real children.
34
+ * A `vapi swarm run --runtime railway` start passes its request as well.
35
+ */
36
+ runtime?: (kind: RuntimeKind, home: string, request?: RuntimeRequest) => Runtime;
37
+ /** The `railway` CLI executor, injected so tests never run the real binary. */
38
+ railwayExec?: RailwayExec;
27
39
  /** The OS secret store `vapi unlock` and `vapi lock` act on. */
28
40
  secretStore?: SecretStore;
29
41
  /** Injected clock, so a signed message is reproducible in a test. */
30
42
  now?: () => Date;
43
+ /** Injected hostname, so device naming is reproducible in a test. */
44
+ hostname?: () => string;
31
45
  /** Device-link operations, injected so tests never touch the account service. */
32
46
  agentLink?: {
33
47
  startDeviceLink?: typeof startDeviceLink;
@@ -44,18 +58,71 @@ export type CliDependencies = {
44
58
  ownerStake?: typeof ownerStake;
45
59
  routerCredentials?: typeof routerCredentials;
46
60
  };
61
+ /** Status-screen deadlines, injected so timeout behavior is deterministic in tests. */
62
+ status?: {
63
+ timeoutMs?: number;
64
+ };
65
+ /** Cloud-backup seams, injected so relay and upload tests stay deterministic. */
66
+ cloudBackup?: {
67
+ startRelay?: typeof import("@vapi-network/core/cloud-backup").startRelay;
68
+ awaitRelay?: typeof import("@vapi-network/core/cloud-backup").awaitRelay;
69
+ uploadBackup?: typeof import("@vapi-network/core/cloud-backup").uploadBackup;
70
+ fetchSiblings?: typeof import("@vapi-network/core").fetchSiblings;
71
+ sleep?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
72
+ randomBytes?: (size: number) => Uint8Array;
73
+ uploadTimeoutMs?: number;
74
+ };
75
+ /** MCP client locations, injected so installer tests never touch user config. */
76
+ mcpInstall?: {
77
+ platform?: NodeJS.Platform;
78
+ homedir?: string;
79
+ cwd?: string;
80
+ appData?: string;
81
+ };
47
82
  /** Agent profile and run operations, injected so tests stay local and deterministic. */
48
83
  agent?: AgentCommandDependencies;
49
- /** Reads stdin to EOF for `vapi router chat ... -`. */
84
+ /** Reads stdin to EOF for `vapi router chat ... -` and scripted vault restores. */
50
85
  readStdin?: () => Promise<string>;
51
86
  /** Opens one public URL in the platform browser. */
52
87
  openUrl?: (url: string) => boolean;
53
88
  /** Moves a wallet balance, injected for deterministic sweep command tests. */
54
89
  sweepBack?: typeof sweepBack;
90
+ /** Transfer authorization inputs, injected so send tests are deterministic. */
91
+ transfer?: {
92
+ nonce?: TransferArgs["nonce"];
93
+ timeoutMs?: number;
94
+ };
95
+ /** Distribution seams, injected so CLI tests never sign or relay live transfers. */
96
+ distribute?: Pick<DistributeArgs, "balanceReader" | "siblingsReader" | "transfer" | "authorizationState" | "randomId" | "randomNonce" | "timeoutMs" | "lockTimeoutMs">;
97
+ /** Swarm capital seams, injected so CLI tests never sign or relay live transfers. */
98
+ swarm?: Pick<SwarmCapitalDeps, "balanceReader" | "transfer" | "authorizationState" | "addressReader" | "randomId" | "randomNonce" | "unlock" | "timeoutMs" | "lockTimeoutMs"> & {
99
+ runSwarm?: typeof runSwarm;
100
+ };
101
+ /** Automatic ceiling sweep seams for status and short-lived paid calls. */
102
+ ceiling?: {
103
+ sweepAboveCeiling?: typeof sweepAboveCeiling;
104
+ sweepAllAboveCeiling?: typeof import("@vapi-network/core").sweepAllAboveCeiling;
105
+ drainCeilingSweeps?: typeof drainCeilingSweeps;
106
+ balanceReader?: CeilingBalanceReader;
107
+ fetchSiblingsImpl?: CeilingSiblingsFetcher;
108
+ transfer?: CeilingTransfer;
109
+ timeoutMs?: number;
110
+ };
55
111
  };
56
112
  export declare class UsageError extends Error {
57
113
  }
114
+ export declare function getPrompts(dependencies: CliDependencies): CliPrompts;
58
115
  export declare function getEnvironment(dependencies: CliDependencies): NodeJS.ProcessEnv;
116
+ /** A recovery phrase is shown only when a person can write it down. */
117
+ export declare function isInteractive(dependencies: CliDependencies): boolean;
118
+ /** Whether a secret can be typed without being echoed, even when stdout is redirected. */
119
+ export declare function isStdinInteractive(dependencies: CliDependencies): boolean;
120
+ /**
121
+ * Reads one visible line. The prompt and the echo go to stderr, so a typed
122
+ * confirmation never lands in the stdout a caller may be capturing.
123
+ */
124
+ export declare function promptForLine(prompt: string): Promise<string>;
125
+ export declare function getLinePrompt(dependencies: CliDependencies): (prompt: string) => Promise<string>;
59
126
  /** The wallet one invocation acts on, resolved before any passphrase is read. */
60
127
  export type WalletTarget = {
61
128
  store: WalletStore;
@@ -64,6 +131,8 @@ export type WalletTarget = {
64
131
  entry: WalletEntry;
65
132
  address?: string;
66
133
  };
134
+ /** Opens the wallet store for this home, migrating a 0.2.x layout on the way. */
135
+ export declare function openWalletStore(dependencies: CliDependencies): Promise<WalletStore>;
67
136
  /** Opens the store and picks the wallet in one step, for the usual command. */
68
137
  export declare function targetWallet(parsed: {
69
138
  one(name: string): string | undefined;
@@ -76,7 +145,7 @@ export declare function unlockTarget(target: WalletTarget, dependencies: CliDepe
76
145
  passphrase: string;
77
146
  }>;
78
147
  /** 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?: {
148
+ export declare function recordAudit(dependencies: CliDependencies, event: AuditEvent | "vault.cloud_backup_on" | "vault.cloud_backup_off", options?: {
80
149
  wallet?: string;
81
150
  detail?: string;
82
151
  }): Promise<void>;
@@ -89,16 +158,29 @@ export declare function requireSecretsAllowed(dependencies: CliDependencies, eve
89
158
  refusal?: string;
90
159
  forcedReason?: string;
91
160
  }): Promise<void>;
161
+ /**
162
+ * Printing a secret or trashing a wallet is worth one deliberate act: the
163
+ * person types the wallet's own name. A mismatch stops before anything moves.
164
+ */
165
+ export declare function confirmWalletName(name: string, prompt: string, refusal: string, dependencies: CliDependencies): Promise<void>;
92
166
  /** Run one CLI invocation and return its process exit code. */
93
167
  export declare function runCli(argv?: string[], io?: CliIo, dependencies?: CliDependencies): Promise<number>;
168
+ export declare function redactDetachedRunValue<T>(value: T, environment: NodeJS.ProcessEnv): T;
169
+ export declare function shouldAutoUploadBackup(args: readonly string[]): boolean;
170
+ export declare function shouldAutoUploadAfterFailure(args: readonly string[]): boolean;
94
171
  /**
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`.
172
+ * Creates another wallet on this machine, with the same custody notice and
173
+ * the same one-time phrase as `vapi init`.
97
174
  * No network call: a fresh wallet has nothing to look up.
98
175
  */
99
176
  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. */
177
+ /** Compatibility export for the agent command while account management moves modules. */
101
178
  export declare function walletCapsCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
179
+ /**
180
+ * The Base USDC balance of an address, read the way `vapi accounts` reads it,
181
+ * so removing a wallet can refuse to walk away from money.
182
+ */
183
+ export declare function baseUsdcBalanceReader(config: VapiConfig, dependencies: CliDependencies): WalletBalanceReader;
102
184
  /**
103
185
  * The registry behind the configured discovery URLs. `VAPI_REGISTRY_URL` has
104
186
  * already moved those by the time the config is loaded, so deriving the base
@@ -106,6 +188,14 @@ export declare function walletCapsCommand(argv: string[], json: boolean, io: Cli
106
188
  * prefix alike. A hand-edited discovery URL falls back to the shipped default.
107
189
  */
108
190
  export declare function registryBaseUrl(config: VapiConfig): string;
191
+ /** The device vault key, read the one way every CLI key export reads it. */
192
+ export declare function deviceVaultKey(store: Pick<WalletStore, "home">, dependencies: CliDependencies): Promise<{
193
+ path: string;
194
+ key: Uint8Array;
195
+ }>;
196
+ /** Loads the config and reports any retired registry URL it had to repair. */
197
+ export declare function readConfig(path: string, io: CliIo): Promise<VapiConfig>;
198
+ export declare function output(io: CliIo, json: boolean, value: unknown, human: string): void;
109
199
  /**
110
200
  * The short word for how far a listing got through vAPI review. A mirrored
111
201
  * external row is called `external` rather than `unverified`: vAPI reviewed
@@ -127,6 +217,14 @@ export declare function verificationNotice(verification: ListingVerification | u
127
217
  * machine simply keeps the printed link.
128
218
  */
129
219
  export declare function openInBrowser(url: string): boolean;
220
+ export declare const CUSTODY_NOTICE: string;
221
+ /**
222
+ * The phrase is shown once, to a person, and waits until they say they have it.
223
+ * A script, a piped run or anything an agent drives gets the pointer to
224
+ * `vapi backup` instead: the wallet is still created, but nothing here may end
225
+ * up in a transcript or a log file.
226
+ */
227
+ export declare function showRecoveryPhrase(phrase: string, io: CliIo, dependencies: CliDependencies): Promise<void>;
130
228
  type ArgumentSpec = {
131
229
  valueOptions: Set<string>;
132
230
  booleanOptions?: Set<string>;
@@ -139,4 +237,6 @@ export declare function parseArguments(argv: string[], spec: ArgumentSpec): {
139
237
  many: (name: string) => string[];
140
238
  has: (name: string) => boolean;
141
239
  };
240
+ export declare function requiredPositional(value: string | undefined, argument: string, usage: string): string;
241
+ export declare function fileExists(path: string): Promise<boolean>;
142
242
  export {};