agentshield-live 0.0.0-stage → 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Johannes Hofmann
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,41 @@
1
- # Temporary Holding Version
1
+ # agentshield-live
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Verify before you act. Tool definitions and a paying caller for [agentshield.live](https://agentshield.live): deterministic checks an agent runs before money moves, an invoice goes out, or a deadline is promised.
4
+
5
+ This package is not the old `agentshield-audit` skill and not agentshield.ai.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm i agentshield-live
11
+ ```
12
+
13
+ Set `X402_PAYER_KEY` to a wallet key with a little USDC on Base. The key stays on your machine. Optional `X402_REF` is a referrer id. No share is paid.
14
+
15
+ ## Use
16
+
17
+ ```js
18
+ import { createAgentShield } from "agentshield-live";
19
+
20
+ const shield = createAgentShield({ maxUsdc: 0.05 });
21
+ const decision = await shield.choose("Check this invoice before I pay it");
22
+ const out = await shield.call("agentshield_invoice", {
23
+ net: "100.00",
24
+ vat: "19.00",
25
+ gross: "119.00",
26
+ country: "DE",
27
+ });
28
+ ```
29
+
30
+ `choose` is free. `call` pays the live 402 price, and refuses if that price is above `maxUsdc`.
31
+
32
+ OpenClaw: `openclaw skills install @bartelmost/agentshield-verify`
33
+
34
+ Rehearse the payment flow on Base Sepolia: https://agentshield.live/try.md
35
+
36
+ ## Links
37
+
38
+ - https://agentshield.live
39
+ - https://agentshield.live/llms.txt
40
+ - https://agentshield.live/mcp
41
+ - https://github.com/bartelmost/agentshield-agent-kit
package/agent-kit.mjs ADDED
@@ -0,0 +1,61 @@
1
+ // agentshield.live agent kit. Drop-in tool definitions plus a caller that pays with YOUR key.
2
+ // Needs: npm i @x402/fetch @x402/evm viem. This file contains no key. Node 20+.
3
+ import { privateKeyToAccount } from "viem/accounts";
4
+ import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
5
+ import { ExactEvmScheme } from "@x402/evm";
6
+
7
+ const BASE = "https://agentshield.live";
8
+
9
+ const q = (props, required) => ({ type: "object", properties: props, required, additionalProperties: false });
10
+ const s = (description) => ({ type: "string", description });
11
+
12
+ // OpenAI-style function definitions. Works as-is for OpenAI, and maps 1:1 to Anthropic input_schema and LangChain tools.
13
+ export const tools = [
14
+ { name: "agentshield_transfer", route: "/transfer", description: "Check a bank transfer before money moves: IBAN, BIC, amount, SEPA scope, remittance text, name. Returns ok and failed fields.",
15
+ parameters: q({ iban: s("Beneficiary IBAN"), bic: s("Optional BIC"), amount: s("Optional decimal amount"), currency: s("Optional currency code"), reference: s("Optional remittance text"), name: s("Optional beneficiary name"), cid: s("Optional German SEPA creditor id") }, ["iban"]) },
16
+ { name: "agentshield_invoice", route: "/invoice", description: "Check an invoice before sending or paying: net + VAT = gross, VAT rate, IBAN, VAT id, date, number. Optional registry=1 asks EU VIES. Returns ok and failed fields.",
17
+ parameters: q({ net: s("Net amount"), vat: s("VAT amount"), gross: s("Gross amount"), rate: s("Optional VAT percent"), country: s("Seller country code"), currency: s("Currency code"), iban: s("Optional IBAN"), vatid: s("Optional VAT id"), date: s("Optional YYYY-MM-DD"), number: s("Optional invoice number"), registry: s("Set to 1 to also ask EU VIES for the VAT id") }, ["net", "gross"]) },
18
+ { name: "agentshield_deadline", route: "/deadline", description: "Add or subtract business days, skipping weekends and public holidays of a country or region.",
19
+ parameters: q({ date: s("Start date YYYY-MM-DD, not counted"), days: s("Non-zero business-day count"), country: s("Two-letter country code"), region: s("Optional region such as BY") }, ["date", "days", "country"]) },
20
+ { name: "agentshield_holidays", route: "/holidays", description: "All statutory public holidays of a year for a country, optionally one region.",
21
+ parameters: q({ country: s("Two-letter country code"), year: s("Year"), region: s("Optional region") }, ["country", "year"]) },
22
+ { name: "agentshield_cryptopay", route: "/cryptopay", description: "Check an EVM stablecoin transfer: recipient checksum, token contract on that chain.",
23
+ parameters: q({ to: s("Recipient 0x address"), chain: s("Chain id or name"), token: s("Optional USDC, USDT or contract address") }, ["to", "chain"]) },
24
+ { name: "agentshield_choose", route: null, description: "Free. Ask whether a subtask is worth paying for. Returns pay, compute or skip and the route to call.",
25
+ parameters: q({ task: s("One sentence: what you are about to do or look up") }, ["task"]) },
26
+ ];
27
+
28
+ export function createAgentShield({ key = process.env.X402_PAYER_KEY, ref = process.env.X402_REF, maxUsdc = 0.1 } = {}) {
29
+ if (!key) throw new Error("Set X402_PAYER_KEY. The key is yours; it never leaves your machine.");
30
+ const account = privateKeyToAccount(key.startsWith("0x") ? key : `0x${key}`);
31
+ const paidFetch = wrapFetchWithPayment(globalThis.fetch, new x402Client().register("eip155:8453", new ExactEvmScheme(account)));
32
+
33
+ async function choose(task) {
34
+ const r = await fetch(`${BASE}/mcp`, { method: "POST", headers: { "content-type": "application/json" },
35
+ body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/call", params: { name: "choose_route", arguments: { task } } }) });
36
+ return JSON.parse((await r.json()).result.content[0].text);
37
+ }
38
+
39
+ async function call(name, args = {}) {
40
+ const tool = tools.find((t) => t.name === name);
41
+ if (!tool) throw new Error(`Unknown tool ${name}`);
42
+ if (!tool.route) return choose(args.task);
43
+ const url = new URL(BASE + tool.route);
44
+ const clean = {};
45
+ for (const [k, v] of Object.entries(args)) if (v !== undefined && v !== "") clean[k] = String(v);
46
+ // The five bundles take a JSON body (POST), so IBANs and names never appear in a URL.
47
+ const init = { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(clean) };
48
+ const probe = await fetch(url, init);
49
+ if (probe.status === 402) {
50
+ const hdr = probe.headers.get("payment-required");
51
+ const price = hdr ? Number(JSON.parse(Buffer.from(hdr, "base64").toString()).accepts[0].amount) / 1e6 : null;
52
+ if (price !== null && price > maxUsdc) return { error: `price ${price} USDC exceeds maxUsdc ${maxUsdc}` };
53
+ }
54
+ const headers = { accept: "application/json", "content-type": "application/json" };
55
+ if (ref) headers["x-agent-ref"] = ref;
56
+ const res = await paidFetch(url, { method: "POST", headers, body: init.body });
57
+ return { status: res.status, ...(await res.json().catch(() => ({}))) };
58
+ }
59
+
60
+ return { tools, choose, call };
61
+ }
package/package.json CHANGED
@@ -1,6 +1,24 @@
1
1
  {
2
2
  "name": "agentshield-live",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Verify before you act. Tool definitions and a paying caller for agentshield.live checks (x402, USDC on Base).",
5
+ "type": "module",
6
+ "main": "./agent-kit.mjs",
7
+ "exports": {
8
+ ".": "./agent-kit.mjs"
9
+ },
10
+ "files": ["agent-kit.mjs", "tools.json", "README.md", "LICENSE"],
11
+ "license": "MIT",
12
+ "homepage": "https://agentshield.live/integrate.md",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/bartelmost/agentshield-agent-kit.git"
16
+ },
17
+ "keywords": ["agentshield", "x402", "ai-agents", "mcp", "invoice", "iban", "usdc", "base"],
18
+ "engines": { "node": ">=20" },
19
+ "dependencies": {
20
+ "@x402/evm": "^2.28.0",
21
+ "@x402/fetch": "^2.28.0",
22
+ "viem": "^2.57.0"
23
+ }
24
+ }
package/tools.json ADDED
@@ -0,0 +1,207 @@
1
+ [
2
+ {
3
+ "name": "agentshield_transfer",
4
+ "description": "Check a bank transfer before money moves: IBAN, BIC, amount, SEPA scope, remittance text, name. Returns ok and failed fields.",
5
+ "parameters": {
6
+ "type": "object",
7
+ "properties": {
8
+ "iban": {
9
+ "type": "string",
10
+ "description": "Beneficiary IBAN"
11
+ },
12
+ "bic": {
13
+ "type": "string",
14
+ "description": "Optional BIC"
15
+ },
16
+ "amount": {
17
+ "type": "string",
18
+ "description": "Optional decimal amount"
19
+ },
20
+ "currency": {
21
+ "type": "string",
22
+ "description": "Optional currency code"
23
+ },
24
+ "reference": {
25
+ "type": "string",
26
+ "description": "Optional remittance text"
27
+ },
28
+ "name": {
29
+ "type": "string",
30
+ "description": "Optional beneficiary name"
31
+ },
32
+ "cid": {
33
+ "type": "string",
34
+ "description": "Optional German SEPA creditor id"
35
+ }
36
+ },
37
+ "required": [
38
+ "iban"
39
+ ],
40
+ "additionalProperties": false
41
+ },
42
+ "route_url": "https://agentshield.live/transfer"
43
+ },
44
+ {
45
+ "name": "agentshield_invoice",
46
+ "description": "Check an invoice before sending or paying: net + VAT = gross, VAT rate, IBAN, VAT id, date, number. Optional registry=1 asks EU VIES. Returns ok and failed fields.",
47
+ "parameters": {
48
+ "type": "object",
49
+ "properties": {
50
+ "net": {
51
+ "type": "string",
52
+ "description": "Net amount"
53
+ },
54
+ "vat": {
55
+ "type": "string",
56
+ "description": "VAT amount"
57
+ },
58
+ "gross": {
59
+ "type": "string",
60
+ "description": "Gross amount"
61
+ },
62
+ "rate": {
63
+ "type": "string",
64
+ "description": "Optional VAT percent"
65
+ },
66
+ "country": {
67
+ "type": "string",
68
+ "description": "Seller country code"
69
+ },
70
+ "currency": {
71
+ "type": "string",
72
+ "description": "Currency code"
73
+ },
74
+ "iban": {
75
+ "type": "string",
76
+ "description": "Optional IBAN"
77
+ },
78
+ "vatid": {
79
+ "type": "string",
80
+ "description": "Optional VAT id"
81
+ },
82
+ "date": {
83
+ "type": "string",
84
+ "description": "Optional YYYY-MM-DD"
85
+ },
86
+ "number": {
87
+ "type": "string",
88
+ "description": "Optional invoice number"
89
+ },
90
+ "registry": {
91
+ "type": "string",
92
+ "description": "Set to 1 to also ask EU VIES for the VAT id"
93
+ }
94
+ },
95
+ "required": [
96
+ "net",
97
+ "gross"
98
+ ],
99
+ "additionalProperties": false
100
+ },
101
+ "route_url": "https://agentshield.live/invoice"
102
+ },
103
+ {
104
+ "name": "agentshield_deadline",
105
+ "description": "Add or subtract business days, skipping weekends and public holidays of a country or region.",
106
+ "parameters": {
107
+ "type": "object",
108
+ "properties": {
109
+ "date": {
110
+ "type": "string",
111
+ "description": "Start date YYYY-MM-DD, not counted"
112
+ },
113
+ "days": {
114
+ "type": "string",
115
+ "description": "Non-zero business-day count"
116
+ },
117
+ "country": {
118
+ "type": "string",
119
+ "description": "Two-letter country code"
120
+ },
121
+ "region": {
122
+ "type": "string",
123
+ "description": "Optional region such as BY"
124
+ }
125
+ },
126
+ "required": [
127
+ "date",
128
+ "days",
129
+ "country"
130
+ ],
131
+ "additionalProperties": false
132
+ },
133
+ "route_url": "https://agentshield.live/deadline"
134
+ },
135
+ {
136
+ "name": "agentshield_holidays",
137
+ "description": "All statutory public holidays of a year for a country, optionally one region.",
138
+ "parameters": {
139
+ "type": "object",
140
+ "properties": {
141
+ "country": {
142
+ "type": "string",
143
+ "description": "Two-letter country code"
144
+ },
145
+ "year": {
146
+ "type": "string",
147
+ "description": "Year"
148
+ },
149
+ "region": {
150
+ "type": "string",
151
+ "description": "Optional region"
152
+ }
153
+ },
154
+ "required": [
155
+ "country",
156
+ "year"
157
+ ],
158
+ "additionalProperties": false
159
+ },
160
+ "route_url": "https://agentshield.live/holidays"
161
+ },
162
+ {
163
+ "name": "agentshield_cryptopay",
164
+ "description": "Check an EVM stablecoin transfer: recipient checksum, token contract on that chain.",
165
+ "parameters": {
166
+ "type": "object",
167
+ "properties": {
168
+ "to": {
169
+ "type": "string",
170
+ "description": "Recipient 0x address"
171
+ },
172
+ "chain": {
173
+ "type": "string",
174
+ "description": "Chain id or name"
175
+ },
176
+ "token": {
177
+ "type": "string",
178
+ "description": "Optional USDC, USDT or contract address"
179
+ }
180
+ },
181
+ "required": [
182
+ "to",
183
+ "chain"
184
+ ],
185
+ "additionalProperties": false
186
+ },
187
+ "route_url": "https://agentshield.live/cryptopay"
188
+ },
189
+ {
190
+ "name": "agentshield_choose",
191
+ "description": "Free. Ask whether a subtask is worth paying for. Returns pay, compute or skip and the route to call.",
192
+ "parameters": {
193
+ "type": "object",
194
+ "properties": {
195
+ "task": {
196
+ "type": "string",
197
+ "description": "One sentence: what you are about to do or look up"
198
+ }
199
+ },
200
+ "required": [
201
+ "task"
202
+ ],
203
+ "additionalProperties": false
204
+ },
205
+ "route_url": null
206
+ }
207
+ ]