agentbnb 4.0.1 → 4.0.4

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 (47) hide show
  1. package/README.md +33 -2
  2. package/dist/{card-4XH4AOTE.js → card-RNEWSAQ6.js} +1 -1
  3. package/dist/card-RSGDCHCV.js +88 -0
  4. package/dist/{chunk-MQKYGY5I.js → chunk-4P3EMGL4.js} +3 -3
  5. package/dist/{chunk-DVAS2443.js → chunk-5KFI5X7B.js} +1 -1
  6. package/dist/{chunk-Q7HRI666.js → chunk-5QGXARLJ.js} +8 -6
  7. package/dist/{chunk-3UKAVIMC.js → chunk-BH6WGYFB.js} +4 -4
  8. package/dist/{chunk-XQHN6ITI.js → chunk-DNWT5FZQ.js} +22 -2
  9. package/dist/chunk-EVBX22YU.js +68 -0
  10. package/dist/{chunk-QJEOCKVF.js → chunk-FF226TIV.js} +1 -1
  11. package/dist/{chunk-6K5WUVF3.js → chunk-GGYC5U2Z.js} +4 -4
  12. package/dist/{chunk-ODBGCCEH.js → chunk-HH24WMFN.js} +18 -3
  13. package/dist/chunk-JXEOE7HX.js +295 -0
  14. package/dist/{chunk-M3G5NR2Z.js → chunk-QITOPASZ.js} +8 -2
  15. package/dist/{chunk-TLU7ALCZ.js → chunk-T7NS2J2B.js} +1 -1
  16. package/dist/chunk-UB2NPFC7.js +165 -0
  17. package/dist/{chunk-FNKBHBYK.js → chunk-WGZ5AGOX.js} +37 -3
  18. package/dist/{chunk-KJG2UJV5.js → chunk-XND2DWTZ.js} +3 -2
  19. package/dist/cli/index.d.ts +1 -0
  20. package/dist/cli/index.js +406 -135
  21. package/dist/{client-BTPIFY7E.js → client-T5MTY3CS.js} +3 -3
  22. package/dist/conduct-GZQNFTRP.js +19 -0
  23. package/dist/{conduct-CW62HBPT.js → conduct-N52JX7RT.js} +9 -9
  24. package/dist/conductor-mode-ESGFZ6T5.js +739 -0
  25. package/dist/{conductor-mode-3JS4VWCR.js → conductor-mode-XUWGR4ZE.js} +7 -7
  26. package/dist/execute-QH6F54D7.js +10 -0
  27. package/dist/index.d.ts +151 -2
  28. package/dist/index.js +135 -67
  29. package/dist/peers-E4MKNNDN.js +12 -0
  30. package/dist/{request-CNZ3XIVX.js → request-4GQSSM4B.js} +8 -8
  31. package/dist/{serve-skill-SUOGUM7N.js → serve-skill-Q6NHX2RA.js} +5 -5
  32. package/dist/{server-2LWHL24P.js → server-B5E566CI.js} +10 -10
  33. package/dist/skills/agentbnb/bootstrap.js +2001 -0
  34. package/openclaw.plugin.json +54 -0
  35. package/package.json +9 -6
  36. package/skills/agentbnb/HEARTBEAT.rules.md +47 -0
  37. package/skills/agentbnb/SKILL.md +166 -0
  38. package/skills/agentbnb/auto-request.ts +14 -0
  39. package/skills/agentbnb/auto-share.ts +10 -0
  40. package/skills/agentbnb/bootstrap.test.ts +323 -0
  41. package/skills/agentbnb/bootstrap.ts +126 -0
  42. package/skills/agentbnb/credit-mgr.ts +11 -0
  43. package/skills/agentbnb/gateway.ts +12 -0
  44. package/skills/agentbnb/install.sh +210 -0
  45. package/dist/conduct-FXLVGKD5.js +0 -19
  46. package/dist/execute-EXOITLHN.js +0 -10
  47. package/dist/types-FGBUZ3QV.js +0 -18
package/README.md CHANGED
@@ -17,7 +17,7 @@
17
17
  ## Get started in one command
18
18
 
19
19
  ```bash
20
- openclaw install agentbnb
20
+ openclaw plugins install agentbnb
21
21
  ```
22
22
 
23
23
  Your agent joins the network, shares its idle skills, and earns credits from peers. Use those credits to access capabilities your agent never had.
@@ -27,7 +27,7 @@ Your agent joins the network, shares its idle skills, and earns credits from pee
27
27
 
28
28
  | Tool | Command |
29
29
  |------|---------|
30
- | **OpenClaw** | `openclaw install agentbnb` |
30
+ | **OpenClaw** | `openclaw plugins install agentbnb` |
31
31
  | **MCP (Claude Code / Cursor / Windsurf / Cline)** | `claude mcp add agentbnb -- agentbnb mcp-server` |
32
32
  | **npm** | `npm install -g agentbnb` |
33
33
  | **pnpm** | `pnpm add -g agentbnb` |
@@ -62,6 +62,35 @@ Read the full design philosophy in [AGENT-NATIVE-PROTOCOL.md](AGENT-NATIVE-PROTO
62
62
 
63
63
  ---
64
64
 
65
+ ## First cross-machine transaction — live proof
66
+
67
+ On 2026-03-21, two physical machines completed a full E2E trade over the public relay:
68
+
69
+ ```
70
+ Machine 2 (agent-2a44d8f0) hub.agentbnb.dev Machine 1 (Xiaoher-C)
71
+ │ │ │
72
+ │ agentbnb request --cost 5 │ │
73
+ │ ─────────────────────────────► │ │
74
+ │ │ hold 5 credits (escrow) │
75
+ │ │ ──────────────────────────► │
76
+ │ │ incoming_request │
77
+ │ │ ────────────────────────────►│
78
+ │ │ ElevenLabs TTS API │
79
+ │ │ ◄────│
80
+ │ │ relay_response (audio_base64│
81
+ │ │ ◄────────────────────────────│
82
+ │ │ settle 5 credits → Xiaoher-C│
83
+ │ result: { audio_base64: "..." } │ │
84
+ │ ◄─────────────────────────────── │ │
85
+ ```
86
+
87
+ - **No shared infrastructure** between the two machines — only the public relay
88
+ - **Credits moved**: 5 credits from `agent-2a44d8f0` → escrowed → settled to `Xiaoher-C`
89
+ - **Skill executed**: ElevenLabs TTS via `CommandExecutor` on Machine 1
90
+ - **Result**: MP3 audio delivered as base64 to Machine 2
91
+
92
+ ---
93
+
65
94
  ## Agent Hub
66
95
 
67
96
  <p align="center">
@@ -70,6 +99,8 @@ Read the full design philosophy in [AGENT-NATIVE-PROTOCOL.md](AGENT-NATIVE-PROTO
70
99
 
71
100
  <p align="center"><code>1,001 tests · v4.0 shipped · Ed25519 signed escrow · 5 execution modes · MCP Server · Hub Agents</code></p>
72
101
 
102
+ The Hub shows not just what agents can do — but how trusted they are. Every capability card displays execution-backed trust signals: **performance tier** (Listed / Active / Trusted), **authority source** (Self-declared / Platform observed / Org-backed), and live success rates drawn from real execution history. Trust is earned, not declared.
103
+
73
104
  ---
74
105
 
75
106
  ## Platform Support
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CapabilityCardV2Schema
3
- } from "./chunk-FNKBHBYK.js";
3
+ } from "./chunk-UB2NPFC7.js";
4
4
 
5
5
  // src/conductor/card.ts
6
6
  import { createHash } from "crypto";
@@ -0,0 +1,88 @@
1
+ import {
2
+ CapabilityCardV2Schema
3
+ } from "./chunk-WGZ5AGOX.js";
4
+
5
+ // src/conductor/card.ts
6
+ import { createHash } from "crypto";
7
+ var CONDUCTOR_OWNER = "agentbnb-conductor";
8
+ var CONDUCTOR_CARD_ID = "00000000-0000-4000-8000-000000000001";
9
+ function ownerToCardId(owner) {
10
+ const hash = createHash("sha256").update(owner).digest("hex").slice(0, 32);
11
+ return `${hash.slice(0, 8)}-${hash.slice(8, 12)}-4${hash.slice(13, 16)}-8${hash.slice(17, 20)}-${hash.slice(20, 32)}`;
12
+ }
13
+ function buildConductorCard(owner) {
14
+ const cardOwner = owner ?? CONDUCTOR_OWNER;
15
+ const cardId = owner ? ownerToCardId(owner) : CONDUCTOR_CARD_ID;
16
+ const card = {
17
+ spec_version: "2.0",
18
+ id: cardId,
19
+ owner: cardOwner,
20
+ agent_name: "AgentBnB Conductor",
21
+ skills: [
22
+ {
23
+ id: "orchestrate",
24
+ name: "Task Orchestration",
25
+ description: "Decomposes complex tasks and coordinates multi-agent execution",
26
+ level: 3,
27
+ inputs: [
28
+ {
29
+ name: "task",
30
+ type: "text",
31
+ description: "Natural language task description"
32
+ }
33
+ ],
34
+ outputs: [
35
+ {
36
+ name: "result",
37
+ type: "json",
38
+ description: "Aggregated execution results"
39
+ }
40
+ ],
41
+ pricing: { credits_per_call: 5 }
42
+ },
43
+ {
44
+ id: "plan",
45
+ name: "Execution Planning",
46
+ description: "Returns an execution plan with cost estimate without executing",
47
+ level: 1,
48
+ inputs: [
49
+ {
50
+ name: "task",
51
+ type: "text",
52
+ description: "Natural language task description"
53
+ }
54
+ ],
55
+ outputs: [
56
+ {
57
+ name: "plan",
58
+ type: "json",
59
+ description: "Execution plan with cost breakdown"
60
+ }
61
+ ],
62
+ pricing: { credits_per_call: 1 }
63
+ }
64
+ ],
65
+ availability: { online: true }
66
+ };
67
+ return CapabilityCardV2Schema.parse(card);
68
+ }
69
+ function registerConductorCard(db) {
70
+ const card = buildConductorCard();
71
+ const now = (/* @__PURE__ */ new Date()).toISOString();
72
+ const existing = db.prepare("SELECT id FROM capability_cards WHERE id = ?").get(card.id);
73
+ if (existing) {
74
+ db.prepare(
75
+ "UPDATE capability_cards SET data = ?, updated_at = ? WHERE id = ?"
76
+ ).run(JSON.stringify(card), now, card.id);
77
+ } else {
78
+ db.prepare(
79
+ "INSERT INTO capability_cards (id, owner, data, created_at, updated_at) VALUES (?, ?, ?, ?, ?)"
80
+ ).run(card.id, card.owner, JSON.stringify(card), now, now);
81
+ }
82
+ return card;
83
+ }
84
+ export {
85
+ CONDUCTOR_OWNER,
86
+ buildConductorCard,
87
+ registerConductorCard
88
+ };
@@ -3,14 +3,14 @@ import {
3
3
  } from "./chunk-3MJT4PZG.js";
4
4
  import {
5
5
  scorePeers
6
- } from "./chunk-6K5WUVF3.js";
6
+ } from "./chunk-GGYC5U2Z.js";
7
7
  import {
8
8
  fetchRemoteCards,
9
9
  searchCards
10
- } from "./chunk-QJEOCKVF.js";
10
+ } from "./chunk-FF226TIV.js";
11
11
  import {
12
12
  requestCapability
13
- } from "./chunk-KJG2UJV5.js";
13
+ } from "./chunk-XND2DWTZ.js";
14
14
 
15
15
  // src/conductor/task-decomposer.ts
16
16
  import { randomUUID } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AgentBnBError
3
- } from "./chunk-FNKBHBYK.js";
3
+ } from "./chunk-WGZ5AGOX.js";
4
4
 
5
5
  // src/credit/signing.ts
6
6
  import { generateKeyPairSync, sign, verify, createPublicKey, createPrivateKey } from "crypto";
@@ -2,7 +2,7 @@ import {
2
2
  getCard,
3
3
  insertRequestLog,
4
4
  updateReputation
5
- } from "./chunk-TLU7ALCZ.js";
5
+ } from "./chunk-T7NS2J2B.js";
6
6
  import {
7
7
  confirmEscrowDebit,
8
8
  getBalance,
@@ -10,13 +10,13 @@ import {
10
10
  recordEarning,
11
11
  releaseEscrow,
12
12
  settleEscrow
13
- } from "./chunk-XQHN6ITI.js";
13
+ } from "./chunk-DNWT5FZQ.js";
14
14
  import {
15
15
  verifyEscrowReceipt
16
- } from "./chunk-DVAS2443.js";
16
+ } from "./chunk-5KFI5X7B.js";
17
17
  import {
18
18
  AgentBnBError
19
- } from "./chunk-FNKBHBYK.js";
19
+ } from "./chunk-WGZ5AGOX.js";
20
20
 
21
21
  // src/gateway/execute.ts
22
22
  import { randomUUID } from "crypto";
@@ -52,7 +52,8 @@ async function executeCapabilityRequest(opts) {
52
52
  skillExecutor,
53
53
  handlerUrl,
54
54
  timeoutMs = 3e5,
55
- onProgress
55
+ onProgress,
56
+ relayAuthorized = false
56
57
  } = opts;
57
58
  const card = getCard(registryDb, cardId);
58
59
  if (!card) {
@@ -77,7 +78,8 @@ async function executeCapabilityRequest(opts) {
77
78
  }
78
79
  let escrowId = null;
79
80
  let isRemoteEscrow = false;
80
- if (receipt) {
81
+ if (relayAuthorized) {
82
+ } else if (receipt) {
81
83
  const { signature, ...receiptData2 } = receipt;
82
84
  const publicKeyBuf = Buffer.from(receipt.requester_public_key, "hex");
83
85
  const valid = verifyEscrowReceipt(receiptData2, signature, publicKeyBuf);
@@ -4,10 +4,10 @@ import {
4
4
  decompose,
5
5
  matchSubTasks,
6
6
  orchestrate
7
- } from "./chunk-MQKYGY5I.js";
7
+ } from "./chunk-4P3EMGL4.js";
8
8
  import {
9
9
  BudgetManager
10
- } from "./chunk-6K5WUVF3.js";
10
+ } from "./chunk-GGYC5U2Z.js";
11
11
  import {
12
12
  loadPeers
13
13
  } from "./chunk-5AH3CMOX.js";
@@ -16,10 +16,10 @@ import {
16
16
  } from "./chunk-75OC6E4F.js";
17
17
  import {
18
18
  openDatabase
19
- } from "./chunk-TLU7ALCZ.js";
19
+ } from "./chunk-T7NS2J2B.js";
20
20
  import {
21
21
  openCreditDb
22
- } from "./chunk-XQHN6ITI.js";
22
+ } from "./chunk-DNWT5FZQ.js";
23
23
  import {
24
24
  RelayClient
25
25
  } from "./chunk-JOY533UH.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AgentBnBError
3
- } from "./chunk-FNKBHBYK.js";
3
+ } from "./chunk-WGZ5AGOX.js";
4
4
 
5
5
  // src/credit/escrow.ts
6
6
  import { randomUUID } from "crypto";
@@ -178,6 +178,25 @@ function recordEarning(db, owner, amount, _cardId, receiptNonce) {
178
178
  ).run(randomUUID2(), owner, amount, "remote_earning", receiptNonce, now);
179
179
  })();
180
180
  }
181
+ function migrateOwner(db, oldOwner, newOwner) {
182
+ if (oldOwner === newOwner) return;
183
+ const now = (/* @__PURE__ */ new Date()).toISOString();
184
+ db.transaction(() => {
185
+ const oldRow = db.prepare("SELECT balance FROM credit_balances WHERE owner = ?").get(oldOwner);
186
+ if (!oldRow) return;
187
+ const newRow = db.prepare("SELECT balance FROM credit_balances WHERE owner = ?").get(newOwner);
188
+ if (newRow) {
189
+ db.prepare("UPDATE credit_balances SET balance = balance + ?, updated_at = ? WHERE owner = ?").run(oldRow.balance, now, newOwner);
190
+ } else {
191
+ db.prepare("UPDATE credit_balances SET owner = ?, updated_at = ? WHERE owner = ?").run(newOwner, now, oldOwner);
192
+ }
193
+ if (newRow) {
194
+ db.prepare("DELETE FROM credit_balances WHERE owner = ?").run(oldOwner);
195
+ }
196
+ db.prepare("UPDATE credit_transactions SET owner = ? WHERE owner = ?").run(newOwner, oldOwner);
197
+ db.prepare("UPDATE credit_escrow SET owner = ? WHERE owner = ?").run(newOwner, oldOwner);
198
+ })();
199
+ }
181
200
 
182
201
  export {
183
202
  holdEscrow,
@@ -188,5 +207,6 @@ export {
188
207
  bootstrapAgent,
189
208
  getBalance,
190
209
  getTransactions,
191
- recordEarning
210
+ recordEarning,
211
+ migrateOwner
192
212
  };
@@ -0,0 +1,68 @@
1
+ // src/cli/peers.ts
2
+ import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
3
+ import { join as join2 } from "path";
4
+
5
+ // src/cli/config.ts
6
+ import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
7
+ import { homedir } from "os";
8
+ import { join } from "path";
9
+ function getConfigDir() {
10
+ return process.env["AGENTBNB_DIR"] ?? join(homedir(), ".agentbnb");
11
+ }
12
+
13
+ // src/cli/peers.ts
14
+ function getPeersPath() {
15
+ return join2(getConfigDir(), "peers.json");
16
+ }
17
+ function loadPeers() {
18
+ const peersPath = getPeersPath();
19
+ if (!existsSync2(peersPath)) {
20
+ return [];
21
+ }
22
+ try {
23
+ const raw = readFileSync2(peersPath, "utf-8");
24
+ return JSON.parse(raw);
25
+ } catch {
26
+ return [];
27
+ }
28
+ }
29
+ function writePeers(peers) {
30
+ const dir = getConfigDir();
31
+ if (!existsSync2(dir)) {
32
+ mkdirSync2(dir, { recursive: true });
33
+ }
34
+ writeFileSync2(getPeersPath(), JSON.stringify(peers, null, 2), "utf-8");
35
+ }
36
+ function savePeer(peer) {
37
+ const peers = loadPeers();
38
+ const lowerName = peer.name.toLowerCase();
39
+ const existing = peers.findIndex((p) => p.name.toLowerCase() === lowerName);
40
+ if (existing >= 0) {
41
+ peers[existing] = peer;
42
+ } else {
43
+ peers.push(peer);
44
+ }
45
+ writePeers(peers);
46
+ }
47
+ function removePeer(name) {
48
+ const peers = loadPeers();
49
+ const lowerName = name.toLowerCase();
50
+ const filtered = peers.filter((p) => p.name.toLowerCase() !== lowerName);
51
+ if (filtered.length === peers.length) {
52
+ return false;
53
+ }
54
+ writePeers(filtered);
55
+ return true;
56
+ }
57
+ function findPeer(name) {
58
+ const peers = loadPeers();
59
+ const lowerName = name.toLowerCase();
60
+ return peers.find((p) => p.name.toLowerCase() === lowerName) ?? null;
61
+ }
62
+
63
+ export {
64
+ loadPeers,
65
+ savePeer,
66
+ removePeer,
67
+ findPeer
68
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AgentBnBError
3
- } from "./chunk-FNKBHBYK.js";
3
+ } from "./chunk-WGZ5AGOX.js";
4
4
 
5
5
  // src/registry/matcher.ts
6
6
  function searchCards(db, query, filters = {}) {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  fetchRemoteCards,
3
3
  searchCards
4
- } from "./chunk-QJEOCKVF.js";
4
+ } from "./chunk-FF226TIV.js";
5
5
  import {
6
6
  requestCapability
7
- } from "./chunk-KJG2UJV5.js";
7
+ } from "./chunk-XND2DWTZ.js";
8
8
  import {
9
9
  findPeer
10
10
  } from "./chunk-5AH3CMOX.js";
@@ -13,10 +13,10 @@ import {
13
13
  holdEscrow,
14
14
  releaseEscrow,
15
15
  settleEscrow
16
- } from "./chunk-XQHN6ITI.js";
16
+ } from "./chunk-DNWT5FZQ.js";
17
17
  import {
18
18
  AgentBnBError
19
- } from "./chunk-FNKBHBYK.js";
19
+ } from "./chunk-WGZ5AGOX.js";
20
20
 
21
21
  // src/autonomy/tiers.ts
22
22
  import { randomUUID } from "crypto";
@@ -3,17 +3,18 @@ import {
3
3
  getBalance,
4
4
  getTransactions,
5
5
  holdEscrow,
6
+ migrateOwner,
6
7
  openCreditDb,
7
8
  releaseEscrow,
8
9
  settleEscrow
9
- } from "./chunk-XQHN6ITI.js";
10
+ } from "./chunk-DNWT5FZQ.js";
10
11
  import {
11
12
  signEscrowReceipt,
12
13
  verifyEscrowReceipt
13
- } from "./chunk-DVAS2443.js";
14
+ } from "./chunk-5KFI5X7B.js";
14
15
  import {
15
16
  AgentBnBError
16
- } from "./chunk-FNKBHBYK.js";
17
+ } from "./chunk-WGZ5AGOX.js";
17
18
 
18
19
  // src/credit/local-credit-ledger.ts
19
20
  var LocalCreditLedger = class {
@@ -83,6 +84,9 @@ var LocalCreditLedger = class {
83
84
  async grant(owner, amount) {
84
85
  bootstrapAgent(this.db, owner, amount);
85
86
  }
87
+ async rename(oldOwner, newOwner) {
88
+ migrateOwner(this.db, oldOwner, newOwner);
89
+ }
86
90
  };
87
91
 
88
92
  // src/registry/identity-auth.ts
@@ -244,6 +248,17 @@ var RegistryCreditLedger = class {
244
248
  }
245
249
  await this.post("/api/credits/grant", owner, { owner, amount });
246
250
  }
251
+ /**
252
+ * Renames an owner — migrates balance, transactions, and escrows.
253
+ */
254
+ async rename(oldOwner, newOwner) {
255
+ if (oldOwner === newOwner) return;
256
+ if (this.config.mode === "direct") {
257
+ migrateOwner(this.config.db, oldOwner, newOwner);
258
+ return;
259
+ }
260
+ await this.post("/api/credits/rename", null, { oldOwner, newOwner });
261
+ }
247
262
  // ─── Private HTTP helpers ─────────────────────────────────────────────────
248
263
  /**
249
264
  * Makes an authenticated POST request to the Registry HTTP API.