@vapi-network/mcp 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.
@@ -0,0 +1,90 @@
1
+ import type { AgentProfile, MarketplaceDiscoveryPage, RunBudget, RunRef, TransferResult, 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
+ import type { SwarmRunInput, SwarmRunResult } from "../agent/swarm-run.js";
6
+ import type { DetachedRunSummary, DetachedSwarmRunResult } from "../agent/runtime.js";
7
+ import type { AccountsSendInput } from "./accounts.js";
8
+ import type { CallReadInput, CallReadOutput } from "./call-read.js";
9
+ import type { SwarmAddInput, SwarmDissolveInput, SwarmDissolveOutput, SwarmFundInput, SwarmFundOutput, SwarmLeaveInput, SwarmLeaveOutput, SwarmRebalanceInput, SwarmRebalanceOutput, SwarmSetupInput, SwarmSetupOutput, SwarmStatusInput, SwarmStatusOutput } from "./swarm.js";
10
+ export type ActionSurface = "cli" | "mcp" | "agent";
11
+ export type SwarmRunScope = {
12
+ name: string;
13
+ treasury: string;
14
+ member: string;
15
+ depth: 0 | 1;
16
+ draw: RunBudget;
17
+ };
18
+ export type SwarmRunActionInput = SwarmRunInput & {
19
+ detach?: boolean;
20
+ };
21
+ export type SwarmRunActionResult = SwarmRunResult | DetachedSwarmRunResult;
22
+ export type SwarmRunsInput = {
23
+ name: string;
24
+ };
25
+ export type SwarmRunsResult = {
26
+ swarm: string;
27
+ runs: DetachedRunSummary[];
28
+ };
29
+ export type ActionRunState = {
30
+ ref?: RunRef;
31
+ swarm?: SwarmRunScope;
32
+ searchedRefs: Set<string>;
33
+ inspected: Map<string, InspectToolResult>;
34
+ paidOrigins: Set<string>;
35
+ };
36
+ export declare function createRunState(): ActionRunState;
37
+ export declare function inspectionCacheKey(input: Pick<InspectToolInput, "id" | "endpoint">): string;
38
+ export type CallPort = {
39
+ search(input: MarketplaceSearchInput): Promise<MarketplaceDiscoveryPage>;
40
+ inspect(input: InspectToolInput): Promise<InspectToolResult>;
41
+ pay(input: CallToolInput & {
42
+ wallet?: string;
43
+ }): Promise<{
44
+ wallet: string;
45
+ } & CallToolResult>;
46
+ read?(input: CallReadInput): Promise<CallReadOutput>;
47
+ };
48
+ export type AccountsPort = {
49
+ send(input: AccountsSendInput): Promise<TransferResult>;
50
+ };
51
+ export type SwarmPort = {
52
+ setup(input: SwarmSetupInput): Promise<SwarmSetupOutput>;
53
+ add(input: SwarmAddInput): Promise<SwarmSetupOutput>;
54
+ leave(input: SwarmLeaveInput): Promise<SwarmLeaveOutput>;
55
+ fund(input: SwarmFundInput): Promise<SwarmFundOutput>;
56
+ rebalance(input: SwarmRebalanceInput): Promise<SwarmRebalanceOutput>;
57
+ status(input: SwarmStatusInput): Promise<SwarmStatusOutput>;
58
+ dissolve(input: SwarmDissolveInput): Promise<SwarmDissolveOutput>;
59
+ };
60
+ export type ActionContext = {
61
+ config: VapiConfig;
62
+ fetch?: typeof fetch;
63
+ clock: () => Date;
64
+ call: CallPort;
65
+ accounts?: AccountsPort;
66
+ swarm?: SwarmPort;
67
+ swarmRun?: {
68
+ run(input: SwarmRunActionInput): Promise<SwarmRunActionResult>;
69
+ };
70
+ swarmRuns?: {
71
+ list(input: SwarmRunsInput): Promise<SwarmRunsResult>;
72
+ };
73
+ caps?: {
74
+ perCallUsd: number;
75
+ };
76
+ askOwner?: (question: {
77
+ action: string;
78
+ reason: string;
79
+ ref?: string;
80
+ priceUsd?: number;
81
+ }) => Promise<boolean>;
82
+ journal?: {
83
+ decided?: (action: string, decision: string) => void | Promise<void>;
84
+ };
85
+ caller: {
86
+ surface: ActionSurface;
87
+ profile?: AgentProfile;
88
+ run?: ActionRunState;
89
+ };
90
+ };
@@ -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>;