agentbnb 4.0.4 → 5.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 (45) hide show
  1. package/dist/chunk-AUBHR7HH.js +25 -0
  2. package/dist/chunk-B5FTAGFN.js +393 -0
  3. package/dist/{chunk-GGYC5U2Z.js → chunk-BTTL24TZ.js} +29 -91
  4. package/dist/chunk-C6KPAFCC.js +387 -0
  5. package/dist/{chunk-JXEOE7HX.js → chunk-CRFCWD6V.js} +163 -92
  6. package/dist/chunk-CSATDXZC.js +89 -0
  7. package/dist/{chunk-T7NS2J2B.js → chunk-DFBX3BBD.js} +84 -1
  8. package/dist/{chunk-DNWT5FZQ.js → chunk-EANI2N2V.js} +98 -1
  9. package/dist/{chunk-HH24WMFN.js → chunk-FLY3WIQR.js} +1 -1
  10. package/dist/{chunk-EVBX22YU.js → chunk-HLUEOLSZ.js} +11 -17
  11. package/dist/chunk-IVOYM3WG.js +25 -0
  12. package/dist/chunk-LCAIAAG2.js +916 -0
  13. package/dist/chunk-MLS6IGGG.js +294 -0
  14. package/dist/{chunk-4P3EMGL4.js → chunk-MNO4COST.js} +5 -3
  15. package/dist/chunk-NH2FIERR.js +138 -0
  16. package/dist/chunk-UKT6H7YT.js +29 -0
  17. package/dist/{chunk-BH6WGYFB.js → chunk-VE3E4AMH.js} +8 -8
  18. package/dist/{chunk-5QGXARLJ.js → chunk-W5BZMKMF.js} +159 -27
  19. package/dist/{chunk-FF226TIV.js → chunk-ZX5623ER.js} +0 -57
  20. package/dist/cli/index.js +362 -4633
  21. package/dist/{conduct-N52JX7RT.js → conduct-KM6ZNJGE.js} +10 -8
  22. package/dist/{conduct-GZQNFTRP.js → conduct-WGTMQND5.js} +10 -8
  23. package/dist/{conductor-mode-XUWGR4ZE.js → conductor-mode-OL2FNOYY.js} +6 -4
  24. package/dist/{conductor-mode-ESGFZ6T5.js → conductor-mode-VRO7TYW2.js} +20 -167
  25. package/dist/execute-CPFSOOO3.js +13 -0
  26. package/dist/execute-IP2QHALV.js +10 -0
  27. package/dist/index.d.ts +14 -8
  28. package/dist/index.js +186 -35
  29. package/dist/{peers-E4MKNNDN.js → peers-CJ7T4RJO.js} +2 -1
  30. package/dist/process-guard-CC7CNRQJ.js +176 -0
  31. package/dist/{request-4GQSSM4B.js → request-YOWPXVLQ.js} +13 -10
  32. package/dist/schema-7BSSLZ4S.js +8 -0
  33. package/dist/{serve-skill-Q6NHX2RA.js → serve-skill-JHFNR7BW.js} +8 -7
  34. package/dist/{server-B5E566CI.js → server-HKJJWFRG.js} +10 -8
  35. package/dist/service-coordinator-5R4LQW6L.js +4917 -0
  36. package/dist/skills/agentbnb/bootstrap.js +5028 -848
  37. package/dist/websocket-client-WRN3HO73.js +6 -0
  38. package/package.json +4 -1
  39. package/skills/agentbnb/SKILL.md +87 -70
  40. package/skills/agentbnb/bootstrap.test.ts +142 -242
  41. package/skills/agentbnb/bootstrap.ts +88 -95
  42. package/skills/agentbnb/install.sh +97 -27
  43. package/dist/card-RNEWSAQ6.js +0 -88
  44. package/dist/chunk-UB2NPFC7.js +0 -165
  45. package/dist/execute-QH6F54D7.js +0 -10
@@ -1,19 +1,21 @@
1
1
  import {
2
2
  conductAction
3
- } from "./chunk-BH6WGYFB.js";
4
- import "./chunk-4P3EMGL4.js";
3
+ } from "./chunk-VE3E4AMH.js";
4
+ import "./chunk-JOY533UH.js";
5
+ import "./chunk-QT7TEVNV.js";
6
+ import "./chunk-MNO4COST.js";
5
7
  import "./chunk-3MJT4PZG.js";
6
- import "./chunk-GGYC5U2Z.js";
7
- import "./chunk-FF226TIV.js";
8
+ import "./chunk-BTTL24TZ.js";
9
+ import "./chunk-CSATDXZC.js";
10
+ import "./chunk-ZX5623ER.js";
11
+ import "./chunk-NH2FIERR.js";
8
12
  import "./chunk-XND2DWTZ.js";
9
13
  import "./chunk-5AH3CMOX.js";
10
14
  import "./chunk-75OC6E4F.js";
11
- import "./chunk-T7NS2J2B.js";
12
- import "./chunk-DNWT5FZQ.js";
15
+ import "./chunk-DFBX3BBD.js";
16
+ import "./chunk-EANI2N2V.js";
13
17
  import "./chunk-5KFI5X7B.js";
14
18
  import "./chunk-WGZ5AGOX.js";
15
- import "./chunk-JOY533UH.js";
16
- import "./chunk-QT7TEVNV.js";
17
19
 
18
20
  // src/mcp/tools/conduct.ts
19
21
  import { z } from "zod";
@@ -1,19 +1,21 @@
1
1
  import {
2
2
  conductAction
3
- } from "./chunk-BH6WGYFB.js";
4
- import "./chunk-4P3EMGL4.js";
3
+ } from "./chunk-VE3E4AMH.js";
4
+ import "./chunk-JOY533UH.js";
5
+ import "./chunk-QT7TEVNV.js";
6
+ import "./chunk-MNO4COST.js";
5
7
  import "./chunk-3MJT4PZG.js";
6
- import "./chunk-GGYC5U2Z.js";
7
- import "./chunk-FF226TIV.js";
8
+ import "./chunk-BTTL24TZ.js";
9
+ import "./chunk-CSATDXZC.js";
10
+ import "./chunk-ZX5623ER.js";
11
+ import "./chunk-NH2FIERR.js";
8
12
  import "./chunk-XND2DWTZ.js";
9
13
  import "./chunk-5AH3CMOX.js";
10
14
  import "./chunk-75OC6E4F.js";
11
- import "./chunk-T7NS2J2B.js";
12
- import "./chunk-DNWT5FZQ.js";
15
+ import "./chunk-DFBX3BBD.js";
16
+ import "./chunk-EANI2N2V.js";
13
17
  import "./chunk-5KFI5X7B.js";
14
18
  import "./chunk-WGZ5AGOX.js";
15
- import "./chunk-JOY533UH.js";
16
- import "./chunk-QT7TEVNV.js";
17
19
  export {
18
20
  conductAction
19
21
  };
@@ -3,16 +3,18 @@ import {
3
3
  decompose,
4
4
  matchSubTasks,
5
5
  orchestrate
6
- } from "./chunk-4P3EMGL4.js";
6
+ } from "./chunk-MNO4COST.js";
7
7
  import "./chunk-3MJT4PZG.js";
8
8
  import {
9
9
  BudgetManager
10
- } from "./chunk-GGYC5U2Z.js";
11
- import "./chunk-FF226TIV.js";
10
+ } from "./chunk-BTTL24TZ.js";
11
+ import "./chunk-CSATDXZC.js";
12
+ import "./chunk-ZX5623ER.js";
13
+ import "./chunk-NH2FIERR.js";
12
14
  import "./chunk-XND2DWTZ.js";
13
15
  import "./chunk-5AH3CMOX.js";
14
16
  import "./chunk-75OC6E4F.js";
15
- import "./chunk-DNWT5FZQ.js";
17
+ import "./chunk-EANI2N2V.js";
16
18
  import "./chunk-5KFI5X7B.js";
17
19
  import "./chunk-WGZ5AGOX.js";
18
20
 
@@ -1,12 +1,15 @@
1
1
  import {
2
- getBalance,
2
+ fetchRemoteCards,
3
3
  interpolateObject,
4
- signEscrowReceipt
5
- } from "./chunk-JXEOE7HX.js";
6
- import "./chunk-EVBX22YU.js";
4
+ requestCapability,
5
+ searchCards
6
+ } from "./chunk-B5FTAGFN.js";
7
+ import "./chunk-HLUEOLSZ.js";
8
+ import "./chunk-IVOYM3WG.js";
7
9
  import {
8
- AgentBnBError
9
- } from "./chunk-UB2NPFC7.js";
10
+ getBalance
11
+ } from "./chunk-CRFCWD6V.js";
12
+ import "./chunk-WGZ5AGOX.js";
10
13
 
11
14
  // src/conductor/task-decomposer.ts
12
15
  import { randomUUID } from "crypto";
@@ -117,165 +120,6 @@ function decompose(task, _availableCapabilities) {
117
120
  return [];
118
121
  }
119
122
 
120
- // src/registry/matcher.ts
121
- function searchCards(db, query, filters = {}) {
122
- const words = query.trim().split(/\s+/).map((w) => w.replace(/["*^{}():]/g, "")).filter((w) => w.length > 0);
123
- if (words.length === 0) return [];
124
- const ftsQuery = words.map((w) => `"${w}"`).join(" OR ");
125
- const conditions = [];
126
- const params = [ftsQuery];
127
- if (filters.level !== void 0) {
128
- conditions.push(`json_extract(cc.data, '$.level') = ?`);
129
- params.push(filters.level);
130
- }
131
- if (filters.online !== void 0) {
132
- conditions.push(`json_extract(cc.data, '$.availability.online') = ?`);
133
- params.push(filters.online ? 1 : 0);
134
- }
135
- const whereClause = conditions.length > 0 ? `AND ${conditions.join(" AND ")}` : "";
136
- const sql = `
137
- SELECT cc.data
138
- FROM capability_cards cc
139
- JOIN cards_fts ON cc.rowid = cards_fts.rowid
140
- WHERE cards_fts MATCH ?
141
- ${whereClause}
142
- ORDER BY bm25(cards_fts)
143
- LIMIT 50
144
- `;
145
- const stmt = db.prepare(sql);
146
- const rows = stmt.all(...params);
147
- const results = rows.map((row) => JSON.parse(row.data));
148
- if (filters.apis_used && filters.apis_used.length > 0) {
149
- const requiredApis = filters.apis_used;
150
- return results.filter((card) => {
151
- const cardApis = card.metadata?.apis_used ?? [];
152
- return requiredApis.every((api) => cardApis.includes(api));
153
- });
154
- }
155
- return results;
156
- }
157
-
158
- // src/gateway/client.ts
159
- import { randomUUID as randomUUID2 } from "crypto";
160
- async function requestCapability(opts) {
161
- const { gatewayUrl, token, cardId, params = {}, timeoutMs = 3e5, escrowReceipt, identity } = opts;
162
- const id = randomUUID2();
163
- const payload = {
164
- jsonrpc: "2.0",
165
- id,
166
- method: "capability.execute",
167
- params: {
168
- card_id: cardId,
169
- ...params,
170
- ...escrowReceipt ? { escrow_receipt: escrowReceipt } : {}
171
- }
172
- };
173
- const headers = { "Content-Type": "application/json" };
174
- if (identity) {
175
- const signature = signEscrowReceipt(payload, identity.privateKey);
176
- headers["X-Agent-Id"] = identity.agentId;
177
- headers["X-Agent-Public-Key"] = identity.publicKey;
178
- headers["X-Agent-Signature"] = signature;
179
- } else if (token) {
180
- headers["Authorization"] = `Bearer ${token}`;
181
- }
182
- const controller = new AbortController();
183
- const timer = setTimeout(() => controller.abort(), timeoutMs);
184
- let response;
185
- try {
186
- response = await fetch(`${gatewayUrl}/rpc`, {
187
- method: "POST",
188
- headers,
189
- body: JSON.stringify(payload),
190
- signal: controller.signal
191
- });
192
- } catch (err) {
193
- clearTimeout(timer);
194
- const isTimeout = err instanceof Error && err.name === "AbortError";
195
- throw new AgentBnBError(
196
- isTimeout ? "Request timed out" : `Network error: ${String(err)}`,
197
- isTimeout ? "TIMEOUT" : "NETWORK_ERROR"
198
- );
199
- } finally {
200
- clearTimeout(timer);
201
- }
202
- const body = await response.json();
203
- if (body.error) {
204
- throw new AgentBnBError(body.error.message, `RPC_ERROR_${body.error.code}`);
205
- }
206
- return body.result;
207
- }
208
-
209
- // src/autonomy/pending-requests.ts
210
- import { randomUUID as randomUUID3 } from "crypto";
211
-
212
- // src/cli/remote-registry.ts
213
- var RegistryTimeoutError = class extends AgentBnBError {
214
- constructor(url) {
215
- super(
216
- `Registry at ${url} did not respond within 5s. Showing local results only.`,
217
- "REGISTRY_TIMEOUT"
218
- );
219
- this.name = "RegistryTimeoutError";
220
- }
221
- };
222
- var RegistryConnectionError = class extends AgentBnBError {
223
- constructor(url) {
224
- super(
225
- `Cannot reach ${url}. Is the registry running? Showing local results only.`,
226
- "REGISTRY_CONNECTION"
227
- );
228
- this.name = "RegistryConnectionError";
229
- }
230
- };
231
- var RegistryAuthError = class extends AgentBnBError {
232
- constructor(url) {
233
- super(
234
- `Authentication failed for ${url}. Run \`agentbnb config set token <your-token>\`.`,
235
- "REGISTRY_AUTH"
236
- );
237
- this.name = "RegistryAuthError";
238
- }
239
- };
240
- async function fetchRemoteCards(registryUrl, params, timeoutMs = 5e3) {
241
- let cardsUrl;
242
- try {
243
- cardsUrl = new URL("/cards", registryUrl);
244
- } catch {
245
- throw new AgentBnBError(`Invalid registry URL: ${registryUrl}`, "INVALID_REGISTRY_URL");
246
- }
247
- const searchParams = new URLSearchParams();
248
- if (params.q !== void 0) searchParams.set("q", params.q);
249
- if (params.level !== void 0) searchParams.set("level", String(params.level));
250
- if (params.online !== void 0) searchParams.set("online", String(params.online));
251
- if (params.tag !== void 0) searchParams.set("tag", params.tag);
252
- searchParams.set("limit", "100");
253
- cardsUrl.search = searchParams.toString();
254
- const controller = new AbortController();
255
- const timer = setTimeout(() => controller.abort(), timeoutMs);
256
- let response;
257
- try {
258
- response = await fetch(cardsUrl.toString(), { signal: controller.signal });
259
- } catch (err) {
260
- clearTimeout(timer);
261
- const isTimeout = err instanceof Error && err.name === "AbortError";
262
- if (isTimeout) {
263
- throw new RegistryTimeoutError(registryUrl);
264
- }
265
- throw new RegistryConnectionError(registryUrl);
266
- } finally {
267
- clearTimeout(timer);
268
- }
269
- if (response.status === 401 || response.status === 403) {
270
- throw new RegistryAuthError(registryUrl);
271
- }
272
- if (!response.ok) {
273
- throw new RegistryConnectionError(registryUrl);
274
- }
275
- const body = await response.json();
276
- return body.items;
277
- }
278
-
279
123
  // src/autonomy/auto-request.ts
280
124
  function minMaxNormalize(values) {
281
125
  if (values.length === 0) return [];
@@ -290,11 +134,20 @@ function minMaxNormalize(values) {
290
134
  function scorePeers(candidates, selfOwner) {
291
135
  const eligible = candidates.filter((c) => c.card.owner !== selfOwner);
292
136
  if (eligible.length === 0) return [];
293
- const successRates = eligible.map((c) => c.card.metadata?.success_rate ?? 0.5);
137
+ const successRates = eligible.map((c) => {
138
+ if (c.skillMetadata?.success_rate !== void 0) {
139
+ return c.skillMetadata.success_rate;
140
+ }
141
+ return c.card.metadata?.success_rate ?? 0.5;
142
+ });
294
143
  const costEfficiencies = eligible.map((c) => c.cost === 0 ? 1 : 1 / c.cost);
295
144
  const idleRates = eligible.map((c) => {
145
+ if (c.skillInternal !== void 0) {
146
+ const skillIdleRate = c.skillInternal["idle_rate"];
147
+ if (typeof skillIdleRate === "number") return skillIdleRate;
148
+ }
296
149
  const internal = c.card._internal;
297
- const idleRate = internal?.idle_rate;
150
+ const idleRate = internal?.["idle_rate"];
298
151
  return typeof idleRate === "number" ? idleRate : 1;
299
152
  });
300
153
  const normSuccess = minMaxNormalize(successRates);
@@ -0,0 +1,13 @@
1
+ import {
2
+ executeCapabilityBatch,
3
+ executeCapabilityRequest
4
+ } from "./chunk-W5BZMKMF.js";
5
+ import "./chunk-UKT6H7YT.js";
6
+ import "./chunk-DFBX3BBD.js";
7
+ import "./chunk-EANI2N2V.js";
8
+ import "./chunk-5KFI5X7B.js";
9
+ import "./chunk-WGZ5AGOX.js";
10
+ export {
11
+ executeCapabilityBatch,
12
+ executeCapabilityRequest
13
+ };
@@ -0,0 +1,10 @@
1
+ import {
2
+ executeCapabilityBatch,
3
+ executeCapabilityRequest
4
+ } from "./chunk-LCAIAAG2.js";
5
+ import "./chunk-CRFCWD6V.js";
6
+ import "./chunk-WGZ5AGOX.js";
7
+ export {
8
+ executeCapabilityBatch,
9
+ executeCapabilityRequest
10
+ };
package/dist/index.d.ts CHANGED
@@ -777,6 +777,12 @@ interface SearchFilters {
777
777
  online?: boolean;
778
778
  /** Filter cards that use all of the specified APIs. */
779
779
  apis_used?: string[];
780
+ /**
781
+ * Minimum reputation score (0.0 - 1.0) for the card owner.
782
+ * Cards whose owner has a reputation score below this value are excluded.
783
+ * Owners with no feedback default to 0.5 (cold-start score).
784
+ */
785
+ min_reputation?: number;
780
786
  }
781
787
  /**
782
788
  * Searches CapabilityCards using FTS5 full-text search with optional filters.
@@ -785,7 +791,7 @@ interface SearchFilters {
785
791
  *
786
792
  * @param db - Open database instance.
787
793
  * @param query - Full-text search query string.
788
- * @param filters - Optional filters for level, online status, and apis_used.
794
+ * @param filters - Optional filters for level, online status, apis_used, and min_reputation.
789
795
  * @returns Array of matching CapabilityCard objects sorted by relevance.
790
796
  */
791
797
  declare function searchCards(db: Database.Database, query: string, filters?: SearchFilters): CapabilityCard[];
@@ -939,8 +945,8 @@ declare const PipelineSkillConfigSchema: z.ZodObject<{
939
945
  skill_id: z.ZodString;
940
946
  input_mapping: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
941
947
  }, "strip", z.ZodTypeAny, {
942
- input_mapping: Record<string, string>;
943
948
  skill_id: string;
949
+ input_mapping: Record<string, string>;
944
950
  }, {
945
951
  skill_id: string;
946
952
  input_mapping?: Record<string, string> | undefined;
@@ -978,8 +984,8 @@ declare const PipelineSkillConfigSchema: z.ZodObject<{
978
984
  free_tier?: number | undefined;
979
985
  };
980
986
  steps: ({
981
- input_mapping: Record<string, string>;
982
987
  skill_id: string;
988
+ input_mapping: Record<string, string>;
983
989
  } | {
984
990
  input_mapping: Record<string, string>;
985
991
  command: string;
@@ -1279,8 +1285,8 @@ declare const SkillConfigSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1279
1285
  skill_id: z.ZodString;
1280
1286
  input_mapping: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
1281
1287
  }, "strip", z.ZodTypeAny, {
1282
- input_mapping: Record<string, string>;
1283
1288
  skill_id: string;
1289
+ input_mapping: Record<string, string>;
1284
1290
  }, {
1285
1291
  skill_id: string;
1286
1292
  input_mapping?: Record<string, string> | undefined;
@@ -1318,8 +1324,8 @@ declare const SkillConfigSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1318
1324
  free_tier?: number | undefined;
1319
1325
  };
1320
1326
  steps: ({
1321
- input_mapping: Record<string, string>;
1322
1327
  skill_id: string;
1328
+ input_mapping: Record<string, string>;
1323
1329
  } | {
1324
1330
  input_mapping: Record<string, string>;
1325
1331
  command: string;
@@ -1605,8 +1611,8 @@ declare const SkillsFileSchema: z.ZodObject<{
1605
1611
  skill_id: z.ZodString;
1606
1612
  input_mapping: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
1607
1613
  }, "strip", z.ZodTypeAny, {
1608
- input_mapping: Record<string, string>;
1609
1614
  skill_id: string;
1615
+ input_mapping: Record<string, string>;
1610
1616
  }, {
1611
1617
  skill_id: string;
1612
1618
  input_mapping?: Record<string, string> | undefined;
@@ -1644,8 +1650,8 @@ declare const SkillsFileSchema: z.ZodObject<{
1644
1650
  free_tier?: number | undefined;
1645
1651
  };
1646
1652
  steps: ({
1647
- input_mapping: Record<string, string>;
1648
1653
  skill_id: string;
1654
+ input_mapping: Record<string, string>;
1649
1655
  } | {
1650
1656
  input_mapping: Record<string, string>;
1651
1657
  command: string;
@@ -1843,8 +1849,8 @@ declare const SkillsFileSchema: z.ZodObject<{
1843
1849
  free_tier?: number | undefined;
1844
1850
  };
1845
1851
  steps: ({
1846
- input_mapping: Record<string, string>;
1847
1852
  skill_id: string;
1853
+ input_mapping: Record<string, string>;
1848
1854
  } | {
1849
1855
  input_mapping: Record<string, string>;
1850
1856
  command: string;