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.
- package/dist/{chunk-7Q2XUXSA.js → chunk-4IPJJRTP.js} +1 -1
- package/dist/{chunk-EZVOG7QS.js → chunk-CKOOVZOI.js} +15 -18
- package/dist/chunk-CQFBNTGT.js +145 -0
- package/dist/{chunk-WKWJWKX7.js → chunk-DYQOFGGI.js} +155 -445
- package/dist/{chunk-NP55V7RQ.js → chunk-EG6RS4JC.js} +70 -46
- package/dist/{chunk-KBQNTUTN.js → chunk-LKLKYXLV.js} +1 -1
- package/dist/{chunk-STJLWMXH.js → chunk-MCED4GDW.js} +467 -98
- package/dist/{chunk-GWMMYVLL.js → chunk-MWOXW7JQ.js} +7 -7
- package/dist/{chunk-GJETGML6.js → chunk-QCGIG7WW.js} +4 -6
- package/dist/{chunk-UYCD3JBZ.js → chunk-QHZGOG3O.js} +148 -46
- package/dist/{chunk-JLNHMNES.js → chunk-RYISHSHB.js} +286 -1
- package/dist/{chunk-SRBVKO2V.js → chunk-S3V6R3EN.js} +66 -39
- package/dist/{chunk-RBXTWWUH.js → chunk-WNXXLCV5.js} +1 -1
- package/dist/{chunk-LOUEJI6X.js → chunk-XBGVQMQJ.js} +71 -47
- package/dist/{chunk-DEWY7OQK.js → chunk-Z2GEFFDO.js} +1 -1
- package/dist/cli/index.js +25 -28
- package/dist/{client-66TFS7RS.js → client-XOLP5IUZ.js} +1 -1
- package/dist/{conduct-A6COHLHY.js → conduct-AZFLNUX3.js} +9 -10
- package/dist/{conduct-IUVAXUAV.js → conduct-VPUYTNEA.js} +9 -10
- package/dist/{conductor-mode-L2MB44BW.js → conductor-mode-PLTB6MS3.js} +6 -7
- package/dist/{conductor-mode-D5TFQW5L.js → conductor-mode-WKB42PYM.js} +6 -3
- package/dist/{execute-WOS457HW.js → execute-NNDCXTN4.js} +3 -2
- package/dist/{execute-5AWLARB5.js → execute-RIRHTIBU.js} +5 -4
- package/dist/index.d.ts +5069 -0
- package/dist/index.js +208 -610
- package/dist/{publish-capability-JJCBBMSX.js → publish-capability-QDR2QIZ2.js} +2 -2
- package/dist/{request-6YQLA7K3.js → request-NX7GSPIG.js} +30 -40
- package/dist/{serve-skill-X7TZSILV.js → serve-skill-E6EJQYAK.js} +9 -8
- package/dist/{server-5TSP4DBX.js → server-VBCT32FC.js} +10 -14
- package/dist/{service-coordinator-WTUSMPY6.js → service-coordinator-KMSA6BST.js} +77 -32
- package/dist/skills/agentbnb/bootstrap.js +113 -69
- package/package.json +1 -1
- package/dist/chunk-BZOJ7HBT.js +0 -170
- 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-
|
|
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
|
|
294
|
-
|
|
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
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
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,
|
|
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
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
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
|
-
|
|
368
|
-
|
|
369
|
-
|
|
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") {
|