@vapi-network/mcp 0.5.0 → 0.7.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
@@ -2,13 +2,57 @@
2
2
 
3
3
  The stdio MCP server behind `vapi mcp`: namespaced tools that let an agent
4
4
  search the vAPI catalogue, read a listing's request contract, pay an x402 API
5
- from a local wallet, and read balances and receipts. It never creates, renames,
6
- removes, backs up or exports a wallet, and no tool of its returns a recovery
7
- phrase, a private key or a passphrase.
5
+ from a local wallet, and read balances, receipts and the status screen
6
+ (`vapi.status`, `vapi.accounts`, `vapi.siblings`). It can derive an account and lower its caps,
7
+ but it never renames, removes, backs up or exports one, and no tool returns a
8
+ recovery phrase, private key or passphrase.
8
9
 
9
10
  One entry point, `@vapi-network/mcp`, exporting `createVapiServer`,
10
11
  `startStdioServer`, `loadServerConfig`, `WalletSession` and the individual
11
12
  `callService`, `inspectService`, `searchMarketplace` and `getWallet` tools.
12
13
 
13
- See the [root README](https://github.com/vAPI-Network/vapi-network#readme) for
14
- the editor configuration, the full tool table and the deprecated aliases.
14
+ ## Exports
15
+
16
+ ### Runtime exports
17
+
18
+ | Name | What it is | Since |
19
+ | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
20
+ | `buildSIWxProof` | function (args: { signer: SIWxSigner; challenge: SIWxChallenge; responseUrl: string; }): unknown | 0.5.0 or earlier |
21
+ | `callService` | function (args: CallServiceArgs): Promise<CallToolResult> | 0.5.0 or earlier |
22
+ | `createAgentRunDeps` | function (input: { profile: AgentProfile; config: VapiConfig; home: string; account: VapiPaymentAccount; wallet: WalletName; spendCaps: SpendCaps; chat: (req: ChatRequest) => Promise<ChatResult>; approve: RunAgentDeps["approve"]; onEvent?: (event: AgentEven... | 0.5.0 or earlier |
23
+ | `createVapiServer` | function (options: VapiServerOptions): unknown | 0.5.0 or earlier |
24
+ | `decidePayment` | function (input: { ref: string; priceUsd: number \| null; verification: string; seenRefs: ReadonlySet<string>; verifiedOnly: boolean; approveAboveUsd: number; maxPerCallUsd: number; }): PayDecision | 0.5.0 or earlier |
25
+ | `getWallet` | function (account: Address \| WalletAddresses \| VapiPaymentAccount, config: VapiConfig, options: { fetchImpl?: typeof fetch; lookup?: LookupFn } = {}): Promise<{ address: Address; balances: WalletBalance[] }> | 0.5.0 or earlier |
26
+ | `inspectService` | function (input: InspectToolInput, config: VapiConfig, fetchImpl?: typeof fetch): Promise<InspectToolResult> | 0.5.0 or earlier |
27
+ | `loadServerConfig` | function (): unknown | 0.5.0 or earlier |
28
+ | `parseSIWxResponse` | function (response: Response, configuredNetworks: VapiConfig["networks"], responseUrl: string, requiredNetwork?: string): Promise<SIWxChallenge \| null> | 0.5.0 or earlier |
29
+ | `resolveServiceEndpoint` | function (id: string, config: VapiRegistryConfig, fetchImpl?: Fetch, endpointName?: string): Promise<DiscoveryEndpoint> | 0.5.0 or earlier |
30
+ | `resolveServiceListing` | function (id: string, config: VapiRegistryConfig, fetchImpl?: Fetch, endpointName?: string): Promise<ResolvedListing> | 0.5.0 or earlier |
31
+ | `runAgent` | function (task: string, deps: RunAgentDeps): Promise<RunAgentResult> | 0.5.0 or earlier |
32
+ | `searchMarketplace` | function (input: MarketplaceSearchInput, config: VapiRegistryConfig, fetchImpl?: Fetch, options?: MarketplaceSearchOptions): Promise<MarketplaceDiscoveryPage> | 0.5.0 or earlier |
33
+ | `startStdioServer` | function (options: VapiServerOptions): unknown | 0.5.0 or earlier |
34
+ | `UNTRUSTED_NOTICE` | constant UNTRUSTED_NOTICE: string | 0.5.0 or earlier |
35
+ | `WalletSession` | class WalletSession | 0.5.0 or earlier |
36
+ | `wrapUntrusted` | function (tool: string, value: unknown): string | 0.5.0 or earlier |
37
+
38
+ ### Types
39
+
40
+ | Name | What it is | Since |
41
+ | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
42
+ | `AgentEvent` | type AgentEvent = \| { type: "step"; n: number } \| { type: "tool"; name: string; summary: string } \| { type: "paid"; ref: string; amountUsd: number; network: string } \| { type: "declined"; ref: string; reason: string } \| { type: "stopped"; reason: "finished"... | 0.5.0 or earlier |
43
+ | `CallToolInput` | type CallToolInput = { id?: string; url?: string; method?: string; endpoint?: string; body?: unknown; maxPriceUsd?: number \| string; network?: string; expectedPayTo?: string; contentType?: string; } | 0.5.0 or earlier |
44
+ | `CallToolResult` | type CallToolResult = { status: number; body: unknown; verification?: ListingVerification; outcome?: "signed_in"; payment: null \| { network: string; amountAtomic: string; amountUsd: string; asset: string; payTo: string; settlement: unknown \| null; proof: st... | 0.5.0 or earlier |
45
+ | `InspectToolInput` | type InspectToolInput = { id: string; endpoint?: string; } | 0.5.0 or earlier |
46
+ | `InspectToolResult` | type InspectToolResult = Omit< Pick< DiscoveryEndpoint, \| "name" \| "method" \| "url" \| "price" \| "description" \| "operationId" \| "requestContentType" \| "requestSchema" \| "responseContentType" >, "method" > & { method: string \| null; network?: string; group?:... | 0.5.0 or earlier |
47
+ | `MarketplaceSearchInput` | type MarketplaceSearchInput = { query?: string; kinds?: MarketplaceKind[]; network?: string; limit?: number; cursor?: string; includeUnverified?: boolean; } | 0.5.0 or earlier |
48
+ | `PayDecision` | type PayDecision = { action: "pay" } \| { action: "ask"; reason: string } \| { action: "refuse"; reason: string } | 0.5.0 or earlier |
49
+ | `RunAgentDeps` | type RunAgentDeps = { profile: AgentProfile; config: VapiConfig; home: string; chat: (req: ChatRequest) => Promise<ChatResult>; search: (q: { query: string; network?: string; includeUnverified: boolean }) => Promise< Array<{ ref: string; name: string; price... | 0.5.0 or earlier |
50
+ | `RunAgentResult` | type RunAgentResult = { answer: string \| null; stoppedBecause: AgentEvent & { type: "stopped" }; paidUsd: number; steps: number; } | 0.5.0 or earlier |
51
+ | `SessionWallet` | type SessionWallet = { name: WalletName; path?: string; } | 0.5.0 or earlier |
52
+ | `SessionWalletInfo` | type SessionWalletInfo = { name: WalletName; address?: string; solanaAddress?: string; label?: string; isDefault: boolean; isActive: boolean; spendCaps?: SpendCaps; } | 0.5.0 or earlier |
53
+ | `VapiServerOptions` | type VapiServerOptions = { account: VapiPaymentAccount; config: VapiConfig; fetchImpl?: typeof fetch; ledgerPath?: string; receiptsPath?: string; searchesPath?: string; reportsDirectory?: string; store?: WalletStore \| undefined; wallet?: string \| undefined; status?: StatusCoreOverrides;... | 0.5.0 or earlier |
54
+ | `WalletAddresses` | type WalletAddresses = { address: Address; solana?: { address: string } \| undefined; } | 0.5.0 or earlier |
55
+ | `WalletBalance` | type WalletBalance = { network: string; name: string; usdcAtomic: string \| null; usdc: string \| null; error?: string; } | 0.5.0 or earlier |
56
+ | `WalletSessionOptions` | type WalletSessionOptions = { account: VapiPaymentAccount; store?: WalletStore \| undefined; wallet?: string \| undefined; env?: NodeJS.ProcessEnv \| undefined; passphrase?: (() => string \| Promise<string>) \| undefined; secretStore?: SecretStore \| undefined; n... | 0.5.0 or earlier |
57
+
58
+ See the [root README](https://github.com/vAPI-Network/vapi-network/blob/main/docs/mcp.md) for the editor configuration, the full tool table and the deprecated aliases.
@@ -0,0 +1,453 @@
1
+ import { type CeilingSweepHook, type SpendCaps, type VapiConfig, type VapiPaymentAccount } from "@vapi-network/core";
2
+ import { z } from "zod";
3
+ import { type CallToolResult } from "../tools/call.js";
4
+ import { type CallPort } from "./context.js";
5
+ export declare const MAX_CACHED_MARKETPLACE_REFS = 200;
6
+ export declare const walletArgument: {
7
+ wallet: z.ZodOptional<z.ZodString>;
8
+ };
9
+ export declare const callToolResultSchema: z.ZodObject<{
10
+ wallet: z.ZodString;
11
+ status: z.ZodNumber;
12
+ body: z.ZodUnknown;
13
+ verification: z.ZodOptional<z.ZodEnum<{
14
+ none: "none";
15
+ requested: "requested";
16
+ verified: "verified";
17
+ }>>;
18
+ payment: z.ZodNullable<z.ZodObject<{
19
+ network: z.ZodString;
20
+ amountAtomic: z.ZodString;
21
+ amountUsd: z.ZodString;
22
+ asset: z.ZodString;
23
+ payTo: z.ZodString;
24
+ settlement: z.ZodNullable<z.ZodUnknown>;
25
+ proof: z.ZodNullable<z.ZodString>;
26
+ }, z.core.$strip>>;
27
+ outcome: z.ZodOptional<z.ZodLiteral<"signed_in">>;
28
+ expectedRequest: z.ZodOptional<z.ZodObject<{
29
+ contentType: z.ZodOptional<z.ZodString>;
30
+ schema: z.ZodOptional<z.ZodUnknown>;
31
+ }, z.core.$strip>>;
32
+ }, z.core.$strip>;
33
+ export declare const inspectToolResultSchema: z.ZodObject<{
34
+ name: z.ZodString;
35
+ method: z.ZodNullable<z.ZodString>;
36
+ url: z.ZodURL;
37
+ price: z.ZodString;
38
+ description: z.ZodString;
39
+ operationId: z.ZodOptional<z.ZodString>;
40
+ requestContentType: z.ZodOptional<z.ZodString>;
41
+ requestSchema: z.ZodOptional<z.ZodUnknown>;
42
+ responseContentType: z.ZodOptional<z.ZodString>;
43
+ network: z.ZodOptional<z.ZodString>;
44
+ group: z.ZodOptional<z.ZodEnum<{
45
+ vapi: "vapi";
46
+ partner: "partner";
47
+ added: "added";
48
+ external: "external";
49
+ }>>;
50
+ fee: z.ZodOptional<z.ZodObject<{
51
+ bps: z.ZodNumber;
52
+ label: z.ZodString;
53
+ }, z.core.$loose>>;
54
+ verification: z.ZodEnum<{
55
+ none: "none";
56
+ requested: "requested";
57
+ verified: "verified";
58
+ }>;
59
+ liveness: z.ZodOptional<z.ZodObject<{
60
+ uptime7d: z.ZodNumber;
61
+ latencyP50Ms: z.ZodNullable<z.ZodNumber>;
62
+ latencyP95Ms: z.ZodNullable<z.ZodNumber>;
63
+ checks7d: z.ZodNumber;
64
+ }, z.core.$loose>>;
65
+ conformance: z.ZodOptional<z.ZodObject<{
66
+ declaredVersion: z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
67
+ versionConformant: z.ZodBoolean;
68
+ offerTransport: z.ZodEnum<{
69
+ body: "body";
70
+ header: "header";
71
+ both: "both";
72
+ }>;
73
+ issues: z.ZodArray<z.ZodString>;
74
+ }, z.core.$loose>>;
75
+ identity: z.ZodOptional<z.ZodObject<{
76
+ erc8004Id: z.ZodString;
77
+ reputation: z.ZodCatch<z.ZodOptional<z.ZodObject<{
78
+ score: z.ZodNumber;
79
+ count: z.ZodNumber;
80
+ }, z.core.$loose>>>;
81
+ }, z.core.$loose>>;
82
+ payment: z.ZodNullable<z.ZodObject<{
83
+ scheme: z.ZodLiteral<"exact">;
84
+ network: z.ZodString;
85
+ asset: z.ZodString;
86
+ payTo: z.ZodString;
87
+ checkedAt: z.ZodString;
88
+ }, z.core.$strip>>;
89
+ }, z.core.$strip>;
90
+ export declare const callSearchInputSchema: z.ZodObject<{
91
+ query: z.ZodOptional<z.ZodString>;
92
+ kinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
93
+ api: "api";
94
+ service_offer: "service_offer";
95
+ open_request: "open_request";
96
+ }>>>;
97
+ network: z.ZodOptional<z.ZodString>;
98
+ limit: z.ZodOptional<z.ZodNumber>;
99
+ cursor: z.ZodOptional<z.ZodString>;
100
+ includeUnverified: z.ZodOptional<z.ZodBoolean>;
101
+ }, z.core.$strip>;
102
+ export declare const callInspectInputSchema: z.ZodObject<{
103
+ id: z.ZodString;
104
+ endpoint: z.ZodOptional<z.ZodString>;
105
+ }, z.core.$strip>;
106
+ export declare const callPayInputSchema: z.ZodObject<{
107
+ id: z.ZodOptional<z.ZodString>;
108
+ url: z.ZodOptional<z.ZodURL>;
109
+ method: z.ZodOptional<z.ZodString>;
110
+ endpoint: z.ZodOptional<z.ZodString>;
111
+ body: z.ZodOptional<z.ZodUnknown>;
112
+ contentType: z.ZodOptional<z.ZodString>;
113
+ network: z.ZodOptional<z.ZodString>;
114
+ expectedPayTo: z.ZodOptional<z.ZodString>;
115
+ maxPriceUsd: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
116
+ wallet: z.ZodOptional<z.ZodString>;
117
+ }, z.core.$strip>;
118
+ export declare const callSearch: import("./define.js").Action<{
119
+ query?: string | undefined;
120
+ kinds?: ("api" | "service_offer" | "open_request")[] | undefined;
121
+ network?: string | undefined;
122
+ limit?: number | undefined;
123
+ cursor?: string | undefined;
124
+ includeUnverified?: boolean | undefined;
125
+ }, {
126
+ [x: string]: unknown;
127
+ protocol: "vapi.marketplace.discovery/1";
128
+ items: ({
129
+ [x: string]: unknown;
130
+ kind: "api";
131
+ provenance: "self_listed" | "partner";
132
+ execution: {
133
+ [x: string]: unknown;
134
+ mode: "direct" | "gateway";
135
+ };
136
+ action: {
137
+ [x: string]: unknown;
138
+ type: "invoke_api";
139
+ href: string;
140
+ };
141
+ verification: "none" | "requested" | "verified";
142
+ ref: string;
143
+ card: {
144
+ [x: string]: unknown;
145
+ title: string;
146
+ summary: string;
147
+ badges: {
148
+ [x: string]: unknown;
149
+ code: "partner" | "live_x402" | "payout_wallet_confirmed" | "vapi_verified" | "external_catalog" | "approved_vendor";
150
+ label: string;
151
+ }[];
152
+ facts: {
153
+ [x: string]: unknown;
154
+ label: string;
155
+ value: string;
156
+ }[];
157
+ byline?: string | undefined;
158
+ bylineHref?: string | undefined;
159
+ };
160
+ group?: "partner" | "vapi" | "added" | "external" | undefined;
161
+ fee?: {
162
+ [x: string]: unknown;
163
+ bps: number;
164
+ label: string;
165
+ } | undefined;
166
+ liveness?: {
167
+ [x: string]: unknown;
168
+ uptime7d: number;
169
+ latencyP50Ms: number | null;
170
+ latencyP95Ms: number | null;
171
+ checks7d: number;
172
+ } | undefined;
173
+ conformance?: {
174
+ [x: string]: unknown;
175
+ declaredVersion: 1 | 2 | null;
176
+ versionConformant: boolean;
177
+ offerTransport: "body" | "header" | "both";
178
+ issues: string[];
179
+ } | undefined;
180
+ identity?: {
181
+ [x: string]: unknown;
182
+ erc8004Id: string;
183
+ reputation?: {
184
+ [x: string]: unknown;
185
+ score: number;
186
+ count: number;
187
+ } | undefined;
188
+ } | undefined;
189
+ } | {
190
+ [x: string]: unknown;
191
+ kind: "api";
192
+ provenance: "indexed";
193
+ execution: {
194
+ [x: string]: unknown;
195
+ mode: "direct";
196
+ url: string;
197
+ method: "HEAD" | "POST" | "GET" | "PUT" | "PATCH" | "DELETE" | null;
198
+ network: string;
199
+ };
200
+ action: {
201
+ [x: string]: unknown;
202
+ type: "invoke_api";
203
+ href: string;
204
+ };
205
+ verification: "none" | "requested" | "verified";
206
+ ref: string;
207
+ card: {
208
+ [x: string]: unknown;
209
+ title: string;
210
+ summary: string;
211
+ badges: {
212
+ [x: string]: unknown;
213
+ code: "partner" | "live_x402" | "payout_wallet_confirmed" | "vapi_verified" | "external_catalog" | "approved_vendor";
214
+ label: string;
215
+ }[];
216
+ facts: {
217
+ [x: string]: unknown;
218
+ label: string;
219
+ value: string;
220
+ }[];
221
+ byline?: string | undefined;
222
+ bylineHref?: string | undefined;
223
+ };
224
+ group?: "partner" | "vapi" | "added" | "external" | undefined;
225
+ fee?: {
226
+ [x: string]: unknown;
227
+ bps: number;
228
+ label: string;
229
+ } | undefined;
230
+ liveness?: {
231
+ [x: string]: unknown;
232
+ uptime7d: number;
233
+ latencyP50Ms: number | null;
234
+ latencyP95Ms: number | null;
235
+ checks7d: number;
236
+ } | undefined;
237
+ conformance?: {
238
+ [x: string]: unknown;
239
+ declaredVersion: 1 | 2 | null;
240
+ versionConformant: boolean;
241
+ offerTransport: "body" | "header" | "both";
242
+ issues: string[];
243
+ } | undefined;
244
+ identity?: {
245
+ [x: string]: unknown;
246
+ erc8004Id: string;
247
+ reputation?: {
248
+ [x: string]: unknown;
249
+ score: number;
250
+ count: number;
251
+ } | undefined;
252
+ } | undefined;
253
+ } | {
254
+ [x: string]: unknown;
255
+ kind: "service_offer";
256
+ action: {
257
+ [x: string]: unknown;
258
+ type: "start_engagement";
259
+ href: string;
260
+ };
261
+ verification: "none" | "requested" | "verified";
262
+ ref: string;
263
+ card: {
264
+ [x: string]: unknown;
265
+ title: string;
266
+ summary: string;
267
+ badges: {
268
+ [x: string]: unknown;
269
+ code: "partner" | "live_x402" | "payout_wallet_confirmed" | "vapi_verified" | "external_catalog" | "approved_vendor";
270
+ label: string;
271
+ }[];
272
+ facts: {
273
+ [x: string]: unknown;
274
+ label: string;
275
+ value: string;
276
+ }[];
277
+ byline?: string | undefined;
278
+ bylineHref?: string | undefined;
279
+ };
280
+ group?: "partner" | "vapi" | "added" | "external" | undefined;
281
+ fee?: {
282
+ [x: string]: unknown;
283
+ bps: number;
284
+ label: string;
285
+ } | undefined;
286
+ liveness?: {
287
+ [x: string]: unknown;
288
+ uptime7d: number;
289
+ latencyP50Ms: number | null;
290
+ latencyP95Ms: number | null;
291
+ checks7d: number;
292
+ } | undefined;
293
+ conformance?: {
294
+ [x: string]: unknown;
295
+ declaredVersion: 1 | 2 | null;
296
+ versionConformant: boolean;
297
+ offerTransport: "body" | "header" | "both";
298
+ issues: string[];
299
+ } | undefined;
300
+ identity?: {
301
+ [x: string]: unknown;
302
+ erc8004Id: string;
303
+ reputation?: {
304
+ [x: string]: unknown;
305
+ score: number;
306
+ count: number;
307
+ } | undefined;
308
+ } | undefined;
309
+ } | {
310
+ [x: string]: unknown;
311
+ kind: "open_request";
312
+ action: {
313
+ [x: string]: unknown;
314
+ type: "propose_to_request";
315
+ href: string;
316
+ };
317
+ verification: "none" | "requested" | "verified";
318
+ ref: string;
319
+ card: {
320
+ [x: string]: unknown;
321
+ title: string;
322
+ summary: string;
323
+ badges: {
324
+ [x: string]: unknown;
325
+ code: "partner" | "live_x402" | "payout_wallet_confirmed" | "vapi_verified" | "external_catalog" | "approved_vendor";
326
+ label: string;
327
+ }[];
328
+ facts: {
329
+ [x: string]: unknown;
330
+ label: string;
331
+ value: string;
332
+ }[];
333
+ byline?: string | undefined;
334
+ bylineHref?: string | undefined;
335
+ };
336
+ group?: "partner" | "vapi" | "added" | "external" | undefined;
337
+ fee?: {
338
+ [x: string]: unknown;
339
+ bps: number;
340
+ label: string;
341
+ } | undefined;
342
+ liveness?: {
343
+ [x: string]: unknown;
344
+ uptime7d: number;
345
+ latencyP50Ms: number | null;
346
+ latencyP95Ms: number | null;
347
+ checks7d: number;
348
+ } | undefined;
349
+ conformance?: {
350
+ [x: string]: unknown;
351
+ declaredVersion: 1 | 2 | null;
352
+ versionConformant: boolean;
353
+ offerTransport: "body" | "header" | "both";
354
+ issues: string[];
355
+ } | undefined;
356
+ identity?: {
357
+ [x: string]: unknown;
358
+ erc8004Id: string;
359
+ reputation?: {
360
+ [x: string]: unknown;
361
+ score: number;
362
+ count: number;
363
+ } | undefined;
364
+ } | undefined;
365
+ })[];
366
+ nextCursor: string | null;
367
+ unavailableKinds: ("api" | "service_offer" | "open_request")[];
368
+ rankingVersion: "marketplace-ranking-v1";
369
+ }>;
370
+ export declare const callInspect: import("./define.js").Action<{
371
+ id: string;
372
+ endpoint?: string | undefined;
373
+ }, {
374
+ name: string;
375
+ method: string | null;
376
+ url: string;
377
+ price: string;
378
+ description: string;
379
+ verification: "none" | "requested" | "verified";
380
+ payment: {
381
+ scheme: "exact";
382
+ network: string;
383
+ asset: string;
384
+ payTo: string;
385
+ checkedAt: string;
386
+ } | null;
387
+ operationId?: string | undefined;
388
+ requestContentType?: string | undefined;
389
+ requestSchema?: unknown;
390
+ responseContentType?: string | undefined;
391
+ network?: string | undefined;
392
+ group?: "partner" | "vapi" | "added" | "external" | undefined;
393
+ fee?: {
394
+ [x: string]: unknown;
395
+ bps: number;
396
+ label: string;
397
+ } | undefined;
398
+ liveness?: {
399
+ [x: string]: unknown;
400
+ uptime7d: number;
401
+ latencyP50Ms: number | null;
402
+ latencyP95Ms: number | null;
403
+ checks7d: number;
404
+ } | undefined;
405
+ conformance?: {
406
+ [x: string]: unknown;
407
+ declaredVersion: 1 | 2 | null;
408
+ versionConformant: boolean;
409
+ offerTransport: "body" | "header" | "both";
410
+ issues: string[];
411
+ } | undefined;
412
+ identity?: {
413
+ [x: string]: unknown;
414
+ erc8004Id: string;
415
+ reputation?: {
416
+ [x: string]: unknown;
417
+ score: number;
418
+ count: number;
419
+ } | undefined;
420
+ } | undefined;
421
+ }>;
422
+ export declare const callPay: import("./define.js").Action<{
423
+ id?: string | undefined;
424
+ url?: string | undefined;
425
+ method?: string | undefined;
426
+ endpoint?: string | undefined;
427
+ body?: unknown;
428
+ contentType?: string | undefined;
429
+ network?: string | undefined;
430
+ expectedPayTo?: string | undefined;
431
+ maxPriceUsd?: string | number | undefined;
432
+ wallet?: string | undefined;
433
+ }, {
434
+ wallet: string;
435
+ } & CallToolResult>;
436
+ export type PaymentResolution = {
437
+ account: VapiPaymentAccount;
438
+ wallet: string;
439
+ spendCaps?: SpendCaps;
440
+ ledgerPath: string;
441
+ receiptsPath: string;
442
+ fetchImpl?: typeof fetch;
443
+ ceilingSweep?: CeilingSweepHook | false;
444
+ };
445
+ export type CreateCallPortOptions = {
446
+ config: VapiConfig;
447
+ fetchImpl?: typeof fetch;
448
+ searchesPath?: string;
449
+ notice?: (message: string) => void;
450
+ cacheMarketplaceHits?: boolean | "optional";
451
+ resolvePayment: (wallet?: string) => Promise<PaymentResolution>;
452
+ };
453
+ export declare function createCallPort(options: CreateCallPortOptions): CallPort;
@@ -0,0 +1,44 @@
1
+ import type { AgentProfile, MarketplaceDiscoveryPage, VapiConfig } from "@vapi-network/core";
2
+ import type { CallToolInput, CallToolResult } from "../tools/call.js";
3
+ import type { InspectToolInput, InspectToolResult } from "../tools/inspect.js";
4
+ import type { MarketplaceSearchInput } from "../tools/search.js";
5
+ export type ActionSurface = "cli" | "mcp" | "agent";
6
+ export type ActionRunState = {
7
+ searchedRefs: Set<string>;
8
+ inspected: Map<string, InspectToolResult>;
9
+ paidOrigins: Set<string>;
10
+ };
11
+ export declare function createRunState(): ActionRunState;
12
+ export declare function inspectionCacheKey(input: Pick<InspectToolInput, "id" | "endpoint">): string;
13
+ export type CallPort = {
14
+ search(input: MarketplaceSearchInput): Promise<MarketplaceDiscoveryPage>;
15
+ inspect(input: InspectToolInput): Promise<InspectToolResult>;
16
+ pay(input: CallToolInput & {
17
+ wallet?: string;
18
+ }): Promise<{
19
+ wallet: string;
20
+ } & CallToolResult>;
21
+ };
22
+ export type ActionContext = {
23
+ config: VapiConfig;
24
+ fetch?: typeof fetch;
25
+ clock: () => Date;
26
+ call: CallPort;
27
+ caps?: {
28
+ perCallUsd: number;
29
+ };
30
+ askOwner?: (question: {
31
+ action: string;
32
+ reason: string;
33
+ ref?: string;
34
+ priceUsd?: number;
35
+ }) => Promise<boolean>;
36
+ journal?: {
37
+ decided?: (action: string, decision: string) => void | Promise<void>;
38
+ };
39
+ caller: {
40
+ surface: ActionSurface;
41
+ profile?: AgentProfile;
42
+ run?: ActionRunState;
43
+ };
44
+ };
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import type { ActionContext } from "./context.js";
3
+ export type ActionMoney = "spends" | "moves" | "none";
4
+ export type ActionGrant = "call" | "router" | "send" | "allocate" | "delegate" | "read";
5
+ export type Action<I, O> = {
6
+ readonly name: string;
7
+ readonly loopName: string;
8
+ readonly description: string;
9
+ readonly input: z.ZodObject<z.ZodRawShape>;
10
+ readonly output: z.ZodType<O>;
11
+ readonly money: ActionMoney;
12
+ readonly grant: ActionGrant;
13
+ run(input: I, ctx: ActionContext): Promise<O>;
14
+ };
15
+ export declare function toLoopName(name: string): string;
16
+ export declare function defineAction<I, O>(spec: Omit<Action<I, O>, "loopName">): Action<I, O>;
@@ -0,0 +1,17 @@
1
+ import { type ActionContext } from "./context.js";
2
+ import type { Action } from "./define.js";
3
+ export type PolicyDecision = {
4
+ kind: "allow";
5
+ } | {
6
+ kind: "ask_owner";
7
+ reason: string;
8
+ ref?: string;
9
+ priceUsd?: number;
10
+ } | {
11
+ kind: "deny";
12
+ reason: string;
13
+ };
14
+ export declare function exactUsdcPrice(value: string): number | null;
15
+ export declare function checkAction<I, O>(action: Action<I, O>, input: I, ctx: ActionContext, options?: {
16
+ ownerApproved?: boolean;
17
+ }): Promise<PolicyDecision>;