@aifinpay/mcp 1.5.1 → 2.0.0-rc.3
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 +11 -15
- package/bin/aifinpay-mcp.js +161 -4
- package/dist/config.d.ts +24 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +46 -0
- package/dist/config.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 +21 -1
- package/dist/safe-fetch.js.map +1 -1
- package/dist/server.d.ts +10 -7
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +43 -81
- 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/agent-quota.d.ts +40 -0
- 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/payable-fetch.d.ts.map +1 -1
- package/dist/tools/payable-fetch.js +44 -16
- package/dist/tools/payable-fetch.js.map +1 -1
- package/dist/tools/production-control.d.ts +108 -0
- package/dist/tools/production-control.d.ts.map +1 -0
- package/dist/tools/production-control.js +131 -0
- package/dist/tools/production-control.js.map +1 -0
- package/package.json +19 -9
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAE5C,O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Q,IAAI,EAAE,CAAC;YACb,KAAK,eAAe;gBAClB,OAAO,eAAe,CAAC,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;YAC1C,KAAK,aAAa;gBAChB,OAAO,aAAa,CAAC,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;YACxC,KAAK,wBAAwB;gBAC3B,OAAO,uBAAuB,CAAC,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;YAClD,KAAK,mBAAmB;gBACtB,OAAO,mBAAmB,CAAC,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;YAC9C,KAAK,oBAAoB;gBACvB,OAAO,oBAAoB,CAAC,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;YAC/C;gBACE,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,4BAA4B,IAAI,EAAE,EAAE,CAAC;iBACtE,CAAC;QACN,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC3B,CAAC;AAQD,SAAS,UAAU,CAAC,KAAgC,EAAE,GAAW;IAC/D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,GAAG,IAAI,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-address.d.ts","sourceRoot":"","sources":["../../src/tools/agent-address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"agent-address.d.ts","sourceRoot":"","sources":["../../src/tools/agent-address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2B/B;AAED,wBAAsB,eAAe,CACnC,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;GAe/B"}
|
|
@@ -1,38 +1,25 @@
|
|
|
1
1
|
export function agentAddressTool() {
|
|
2
2
|
return {
|
|
3
3
|
name: "agent_address",
|
|
4
|
-
description: "Return the agent's on-chain
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"and other bridges advertising Polygon settlement. Solana (base58) — " +
|
|
8
|
-
"for the leaderboard / Seat PDA and Solana-native bridges. Casper — " +
|
|
9
|
-
"identity only for now: the address is derived from the same seed and " +
|
|
10
|
-
"can be funded, but this SDK cannot yet sign Casper deploys, so it is " +
|
|
11
|
-
"not a settlement rail here. One seed, three addresses.",
|
|
4
|
+
description: "Return the agent's currently derived on-chain addresses. " +
|
|
5
|
+
"This tool is read-only and never authorizes or signs a payment. " +
|
|
6
|
+
"Production value movement is available only through the verified SDK v2 settlement executor after trusted deployment pins are released.",
|
|
12
7
|
inputSchema: {
|
|
13
8
|
type: "object",
|
|
14
9
|
properties: {},
|
|
15
10
|
},
|
|
16
|
-
// OpenAI Apps SDK requires impact hints on every tool (omitting = validation error).
|
|
17
11
|
annotations: { readOnlyHint: true, openWorldHint: false, destructiveHint: false },
|
|
18
12
|
outputSchema: {
|
|
19
13
|
type: "object",
|
|
20
14
|
properties: {
|
|
21
15
|
solana: { type: "string", description: "Solana base58 address" },
|
|
22
|
-
evm: { type: "string", description: "
|
|
23
|
-
// Declared because the handler returns it. A field present in the
|
|
24
|
-
// payload but absent from the schema is how a client silently drops
|
|
25
|
-
// it — the address would be derived, returned, and never shown.
|
|
16
|
+
evm: { type: "string", description: "EVM address used across EVM networks" },
|
|
26
17
|
casper: {
|
|
27
18
|
type: "string",
|
|
28
|
-
description: "Casper
|
|
29
|
-
"and fundable, but this SDK cannot sign Casper deploys yet.",
|
|
19
|
+
description: "Casper identity derived from the same seed. Read-only in this MCP RC; no payment signing tool is exposed.",
|
|
30
20
|
},
|
|
31
21
|
note: { type: "string" },
|
|
32
22
|
},
|
|
33
|
-
// `casper` is deliberately not required: an agent built from a raw EVM
|
|
34
|
-
// key has no seed to derive it from, and claiming it always exists
|
|
35
|
-
// would make that case look like a bug rather than a limitation.
|
|
36
23
|
required: ["solana", "evm"],
|
|
37
24
|
},
|
|
38
25
|
};
|
|
@@ -41,16 +28,8 @@ export async function runAgentAddress(ctx, _args) {
|
|
|
41
28
|
const payload = {
|
|
42
29
|
solana: ctx.agent.solanaAddress,
|
|
43
30
|
evm: ctx.agent.evmAddress,
|
|
44
|
-
// Casper was absent here while the project counted it among its live
|
|
45
|
-
// networks, so an agent could not be told its own address on a chain we
|
|
46
|
-
// advertise. Same seed as the other two; the account hash is what a Casper
|
|
47
|
-
// explorer expects.
|
|
48
31
|
casper: ctx.agent.casperAddress,
|
|
49
|
-
note: "
|
|
50
|
-
"(io.net, Exa, Venice). Solana is supported via Seat PDA payments. " +
|
|
51
|
-
"Casper has a deployed settlement contract and the SDK derives the " +
|
|
52
|
-
"address, but does not yet sign Casper deploys. " +
|
|
53
|
-
"One seed derives all three — funding any enables that chain.",
|
|
32
|
+
note: "Read-only address discovery. Payment signing is intentionally absent from this MCP production RC until the final SDK v2 release contains independently trusted deployment pins and paid E2E evidence.",
|
|
54
33
|
};
|
|
55
34
|
return {
|
|
56
35
|
content: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-address.js","sourceRoot":"","sources":["../../src/tools/agent-address.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"agent-address.js","sourceRoot":"","sources":["../../src/tools/agent-address.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,IAA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
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: string;
|
|
7
|
+
properties: {
|
|
8
|
+
merchant_id: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
include_exhausted: {
|
|
13
|
+
type: string;
|
|
14
|
+
default: boolean;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
annotations: {
|
|
20
|
+
readOnlyHint: boolean;
|
|
21
|
+
openWorldHint: boolean;
|
|
22
|
+
destructiveHint: boolean;
|
|
23
|
+
};
|
|
24
|
+
outputSchema: {
|
|
25
|
+
type: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare function runAgentQuota(ctx: ToolContext, args: Record<string, unknown>): Promise<{
|
|
29
|
+
isError: boolean;
|
|
30
|
+
content: {
|
|
31
|
+
type: string;
|
|
32
|
+
text: string;
|
|
33
|
+
}[];
|
|
34
|
+
} | {
|
|
35
|
+
content: {
|
|
36
|
+
type: string;
|
|
37
|
+
text: string;
|
|
38
|
+
}[];
|
|
39
|
+
}>;
|
|
40
|
+
//# sourceMappingURL=agent-quota.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-quota.d.ts","sourceRoot":"","sources":["../../src/tools/agent-quota.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;EA4B7B;AAiBD,wBAAsB,aAAa,CACjC,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;GAwE9B"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const DEFAULT_BASE = "https://api.aifinpay.io";
|
|
2
|
+
export function agentQuotaTool() {
|
|
3
|
+
return {
|
|
4
|
+
name: "agent_quota",
|
|
5
|
+
description: "How many prepaid requests this agent has left, per service. Lists the " +
|
|
6
|
+
"agent's active quota batches (merchant, resource, used, remaining, " +
|
|
7
|
+
"expiry). Read-only; never spends, pays, or signs anything. Ask it " +
|
|
8
|
+
"things like: how many calls do I have left at mrch_x?",
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
merchant_id: {
|
|
13
|
+
type: "string",
|
|
14
|
+
description: "Optional mrch_… filter — only batches bought from this service.",
|
|
15
|
+
},
|
|
16
|
+
include_exhausted: {
|
|
17
|
+
type: "boolean",
|
|
18
|
+
default: false,
|
|
19
|
+
description: "Also list batches with 0 remaining (still retained, not yet expired).",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
// Talks only to the configured AiFinPay backend, never to arbitrary URLs.
|
|
24
|
+
annotations: { readOnlyHint: true, openWorldHint: false, destructiveHint: false },
|
|
25
|
+
outputSchema: { type: "object" },
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export async function runAgentQuota(ctx, args) {
|
|
29
|
+
const base = (ctx.config.baseUrl ?? DEFAULT_BASE).replace(/\/+$/, "");
|
|
30
|
+
const address = ctx.agent.evmAddress;
|
|
31
|
+
const merchantFilter = typeof args.merchant_id === "string" && args.merchant_id ? args.merchant_id : null;
|
|
32
|
+
const includeExhausted = args.include_exhausted === true;
|
|
33
|
+
let resp;
|
|
34
|
+
try {
|
|
35
|
+
resp = await ctx.agent.inner.fetchImpl(`${base}/v1/agents/${address}/receipts`, { method: "GET" });
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
const err = e;
|
|
39
|
+
return errorResult(`could not reach ${base}: ${err.message}`);
|
|
40
|
+
}
|
|
41
|
+
if (!resp.ok) {
|
|
42
|
+
return errorResult(`quota lookup failed: HTTP ${resp.status}`);
|
|
43
|
+
}
|
|
44
|
+
const body = (await resp.json());
|
|
45
|
+
const now = Math.floor(Date.now() / 1000);
|
|
46
|
+
let batches = (body.receipts ?? [])
|
|
47
|
+
.filter((r) => r.exp == null || r.exp > now)
|
|
48
|
+
.filter((r) => (merchantFilter ? r.merchant_id === merchantFilter : true))
|
|
49
|
+
.filter((r) => includeExhausted || (r.remaining ?? 0) > 0)
|
|
50
|
+
.map((r) => ({
|
|
51
|
+
merchant_id: r.merchant_id,
|
|
52
|
+
resource: r.resource,
|
|
53
|
+
scope: r.scope ?? "exact",
|
|
54
|
+
tier: r.tier,
|
|
55
|
+
used: r.used ?? 0,
|
|
56
|
+
remaining: r.remaining ?? 0,
|
|
57
|
+
quota: r.quota ?? 1,
|
|
58
|
+
paid: r.amount != null ? `${r.amount} ${r.currency ?? "USD"}` : undefined,
|
|
59
|
+
expires: r.exp != null ? new Date(r.exp * 1000).toISOString() : undefined,
|
|
60
|
+
receipt_id: r.receipt_id,
|
|
61
|
+
}));
|
|
62
|
+
// Most useful first: the batches with the most room to spend.
|
|
63
|
+
batches = batches.sort((a, b) => b.remaining - a.remaining);
|
|
64
|
+
// Roll up per merchant so "how much do I have left at X" is one line even
|
|
65
|
+
// when the agent bought several batches there.
|
|
66
|
+
const perMerchant = new Map();
|
|
67
|
+
for (const b of batches) {
|
|
68
|
+
const key = b.merchant_id ?? "unknown";
|
|
69
|
+
const cur = perMerchant.get(key) ?? { remaining: 0, batches: 0 };
|
|
70
|
+
cur.remaining += b.remaining;
|
|
71
|
+
cur.batches += 1;
|
|
72
|
+
perMerchant.set(key, cur);
|
|
73
|
+
}
|
|
74
|
+
const payload = {
|
|
75
|
+
agent: address,
|
|
76
|
+
...(merchantFilter ? { merchant_filter: merchantFilter } : {}),
|
|
77
|
+
totals: Object.fromEntries(perMerchant),
|
|
78
|
+
batches,
|
|
79
|
+
note: batches.length === 0
|
|
80
|
+
? merchantFilter
|
|
81
|
+
? `no active quota at ${merchantFilter} — a new batch starts with that service's 402 (or agent_quote its URL first)`
|
|
82
|
+
: "no active quota anywhere — pay a service's 402 to start a batch"
|
|
83
|
+
: "`remaining` is authoritative where AiFinPay meters (hosted gateway); a merchant running its own @aifinpay/gate meters locally and our copy can lag behind by their traffic.",
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function errorResult(...lines) {
|
|
90
|
+
return {
|
|
91
|
+
isError: true,
|
|
92
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=agent-quota.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-quota.js","sourceRoot":"","sources":["../../src/tools/agent-quota.ts"],"names":[],"mappings":"AAuBA,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAE/C,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,WAAW,EACT,wEAAwE;YACxE,qEAAqE;YACrE,oEAAoE;YACpE,uDAAuD;QACzD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,iEAAiE;iBACpE;gBACD,iBAAiB,EAAE;oBACjB,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,KAAK;oBACd,WAAW,EACT,uEAAuE;iBAC1E;aACF;SACF;QACD,0EAA0E;QAC1E,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE;QACjF,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACjC,CAAC;AACJ,CAAC;AAiBD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,GAAgB,EAChB,IAA6B;IAE7B,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,YAAY,CAAC,CAAC,O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"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"payable-fetch.d.ts","sourceRoot":"","sources":["../../src/tools/payable-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsD/B;AAED,wBAAsB,eAAe,CACnC,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;GA8F9B"}
|
|
@@ -7,9 +7,10 @@ export function payableFetchTool() {
|
|
|
7
7
|
"without being able to settle it. " +
|
|
8
8
|
"Natural-language triggers: 'fetch <paid URL>', 'pay for <url>', " +
|
|
9
9
|
"'try this URL — it might be paid', 'pay the 402 and get the response'. " +
|
|
10
|
-
"The agent automatically detects the
|
|
11
|
-
"or
|
|
12
|
-
"
|
|
10
|
+
"The agent automatically detects the protocol — the AIFP-1 gateway " +
|
|
11
|
+
"(gateway.aifinpay.io) or an x402 facilitator (AiFinPay or Coinbase " +
|
|
12
|
+
"x402) — pays from the agent's wallet, retries, and returns the response " +
|
|
13
|
+
"status, headers, and body. For known " +
|
|
13
14
|
"AiFinPay-registered providers (exa, io-net, venice, ...), prefer " +
|
|
14
15
|
"`agent_call` instead — it's higher-level and resolves the bridge URL " +
|
|
15
16
|
"from the registry.",
|
|
@@ -60,20 +61,47 @@ export async function runPayableFetch(ctx, args) {
|
|
|
60
61
|
const maxAmountUsd = typeof args.max_amount_usd === "number"
|
|
61
62
|
? args.max_amount_usd
|
|
62
63
|
: ctx.config.maxAmountUsd;
|
|
64
|
+
const forcedFacilitator = typeof args.facilitator === "string" ? args.facilitator : undefined;
|
|
63
65
|
try {
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
// Two payment protocols answer a 402 here, and this tool used to speak only
|
|
67
|
+
// one of them.
|
|
68
|
+
//
|
|
69
|
+
// AIFP-1 gateway (gateway.aifinpay.io/{slug}/…): quote → settle on-chain →
|
|
70
|
+
// receipt → retry. Lives on the unified agent as fetchPaid().
|
|
71
|
+
// x402 facilitators (AiFinPay / Coinbase): the X-PAYMENT header flow, on
|
|
72
|
+
// the wrapped Solana-side agent as inner.pay().
|
|
73
|
+
//
|
|
74
|
+
// Before this, payable_fetch called inner.pay() only, so an MCP agent
|
|
75
|
+
// pointed at a gateway URL got stuck on the 402 it could not read — the
|
|
76
|
+
// single most common paid surface we run (AIFINP-118 neighbour).
|
|
77
|
+
//
|
|
78
|
+
// Routing, safe by construction: fetchPaid() is documented to return a
|
|
79
|
+
// non-AIFP-1 402 UNTOUCHED and cost nothing, so trying it first can pay an
|
|
80
|
+
// AIFP-1 URL but can never mis-pay an x402 one. Anything it hands back still
|
|
81
|
+
// 402 falls through to the x402 path. A caller who forces a facilitator has
|
|
82
|
+
// stated x402 intent, so skip AIFP-1 entirely for them.
|
|
83
|
+
let resp = null;
|
|
84
|
+
if (!forcedFacilitator) {
|
|
85
|
+
resp = await ctx.agent.fetchPaid(url, { method, body, headers });
|
|
86
|
+
if (resp === null) {
|
|
87
|
+
// Budget cap hit with on_limit_exceeded="skip" — do NOT then try to pay
|
|
88
|
+
// the same call via x402; that would defeat the cap the caller set.
|
|
89
|
+
return errorResult("payment skipped: the per-call or daily budget cap was reached " +
|
|
90
|
+
"(on_limit_exceeded is set to skip).");
|
|
91
|
+
}
|
|
92
|
+
if (resp.status === 402) {
|
|
93
|
+
// Not an AIFP-1 gateway 402 — fetchPaid passed it through. Try x402.
|
|
94
|
+
resp = null;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (resp === null) {
|
|
98
|
+
resp = await ctx.agent.inner.pay(url, {
|
|
99
|
+
method,
|
|
100
|
+
body,
|
|
101
|
+
headers,
|
|
102
|
+
options: { maxAmountUsd, facilitator: forcedFacilitator },
|
|
103
|
+
});
|
|
104
|
+
}
|
|
77
105
|
const respHeaders = {};
|
|
78
106
|
resp.headers.forEach((v, k) => (respHeaders[k] = v));
|
|
79
107
|
const text = await resp.text();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payable-fetch.js","sourceRoot":"","sources":["../../src/tools/payable-fetch.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,WAAW,EACT,sEAAsE;YACtE,uEAAuE;YACvE,uEAAuE;YACvE,mCAAmC;YACnC,kEAAkE;YAClE,yEAAyE;YACzE,
|
|
1
|
+
{"version":3,"file":"payable-fetch.js","sourceRoot":"","sources":["../../src/tools/payable-fetch.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,WAAW,EACT,sEAAsE;YACtE,uEAAuE;YACvE,uEAAuE;YACvE,mCAAmC;YACnC,kEAAkE;YAClE,yEAAyE;YACzE,oEAAoE;YACpE,qEAAqE;YACrE,0EAA0E;YAC1E,uCAAuC;YACvC,mEAAmE;YACnE,uEAAuE;YACvE,oBAAoB;QACtB,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,EAAE;gBAC3D,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;oBAC/C,OAAO,EAAE,KAAK;iBACf;g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,CAAC;QAED,MAAM,WAAW,GAA2B,EAAE,CAAC;QAC/C,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACrD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAE/B,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,MAAM,EAAE,IAAI,CAAC,MAAM;wBACnB,EAAE,EAAE,IAAI,CAAC,EAAE;wBACX,OAAO,EAAE,WAAW;wBACpB,IAAI,EAAE,IAAI;qBACX,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,GAAG,GAAG,CAAU,CAAC;QACvB,OAAO,WAAW,CAChB,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,EACzC,qBAAqB,GAAG,CAAC,KAAK,CAAC,aAAa,0BAA0B;YACpE,+DAA+D;YAC/D,gCAAgC,CACnC,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,GAAG,KAAe;IACrC,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;KAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { ToolContext } from "../server.js";
|
|
2
|
+
export declare function agentPassportResolveTool(): {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: string;
|
|
7
|
+
properties: {
|
|
8
|
+
identifier: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
required: string[];
|
|
14
|
+
};
|
|
15
|
+
annotations: {
|
|
16
|
+
readOnlyHint: boolean;
|
|
17
|
+
openWorldHint: boolean;
|
|
18
|
+
destructiveHint: boolean;
|
|
19
|
+
};
|
|
20
|
+
outputSchema: {
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare function runAgentPassportResolve(ctx: ToolContext, args: Record<string, unknown>): Promise<{
|
|
25
|
+
content: {
|
|
26
|
+
type: string;
|
|
27
|
+
text: string;
|
|
28
|
+
}[];
|
|
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<{
|
|
52
|
+
content: {
|
|
53
|
+
type: string;
|
|
54
|
+
text: string;
|
|
55
|
+
}[];
|
|
56
|
+
}>;
|
|
57
|
+
export declare function settlementInvoiceTool(): {
|
|
58
|
+
name: string;
|
|
59
|
+
description: string;
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: string;
|
|
62
|
+
properties: {
|
|
63
|
+
route_class: {
|
|
64
|
+
type: string;
|
|
65
|
+
enum: string[];
|
|
66
|
+
};
|
|
67
|
+
chain: {
|
|
68
|
+
type: string;
|
|
69
|
+
enum: string[];
|
|
70
|
+
};
|
|
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: {
|
|
87
|
+
type: string;
|
|
88
|
+
description: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
required: string[];
|
|
92
|
+
};
|
|
93
|
+
annotations: {
|
|
94
|
+
readOnlyHint: boolean;
|
|
95
|
+
openWorldHint: boolean;
|
|
96
|
+
destructiveHint: boolean;
|
|
97
|
+
};
|
|
98
|
+
outputSchema: {
|
|
99
|
+
type: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
export declare function runSettlementInvoice(ctx: ToolContext, args: Record<string, unknown>): Promise<{
|
|
103
|
+
content: {
|
|
104
|
+
type: string;
|
|
105
|
+
text: string;
|
|
106
|
+
}[];
|
|
107
|
+
}>;
|
|
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;AA8BhD,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,131 @@
|
|
|
1
|
+
const DEFAULT_BASE = "https://aifinpay.io";
|
|
2
|
+
const ROUTES = new Set(["AIFP-1", "AIFP-2"]);
|
|
3
|
+
const CHAINS = new Set([
|
|
4
|
+
"polygon", "avalanche", "arbitrum", "bnb", "base",
|
|
5
|
+
"unichain", "optimism", "botchain", "xrplevm",
|
|
6
|
+
]);
|
|
7
|
+
function result(value) {
|
|
8
|
+
return { content: [{ type: "text", text: JSON.stringify(value, null, 2) }] };
|
|
9
|
+
}
|
|
10
|
+
function errorResult(message) {
|
|
11
|
+
return { isError: true, content: [{ type: "text", text: message }] };
|
|
12
|
+
}
|
|
13
|
+
function base(ctx) {
|
|
14
|
+
return String(ctx.config.baseUrl || DEFAULT_BASE).replace(/\/$/, "");
|
|
15
|
+
}
|
|
16
|
+
async function api(ctx, path, init) {
|
|
17
|
+
const response = await ctx.agent.inner.fetchImpl(`${base(ctx)}${path}`, init);
|
|
18
|
+
const body = await response.json().catch(() => null);
|
|
19
|
+
if (!response.ok) {
|
|
20
|
+
const detail = body && typeof body === "object"
|
|
21
|
+
? JSON.stringify(body)
|
|
22
|
+
: `HTTP ${response.status}`;
|
|
23
|
+
throw new Error(detail);
|
|
24
|
+
}
|
|
25
|
+
return body;
|
|
26
|
+
}
|
|
27
|
+
export function agentPassportResolveTool() {
|
|
28
|
+
return {
|
|
29
|
+
name: "agent_passport_resolve",
|
|
30
|
+
description: "Resolve an AiFinPay Agent Passport by @username, permanent AIFP number, or immutable agent id. " +
|
|
31
|
+
"Returns verified public wallet bindings only. Resolution never authorizes a payment.",
|
|
32
|
+
inputSchema: {
|
|
33
|
+
type: "object",
|
|
34
|
+
properties: {
|
|
35
|
+
identifier: { type: "string", description: "@username, AIFP-#########, or aifp_agent_* id" },
|
|
36
|
+
},
|
|
37
|
+
required: ["identifier"],
|
|
38
|
+
},
|
|
39
|
+
annotations: { readOnlyHint: true, openWorldHint: false, destructiveHint: false },
|
|
40
|
+
outputSchema: { type: "object" },
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export async function runAgentPassportResolve(ctx, args) {
|
|
44
|
+
const identifier = String(args.identifier || "").trim();
|
|
45
|
+
if (!identifier)
|
|
46
|
+
return errorResult("missing required arg: identifier");
|
|
47
|
+
try {
|
|
48
|
+
const body = await api(ctx, `/api/agent/resolve/${encodeURIComponent(identifier)}`);
|
|
49
|
+
return result(body);
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
return errorResult(`Agent Passport resolve failed: ${e.message}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export function settlementRoutesTool() {
|
|
56
|
+
return {
|
|
57
|
+
name: "settlement_routes",
|
|
58
|
+
description: "Read AiFinPay's currently runtime-verified v1.3 settlement routes. " +
|
|
59
|
+
"AIFP-1 is merchant monetisation (99% merchant / 1% AiFinPay / 0% creator). " +
|
|
60
|
+
"AIFP-2/x402 is 100% provider / 0% AiFinPay / 0% creator.",
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: {
|
|
64
|
+
route_class: { type: "string", enum: ["AIFP-1", "AIFP-2"] },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
annotations: { readOnlyHint: true, openWorldHint: false, destructiveHint: false },
|
|
68
|
+
outputSchema: { type: "object" },
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export async function runSettlementRoutes(ctx, args) {
|
|
72
|
+
const route = args.route_class == null ? "" : String(args.route_class).toUpperCase();
|
|
73
|
+
if (route && !ROUTES.has(route))
|
|
74
|
+
return errorResult("route_class must be AIFP-1 or AIFP-2");
|
|
75
|
+
try {
|
|
76
|
+
return result(await api(ctx, `/v1/settlement/routes${route ? `?route_class=${encodeURIComponent(route)}` : ""}`));
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
return errorResult(`Settlement route lookup failed: ${e.message}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export function settlementInvoiceTool() {
|
|
83
|
+
return {
|
|
84
|
+
name: "settlement_invoice",
|
|
85
|
+
description: "Build and validate a NON-SIGNING v1.3 settlement invoice. This tool never moves funds. " +
|
|
86
|
+
"Use the published @aifinpay/agent v2 settlement executor to verify bytecode/profile and sign it.",
|
|
87
|
+
inputSchema: {
|
|
88
|
+
type: "object",
|
|
89
|
+
properties: {
|
|
90
|
+
route_class: { type: "string", enum: ["AIFP-1", "AIFP-2"] },
|
|
91
|
+
chain: { type: "string", enum: [...CHAINS] },
|
|
92
|
+
asset: { type: "string", description: "Native symbol, USDC, or USDT if the route advertises it." },
|
|
93
|
+
gross_amount: { type: "string", description: "Gross payer amount in base units." },
|
|
94
|
+
merchant_wallet: { type: "string", description: "Merchant/provider EVM wallet." },
|
|
95
|
+
order_id: { type: "string" },
|
|
96
|
+
valid_until: { type: "integer", description: "Optional Unix seconds, max 20 minutes ahead." },
|
|
97
|
+
},
|
|
98
|
+
required: ["route_class", "chain", "asset", "gross_amount", "merchant_wallet", "order_id"],
|
|
99
|
+
},
|
|
100
|
+
annotations: { readOnlyHint: true, openWorldHint: false, destructiveHint: false },
|
|
101
|
+
outputSchema: { type: "object" },
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export async function runSettlementInvoice(ctx, args) {
|
|
105
|
+
const route = String(args.route_class || "").toUpperCase();
|
|
106
|
+
const chain = String(args.chain || "").toLowerCase();
|
|
107
|
+
if (!ROUTES.has(route))
|
|
108
|
+
return errorResult("route_class must be AIFP-1 or AIFP-2");
|
|
109
|
+
if (!CHAINS.has(chain))
|
|
110
|
+
return errorResult("unsupported EVM settlement chain");
|
|
111
|
+
try {
|
|
112
|
+
const payload = {
|
|
113
|
+
route_class: route,
|
|
114
|
+
chain,
|
|
115
|
+
asset: String(args.asset || "").toUpperCase(),
|
|
116
|
+
gross_amount: String(args.gross_amount || ""),
|
|
117
|
+
merchant_wallet: String(args.merchant_wallet || ""),
|
|
118
|
+
order_id: String(args.order_id || ""),
|
|
119
|
+
...(args.valid_until != null ? { valid_until: Number(args.valid_until) } : {}),
|
|
120
|
+
};
|
|
121
|
+
return result(await api(ctx, "/v1/settlement/invoice", {
|
|
122
|
+
method: "POST",
|
|
123
|
+
headers: { "content-type": "application/json" },
|
|
124
|
+
body: JSON.stringify(payload),
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
catch (e) {
|
|
128
|
+
return errorResult(`Settlement invoice failed: ${e.message}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=production-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"production-control.js","sourceRoot":"","sources":["../../src/tools/production-control.ts"],"names":[],"mappings":"AAEA,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,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC/E,CAAC;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