@aifinpay/mcp 1.5.3 → 2.0.0-rc.12
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 +116 -69
- package/bin/aifinpay-mcp.js +119 -49
- package/dist/api.d.ts +2 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +6 -0
- package/dist/api.js.map +1 -0
- package/dist/config.d.ts +35 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +63 -0
- package/dist/config.js.map +1 -1
- package/dist/identity.d.ts +9 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +75 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -6
- package/dist/index.js.map +1 -1
- package/dist/safe-fetch.d.ts +2 -0
- package/dist/safe-fetch.d.ts.map +1 -1
- package/dist/safe-fetch.js +76 -17
- package/dist/safe-fetch.js.map +1 -1
- package/dist/server.d.ts +11 -8
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +106 -102
- package/dist/server.js.map +1 -1
- package/dist/tools/agent-address.d.ts.map +1 -1
- package/dist/tools/agent-address.js +6 -27
- package/dist/tools/agent-address.js.map +1 -1
- package/dist/tools/{payable-fetch.d.ts → agent-history.d.ts} +21 -23
- package/dist/tools/agent-history.d.ts.map +1 -0
- package/dist/tools/agent-history.js +73 -0
- package/dist/tools/agent-history.js.map +1 -0
- package/dist/tools/{agent-quote.d.ts → agent-quota.d.ts} +7 -8
- package/dist/tools/agent-quota.d.ts.map +1 -0
- package/dist/tools/agent-quota.js +95 -0
- package/dist/tools/agent-quota.js.map +1 -0
- package/dist/tools/dev-payment-quote.d.ts +39 -0
- package/dist/tools/dev-payment-quote.d.ts.map +1 -0
- package/dist/tools/dev-payment-quote.js +52 -0
- package/dist/tools/dev-payment-quote.js.map +1 -0
- package/dist/tools/{pay-with-split.d.ts → production-control.d.ts} +49 -34
- package/dist/tools/production-control.d.ts.map +1 -0
- package/dist/tools/production-control.js +132 -0
- package/dist/tools/production-control.js.map +1 -0
- package/package.json +7 -21
- package/skills/SKILL.md +143 -0
- package/dist/directory.d.ts +0 -55
- package/dist/directory.d.ts.map +0 -1
- package/dist/directory.js +0 -56
- package/dist/directory.js.map +0 -1
- package/dist/tools/agent-call.d.ts +0 -68
- package/dist/tools/agent-call.d.ts.map +0 -1
- package/dist/tools/agent-call.js +0 -129
- package/dist/tools/agent-call.js.map +0 -1
- package/dist/tools/agent-claim-self.d.ts +0 -66
- package/dist/tools/agent-claim-self.d.ts.map +0 -1
- package/dist/tools/agent-claim-self.js +0 -299
- package/dist/tools/agent-claim-self.js.map +0 -1
- package/dist/tools/agent-quote.d.ts.map +0 -1
- package/dist/tools/agent-quote.js +0 -81
- package/dist/tools/agent-quote.js.map +0 -1
- package/dist/tools/pay-with-split.d.ts.map +0 -1
- package/dist/tools/pay-with-split.js +0 -138
- package/dist/tools/pay-with-split.js.map +0 -1
- package/dist/tools/payable-fetch.d.ts.map +0 -1
- package/dist/tools/payable-fetch.js +0 -135
- package/dist/tools/payable-fetch.js.map +0 -1
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
import type { ToolContext } from "../server.js";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function agentPassportResolveTool(): {
|
|
3
3
|
name: string;
|
|
4
4
|
description: string;
|
|
5
5
|
inputSchema: {
|
|
6
6
|
type: string;
|
|
7
7
|
properties: {
|
|
8
|
-
|
|
9
|
-
type: string;
|
|
10
|
-
enum: string[];
|
|
11
|
-
description: string;
|
|
12
|
-
};
|
|
13
|
-
merchant_wallet: {
|
|
14
|
-
type: string;
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
merchant_amount: {
|
|
18
|
-
type: string;
|
|
19
|
-
description: string;
|
|
20
|
-
};
|
|
21
|
-
order_id: {
|
|
22
|
-
type: string;
|
|
23
|
-
description: string;
|
|
24
|
-
};
|
|
25
|
-
fee_recipient: {
|
|
8
|
+
identifier: {
|
|
26
9
|
type: string;
|
|
27
10
|
description: string;
|
|
28
11
|
};
|
|
@@ -38,30 +21,69 @@ export declare function payWithSplitTool(): {
|
|
|
38
21
|
type: string;
|
|
39
22
|
};
|
|
40
23
|
};
|
|
41
|
-
export declare function
|
|
42
|
-
isError: boolean;
|
|
24
|
+
export declare function runAgentPassportResolve(ctx: ToolContext, args: Record<string, unknown>): Promise<{
|
|
43
25
|
content: {
|
|
44
26
|
type: string;
|
|
45
27
|
text: string;
|
|
46
28
|
}[];
|
|
47
|
-
}
|
|
29
|
+
}>;
|
|
30
|
+
export declare function settlementRoutesTool(): {
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: string;
|
|
35
|
+
properties: {
|
|
36
|
+
route_class: {
|
|
37
|
+
type: string;
|
|
38
|
+
enum: string[];
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
annotations: {
|
|
43
|
+
readOnlyHint: boolean;
|
|
44
|
+
openWorldHint: boolean;
|
|
45
|
+
destructiveHint: boolean;
|
|
46
|
+
};
|
|
47
|
+
outputSchema: {
|
|
48
|
+
type: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export declare function runSettlementRoutes(ctx: ToolContext, args: Record<string, unknown>): Promise<{
|
|
48
52
|
content: {
|
|
49
53
|
type: string;
|
|
50
54
|
text: string;
|
|
51
55
|
}[];
|
|
52
|
-
structuredContent: Record<string, unknown>;
|
|
53
56
|
}>;
|
|
54
|
-
export declare function
|
|
57
|
+
export declare function settlementInvoiceTool(): {
|
|
55
58
|
name: string;
|
|
56
59
|
description: string;
|
|
57
60
|
inputSchema: {
|
|
58
61
|
type: string;
|
|
59
62
|
properties: {
|
|
63
|
+
route_class: {
|
|
64
|
+
type: string;
|
|
65
|
+
enum: string[];
|
|
66
|
+
};
|
|
60
67
|
chain: {
|
|
61
68
|
type: string;
|
|
62
69
|
enum: string[];
|
|
63
70
|
};
|
|
64
|
-
|
|
71
|
+
asset: {
|
|
72
|
+
type: string;
|
|
73
|
+
description: string;
|
|
74
|
+
};
|
|
75
|
+
gross_amount: {
|
|
76
|
+
type: string;
|
|
77
|
+
description: string;
|
|
78
|
+
};
|
|
79
|
+
merchant_wallet: {
|
|
80
|
+
type: string;
|
|
81
|
+
description: string;
|
|
82
|
+
};
|
|
83
|
+
order_id: {
|
|
84
|
+
type: string;
|
|
85
|
+
};
|
|
86
|
+
valid_until: {
|
|
65
87
|
type: string;
|
|
66
88
|
description: string;
|
|
67
89
|
};
|
|
@@ -77,17 +99,10 @@ export declare function quoteSplitTool(): {
|
|
|
77
99
|
type: string;
|
|
78
100
|
};
|
|
79
101
|
};
|
|
80
|
-
export declare function
|
|
81
|
-
isError: boolean;
|
|
82
|
-
content: {
|
|
83
|
-
type: string;
|
|
84
|
-
text: string;
|
|
85
|
-
}[];
|
|
86
|
-
} | {
|
|
102
|
+
export declare function runSettlementInvoice(ctx: ToolContext, args: Record<string, unknown>): Promise<{
|
|
87
103
|
content: {
|
|
88
104
|
type: string;
|
|
89
105
|
text: string;
|
|
90
106
|
}[];
|
|
91
|
-
structuredContent: Record<string, unknown>;
|
|
92
107
|
}>;
|
|
93
|
-
//# sourceMappingURL=
|
|
108
|
+
//# sourceMappingURL=production-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"production-control.d.ts","sourceRoot":"","sources":["../../src/tools/production-control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA+BhD,wBAAgB,wBAAwB;;;;;;;;;;;;;;;;;;;;;EAgBvC;AAED,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;GAS5F;AAED,wBAAgB,oBAAoB;;;;;;;;;;;;;;;;;;;;EAgBnC;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;GAQxF;AAED,wBAAgB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBpC;AAED,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;GAuBzF"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { apiUrl } from "../api.js";
|
|
2
|
+
const DEFAULT_BASE = "https://aifinpay.io";
|
|
3
|
+
const ROUTES = new Set(["AIFP-1", "AIFP-2"]);
|
|
4
|
+
const CHAINS = new Set([
|
|
5
|
+
"polygon", "avalanche", "arbitrum", "bnb", "base",
|
|
6
|
+
"unichain", "optimism", "botchain", "xrplevm",
|
|
7
|
+
]);
|
|
8
|
+
function result(value) {
|
|
9
|
+
return { content: [{ type: "text", text: JSON.stringify(value, null, 2) }] };
|
|
10
|
+
}
|
|
11
|
+
function errorResult(message) {
|
|
12
|
+
return { isError: true, content: [{ type: "text", text: message }] };
|
|
13
|
+
}
|
|
14
|
+
function base(ctx) {
|
|
15
|
+
return String(ctx.config.baseUrl || DEFAULT_BASE).replace(/\/$/, "");
|
|
16
|
+
}
|
|
17
|
+
async function api(ctx, path, init) {
|
|
18
|
+
const response = await ctx.agent.inner.fetchImpl(apiUrl(base(ctx), path), init);
|
|
19
|
+
const body = await response.json().catch(() => null);
|
|
20
|
+
if (!response.ok) {
|
|
21
|
+
const detail = body && typeof body === "object"
|
|
22
|
+
? JSON.stringify(body)
|
|
23
|
+
: `HTTP ${response.status}`;
|
|
24
|
+
throw new Error(detail);
|
|
25
|
+
}
|
|
26
|
+
return body;
|
|
27
|
+
}
|
|
28
|
+
export function agentPassportResolveTool() {
|
|
29
|
+
return {
|
|
30
|
+
name: "agent_passport_resolve",
|
|
31
|
+
description: "Resolve an AiFinPay Agent Passport by @username, permanent AIFP number, or immutable agent id. " +
|
|
32
|
+
"Returns verified public wallet bindings only. Resolution never authorizes a payment.",
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: "object",
|
|
35
|
+
properties: {
|
|
36
|
+
identifier: { type: "string", description: "@username, AIFP-#########, or aifp_agent_* id" },
|
|
37
|
+
},
|
|
38
|
+
required: ["identifier"],
|
|
39
|
+
},
|
|
40
|
+
annotations: { readOnlyHint: true, openWorldHint: false, destructiveHint: false },
|
|
41
|
+
outputSchema: { type: "object" },
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export async function runAgentPassportResolve(ctx, args) {
|
|
45
|
+
const identifier = String(args.identifier || "").trim();
|
|
46
|
+
if (!identifier)
|
|
47
|
+
return errorResult("missing required arg: identifier");
|
|
48
|
+
try {
|
|
49
|
+
const body = await api(ctx, `/api/agent/resolve/${encodeURIComponent(identifier)}`);
|
|
50
|
+
return result(body);
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
return errorResult(`Agent Passport resolve failed: ${e.message}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function settlementRoutesTool() {
|
|
57
|
+
return {
|
|
58
|
+
name: "settlement_routes",
|
|
59
|
+
description: "Read AiFinPay's currently runtime-verified v1.3 settlement routes. " +
|
|
60
|
+
"AIFP-1 is merchant monetisation (99% merchant / 1% AiFinPay / 0% creator). " +
|
|
61
|
+
"AIFP-2/x402 is 100% provider / 0% AiFinPay / 0% creator.",
|
|
62
|
+
inputSchema: {
|
|
63
|
+
type: "object",
|
|
64
|
+
properties: {
|
|
65
|
+
route_class: { type: "string", enum: ["AIFP-1", "AIFP-2"] },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
annotations: { readOnlyHint: true, openWorldHint: false, destructiveHint: false },
|
|
69
|
+
outputSchema: { type: "object" },
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export async function runSettlementRoutes(ctx, args) {
|
|
73
|
+
const route = args.route_class == null ? "" : String(args.route_class).toUpperCase();
|
|
74
|
+
if (route && !ROUTES.has(route))
|
|
75
|
+
return errorResult("route_class must be AIFP-1 or AIFP-2");
|
|
76
|
+
try {
|
|
77
|
+
return result(await api(ctx, `/v1/settlement/routes${route ? `?route_class=${encodeURIComponent(route)}` : ""}`));
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
return errorResult(`Settlement route lookup failed: ${e.message}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export function settlementInvoiceTool() {
|
|
84
|
+
return {
|
|
85
|
+
name: "settlement_invoice",
|
|
86
|
+
description: "Build and validate a NON-SIGNING v1.3 settlement invoice. This tool never moves funds. " +
|
|
87
|
+
"Use the published @aifinpay/agent v2 settlement executor to verify bytecode/profile and sign it.",
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: "object",
|
|
90
|
+
properties: {
|
|
91
|
+
route_class: { type: "string", enum: ["AIFP-1", "AIFP-2"] },
|
|
92
|
+
chain: { type: "string", enum: [...CHAINS] },
|
|
93
|
+
asset: { type: "string", description: "Native symbol, USDC, or USDT if the route advertises it." },
|
|
94
|
+
gross_amount: { type: "string", description: "Gross payer amount in base units." },
|
|
95
|
+
merchant_wallet: { type: "string", description: "Merchant/provider EVM wallet." },
|
|
96
|
+
order_id: { type: "string" },
|
|
97
|
+
valid_until: { type: "integer", description: "Optional Unix seconds, max 20 minutes ahead." },
|
|
98
|
+
},
|
|
99
|
+
required: ["route_class", "chain", "asset", "gross_amount", "merchant_wallet", "order_id"],
|
|
100
|
+
},
|
|
101
|
+
annotations: { readOnlyHint: true, openWorldHint: false, destructiveHint: false },
|
|
102
|
+
outputSchema: { type: "object" },
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export async function runSettlementInvoice(ctx, args) {
|
|
106
|
+
const route = String(args.route_class || "").toUpperCase();
|
|
107
|
+
const chain = String(args.chain || "").toLowerCase();
|
|
108
|
+
if (!ROUTES.has(route))
|
|
109
|
+
return errorResult("route_class must be AIFP-1 or AIFP-2");
|
|
110
|
+
if (!CHAINS.has(chain))
|
|
111
|
+
return errorResult("unsupported EVM settlement chain");
|
|
112
|
+
try {
|
|
113
|
+
const payload = {
|
|
114
|
+
route_class: route,
|
|
115
|
+
chain,
|
|
116
|
+
asset: String(args.asset || "").toUpperCase(),
|
|
117
|
+
gross_amount: String(args.gross_amount || ""),
|
|
118
|
+
merchant_wallet: String(args.merchant_wallet || ""),
|
|
119
|
+
order_id: String(args.order_id || ""),
|
|
120
|
+
...(args.valid_until != null ? { valid_until: Number(args.valid_until) } : {}),
|
|
121
|
+
};
|
|
122
|
+
return result(await api(ctx, "/v1/settlement/invoice", {
|
|
123
|
+
method: "POST",
|
|
124
|
+
headers: { "content-type": "application/json" },
|
|
125
|
+
body: JSON.stringify(payload),
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
catch (e) {
|
|
129
|
+
return errorResult(`Settlement invoice failed: ${e.message}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=production-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"production-control.js","sourceRoot":"","sources":["../../src/tools/production-control.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAC3C,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC7C,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC;IACrB,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM;IACjD,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS;CAC9C,CAAC,CAAC;AAEH,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI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nD,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;YACrC,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC/E,CAAC;QACF,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,wBAAwB,EAAE;YACrD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;SAC9B,CAAC,CAAC,CAAC;IACN,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,WAAW,CAAC,8BAA+B,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aifinpay/mcp",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.0-rc.12",
|
|
4
|
+
"description": "AiFinPay MCP production-RC control surface for Agent Passport resolution and runtime-verified AIFP-1/AIFP-2 settlement invoices. Signing tools remain gated until @aifinpay/agent v2 release.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"dist",
|
|
19
19
|
"bin",
|
|
20
20
|
"README.md",
|
|
21
|
-
"LICENSE"
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"skills"
|
|
22
23
|
],
|
|
23
24
|
"scripts": {
|
|
24
25
|
"build": "tsc -p tsconfig.json",
|
|
@@ -32,10 +33,9 @@
|
|
|
32
33
|
"mcp-server",
|
|
33
34
|
"mcp-payments",
|
|
34
35
|
"mcp-monetization",
|
|
35
|
-
"
|
|
36
|
+
"agent-passport",
|
|
37
|
+
"settlement",
|
|
36
38
|
"x402-mcp",
|
|
37
|
-
"pay-per-call",
|
|
38
|
-
"paid-ai-tools",
|
|
39
39
|
"claude-desktop",
|
|
40
40
|
"claude-mcp",
|
|
41
41
|
"cursor",
|
|
@@ -46,29 +46,15 @@
|
|
|
46
46
|
"ai-agent-payments",
|
|
47
47
|
"agentic-ai",
|
|
48
48
|
"autonomous-agents",
|
|
49
|
-
"autonomous-payments",
|
|
50
49
|
"agent-payments",
|
|
51
50
|
"agent-commerce",
|
|
52
51
|
"agentic-commerce",
|
|
53
52
|
"agent-economy",
|
|
54
53
|
"ai-commerce",
|
|
55
|
-
"ai-payment-infrastructure",
|
|
56
|
-
"ai-financial-infrastructure",
|
|
57
54
|
"x402",
|
|
58
55
|
"x402-payments",
|
|
59
56
|
"http-402",
|
|
60
|
-
"
|
|
61
|
-
"api-payments",
|
|
62
|
-
"api-monetization",
|
|
63
|
-
"machine-payments",
|
|
64
|
-
"m2m-payments",
|
|
65
|
-
"programmable-payments",
|
|
66
|
-
"crypto-payments",
|
|
67
|
-
"stablecoin-payments",
|
|
68
|
-
"polygon",
|
|
69
|
-
"solana",
|
|
70
|
-
"non-custodial",
|
|
71
|
-
"stripe-for-ai-agents"
|
|
57
|
+
"non-custodial"
|
|
72
58
|
],
|
|
73
59
|
"author": "CoinSecurities (SECCO) <contact@aifinpay.io>",
|
|
74
60
|
"license": "MIT",
|
package/skills/SKILL.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: aifinpay
|
|
3
|
+
description: Discover an agent wallet, retrieve payment history and prepaid quotas, resolve public Agent Passport identities, and inspect dev payment quotes through AiFinPay MCP/SDK.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
The current source and compatible package line is **2.0.0-rc.12**. Until that
|
|
8
|
+
RC is published, use the checked-out source build or an explicitly pinned
|
|
9
|
+
compatible package; never install `latest` for a payment test. The production
|
|
10
|
+
RC tool inventory below is read-only; do not claim MCP signing or AIFP-2
|
|
11
|
+
settlement is active.
|
|
12
|
+
|
|
13
|
+
# AiFinPay agent workflow
|
|
14
|
+
|
|
15
|
+
Use the tools actually returned by MCP tools/list. This RC exposes
|
|
16
|
+
agent_address, agent_reload, agent_history, agent_quota,
|
|
17
|
+
agent_passport_resolve, settlement_routes and settlement_invoice.
|
|
18
|
+
With AIFINPAY_MODE=dev it also exposes dev_payment_quote.
|
|
19
|
+
It does not register payable_fetch, agent_call or other payment-signing tools.
|
|
20
|
+
Never tell a user a payment was sent because a quote or invoice was created.
|
|
21
|
+
|
|
22
|
+
## Wallet source priority
|
|
23
|
+
|
|
24
|
+
The local server selects one identity in this order:
|
|
25
|
+
|
|
26
|
+
1. SEED_HASH environment variable: 32-byte hex seed, 64 hex characters,
|
|
27
|
+
optionally prefixed with 0x. Passed directly to AiFinPayAgent.fromSeed;
|
|
28
|
+
no second hash, no mnemonic conversion.
|
|
29
|
+
2. ./aifinpay/agents.json relative to the MCP process working directory.
|
|
30
|
+
AIFINPAY_AGENTS_FILE may name an explicit absolute path.
|
|
31
|
+
3. Legacy AIFINPAY_AGENT_SECRET base58 secret.
|
|
32
|
+
4. Legacy ~/.aifinpay/agent.json (or AIFINPAY_HOME/agent.json).
|
|
33
|
+
|
|
34
|
+
The project-file schema is:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{"agents":[{"id":"research-agent","seed_hash":"REDACTED"}]}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
REDACTED is a placeholder, not a usable seed. With more than one record,
|
|
41
|
+
AIFINPAY_AGENT_ID must select exactly one id. Invalid configured sources stop
|
|
42
|
+
loading; they never silently generate a new wallet or fall back to another.
|
|
43
|
+
Keep secret files private (mode 600), outside Git and outside chat. Never ask
|
|
44
|
+
for a real seed, print it, or send it to the backend. Use agent_address to
|
|
45
|
+
confirm the public wallet selected. With no configured identity the server
|
|
46
|
+
uses an ephemeral wallet: do not fund it.
|
|
47
|
+
|
|
48
|
+
## Init and reconnect
|
|
49
|
+
|
|
50
|
+
For a funded crawler or balance check, load the existing persistent identity
|
|
51
|
+
first through the configured MCP identity sources or
|
|
52
|
+
`AiFinPayAgent.fromEnvironment()`. If none exists, stop and ask the operator
|
|
53
|
+
to configure one; never call `Agent.new()` to create a wallet that will be
|
|
54
|
+
funded. `npx @aifinpay/mcp@2.0.0-rc.12 init` creates the legacy keystore only when no
|
|
55
|
+
configured wallet exists. It preserves existing wallets. After init or a local
|
|
56
|
+
wallet-file update, call agent_reload in the existing MCP connection, then agent_address.
|
|
57
|
+
The reload returns only public addresses and preserves the old identity if
|
|
58
|
+
loading fails. This server does not require a new conversation.
|
|
59
|
+
|
|
60
|
+
On an interactive TTY, init may print a one-time private-key recovery line for
|
|
61
|
+
the operator to back up offline. Automated agents must never request, capture,
|
|
62
|
+
log or repeat that line; non-interactive runs suppress it.
|
|
63
|
+
|
|
64
|
+
Installing a new package or changing launch environment variables requires the
|
|
65
|
+
MCP host to launch/reconnect the server process. Shell exports cannot change an
|
|
66
|
+
already running process. Whether the host can reconnect in the same UI session
|
|
67
|
+
is client-specific; do not universally prescribe restarting the whole chat.
|
|
68
|
+
|
|
69
|
+
## Payment history is required before reporting spend
|
|
70
|
+
|
|
71
|
+
Use agent_history. Do not guess /v1/history, /v1/payments or /v1/wallet/tx.
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{"address":"0x…","source":"transactions","limit":25,"offset":0}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{"passport":"AIFP-000000042","source":"receipts","network":"polygon"}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
An omitted address/passport uses the current wallet. With both inputs, the
|
|
82
|
+
address must match the passport's verified wallet on the requested network.
|
|
83
|
+
Passport accepts a public @username, AIFP number or aifp_agent_* id; a secret
|
|
84
|
+
API key or holder private key is not a passport identifier. The backend
|
|
85
|
+
resolver must be deployed. A 404/403/503 is unavailable history, not proof
|
|
86
|
+
that the agent made no payments.
|
|
87
|
+
|
|
88
|
+
Routes:
|
|
89
|
+
|
|
90
|
+
- GET /v1/agents/:address/transactions?chain=polygon&limit=25&offset=0:
|
|
91
|
+
public facts from indexed AiFinPay Polygon settlements in the durable
|
|
92
|
+
ledger. Excludes arbitrary wallet transfers and may lag the chain.
|
|
93
|
+
- GET /v1/agents/:address/receipts?limit=25&offset=0: retained prepaid-batch
|
|
94
|
+
metadata, including test payments. Never includes the spendable receipt JWT.
|
|
95
|
+
- GET /v1/agents/:address/statement?days=7: retained billing statement.
|
|
96
|
+
- GET /api/agent/resolve/:identifier: public verified passport wallet bindings,
|
|
97
|
+
only on backends with the Agent Passport service installed.
|
|
98
|
+
|
|
99
|
+
On https://api.aifinpay.io the resolver path is /agent/resolve/:identifier
|
|
100
|
+
because ingress adds /api. Keep /v1 paths unchanged. On the main host or a
|
|
101
|
+
normal dev backend, the resolver includes /api.
|
|
102
|
+
|
|
103
|
+
Amounts from the ledger are integer strings in token base units. Do not turn
|
|
104
|
+
uint256 amounts into JavaScript numbers. Use next_offset for the next page.
|
|
105
|
+
Receipt history is retained metadata, not a full blockchain explorer. External
|
|
106
|
+
merchants may meter quotas locally; AiFinPay's remaining count can lag.
|
|
107
|
+
|
|
108
|
+
Node SDK: getAgentHistory({address, passport, source, network, limit, offset,
|
|
109
|
+
baseUrl}) uses the same route flow. Retrieve a paid bearer receipt separately
|
|
110
|
+
with the signed recovery API; never put it in a public history report.
|
|
111
|
+
|
|
112
|
+
After a settlement error, retain the original quote, transaction reference and
|
|
113
|
+
idempotency context and use the recovery path before another attempt. A new
|
|
114
|
+
quote or a new `fetchPaid` call may charge again; this RC has no payment
|
|
115
|
+
executor. `dev.ratersapp.com` is only a hostname, not proof of testnet or dev
|
|
116
|
+
settlement. Validate the 402 challenge and quote's `network_mode`, chain and
|
|
117
|
+
deployed contract before any approved executor could settle.
|
|
118
|
+
|
|
119
|
+
## Dev paid-content inspection
|
|
120
|
+
|
|
121
|
+
Configure AIFINPAY_MODE=dev and a separate AIFINPAY_BASE_URL. The backend must
|
|
122
|
+
have AIFP_DEV_MODE=true and AIFP_DEV_MERCHANT_ID pointing to an existing test
|
|
123
|
+
merchant. GET /v1/dev/paid/data then uses the real receipt gate. Live merchants
|
|
124
|
+
are rejected; a missing config cannot enable free access.
|
|
125
|
+
|
|
126
|
+
Call dev_payment_quote({contract_version:"1.2" or "1.4", units:1000}). It reads
|
|
127
|
+
the 402 and requests a batch quote. The quote must name only Amoy, test mode,
|
|
128
|
+
the same merchant/resource and the requested deployed contract version.
|
|
129
|
+
Changing a requested version does not redeploy a contract or relabel its ABI;
|
|
130
|
+
a mismatch stops the flow. The operator must configure the corresponding
|
|
131
|
+
verified SPLITTER_ADDRESS_AMOY deployment first. Minimum-unit and cap errors
|
|
132
|
+
stop the request; do not lower units below the server minimum, edit quote
|
|
133
|
+
responses, or invent manual nonces, receipts or transactions.
|
|
134
|
+
|
|
135
|
+
This tool never broadcasts. Current MCP has no settlement executor; SDK
|
|
136
|
+
fetchPaid remains gated and is not a general Amoy 1.2/1.4 executor. Finish
|
|
137
|
+
that executor's deployment verification and paid testnet E2E before claiming
|
|
138
|
+
the full dev payment loop works. A prepaid batch means one settlement funding
|
|
139
|
+
multiple API calls, not an arbitrary batch of on-chain transfers.
|
|
140
|
+
|
|
141
|
+
After any actual settlement, retain its quote and transaction reference.
|
|
142
|
+
Retry receipt issuance on temporary errors without paying again. Inspect
|
|
143
|
+
agent_history(source:"receipts") and agent_quota to report the result.
|
package/dist/directory.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* createDirectoryServer — the READ-ONLY MCP server submitted to the OpenAI
|
|
3
|
-
* ChatGPT App Directory. Distinct from `createServer` (the full BYO-MCP
|
|
4
|
-
* connector with payment execution): this one exposes ONLY the read-only
|
|
5
|
-
* directory tools, requires NO agent identity and NO auth, and never moves
|
|
6
|
-
* money — so it is reviewable under OpenAI's directory policy (Obsidian/32 /34).
|
|
7
|
-
*
|
|
8
|
-
* One codebase, two profiles: the HTTP wrapper picks this when
|
|
9
|
-
* AIFINPAY_MCP_PROFILE=directory.
|
|
10
|
-
*/
|
|
11
|
-
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
12
|
-
export interface DirectoryServerConfig {
|
|
13
|
-
/** Public API base for the wrapped GET endpoints. Defaults to production. */
|
|
14
|
-
apiBase?: string;
|
|
15
|
-
/** Per-request timeout (ms). */
|
|
16
|
-
timeoutMs?: number;
|
|
17
|
-
log?: (level: "info" | "warn" | "error", msg: string) => void;
|
|
18
|
-
}
|
|
19
|
-
export declare function createDirectoryServer(config?: DirectoryServerConfig): Promise<{
|
|
20
|
-
server: Server<{
|
|
21
|
-
method: string;
|
|
22
|
-
params?: {
|
|
23
|
-
[x: string]: unknown;
|
|
24
|
-
_meta?: {
|
|
25
|
-
[x: string]: unknown;
|
|
26
|
-
progressToken?: string | number | undefined;
|
|
27
|
-
"io.modelcontextprotocol/related-task"?: {
|
|
28
|
-
taskId: string;
|
|
29
|
-
} | undefined;
|
|
30
|
-
} | undefined;
|
|
31
|
-
} | undefined;
|
|
32
|
-
}, {
|
|
33
|
-
method: string;
|
|
34
|
-
params?: {
|
|
35
|
-
[x: string]: unknown;
|
|
36
|
-
_meta?: {
|
|
37
|
-
[x: string]: unknown;
|
|
38
|
-
progressToken?: string | number | undefined;
|
|
39
|
-
"io.modelcontextprotocol/related-task"?: {
|
|
40
|
-
taskId: string;
|
|
41
|
-
} | undefined;
|
|
42
|
-
} | undefined;
|
|
43
|
-
} | undefined;
|
|
44
|
-
}, {
|
|
45
|
-
[x: string]: unknown;
|
|
46
|
-
_meta?: {
|
|
47
|
-
[x: string]: unknown;
|
|
48
|
-
progressToken?: string | number | undefined;
|
|
49
|
-
"io.modelcontextprotocol/related-task"?: {
|
|
50
|
-
taskId: string;
|
|
51
|
-
} | undefined;
|
|
52
|
-
} | undefined;
|
|
53
|
-
}>;
|
|
54
|
-
}>;
|
|
55
|
-
//# sourceMappingURL=directory.d.ts.map
|
package/dist/directory.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAYnE,MAAM,WAAW,qBAAqB;IACpC,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D;AAwBD,wBAAsB,qBAAqB,CAAC,MAAM,GAAE,qBAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2B7E"}
|
package/dist/directory.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* createDirectoryServer — the READ-ONLY MCP server submitted to the OpenAI
|
|
3
|
-
* ChatGPT App Directory. Distinct from `createServer` (the full BYO-MCP
|
|
4
|
-
* connector with payment execution): this one exposes ONLY the read-only
|
|
5
|
-
* directory tools, requires NO agent identity and NO auth, and never moves
|
|
6
|
-
* money — so it is reviewable under OpenAI's directory policy (Obsidian/32 /34).
|
|
7
|
-
*
|
|
8
|
-
* One codebase, two profiles: the HTTP wrapper picks this when
|
|
9
|
-
* AIFINPAY_MCP_PROFILE=directory.
|
|
10
|
-
*/
|
|
11
|
-
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
12
|
-
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
13
|
-
import { directoryTools, runDirectoryTool, DIRECTORY_API_BASE, } from "./tools/directory.js";
|
|
14
|
-
// Server-wide instructions returned at initialize. ChatGPT/Codex use these as a
|
|
15
|
-
// cross-tool guide (OpenAI readiness checklist item; the audit found it ABSENT
|
|
16
|
-
// on the connector server). States the read-only contract, networks, and limits.
|
|
17
|
-
const DIRECTORY_INSTRUCTIONS = [
|
|
18
|
-
"AiFinPay is payment infrastructure for AI agents. THIS server is the",
|
|
19
|
-
"read-only directory surface: it answers questions about the AiFinPay agent",
|
|
20
|
-
"economy and prices AI services — it does NOT move money, hold funds, sign",
|
|
21
|
-
"transactions, or execute any payment. Every tool is read-only.",
|
|
22
|
-
"",
|
|
23
|
-
"Use it to: list available AI providers and their per-call prices",
|
|
24
|
-
"(list_providers / provider_info / provider_status / service_coverage),",
|
|
25
|
-
"preview a fee-on-top cost breakdown without paying (quote_cost), read public",
|
|
26
|
-
"protocol stats (network_stats) and the on-chain agent leaderboard",
|
|
27
|
-
"(leaderboard), verify an agent's AgentPassport (verify_passport), and look up",
|
|
28
|
-
"a public agent profile (agent_profile).",
|
|
29
|
-
"",
|
|
30
|
-
"Networks: Polygon and Solana mainnet. Data is public on-chain / registry",
|
|
31
|
-
"information. To actually execute a payment, an agent uses the separate",
|
|
32
|
-
"AiFinPay connector or SDK — not this directory app. Requests are rate limited;",
|
|
33
|
-
"on HTTP 429 (rate_limit_exceeded), back off and retry.",
|
|
34
|
-
].join("\n");
|
|
35
|
-
export async function createDirectoryServer(config = {}) {
|
|
36
|
-
const log = config.log ?? ((lvl, msg) => process.stderr.write(`[${lvl}] ${msg}\n`));
|
|
37
|
-
const ctx = {
|
|
38
|
-
apiBase: (config.apiBase || DIRECTORY_API_BASE).replace(/\/$/, ""),
|
|
39
|
-
timeoutMs: config.timeoutMs ?? 15000,
|
|
40
|
-
log,
|
|
41
|
-
};
|
|
42
|
-
const server = new Server({ name: "@aifinpay/mcp-directory", version: "1.0.0" }, {
|
|
43
|
-
capabilities: { tools: {} },
|
|
44
|
-
instructions: DIRECTORY_INSTRUCTIONS,
|
|
45
|
-
});
|
|
46
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
47
|
-
tools: directoryTools(),
|
|
48
|
-
}));
|
|
49
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
50
|
-
const { name, arguments: args } = request.params;
|
|
51
|
-
return runDirectoryTool(ctx, name, args ?? {});
|
|
52
|
-
});
|
|
53
|
-
log("info", `[aifinpay-mcp-directory] read-only profile · api=${ctx.apiBase}`);
|
|
54
|
-
return { server };
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=directory.js.map
|
package/dist/directory.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory.js","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,kBAAkB,GAEnB,MAAM,sBAAsB,CAAC;AAU9B,gFAAgF;AAChF,+EAA+E;AAC/E,iFAAiF;AACjF,MAAM,sBAAsB,GAAG;IAC7B,sEAAsE;IACtE,4EAA4E;IAC5E,2EAA2E;IAC3E,gEAAgE;IAChE,EAAE;IACF,kEAAkE;IAClE,wEAAwE;IACxE,8EAA8E;IAC9E,mEAAmE;IACnE,+EAA+E;IAC/E,yCAAyC;IACzC,EAAE;IACF,0EAA0E;IAC1E,wEAAwE;IACxE,gFAAgF;IAChF,wDAAwD;CACzD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,SAAgC,EAAE;IAC5E,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;IACpF,MAAM,GAAG,GAAqB;QAC5B,OAAO,EAAE,CAAC,MAAM,CAAC,OAAO,IAAI,kBAAkB,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;QAClE,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,KAAK;QACpC,GAAG;KACJ,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB,EAAE,IAAI,EAAE,yBAAyB,EAAE,OAAO,EAAE,OAAO,EAAE,EACrD;QACE,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QAC3B,YAAY,EAAE,sBAAsB;KACrC,CACF,CAAC;IAEF,MAAM,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QAC5D,KAAK,EAAE,cAAc,EAAE;KACxB,CAAC,CAAC,CAAC;IAEJ,MAAM,CAAC,iBAAiB,CAAC,qBAAqB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAChE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;QACjD,OAAO,gBAAgB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,MAAM,EAAE,oDAAoD,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/E,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { ToolContext } from "../server.js";
|
|
2
|
-
/**
|
|
3
|
-
* `agent_call` — unified registry-resolved paid HTTP call.
|
|
4
|
-
*
|
|
5
|
-
* The agent picks a provider by name ("exa", "io-net", "venice", …),
|
|
6
|
-
* the SDK looks up the bridge URL + price from the public AiFinPay
|
|
7
|
-
* registry, negotiates the 402 challenge, settles on Polygon via
|
|
8
|
-
* B2BSplitter.payMatic, retries with proof, and returns the upstream
|
|
9
|
-
* response body.
|
|
10
|
-
*
|
|
11
|
-
* Use this in preference to `payable_fetch` when you have a registered
|
|
12
|
-
* provider name — it auto-routes price, chain, and bridge URL.
|
|
13
|
-
*
|
|
14
|
-
* Requires the EVM address (from `agent_address`) to be funded with POL
|
|
15
|
-
* on Polygon mainnet (gas + payment), or USDC if the provider quotes in
|
|
16
|
-
* stablecoin.
|
|
17
|
-
*/
|
|
18
|
-
export declare function agentCallTool(): {
|
|
19
|
-
name: string;
|
|
20
|
-
description: string;
|
|
21
|
-
inputSchema: {
|
|
22
|
-
type: string;
|
|
23
|
-
properties: {
|
|
24
|
-
provider: {
|
|
25
|
-
type: string;
|
|
26
|
-
description: string;
|
|
27
|
-
};
|
|
28
|
-
body: {
|
|
29
|
-
type: string;
|
|
30
|
-
description: string;
|
|
31
|
-
additionalProperties: boolean;
|
|
32
|
-
};
|
|
33
|
-
method: {
|
|
34
|
-
type: string;
|
|
35
|
-
enum: string[];
|
|
36
|
-
default: string;
|
|
37
|
-
description: string;
|
|
38
|
-
};
|
|
39
|
-
cost: {
|
|
40
|
-
type: string;
|
|
41
|
-
description: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
required: string[];
|
|
45
|
-
};
|
|
46
|
-
annotations: {
|
|
47
|
-
readOnlyHint: boolean;
|
|
48
|
-
openWorldHint: boolean;
|
|
49
|
-
destructiveHint: boolean;
|
|
50
|
-
};
|
|
51
|
-
outputSchema: {
|
|
52
|
-
type: string;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
export declare function runAgentCall(ctx: ToolContext, args: Record<string, unknown>): Promise<{
|
|
56
|
-
isError: boolean;
|
|
57
|
-
content: {
|
|
58
|
-
type: string;
|
|
59
|
-
text: string;
|
|
60
|
-
}[];
|
|
61
|
-
} | {
|
|
62
|
-
content: {
|
|
63
|
-
type: string;
|
|
64
|
-
text: string;
|
|
65
|
-
}[];
|
|
66
|
-
isError?: undefined;
|
|
67
|
-
}>;
|
|
68
|
-
//# sourceMappingURL=agent-call.d.ts.map
|