agentshield-protocol 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.
Files changed (2) hide show
  1. package/package.json +55 -0
  2. package/sdk.js +79 -0
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "agentshield-protocol",
3
+ "version": "1.0.0",
4
+ "description": "Security protocol for autonomous AI agents — contract verification, wallet monitoring, freeze protection, and x402 machine payments.",
5
+ "type": "module",
6
+ "main": "sdk.js",
7
+ "exports": {
8
+ ".": "./sdk.js"
9
+ },
10
+ "keywords": [
11
+ "ai-agent",
12
+ "agent-security",
13
+ "smart-contract",
14
+ "wallet-security",
15
+ "x402",
16
+ "web3",
17
+ "defi",
18
+ "autonomous-agent",
19
+ "contract-verification",
20
+ "agent-shield",
21
+ "mcp",
22
+ "machine-payments"
23
+ ],
24
+ "author": "pullmein",
25
+ "license": "MIT",
26
+ "homepage": "https://agentshield.workers.dev",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/pullmein/agentshield"
30
+ },
31
+ "bugs": {
32
+ "url": "https://github.com/pullmein/agentshield/issues"
33
+ },
34
+ "files": [
35
+ "sdk.js",
36
+ "README.md"
37
+ ],
38
+ "scripts": {
39
+ "dev": "wrangler dev --var DEV_MODE:true",
40
+ "deploy": "wrangler deploy",
41
+ "db:create": "wrangler d1 create agentshield-db",
42
+ "db:migrate": "wrangler d1 execute agentshield-db --file=schema.sql",
43
+ "db:migrate:remote": "wrangler d1 execute agentshield-db --remote --file=schema.sql",
44
+ "kv:create": "wrangler kv:namespace create agentshield-cache",
45
+ "mcp": "node mcp-server.js",
46
+ "setup": "npm run db:create && npm run kv:create && echo 'Now update wrangler.toml with the IDs above, then run: npm run db:migrate'"
47
+ },
48
+ "dependencies": {
49
+ "@modelcontextprotocol/sdk": "^1.0.0"
50
+ },
51
+ "devDependencies": {
52
+ "esbuild": "^0.28.0",
53
+ "wrangler": "^3.114.17"
54
+ }
55
+ }
package/sdk.js ADDED
@@ -0,0 +1,79 @@
1
+ /**
2
+ * AgentShield SDK
3
+ * Security protocol for autonomous AI agents
4
+ * https://agentshield.workers.dev
5
+ */
6
+
7
+ const BASE_URL = 'https://agentshield.workers.dev';
8
+
9
+ export class AgentShield {
10
+ constructor(options = {}) {
11
+ this.baseUrl = options.baseUrl || BASE_URL;
12
+ this.wallet = options.wallet || null;
13
+ this.apiKey = options.apiKey || null;
14
+ }
15
+
16
+ _headers() {
17
+ const h = { 'Content-Type': 'application/json' };
18
+ if (this.wallet) h['X-Wallet'] = this.wallet;
19
+ if (this.apiKey) h['X-API-Key'] = this.apiKey;
20
+ return h;
21
+ }
22
+
23
+ /**
24
+ * Verify a smart contract for safety risks
25
+ * @param {string} contract - Contract address (0x...)
26
+ * @param {string} chain - Chain name (default: 'ethereum')
27
+ */
28
+ async verify(contract, chain = 'ethereum') {
29
+ const url = `${this.baseUrl}/verify?contract=${contract}&chain=${chain}`;
30
+ const res = await fetch(url, { headers: this._headers() });
31
+ return res.json();
32
+ }
33
+
34
+ /**
35
+ * Monitor a wallet address for suspicious activity
36
+ * @param {string} wallet - Wallet address to monitor
37
+ */
38
+ async monitor(wallet) {
39
+ const res = await fetch(`${this.baseUrl}/monitor`, {
40
+ method: 'POST',
41
+ headers: this._headers(),
42
+ body: JSON.stringify({ wallet }),
43
+ });
44
+ return res.json();
45
+ }
46
+
47
+ /**
48
+ * Freeze an agent's wallet to stop dangerous interactions
49
+ * @param {string} wallet - Wallet address to freeze
50
+ * @param {string} reason - Reason for freeze
51
+ */
52
+ async freeze(wallet, reason) {
53
+ const res = await fetch(`${this.baseUrl}/freeze`, {
54
+ method: 'POST',
55
+ headers: this._headers(),
56
+ body: JSON.stringify({ wallet, reason }),
57
+ });
58
+ return res.json();
59
+ }
60
+
61
+ /**
62
+ * Get agent context / manifest info
63
+ */
64
+ async agentContext() {
65
+ const res = await fetch(`${this.baseUrl}/agent-context`, { headers: this._headers() });
66
+ return res.json();
67
+ }
68
+
69
+ /**
70
+ * Get OpenAPI spec
71
+ */
72
+ async openapi() {
73
+ const res = await fetch(`${this.baseUrl}/openapi.json`);
74
+ return res.json();
75
+ }
76
+ }
77
+
78
+ // CommonJS + ESM compat default export
79
+ export default AgentShield;