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
@@ -7,10 +7,13 @@ import {
7
7
  insertRequestLog,
8
8
  recordEarning,
9
9
  releaseEscrow,
10
+ resolveTargetCapability,
10
11
  settleEscrow,
11
- updateReputation,
12
+ updateReputation
13
+ } from "./chunk-MCED4GDW.js";
14
+ import {
12
15
  verifyEscrowReceipt
13
- } from "./chunk-STJLWMXH.js";
16
+ } from "./chunk-EJKW57ZV.js";
14
17
  import {
15
18
  loadConfig
16
19
  } from "./chunk-IVOYM3WG.js";
@@ -290,8 +293,12 @@ async function executeCapabilityBatch(options) {
290
293
  };
291
294
  }
292
295
  const executeItem = async (item, index) => {
293
- const card = getCard(registryDb, item.skill_id);
294
- if (!card) {
296
+ const resolved = await resolveTargetCapability(item.skill_id, {
297
+ registryDb,
298
+ registryUrl: options.registryUrl,
299
+ onlineOnly: true
300
+ });
301
+ if (!resolved) {
295
302
  return {
296
303
  request_index: index,
297
304
  status: "failed",
@@ -300,26 +307,11 @@ async function executeCapabilityBatch(options) {
300
307
  error: `Card/skill not found: ${item.skill_id}`
301
308
  };
302
309
  }
303
- const rawCard = card;
304
- let creditsNeeded;
305
- let resolvedSkillId;
306
- if (Array.isArray(rawCard["skills"])) {
307
- const v2card = card;
308
- const skill = v2card.skills[0];
309
- if (!skill) {
310
- return {
311
- request_index: index,
312
- status: "failed",
313
- credits_spent: 0,
314
- credits_refunded: 0,
315
- error: `No skills defined on card: ${item.skill_id}`
316
- };
317
- }
318
- creditsNeeded = skill.pricing.credits_per_call;
319
- resolvedSkillId = skill.id;
320
- } else {
321
- creditsNeeded = card.pricing.credits_per_call;
322
- }
310
+ const localCard = getCard(registryDb, resolved.cardId);
311
+ const localCardRaw = localCard;
312
+ const cardName = typeof localCardRaw?.["name"] === "string" ? localCardRaw["name"] : typeof localCardRaw?.["agent_name"] === "string" ? localCardRaw["agent_name"] : resolved.cardId;
313
+ const creditsNeeded = resolved.credits_per_call;
314
+ const resolvedSkillId = resolved.skillId;
323
315
  if (creditsNeeded > item.max_credits) {
324
316
  return {
325
317
  request_index: index,
@@ -341,7 +333,7 @@ async function executeCapabilityBatch(options) {
341
333
  error: "Insufficient credits"
342
334
  };
343
335
  }
344
- escrowId = holdEscrow(creditDb, owner, creditsNeeded, card.id);
336
+ escrowId = holdEscrow(creditDb, owner, creditsNeeded, resolved.cardId);
345
337
  } catch (err) {
346
338
  const msg = err instanceof AgentBnBError ? err.message : "Failed to hold escrow";
347
339
  return {
@@ -353,30 +345,62 @@ async function executeCapabilityBatch(options) {
353
345
  };
354
346
  }
355
347
  const startMs = Date.now();
356
- const latencyMs = Date.now() - startMs;
357
- settleEscrow(creditDb, escrowId, card.owner);
358
- updateReputation(registryDb, card.id, true, latencyMs);
359
348
  try {
360
- insertRequestLog(registryDb, {
361
- id: randomUUID(),
362
- card_id: card.id,
363
- card_name: card.name,
364
- skill_id: resolvedSkillId,
365
- requester: owner,
349
+ const result = options.dispatchRequest ? await options.dispatchRequest({
350
+ target: resolved,
351
+ params: item.params,
352
+ requester: owner
353
+ }) : { card_id: resolved.cardId, skill_id: resolvedSkillId };
354
+ const latencyMs = Date.now() - startMs;
355
+ settleEscrow(creditDb, escrowId, resolved.owner);
356
+ updateReputation(registryDb, resolved.cardId, true, latencyMs);
357
+ try {
358
+ insertRequestLog(registryDb, {
359
+ id: randomUUID(),
360
+ card_id: resolved.cardId,
361
+ card_name: cardName,
362
+ skill_id: resolvedSkillId,
363
+ requester: owner,
364
+ status: "success",
365
+ latency_ms: latencyMs,
366
+ credits_charged: creditsNeeded,
367
+ created_at: (/* @__PURE__ */ new Date()).toISOString()
368
+ });
369
+ } catch {
370
+ }
371
+ return {
372
+ request_index: index,
366
373
  status: "success",
367
- latency_ms: latencyMs,
368
- credits_charged: creditsNeeded,
369
- created_at: (/* @__PURE__ */ new Date()).toISOString()
370
- });
371
- } catch {
374
+ result,
375
+ credits_spent: creditsNeeded,
376
+ credits_refunded: 0
377
+ };
378
+ } catch (err) {
379
+ releaseEscrow(creditDb, escrowId);
380
+ const latencyMs = Date.now() - startMs;
381
+ try {
382
+ insertRequestLog(registryDb, {
383
+ id: randomUUID(),
384
+ card_id: resolved.cardId,
385
+ card_name: cardName,
386
+ skill_id: resolvedSkillId,
387
+ requester: owner,
388
+ status: "failure",
389
+ latency_ms: latencyMs,
390
+ credits_charged: 0,
391
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
392
+ failure_reason: "not_found"
393
+ });
394
+ } catch {
395
+ }
396
+ return {
397
+ request_index: index,
398
+ status: "failed",
399
+ credits_spent: 0,
400
+ credits_refunded: creditsNeeded,
401
+ error: err instanceof Error ? err.message : String(err)
402
+ };
372
403
  }
373
- return {
374
- request_index: index,
375
- status: "success",
376
- result: { card_id: card.id, skill_id: resolvedSkillId },
377
- credits_spent: creditsNeeded,
378
- credits_refunded: 0
379
- };
380
404
  };
381
405
  let results;
382
406
  if (strategy === "sequential") {
@@ -8,7 +8,7 @@ import {
8
8
  openCreditDb,
9
9
  releaseEscrow,
10
10
  settleEscrow
11
- } from "./chunk-JLNHMNES.js";
11
+ } from "./chunk-RYISHSHB.js";
12
12
  import {
13
13
  generateKeyPair,
14
14
  loadKeyPair,