agentbnb 8.2.1 → 8.2.3

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 (36) 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-TUCEDQGM.js +44 -0
  14. package/dist/{chunk-RBXTWWUH.js → chunk-WNXXLCV5.js} +1 -1
  15. package/dist/{chunk-LOUEJI6X.js → chunk-XBGVQMQJ.js} +71 -47
  16. package/dist/{chunk-DEWY7OQK.js → chunk-Z2GEFFDO.js} +1 -1
  17. package/dist/cli/index.js +38 -74
  18. package/dist/{client-66TFS7RS.js → client-XOLP5IUZ.js} +1 -1
  19. package/dist/{conduct-A6COHLHY.js → conduct-AZFLNUX3.js} +9 -10
  20. package/dist/{conduct-IUVAXUAV.js → conduct-VPUYTNEA.js} +9 -10
  21. package/dist/{conductor-mode-L2MB44BW.js → conductor-mode-PLTB6MS3.js} +6 -7
  22. package/dist/{conductor-mode-D5TFQW5L.js → conductor-mode-WKB42PYM.js} +6 -3
  23. package/dist/{execute-WOS457HW.js → execute-NNDCXTN4.js} +3 -2
  24. package/dist/{execute-5AWLARB5.js → execute-RIRHTIBU.js} +5 -4
  25. package/dist/index.d.ts +5069 -0
  26. package/dist/index.js +208 -610
  27. package/dist/{publish-capability-JJCBBMSX.js → publish-capability-QDR2QIZ2.js} +2 -2
  28. package/dist/{request-6YQLA7K3.js → request-OERS5BE7.js} +71 -33
  29. package/dist/{serve-skill-X7TZSILV.js → serve-skill-E6EJQYAK.js} +9 -8
  30. package/dist/{server-5TSP4DBX.js → server-46VEG2W7.js} +10 -14
  31. package/dist/{service-coordinator-WTUSMPY6.js → service-coordinator-KMSA6BST.js} +77 -32
  32. package/dist/skills/agentbnb/bootstrap.js +150 -62
  33. package/package.json +18 -12
  34. package/skills/agentbnb/install.sh +0 -0
  35. package/dist/chunk-BZOJ7HBT.js +0 -170
  36. 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,36 @@
1
1
  import {
2
- RelayClient
3
- } from "./chunk-Z4MCGKTL.js";
4
- import "./chunk-SSK653A6.js";
5
- import {
6
- createLedger
7
- } from "./chunk-KBQNTUTN.js";
2
+ createSignedEscrowReceipt
3
+ } from "./chunk-TUCEDQGM.js";
8
4
  import {
9
5
  AutoRequestor,
10
6
  BudgetManager,
11
7
  DEFAULT_BUDGET_CONFIG
12
- } from "./chunk-UYCD3JBZ.js";
13
- import "./chunk-KF3TZHA5.js";
8
+ } from "./chunk-QHZGOG3O.js";
14
9
  import {
15
10
  DEFAULT_AUTONOMY_CONFIG
16
11
  } from "./chunk-GKVTD4EZ.js";
17
- import "./chunk-BZOJ7HBT.js";
12
+ import "./chunk-CQFBNTGT.js";
18
13
  import {
19
- openCreditDb
20
- } from "./chunk-JLNHMNES.js";
14
+ confirmEscrowDebit,
15
+ openCreditDb,
16
+ releaseEscrow
17
+ } from "./chunk-RYISHSHB.js";
21
18
  import "./chunk-NWIQJ2CL.js";
22
19
  import {
23
20
  requestCapability
24
- } from "./chunk-EZVOG7QS.js";
21
+ } from "./chunk-CKOOVZOI.js";
25
22
  import {
26
23
  loadKeyPair
27
24
  } from "./chunk-EJKW57ZV.js";
28
25
  import "./chunk-5AH3CMOX.js";
29
26
  import "./chunk-75OC6E4F.js";
27
+ import {
28
+ RelayClient
29
+ } from "./chunk-Z4MCGKTL.js";
30
+ import "./chunk-SSK653A6.js";
30
31
  import {
31
32
  openDatabase
32
- } from "./chunk-SRBVKO2V.js";
33
+ } from "./chunk-S3V6R3EN.js";
33
34
  import "./chunk-WVY2W7AA.js";
34
35
 
35
36
  // src/mcp/tools/request.ts
@@ -88,12 +89,23 @@ async function handleRequest(args, ctx) {
88
89
  } finally {
89
90
  db.close();
90
91
  }
92
+ let identityAuth;
93
+ try {
94
+ const keys = loadKeyPair(ctx.configDir);
95
+ identityAuth = {
96
+ agentId: ctx.identity.agent_id,
97
+ publicKey: ctx.identity.public_key,
98
+ privateKey: keys.privateKey
99
+ };
100
+ } catch {
101
+ }
91
102
  if (localCard && localCard.owner === ctx.config.owner) {
92
103
  const result = await requestCapability({
93
104
  gatewayUrl: ctx.config.gateway_url,
94
105
  token: ctx.config.token,
95
106
  cardId,
96
- params: { ...args.params ?? {}, ...args.skill_id ? { skill_id: args.skill_id } : {}, requester: ctx.config.owner }
107
+ params: { ...args.params ?? {}, ...args.skill_id ? { skill_id: args.skill_id } : {}, requester: ctx.config.owner },
108
+ identity: identityAuth
97
109
  });
98
110
  return {
99
111
  content: [{ type: "text", text: JSON.stringify({ success: true, result }, null, 2) }]
@@ -123,32 +135,58 @@ async function handleRequest(args, ctx) {
123
135
  const targetOwner = remoteCard["owner"] ?? remoteCard["agent_name"];
124
136
  const gatewayUrl = remoteCard["gateway_url"];
125
137
  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
131
- });
132
- const { escrowId } = await ledger.hold(ctx.config.owner, maxCost, cardId);
133
- try {
138
+ let remoteCost = 0;
139
+ const remoteSkills = remoteCard["skills"];
140
+ if (Array.isArray(remoteSkills)) {
141
+ const matchedSkill = args.skill_id ? remoteSkills.find((s) => s.id === args.skill_id) : remoteSkills[0];
142
+ remoteCost = matchedSkill?.pricing?.credits_per_call ?? 0;
143
+ } else {
144
+ const remotePricing = remoteCard["pricing"];
145
+ remoteCost = remotePricing?.credits_per_call ?? 0;
146
+ }
147
+ if (remoteCost > 0) {
148
+ const creditDb = openCreditDb(ctx.config.credit_db_path);
149
+ creditDb.pragma("busy_timeout = 5000");
150
+ try {
151
+ const keys = loadKeyPair(ctx.configDir);
152
+ const { escrowId, receipt } = createSignedEscrowReceipt(creditDb, keys.privateKey, keys.publicKey, {
153
+ owner: ctx.config.owner,
154
+ agent_id: ctx.identity.agent_id,
155
+ amount: remoteCost,
156
+ cardId,
157
+ skillId: args.skill_id
158
+ });
159
+ try {
160
+ const result = await requestCapability({
161
+ gatewayUrl,
162
+ token: ctx.config.token ?? "",
163
+ cardId,
164
+ params: { ...args.params ?? {}, ...args.skill_id ? { skill_id: args.skill_id } : {}, requester: ctx.config.owner },
165
+ identity: identityAuth,
166
+ escrowReceipt: receipt
167
+ });
168
+ confirmEscrowDebit(creditDb, escrowId);
169
+ return {
170
+ content: [{ type: "text", text: JSON.stringify({ success: true, result }, null, 2) }]
171
+ };
172
+ } catch (execErr) {
173
+ releaseEscrow(creditDb, escrowId);
174
+ throw execErr;
175
+ }
176
+ } finally {
177
+ creditDb.close();
178
+ }
179
+ } else {
134
180
  const result = await requestCapability({
135
181
  gatewayUrl,
136
- token: "",
182
+ token: ctx.config.token ?? "",
137
183
  cardId,
138
184
  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
- }
185
+ identity: identityAuth
144
186
  });
145
- await ledger.settle(escrowId, targetOwner ?? "unknown");
146
187
  return {
147
- content: [{ type: "text", text: JSON.stringify({ success: true, result, credits_spent: maxCost }, null, 2) }]
188
+ content: [{ type: "text", text: JSON.stringify({ success: true, result }, null, 2) }]
148
189
  };
149
- } catch (err) {
150
- await ledger.release(escrowId);
151
- throw err;
152
190
  }
153
191
  }
154
192
  if (targetOwner) {
@@ -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.3";
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-OERS5BE7.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",