agentbnb 8.2.1 → 8.2.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 (34) hide show
  1. package/dist/{chunk-7Q2XUXSA.js → chunk-4IPJJRTP.js} +1 -1
  2. package/dist/{chunk-EZVOG7QS.js → chunk-CKOOVZOI.js} +15 -18
  3. package/dist/chunk-CQFBNTGT.js +145 -0
  4. package/dist/{chunk-WKWJWKX7.js → chunk-DYQOFGGI.js} +155 -445
  5. package/dist/{chunk-NP55V7RQ.js → chunk-EG6RS4JC.js} +70 -46
  6. package/dist/{chunk-KBQNTUTN.js → chunk-LKLKYXLV.js} +1 -1
  7. package/dist/{chunk-STJLWMXH.js → chunk-MCED4GDW.js} +467 -98
  8. package/dist/{chunk-GWMMYVLL.js → chunk-MWOXW7JQ.js} +7 -7
  9. package/dist/{chunk-GJETGML6.js → chunk-QCGIG7WW.js} +4 -6
  10. package/dist/{chunk-UYCD3JBZ.js → chunk-QHZGOG3O.js} +148 -46
  11. package/dist/{chunk-JLNHMNES.js → chunk-RYISHSHB.js} +286 -1
  12. package/dist/{chunk-SRBVKO2V.js → chunk-S3V6R3EN.js} +66 -39
  13. package/dist/{chunk-RBXTWWUH.js → chunk-WNXXLCV5.js} +1 -1
  14. package/dist/{chunk-LOUEJI6X.js → chunk-XBGVQMQJ.js} +71 -47
  15. package/dist/{chunk-DEWY7OQK.js → chunk-Z2GEFFDO.js} +1 -1
  16. package/dist/cli/index.js +25 -28
  17. package/dist/{client-66TFS7RS.js → client-XOLP5IUZ.js} +1 -1
  18. package/dist/{conduct-A6COHLHY.js → conduct-AZFLNUX3.js} +9 -10
  19. package/dist/{conduct-IUVAXUAV.js → conduct-VPUYTNEA.js} +9 -10
  20. package/dist/{conductor-mode-L2MB44BW.js → conductor-mode-PLTB6MS3.js} +6 -7
  21. package/dist/{conductor-mode-D5TFQW5L.js → conductor-mode-WKB42PYM.js} +6 -3
  22. package/dist/{execute-WOS457HW.js → execute-NNDCXTN4.js} +3 -2
  23. package/dist/{execute-5AWLARB5.js → execute-RIRHTIBU.js} +5 -4
  24. package/dist/index.d.ts +5069 -0
  25. package/dist/index.js +208 -610
  26. package/dist/{publish-capability-JJCBBMSX.js → publish-capability-QDR2QIZ2.js} +2 -2
  27. package/dist/{request-6YQLA7K3.js → request-NX7GSPIG.js} +30 -40
  28. package/dist/{serve-skill-X7TZSILV.js → serve-skill-E6EJQYAK.js} +9 -8
  29. package/dist/{server-5TSP4DBX.js → server-VBCT32FC.js} +10 -14
  30. package/dist/{service-coordinator-WTUSMPY6.js → service-coordinator-KMSA6BST.js} +77 -32
  31. package/dist/skills/agentbnb/bootstrap.js +113 -69
  32. package/package.json +1 -1
  33. package/dist/chunk-BZOJ7HBT.js +0 -170
  34. package/dist/chunk-KF3TZHA5.js +0 -91
@@ -2,8 +2,8 @@ import {
2
2
  parseSoulMd,
3
3
  publishFromSoul,
4
4
  skillConfigToSkill
5
- } from "./chunk-7Q2XUXSA.js";
6
- import "./chunk-SRBVKO2V.js";
5
+ } from "./chunk-4IPJJRTP.js";
6
+ import "./chunk-S3V6R3EN.js";
7
7
  import "./chunk-WVY2W7AA.js";
8
8
  export {
9
9
  parseSoulMd,
@@ -1,35 +1,31 @@
1
- import {
2
- RelayClient
3
- } from "./chunk-Z4MCGKTL.js";
4
- import "./chunk-SSK653A6.js";
5
- import {
6
- createLedger
7
- } from "./chunk-KBQNTUTN.js";
8
1
  import {
9
2
  AutoRequestor,
10
3
  BudgetManager,
11
4
  DEFAULT_BUDGET_CONFIG
12
- } from "./chunk-UYCD3JBZ.js";
13
- import "./chunk-KF3TZHA5.js";
5
+ } from "./chunk-QHZGOG3O.js";
14
6
  import {
15
7
  DEFAULT_AUTONOMY_CONFIG
16
8
  } from "./chunk-GKVTD4EZ.js";
17
- import "./chunk-BZOJ7HBT.js";
9
+ import "./chunk-CQFBNTGT.js";
18
10
  import {
19
11
  openCreditDb
20
- } from "./chunk-JLNHMNES.js";
12
+ } from "./chunk-RYISHSHB.js";
21
13
  import "./chunk-NWIQJ2CL.js";
22
14
  import {
23
15
  requestCapability
24
- } from "./chunk-EZVOG7QS.js";
16
+ } from "./chunk-CKOOVZOI.js";
25
17
  import {
26
18
  loadKeyPair
27
19
  } from "./chunk-EJKW57ZV.js";
28
20
  import "./chunk-5AH3CMOX.js";
29
21
  import "./chunk-75OC6E4F.js";
22
+ import {
23
+ RelayClient
24
+ } from "./chunk-Z4MCGKTL.js";
25
+ import "./chunk-SSK653A6.js";
30
26
  import {
31
27
  openDatabase
32
- } from "./chunk-SRBVKO2V.js";
28
+ } from "./chunk-S3V6R3EN.js";
33
29
  import "./chunk-WVY2W7AA.js";
34
30
 
35
31
  // src/mcp/tools/request.ts
@@ -88,12 +84,23 @@ async function handleRequest(args, ctx) {
88
84
  } finally {
89
85
  db.close();
90
86
  }
87
+ let identityAuth;
88
+ try {
89
+ const keys = loadKeyPair(ctx.configDir);
90
+ identityAuth = {
91
+ agentId: ctx.identity.agent_id,
92
+ publicKey: ctx.identity.public_key,
93
+ privateKey: keys.privateKey
94
+ };
95
+ } catch {
96
+ }
91
97
  if (localCard && localCard.owner === ctx.config.owner) {
92
98
  const result = await requestCapability({
93
99
  gatewayUrl: ctx.config.gateway_url,
94
100
  token: ctx.config.token,
95
101
  cardId,
96
- params: { ...args.params ?? {}, ...args.skill_id ? { skill_id: args.skill_id } : {}, requester: ctx.config.owner }
102
+ params: { ...args.params ?? {}, ...args.skill_id ? { skill_id: args.skill_id } : {}, requester: ctx.config.owner },
103
+ identity: identityAuth
97
104
  });
98
105
  return {
99
106
  content: [{ type: "text", text: JSON.stringify({ success: true, result }, null, 2) }]
@@ -123,33 +130,16 @@ async function handleRequest(args, ctx) {
123
130
  const targetOwner = remoteCard["owner"] ?? remoteCard["agent_name"];
124
131
  const gatewayUrl = remoteCard["gateway_url"];
125
132
  if (gatewayUrl) {
126
- const keys = loadKeyPair(ctx.configDir);
127
- const ledger = createLedger({
128
- registryUrl: ctx.config.registry,
129
- ownerPublicKey: ctx.identity.public_key,
130
- privateKey: keys.privateKey
133
+ const result = await requestCapability({
134
+ gatewayUrl,
135
+ token: "",
136
+ cardId,
137
+ params: { ...args.params ?? {}, ...args.skill_id ? { skill_id: args.skill_id } : {}, requester: ctx.config.owner },
138
+ identity: identityAuth
131
139
  });
132
- const { escrowId } = await ledger.hold(ctx.config.owner, maxCost, cardId);
133
- try {
134
- const result = await requestCapability({
135
- gatewayUrl,
136
- token: "",
137
- cardId,
138
- params: { ...args.params ?? {}, ...args.skill_id ? { skill_id: args.skill_id } : {}, requester: ctx.config.owner },
139
- identity: {
140
- agentId: ctx.identity.agent_id,
141
- publicKey: ctx.identity.public_key,
142
- privateKey: keys.privateKey
143
- }
144
- });
145
- await ledger.settle(escrowId, targetOwner ?? "unknown");
146
- return {
147
- content: [{ type: "text", text: JSON.stringify({ success: true, result, credits_spent: maxCost }, null, 2) }]
148
- };
149
- } catch (err) {
150
- await ledger.release(escrowId);
151
- throw err;
152
- }
140
+ return {
141
+ content: [{ type: "text", text: JSON.stringify({ success: true, result }, null, 2) }]
142
+ };
153
143
  }
154
144
  if (targetOwner) {
155
145
  const relay = new RelayClient({
@@ -1,21 +1,22 @@
1
1
  import {
2
2
  executeCapabilityRequest
3
- } from "./chunk-LOUEJI6X.js";
4
- import {
5
- RelayClient
6
- } from "./chunk-Z4MCGKTL.js";
7
- import "./chunk-SSK653A6.js";
8
- import "./chunk-RBXTWWUH.js";
3
+ } from "./chunk-XBGVQMQJ.js";
4
+ import "./chunk-WNXXLCV5.js";
5
+ import "./chunk-CQFBNTGT.js";
9
6
  import {
10
7
  openCreditDb
11
- } from "./chunk-JLNHMNES.js";
8
+ } from "./chunk-RYISHSHB.js";
12
9
  import "./chunk-NWIQJ2CL.js";
13
10
  import "./chunk-EJKW57ZV.js";
14
11
  import "./chunk-75OC6E4F.js";
12
+ import {
13
+ RelayClient
14
+ } from "./chunk-Z4MCGKTL.js";
15
+ import "./chunk-SSK653A6.js";
15
16
  import {
16
17
  listCards,
17
18
  openDatabase
18
- } from "./chunk-SRBVKO2V.js";
19
+ } from "./chunk-S3V6R3EN.js";
19
20
  import "./chunk-WVY2W7AA.js";
20
21
 
21
22
  // src/mcp/tools/serve-skill.ts
@@ -1,18 +1,14 @@
1
1
  import {
2
2
  createLedger,
3
3
  ensureIdentity
4
- } from "./chunk-KBQNTUTN.js";
4
+ } from "./chunk-LKLKYXLV.js";
5
5
  import {
6
6
  fetchRemoteCards,
7
- mergeResults
8
- } from "./chunk-KF3TZHA5.js";
9
- import {
10
- searchCards
11
- } from "./chunk-BZOJ7HBT.js";
12
- import {
13
7
  getBalance,
14
- openCreditDb
15
- } from "./chunk-JLNHMNES.js";
8
+ mergeResults,
9
+ openCreditDb,
10
+ searchCards
11
+ } from "./chunk-RYISHSHB.js";
16
12
  import "./chunk-NWIQJ2CL.js";
17
13
  import {
18
14
  loadKeyPair
@@ -24,7 +20,7 @@ import {
24
20
  import {
25
21
  insertCard,
26
22
  openDatabase
27
- } from "./chunk-SRBVKO2V.js";
23
+ } from "./chunk-S3V6R3EN.js";
28
24
  import {
29
25
  AnyCardSchema
30
26
  } from "./chunk-WVY2W7AA.js";
@@ -251,7 +247,7 @@ function registerPublishTool(server, ctx) {
251
247
  }
252
248
 
253
249
  // src/mcp/server.ts
254
- var VERSION = "8.2.1";
250
+ var VERSION = "8.2.2";
255
251
  async function startMcpServer() {
256
252
  const config = loadConfig();
257
253
  if (!config) {
@@ -272,9 +268,9 @@ async function startMcpServer() {
272
268
  registerDiscoverTool(server, ctx);
273
269
  registerStatusTool(server, ctx);
274
270
  registerPublishTool(server, ctx);
275
- const { registerRequestTool } = await import("./request-6YQLA7K3.js");
276
- const { registerConductTool } = await import("./conduct-A6COHLHY.js");
277
- const { registerServeSkillTool } = await import("./serve-skill-X7TZSILV.js");
271
+ const { registerRequestTool } = await import("./request-NX7GSPIG.js");
272
+ const { registerConductTool } = await import("./conduct-AZFLNUX3.js");
273
+ const { registerServeSkillTool } = await import("./serve-skill-E6EJQYAK.js");
278
274
  registerRequestTool(server, ctx);
279
275
  registerConductTool(server, ctx);
280
276
  registerServeSkillTool(server, ctx);
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  executeCapabilityBatch,
3
3
  executeCapabilityRequest
4
- } from "./chunk-LOUEJI6X.js";
4
+ } from "./chunk-XBGVQMQJ.js";
5
5
  import {
6
6
  StructuredFeedbackSchema
7
7
  } from "./chunk-AUBHR7HH.js";
8
8
  import {
9
- RelayMessageSchema
10
- } from "./chunk-SSK653A6.js";
9
+ interpolateObject
10
+ } from "./chunk-3MJT4PZG.js";
11
11
  import {
12
12
  KNOWN_API_KEYS,
13
13
  announceGateway,
@@ -16,20 +16,13 @@ import {
16
16
  getPricingStats,
17
17
  resolveSelfCli,
18
18
  stopAnnouncement
19
- } from "./chunk-DEWY7OQK.js";
20
- import "./chunk-RBXTWWUH.js";
19
+ } from "./chunk-Z2GEFFDO.js";
21
20
  import {
22
21
  createLedger,
23
22
  deriveAgentId,
24
23
  identityAuthPlugin
25
- } from "./chunk-KBQNTUTN.js";
26
- import {
27
- ApiSkillConfigSchema,
28
- parseSkillsFile
29
- } from "./chunk-OCSU2S6W.js";
30
- import {
31
- interpolateObject
32
- } from "./chunk-3MJT4PZG.js";
24
+ } from "./chunk-LKLKYXLV.js";
25
+ import "./chunk-WNXXLCV5.js";
33
26
  import {
34
27
  DEFAULT_AUTONOMY_CONFIG,
35
28
  getAutonomyTier,
@@ -37,22 +30,21 @@ import {
37
30
  listPendingRequests,
38
31
  resolvePendingRequest
39
32
  } from "./chunk-GKVTD4EZ.js";
33
+ import "./chunk-CQFBNTGT.js";
40
34
  import {
35
+ bootstrapAgent,
41
36
  buildReputationMap,
42
37
  computeReputation,
43
38
  filterCards,
44
- searchCards
45
- } from "./chunk-BZOJ7HBT.js";
46
- import {
47
- bootstrapAgent,
48
39
  getBalance,
49
40
  getTransactions,
50
41
  holdEscrow,
51
42
  migrateOwner,
52
43
  openCreditDb,
53
44
  releaseEscrow,
45
+ searchCards,
54
46
  settleEscrow
55
- } from "./chunk-JLNHMNES.js";
47
+ } from "./chunk-RYISHSHB.js";
56
48
  import "./chunk-NWIQJ2CL.js";
57
49
  import {
58
50
  generateKeyPair,
@@ -61,6 +53,9 @@ import {
61
53
  import {
62
54
  getConfigDir
63
55
  } from "./chunk-75OC6E4F.js";
56
+ import {
57
+ RelayMessageSchema
58
+ } from "./chunk-SSK653A6.js";
64
59
  import {
65
60
  getActivityFeed,
66
61
  getCard,
@@ -80,11 +75,15 @@ import {
80
75
  updateCard,
81
76
  updateSkillAvailability,
82
77
  updateSkillIdleRate
83
- } from "./chunk-SRBVKO2V.js";
78
+ } from "./chunk-S3V6R3EN.js";
84
79
  import {
85
80
  AgentBnBError,
86
81
  AnyCardSchema
87
82
  } from "./chunk-WVY2W7AA.js";
83
+ import {
84
+ ApiSkillConfigSchema,
85
+ parseSkillsFile
86
+ } from "./chunk-OCSU2S6W.js";
88
87
 
89
88
  // src/runtime/agent-runtime.ts
90
89
  import { readFileSync, existsSync } from "fs";
@@ -945,7 +944,7 @@ var AgentRuntime = class {
945
944
  }
946
945
  const modes = /* @__PURE__ */ new Map();
947
946
  if (this.conductorEnabled) {
948
- const { ConductorMode } = await import("./conductor-mode-L2MB44BW.js");
947
+ const { ConductorMode } = await import("./conductor-mode-PLTB6MS3.js");
949
948
  const { registerConductorCard, CONDUCTOR_OWNER } = await import("./card-EX2EYGCZ.js");
950
949
  const { loadPeers } = await import("./peers-K7FSHPN3.js");
951
950
  registerConductorCard(this.registryDb);
@@ -1258,6 +1257,7 @@ import swaggerUi from "@fastify/swagger-ui";
1258
1257
  import fastifyStatic from "@fastify/static";
1259
1258
  import fastifyWebsocket from "@fastify/websocket";
1260
1259
  import { join, dirname } from "path";
1260
+ import { randomUUID as randomUUID6 } from "crypto";
1261
1261
  import { fileURLToPath } from "url";
1262
1262
  import { existsSync as existsSync2 } from "fs";
1263
1263
  import { z as z4 } from "zod";
@@ -4440,15 +4440,60 @@ function createRegistryServer(opts) {
4440
4440
  });
4441
4441
  }
4442
4442
  const { requests, strategy, total_budget } = parseResult.data;
4443
- const batchResult = await executeCapabilityBatch({
4444
- requests,
4445
- strategy,
4446
- total_budget,
4447
- registryDb: db,
4448
- creditDb: opts.creditDb,
4449
- owner
4450
- });
4451
- return reply.send(batchResult);
4443
+ const host = request.headers.host ?? request.hostname;
4444
+ const relayRegistryUrl = `${request.protocol}://${host}`;
4445
+ const relayRequesterOwner = `${owner}:batch:${Date.now()}`;
4446
+ let relayClient;
4447
+ try {
4448
+ const batchResult = await executeCapabilityBatch({
4449
+ requests,
4450
+ strategy,
4451
+ total_budget,
4452
+ registryDb: db,
4453
+ creditDb: opts.creditDb,
4454
+ owner,
4455
+ registryUrl: relayRegistryUrl,
4456
+ dispatchRequest: async ({ target, params, requester }) => {
4457
+ if (!target.via_relay) {
4458
+ return { card_id: target.cardId, skill_id: target.skillId };
4459
+ }
4460
+ if (!relayClient) {
4461
+ const { RelayClient } = await import("./websocket-client-QOVARTRN.js");
4462
+ relayClient = new RelayClient({
4463
+ registryUrl: relayRegistryUrl,
4464
+ owner: relayRequesterOwner,
4465
+ token: "batch-token",
4466
+ card: {
4467
+ spec_version: "1.0",
4468
+ id: randomUUID6(),
4469
+ owner: relayRequesterOwner,
4470
+ name: relayRequesterOwner,
4471
+ description: "Batch requester",
4472
+ level: 1,
4473
+ inputs: [],
4474
+ outputs: [],
4475
+ pricing: { credits_per_call: 1 },
4476
+ availability: { online: false }
4477
+ },
4478
+ onRequest: async () => ({ error: { code: -32601, message: "Batch requester does not serve capabilities" } }),
4479
+ silent: true
4480
+ });
4481
+ await relayClient.connect();
4482
+ }
4483
+ const { requestViaRelay } = await import("./client-XOLP5IUZ.js");
4484
+ return requestViaRelay(relayClient, {
4485
+ targetOwner: target.owner,
4486
+ cardId: target.cardId,
4487
+ skillId: target.skillId,
4488
+ params: { ...params, requester },
4489
+ requester
4490
+ });
4491
+ }
4492
+ });
4493
+ return reply.send(batchResult);
4494
+ } finally {
4495
+ relayClient?.disconnect();
4496
+ }
4452
4497
  });
4453
4498
  if (opts.ownerApiKey && opts.ownerName) {
4454
4499
  const ownerApiKey = opts.ownerApiKey;
@@ -4870,7 +4915,7 @@ var IdleMonitor = class {
4870
4915
  import { spawn as spawn2 } from "child_process";
4871
4916
  import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
4872
4917
  import { join as join2 } from "path";
4873
- import { randomUUID as randomUUID6 } from "crypto";
4918
+ import { randomUUID as randomUUID7 } from "crypto";
4874
4919
  var ServiceCoordinator = class {
4875
4920
  config;
4876
4921
  guard;
@@ -5073,10 +5118,10 @@ var ServiceCoordinator = class {
5073
5118
  }
5074
5119
  if (opts.registryUrl && opts.relay) {
5075
5120
  const { RelayClient } = await import("./websocket-client-QOVARTRN.js");
5076
- const { executeCapabilityRequest: executeCapabilityRequest2 } = await import("./execute-5AWLARB5.js");
5121
+ const { executeCapabilityRequest: executeCapabilityRequest2 } = await import("./execute-RIRHTIBU.js");
5077
5122
  const cards = listCards(this.runtime.registryDb, this.config.owner);
5078
5123
  const card = cards[0] ?? {
5079
- id: randomUUID6(),
5124
+ id: randomUUID7(),
5080
5125
  owner: this.config.owner,
5081
5126
  name: this.config.owner,
5082
5127
  description: "Agent registered via CLI",