@rileycraig/plugin-x402-agentstore 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 (3) hide show
  1. package/README.md +45 -0
  2. package/dist/index.js +86 -0
  3. package/package.json +32 -0
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # @rileycraig/plugin-x402-agentstore
2
+
3
+ **Put paid AI data tools inside any ElizaOS agent.** This plugin gives ElizaOS agents native actions that call the [x402 Agent Store](https://store.agentexchange.work) and pay per request in USDC via [x402](https://www.x402.org) — no API keys, no subscriptions.
4
+
5
+ This is how high-volume x402 services actually get called: not by being listed in a registry, but by being a **pre-installed tool inside the agents people run.** (BlockRun gets its volume by being ClawRouter inside OpenClaw; this puts our tools inside ElizaOS the same way.)
6
+
7
+ ## Actions
8
+
9
+ | Action | What it does | Price |
10
+ |---|---|---|
11
+ | `AI_VISIBILITY_CHECK` | Does AI recommend a brand/token? Score 0–100 + who AI names instead | free teaser / $0.95 full |
12
+ | `DEX_TOKEN_DATA` | Live DEX price, volume, liquidity, buy/sell flow for any token | $0.002 |
13
+ | `AI_CATEGORY_RANKING` | Who AI recommends across a whole category, ranked | $0.02 |
14
+ | `COUNTRY_ECONOMICS` | GDP, inflation, unemployment for 200+ countries | $0.005 |
15
+
16
+ Paid calls settle from the agent's own x402 wallet on Base. Free teasers work with no payment.
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ npm install @rileycraig/plugin-x402-agentstore
22
+ ```
23
+
24
+ ```ts
25
+ import { x402AgentStorePlugin } from "@rileycraig/plugin-x402-agentstore";
26
+
27
+ // add to your ElizaOS character / runtime plugins:
28
+ plugins: [x402AgentStorePlugin]
29
+ ```
30
+
31
+ ## Build & publish
32
+
33
+ ```bash
34
+ npm install
35
+ npm run build
36
+ npm publish --access public
37
+ # then submit to the ElizaOS plugin registry so every ElizaOS agent can discover it
38
+ ```
39
+
40
+ ## Why
41
+ The agent economy runs on agents calling tools inside their frameworks. This plugin makes the x402 Agent Store's unique data — especially **AI-visibility** (does AI recommend you?), which nothing else offers — a one-line install for the entire ElizaOS ecosystem.
42
+
43
+ - Store: https://store.agentexchange.work · Free samples: https://store.agentexchange.work/samples
44
+ - MCP (Claude/Cursor/Windsurf): https://store.agentexchange.work/mcp
45
+ - License: MIT
package/dist/index.js ADDED
@@ -0,0 +1,86 @@
1
+ // src/index.ts
2
+ var STORE = "https://store.agentexchange.work";
3
+ async function callStore(runtime, path) {
4
+ const f = runtime.fetch || fetch;
5
+ const res = await f(STORE + path, { headers: { accept: "application/json" } });
6
+ if (res.status === 402) {
7
+ let req = null;
8
+ try {
9
+ req = await res.json();
10
+ } catch {
11
+ }
12
+ return { payment_required: true, how: "Settle the x402 USDC payment on Base and retry with the X-PAYMENT header.", requirements: req };
13
+ }
14
+ return res.json();
15
+ }
16
+ var aiVisibility = {
17
+ name: "AI_VISIBILITY_CHECK",
18
+ similes: ["DOES_AI_RECOMMEND", "BRAND_VISIBILITY", "GEO_CHECK", "AI_REPUTATION"],
19
+ description: "Check whether AI assistants (ChatGPT/Perplexity/Gemini) recommend a brand or token in its category. Returns a 0-100 AI-visibility score, mention rate, and which competitors AI names instead. Free teaser via /score; full audit via paid /brands/check.",
20
+ validate: async () => true,
21
+ handler: async (runtime, message, _state, _o, callback) => {
22
+ var _a;
23
+ const text = (((_a = message == null ? void 0 : message.content) == null ? void 0 : _a.text) || "").trim();
24
+ const m = text.match(/(.+?)\s+(?:in|for)\s+(.+)/i);
25
+ const brand = ((m == null ? void 0 : m[1]) || text).replace(/^(check|is|does ai recommend)\s+/i, "").trim();
26
+ const category = ((m == null ? void 0 : m[2]) || "its category").trim();
27
+ const data = await callStore(runtime, `/score?brand=${encodeURIComponent(brand)}&category=${encodeURIComponent(category)}`);
28
+ if (callback) callback({ text: `AI-visibility for ${brand}: ${JSON.stringify(data)}`, content: data });
29
+ return true;
30
+ },
31
+ examples: []
32
+ };
33
+ var dexToken = {
34
+ name: "DEX_TOKEN_DATA",
35
+ similes: ["TOKEN_PRICE", "CRYPTO_DEX", "TOKEN_LIQUIDITY", "TOKEN_VOLUME"],
36
+ description: "Live decentralized-exchange data for any token (price, 24h volume, liquidity, buy/sell flow, momentum) across every chain. Paid per call ($0.002) via x402.",
37
+ validate: async () => true,
38
+ handler: async (runtime, message, _state, _o, callback) => {
39
+ var _a;
40
+ const q = (((_a = message == null ? void 0 : message.content) == null ? void 0 : _a.text) || "").replace(/^(price|token|dex)\s+(of\s+)?/i, "").trim();
41
+ const data = await callStore(runtime, `/crypto/dex?q=${encodeURIComponent(q)}`);
42
+ if (callback) callback({ text: `DEX data for ${q}: ${JSON.stringify(data)}`, content: data });
43
+ return true;
44
+ },
45
+ examples: []
46
+ };
47
+ var categoryRanking = {
48
+ name: "AI_CATEGORY_RANKING",
49
+ similes: ["WHO_DOES_AI_RECOMMEND", "CATEGORY_LEADERBOARD", "BEST_IN_CATEGORY"],
50
+ description: "Ask which brands AI recommends across a whole category right now, ranked by mention share. Paid per call ($0.02) via x402.",
51
+ validate: async () => true,
52
+ handler: async (runtime, message, _state, _o, callback) => {
53
+ var _a;
54
+ const category = (((_a = message == null ? void 0 : message.content) == null ? void 0 : _a.text) || "").replace(/^(who does ai recommend (for|in)|best|ranking for)\s+/i, "").trim();
55
+ const data = await callStore(runtime, `/category/ranking?category=${encodeURIComponent(category)}`);
56
+ if (callback) callback({ text: `AI category ranking for ${category}: ${JSON.stringify(data)}`, content: data });
57
+ return true;
58
+ },
59
+ examples: []
60
+ };
61
+ var countryEconomics = {
62
+ name: "COUNTRY_ECONOMICS",
63
+ similes: ["GDP", "INFLATION", "MACRO_DATA", "COUNTRY_FINANCE"],
64
+ description: "Economic indicators (GDP, growth, inflation, unemployment, GDP/capita, population) for 200+ countries. Paid per call ($0.005) via x402.",
65
+ validate: async () => true,
66
+ handler: async (runtime, message, _state, _o, callback) => {
67
+ var _a;
68
+ const country = (((_a = message == null ? void 0 : message.content) == null ? void 0 : _a.text) || "USA").replace(/[^A-Za-z ]/g, "").trim().slice(0, 40) || "USA";
69
+ const data = await callStore(runtime, `/macro/country?country=${encodeURIComponent(country)}`);
70
+ if (callback) callback({ text: `Economic indicators for ${country}: ${JSON.stringify(data)}`, content: data });
71
+ return true;
72
+ },
73
+ examples: []
74
+ };
75
+ var x402AgentStorePlugin = {
76
+ name: "x402-agentstore",
77
+ description: "x402 Agent Store data tools for ElizaOS: AI-visibility/GEO, live DEX token data, AI category rankings, prediction-market odds, and country economics \u2014 pay-per-call in USDC via x402, no API keys.",
78
+ actions: [aiVisibility, dexToken, categoryRanking, countryEconomics],
79
+ providers: [],
80
+ evaluators: []
81
+ };
82
+ var index_default = x402AgentStorePlugin;
83
+ export {
84
+ index_default as default,
85
+ x402AgentStorePlugin
86
+ };
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@rileycraig/plugin-x402-agentstore",
3
+ "version": "1.0.0",
4
+ "description": "ElizaOS plugin: x402 Agent Store data tools — AI-visibility/GEO, live DEX token data, AI category rankings, prediction-market odds, country economics. Pay-per-call in USDC via x402, no API keys.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": ["dist"],
16
+ "scripts": {
17
+ "build": "tsup src/index.ts --format esm --clean"
18
+ },
19
+ "peerDependencies": {
20
+ "@elizaos/core": "*"
21
+ },
22
+ "devDependencies": {
23
+ "tsup": "^8.0.0",
24
+ "typescript": "^5.4.0"
25
+ },
26
+ "keywords": ["elizaos", "elizaos-plugin", "x402", "ai-visibility", "geo", "crypto", "dex", "agent", "base", "usdc"],
27
+ "author": "Riley Craig <rileycraig14@gmail.com>",
28
+ "license": "MIT",
29
+ "agentConfig": {
30
+ "pluginType": "elizaos:plugin:1.0.0"
31
+ }
32
+ }