@vapi-network/mcp 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,17 @@
1
+ import { type AgentProfile, type ChatRequest, type ChatResult, type SpendCaps, type VapiConfig, type VapiPaymentAccount, type WalletName } from "@vapi-network/core";
2
+ import type { AgentEvent, RunAgentDeps } from "./run.js";
3
+ export declare function createAgentRunDeps(input: {
4
+ profile: AgentProfile;
5
+ config: VapiConfig;
6
+ home: string;
7
+ account: VapiPaymentAccount;
8
+ wallet: WalletName;
9
+ spendCaps: SpendCaps;
10
+ chat: (req: ChatRequest) => Promise<ChatResult>;
11
+ approve: RunAgentDeps["approve"];
12
+ onEvent?: (event: AgentEvent) => void;
13
+ tty?: boolean;
14
+ fetchImpl?: typeof fetch;
15
+ ledgerPath?: string;
16
+ receiptsPath?: string;
17
+ }): RunAgentDeps;
@@ -0,0 +1,21 @@
1
+ export declare const UNTRUSTED_NOTICE: string;
2
+ /** Wraps tool output so the model can tell data from instructions. */
3
+ export declare function wrapUntrusted(tool: string, value: unknown): string;
4
+ export type PayDecision = {
5
+ action: "pay";
6
+ } | {
7
+ action: "ask";
8
+ reason: string;
9
+ } | {
10
+ action: "refuse";
11
+ reason: string;
12
+ };
13
+ export declare function decidePayment(input: {
14
+ ref: string;
15
+ priceUsd: number | null;
16
+ verification: string;
17
+ seenRefs: ReadonlySet<string>;
18
+ verifiedOnly: boolean;
19
+ approveAboveUsd: number;
20
+ maxPerCallUsd: number;
21
+ }): PayDecision;
@@ -0,0 +1,72 @@
1
+ import { type AgentProfile, type ChatRequest, type ChatResult, type VapiConfig } from "@vapi-network/core";
2
+ import type { InspectToolResult } from "../tools/inspect.js";
3
+ export type AgentEvent = {
4
+ type: "step";
5
+ n: number;
6
+ } | {
7
+ type: "tool";
8
+ name: string;
9
+ summary: string;
10
+ } | {
11
+ type: "paid";
12
+ ref: string;
13
+ amountUsd: number;
14
+ network: string;
15
+ } | {
16
+ type: "declined";
17
+ ref: string;
18
+ reason: string;
19
+ } | {
20
+ type: "stopped";
21
+ reason: "finished" | "max_steps" | "router_budget" | "paused" | "error";
22
+ detail?: string;
23
+ };
24
+ export type RunAgentDeps = {
25
+ profile: AgentProfile;
26
+ config: VapiConfig;
27
+ home: string;
28
+ chat: (req: ChatRequest) => Promise<ChatResult>;
29
+ search: (q: {
30
+ query: string;
31
+ network?: string;
32
+ includeUnverified: boolean;
33
+ }) => Promise<Array<{
34
+ ref: string;
35
+ name: string;
36
+ priceUsd: number | null;
37
+ verification: string;
38
+ description?: string;
39
+ }>>;
40
+ inspect: (ref: string) => Promise<InspectToolResult>;
41
+ pay: (input: {
42
+ ref: string;
43
+ body?: unknown;
44
+ maxPriceUsd: number;
45
+ }) => Promise<{
46
+ ok: boolean;
47
+ status: number;
48
+ body: unknown;
49
+ amountUsd: number;
50
+ network: string;
51
+ }>;
52
+ caps: {
53
+ perCallUsd: number;
54
+ };
55
+ approve: (question: {
56
+ ref: string;
57
+ priceUsd: number;
58
+ reason: string;
59
+ }) => Promise<boolean>;
60
+ onEvent?: (event: AgentEvent) => void;
61
+ tty?: boolean;
62
+ now?: () => Date;
63
+ };
64
+ export type RunAgentResult = {
65
+ answer: string | null;
66
+ stoppedBecause: AgentEvent & {
67
+ type: "stopped";
68
+ };
69
+ paidUsd: number;
70
+ steps: number;
71
+ };
72
+ export declare function runAgent(task: string, deps: RunAgentDeps): Promise<RunAgentResult>;
package/dist/index.d.ts CHANGED
@@ -4,3 +4,6 @@ export { resolveServiceEndpoint, resolveServiceListing, searchMarketplace, type
4
4
  export { getWallet, type WalletAddresses, type WalletBalance } from "./tools/wallet.js";
5
5
  export { WalletSession, type SessionWallet, type SessionWalletInfo, type WalletSessionOptions, } from "./wallet-session.js";
6
6
  export { buildSIWxProof, parseSIWxResponse } from "./siwx.js";
7
+ export { UNTRUSTED_NOTICE, decidePayment, wrapUntrusted, type PayDecision, } from "./agent/guards.js";
8
+ export { createAgentRunDeps } from "./agent/deps.js";
9
+ export { runAgent, type AgentEvent, type RunAgentDeps, type RunAgentResult } from "./agent/run.js";