agentbnb 5.1.11 → 6.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 (48) hide show
  1. package/dist/{card-RSGDCHCV.js → card-REW7BSWW.js} +1 -1
  2. package/dist/{chunk-EPIWHNB2.js → chunk-2TLZ6G2B.js} +446 -373
  3. package/dist/{chunk-WGZ5AGOX.js → chunk-3CIMVISQ.js} +24 -1
  4. package/dist/{chunk-NH2FIERR.js → chunk-574W3HHE.js} +1 -1
  5. package/dist/{chunk-B5FTAGFN.js → chunk-7XHDSWRD.js} +75 -75
  6. package/dist/{chunk-NLAWT4DT.js → chunk-7YLFLC5C.js} +6 -6
  7. package/dist/chunk-BP3L2TET.js +148 -0
  8. package/dist/{chunk-EGUOAHCW.js → chunk-C2T4BMRW.js} +12 -12
  9. package/dist/{chunk-5KFI5X7B.js → chunk-F53QQIM2.js} +1 -1
  10. package/dist/chunk-JR6TJDIF.js +425 -0
  11. package/dist/{chunk-DFBX3BBD.js → chunk-KA2VIEGM.js} +211 -16
  12. package/dist/chunk-NQTE577Q.js +159 -0
  13. package/dist/{chunk-WTXRY7R2.js → chunk-NYV3NE5Z.js} +157 -9
  14. package/dist/{chunk-UKT6H7YT.js → chunk-OZXCRLP3.js} +1 -1
  15. package/dist/{chunk-QITOPASZ.js → chunk-PSQHUZ7X.js} +1 -1
  16. package/dist/{chunk-EANI2N2V.js → chunk-RVYQSC6L.js} +2 -99
  17. package/dist/{chunk-MLS6IGGG.js → chunk-TQDV254A.js} +1 -1
  18. package/dist/{chunk-QQFBFV4V.js → chunk-TR6UZDNX.js} +57 -18
  19. package/dist/{chunk-ZX5623ER.js → chunk-VMH2YS2I.js} +1 -1
  20. package/dist/{chunk-XND2DWTZ.js → chunk-VPQ44XKE.js} +2 -2
  21. package/dist/{chunk-CSATDXZC.js → chunk-Y7T6IMM3.js} +1 -1
  22. package/dist/{chunk-FLY3WIQR.js → chunk-YRRVFTDR.js} +3 -3
  23. package/dist/cli/index.js +261 -125
  24. package/dist/{client-T5MTY3CS.js → client-HRYRJKSA.js} +3 -3
  25. package/dist/{conduct-WU3VEXB6.js → conduct-LF6FYPLD.js} +11 -11
  26. package/dist/conduct-QAFZIEY6.js +21 -0
  27. package/dist/{conductor-mode-ZMTFZGJP.js → conductor-mode-NUDQLZFM.js} +309 -13
  28. package/dist/conductor-mode-YQ6QSPPT.js +275 -0
  29. package/dist/{execute-4D4ITQCL.js → execute-ITHIYYOX.js} +4 -3
  30. package/dist/execute-PNJFABVJ.js +14 -0
  31. package/dist/index.d.ts +555 -0
  32. package/dist/index.js +592 -83
  33. package/dist/{process-guard-CC7CNRQJ.js → process-guard-QCCBGILS.js} +1 -1
  34. package/dist/publish-capability-TS6CNR5G.js +12 -0
  35. package/dist/{request-VOXBFUOG.js → request-P6QCTCCG.js} +14 -14
  36. package/dist/{serve-skill-IH7UAJNR.js → serve-skill-EZOL7UYN.js} +10 -9
  37. package/dist/{server-JVQW2TID.js → server-3G6ZTASA.js} +16 -16
  38. package/dist/{service-coordinator-EYRDTHL5.js → service-coordinator-CRSE4GWC.js} +174 -242
  39. package/dist/skill-config-4W5W5O6T.js +22 -0
  40. package/dist/skills/agentbnb/bootstrap.js +227 -67
  41. package/package.json +1 -1
  42. package/skills/agentbnb/SKILL.md +35 -0
  43. package/skills/agentbnb/bootstrap.ts +126 -8
  44. package/skills/agentbnb/install.sh +49 -9
  45. package/dist/chunk-CRFCWD6V.js +0 -366
  46. package/dist/conduct-6LKIJJKQ.js +0 -21
  47. package/dist/conductor-mode-Q4IIDY5E.js +0 -123
  48. package/dist/execute-T7Y6RKSW.js +0 -13
@@ -48,7 +48,9 @@ var CapabilityCardSchema = z.object({
48
48
  tags: z.array(z.string()).optional()
49
49
  }).optional(),
50
50
  created_at: z.string().datetime().optional(),
51
- updated_at: z.string().datetime().optional()
51
+ updated_at: z.string().datetime().optional(),
52
+ /** Exact-match capability type key for network routing (e.g. 'task_decomposition'). Optional — backward-compatible. */
53
+ capability_type: z.string().optional()
52
54
  });
53
55
  var SkillSchema = z.object({
54
56
  /** Stable skill identifier, e.g. 'tts-elevenlabs'. Used for gateway routing and idle tracking. */
@@ -58,6 +60,25 @@ var SkillSchema = z.object({
58
60
  level: z.union([z.literal(1), z.literal(2), z.literal(3)]),
59
61
  /** Optional grouping category, e.g. 'tts' | 'video_gen' | 'code_review'. */
60
62
  category: z.string().optional(),
63
+ /** Exact-match capability type key for network routing (e.g. 'task_decomposition'). Optional — per-skill routing hint. */
64
+ capability_type: z.string().optional(),
65
+ /**
66
+ * Multi-value capability routing tags — what this skill IS / offers to the outside.
67
+ * Used by Conductor for precise skill-level matching.
68
+ * Example: ["audio_generation", "audio_editing", "content_production"]
69
+ */
70
+ capability_types: z.array(z.string()).optional(),
71
+ /**
72
+ * Capabilities this skill internally depends on when executing.
73
+ * Used by Conductor for decomposition planning and cost estimation.
74
+ * Example: ["tts", "sound_effects", "audio_mixing"]
75
+ */
76
+ requires_capabilities: z.array(z.string()).optional(),
77
+ /**
78
+ * Publishing visibility. 'private' skills are excluded from published CapabilityCards.
79
+ * Defaults to 'public' when omitted.
80
+ */
81
+ visibility: z.enum(["public", "private"]).optional(),
61
82
  inputs: z.array(IOSchemaSchema),
62
83
  outputs: z.array(IOSchemaSchema),
63
84
  pricing: z.object({
@@ -144,6 +165,8 @@ var CapabilityCardV2Schema = z.object({
144
165
  _internal: z.record(z.unknown()).optional(),
145
166
  /** Public gateway URL where this agent accepts requests. Populated on remote publish. */
146
167
  gateway_url: z.string().url().optional(),
168
+ /** Exact-match capability type key for network routing (e.g. 'task_decomposition'). Optional — backward-compatible. */
169
+ capability_type: z.string().optional(),
147
170
  created_at: z.string().datetime().optional(),
148
171
  updated_at: z.string().datetime().optional()
149
172
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getFeedbackForProvider
3
- } from "./chunk-EANI2N2V.js";
3
+ } from "./chunk-KA2VIEGM.js";
4
4
 
5
5
  // src/feedback/reputation.ts
6
6
  var QUALITY_SCORES = {
@@ -1,10 +1,83 @@
1
1
  import {
2
2
  getFeedbackForProvider,
3
3
  signEscrowReceipt
4
- } from "./chunk-CRFCWD6V.js";
4
+ } from "./chunk-2TLZ6G2B.js";
5
5
  import {
6
6
  AgentBnBError
7
- } from "./chunk-WGZ5AGOX.js";
7
+ } from "./chunk-3CIMVISQ.js";
8
+
9
+ // src/gateway/client.ts
10
+ import { randomUUID } from "crypto";
11
+ async function requestCapability(opts) {
12
+ const { gatewayUrl, token, cardId, params = {}, timeoutMs = 3e5, escrowReceipt, identity } = opts;
13
+ const id = randomUUID();
14
+ const payload = {
15
+ jsonrpc: "2.0",
16
+ id,
17
+ method: "capability.execute",
18
+ params: {
19
+ card_id: cardId,
20
+ ...params,
21
+ ...escrowReceipt ? { escrow_receipt: escrowReceipt } : {}
22
+ }
23
+ };
24
+ const headers = { "Content-Type": "application/json" };
25
+ if (identity) {
26
+ const signature = signEscrowReceipt(payload, identity.privateKey);
27
+ headers["X-Agent-Id"] = identity.agentId;
28
+ headers["X-Agent-Public-Key"] = identity.publicKey;
29
+ headers["X-Agent-Signature"] = signature;
30
+ } else if (token) {
31
+ headers["Authorization"] = `Bearer ${token}`;
32
+ }
33
+ const controller = new AbortController();
34
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
35
+ let response;
36
+ try {
37
+ response = await fetch(`${gatewayUrl}/rpc`, {
38
+ method: "POST",
39
+ headers,
40
+ body: JSON.stringify(payload),
41
+ signal: controller.signal
42
+ });
43
+ } catch (err) {
44
+ clearTimeout(timer);
45
+ const isTimeout = err instanceof Error && err.name === "AbortError";
46
+ throw new AgentBnBError(
47
+ isTimeout ? "Request timed out" : `Network error: ${String(err)}`,
48
+ isTimeout ? "TIMEOUT" : "NETWORK_ERROR"
49
+ );
50
+ } finally {
51
+ clearTimeout(timer);
52
+ }
53
+ const body = await response.json();
54
+ if (body.error) {
55
+ throw new AgentBnBError(body.error.message, `RPC_ERROR_${body.error.code}`);
56
+ }
57
+ return body.result;
58
+ }
59
+ async function requestViaRelay(relay, opts) {
60
+ try {
61
+ return await relay.request({
62
+ targetOwner: opts.targetOwner,
63
+ cardId: opts.cardId,
64
+ skillId: opts.skillId,
65
+ params: opts.params ?? {},
66
+ requester: opts.requester,
67
+ escrowReceipt: opts.escrowReceipt,
68
+ timeoutMs: opts.timeoutMs
69
+ });
70
+ } catch (err) {
71
+ const message = err instanceof Error ? err.message : String(err);
72
+ if (message.includes("timeout")) {
73
+ throw new AgentBnBError(message, "TIMEOUT");
74
+ }
75
+ if (message.includes("offline")) {
76
+ throw new AgentBnBError(message, "AGENT_OFFLINE");
77
+ }
78
+ throw new AgentBnBError(message, "RELAY_ERROR");
79
+ }
80
+ }
8
81
 
9
82
  // src/utils/interpolation.ts
10
83
  function resolvePath(obj, path) {
@@ -181,79 +254,6 @@ function buildReputationMap(db, owners) {
181
254
  return map;
182
255
  }
183
256
 
184
- // src/gateway/client.ts
185
- import { randomUUID } from "crypto";
186
- async function requestCapability(opts) {
187
- const { gatewayUrl, token, cardId, params = {}, timeoutMs = 3e5, escrowReceipt, identity } = opts;
188
- const id = randomUUID();
189
- const payload = {
190
- jsonrpc: "2.0",
191
- id,
192
- method: "capability.execute",
193
- params: {
194
- card_id: cardId,
195
- ...params,
196
- ...escrowReceipt ? { escrow_receipt: escrowReceipt } : {}
197
- }
198
- };
199
- const headers = { "Content-Type": "application/json" };
200
- if (identity) {
201
- const signature = signEscrowReceipt(payload, identity.privateKey);
202
- headers["X-Agent-Id"] = identity.agentId;
203
- headers["X-Agent-Public-Key"] = identity.publicKey;
204
- headers["X-Agent-Signature"] = signature;
205
- } else if (token) {
206
- headers["Authorization"] = `Bearer ${token}`;
207
- }
208
- const controller = new AbortController();
209
- const timer = setTimeout(() => controller.abort(), timeoutMs);
210
- let response;
211
- try {
212
- response = await fetch(`${gatewayUrl}/rpc`, {
213
- method: "POST",
214
- headers,
215
- body: JSON.stringify(payload),
216
- signal: controller.signal
217
- });
218
- } catch (err) {
219
- clearTimeout(timer);
220
- const isTimeout = err instanceof Error && err.name === "AbortError";
221
- throw new AgentBnBError(
222
- isTimeout ? "Request timed out" : `Network error: ${String(err)}`,
223
- isTimeout ? "TIMEOUT" : "NETWORK_ERROR"
224
- );
225
- } finally {
226
- clearTimeout(timer);
227
- }
228
- const body = await response.json();
229
- if (body.error) {
230
- throw new AgentBnBError(body.error.message, `RPC_ERROR_${body.error.code}`);
231
- }
232
- return body.result;
233
- }
234
- async function requestViaRelay(relay, opts) {
235
- try {
236
- return await relay.request({
237
- targetOwner: opts.targetOwner,
238
- cardId: opts.cardId,
239
- skillId: opts.skillId,
240
- params: opts.params ?? {},
241
- requester: opts.requester,
242
- escrowReceipt: opts.escrowReceipt,
243
- timeoutMs: opts.timeoutMs
244
- });
245
- } catch (err) {
246
- const message = err instanceof Error ? err.message : String(err);
247
- if (message.includes("timeout")) {
248
- throw new AgentBnBError(message, "TIMEOUT");
249
- }
250
- if (message.includes("offline")) {
251
- throw new AgentBnBError(message, "AGENT_OFFLINE");
252
- }
253
- throw new AgentBnBError(message, "RELAY_ERROR");
254
- }
255
- }
256
-
257
257
  // src/autonomy/tiers.ts
258
258
  import { randomUUID as randomUUID2 } from "crypto";
259
259
  var DEFAULT_AUTONOMY_CONFIG = {
@@ -7,10 +7,13 @@ import {
7
7
  decompose,
8
8
  matchSubTasks,
9
9
  orchestrate
10
- } from "./chunk-WTXRY7R2.js";
10
+ } from "./chunk-NYV3NE5Z.js";
11
11
  import {
12
12
  BudgetManager
13
- } from "./chunk-EGUOAHCW.js";
13
+ } from "./chunk-C2T4BMRW.js";
14
+ import {
15
+ openCreditDb
16
+ } from "./chunk-RVYQSC6L.js";
14
17
  import {
15
18
  loadPeers
16
19
  } from "./chunk-5AH3CMOX.js";
@@ -19,10 +22,7 @@ import {
19
22
  } from "./chunk-75OC6E4F.js";
20
23
  import {
21
24
  openDatabase
22
- } from "./chunk-DFBX3BBD.js";
23
- import {
24
- openCreditDb
25
- } from "./chunk-EANI2N2V.js";
25
+ } from "./chunk-KA2VIEGM.js";
26
26
 
27
27
  // src/cli/conduct.ts
28
28
  async function conductAction(task, opts) {
@@ -0,0 +1,148 @@
1
+ import {
2
+ insertCard
3
+ } from "./chunk-KA2VIEGM.js";
4
+ import {
5
+ CapabilityCardSchema
6
+ } from "./chunk-3CIMVISQ.js";
7
+
8
+ // src/skills/publish-capability.ts
9
+ import { randomUUID } from "crypto";
10
+ function parseSoulMd(content) {
11
+ const lines = content.split("\n");
12
+ let name = "";
13
+ let description = "";
14
+ const capabilities = [];
15
+ const unknownSections = [];
16
+ let currentSection = null;
17
+ let currentCapabilityName = "";
18
+ let currentCapabilityLines = [];
19
+ let currentCapabilityPricing = void 0;
20
+ let descriptionLines = [];
21
+ let pastFirstH1 = false;
22
+ let pastFirstH2 = false;
23
+ const flushCapability = () => {
24
+ if (currentCapabilityName) {
25
+ const cap = {
26
+ name: currentCapabilityName,
27
+ description: currentCapabilityLines.join(" ").trim()
28
+ };
29
+ if (currentCapabilityPricing !== void 0) {
30
+ cap.pricing = currentCapabilityPricing;
31
+ }
32
+ capabilities.push(cap);
33
+ currentCapabilityName = "";
34
+ currentCapabilityLines = [];
35
+ currentCapabilityPricing = void 0;
36
+ }
37
+ };
38
+ for (const line of lines) {
39
+ const trimmed = line.trim();
40
+ if (/^# /.test(trimmed) && !pastFirstH1) {
41
+ name = trimmed.slice(2).trim();
42
+ pastFirstH1 = true;
43
+ currentSection = "preamble";
44
+ continue;
45
+ }
46
+ if (/^## /.test(trimmed)) {
47
+ flushCapability();
48
+ const capName = trimmed.slice(3).trim();
49
+ currentCapabilityName = capName;
50
+ currentSection = "capability";
51
+ pastFirstH2 = true;
52
+ continue;
53
+ }
54
+ if (/^#{3,} /.test(trimmed)) {
55
+ const sectionName = trimmed.replace(/^#+\s*/, "");
56
+ if (!unknownSections.includes(sectionName)) {
57
+ unknownSections.push(sectionName);
58
+ }
59
+ continue;
60
+ }
61
+ if (trimmed === "") continue;
62
+ if (currentSection === "preamble" && !pastFirstH2) {
63
+ descriptionLines.push(trimmed);
64
+ } else if (currentSection === "capability") {
65
+ const pricingMatch = trimmed.match(/^pricing:\s*(\d+(?:\.\d+)?)$/i);
66
+ if (pricingMatch) {
67
+ const val = parseFloat(pricingMatch[1]);
68
+ if (!isNaN(val) && val >= 0) {
69
+ currentCapabilityPricing = val;
70
+ }
71
+ } else {
72
+ currentCapabilityLines.push(trimmed);
73
+ }
74
+ }
75
+ }
76
+ flushCapability();
77
+ if (descriptionLines.length > 0) {
78
+ description = descriptionLines[0] ?? "";
79
+ }
80
+ return {
81
+ name,
82
+ description,
83
+ level: 2,
84
+ capabilities,
85
+ unknownSections
86
+ };
87
+ }
88
+ function publishFromSoul(db, soulContent, owner) {
89
+ const parsed = parseSoulMd(soulContent);
90
+ const capsSummary = parsed.capabilities.map((c) => c.name).join(", ");
91
+ const description = parsed.description.length > 0 ? parsed.description.slice(0, 500) : capsSummary.slice(0, 500);
92
+ const card = {
93
+ spec_version: "1.0",
94
+ id: randomUUID(),
95
+ owner,
96
+ name: parsed.name || "Unknown Agent",
97
+ description,
98
+ level: parsed.level,
99
+ inputs: [
100
+ {
101
+ name: "input",
102
+ type: "text",
103
+ description: "Input for the capability",
104
+ required: true
105
+ }
106
+ ],
107
+ outputs: [
108
+ {
109
+ name: "output",
110
+ type: "text",
111
+ description: "Output from the capability",
112
+ required: true
113
+ }
114
+ ],
115
+ pricing: {
116
+ credits_per_call: 10
117
+ },
118
+ availability: {
119
+ online: true
120
+ },
121
+ metadata: {
122
+ tags: parsed.capabilities.map((c) => c.name.toLowerCase().replace(/\s+/g, "-"))
123
+ }
124
+ };
125
+ CapabilityCardSchema.parse(card);
126
+ insertCard(db, card);
127
+ return card;
128
+ }
129
+ function skillConfigToSkill(config) {
130
+ return {
131
+ id: config.id,
132
+ name: config.name,
133
+ description: config.description ?? "",
134
+ level: 2,
135
+ inputs: [],
136
+ outputs: [],
137
+ pricing: config.pricing,
138
+ ...config.capability_types !== void 0 && { capability_types: config.capability_types },
139
+ ...config.requires_capabilities !== void 0 && { requires_capabilities: config.requires_capabilities },
140
+ ...config.visibility !== void 0 && { visibility: config.visibility }
141
+ };
142
+ }
143
+
144
+ export {
145
+ parseSoulMd,
146
+ publishFromSoul,
147
+ skillConfigToSkill
148
+ };
@@ -1,26 +1,26 @@
1
+ import {
2
+ fetchRemoteCards
3
+ } from "./chunk-VMH2YS2I.js";
1
4
  import {
2
5
  createPendingRequest,
3
6
  getAutonomyTier,
4
7
  insertAuditEvent
5
- } from "./chunk-CSATDXZC.js";
6
- import {
7
- fetchRemoteCards
8
- } from "./chunk-ZX5623ER.js";
8
+ } from "./chunk-Y7T6IMM3.js";
9
9
  import {
10
10
  searchCards
11
- } from "./chunk-NH2FIERR.js";
12
- import {
13
- requestCapability
14
- } from "./chunk-XND2DWTZ.js";
15
- import {
16
- findPeer
17
- } from "./chunk-5AH3CMOX.js";
11
+ } from "./chunk-574W3HHE.js";
18
12
  import {
19
13
  getBalance,
20
14
  holdEscrow,
21
15
  releaseEscrow,
22
16
  settleEscrow
23
- } from "./chunk-EANI2N2V.js";
17
+ } from "./chunk-RVYQSC6L.js";
18
+ import {
19
+ requestCapability
20
+ } from "./chunk-VPQ44XKE.js";
21
+ import {
22
+ findPeer
23
+ } from "./chunk-5AH3CMOX.js";
24
24
 
25
25
  // src/credit/budget.ts
26
26
  var DEFAULT_BUDGET_CONFIG = {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AgentBnBError
3
- } from "./chunk-WGZ5AGOX.js";
3
+ } from "./chunk-3CIMVISQ.js";
4
4
 
5
5
  // src/credit/signing.ts
6
6
  import { generateKeyPairSync, sign, verify, createPublicKey, createPrivateKey } from "crypto";