agentbnb 4.0.1 → 4.0.2

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 (39) hide show
  1. package/README.md +2 -0
  2. package/dist/{card-4XH4AOTE.js → card-RSGDCHCV.js} +1 -1
  3. package/dist/{chunk-MQKYGY5I.js → chunk-4P3EMGL4.js} +3 -3
  4. package/dist/{chunk-DVAS2443.js → chunk-5KFI5X7B.js} +1 -1
  5. package/dist/{chunk-Q7HRI666.js → chunk-7NA43XCG.js} +4 -4
  6. package/dist/{chunk-3UKAVIMC.js → chunk-BH6WGYFB.js} +4 -4
  7. package/dist/{chunk-XQHN6ITI.js → chunk-DNWT5FZQ.js} +22 -2
  8. package/dist/{chunk-QJEOCKVF.js → chunk-FF226TIV.js} +1 -1
  9. package/dist/{chunk-6K5WUVF3.js → chunk-GGYC5U2Z.js} +4 -4
  10. package/dist/{chunk-ODBGCCEH.js → chunk-HH24WMFN.js} +18 -3
  11. package/dist/{chunk-M3G5NR2Z.js → chunk-QITOPASZ.js} +8 -2
  12. package/dist/{chunk-TLU7ALCZ.js → chunk-T7NS2J2B.js} +1 -1
  13. package/dist/{chunk-FNKBHBYK.js → chunk-WGZ5AGOX.js} +37 -3
  14. package/dist/{chunk-KJG2UJV5.js → chunk-XND2DWTZ.js} +3 -2
  15. package/dist/cli/index.d.ts +1 -0
  16. package/dist/cli/index.js +403 -134
  17. package/dist/{client-BTPIFY7E.js → client-T5MTY3CS.js} +3 -3
  18. package/dist/conduct-GZQNFTRP.js +19 -0
  19. package/dist/{conduct-CW62HBPT.js → conduct-N52JX7RT.js} +9 -9
  20. package/dist/{conductor-mode-3JS4VWCR.js → conductor-mode-XUWGR4ZE.js} +7 -7
  21. package/dist/execute-PNGQOMYO.js +10 -0
  22. package/dist/index.d.ts +146 -2
  23. package/dist/index.js +131 -65
  24. package/dist/{request-CNZ3XIVX.js → request-4GQSSM4B.js} +8 -8
  25. package/dist/{serve-skill-SUOGUM7N.js → serve-skill-TPHZH6BS.js} +5 -5
  26. package/dist/{server-2LWHL24P.js → server-365V3GYD.js} +10 -10
  27. package/package.json +3 -6
  28. package/skills/agentbnb/HEARTBEAT.rules.md +47 -0
  29. package/skills/agentbnb/SKILL.md +166 -0
  30. package/skills/agentbnb/auto-request.ts +14 -0
  31. package/skills/agentbnb/auto-share.ts +10 -0
  32. package/skills/agentbnb/bootstrap.test.ts +323 -0
  33. package/skills/agentbnb/bootstrap.ts +126 -0
  34. package/skills/agentbnb/credit-mgr.ts +11 -0
  35. package/skills/agentbnb/gateway.ts +12 -0
  36. package/skills/agentbnb/install.sh +210 -0
  37. package/dist/conduct-FXLVGKD5.js +0 -19
  38. package/dist/execute-EXOITLHN.js +0 -10
  39. package/dist/types-FGBUZ3QV.js +0 -18
package/README.md CHANGED
@@ -70,6 +70,8 @@ Read the full design philosophy in [AGENT-NATIVE-PROTOCOL.md](AGENT-NATIVE-PROTO
70
70
 
71
71
  <p align="center"><code>1,001 tests · v4.0 shipped · Ed25519 signed escrow · 5 execution modes · MCP Server · Hub Agents</code></p>
72
72
 
73
+ 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.
74
+
73
75
  ---
74
76
 
75
77
  ## Platform Support
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CapabilityCardV2Schema
3
- } from "./chunk-FNKBHBYK.js";
3
+ } from "./chunk-WGZ5AGOX.js";
4
4
 
5
5
  // src/conductor/card.ts
6
6
  import { createHash } from "crypto";
@@ -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";
@@ -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
  };
@@ -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.
@@ -2,7 +2,7 @@ import {
2
2
  generateKeyPair,
3
3
  loadKeyPair,
4
4
  saveKeyPair
5
- } from "./chunk-DVAS2443.js";
5
+ } from "./chunk-5KFI5X7B.js";
6
6
 
7
7
  // src/identity/identity.ts
8
8
  import { z } from "zod";
@@ -80,7 +80,13 @@ function saveIdentity(configDir, identity) {
80
80
  }
81
81
  function ensureIdentity(configDir, owner) {
82
82
  const existing = loadIdentity(configDir);
83
- if (existing) return existing;
83
+ if (existing) {
84
+ if (existing.owner !== owner) {
85
+ existing.owner = owner;
86
+ saveIdentity(configDir, existing);
87
+ }
88
+ return existing;
89
+ }
84
90
  return createIdentity(configDir, owner);
85
91
  }
86
92
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  AgentBnBError,
3
3
  CapabilityCardSchema
4
- } from "./chunk-FNKBHBYK.js";
4
+ } from "./chunk-WGZ5AGOX.js";
5
5
 
6
6
  // src/registry/request-log.ts
7
7
  var SINCE_MS = {
@@ -83,12 +83,45 @@ var SkillSchema = z.object({
83
83
  */
84
84
  _internal: z.record(z.unknown()).optional()
85
85
  });
86
+ var SuitabilitySchema = z.object({
87
+ /** Use cases this agent/skill is optimised for. */
88
+ ideal_for: z.array(z.string()).optional(),
89
+ /** Scenarios this agent/skill cannot reliably handle. */
90
+ not_suitable_for: z.array(z.string()).optional(),
91
+ /** Domains explicitly excluded (used for routing exclusions in later phases). */
92
+ excluded_domains: z.array(z.string()).optional(),
93
+ /** Conditions that increase failure risk, shown as warnings in the Hub. */
94
+ risk_conditions: z.array(z.string()).optional(),
95
+ /** Recommended alternative when this agent is unsuitable. */
96
+ fallback_recommendation: z.string().optional()
97
+ });
98
+ var LearningSchema = z.object({
99
+ /** Known limitations that may affect reliability (self-declared). */
100
+ known_limitations: z.array(z.string()).optional(),
101
+ /** Common failure patterns observed by the provider. */
102
+ common_failure_patterns: z.array(z.string()).optional(),
103
+ /** Version-tagged improvements the provider has shipped. */
104
+ recent_improvements: z.array(z.object({
105
+ version: z.string(),
106
+ summary: z.string(),
107
+ timestamp: z.string()
108
+ })).optional(),
109
+ /** Structured critiques from external sources (phase 2+). */
110
+ critiques: z.array(z.object({
111
+ type: z.literal("structured"),
112
+ summary: z.string(),
113
+ source_tier: z.string(),
114
+ timestamp: z.string()
115
+ })).optional()
116
+ });
86
117
  var CapabilityCardV2Schema = z.object({
87
118
  spec_version: z.literal("2.0"),
88
119
  id: z.string().uuid(),
89
120
  owner: z.string().min(1),
90
121
  /** Agent display name — was 'name' in v1.0. */
91
122
  agent_name: z.string().min(1).max(100),
123
+ /** Short one-liner shown in Hub v2 Identity Header. */
124
+ short_description: z.string().max(200).optional(),
92
125
  /** At least one skill is required. */
93
126
  skills: z.array(SkillSchema).min(1),
94
127
  availability: z.object({
@@ -100,6 +133,10 @@ var CapabilityCardV2Schema = z.object({
100
133
  runtime: z.string(),
101
134
  region: z.string().optional()
102
135
  }).optional(),
136
+ /** Suitability metadata for Hub v2 profile and future routing warnings. */
137
+ suitability: SuitabilitySchema.optional(),
138
+ /** Learning signals — self-declared limitations, improvements, critiques. */
139
+ learning: LearningSchema.optional(),
103
140
  /**
104
141
  * Private per-card metadata. Stripped from all API and CLI responses —
105
142
  * never transmitted beyond the local store.
@@ -123,10 +160,7 @@ var AgentBnBError = class extends Error {
123
160
  };
124
161
 
125
162
  export {
126
- IOSchemaSchema,
127
- PoweredBySchema,
128
163
  CapabilityCardSchema,
129
- SkillSchema,
130
164
  CapabilityCardV2Schema,
131
165
  AnyCardSchema,
132
166
  AgentBnBError
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  signEscrowReceipt
3
- } from "./chunk-DVAS2443.js";
3
+ } from "./chunk-5KFI5X7B.js";
4
4
  import {
5
5
  AgentBnBError
6
- } from "./chunk-FNKBHBYK.js";
6
+ } from "./chunk-WGZ5AGOX.js";
7
7
 
8
8
  // src/gateway/client.ts
9
9
  import { randomUUID } from "crypto";
@@ -62,6 +62,7 @@ async function requestViaRelay(relay, opts) {
62
62
  cardId: opts.cardId,
63
63
  skillId: opts.skillId,
64
64
  params: opts.params ?? {},
65
+ requester: opts.requester,
65
66
  escrowReceipt: opts.escrowReceipt,
66
67
  timeoutMs: opts.timeoutMs
67
68
  });
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node