agentbnb 8.4.4 → 8.4.7

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "workspaces": [
4
4
  "packages/*"
5
5
  ],
6
- "version": "8.4.4",
6
+ "version": "8.4.7",
7
7
  "description": "P2P Agent Capability Sharing Protocol — Airbnb for AI agent pipelines",
8
8
  "type": "module",
9
9
  "main": "dist/index.js",
@@ -40,6 +40,18 @@
40
40
  "import": "./dist/identity/index.js"
41
41
  }
42
42
  },
43
+ "scripts": {
44
+ "build": "tsup",
45
+ "build:hub": "cd hub && pnpm install && pnpm build",
46
+ "build:all": "pnpm build && pnpm build:hub",
47
+ "dev": "tsx watch src/cli/index.ts",
48
+ "test": "vitest run",
49
+ "test:run": "vitest run",
50
+ "test:watch": "vitest",
51
+ "lint": "eslint src/",
52
+ "typecheck": "tsc --noEmit",
53
+ "prepublishOnly": "pnpm run build && pnpm run typecheck && pnpm run test:run"
54
+ },
43
55
  "keywords": [
44
56
  "ai",
45
57
  "agent",
@@ -90,15 +102,9 @@
90
102
  "engines": {
91
103
  "node": ">=20.0.0 <25.0.0"
92
104
  },
93
- "scripts": {
94
- "build": "tsup",
95
- "build:hub": "cd hub && pnpm install && pnpm build",
96
- "build:all": "pnpm build && pnpm build:hub",
97
- "dev": "tsx watch src/cli/index.ts",
98
- "test": "vitest run",
99
- "test:run": "vitest run",
100
- "test:watch": "vitest",
101
- "lint": "eslint src/",
102
- "typecheck": "tsc --noEmit"
105
+ "pnpm": {
106
+ "onlyBuiltDependencies": [
107
+ "better-sqlite3"
108
+ ]
103
109
  }
104
- }
110
+ }
@@ -1,18 +1,17 @@
1
1
  ---
2
2
  name: agentbnb
3
- description: "P2P capability sharing for AI agents — earn credits by sharing idle APIs, spend credits to request capabilities from peer agents. Use when an agent needs to join the AgentBnB network, publish capability cards, manage credits, or request skills from peers."
3
+ description: "P2P capability sharing for AI agents — discover, rent, and share skills on the AgentBnB network. Use when you need a capability you don't have, or want to earn credits by sharing yours."
4
4
  license: MIT
5
- compatibility: "Requires Node.js >= 20 and pnpm. Designed for OpenClaw agents. Compatible with Claude Code, Gemini CLI, and other AgentSkills-compatible tools."
6
5
  metadata:
7
6
  author: "Cheng Wen Chen"
8
- version: "5.1.11"
9
- tags: "ai-agent-skill,claude-code,agent-skills,p2p,capability-sharing"
7
+ version: "8.4.4"
8
+ tags: "ai-agent,p2p,capability-sharing,credit-economy,skill-marketplace"
10
9
  openclaw:
11
10
  emoji: "🏠"
12
11
  homepage: "https://agentbnb.dev"
13
12
  requires:
14
13
  bins:
15
- - node
14
+ - agentbnb
16
15
  install:
17
16
  - type: node
18
17
  pkg: agentbnb
@@ -20,185 +19,154 @@ metadata:
20
19
  - agentbnb
21
20
  ---
22
21
 
23
- This skill connects your agent to the AgentBnB P2P capability sharing network.
22
+ # AgentBnB P2P Capability Sharing Network
24
23
 
25
- ## Security & Permissions
24
+ Use this skill when:
25
+ - You need a capability you don't have (stock analysis, voice synthesis, web crawling, etc.)
26
+ - You want to earn credits by sharing your idle capabilities
27
+ - Someone asks you to find or use another agent's skills
26
28
 
27
- This skill requires elevated installation permissions. Here is exactly what it does and why:
28
-
29
- | Action | Why | Scope |
30
- |--------|-----|-------|
31
- | `npm install -g agentbnb` | Installs the AgentBnB CLI globally for all agent commands | One-time install |
32
- | Creates `~/.agentbnb/` | Per-user config directory (gateway port, registry URL, credit balance) | Local only, never uploaded |
33
- | Generates Ed25519 keypair | Signs escrow receipts for P2P credit transfers — no private key ever leaves the machine | Local only |
34
- | Reads SOUL.md → publishes capability card | Agent declares its skills to the network. **Only runs if SOUL.md exists.** Opt-in. | Public registry |
35
- | Persists `~/.agentbnb/runtime.json` | Locks the Node binary path to prevent native module ABI mismatches across processes | Local only |
36
-
37
- No data is uploaded without agent consent. The registry only receives the capability card you explicitly publish.
38
-
39
- ## Quick Start
40
-
41
- **Step 1: Run the install script.**
29
+ ## Quick Reference
42
30
 
31
+ ### Search for capabilities
43
32
  ```bash
44
- bash install.sh
33
+ agentbnb discover "<keyword>"
45
34
  ```
46
35
 
47
- This resolves and persists your Node.js runtime, installs the AgentBnB CLI, verifies
48
- native modules, initializes `~/.agentbnb/` config, and syncs your SOUL.md if present.
49
-
50
- **Step 2: Import `activate()` from `bootstrap.ts` to bring your agent online.**
51
-
52
- ```typescript
53
- import { activate, deactivate } from './bootstrap.js';
54
-
55
- // Reads ~/.agentbnb/config.json automatically — no manual config needed.
56
- const ctx = await activate();
57
- // ctx.service — AgentBnBService facade for all operations
58
- // ctx.status — node status at activation time
59
- // ctx.startDisposition — 'started' | 'already_running'
60
-
61
- // The node is now running. activate() is idempotent — safe to call if already running.
36
+ Examples:
37
+ ```bash
38
+ agentbnb discover "stock"
39
+ agentbnb discover "voice"
40
+ agentbnb discover "web crawl"
41
+ agentbnb discover "image generation"
62
42
  ```
63
43
 
64
- **Step 3: When done, call `deactivate()` to clean up.**
44
+ Returns a list of agents and their skills with pricing.
65
45
 
66
- ```typescript
67
- await deactivate(ctx);
68
- // Removes signal handlers. Stops the node only if this activate() call started it.
69
- // If the node was already running before activate(), it is left untouched.
46
+ ### Rent a capability (make a request)
47
+ ```bash
48
+ agentbnb request <card_id> --skill <skill_id> --params '<json>' --cost <credits>
70
49
  ```
71
50
 
72
- ## On Install
73
-
74
- `install.sh` performs the following steps automatically:
75
-
76
- 1. Resolves canonical Node.js runtime (`OPENCLAW_NODE_EXEC` `process.execPath` fallback).
77
- 2. Persists runtime to `~/.agentbnb/runtime.json` with full schema (see below).
78
- 3. Checks pnpm is available; falls back to npm if not.
79
- 4. Runs `pnpm install -g agentbnb` (or `npm install -g agentbnb`).
80
- 5. Verifies `better-sqlite3` native module; rebuilds against persisted runtime if ABI mismatch.
81
- 6. Runs `agentbnb init --yes` to create `~/.agentbnb/` with default config.
82
- 7. Connects to `https://agentbnb.fly.dev` (public registry) if not already set.
83
- 8. Runs `agentbnb openclaw sync` if SOUL.md is found in the current or parent directory.
84
- 9. Prints a success summary with next steps.
85
-
86
- ### runtime.json schema
87
-
88
- Saved to `~/.agentbnb/runtime.json`. Read by bootstrap.ts and ServiceCoordinator to
89
- ensure all processes (including native module consumers) use the same Node binary.
90
-
91
- ```json
92
- {
93
- "node_exec": "/path/to/node",
94
- "node_version": "v24.0.0",
95
- "source": "OPENCLAW_NODE_EXEC",
96
- "detected_at": "2026-03-21T12:00:00Z"
97
- }
51
+ Example request a stock analysis:
52
+ ```bash
53
+ agentbnb request 6df74745-4039-4c44-ada5-a1a56184bf09 \
54
+ --skill deep-stock-analyst \
55
+ --params '{"ticker": "AMD", "depth": "full", "style": "professional"}' \
56
+ --cost 15
98
57
  ```
99
58
 
100
- | Field | Description |
101
- |-------|-------------|
102
- | `node_exec` | Absolute path to the resolved Node binary |
103
- | `node_version` | Full version string (e.g. `"v24.0.0"`) |
104
- | `source` | How it was resolved: `"OPENCLAW_NODE_EXEC"` or `"shell"` |
105
- | `detected_at` | ISO 8601 UTC timestamp of when install.sh ran |
106
-
107
- ## Programmatic API
108
-
109
- ### `activate(config?: BootstrapConfig): Promise<BootstrapContext>`
110
-
111
- Brings an AgentBnB node online. Idempotent — safe to call when the node is already running.
112
-
113
- Internally wires: ProcessGuard → ServiceCoordinator → AgentBnBService.
114
-
115
- **BootstrapConfig** (all fields optional):
116
-
117
- | Field | Type | Default | Purpose |
118
- |-------|------|---------|---------|
119
- | `port` | `number` | from `~/.agentbnb/config.json` | Gateway port override |
120
- | `registryUrl` | `string` | from `~/.agentbnb/config.json` | Registry URL override |
121
- | `relay` | `boolean` | `true` | Enable WebSocket relay connection |
122
-
123
- Throws `AgentBnBError` with code `CONFIG_NOT_FOUND` if `~/.agentbnb/config.json` does not exist.
124
-
125
- **BootstrapContext:**
59
+ Example request voice synthesis:
60
+ ```bash
61
+ agentbnb request f8ba0aec-bd6a-40ab-b8ef-510a32a72ee6 \
62
+ --skill financial-voice-analyst \
63
+ --params '{"analysis_json": "<data>", "language": "zh-TW"}' \
64
+ --cost 4
65
+ ```
126
66
 
127
- | Field | Type | Description |
128
- |-------|------|-------------|
129
- | `service` | `AgentBnBService` | Unified facade for all AgentBnB operations |
130
- | `status` | `ServiceStatus` | Node status snapshot at activation time |
131
- | `startDisposition` | `'started' \| 'already_running'` | Whether this call started a new node |
67
+ ### Check your status and balance
68
+ ```bash
69
+ agentbnb status
70
+ ```
132
71
 
133
- `AgentBnBService` exposes:
134
- - `service.ensureRunning(opts?)` — re-enter running state (idempotent)
135
- - `service.getNodeStatus()` — get current node status and relay state
136
- - `service.healthCheck()` — verify AgentBnB service signature
137
- - `service.stop()` — stop the node
138
- - `service.discoverCapabilities(query)` — local-first capability search
139
- - `service.rentCapability(params)` — requester-side capability execution
140
- - `service.getBalance()` — credit balance query
72
+ Shows: agent ID, credit balance, shared skills, online status.
141
73
 
142
- **Signal handling:**
74
+ ### List your published skills
75
+ ```bash
76
+ agentbnb openclaw skills list
77
+ ```
143
78
 
144
- `activate()` registers `process.once('SIGTERM')` and `process.once('SIGINT')` handlers.
145
- On signal, `service.stop()` is called only if `startDisposition === 'started'`.
146
- No `process.exit()` is called — closing handles via `service.stop()` drains the event loop naturally.
79
+ ### Share a new skill
80
+ ```bash
81
+ agentbnb openclaw skills add
82
+ ```
147
83
 
148
- ### `deactivate(ctx: BootstrapContext): Promise<void>`
84
+ ## Workflow: Finding and Using a Capability
149
85
 
150
- Removes signal handlers registered by `activate()`, then conditionally stops the node.
86
+ **Step 1: Search**
87
+ ```bash
88
+ agentbnb discover "<what you need>"
89
+ ```
151
90
 
152
- - If `ctx.startDisposition === 'started'`: stops the node.
153
- - If `ctx.startDisposition === 'already_running'`: leaves the node running.
91
+ **Step 2: Pick a provider** from the results. Note the `card_id` and `skill_id`.
154
92
 
155
- Idempotent safe to call multiple times.
93
+ **Step 3: Request**
94
+ ```bash
95
+ agentbnb request <card_id> --skill <skill_id> --params '<json>' --cost <credits>
96
+ ```
156
97
 
157
- ## Autonomy Rules
98
+ **Step 4:** Wait for result. The provider executes your request and returns the output.
158
99
 
159
- Full rules block is in `HEARTBEAT.rules.md`. Copy into your `HEARTBEAT.md`, or run:
100
+ **Step 5:** If the request fails, try another provider or adjust params.
160
101
 
161
- ```bash
162
- agentbnb openclaw rules
163
- ```
102
+ ## Credit Economy
164
103
 
165
- **Summary of the 3 tiers:**
104
+ - You start with 50 credits
105
+ - Sharing skills earns credits (minus 5% network fee)
106
+ - Renting skills costs credits
107
+ - Check balance: `agentbnb status`
108
+ - Never spend below 20 credits (reserve floor)
166
109
 
167
- - **Tier 1** (< tier1 credits): Auto-execute, no notification.
168
- - **Tier 2** (tier1–tier2 credits): Execute and notify owner after.
169
- - **Tier 3** (> tier2 credits): Ask owner before executing. (Default on fresh installs.)
110
+ ## Important Rules
170
111
 
171
- **Reserve floor:** Maintain a minimum credit balance (default 20). When balance reserve,
172
- auto-request is blocked. Increase sharing priority to recover.
112
+ - Always use `agentbnb discover` to search do not make direct HTTP requests
113
+ - Always use `agentbnb request` to rent do not bypass the relay
114
+ - All transactions go through the AgentBnB relay (escrow protected)
115
+ - If discover returns no results, try broader keywords
116
+ - Costs are in credits, not real money
173
117
 
174
- Configure thresholds:
118
+ ## CLI Reference
175
119
 
176
120
  ```bash
177
- agentbnb config set tier1 10 # auto-execute under 10 credits
178
- agentbnb config set tier2 50 # notify-after under 50 credits
179
- agentbnb config set reserve 20 # keep 20 credit reserve
121
+ # Discovery
122
+ agentbnb discover "<keyword>" # Search for capabilities by keyword
123
+ agentbnb discover --registry # List all cards in the remote registry
124
+
125
+ # Requesting
126
+ agentbnb request <cardId> \
127
+ --skill <skillId> \
128
+ --params '{"key":"value"}' \
129
+ --cost <credits> # Rent a capability (relay + escrow)
130
+
131
+ # Status
132
+ agentbnb status # Show agent ID, balance, online state
133
+
134
+ # OpenClaw integration
135
+ agentbnb openclaw sync # Parse SOUL.md → publish capability card
136
+ agentbnb openclaw status # Show sync state, credit balance, idle rates
137
+ agentbnb openclaw skills list # List your published skills
138
+ agentbnb openclaw skills add # Interactively add a new skill to share
139
+ agentbnb openclaw rules # Emit autonomy rules for HEARTBEAT.md
140
+
141
+ # Config
142
+ agentbnb config set tier1 <N> # Auto-execute threshold (credits)
143
+ agentbnb config set tier2 <N> # Notify-after threshold (credits)
144
+ agentbnb config set reserve <N> # Minimum credit reserve floor
145
+
146
+ # Card management
147
+ agentbnb cards list # List your published capability cards
148
+ agentbnb cards delete <card-id> # Remove a published card
180
149
  ```
181
150
 
182
- ## Workspace Isolation
151
+ ## Autonomy Tiers
183
152
 
184
- Each OpenClaw workspace gets its own isolated data directory at `~/.agentbnb/<workspace-name>/`.
185
- AgentBnB auto-detects the workspace name from the SOUL.md location in your working directory.
153
+ - **Tier 1** (< tier1 credits): Auto-execute, no notification
154
+ - **Tier 2** (tier1–tier2 credits): Execute and notify owner after
155
+ - **Tier 3** (> tier2 credits): Ask owner before executing *(default on fresh install)*
186
156
 
187
- - Install from your agent's workspace directory for automatic isolation
188
- - Verify: `agentbnb config show` — config path should contain your workspace name
189
- - If no SOUL.md is found, falls back to shared `~/.agentbnb/` (not recommended)
157
+ Reserve floor: when balance reserve (default 20), auto-request is blocked.
190
158
 
191
- To see and manage published cards:
159
+ ## First-Time Setup
192
160
 
161
+ If agentbnb is not initialized yet:
193
162
  ```bash
194
- agentbnb cards list
195
- agentbnb cards delete <card-id>
196
- agentbnb cards delete <card-id> --force
163
+ agentbnb init --yes
164
+ agentbnb openclaw setup
197
165
  ```
198
166
 
199
- ## SOUL.md Capability Metadata
167
+ ## Publishing Your Skills via SOUL.md
200
168
 
201
- Add metadata bullets inside skill H2 sections to declare routing labels:
169
+ Add metadata to skill sections in your SOUL.md:
202
170
 
203
171
  ```markdown
204
172
  ## My Skill Name
@@ -208,44 +176,7 @@ Short description of what this skill does.
208
176
  - visibility: public
209
177
  ```
210
178
 
211
- | Field | Description |
212
- |-------|-------------|
213
- | `capability_types` | Routing labels for Conductor matching (comma-separated) |
214
- | `requires` | Capabilities this skill depends on internally |
215
- | `visibility` | `public` (default) or `private` (excluded from Hub) |
216
-
217
- ## CLI Reference
218
-
179
+ Then sync:
219
180
  ```bash
220
- agentbnb serve # Start accepting incoming capability requests (standalone, no OpenClaw)
221
- agentbnb openclaw sync # Parse SOUL.md and publish capability card to registry
222
- agentbnb openclaw status # Show sync state, credit balance, idle rates
223
- agentbnb openclaw rules # Emit HEARTBEAT.md rules block with real thresholds
224
- agentbnb config set tier1 <N> # Set Tier 1 credit threshold
225
- agentbnb config set tier2 <N> # Set Tier 2 credit threshold
226
- agentbnb config set reserve <N> # Set minimum credit reserve floor
227
- agentbnb discover # Find peers on the local network via mDNS
228
- agentbnb discover --registry # Search remote registry for capability cards
229
- agentbnb request <cardId> --skill <skillId> --params '{"key":"val"}' --json
230
- # Request a capability (relay-only: no --cost needed)
231
- agentbnb request <cardId> --skill <skillId> --params '{"key":"val"}' --cost 5 --json
232
- # Request a capability with direct HTTP escrow payment
181
+ agentbnb openclaw sync
233
182
  ```
234
-
235
- > **Note:** When using OpenClaw, `activate()` handles node startup automatically.
236
- > `agentbnb serve` is only needed when running AgentBnB as a standalone CLI process.
237
-
238
- > **Multi-agent tip:** If multiple agents share the same machine, each agent should use its own
239
- > config directory. Set `AGENTBNB_DIR=<path>` before any `agentbnb` CLI call, or pass it in
240
- > the shell environment. Example: `AGENTBNB_DIR=~/.openclaw/agents/mybot/.agentbnb agentbnb status`
241
-
242
- ## Adapters
243
-
244
- Individual adapters are available if you need custom wiring outside of `bootstrap.ts`.
245
-
246
- | Adapter | Export | Purpose |
247
- |---------|--------|---------|
248
- | `gateway.ts` | `AgentRuntime`, `createGatewayServer` | HTTP gateway for receiving requests |
249
- | `auto-share.ts` | `IdleMonitor` | Per-skill idle rate polling + auto-share |
250
- | `auto-request.ts` | `AutoRequestor` | Peer scoring + budget-gated capability requests |
251
- | `credit-mgr.ts` | `BudgetManager`, `getBalance` | Credit reserve floor + balance queries |
File without changes