@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.
- package/README.md +59 -5
- package/dist/actions/accounts.d.ts +53 -0
- package/dist/actions/call-read.d.ts +28 -0
- package/dist/actions/call.d.ts +458 -0
- package/dist/actions/context.d.ts +90 -0
- package/dist/actions/define.d.ts +16 -0
- package/dist/actions/policy.d.ts +17 -0
- package/dist/actions/register.d.ts +915 -0
- package/dist/actions/swarm-agent.d.ts +178 -0
- package/dist/actions/swarm.d.ts +1586 -0
- package/dist/agent/deps.d.ts +12 -1
- package/dist/agent/run.d.ts +78 -2
- package/dist/agent/runtime.d.ts +154 -0
- package/dist/agent/swarm-run.d.ts +94 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.js +14465 -4453
- package/dist/index.js.map +3 -3
- package/dist/server.d.ts +19 -6
- package/dist/tools/accounts.d.ts +145 -0
- package/dist/tools/auth.d.ts +2 -0
- package/dist/tools/call.d.ts +8 -1
- package/dist/tools/siblings.d.ts +70 -0
- package/dist/tools/status.d.ts +116 -0
- package/dist/wallet-session.d.ts +21 -25
- package/package.json +1 -1
package/dist/server.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { type SecretStore, type VapiPaymentAccount, type VapiConfig, type WalletStore } from "@vapi-network/core";
|
|
1
|
+
import { type SecretStore, type SwarmCapitalDeps, type VapiPaymentAccount, type VapiConfig, type WalletStore } from "@vapi-network/core";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { type Runtime } from "./agent/runtime.js";
|
|
3
4
|
import { callService, type CallToolInput, type CallToolResult } from "./tools/call.js";
|
|
5
|
+
import { type AccountsToolOverrides } from "./tools/accounts.js";
|
|
4
6
|
import { type AuthAgentLinkOverrides } from "./tools/auth.js";
|
|
5
7
|
import { type RouterCoreOverrides } from "./tools/router.js";
|
|
8
|
+
import { type StatusCoreOverrides } from "./tools/status.js";
|
|
6
9
|
export { callService, type CallToolInput, type CallToolResult };
|
|
7
10
|
export type VapiServerOptions = {
|
|
8
|
-
/** The
|
|
11
|
+
/** The account opened before stdio was connected. */
|
|
9
12
|
account: VapiPaymentAccount;
|
|
10
13
|
config: VapiConfig;
|
|
11
14
|
fetchImpl?: typeof fetch;
|
|
@@ -13,19 +16,27 @@ export type VapiServerOptions = {
|
|
|
13
16
|
receiptsPath?: string;
|
|
14
17
|
searchesPath?: string;
|
|
15
18
|
reportsDirectory?: string;
|
|
16
|
-
/** The
|
|
19
|
+
/** The accounts on this machine. Without it the server has exactly one. */
|
|
17
20
|
store?: WalletStore | undefined;
|
|
18
|
-
/** The
|
|
21
|
+
/** The account the session starts on; `VAPI_WALLET` and the default follow. */
|
|
19
22
|
wallet?: string | undefined;
|
|
20
23
|
env?: NodeJS.ProcessEnv | undefined;
|
|
21
|
-
/** The passphrase a
|
|
24
|
+
/** The passphrase for a legacy 0.5 keystore that has not been migrated yet. */
|
|
22
25
|
passphrase?: (() => string | Promise<string>) | undefined;
|
|
23
|
-
/** The OS secret store
|
|
26
|
+
/** The OS secret store used by the vault and any legacy keystore entries. */
|
|
24
27
|
secretStore?: SecretStore | undefined;
|
|
25
28
|
/** Device-link functions and API base overridden by deterministic tests. */
|
|
26
29
|
agentLink?: AuthAgentLinkOverrides | undefined;
|
|
27
30
|
/** Core Router functions overridden by deterministic tests. */
|
|
28
31
|
router?: RouterCoreOverrides | undefined;
|
|
32
|
+
/** Status probes and clock overridden by deterministic tests. */
|
|
33
|
+
status?: StatusCoreOverrides | undefined;
|
|
34
|
+
/** Account-link functions, device identity and clock overridden by deterministic tests. */
|
|
35
|
+
accounts?: AccountsToolOverrides | undefined;
|
|
36
|
+
/** Swarm capital seams overridden by deterministic tests. */
|
|
37
|
+
swarm?: Pick<SwarmCapitalDeps, "balanceReader" | "transfer" | "randomId" | "randomNonce"> | undefined;
|
|
38
|
+
/** Background runtime used by detached swarm runs. */
|
|
39
|
+
runtime?: Runtime | undefined;
|
|
29
40
|
};
|
|
30
41
|
type ToolResult = {
|
|
31
42
|
isError?: boolean;
|
|
@@ -51,6 +62,7 @@ type ListedTool = {
|
|
|
51
62
|
/** Minimal MCP server implementation for stdio and deterministic in-memory tests. */
|
|
52
63
|
export declare class VapiMcpServer {
|
|
53
64
|
#private;
|
|
65
|
+
constructor(onClose?: () => void);
|
|
54
66
|
registerTool<Shape extends z.ZodRawShape>(name: string, definition: ToolDefinition<Shape>, handler: (input: z.infer<z.ZodObject<Shape>>) => Promise<ToolResult>): void;
|
|
55
67
|
listTools(): Promise<{
|
|
56
68
|
tools: ListedTool[];
|
|
@@ -86,4 +98,5 @@ export declare function loadServerConfig(): Promise<{
|
|
|
86
98
|
marketplaceDiscoveryUrl: string;
|
|
87
99
|
}[] | undefined;
|
|
88
100
|
allowPrivateNetwork?: boolean | undefined;
|
|
101
|
+
device?: string | undefined;
|
|
89
102
|
}>;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { type AddAccountArgs, type SecretStore, type TransferArgs, type WalletStore } from "@vapi-network/core";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { AccountsPort } from "../actions/context.js";
|
|
4
|
+
import type { WalletSession } from "../wallet-session.js";
|
|
5
|
+
export { accountsSendInputSchema, accountsSendOutputSchema } from "../actions/accounts.js";
|
|
6
|
+
export declare const accountsAddTool: {
|
|
7
|
+
description: string;
|
|
8
|
+
strictInput: boolean;
|
|
9
|
+
inputSchema: {
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
caps: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
perCallUsd: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
perDayUsd: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
routerAllowanceUsd: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
link: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
};
|
|
18
|
+
outputSchema: z.ZodObject<{
|
|
19
|
+
account: z.ZodString;
|
|
20
|
+
address: z.ZodString;
|
|
21
|
+
caps: z.ZodObject<{
|
|
22
|
+
perCallUsd: z.ZodString;
|
|
23
|
+
perDayUsd: z.ZodString;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
created: z.ZodBoolean;
|
|
26
|
+
linked: z.ZodBoolean;
|
|
27
|
+
autoApproved: z.ZodBoolean;
|
|
28
|
+
link: z.ZodOptional<z.ZodObject<{
|
|
29
|
+
userCode: z.ZodString;
|
|
30
|
+
verificationUri: z.ZodURL;
|
|
31
|
+
verificationUriComplete: z.ZodURL;
|
|
32
|
+
expiresInSeconds: z.ZodNumber;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
message: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
};
|
|
37
|
+
export declare const accountsCapsTool: {
|
|
38
|
+
description: string;
|
|
39
|
+
strictInput: boolean;
|
|
40
|
+
inputSchema: {
|
|
41
|
+
name: z.ZodString;
|
|
42
|
+
perCallUsd: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
perDayUsd: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
ceilingUsd: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"off">]>>;
|
|
45
|
+
};
|
|
46
|
+
outputSchema: z.ZodObject<{
|
|
47
|
+
account: z.ZodString;
|
|
48
|
+
address: z.ZodString;
|
|
49
|
+
caps: z.ZodObject<{
|
|
50
|
+
perCallUsd: z.ZodString;
|
|
51
|
+
perDayUsd: z.ZodString;
|
|
52
|
+
ceilingUsd: z.ZodString;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
message: z.ZodString;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
};
|
|
57
|
+
export declare const accountsSendTool: {
|
|
58
|
+
description: string;
|
|
59
|
+
strictInput: boolean;
|
|
60
|
+
inputSchema: {
|
|
61
|
+
from: z.ZodString;
|
|
62
|
+
to: z.ZodString;
|
|
63
|
+
amountUsd: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
64
|
+
network: z.ZodOptional<z.ZodEnum<{
|
|
65
|
+
base: "base";
|
|
66
|
+
arc: "arc";
|
|
67
|
+
}>>;
|
|
68
|
+
};
|
|
69
|
+
outputSchema: z.ZodObject<{
|
|
70
|
+
status: z.ZodEnum<{
|
|
71
|
+
unknown: "unknown";
|
|
72
|
+
sent: "sent";
|
|
73
|
+
}>;
|
|
74
|
+
from: z.ZodString;
|
|
75
|
+
to: z.ZodString;
|
|
76
|
+
toName: z.ZodString;
|
|
77
|
+
toKind: z.ZodEnum<{
|
|
78
|
+
account: "account";
|
|
79
|
+
owner: "owner";
|
|
80
|
+
}>;
|
|
81
|
+
amountUsd: z.ZodString;
|
|
82
|
+
amountAtomic: z.ZodString;
|
|
83
|
+
network: z.ZodEnum<{
|
|
84
|
+
"eip155:8453": "eip155:8453";
|
|
85
|
+
"eip155:5042": "eip155:5042";
|
|
86
|
+
}>;
|
|
87
|
+
txHash: z.ZodNullable<z.ZodString>;
|
|
88
|
+
nonce: z.ZodString;
|
|
89
|
+
replayed: z.ZodBoolean;
|
|
90
|
+
message: z.ZodString;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
};
|
|
93
|
+
export type AccountsToolOverrides = {
|
|
94
|
+
configPath?: string | undefined;
|
|
95
|
+
hostname?: string | undefined;
|
|
96
|
+
now?: (() => number) | undefined;
|
|
97
|
+
sleep?: AddAccountArgs["sleep"];
|
|
98
|
+
startDeviceLink?: AddAccountArgs["startDeviceLink"];
|
|
99
|
+
pollDeviceLink?: AddAccountArgs["pollDeviceLink"];
|
|
100
|
+
saveAgentLink?: AddAccountArgs["saveAgentLink"];
|
|
101
|
+
scopes?: AddAccountArgs["scopes"];
|
|
102
|
+
nonce?: TransferArgs["nonce"];
|
|
103
|
+
};
|
|
104
|
+
export type AccountsToolsOptions = AccountsToolOverrides & {
|
|
105
|
+
session: WalletSession;
|
|
106
|
+
secrets: SecretStore;
|
|
107
|
+
wallets?: WalletStore | undefined;
|
|
108
|
+
fetchImpl: typeof fetch;
|
|
109
|
+
apiBase: string;
|
|
110
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
111
|
+
signal?: AbortSignal | undefined;
|
|
112
|
+
};
|
|
113
|
+
export type CreateAccountsPortOptions = Pick<AccountsToolsOptions, "session" | "secrets" | "wallets" | "fetchImpl" | "apiBase" | "now" | "nonce">;
|
|
114
|
+
type ToolResult = {
|
|
115
|
+
structuredContent: Record<string, unknown>;
|
|
116
|
+
content: Array<{
|
|
117
|
+
type: "text";
|
|
118
|
+
text: string;
|
|
119
|
+
}>;
|
|
120
|
+
} | {
|
|
121
|
+
isError: true;
|
|
122
|
+
content: Array<{
|
|
123
|
+
type: "text";
|
|
124
|
+
text: string;
|
|
125
|
+
}>;
|
|
126
|
+
};
|
|
127
|
+
/** Account mutation tools. Link credentials and the device code stay inside core. */
|
|
128
|
+
export declare function createAccountsTools(options: AccountsToolsOptions): {
|
|
129
|
+
add(input: {
|
|
130
|
+
name: string;
|
|
131
|
+
caps?: {
|
|
132
|
+
perCallUsd?: number;
|
|
133
|
+
perDayUsd?: number;
|
|
134
|
+
};
|
|
135
|
+
routerAllowanceUsd?: number;
|
|
136
|
+
link?: boolean;
|
|
137
|
+
}): Promise<ToolResult>;
|
|
138
|
+
caps(input: {
|
|
139
|
+
name: string;
|
|
140
|
+
perCallUsd?: number;
|
|
141
|
+
perDayUsd?: number;
|
|
142
|
+
ceilingUsd?: number | "off";
|
|
143
|
+
}): Promise<ToolResult>;
|
|
144
|
+
};
|
|
145
|
+
export declare function createAccountsPort(options: CreateAccountsPortOptions): AccountsPort;
|
package/dist/tools/auth.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export declare const authLinkTool: {
|
|
|
38
38
|
description: string;
|
|
39
39
|
inputSchema: {
|
|
40
40
|
label: z.ZodOptional<z.ZodString>;
|
|
41
|
+
account: z.ZodOptional<z.ZodString>;
|
|
41
42
|
};
|
|
42
43
|
outputSchema: z.ZodObject<{
|
|
43
44
|
wallet: z.ZodString;
|
|
@@ -73,6 +74,7 @@ type ToolResult = {
|
|
|
73
74
|
export declare function createAuthTools(options: AuthToolsOptions): {
|
|
74
75
|
link(input: {
|
|
75
76
|
label?: string;
|
|
77
|
+
account?: string;
|
|
76
78
|
}): Promise<ToolResult>;
|
|
77
79
|
status(input: {
|
|
78
80
|
wallet?: string;
|
package/dist/tools/call.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ListingVerification, type LookupFn, type MarketplaceHit, type SpendCaps, type VapiPaymentAccount, type VapiConfig, type WalletName } from "@vapi-network/core";
|
|
1
|
+
import { type ListingVerification, type LookupFn, type MarketplaceHit, type RunBudget, type RunRef, type CeilingSweepHook, type SpendCaps, type VapiPaymentAccount, type VapiConfig, type WalletName } from "@vapi-network/core";
|
|
2
2
|
export type CallToolInput = {
|
|
3
3
|
id?: string;
|
|
4
4
|
url?: string;
|
|
@@ -44,6 +44,8 @@ export declare class VapiCallError extends Error {
|
|
|
44
44
|
export type CallToolResult = {
|
|
45
45
|
status: number;
|
|
46
46
|
body: unknown;
|
|
47
|
+
/** The final resource URL after guarded redirects, present when a payment settled. */
|
|
48
|
+
resourceUrl?: string;
|
|
47
49
|
/**
|
|
48
50
|
* How far the paid listing got through vAPI review. Absent when there was no
|
|
49
51
|
* listing to disclose — a call made against an explicit URL.
|
|
@@ -78,7 +80,12 @@ export type CallServiceArgs = {
|
|
|
78
80
|
/** The caps of that wallet. Without it, the machine-wide config caps apply. */
|
|
79
81
|
spendCaps?: SpendCaps;
|
|
80
82
|
now?: Date;
|
|
83
|
+
allowanceExpiresAt?: Date;
|
|
81
84
|
nowMs?: () => number;
|
|
82
85
|
timeoutMs?: number;
|
|
86
|
+
runBudget?: RunBudget;
|
|
87
|
+
run?: RunRef;
|
|
88
|
+
/** Best-effort account ceiling enforcement after decisive settlement. */
|
|
89
|
+
ceilingSweep?: CeilingSweepHook | false;
|
|
83
90
|
};
|
|
84
91
|
export declare function callService(args: CallServiceArgs): Promise<CallToolResult>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type SecretStore, type WalletStore } from "@vapi-network/core";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
declare const siblingsOutputSchema: z.ZodObject<{
|
|
4
|
+
owner: z.ZodNullable<z.ZodString>;
|
|
5
|
+
siblings: z.ZodArray<z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
address: z.ZodString;
|
|
8
|
+
device: z.ZodNullable<z.ZodString>;
|
|
9
|
+
status: z.ZodEnum<{
|
|
10
|
+
active: "active";
|
|
11
|
+
revoked: "revoked";
|
|
12
|
+
}>;
|
|
13
|
+
allowance: z.ZodObject<{
|
|
14
|
+
routerPerDayUsd: z.ZodNullable<z.ZodNumber>;
|
|
15
|
+
perCallUsd: z.ZodNullable<z.ZodNumber>;
|
|
16
|
+
perDayUsd: z.ZodNullable<z.ZodNumber>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
self: z.ZodBoolean;
|
|
19
|
+
onThisDevice: z.ZodBoolean;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
note: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export declare const vapiSiblingsTool: {
|
|
24
|
+
description: string;
|
|
25
|
+
inputSchema: {
|
|
26
|
+
account: z.ZodOptional<z.ZodString>;
|
|
27
|
+
};
|
|
28
|
+
outputSchema: z.ZodObject<{
|
|
29
|
+
owner: z.ZodNullable<z.ZodString>;
|
|
30
|
+
siblings: z.ZodArray<z.ZodObject<{
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
address: z.ZodString;
|
|
33
|
+
device: z.ZodNullable<z.ZodString>;
|
|
34
|
+
status: z.ZodEnum<{
|
|
35
|
+
active: "active";
|
|
36
|
+
revoked: "revoked";
|
|
37
|
+
}>;
|
|
38
|
+
allowance: z.ZodObject<{
|
|
39
|
+
routerPerDayUsd: z.ZodNullable<z.ZodNumber>;
|
|
40
|
+
perCallUsd: z.ZodNullable<z.ZodNumber>;
|
|
41
|
+
perDayUsd: z.ZodNullable<z.ZodNumber>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
self: z.ZodBoolean;
|
|
44
|
+
onThisDevice: z.ZodBoolean;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
note: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
};
|
|
49
|
+
type ToolResult = {
|
|
50
|
+
structuredContent: z.infer<typeof siblingsOutputSchema>;
|
|
51
|
+
content: Array<{
|
|
52
|
+
type: "text";
|
|
53
|
+
text: string;
|
|
54
|
+
}>;
|
|
55
|
+
} | {
|
|
56
|
+
isError: true;
|
|
57
|
+
content: Array<{
|
|
58
|
+
type: "text";
|
|
59
|
+
text: string;
|
|
60
|
+
}>;
|
|
61
|
+
};
|
|
62
|
+
export declare function createSiblingsTool(options: {
|
|
63
|
+
wallets?: WalletStore | undefined;
|
|
64
|
+
secrets: SecretStore;
|
|
65
|
+
fetchImpl: typeof fetch;
|
|
66
|
+
now?: (() => Date) | undefined;
|
|
67
|
+
}): (input: {
|
|
68
|
+
account?: string;
|
|
69
|
+
}) => Promise<ToolResult>;
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type SecretStore, type StatusDeps, type VapiConfig, type WalletStore } from "@vapi-network/core";
|
|
2
|
+
import { routerUsage } from "@vapi-network/core/router-client";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
export declare const vapiStatusTool: {
|
|
5
|
+
description: string;
|
|
6
|
+
inputSchema: {};
|
|
7
|
+
outputSchema: z.ZodObject<{
|
|
8
|
+
version: z.ZodString;
|
|
9
|
+
home: z.ZodString;
|
|
10
|
+
registry: z.ZodString;
|
|
11
|
+
owner: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
address: z.ZodString;
|
|
13
|
+
linked: z.ZodBoolean;
|
|
14
|
+
console: z.ZodString;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
vault: z.ZodObject<{
|
|
17
|
+
exists: z.ZodBoolean;
|
|
18
|
+
unlocked: z.ZodBoolean;
|
|
19
|
+
store: z.ZodString;
|
|
20
|
+
protected: z.ZodBoolean;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
accounts: z.ZodArray<z.ZodObject<{
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
default: z.ZodBoolean;
|
|
25
|
+
address: z.ZodString;
|
|
26
|
+
usdc: z.ZodOptional<z.ZodString>;
|
|
27
|
+
routerTodayUsd: z.ZodOptional<z.ZodString>;
|
|
28
|
+
routerAllowanceUsd: z.ZodOptional<z.ZodString>;
|
|
29
|
+
caps: z.ZodObject<{
|
|
30
|
+
perCallUsd: z.ZodString;
|
|
31
|
+
perDayUsd: z.ZodString;
|
|
32
|
+
ceilingUsd: z.ZodString;
|
|
33
|
+
ceilingFloorUsd: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
link: z.ZodEnum<{
|
|
36
|
+
unknown: "unknown";
|
|
37
|
+
paused: "paused";
|
|
38
|
+
not_linked: "not_linked";
|
|
39
|
+
active: "active";
|
|
40
|
+
revoked: "revoked";
|
|
41
|
+
}>;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
unfinishedMovements: z.ZodArray<z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
from: z.ZodString;
|
|
46
|
+
network: z.ZodString;
|
|
47
|
+
createdAt: z.ZodString;
|
|
48
|
+
pendingLegs: z.ZodNumber;
|
|
49
|
+
unknownLegs: z.ZodNumber;
|
|
50
|
+
}, z.core.$strip>>;
|
|
51
|
+
next: z.ZodArray<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
};
|
|
54
|
+
export declare const vapiAccountsTool: {
|
|
55
|
+
description: string;
|
|
56
|
+
inputSchema: {};
|
|
57
|
+
outputSchema: z.ZodObject<{
|
|
58
|
+
accounts: z.ZodArray<z.ZodObject<{
|
|
59
|
+
name: z.ZodString;
|
|
60
|
+
default: z.ZodBoolean;
|
|
61
|
+
address: z.ZodString;
|
|
62
|
+
usdc: z.ZodOptional<z.ZodString>;
|
|
63
|
+
routerTodayUsd: z.ZodOptional<z.ZodString>;
|
|
64
|
+
routerAllowanceUsd: z.ZodOptional<z.ZodString>;
|
|
65
|
+
caps: z.ZodObject<{
|
|
66
|
+
perCallUsd: z.ZodString;
|
|
67
|
+
perDayUsd: z.ZodString;
|
|
68
|
+
ceilingUsd: z.ZodString;
|
|
69
|
+
ceilingFloorUsd: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
link: z.ZodEnum<{
|
|
72
|
+
unknown: "unknown";
|
|
73
|
+
paused: "paused";
|
|
74
|
+
not_linked: "not_linked";
|
|
75
|
+
active: "active";
|
|
76
|
+
revoked: "revoked";
|
|
77
|
+
}>;
|
|
78
|
+
}, z.core.$strip>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
};
|
|
81
|
+
export type StatusCoreOverrides = {
|
|
82
|
+
usdcBalance?: StatusDeps["chain"]["usdcBalance"] | undefined;
|
|
83
|
+
routerUsage?: StatusDeps["agents"]["routerUsage"] | undefined;
|
|
84
|
+
linkStatus?: StatusDeps["agents"]["linkStatus"] | undefined;
|
|
85
|
+
timeoutMs?: number | undefined;
|
|
86
|
+
now?: (() => Date) | undefined;
|
|
87
|
+
};
|
|
88
|
+
export type StatusToolsOptions = StatusCoreOverrides & {
|
|
89
|
+
version: string;
|
|
90
|
+
home: string;
|
|
91
|
+
registry: string;
|
|
92
|
+
wallets?: WalletStore | undefined;
|
|
93
|
+
secrets: SecretStore;
|
|
94
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
95
|
+
fetchImpl: typeof fetch;
|
|
96
|
+
config: VapiConfig;
|
|
97
|
+
routerClientUsage?: typeof routerUsage | undefined;
|
|
98
|
+
};
|
|
99
|
+
type StatusToolResult = {
|
|
100
|
+
structuredContent: Record<string, unknown>;
|
|
101
|
+
content: Array<{
|
|
102
|
+
type: "text";
|
|
103
|
+
text: string;
|
|
104
|
+
}>;
|
|
105
|
+
} | {
|
|
106
|
+
isError: true;
|
|
107
|
+
content: Array<{
|
|
108
|
+
type: "text";
|
|
109
|
+
text: string;
|
|
110
|
+
}>;
|
|
111
|
+
};
|
|
112
|
+
export declare function createStatusTools(options: StatusToolsOptions): {
|
|
113
|
+
status(input: Record<string, never>): Promise<StatusToolResult>;
|
|
114
|
+
accounts(input: Record<string, never>): Promise<StatusToolResult>;
|
|
115
|
+
};
|
|
116
|
+
export {};
|
package/dist/wallet-session.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type SecretStore, type SpendCaps, type VapiPaymentAccount, type WalletName, type WalletStore } from "@vapi-network/core";
|
|
2
2
|
import type { WalletAddresses } from "./tools/wallet.js";
|
|
3
|
-
/** The
|
|
3
|
+
/** The account one tool call acts on. `path` is absent on a single-account home. */
|
|
4
4
|
export type SessionWallet = {
|
|
5
5
|
name: WalletName;
|
|
6
|
-
/** The keystore
|
|
6
|
+
/** The legacy keystore path, when this machine has an account store. */
|
|
7
7
|
path?: string;
|
|
8
8
|
};
|
|
9
9
|
/** One row of `wallet.list`, before balances are read. */
|
|
@@ -13,24 +13,22 @@ export type SessionWalletInfo = {
|
|
|
13
13
|
solanaAddress?: string;
|
|
14
14
|
label?: string;
|
|
15
15
|
isDefault: boolean;
|
|
16
|
-
/** Whether this is the
|
|
16
|
+
/** Whether this is the account the session currently pays from. */
|
|
17
17
|
isActive: boolean;
|
|
18
18
|
spendCaps?: SpendCaps;
|
|
19
19
|
};
|
|
20
20
|
export type WalletSessionOptions = {
|
|
21
|
-
/** The
|
|
21
|
+
/** The account opened before stdio was connected, for a store-less home. */
|
|
22
22
|
account: VapiPaymentAccount;
|
|
23
|
-
/** The
|
|
23
|
+
/** The accounts on this machine. Without it the session has exactly one. */
|
|
24
24
|
store?: WalletStore | undefined;
|
|
25
25
|
/** The name the session starts on, before `VAPI_WALLET` and the default. */
|
|
26
26
|
wallet?: string | undefined;
|
|
27
27
|
env?: NodeJS.ProcessEnv | undefined;
|
|
28
28
|
/**
|
|
29
|
-
* The passphrase a
|
|
30
|
-
* `VAPI_KEYSTORE_PASSWORD` nor the OS secret store has one.
|
|
31
|
-
* over what it read at startup
|
|
32
|
-
* terminal — so switching wallets never needs a prompt on a stdout that
|
|
33
|
-
* belongs to MCP frames.
|
|
29
|
+
* The passphrase for a legacy 0.5 keystore that has not been migrated yet,
|
|
30
|
+
* used when neither `VAPI_KEYSTORE_PASSWORD` nor the OS secret store has one.
|
|
31
|
+
* The CLI hands over what it read at startup, so MCP stdout is never prompted.
|
|
34
32
|
*/
|
|
35
33
|
passphrase?: (() => string | Promise<string>) | undefined;
|
|
36
34
|
/** The OS secret store to read `vapi unlock` entries from. */
|
|
@@ -38,49 +36,47 @@ export type WalletSessionOptions = {
|
|
|
38
36
|
now?: (() => Date) | undefined;
|
|
39
37
|
};
|
|
40
38
|
/**
|
|
41
|
-
* Which
|
|
39
|
+
* Which account an MCP session pays from, for the lifetime of the process.
|
|
42
40
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* passphrase at all, because the wallet store can read a keystore's addresses
|
|
48
|
-
* without opening it. Only a payment unlocks a key, once, for that one call.
|
|
41
|
+
* `wallet.use` is memory-only. The account tools may derive an account or lower
|
|
42
|
+
* its caps in `wallets.json`, but this package never renames, removes, backs up
|
|
43
|
+
* or exports one. Reads — addresses, balances, network accounts, funding links
|
|
44
|
+
* — need no passphrase or opened vault. Only signing operations open a signer.
|
|
49
45
|
*/
|
|
50
46
|
export declare class WalletSession {
|
|
51
47
|
#private;
|
|
52
48
|
private readonly options;
|
|
53
49
|
constructor(options: WalletSessionOptions);
|
|
54
|
-
/** The
|
|
50
|
+
/** The account the next tool call uses when it names none. */
|
|
55
51
|
get activeName(): WalletName | undefined;
|
|
56
52
|
get store(): WalletStore | undefined;
|
|
57
53
|
/** The home the audit log lives in, honouring `VAPI_HOME`. */
|
|
58
54
|
get home(): string;
|
|
59
55
|
/**
|
|
60
|
-
* An explicit name first, then the session's active
|
|
56
|
+
* An explicit name first, then the session's active account — which already
|
|
61
57
|
* absorbed `VAPI_WALLET` and the registry default when the session started.
|
|
62
58
|
*/
|
|
63
59
|
resolve(name?: string): SessionWallet;
|
|
64
|
-
/** The addresses of
|
|
60
|
+
/** The addresses of an account, read from the vault or a legacy keystore header. */
|
|
65
61
|
addressesFor(name?: string): Promise<{
|
|
66
62
|
wallet: SessionWallet;
|
|
67
63
|
} & WalletAddresses>;
|
|
68
64
|
/**
|
|
69
|
-
* The
|
|
65
|
+
* The signer for one payment, plus the caps of that account. Nothing
|
|
70
66
|
* here is cached: the account is created for this call and dropped with it,
|
|
71
|
-
* so switching
|
|
67
|
+
* so switching accounts mid-session pays from the account that was asked for.
|
|
72
68
|
*/
|
|
73
69
|
payment(name?: string): Promise<{
|
|
74
70
|
wallet: SessionWallet;
|
|
75
71
|
account: VapiPaymentAccount;
|
|
76
72
|
spendCaps?: SpendCaps;
|
|
77
73
|
}>;
|
|
78
|
-
/** Every
|
|
74
|
+
/** Every account this machine knows, with the session's own marker on one. */
|
|
79
75
|
list(): Promise<SessionWalletInfo[]>;
|
|
80
76
|
/**
|
|
81
|
-
* Points the session at another
|
|
77
|
+
* Points the session at another account. Memory only: the human's default in
|
|
82
78
|
* `wallets.json` is not touched, so the next `vapi` command in their terminal
|
|
83
|
-
* still uses the
|
|
79
|
+
* still uses the account they chose. The switch is audited, because the account
|
|
84
80
|
* an agent pays from changed.
|
|
85
81
|
*/
|
|
86
82
|
use(name: string): Promise<{
|