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.
- 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-TUCEDQGM.js +44 -0
- 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 +38 -74
- 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-OERS5BE7.js} +71 -33
- package/dist/{serve-skill-X7TZSILV.js → serve-skill-E6EJQYAK.js} +9 -8
- package/dist/{server-5TSP4DBX.js → server-46VEG2W7.js} +10 -14
- package/dist/{service-coordinator-WTUSMPY6.js → service-coordinator-KMSA6BST.js} +77 -32
- package/dist/skills/agentbnb/bootstrap.js +150 -62
- package/package.json +18 -12
- package/skills/agentbnb/install.sh +0 -0
- package/dist/chunk-BZOJ7HBT.js +0 -170
- package/dist/chunk-KF3TZHA5.js +0 -91
|
@@ -315,7 +315,10 @@ var V2_FTS_TRIGGERS = `
|
|
|
315
315
|
new.id,
|
|
316
316
|
new.owner,
|
|
317
317
|
COALESCE(
|
|
318
|
-
(SELECT group_concat(
|
|
318
|
+
(SELECT group_concat(
|
|
319
|
+
COALESCE(json_extract(value, '$.id'), '') || ' ' || COALESCE(json_extract(value, '$.name'), ''),
|
|
320
|
+
' '
|
|
321
|
+
)
|
|
319
322
|
FROM json_each(json_extract(new.data, '$.skills'))),
|
|
320
323
|
json_extract(new.data, '$.name'),
|
|
321
324
|
''
|
|
@@ -355,7 +358,10 @@ var V2_FTS_TRIGGERS = `
|
|
|
355
358
|
old.id,
|
|
356
359
|
old.owner,
|
|
357
360
|
COALESCE(
|
|
358
|
-
(SELECT group_concat(
|
|
361
|
+
(SELECT group_concat(
|
|
362
|
+
COALESCE(json_extract(value, '$.id'), '') || ' ' || COALESCE(json_extract(value, '$.name'), ''),
|
|
363
|
+
' '
|
|
364
|
+
)
|
|
359
365
|
FROM json_each(json_extract(old.data, '$.skills'))),
|
|
360
366
|
json_extract(old.data, '$.name'),
|
|
361
367
|
''
|
|
@@ -391,7 +397,10 @@ var V2_FTS_TRIGGERS = `
|
|
|
391
397
|
new.id,
|
|
392
398
|
new.owner,
|
|
393
399
|
COALESCE(
|
|
394
|
-
(SELECT group_concat(
|
|
400
|
+
(SELECT group_concat(
|
|
401
|
+
COALESCE(json_extract(value, '$.id'), '') || ' ' || COALESCE(json_extract(value, '$.name'), ''),
|
|
402
|
+
' '
|
|
403
|
+
)
|
|
395
404
|
FROM json_each(json_extract(new.data, '$.skills'))),
|
|
396
405
|
json_extract(new.data, '$.name'),
|
|
397
406
|
''
|
|
@@ -431,7 +440,10 @@ var V2_FTS_TRIGGERS = `
|
|
|
431
440
|
old.id,
|
|
432
441
|
old.owner,
|
|
433
442
|
COALESCE(
|
|
434
|
-
(SELECT group_concat(
|
|
443
|
+
(SELECT group_concat(
|
|
444
|
+
COALESCE(json_extract(value, '$.id'), '') || ' ' || COALESCE(json_extract(value, '$.name'), ''),
|
|
445
|
+
' '
|
|
446
|
+
)
|
|
435
447
|
FROM json_each(json_extract(old.data, '$.skills'))),
|
|
436
448
|
json_extract(old.data, '$.name'),
|
|
437
449
|
''
|
|
@@ -518,6 +530,10 @@ function runMigrations(db) {
|
|
|
518
530
|
const version = db.pragma("user_version")[0]?.user_version ?? 0;
|
|
519
531
|
if (version < 2) {
|
|
520
532
|
migrateV1toV2(db);
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
if (version < 3) {
|
|
536
|
+
migrateV2toV3(db);
|
|
521
537
|
}
|
|
522
538
|
}
|
|
523
539
|
function migrateV1toV2(db) {
|
|
@@ -559,44 +575,55 @@ function migrateV1toV2(db) {
|
|
|
559
575
|
);
|
|
560
576
|
}
|
|
561
577
|
db.exec(V2_FTS_TRIGGERS);
|
|
562
|
-
db
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
let tags;
|
|
573
|
-
if (skills.length > 0) {
|
|
574
|
-
name = skills.map((s) => String(s["name"] ?? "")).join(" ");
|
|
575
|
-
description = skills.map((s) => String(s["description"] ?? "")).join(" ");
|
|
576
|
-
tags = [
|
|
577
|
-
// tags from metadata.tags[]
|
|
578
|
-
...skills.flatMap((s) => {
|
|
579
|
-
const meta = s["metadata"];
|
|
580
|
-
return meta?.["tags"] ?? [];
|
|
581
|
-
}),
|
|
582
|
-
// capability_type (singular)
|
|
583
|
-
...skills.map((s) => s["capability_type"]).filter((v) => typeof v === "string" && v.length > 0),
|
|
584
|
-
// capability_types[] (plural)
|
|
585
|
-
...skills.flatMap((s) => s["capability_types"] ?? [])
|
|
586
|
-
].join(" ");
|
|
587
|
-
} else {
|
|
588
|
-
name = String(data["name"] ?? "");
|
|
589
|
-
description = String(data["description"] ?? "");
|
|
590
|
-
const meta = data["metadata"];
|
|
591
|
-
const rawTags = meta?.["tags"] ?? [];
|
|
592
|
-
tags = rawTags.join(" ");
|
|
593
|
-
}
|
|
594
|
-
ftsInsert.run(row.rowid, row.id, row.owner, name, description, tags);
|
|
595
|
-
}
|
|
596
|
-
db.pragma("user_version = 2");
|
|
578
|
+
rebuildCardsFts(db);
|
|
579
|
+
db.pragma("user_version = 3");
|
|
580
|
+
});
|
|
581
|
+
migrate();
|
|
582
|
+
}
|
|
583
|
+
function migrateV2toV3(db) {
|
|
584
|
+
const migrate = db.transaction(() => {
|
|
585
|
+
db.exec(V2_FTS_TRIGGERS);
|
|
586
|
+
rebuildCardsFts(db);
|
|
587
|
+
db.pragma("user_version = 3");
|
|
597
588
|
});
|
|
598
589
|
migrate();
|
|
599
590
|
}
|
|
591
|
+
function rebuildCardsFts(db) {
|
|
592
|
+
db.exec(`INSERT INTO cards_fts(cards_fts) VALUES('delete-all')`);
|
|
593
|
+
const allRows = db.prepare("SELECT rowid, id, owner, data FROM capability_cards").all();
|
|
594
|
+
const ftsInsert = db.prepare(
|
|
595
|
+
"INSERT INTO cards_fts(rowid, id, owner, name, description, tags) VALUES (?, ?, ?, ?, ?, ?)"
|
|
596
|
+
);
|
|
597
|
+
for (const row of allRows) {
|
|
598
|
+
const data = JSON.parse(row.data);
|
|
599
|
+
const skills = data["skills"] ?? [];
|
|
600
|
+
let name;
|
|
601
|
+
let description;
|
|
602
|
+
let tags;
|
|
603
|
+
if (skills.length > 0) {
|
|
604
|
+
name = skills.map((s) => `${String(s["id"] ?? "")} ${String(s["name"] ?? "")}`.trim()).join(" ");
|
|
605
|
+
description = skills.map((s) => String(s["description"] ?? "")).join(" ");
|
|
606
|
+
tags = [
|
|
607
|
+
// tags from metadata.tags[]
|
|
608
|
+
...skills.flatMap((s) => {
|
|
609
|
+
const meta = s["metadata"];
|
|
610
|
+
return meta?.["tags"] ?? [];
|
|
611
|
+
}),
|
|
612
|
+
// capability_type (singular)
|
|
613
|
+
...skills.map((s) => s["capability_type"]).filter((v) => typeof v === "string" && v.length > 0),
|
|
614
|
+
// capability_types[] (plural)
|
|
615
|
+
...skills.flatMap((s) => s["capability_types"] ?? [])
|
|
616
|
+
].join(" ");
|
|
617
|
+
} else {
|
|
618
|
+
name = String(data["name"] ?? "");
|
|
619
|
+
description = String(data["description"] ?? "");
|
|
620
|
+
const meta = data["metadata"];
|
|
621
|
+
const rawTags = meta?.["tags"] ?? [];
|
|
622
|
+
tags = rawTags.join(" ");
|
|
623
|
+
}
|
|
624
|
+
ftsInsert.run(row.rowid, row.id, row.owner, name, description, tags);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
600
627
|
function insertCard(db, card) {
|
|
601
628
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
602
629
|
const withTimestamps = { ...card, created_at: card.created_at ?? now, updated_at: now };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
holdEscrow
|
|
3
|
+
} from "./chunk-RYISHSHB.js";
|
|
4
|
+
import {
|
|
5
|
+
signEscrowReceipt
|
|
6
|
+
} from "./chunk-EJKW57ZV.js";
|
|
7
|
+
|
|
8
|
+
// src/credit/escrow-receipt.ts
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { randomUUID } from "crypto";
|
|
11
|
+
var EscrowReceiptSchema = z.object({
|
|
12
|
+
requester_owner: z.string().min(1),
|
|
13
|
+
requester_agent_id: z.string().optional(),
|
|
14
|
+
requester_public_key: z.string().min(1),
|
|
15
|
+
amount: z.number().positive(),
|
|
16
|
+
card_id: z.string().min(1),
|
|
17
|
+
skill_id: z.string().optional(),
|
|
18
|
+
timestamp: z.string(),
|
|
19
|
+
nonce: z.string().uuid(),
|
|
20
|
+
signature: z.string().min(1)
|
|
21
|
+
});
|
|
22
|
+
function createSignedEscrowReceipt(db, privateKey, publicKey, opts) {
|
|
23
|
+
const escrowId = holdEscrow(db, opts.owner, opts.amount, opts.cardId);
|
|
24
|
+
const receiptData = {
|
|
25
|
+
requester_owner: opts.owner,
|
|
26
|
+
...opts.agent_id ? { requester_agent_id: opts.agent_id } : {},
|
|
27
|
+
requester_public_key: publicKey.toString("hex"),
|
|
28
|
+
amount: opts.amount,
|
|
29
|
+
card_id: opts.cardId,
|
|
30
|
+
...opts.skillId ? { skill_id: opts.skillId } : {},
|
|
31
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
32
|
+
nonce: randomUUID()
|
|
33
|
+
};
|
|
34
|
+
const signature = signEscrowReceipt(receiptData, privateKey);
|
|
35
|
+
const receipt = {
|
|
36
|
+
...receiptData,
|
|
37
|
+
signature
|
|
38
|
+
};
|
|
39
|
+
return { escrowId, receipt };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
createSignedEscrowReceipt
|
|
44
|
+
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
settleProviderEarning
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WNXXLCV5.js";
|
|
4
|
+
import {
|
|
5
|
+
resolveTargetCapability
|
|
6
|
+
} from "./chunk-CQFBNTGT.js";
|
|
4
7
|
import {
|
|
5
8
|
getBalance,
|
|
6
9
|
holdEscrow,
|
|
7
10
|
releaseEscrow,
|
|
8
11
|
settleEscrow
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-RYISHSHB.js";
|
|
10
13
|
import {
|
|
11
14
|
verifyEscrowReceipt
|
|
12
15
|
} from "./chunk-EJKW57ZV.js";
|
|
@@ -17,7 +20,7 @@ import {
|
|
|
17
20
|
getCard,
|
|
18
21
|
insertRequestLog,
|
|
19
22
|
updateReputation
|
|
20
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-S3V6R3EN.js";
|
|
21
24
|
import {
|
|
22
25
|
AgentBnBError
|
|
23
26
|
} from "./chunk-WVY2W7AA.js";
|
|
@@ -272,8 +275,12 @@ async function executeCapabilityBatch(options) {
|
|
|
272
275
|
};
|
|
273
276
|
}
|
|
274
277
|
const executeItem = async (item, index) => {
|
|
275
|
-
const
|
|
276
|
-
|
|
278
|
+
const resolved = await resolveTargetCapability(item.skill_id, {
|
|
279
|
+
registryDb,
|
|
280
|
+
registryUrl: options.registryUrl,
|
|
281
|
+
onlineOnly: true
|
|
282
|
+
});
|
|
283
|
+
if (!resolved) {
|
|
277
284
|
return {
|
|
278
285
|
request_index: index,
|
|
279
286
|
status: "failed",
|
|
@@ -282,26 +289,11 @@ async function executeCapabilityBatch(options) {
|
|
|
282
289
|
error: `Card/skill not found: ${item.skill_id}`
|
|
283
290
|
};
|
|
284
291
|
}
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
const skill = v2card.skills[0];
|
|
291
|
-
if (!skill) {
|
|
292
|
-
return {
|
|
293
|
-
request_index: index,
|
|
294
|
-
status: "failed",
|
|
295
|
-
credits_spent: 0,
|
|
296
|
-
credits_refunded: 0,
|
|
297
|
-
error: `No skills defined on card: ${item.skill_id}`
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
creditsNeeded = skill.pricing.credits_per_call;
|
|
301
|
-
resolvedSkillId = skill.id;
|
|
302
|
-
} else {
|
|
303
|
-
creditsNeeded = card.pricing.credits_per_call;
|
|
304
|
-
}
|
|
292
|
+
const localCard = getCard(registryDb, resolved.cardId);
|
|
293
|
+
const localCardRaw = localCard;
|
|
294
|
+
const cardName = typeof localCardRaw?.["name"] === "string" ? localCardRaw["name"] : typeof localCardRaw?.["agent_name"] === "string" ? localCardRaw["agent_name"] : resolved.cardId;
|
|
295
|
+
const creditsNeeded = resolved.credits_per_call;
|
|
296
|
+
const resolvedSkillId = resolved.skillId;
|
|
305
297
|
if (creditsNeeded > item.max_credits) {
|
|
306
298
|
return {
|
|
307
299
|
request_index: index,
|
|
@@ -323,7 +315,7 @@ async function executeCapabilityBatch(options) {
|
|
|
323
315
|
error: "Insufficient credits"
|
|
324
316
|
};
|
|
325
317
|
}
|
|
326
|
-
escrowId = holdEscrow(creditDb, owner, creditsNeeded,
|
|
318
|
+
escrowId = holdEscrow(creditDb, owner, creditsNeeded, resolved.cardId);
|
|
327
319
|
} catch (err) {
|
|
328
320
|
const msg = err instanceof AgentBnBError ? err.message : "Failed to hold escrow";
|
|
329
321
|
return {
|
|
@@ -335,30 +327,62 @@ async function executeCapabilityBatch(options) {
|
|
|
335
327
|
};
|
|
336
328
|
}
|
|
337
329
|
const startMs = Date.now();
|
|
338
|
-
const latencyMs = Date.now() - startMs;
|
|
339
|
-
settleEscrow(creditDb, escrowId, card.owner);
|
|
340
|
-
updateReputation(registryDb, card.id, true, latencyMs);
|
|
341
330
|
try {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
331
|
+
const result = options.dispatchRequest ? await options.dispatchRequest({
|
|
332
|
+
target: resolved,
|
|
333
|
+
params: item.params,
|
|
334
|
+
requester: owner
|
|
335
|
+
}) : { card_id: resolved.cardId, skill_id: resolvedSkillId };
|
|
336
|
+
const latencyMs = Date.now() - startMs;
|
|
337
|
+
settleEscrow(creditDb, escrowId, resolved.owner);
|
|
338
|
+
updateReputation(registryDb, resolved.cardId, true, latencyMs);
|
|
339
|
+
try {
|
|
340
|
+
insertRequestLog(registryDb, {
|
|
341
|
+
id: randomUUID(),
|
|
342
|
+
card_id: resolved.cardId,
|
|
343
|
+
card_name: cardName,
|
|
344
|
+
skill_id: resolvedSkillId,
|
|
345
|
+
requester: owner,
|
|
346
|
+
status: "success",
|
|
347
|
+
latency_ms: latencyMs,
|
|
348
|
+
credits_charged: creditsNeeded,
|
|
349
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
350
|
+
});
|
|
351
|
+
} catch {
|
|
352
|
+
}
|
|
353
|
+
return {
|
|
354
|
+
request_index: index,
|
|
348
355
|
status: "success",
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
} catch {
|
|
356
|
+
result,
|
|
357
|
+
credits_spent: creditsNeeded,
|
|
358
|
+
credits_refunded: 0
|
|
359
|
+
};
|
|
360
|
+
} catch (err) {
|
|
361
|
+
releaseEscrow(creditDb, escrowId);
|
|
362
|
+
const latencyMs = Date.now() - startMs;
|
|
363
|
+
try {
|
|
364
|
+
insertRequestLog(registryDb, {
|
|
365
|
+
id: randomUUID(),
|
|
366
|
+
card_id: resolved.cardId,
|
|
367
|
+
card_name: cardName,
|
|
368
|
+
skill_id: resolvedSkillId,
|
|
369
|
+
requester: owner,
|
|
370
|
+
status: "failure",
|
|
371
|
+
latency_ms: latencyMs,
|
|
372
|
+
credits_charged: 0,
|
|
373
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
374
|
+
failure_reason: "not_found"
|
|
375
|
+
});
|
|
376
|
+
} catch {
|
|
377
|
+
}
|
|
378
|
+
return {
|
|
379
|
+
request_index: index,
|
|
380
|
+
status: "failed",
|
|
381
|
+
credits_spent: 0,
|
|
382
|
+
credits_refunded: creditsNeeded,
|
|
383
|
+
error: err instanceof Error ? err.message : String(err)
|
|
384
|
+
};
|
|
354
385
|
}
|
|
355
|
-
return {
|
|
356
|
-
request_index: index,
|
|
357
|
-
status: "success",
|
|
358
|
-
result: { card_id: card.id, skill_id: resolvedSkillId },
|
|
359
|
-
credits_spent: creditsNeeded,
|
|
360
|
-
credits_refunded: 0
|
|
361
|
-
};
|
|
362
386
|
};
|
|
363
387
|
let results;
|
|
364
388
|
if (strategy === "sequential") {
|
package/dist/cli/index.js
CHANGED
|
@@ -7,55 +7,50 @@ import {
|
|
|
7
7
|
discoverLocalAgents,
|
|
8
8
|
getPricingStats,
|
|
9
9
|
resolveSelfCli
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import {
|
|
12
|
-
releaseRequesterEscrow,
|
|
13
|
-
settleRequesterEscrow
|
|
14
|
-
} from "../chunk-RBXTWWUH.js";
|
|
10
|
+
} from "../chunk-Z2GEFFDO.js";
|
|
15
11
|
import {
|
|
16
12
|
createLedger,
|
|
17
13
|
ensureIdentity,
|
|
18
14
|
loadOrRepairIdentity
|
|
19
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-LKLKYXLV.js";
|
|
20
16
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
releaseRequesterEscrow,
|
|
18
|
+
settleRequesterEscrow
|
|
19
|
+
} from "../chunk-WNXXLCV5.js";
|
|
20
|
+
import {
|
|
21
|
+
createSignedEscrowReceipt
|
|
22
|
+
} from "../chunk-TUCEDQGM.js";
|
|
23
23
|
import {
|
|
24
24
|
AutoRequestor,
|
|
25
25
|
BudgetManager,
|
|
26
26
|
DEFAULT_BUDGET_CONFIG
|
|
27
|
-
} from "../chunk-
|
|
28
|
-
import {
|
|
29
|
-
fetchRemoteCards,
|
|
30
|
-
mergeResults
|
|
31
|
-
} from "../chunk-KF3TZHA5.js";
|
|
27
|
+
} from "../chunk-QHZGOG3O.js";
|
|
32
28
|
import {
|
|
33
29
|
DEFAULT_AUTONOMY_CONFIG
|
|
34
30
|
} from "../chunk-GKVTD4EZ.js";
|
|
35
|
-
import
|
|
36
|
-
filterCards,
|
|
37
|
-
searchCards
|
|
38
|
-
} from "../chunk-BZOJ7HBT.js";
|
|
31
|
+
import "../chunk-CQFBNTGT.js";
|
|
39
32
|
import {
|
|
40
33
|
bootstrapAgent,
|
|
41
34
|
createAgentRecord,
|
|
35
|
+
fetchRemoteCards,
|
|
36
|
+
filterCards,
|
|
42
37
|
getBalance,
|
|
43
38
|
getTransactions,
|
|
44
|
-
holdEscrow,
|
|
45
39
|
lookupAgent,
|
|
46
40
|
lookupAgentByOwner,
|
|
41
|
+
mergeResults,
|
|
47
42
|
migrateOwner,
|
|
48
|
-
openCreditDb
|
|
49
|
-
|
|
43
|
+
openCreditDb,
|
|
44
|
+
searchCards
|
|
45
|
+
} from "../chunk-RYISHSHB.js";
|
|
50
46
|
import "../chunk-NWIQJ2CL.js";
|
|
51
47
|
import {
|
|
52
48
|
requestCapability
|
|
53
|
-
} from "../chunk-
|
|
49
|
+
} from "../chunk-CKOOVZOI.js";
|
|
54
50
|
import {
|
|
55
51
|
generateKeyPair,
|
|
56
52
|
loadKeyPair,
|
|
57
|
-
saveKeyPair
|
|
58
|
-
signEscrowReceipt
|
|
53
|
+
saveKeyPair
|
|
59
54
|
} from "../chunk-EJKW57ZV.js";
|
|
60
55
|
import {
|
|
61
56
|
findPeer,
|
|
@@ -68,13 +63,16 @@ import {
|
|
|
68
63
|
loadConfig,
|
|
69
64
|
saveConfig
|
|
70
65
|
} from "../chunk-75OC6E4F.js";
|
|
66
|
+
import {
|
|
67
|
+
parseSoulMd
|
|
68
|
+
} from "../chunk-4IPJJRTP.js";
|
|
71
69
|
import {
|
|
72
70
|
deleteCard,
|
|
73
71
|
getCard,
|
|
74
72
|
insertCard,
|
|
75
73
|
listCards,
|
|
76
74
|
openDatabase
|
|
77
|
-
} from "../chunk-
|
|
75
|
+
} from "../chunk-S3V6R3EN.js";
|
|
78
76
|
import {
|
|
79
77
|
AgentBnBError,
|
|
80
78
|
AnyCardSchema,
|
|
@@ -84,47 +82,13 @@ import {
|
|
|
84
82
|
// src/cli/index.ts
|
|
85
83
|
import { Command } from "commander";
|
|
86
84
|
import { readFileSync as readFileSync4 } from "fs";
|
|
87
|
-
import { randomUUID as
|
|
85
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
88
86
|
import { join as join4 } from "path";
|
|
89
87
|
import { networkInterfaces as networkInterfaces2 } from "os";
|
|
90
88
|
import { createInterface as createInterface3 } from "readline";
|
|
91
89
|
|
|
92
|
-
// src/credit/escrow-receipt.ts
|
|
93
|
-
import { z } from "zod";
|
|
94
|
-
import { randomUUID } from "crypto";
|
|
95
|
-
var EscrowReceiptSchema = z.object({
|
|
96
|
-
requester_owner: z.string().min(1),
|
|
97
|
-
requester_agent_id: z.string().optional(),
|
|
98
|
-
requester_public_key: z.string().min(1),
|
|
99
|
-
amount: z.number().positive(),
|
|
100
|
-
card_id: z.string().min(1),
|
|
101
|
-
skill_id: z.string().optional(),
|
|
102
|
-
timestamp: z.string(),
|
|
103
|
-
nonce: z.string().uuid(),
|
|
104
|
-
signature: z.string().min(1)
|
|
105
|
-
});
|
|
106
|
-
function createSignedEscrowReceipt(db, privateKey, publicKey, opts) {
|
|
107
|
-
const escrowId = holdEscrow(db, opts.owner, opts.amount, opts.cardId);
|
|
108
|
-
const receiptData = {
|
|
109
|
-
requester_owner: opts.owner,
|
|
110
|
-
...opts.agent_id ? { requester_agent_id: opts.agent_id } : {},
|
|
111
|
-
requester_public_key: publicKey.toString("hex"),
|
|
112
|
-
amount: opts.amount,
|
|
113
|
-
card_id: opts.cardId,
|
|
114
|
-
...opts.skillId ? { skill_id: opts.skillId } : {},
|
|
115
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
116
|
-
nonce: randomUUID()
|
|
117
|
-
};
|
|
118
|
-
const signature = signEscrowReceipt(receiptData, privateKey);
|
|
119
|
-
const receipt = {
|
|
120
|
-
...receiptData,
|
|
121
|
-
signature
|
|
122
|
-
};
|
|
123
|
-
return { escrowId, receipt };
|
|
124
|
-
}
|
|
125
|
-
|
|
126
90
|
// src/openclaw/soul-sync.ts
|
|
127
|
-
import { randomUUID
|
|
91
|
+
import { randomUUID } from "crypto";
|
|
128
92
|
var SKILL_META_GLOBAL_RE = /(?:^|\s)-\s*(capability_types|requires(?:_capabilities)?|visibility)\s*:\s*([^-][^]*?)(?=\s+-\s+(?:capability_types|requires(?:_capabilities)?|visibility)\s*:|$)/gi;
|
|
129
93
|
function extractSkillMeta(raw) {
|
|
130
94
|
let capability_types;
|
|
@@ -159,7 +123,7 @@ function parseSoulMdV2(content) {
|
|
|
159
123
|
const parsed = parseSoulMd(content);
|
|
160
124
|
const skills = parsed.capabilities.map((cap) => {
|
|
161
125
|
const sanitizedId = cap.name.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
|
|
162
|
-
const id = sanitizedId.length > 0 ? sanitizedId :
|
|
126
|
+
const id = sanitizedId.length > 0 ? sanitizedId : randomUUID();
|
|
163
127
|
const { description: cleanDesc, capability_types, requires_capabilities, visibility } = extractSkillMeta(cap.description);
|
|
164
128
|
const finalDescription = (cleanDesc || cap.name).slice(0, 500);
|
|
165
129
|
const skill = {
|
|
@@ -213,7 +177,7 @@ function publishFromSoulV2(db, soulContent, owner, sharedSkills) {
|
|
|
213
177
|
(c) => c.spec_version === "2.0"
|
|
214
178
|
);
|
|
215
179
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
216
|
-
const cardId = existingV2?.id ??
|
|
180
|
+
const cardId = existingV2?.id ?? randomUUID();
|
|
217
181
|
const card = {
|
|
218
182
|
spec_version: "2.0",
|
|
219
183
|
id: cardId,
|
|
@@ -329,7 +293,7 @@ import { join as join2 } from "path";
|
|
|
329
293
|
import { networkInterfaces } from "os";
|
|
330
294
|
|
|
331
295
|
// src/onboarding/index.ts
|
|
332
|
-
import { randomUUID as
|
|
296
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
333
297
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
334
298
|
import { join } from "path";
|
|
335
299
|
|
|
@@ -492,7 +456,7 @@ function capabilitiesToV2Card(capabilities, owner, agentName) {
|
|
|
492
456
|
}));
|
|
493
457
|
const card = {
|
|
494
458
|
spec_version: "2.0",
|
|
495
|
-
id:
|
|
459
|
+
id: randomUUID2(),
|
|
496
460
|
owner,
|
|
497
461
|
agent_name: agentName ?? owner,
|
|
498
462
|
skills,
|
|
@@ -922,7 +886,7 @@ Skills: ${skills.skillCount} skill(s) in ${skills.path}`);
|
|
|
922
886
|
if (!skipServe) {
|
|
923
887
|
try {
|
|
924
888
|
const { ProcessGuard } = await import("../process-guard-GH5LRNWO.js");
|
|
925
|
-
const { ServiceCoordinator } = await import("../service-coordinator-
|
|
889
|
+
const { ServiceCoordinator } = await import("../service-coordinator-KMSA6BST.js");
|
|
926
890
|
const guard = new ProcessGuard(join3(initResult.configDir, ".pid"));
|
|
927
891
|
const coordinator = new ServiceCoordinator(initResult.config, guard);
|
|
928
892
|
const result = await coordinator.ensureRunning({
|
|
@@ -984,7 +948,7 @@ Skills: ${skills.skillCount} skill(s) in ${skills.path}`);
|
|
|
984
948
|
}
|
|
985
949
|
|
|
986
950
|
// src/cli/index.ts
|
|
987
|
-
var VERSION = "8.2.
|
|
951
|
+
var VERSION = "8.2.3";
|
|
988
952
|
function loadIdentityAuth2(owner) {
|
|
989
953
|
const configDir = getConfigDir();
|
|
990
954
|
let keys;
|
|
@@ -1165,7 +1129,7 @@ program.command("publish-skills").description("Publish capabilities from skills.
|
|
|
1165
1129
|
process.exit(1);
|
|
1166
1130
|
}
|
|
1167
1131
|
const { parseSkillsFile } = await import("../skill-config-FETXPNVP.js");
|
|
1168
|
-
const { skillConfigToSkill } = await import("../publish-capability-
|
|
1132
|
+
const { skillConfigToSkill } = await import("../publish-capability-QDR2QIZ2.js");
|
|
1169
1133
|
const skillsPath = typeof opts.fromSkills === "string" ? opts.fromSkills : "./skills.yaml";
|
|
1170
1134
|
let yamlContent;
|
|
1171
1135
|
try {
|
|
@@ -1193,7 +1157,7 @@ program.command("publish-skills").description("Publish capabilities from skills.
|
|
|
1193
1157
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1194
1158
|
const card = {
|
|
1195
1159
|
spec_version: "2.0",
|
|
1196
|
-
id:
|
|
1160
|
+
id: randomUUID3(),
|
|
1197
1161
|
owner: config.owner,
|
|
1198
1162
|
agent_name: config.owner,
|
|
1199
1163
|
skills,
|
|
@@ -1699,13 +1663,13 @@ Batch Results (${res.results.length} items):`);
|
|
|
1699
1663
|
};
|
|
1700
1664
|
const tryViaRelay = async () => {
|
|
1701
1665
|
const { RelayClient } = await import("../websocket-client-QOVARTRN.js");
|
|
1702
|
-
const { requestViaRelay } = await import("../client-
|
|
1703
|
-
const requesterId = `${config.owner}:req:${
|
|
1666
|
+
const { requestViaRelay } = await import("../client-XOLP5IUZ.js");
|
|
1667
|
+
const requesterId = `${config.owner}:req:${randomUUID3()}`;
|
|
1704
1668
|
const tempRelay = new RelayClient({
|
|
1705
1669
|
registryUrl: config.registry,
|
|
1706
1670
|
owner: requesterId,
|
|
1707
1671
|
token: config.token,
|
|
1708
|
-
card: { id:
|
|
1672
|
+
card: { id: randomUUID3(), owner: requesterId, name: requesterId, description: "Requester", level: 1, spec_version: "1.0", inputs: [], outputs: [], pricing: { credits_per_call: 1 }, availability: { online: false } },
|
|
1709
1673
|
onRequest: async () => ({ error: { code: -32601, message: "Not serving" } }),
|
|
1710
1674
|
silent: true
|
|
1711
1675
|
});
|
|
@@ -1829,7 +1793,7 @@ program.command("serve").description("Start the AgentBnB gateway server").option
|
|
|
1829
1793
|
process.exit(1);
|
|
1830
1794
|
}
|
|
1831
1795
|
const { ProcessGuard } = await import("../process-guard-GH5LRNWO.js");
|
|
1832
|
-
const { ServiceCoordinator } = await import("../service-coordinator-
|
|
1796
|
+
const { ServiceCoordinator } = await import("../service-coordinator-KMSA6BST.js");
|
|
1833
1797
|
const port = opts.port ? parseInt(opts.port, 10) : config.gateway_port;
|
|
1834
1798
|
const registryPort = parseInt(opts.registryPort, 10);
|
|
1835
1799
|
if (!Number.isFinite(port) || !Number.isFinite(registryPort)) {
|
|
@@ -2203,7 +2167,7 @@ openclaw.command("rules").description("Print HEARTBEAT.md rules block (or inject
|
|
|
2203
2167
|
}
|
|
2204
2168
|
});
|
|
2205
2169
|
program.command("conduct <task>").description("Orchestrate a complex task across the AgentBnB network").option("--plan-only", "Show execution plan without executing").option("--max-budget <credits>", "Maximum credits to spend", "100").option("--json", "Output as JSON").action(async (task, opts) => {
|
|
2206
|
-
const { conductAction } = await import("../conduct-
|
|
2170
|
+
const { conductAction } = await import("../conduct-VPUYTNEA.js");
|
|
2207
2171
|
const result = await conductAction(task, opts);
|
|
2208
2172
|
if (opts.json) {
|
|
2209
2173
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2315,7 +2279,7 @@ Feedback for skill: ${opts.skill} (${feedbacks.length} entries)
|
|
|
2315
2279
|
});
|
|
2316
2280
|
program.command("quickstart").alias("qs").description("One-command setup: init + skills.yaml + MCP registration + serve daemon").option("--owner <name>", "Agent owner name").option("--port <port>", "Gateway port", "7700").option("--no-serve", "Skip starting background daemon").option("--no-mcp", "Skip MCP registration with Claude Code").option("--json", "Output as JSON").action(runQuickstart);
|
|
2317
2281
|
program.command("mcp-server").description("Start an MCP (Model Context Protocol) server for IDE integration").action(async () => {
|
|
2318
|
-
const { startMcpServer } = await import("../server-
|
|
2282
|
+
const { startMcpServer } = await import("../server-46VEG2W7.js");
|
|
2319
2283
|
await startMcpServer();
|
|
2320
2284
|
});
|
|
2321
2285
|
await program.parseAsync(process.argv);
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
conductAction
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-SSK653A6.js";
|
|
6
|
-
import "./chunk-GJETGML6.js";
|
|
3
|
+
} from "./chunk-MWOXW7JQ.js";
|
|
4
|
+
import "./chunk-QCGIG7WW.js";
|
|
7
5
|
import "./chunk-3MJT4PZG.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-KF3TZHA5.js";
|
|
6
|
+
import "./chunk-QHZGOG3O.js";
|
|
10
7
|
import "./chunk-GKVTD4EZ.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-CQFBNTGT.js";
|
|
9
|
+
import "./chunk-RYISHSHB.js";
|
|
13
10
|
import "./chunk-NWIQJ2CL.js";
|
|
14
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-CKOOVZOI.js";
|
|
15
12
|
import "./chunk-EJKW57ZV.js";
|
|
16
13
|
import "./chunk-5AH3CMOX.js";
|
|
17
14
|
import "./chunk-75OC6E4F.js";
|
|
18
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-Z4MCGKTL.js";
|
|
16
|
+
import "./chunk-SSK653A6.js";
|
|
17
|
+
import "./chunk-S3V6R3EN.js";
|
|
19
18
|
import "./chunk-WVY2W7AA.js";
|
|
20
19
|
|
|
21
20
|
// src/mcp/tools/conduct.ts
|