@beggar-bot/elizaos 0.0.0-stage → 0.1.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 +11 -2
  2. package/package.json +34 -4
  3. package/src/index.js +49 -0
package/README.md CHANGED
@@ -1,3 +1,12 @@
1
- # Temporary Holding Version
1
+ # @beggar-bot/elizaos
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
+ ElizaOS plugin for Beggar Bot. Register `beggarBotPlugin({ signer })` in your character's `plugins` list. Each action calls a paid route at $0.02 USDC; the **buyer's** signer is required (pass it in, or set `BEGGAR_BOT_SIGNER` in your host — a raw key is never read from env by this package; supply a signer object from your runtime).
4
+
5
+ ```js
6
+ import { beggarBotPlugin } from "@beggar-bot/elizaos";
7
+
8
+ export const plugin = beggarBotPlugin({ signer });
9
+ // plugin.name, plugin.actions, plugin.description
10
+ ```
11
+
12
+ This package does not import `@elizaos/core` (optional peer). Actions follow the public `{ name, description, validate, handler, similes }` shape and return `{ success, text, data }`.
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "@beggar-bot/elizaos",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "ElizaOS plugin for Beggar Bot ($0.02 x402 on Base, buyer's wallet).",
5
+ "type": "module",
6
+ "main": "src/index.js",
7
+ "exports": {
8
+ ".": "./src/index.js"
9
+ },
10
+ "files": [
11
+ "src"
12
+ ],
13
+ "license": "MIT",
14
+ "dependencies": {
15
+ "@beggar-bot/x402-client": "0.1.0"
16
+ },
17
+ "engines": {
18
+ "node": ">=20"
19
+ },
20
+ "author": {
21
+ "name": "Beggar Bot",
22
+ "email": "beggarbot@mail.grokbot.com"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/beggar-bot-x402/beggar-bot-connectors.git",
30
+ "directory": "packages/elizaos"
31
+ },
32
+ "homepage": "https://github.com/beggar-bot-x402/beggar-bot-connectors/tree/main/packages/elizaos",
33
+ "bugs": {
34
+ "url": "https://github.com/beggar-bot-x402/beggar-bot-connectors/issues"
35
+ }
36
+ }
package/src/index.js ADDED
@@ -0,0 +1,49 @@
1
+ import { asSigner, callCatalog, paidRequest, CATALOG } from "@beggar-bot/x402-client";
2
+
3
+ export function beggarBotPlugin(opts = {}) {
4
+ const signer = asSigner(opts.signer);
5
+ const common = { ...opts, signer };
6
+ const actions = CATALOG.map((entry) => ({
7
+ name: `BEGGAR_${entry.name.toUpperCase()}`,
8
+ similes: [entry.name, entry.name.replace(/_/g, " ")],
9
+ description: entry.description,
10
+ validate: async () => true,
11
+ handler: async (_runtime, _message, _state, options = {}, callback) => {
12
+ try {
13
+ const args = { ...(options || {}) };
14
+ const result = await callCatalog(entry.name, args, common);
15
+ const text = JSON.stringify(result.data);
16
+ const out = { success: result.ok, text, data: result.data, values: { tx: result.payment?.transaction || null } };
17
+ if (callback) await callback({ text, actions: [`BEGGAR_${entry.name.toUpperCase()}`] });
18
+ return out;
19
+ } catch (err) {
20
+ return { success: false, text: err.message, error: err };
21
+ }
22
+ },
23
+ }));
24
+ actions.push({
25
+ name: "BEGGAR_CALL_ENDPOINT",
26
+ similes: ["call_endpoint", "beggar bot"],
27
+ description: "Call any Beggar Bot path (600+ routes) at $0.02 USDC via x402. Pass path and optional query.",
28
+ validate: async () => true,
29
+ handler: async (_runtime, _message, _state, options = {}, callback) => {
30
+ try {
31
+ const result = await paidRequest(options.path, { ...common, method: "GET", query: options.query });
32
+ const text = JSON.stringify(result.data);
33
+ if (callback) await callback({ text, actions: ["BEGGAR_CALL_ENDPOINT"] });
34
+ return { success: result.ok, text, data: result.data };
35
+ } catch (err) {
36
+ return { success: false, text: err.message, error: err };
37
+ }
38
+ },
39
+ });
40
+ return {
41
+ name: "beggar-bot",
42
+ description: "Pay-per-call Beggar Bot APIs at $0.02 USDC on Base via x402, signed by the buyer's wallet.",
43
+ actions,
44
+ };
45
+ }
46
+
47
+ export function createBeggarBotPlugin(opts) {
48
+ return beggarBotPlugin(opts);
49
+ }