@vapi-network/cli 0.3.0 → 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.
@@ -0,0 +1,8 @@
1
+ import { type CliDependencies, type CliIo } from "./cli.js";
2
+ export declare function loginCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
3
+ /** Shared device-link flow used by `vapi login` and `vapi agent create`. */
4
+ export declare function runLoginFlow(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies, options?: {
5
+ routerAllowanceUsd?: number;
6
+ }): Promise<void>;
7
+ export declare function logoutCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
8
+ export declare function whoamiCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
@@ -0,0 +1,193 @@
1
+ /**
2
+ * The registry's listing write API, as seen from one person's terminal.
3
+ *
4
+ * Everything else in this client reads the registry without an account. Listing
5
+ * an API is the one thing that writes, so it is the one thing that carries a
6
+ * bearer credential and a wallet signature. It lives in the CLI package rather
7
+ * than in a source adapter because it is not discovery: there is no MCP tool,
8
+ * and the only caller is the CLI.
9
+ *
10
+ * Every response is returned exactly as the registry sent it, so `--json` can
11
+ * hand it on untouched and an unknown field is carried rather than dropped. The
12
+ * readers below only look for what the human output needs.
13
+ */
14
+ import type { Address } from "viem";
15
+ /** The categories the registry's listing form accepts. */
16
+ export declare const LISTING_CATEGORIES: readonly ["ai", "data", "crypto", "compute", "search"];
17
+ export type ListingCategory = (typeof LISTING_CATEGORIES)[number];
18
+ /** How the registry should read the URL it was handed. Left out, it decides. */
19
+ export declare const PROBE_MODES: readonly ["origin", "endpoint", "openapi"];
20
+ export type ProbeMode = (typeof PROBE_MODES)[number];
21
+ /** The states `vapi publish` can ask a listing to move to. */
22
+ export type ListingStatusAction = "activate" | "request_verification" | "suspend";
23
+ /** Payouts settle in USDC on Base, so the payout signature is bound to Base. */
24
+ export declare const PAYOUT_CHAIN_ID: "eip155:8453";
25
+ /**
26
+ * The sentence the provider signs. It is not a login: it says which wallet the
27
+ * registry should pay, and it is the only thing this command ever signs.
28
+ */
29
+ export declare const PAYOUT_STATEMENT = "Confirm this wallet receives vAPI Call payouts";
30
+ /** The sentence a claim message states, completed with the origin being claimed. */
31
+ export declare const CLAIM_STATEMENT_PREFIX = "Claim the vAPI Call listings served from";
32
+ /** Where a person creates the key this client authenticates with. */
33
+ export declare const API_KEY_CONSOLE_PATH = "/account";
34
+ /** One candidate endpoint the probe found behind the URL it was given. */
35
+ export type ProbeOperation = Readonly<{
36
+ name: string;
37
+ method?: string;
38
+ url?: string;
39
+ description?: string;
40
+ operationId?: string;
41
+ requestContentType?: string;
42
+ requestSchema?: unknown;
43
+ responseContentType?: string;
44
+ pathTemplate?: string;
45
+ pathParameters?: unknown;
46
+ }> & Readonly<Record<string, unknown>>;
47
+ /** Why the registry will not list this URL, in the registry's own words. */
48
+ export type ProbeRejection = Readonly<{
49
+ code?: string;
50
+ message?: string;
51
+ hint?: string;
52
+ }> & Readonly<Record<string, unknown>>;
53
+ /** The console's `VendorProbeResult`, read tolerantly. */
54
+ export type ProbeResult = Readonly<{
55
+ operations?: readonly ProbeOperation[];
56
+ accepts?: readonly unknown[];
57
+ diagnostics?: Readonly<{
58
+ steps?: readonly unknown[];
59
+ rejection?: ProbeRejection | null;
60
+ }>;
61
+ }> & Readonly<Record<string, unknown>>;
62
+ export type PayoutNonce = Readonly<{
63
+ nonce: string;
64
+ message?: string;
65
+ }> & Readonly<Record<string, unknown>>;
66
+ export type SplitterNetworkState = Readonly<{
67
+ network?: string;
68
+ name?: string;
69
+ chainId?: number;
70
+ factoryAddress?: string;
71
+ splitterAddress?: string;
72
+ deployed?: boolean;
73
+ balanceWei?: string;
74
+ }> & Readonly<Record<string, unknown>>;
75
+ export type SplitterStates = Readonly<{
76
+ networkStates?: readonly SplitterNetworkState[];
77
+ feeBp?: number;
78
+ }> & Readonly<Record<string, unknown>>;
79
+ export type ListingEndpointInput = {
80
+ name: string;
81
+ method: string;
82
+ url: string;
83
+ description: string;
84
+ operationId?: string;
85
+ requestContentType?: string;
86
+ requestSchema?: unknown;
87
+ responseContentType?: string;
88
+ pathTemplate?: string;
89
+ pathParameters?: unknown;
90
+ };
91
+ export type CreateListingInput = {
92
+ name: string;
93
+ description: string;
94
+ category: ListingCategory;
95
+ endpoints: ListingEndpointInput[];
96
+ payoutWallet: string;
97
+ siweMessage: string;
98
+ signature: string;
99
+ };
100
+ export type CreatedListing = Readonly<{
101
+ ok?: boolean;
102
+ listing?: Readonly<{
103
+ slug?: string;
104
+ status?: string;
105
+ verification?: string;
106
+ }> & Readonly<Record<string, unknown>>;
107
+ }> & Readonly<Record<string, unknown>>;
108
+ export type ListingStatusResult = Readonly<{
109
+ ok?: boolean;
110
+ status?: string;
111
+ verification?: string;
112
+ }> & Readonly<Record<string, unknown>>;
113
+ export type MyListings = Readonly<{
114
+ listings?: readonly unknown[];
115
+ }> & Readonly<Record<string, unknown>>;
116
+ export type ClaimNonce = Readonly<{
117
+ message?: string;
118
+ }> & Readonly<Record<string, unknown>>;
119
+ export type ClaimInput = {
120
+ origin: string;
121
+ message: string;
122
+ signature: string;
123
+ };
124
+ export type ClaimResult = Readonly<{
125
+ claimed?: readonly unknown[];
126
+ }> & Readonly<Record<string, unknown>>;
127
+ /**
128
+ * A refusal from the registry, already turned into the sentence a person
129
+ * should read. The status is kept so a caller can tell a rejection from an
130
+ * outage without parsing the message.
131
+ */
132
+ export declare class RegistryApiError extends Error {
133
+ readonly status: number;
134
+ readonly body?: unknown | undefined;
135
+ constructor(status: number, message: string, body?: unknown | undefined);
136
+ }
137
+ export type ListingsClientOptions = {
138
+ /** The registry base URL, with any mount prefix it carries. */
139
+ baseUrl: string;
140
+ /** The `vapi_sk_…` key, sent as a bearer token and never logged. */
141
+ apiKey?: string;
142
+ /** A caller that adds and refreshes its own bearer credential. */
143
+ authenticatedFetch?: typeof fetch;
144
+ fetchImpl?: typeof fetch;
145
+ allowPrivateNetwork?: boolean;
146
+ };
147
+ export type ListingsClient = {
148
+ readonly baseUrl: string;
149
+ probe(input: {
150
+ url: string;
151
+ method?: string;
152
+ mode?: ProbeMode;
153
+ }): Promise<ProbeResult>;
154
+ payoutNonce(wallet: string): Promise<PayoutNonce>;
155
+ splitters(wallet: string): Promise<SplitterStates>;
156
+ create(input: CreateListingInput): Promise<CreatedListing>;
157
+ status(slug: string, action: ListingStatusAction): Promise<ListingStatusResult>;
158
+ mine(): Promise<MyListings>;
159
+ claimNonce(origin: string, wallet: string): Promise<ClaimNonce>;
160
+ claim(input: ClaimInput): Promise<ClaimResult>;
161
+ };
162
+ /** Appends one absolute path to the registry base, keeping any mount prefix. */
163
+ export declare function listingsUrl(baseUrl: string, path: string): URL;
164
+ export declare function createListingsClient(options: ListingsClientOptions): ListingsClient;
165
+ /**
166
+ * Refuses to sign a claim message that is not the one the claim contract
167
+ * describes: an EIP-4361 message from this registry's host, for this wallet,
168
+ * on Base, stating the origin being claimed. The registry writes the message,
169
+ * so this is the line that keeps a wallet from signing anything else it sends.
170
+ */
171
+ export declare function assertClaimMessage(message: string, expected: {
172
+ baseUrl: string;
173
+ origin: string;
174
+ address: Address;
175
+ }): void;
176
+ /**
177
+ * The canonical EIP-4361 message a provider signs to name their payout wallet.
178
+ * The registry may send its own `message`, in which case that one is signed
179
+ * verbatim; this is what the client builds when it does not, so the two sides
180
+ * agree byte for byte.
181
+ */
182
+ export declare function buildPayoutSiweMessage(args: {
183
+ baseUrl: string;
184
+ address: Address;
185
+ nonce: string;
186
+ issuedAt: string;
187
+ }): string;
188
+ /** The operations a probe found, normalized to the fields a listing needs. */
189
+ export declare function readProbeOperations(probe: ProbeResult): ProbeOperation[];
190
+ /** The rejection a probe carries, or undefined when the URL passed. */
191
+ export declare function readProbeRejection(probe: ProbeResult): ProbeRejection | undefined;
192
+ /** One line per probe step, whatever shape the registry sends them in. */
193
+ export declare function formatProbeSteps(probe: ProbeResult): string[];
@@ -0,0 +1,2 @@
1
+ import { type CliDependencies, type CliIo } from "./cli.js";
2
+ export declare function routerCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import { type CliDependencies, type CliIo } from "./cli.js";
2
+ export declare const STAKE_URL = "https://api.vapinetwork.ai/stake";
3
+ export declare function stakeCommand(argv: string[], json: boolean, io: CliIo, dependencies: CliDependencies): Promise<void>;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const CLI_VERSION = "0.3.0";
1
+ export declare const CLI_VERSION = "0.5.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vapi-network/cli",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Command-line interface for the non-custodial vAPI Network wallet",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {