agentbnb 8.2.3 → 8.3.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 (62) hide show
  1. package/dist/{card-EX2EYGCZ.js → card-BN643ZOY.js} +6 -2
  2. package/dist/card-T2XJZA5A.js +92 -0
  3. package/dist/{chunk-3LWBH7P3.js → chunk-4NFJ3VYZ.js} +20 -1
  4. package/dist/chunk-5AIYALBX.js +857 -0
  5. package/dist/chunk-6QMDJVMS.js +238 -0
  6. package/dist/{chunk-LKLKYXLV.js → chunk-74LZDEDT.js} +6 -4
  7. package/dist/{chunk-GKVTD4EZ.js → chunk-77KGEDH4.js} +1 -1
  8. package/dist/{chunk-QCGIG7WW.js → chunk-7IQE34QK.js} +14 -7
  9. package/dist/{chunk-QHZGOG3O.js → chunk-D242QZCR.js} +168 -41
  10. package/dist/chunk-EE3V3DXK.js +60 -0
  11. package/dist/{chunk-RYISHSHB.js → chunk-F3KIEVJ2.js} +207 -265
  12. package/dist/{chunk-XBGVQMQJ.js → chunk-FELGHDCA.js} +16 -39
  13. package/dist/{chunk-EJKW57ZV.js → chunk-GIEJVKZZ.js} +1 -1
  14. package/dist/{chunk-WVY2W7AA.js → chunk-I7KWA7OB.js} +20 -0
  15. package/dist/{chunk-4IPJJRTP.js → chunk-IGQNP3ZO.js} +5 -2
  16. package/dist/chunk-NQANA6WH.js +797 -0
  17. package/dist/{chunk-Z4MCGKTL.js → chunk-NX27AFPA.js} +15 -2
  18. package/dist/{chunk-Z2GEFFDO.js → chunk-O4Q7BRG6.js} +2 -2
  19. package/dist/{chunk-SSK653A6.js → chunk-PQIP7EXY.js} +6 -0
  20. package/dist/{chunk-EG6RS4JC.js → chunk-QFPXZITP.js} +20 -65
  21. package/dist/chunk-R4F4XII4.js +264 -0
  22. package/dist/{chunk-DYQOFGGI.js → chunk-RVBW2QXU.js} +178 -49
  23. package/dist/{chunk-CQFBNTGT.js → chunk-S7DZHKCG.js} +25 -12
  24. package/dist/chunk-U6LP4KWN.js +238 -0
  25. package/dist/{chunk-MWOXW7JQ.js → chunk-VJ7XBEY6.js} +24 -16
  26. package/dist/chunk-WTHMHNKC.js +129 -0
  27. package/dist/{chunk-OCSU2S6W.js → chunk-WX3GZVFG.js} +2 -1
  28. package/dist/{chunk-CKOOVZOI.js → chunk-YKMBFQC2.js} +37 -5
  29. package/dist/{chunk-S3V6R3EN.js → chunk-ZU2TP7CN.js} +70 -27
  30. package/dist/cli/index.js +203 -237
  31. package/dist/client-OKJJ3UP2.js +19 -0
  32. package/dist/client-UQBGCIPA.js +20 -0
  33. package/dist/conduct-4JDMWBQD.js +22 -0
  34. package/dist/{conduct-AZFLNUX3.js → conduct-VYYBCPHA.js} +14 -13
  35. package/dist/{conductor-mode-WKB42PYM.js → conductor-mode-OPGQJFLA.js} +12 -8
  36. package/dist/{conductor-mode-PLTB6MS3.js → conductor-mode-SBDCRIX6.js} +16 -11
  37. package/dist/execute-FZLQGIXB.js +14 -0
  38. package/dist/execute-TEZPQ5WP.js +15 -0
  39. package/dist/index.d.ts +172 -11
  40. package/dist/index.js +1529 -433
  41. package/dist/{process-guard-GH5LRNWO.js → process-guard-TNSUNHSR.js} +1 -1
  42. package/dist/{publish-capability-QDR2QIZ2.js → publish-capability-HVYILTPR.js} +4 -3
  43. package/dist/{reliability-metrics-QG7WC5QK.js → reliability-metrics-G7LPUYJD.js} +3 -1
  44. package/dist/reliability-metrics-RRUKJ4ME.js +20 -0
  45. package/dist/{request-OERS5BE7.js → request-KJNKR27T.js} +76 -71
  46. package/dist/{serve-skill-E6EJQYAK.js → serve-skill-GC6NIQ5T.js} +10 -11
  47. package/dist/{server-46VEG2W7.js → server-YV3XPTX5.js} +11 -10
  48. package/dist/{service-coordinator-KMSA6BST.js → service-coordinator-RY5AKUZS.js} +420 -171
  49. package/dist/{skill-config-FETXPNVP.js → skill-config-5O2VR546.js} +1 -1
  50. package/dist/skills/agentbnb/bootstrap.js +528 -253
  51. package/dist/websocket-client-3U27WJUU.js +7 -0
  52. package/dist/{websocket-client-4Z5P54RU.js → websocket-client-SNDF3B6N.js} +1 -1
  53. package/package.json +1 -1
  54. package/dist/chunk-MCED4GDW.js +0 -1572
  55. package/dist/chunk-NWIQJ2CL.js +0 -108
  56. package/dist/chunk-TUCEDQGM.js +0 -44
  57. package/dist/chunk-WNXXLCV5.js +0 -32
  58. package/dist/client-XOLP5IUZ.js +0 -12
  59. package/dist/conduct-VPUYTNEA.js +0 -21
  60. package/dist/execute-NNDCXTN4.js +0 -13
  61. package/dist/execute-RIRHTIBU.js +0 -16
  62. package/dist/websocket-client-QOVARTRN.js +0 -7
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AgentBnBError
3
- } from "./chunk-WVY2W7AA.js";
3
+ } from "./chunk-I7KWA7OB.js";
4
4
 
5
5
  // src/runtime/process-guard.ts
6
6
  import { dirname, join } from "path";
@@ -2,9 +2,10 @@ import {
2
2
  parseSoulMd,
3
3
  publishFromSoul,
4
4
  skillConfigToSkill
5
- } from "./chunk-4IPJJRTP.js";
6
- import "./chunk-S3V6R3EN.js";
7
- import "./chunk-WVY2W7AA.js";
5
+ } from "./chunk-IGQNP3ZO.js";
6
+ import "./chunk-5AIYALBX.js";
7
+ import "./chunk-WTHMHNKC.js";
8
+ import "./chunk-I7KWA7OB.js";
8
9
  export {
9
10
  parseSoulMd,
10
11
  publishFromSoul,
@@ -6,7 +6,9 @@ import {
6
6
  recordFeedback,
7
7
  recordQualityFailure,
8
8
  recordSuccessfulHire
9
- } from "./chunk-NWIQJ2CL.js";
9
+ } from "./chunk-6QMDJVMS.js";
10
+ import "./chunk-EE3V3DXK.js";
11
+ import "./chunk-I7KWA7OB.js";
10
12
  export {
11
13
  RELIABILITY_METRICS_SCHEMA,
12
14
  ensureReliabilityTable,
@@ -0,0 +1,20 @@
1
+ import {
2
+ RELIABILITY_METRICS_SCHEMA,
3
+ ensureReliabilityTable,
4
+ getReliabilityMetrics,
5
+ recordAvailabilityCheck,
6
+ recordFeedback,
7
+ recordQualityFailure,
8
+ recordSuccessfulHire
9
+ } from "./chunk-U6LP4KWN.js";
10
+ import "./chunk-WTHMHNKC.js";
11
+ import "./chunk-I7KWA7OB.js";
12
+ export {
13
+ RELIABILITY_METRICS_SCHEMA,
14
+ ensureReliabilityTable,
15
+ getReliabilityMetrics,
16
+ recordAvailabilityCheck,
17
+ recordFeedback,
18
+ recordQualityFailure,
19
+ recordSuccessfulHire
20
+ };
@@ -1,37 +1,32 @@
1
- import {
2
- createSignedEscrowReceipt
3
- } from "./chunk-TUCEDQGM.js";
4
1
  import {
5
2
  AutoRequestor,
6
3
  BudgetManager,
7
- DEFAULT_BUDGET_CONFIG
8
- } from "./chunk-QHZGOG3O.js";
4
+ DEFAULT_BUDGET_CONFIG,
5
+ requestViaTemporaryRelay
6
+ } from "./chunk-D242QZCR.js";
9
7
  import {
10
8
  DEFAULT_AUTONOMY_CONFIG
11
- } from "./chunk-GKVTD4EZ.js";
12
- import "./chunk-CQFBNTGT.js";
9
+ } from "./chunk-77KGEDH4.js";
10
+ import "./chunk-S7DZHKCG.js";
13
11
  import {
14
- confirmEscrowDebit,
15
- openCreditDb,
16
- releaseEscrow
17
- } from "./chunk-RYISHSHB.js";
18
- import "./chunk-NWIQJ2CL.js";
12
+ openCreditDb
13
+ } from "./chunk-F3KIEVJ2.js";
14
+ import "./chunk-NX27AFPA.js";
15
+ import "./chunk-PQIP7EXY.js";
19
16
  import {
20
17
  requestCapability
21
- } from "./chunk-CKOOVZOI.js";
18
+ } from "./chunk-YKMBFQC2.js";
22
19
  import {
23
20
  loadKeyPair
24
- } from "./chunk-EJKW57ZV.js";
21
+ } from "./chunk-GIEJVKZZ.js";
22
+ import "./chunk-U6LP4KWN.js";
25
23
  import "./chunk-5AH3CMOX.js";
26
24
  import "./chunk-75OC6E4F.js";
27
- import {
28
- RelayClient
29
- } from "./chunk-Z4MCGKTL.js";
30
- import "./chunk-SSK653A6.js";
31
25
  import {
32
26
  openDatabase
33
- } from "./chunk-S3V6R3EN.js";
34
- import "./chunk-WVY2W7AA.js";
27
+ } from "./chunk-5AIYALBX.js";
28
+ import "./chunk-WTHMHNKC.js";
29
+ import "./chunk-I7KWA7OB.js";
35
30
 
36
31
  // src/mcp/tools/request.ts
37
32
  import { z } from "zod";
@@ -40,8 +35,35 @@ var requestInputSchema = {
40
35
  card_id: z.string().optional().describe("Direct card ID to request (skips search)"),
41
36
  skill_id: z.string().optional().describe("Specific skill within a v2.0 card"),
42
37
  params: z.record(z.unknown()).optional().describe("Input parameters for the capability"),
43
- max_cost: z.number().optional().default(50).describe("Maximum credits to spend")
38
+ max_cost: z.number().optional().default(50).describe("Maximum credits to spend"),
39
+ timeout_ms: z.number().positive().optional().describe("Requester timeout override in milliseconds")
44
40
  };
41
+ function parsePositiveNumber(value) {
42
+ return typeof value === "number" && value > 0 ? value : void 0;
43
+ }
44
+ function deriveTimeoutHintFromCard(remoteCard, skillId) {
45
+ const topLevelHint = {
46
+ expected_duration_ms: parsePositiveNumber(remoteCard["expected_duration_ms"]),
47
+ hard_timeout_ms: parsePositiveNumber(remoteCard["hard_timeout_ms"])
48
+ };
49
+ const skills = remoteCard["skills"];
50
+ if (!Array.isArray(skills)) {
51
+ return topLevelHint.expected_duration_ms !== void 0 || topLevelHint.hard_timeout_ms !== void 0 ? topLevelHint : void 0;
52
+ }
53
+ const selectedSkill = skillId ? skills.find((candidate) => {
54
+ if (!candidate || typeof candidate !== "object") return false;
55
+ return candidate["id"] === skillId;
56
+ }) : skills[0];
57
+ if (!selectedSkill || typeof selectedSkill !== "object") {
58
+ return topLevelHint.expected_duration_ms !== void 0 || topLevelHint.hard_timeout_ms !== void 0 ? topLevelHint : void 0;
59
+ }
60
+ const skillRecord = selectedSkill;
61
+ const skillHint = {
62
+ expected_duration_ms: parsePositiveNumber(skillRecord["expected_duration_ms"]) ?? topLevelHint.expected_duration_ms,
63
+ hard_timeout_ms: parsePositiveNumber(skillRecord["hard_timeout_ms"]) ?? topLevelHint.hard_timeout_ms
64
+ };
65
+ return skillHint.expected_duration_ms !== void 0 || skillHint.hard_timeout_ms !== void 0 ? skillHint : void 0;
66
+ }
45
67
  async function handleRequest(args, ctx) {
46
68
  try {
47
69
  const maxCost = args.max_cost ?? 50;
@@ -105,6 +127,7 @@ async function handleRequest(args, ctx) {
105
127
  token: ctx.config.token,
106
128
  cardId,
107
129
  params: { ...args.params ?? {}, ...args.skill_id ? { skill_id: args.skill_id } : {}, requester: ctx.config.owner },
130
+ timeoutMs: args.timeout_ms,
108
131
  identity: identityAuth
109
132
  });
110
133
  return {
@@ -133,7 +156,9 @@ async function handleRequest(args, ctx) {
133
156
  };
134
157
  }
135
158
  const targetOwner = remoteCard["owner"] ?? remoteCard["agent_name"];
159
+ const targetAgentId = typeof remoteCard["agent_id"] === "string" ? remoteCard["agent_id"] : void 0;
136
160
  const gatewayUrl = remoteCard["gateway_url"];
161
+ const timeoutHint = deriveTimeoutHintFromCard(remoteCard, args.skill_id);
137
162
  if (gatewayUrl) {
138
163
  let remoteCost = 0;
139
164
  const remoteSkills = remoteCard["skills"];
@@ -145,43 +170,33 @@ async function handleRequest(args, ctx) {
145
170
  remoteCost = remotePricing?.credits_per_call ?? 0;
146
171
  }
147
172
  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();
173
+ if (!targetOwner) {
174
+ return {
175
+ content: [{ type: "text", text: JSON.stringify({ success: false, error: "Paid remote request requires a target owner for relay routing" }) }]
176
+ };
178
177
  }
178
+ const result = await requestViaTemporaryRelay({
179
+ registryUrl: ctx.config.registry,
180
+ owner: ctx.config.owner,
181
+ token: ctx.config.token ?? "",
182
+ targetOwner,
183
+ targetAgentId,
184
+ cardId,
185
+ skillId: args.skill_id,
186
+ params: { ...args.params ?? {}, ...args.skill_id ? { skill_id: args.skill_id } : {}, requester: ctx.config.owner },
187
+ timeoutMs: args.timeout_ms
188
+ });
189
+ return {
190
+ content: [{ type: "text", text: JSON.stringify({ success: true, result }, null, 2) }]
191
+ };
179
192
  } else {
180
193
  const result = await requestCapability({
181
194
  gatewayUrl,
182
195
  token: ctx.config.token ?? "",
183
196
  cardId,
184
197
  params: { ...args.params ?? {}, ...args.skill_id ? { skill_id: args.skill_id } : {}, requester: ctx.config.owner },
198
+ timeoutMs: args.timeout_ms,
199
+ timeoutHint,
185
200
  identity: identityAuth
186
201
  });
187
202
  return {
@@ -190,30 +205,20 @@ async function handleRequest(args, ctx) {
190
205
  }
191
206
  }
192
207
  if (targetOwner) {
193
- const relay = new RelayClient({
208
+ const result = await requestViaTemporaryRelay({
194
209
  registryUrl: ctx.config.registry,
195
210
  owner: ctx.config.owner,
196
211
  token: ctx.config.token ?? "",
197
- card: { id: ctx.config.owner, owner: ctx.config.owner, name: "mcp-requester" },
198
- onRequest: async () => ({ error: { code: -32601, message: "MCP client does not accept requests" } }),
199
- silent: true
212
+ targetOwner,
213
+ targetAgentId,
214
+ cardId,
215
+ skillId: args.skill_id,
216
+ params: { ...args.params ?? {}, ...args.skill_id ? { skill_id: args.skill_id } : {} },
217
+ timeoutMs: args.timeout_ms
200
218
  });
201
- try {
202
- await relay.connect();
203
- const result = await relay.request({
204
- targetOwner,
205
- cardId,
206
- skillId: args.skill_id,
207
- params: args.params ?? {},
208
- requester: ctx.config.owner,
209
- timeoutMs: 3e5
210
- });
211
- return {
212
- content: [{ type: "text", text: JSON.stringify({ success: true, result }, null, 2) }]
213
- };
214
- } finally {
215
- relay.disconnect();
216
- }
219
+ return {
220
+ content: [{ type: "text", text: JSON.stringify({ success: true, result }, null, 2) }]
221
+ };
217
222
  }
218
223
  return {
219
224
  content: [{ type: "text", text: JSON.stringify({ success: false, error: "Remote card has no gateway_url and no owner for relay routing" }) }]
@@ -1,23 +1,22 @@
1
1
  import {
2
2
  executeCapabilityRequest
3
- } from "./chunk-XBGVQMQJ.js";
4
- import "./chunk-WNXXLCV5.js";
5
- import "./chunk-CQFBNTGT.js";
3
+ } from "./chunk-FELGHDCA.js";
4
+ import "./chunk-S7DZHKCG.js";
6
5
  import {
7
6
  openCreditDb
8
- } from "./chunk-RYISHSHB.js";
9
- import "./chunk-NWIQJ2CL.js";
10
- import "./chunk-EJKW57ZV.js";
11
- import "./chunk-75OC6E4F.js";
7
+ } from "./chunk-F3KIEVJ2.js";
12
8
  import {
13
9
  RelayClient
14
- } from "./chunk-Z4MCGKTL.js";
15
- import "./chunk-SSK653A6.js";
10
+ } from "./chunk-NX27AFPA.js";
11
+ import "./chunk-PQIP7EXY.js";
12
+ import "./chunk-U6LP4KWN.js";
13
+ import "./chunk-75OC6E4F.js";
16
14
  import {
17
15
  listCards,
18
16
  openDatabase
19
- } from "./chunk-S3V6R3EN.js";
20
- import "./chunk-WVY2W7AA.js";
17
+ } from "./chunk-5AIYALBX.js";
18
+ import "./chunk-WTHMHNKC.js";
19
+ import "./chunk-I7KWA7OB.js";
21
20
 
22
21
  // src/mcp/tools/serve-skill.ts
23
22
  import { z } from "zod";
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  createLedger,
3
3
  ensureIdentity
4
- } from "./chunk-LKLKYXLV.js";
4
+ } from "./chunk-74LZDEDT.js";
5
5
  import {
6
6
  fetchRemoteCards,
7
7
  getBalance,
8
8
  mergeResults,
9
9
  openCreditDb,
10
10
  searchCards
11
- } from "./chunk-RYISHSHB.js";
12
- import "./chunk-NWIQJ2CL.js";
11
+ } from "./chunk-F3KIEVJ2.js";
13
12
  import {
14
13
  loadKeyPair
15
- } from "./chunk-EJKW57ZV.js";
14
+ } from "./chunk-GIEJVKZZ.js";
15
+ import "./chunk-U6LP4KWN.js";
16
16
  import {
17
17
  getConfigDir,
18
18
  loadConfig
@@ -20,10 +20,11 @@ import {
20
20
  import {
21
21
  insertCard,
22
22
  openDatabase
23
- } from "./chunk-S3V6R3EN.js";
23
+ } from "./chunk-5AIYALBX.js";
24
+ import "./chunk-WTHMHNKC.js";
24
25
  import {
25
26
  AnyCardSchema
26
- } from "./chunk-WVY2W7AA.js";
27
+ } from "./chunk-I7KWA7OB.js";
27
28
 
28
29
  // src/mcp/server.ts
29
30
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -247,7 +248,7 @@ function registerPublishTool(server, ctx) {
247
248
  }
248
249
 
249
250
  // src/mcp/server.ts
250
- var VERSION = "8.2.3";
251
+ var VERSION = true ? "8.3.0" : "0.0.0-dev";
251
252
  async function startMcpServer() {
252
253
  const config = loadConfig();
253
254
  if (!config) {
@@ -268,9 +269,9 @@ async function startMcpServer() {
268
269
  registerDiscoverTool(server, ctx);
269
270
  registerStatusTool(server, ctx);
270
271
  registerPublishTool(server, ctx);
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");
272
+ const { registerRequestTool } = await import("./request-KJNKR27T.js");
273
+ const { registerConductTool } = await import("./conduct-VYYBCPHA.js");
274
+ const { registerServeSkillTool } = await import("./serve-skill-GC6NIQ5T.js");
274
275
  registerRequestTool(server, ctx);
275
276
  registerConductTool(server, ctx);
276
277
  registerServeSkillTool(server, ctx);