agentbnb 5.1.11 → 6.0.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.
- package/dist/{card-RSGDCHCV.js → card-REW7BSWW.js} +1 -1
- package/dist/{chunk-EPIWHNB2.js → chunk-2TLZ6G2B.js} +446 -373
- package/dist/{chunk-WGZ5AGOX.js → chunk-3CIMVISQ.js} +24 -1
- package/dist/{chunk-NH2FIERR.js → chunk-574W3HHE.js} +1 -1
- package/dist/{chunk-B5FTAGFN.js → chunk-7XHDSWRD.js} +75 -75
- package/dist/{chunk-NLAWT4DT.js → chunk-7YLFLC5C.js} +6 -6
- package/dist/chunk-BP3L2TET.js +148 -0
- package/dist/{chunk-EGUOAHCW.js → chunk-C2T4BMRW.js} +12 -12
- package/dist/{chunk-5KFI5X7B.js → chunk-F53QQIM2.js} +1 -1
- package/dist/chunk-JR6TJDIF.js +425 -0
- package/dist/{chunk-DFBX3BBD.js → chunk-KA2VIEGM.js} +211 -16
- package/dist/chunk-NQTE577Q.js +159 -0
- package/dist/{chunk-WTXRY7R2.js → chunk-NYV3NE5Z.js} +157 -9
- package/dist/{chunk-UKT6H7YT.js → chunk-OZXCRLP3.js} +1 -1
- package/dist/{chunk-QITOPASZ.js → chunk-PSQHUZ7X.js} +1 -1
- package/dist/{chunk-EANI2N2V.js → chunk-RVYQSC6L.js} +2 -99
- package/dist/{chunk-MLS6IGGG.js → chunk-TQDV254A.js} +1 -1
- package/dist/{chunk-QQFBFV4V.js → chunk-TR6UZDNX.js} +57 -18
- package/dist/{chunk-ZX5623ER.js → chunk-VMH2YS2I.js} +1 -1
- package/dist/{chunk-XND2DWTZ.js → chunk-VPQ44XKE.js} +2 -2
- package/dist/{chunk-CSATDXZC.js → chunk-Y7T6IMM3.js} +1 -1
- package/dist/{chunk-FLY3WIQR.js → chunk-YRRVFTDR.js} +3 -3
- package/dist/cli/index.js +261 -125
- package/dist/{client-T5MTY3CS.js → client-HRYRJKSA.js} +3 -3
- package/dist/{conduct-WU3VEXB6.js → conduct-LF6FYPLD.js} +11 -11
- package/dist/conduct-QAFZIEY6.js +21 -0
- package/dist/{conductor-mode-ZMTFZGJP.js → conductor-mode-NUDQLZFM.js} +309 -13
- package/dist/conductor-mode-YQ6QSPPT.js +275 -0
- package/dist/{execute-4D4ITQCL.js → execute-ITHIYYOX.js} +4 -3
- package/dist/execute-PNJFABVJ.js +14 -0
- package/dist/index.d.ts +555 -0
- package/dist/index.js +592 -83
- package/dist/{process-guard-CC7CNRQJ.js → process-guard-QCCBGILS.js} +1 -1
- package/dist/publish-capability-TS6CNR5G.js +12 -0
- package/dist/{request-VOXBFUOG.js → request-P6QCTCCG.js} +14 -14
- package/dist/{serve-skill-IH7UAJNR.js → serve-skill-EZOL7UYN.js} +10 -9
- package/dist/{server-JVQW2TID.js → server-3G6ZTASA.js} +16 -16
- package/dist/{service-coordinator-EYRDTHL5.js → service-coordinator-CRSE4GWC.js} +174 -242
- package/dist/skill-config-4W5W5O6T.js +22 -0
- package/dist/skills/agentbnb/bootstrap.js +227 -67
- package/package.json +1 -1
- package/skills/agentbnb/SKILL.md +35 -0
- package/skills/agentbnb/bootstrap.ts +126 -8
- package/skills/agentbnb/install.sh +49 -9
- package/dist/chunk-CRFCWD6V.js +0 -366
- package/dist/conduct-6LKIJJKQ.js +0 -21
- package/dist/conductor-mode-Q4IIDY5E.js +0 -123
- package/dist/execute-T7Y6RKSW.js +0 -13
|
@@ -12,53 +12,54 @@ import {
|
|
|
12
12
|
requestViaRelay,
|
|
13
13
|
resolvePendingRequest,
|
|
14
14
|
searchCards
|
|
15
|
-
} from "../../chunk-
|
|
16
|
-
import {
|
|
17
|
-
getConfigDir,
|
|
18
|
-
loadConfig
|
|
19
|
-
} from "../../chunk-IVOYM3WG.js";
|
|
15
|
+
} from "../../chunk-7XHDSWRD.js";
|
|
20
16
|
import {
|
|
21
17
|
executeCapabilityBatch,
|
|
22
18
|
executeCapabilityRequest,
|
|
23
|
-
getActivityFeed,
|
|
24
|
-
getCard,
|
|
25
|
-
getEvolutionHistory,
|
|
26
|
-
getLatestEvolution,
|
|
27
|
-
getRequestLog,
|
|
28
|
-
getSkillRequestCount,
|
|
29
|
-
insertCard,
|
|
30
|
-
insertEvolution,
|
|
31
|
-
insertRequestLog,
|
|
32
|
-
listCards,
|
|
33
|
-
openDatabase,
|
|
34
19
|
releaseRequesterEscrow,
|
|
35
|
-
settleRequesterEscrow
|
|
36
|
-
|
|
37
|
-
updateSkillAvailability,
|
|
38
|
-
updateSkillIdleRate
|
|
39
|
-
} from "../../chunk-EPIWHNB2.js";
|
|
20
|
+
settleRequesterEscrow
|
|
21
|
+
} from "../../chunk-JR6TJDIF.js";
|
|
40
22
|
import {
|
|
41
23
|
bootstrapAgent,
|
|
42
24
|
generateKeyPair,
|
|
25
|
+
getActivityFeed,
|
|
43
26
|
getBalance,
|
|
27
|
+
getCard,
|
|
28
|
+
getCardsBySkillCapability,
|
|
29
|
+
getEvolutionHistory,
|
|
44
30
|
getFeedbackForProvider,
|
|
45
31
|
getFeedbackForSkill,
|
|
32
|
+
getLatestEvolution,
|
|
33
|
+
getRequestLog,
|
|
34
|
+
getSkillRequestCount,
|
|
46
35
|
getTransactions,
|
|
47
36
|
holdEscrow,
|
|
37
|
+
insertCard,
|
|
38
|
+
insertEvolution,
|
|
48
39
|
insertFeedback,
|
|
40
|
+
insertRequestLog,
|
|
41
|
+
listCards,
|
|
49
42
|
loadKeyPair,
|
|
50
43
|
migrateOwner,
|
|
51
44
|
openCreditDb,
|
|
45
|
+
openDatabase,
|
|
52
46
|
releaseEscrow,
|
|
53
47
|
saveKeyPair,
|
|
54
48
|
settleEscrow,
|
|
55
49
|
signEscrowReceipt,
|
|
50
|
+
updateCard,
|
|
51
|
+
updateSkillAvailability,
|
|
52
|
+
updateSkillIdleRate,
|
|
56
53
|
verifyEscrowReceipt
|
|
57
|
-
} from "../../chunk-
|
|
54
|
+
} from "../../chunk-2TLZ6G2B.js";
|
|
55
|
+
import {
|
|
56
|
+
getConfigDir,
|
|
57
|
+
loadConfig
|
|
58
|
+
} from "../../chunk-IVOYM3WG.js";
|
|
58
59
|
import {
|
|
59
60
|
AgentBnBError,
|
|
60
61
|
AnyCardSchema
|
|
61
|
-
} from "../../chunk-
|
|
62
|
+
} from "../../chunk-3CIMVISQ.js";
|
|
62
63
|
import {
|
|
63
64
|
RelayClient,
|
|
64
65
|
RelayMessageSchema
|
|
@@ -66,7 +67,11 @@ import {
|
|
|
66
67
|
|
|
67
68
|
// skills/agentbnb/bootstrap.ts
|
|
68
69
|
import { join as join5 } from "path";
|
|
70
|
+
import { dirname as dirname4, basename } from "path";
|
|
71
|
+
import { existsSync as existsSync6 } from "fs";
|
|
72
|
+
import { homedir as homedir2 } from "os";
|
|
69
73
|
import { spawnSync } from "child_process";
|
|
74
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
70
75
|
|
|
71
76
|
// src/runtime/process-guard.ts
|
|
72
77
|
import { dirname, join } from "path";
|
|
@@ -324,6 +329,9 @@ function createSkillExecutor(configs, modes) {
|
|
|
324
329
|
// src/skills/skill-config.ts
|
|
325
330
|
import { z } from "zod";
|
|
326
331
|
import yaml from "js-yaml";
|
|
332
|
+
var CapacitySchema = z.object({
|
|
333
|
+
max_concurrent: z.number().positive().int().optional()
|
|
334
|
+
}).optional();
|
|
327
335
|
var PricingSchema = z.object({
|
|
328
336
|
credits_per_call: z.number().nonnegative(),
|
|
329
337
|
credits_per_minute: z.number().nonnegative().optional(),
|
|
@@ -345,6 +353,12 @@ var ApiAuthSchema = z.discriminatedUnion("type", [
|
|
|
345
353
|
password: z.string()
|
|
346
354
|
})
|
|
347
355
|
]);
|
|
356
|
+
var CapabilityDeclarationSchema = {
|
|
357
|
+
description: z.string().optional(),
|
|
358
|
+
capability_types: z.array(z.string()).optional(),
|
|
359
|
+
requires_capabilities: z.array(z.string()).optional(),
|
|
360
|
+
visibility: z.enum(["public", "private"]).optional()
|
|
361
|
+
};
|
|
348
362
|
var ApiSkillConfigSchema = z.object({
|
|
349
363
|
id: z.string().min(1),
|
|
350
364
|
type: z.literal("api"),
|
|
@@ -357,7 +371,9 @@ var ApiSkillConfigSchema = z.object({
|
|
|
357
371
|
pricing: PricingSchema,
|
|
358
372
|
timeout_ms: z.number().positive().default(3e4),
|
|
359
373
|
retries: z.number().nonnegative().int().default(0),
|
|
360
|
-
provider: z.string().optional()
|
|
374
|
+
provider: z.string().optional(),
|
|
375
|
+
capacity: CapacitySchema,
|
|
376
|
+
...CapabilityDeclarationSchema
|
|
361
377
|
});
|
|
362
378
|
var PipelineStepSchema = z.union([
|
|
363
379
|
z.object({
|
|
@@ -375,7 +391,9 @@ var PipelineSkillConfigSchema = z.object({
|
|
|
375
391
|
name: z.string().min(1),
|
|
376
392
|
steps: z.array(PipelineStepSchema).min(1),
|
|
377
393
|
pricing: PricingSchema,
|
|
378
|
-
timeout_ms: z.number().positive().optional()
|
|
394
|
+
timeout_ms: z.number().positive().optional(),
|
|
395
|
+
capacity: CapacitySchema,
|
|
396
|
+
...CapabilityDeclarationSchema
|
|
379
397
|
});
|
|
380
398
|
var OpenClawSkillConfigSchema = z.object({
|
|
381
399
|
id: z.string().min(1),
|
|
@@ -384,7 +402,9 @@ var OpenClawSkillConfigSchema = z.object({
|
|
|
384
402
|
agent_name: z.string().min(1),
|
|
385
403
|
channel: z.enum(["telegram", "webhook", "process"]),
|
|
386
404
|
pricing: PricingSchema,
|
|
387
|
-
timeout_ms: z.number().positive().optional()
|
|
405
|
+
timeout_ms: z.number().positive().optional(),
|
|
406
|
+
capacity: CapacitySchema,
|
|
407
|
+
...CapabilityDeclarationSchema
|
|
388
408
|
});
|
|
389
409
|
var CommandSkillConfigSchema = z.object({
|
|
390
410
|
id: z.string().min(1),
|
|
@@ -395,7 +415,9 @@ var CommandSkillConfigSchema = z.object({
|
|
|
395
415
|
allowed_commands: z.array(z.string()).optional(),
|
|
396
416
|
working_dir: z.string().optional(),
|
|
397
417
|
timeout_ms: z.number().positive().default(3e4),
|
|
398
|
-
pricing: PricingSchema
|
|
418
|
+
pricing: PricingSchema,
|
|
419
|
+
capacity: CapacitySchema,
|
|
420
|
+
...CapabilityDeclarationSchema
|
|
399
421
|
});
|
|
400
422
|
var ConductorSkillConfigSchema = z.object({
|
|
401
423
|
id: z.string().min(1),
|
|
@@ -403,7 +425,9 @@ var ConductorSkillConfigSchema = z.object({
|
|
|
403
425
|
name: z.string().min(1),
|
|
404
426
|
conductor_skill: z.enum(["orchestrate", "plan"]),
|
|
405
427
|
pricing: PricingSchema,
|
|
406
|
-
timeout_ms: z.number().positive().optional()
|
|
428
|
+
timeout_ms: z.number().positive().optional(),
|
|
429
|
+
capacity: CapacitySchema,
|
|
430
|
+
...CapabilityDeclarationSchema
|
|
407
431
|
});
|
|
408
432
|
var SkillConfigSchema = z.discriminatedUnion("type", [
|
|
409
433
|
ApiSkillConfigSchema,
|
|
@@ -1071,8 +1095,8 @@ var AgentRuntime = class {
|
|
|
1071
1095
|
}
|
|
1072
1096
|
const modes = /* @__PURE__ */ new Map();
|
|
1073
1097
|
if (this.conductorEnabled) {
|
|
1074
|
-
const { ConductorMode } = await import("../../conductor-mode-
|
|
1075
|
-
const { registerConductorCard, CONDUCTOR_OWNER } = await import("../../card-
|
|
1098
|
+
const { ConductorMode } = await import("../../conductor-mode-NUDQLZFM.js");
|
|
1099
|
+
const { registerConductorCard, CONDUCTOR_OWNER } = await import("../../card-REW7BSWW.js");
|
|
1076
1100
|
const { loadPeers } = await import("../../peers-CJ7T4RJO.js");
|
|
1077
1101
|
registerConductorCard(this.registryDb);
|
|
1078
1102
|
const resolveAgentUrl = (owner) => {
|
|
@@ -1178,6 +1202,7 @@ var AgentRuntime = class {
|
|
|
1178
1202
|
|
|
1179
1203
|
// src/gateway/server.ts
|
|
1180
1204
|
import Fastify from "fastify";
|
|
1205
|
+
import { randomUUID } from "crypto";
|
|
1181
1206
|
var VERSION = "0.0.1";
|
|
1182
1207
|
function createGatewayServer(opts) {
|
|
1183
1208
|
const {
|
|
@@ -1191,6 +1216,8 @@ function createGatewayServer(opts) {
|
|
|
1191
1216
|
} = opts;
|
|
1192
1217
|
const fastify = Fastify({ logger: !silent });
|
|
1193
1218
|
const tokenSet = new Set(tokens);
|
|
1219
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
1220
|
+
const OVERLOAD_RETRY_MS = 5e3;
|
|
1194
1221
|
fastify.addHook("onRequest", async (request) => {
|
|
1195
1222
|
if (request.method === "GET" && request.url === "/health") return;
|
|
1196
1223
|
const auth = request.headers.authorization;
|
|
@@ -1256,18 +1283,63 @@ function createGatewayServer(opts) {
|
|
|
1256
1283
|
}
|
|
1257
1284
|
const requester = params.requester ?? "unknown";
|
|
1258
1285
|
const receipt = params.escrow_receipt;
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1286
|
+
if (skillExecutor && skillId && typeof skillExecutor.getSkillConfig === "function") {
|
|
1287
|
+
const skillConfig = skillExecutor.getSkillConfig(skillId);
|
|
1288
|
+
const maxConcurrent = skillConfig?.capacity?.max_concurrent;
|
|
1289
|
+
if (maxConcurrent !== void 0) {
|
|
1290
|
+
const current = inFlight.get(skillId) ?? 0;
|
|
1291
|
+
if (current >= maxConcurrent) {
|
|
1292
|
+
try {
|
|
1293
|
+
insertRequestLog(registryDb, {
|
|
1294
|
+
id: randomUUID(),
|
|
1295
|
+
card_id: cardId,
|
|
1296
|
+
card_name: "<overload>",
|
|
1297
|
+
requester,
|
|
1298
|
+
status: "failure",
|
|
1299
|
+
latency_ms: 0,
|
|
1300
|
+
credits_charged: 0,
|
|
1301
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1302
|
+
skill_id: skillId,
|
|
1303
|
+
failure_reason: "overload"
|
|
1304
|
+
});
|
|
1305
|
+
} catch {
|
|
1306
|
+
}
|
|
1307
|
+
return reply.status(200).send({
|
|
1308
|
+
jsonrpc: "2.0",
|
|
1309
|
+
id,
|
|
1310
|
+
error: {
|
|
1311
|
+
code: -32e3,
|
|
1312
|
+
message: "overload",
|
|
1313
|
+
data: { error: "overload", retry_after_ms: OVERLOAD_RETRY_MS }
|
|
1314
|
+
}
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
const trackKey = skillId ?? cardId;
|
|
1320
|
+
inFlight.set(trackKey, (inFlight.get(trackKey) ?? 0) + 1);
|
|
1321
|
+
let result;
|
|
1322
|
+
try {
|
|
1323
|
+
result = await executeCapabilityRequest({
|
|
1324
|
+
registryDb,
|
|
1325
|
+
creditDb,
|
|
1326
|
+
cardId,
|
|
1327
|
+
skillId,
|
|
1328
|
+
params,
|
|
1329
|
+
requester,
|
|
1330
|
+
escrowReceipt: receipt,
|
|
1331
|
+
skillExecutor,
|
|
1332
|
+
handlerUrl,
|
|
1333
|
+
timeoutMs
|
|
1334
|
+
});
|
|
1335
|
+
} finally {
|
|
1336
|
+
const next = (inFlight.get(trackKey) ?? 1) - 1;
|
|
1337
|
+
if (next <= 0) {
|
|
1338
|
+
inFlight.delete(trackKey);
|
|
1339
|
+
} else {
|
|
1340
|
+
inFlight.set(trackKey, next);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1271
1343
|
if (result.success) {
|
|
1272
1344
|
return reply.send({ jsonrpc: "2.0", id, result: result.result });
|
|
1273
1345
|
} else {
|
|
@@ -1682,7 +1754,7 @@ function createLedger(opts) {
|
|
|
1682
1754
|
}
|
|
1683
1755
|
|
|
1684
1756
|
// src/cli/onboarding.ts
|
|
1685
|
-
import { randomUUID } from "crypto";
|
|
1757
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
1686
1758
|
import { createConnection } from "net";
|
|
1687
1759
|
var KNOWN_API_KEYS = [
|
|
1688
1760
|
"OPENAI_API_KEY",
|
|
@@ -1807,7 +1879,7 @@ function buildDraftCard(apiKey, owner) {
|
|
|
1807
1879
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1808
1880
|
return {
|
|
1809
1881
|
spec_version: "1.0",
|
|
1810
|
-
id:
|
|
1882
|
+
id: randomUUID2(),
|
|
1811
1883
|
owner,
|
|
1812
1884
|
name: template.name,
|
|
1813
1885
|
description: template.description,
|
|
@@ -1827,7 +1899,7 @@ function buildDraftCard(apiKey, owner) {
|
|
|
1827
1899
|
}
|
|
1828
1900
|
|
|
1829
1901
|
// src/relay/websocket-relay.ts
|
|
1830
|
-
import { randomUUID as
|
|
1902
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
1831
1903
|
|
|
1832
1904
|
// src/relay/relay-credit.ts
|
|
1833
1905
|
function lookupCardPrice(registryDb, cardId, skillId) {
|
|
@@ -1885,10 +1957,10 @@ function releaseForRelay(creditDb, escrowId) {
|
|
|
1885
1957
|
}
|
|
1886
1958
|
|
|
1887
1959
|
// src/hub-agent/relay-bridge.ts
|
|
1888
|
-
import { randomUUID as
|
|
1960
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
1889
1961
|
|
|
1890
1962
|
// src/hub-agent/job-queue.ts
|
|
1891
|
-
import { randomUUID as
|
|
1963
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
1892
1964
|
function initJobQueue(db) {
|
|
1893
1965
|
db.exec(`
|
|
1894
1966
|
CREATE TABLE IF NOT EXISTS hub_agent_jobs (
|
|
@@ -1907,7 +1979,7 @@ function initJobQueue(db) {
|
|
|
1907
1979
|
`);
|
|
1908
1980
|
}
|
|
1909
1981
|
function insertJob(db, input) {
|
|
1910
|
-
const id =
|
|
1982
|
+
const id = randomUUID3();
|
|
1911
1983
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1912
1984
|
const paramsJson = JSON.stringify(input.params);
|
|
1913
1985
|
db.prepare(`
|
|
@@ -2205,7 +2277,7 @@ function createRelayBridge(opts) {
|
|
|
2205
2277
|
updateJobStatus(registryDb, job.id, "dispatched");
|
|
2206
2278
|
const agent = getHubAgent(registryDb, job.hub_agent_id);
|
|
2207
2279
|
const cardId = agent ? agent.agent_id.padEnd(32, "0").replace(/^(.{8})(.{4})(.{4})(.{4})(.{12}).*$/, "$1-$2-$3-$4-$5") : job.hub_agent_id;
|
|
2208
|
-
const requestId =
|
|
2280
|
+
const requestId = randomUUID4();
|
|
2209
2281
|
let params = {};
|
|
2210
2282
|
try {
|
|
2211
2283
|
params = JSON.parse(job.params);
|
|
@@ -2351,7 +2423,7 @@ function registerWebSocketRelay(server, db, creditDb) {
|
|
|
2351
2423
|
function logAgentJoined(owner, cardName, cardId) {
|
|
2352
2424
|
try {
|
|
2353
2425
|
insertRequestLog(db, {
|
|
2354
|
-
id:
|
|
2426
|
+
id: randomUUID5(),
|
|
2355
2427
|
card_id: cardId,
|
|
2356
2428
|
card_name: cardName,
|
|
2357
2429
|
requester: owner,
|
|
@@ -2699,7 +2771,7 @@ function registerWebSocketRelay(server, db, creditDb) {
|
|
|
2699
2771
|
|
|
2700
2772
|
// src/identity/guarantor.ts
|
|
2701
2773
|
import { z as z3 } from "zod";
|
|
2702
|
-
import { randomUUID as
|
|
2774
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
2703
2775
|
var MAX_AGENTS_PER_GUARANTOR = 10;
|
|
2704
2776
|
var GUARANTOR_CREDIT_POOL = 50;
|
|
2705
2777
|
var GuarantorRecordSchema = z3.object({
|
|
@@ -2738,7 +2810,7 @@ function registerGuarantor(db, githubLogin) {
|
|
|
2738
2810
|
);
|
|
2739
2811
|
}
|
|
2740
2812
|
const record = {
|
|
2741
|
-
id:
|
|
2813
|
+
id: randomUUID6(),
|
|
2742
2814
|
github_login: githubLogin,
|
|
2743
2815
|
agent_count: 0,
|
|
2744
2816
|
credit_pool: GUARANTOR_CREDIT_POOL,
|
|
@@ -2812,7 +2884,7 @@ function getAgentGuarantor(db, agentId) {
|
|
|
2812
2884
|
function initiateGithubAuth() {
|
|
2813
2885
|
return {
|
|
2814
2886
|
auth_url: "https://github.com/login/oauth/authorize?client_id=PLACEHOLDER&scope=read:user",
|
|
2815
|
-
state:
|
|
2887
|
+
state: randomUUID6()
|
|
2816
2888
|
};
|
|
2817
2889
|
}
|
|
2818
2890
|
|
|
@@ -4096,6 +4168,7 @@ function createRegistryServer(opts) {
|
|
|
4096
4168
|
min_success_rate: { type: "number", description: "Minimum success rate (0-1)" },
|
|
4097
4169
|
max_latency_ms: { type: "number", description: "Maximum average latency in ms" },
|
|
4098
4170
|
min_reputation: { type: "number", description: "Minimum reputation score (0-1) based on peer feedback" },
|
|
4171
|
+
capability_type: { type: "string", description: "Filter cards whose skills declare this capability_type (e.g. tts, code_gen)" },
|
|
4099
4172
|
sort: { type: "string", enum: ["popular", "rated", "success_rate", "cheapest", "newest", "latency", "reputation_desc", "reputation_asc"], description: "Sort order" },
|
|
4100
4173
|
limit: { type: "integer", default: 20, description: "Max items per page (max 100)" },
|
|
4101
4174
|
offset: { type: "integer", default: 0, description: "Pagination offset" }
|
|
@@ -4122,6 +4195,7 @@ function createRegistryServer(opts) {
|
|
|
4122
4195
|
const onlineRaw = query.online;
|
|
4123
4196
|
const online = onlineRaw === "true" ? true : onlineRaw === "false" ? false : void 0;
|
|
4124
4197
|
const tag = query.tag?.trim();
|
|
4198
|
+
const capabilityType = query.capability_type?.trim() || void 0;
|
|
4125
4199
|
const minSuccessRate = query.min_success_rate !== void 0 ? parseFloat(query.min_success_rate) : void 0;
|
|
4126
4200
|
const maxLatencyMs = query.max_latency_ms !== void 0 ? parseFloat(query.max_latency_ms) : void 0;
|
|
4127
4201
|
const minReputation = query.min_reputation !== void 0 ? parseFloat(query.min_reputation) : void 0;
|
|
@@ -4137,6 +4211,12 @@ function createRegistryServer(opts) {
|
|
|
4137
4211
|
cards = filterCards(db, { level, online, min_reputation: minReputation });
|
|
4138
4212
|
}
|
|
4139
4213
|
cards = cards.filter((c) => !c.owner.includes(":req:"));
|
|
4214
|
+
if (capabilityType !== void 0) {
|
|
4215
|
+
const capTypeIds = new Set(
|
|
4216
|
+
getCardsBySkillCapability(db, capabilityType).map((c) => c.id)
|
|
4217
|
+
);
|
|
4218
|
+
cards = cards.filter((c) => capTypeIds.has(c.id));
|
|
4219
|
+
}
|
|
4140
4220
|
if (tag !== void 0 && tag.length > 0) {
|
|
4141
4221
|
cards = cards.filter((c) => {
|
|
4142
4222
|
const rootTags = c.metadata?.tags ?? [];
|
|
@@ -5238,7 +5318,7 @@ import { createRequire } from "module";
|
|
|
5238
5318
|
import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
|
|
5239
5319
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5240
5320
|
import { dirname as dirname3, join as join4, resolve } from "path";
|
|
5241
|
-
import { randomUUID as
|
|
5321
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
5242
5322
|
var ServiceCoordinator = class {
|
|
5243
5323
|
config;
|
|
5244
5324
|
guard;
|
|
@@ -5379,7 +5459,7 @@ var ServiceCoordinator = class {
|
|
|
5379
5459
|
console.log("Conductor mode enabled \u2014 orchestrate/plan skills available via gateway");
|
|
5380
5460
|
}
|
|
5381
5461
|
if (opts.conductorEnabled && this.config.conductor?.public) {
|
|
5382
|
-
const { buildConductorCard } = await import("../../card-
|
|
5462
|
+
const { buildConductorCard } = await import("../../card-REW7BSWW.js");
|
|
5383
5463
|
const conductorCard = buildConductorCard(this.config.owner);
|
|
5384
5464
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5385
5465
|
const existing = this.runtime.registryDb.prepare("SELECT id FROM capability_cards WHERE id = ?").get(conductorCard.id);
|
|
@@ -5437,10 +5517,10 @@ var ServiceCoordinator = class {
|
|
|
5437
5517
|
}
|
|
5438
5518
|
if (opts.registryUrl && opts.relay) {
|
|
5439
5519
|
const { RelayClient: RelayClient2 } = await import("../../websocket-client-WRN3HO73.js");
|
|
5440
|
-
const { executeCapabilityRequest: executeCapabilityRequest2 } = await import("../../execute-
|
|
5520
|
+
const { executeCapabilityRequest: executeCapabilityRequest2 } = await import("../../execute-ITHIYYOX.js");
|
|
5441
5521
|
const cards = listCards(this.runtime.registryDb, this.config.owner);
|
|
5442
5522
|
const card = cards[0] ?? {
|
|
5443
|
-
id:
|
|
5523
|
+
id: randomUUID7(),
|
|
5444
5524
|
owner: this.config.owner,
|
|
5445
5525
|
name: this.config.owner,
|
|
5446
5526
|
description: "Agent registered via CLI",
|
|
@@ -5453,7 +5533,7 @@ var ServiceCoordinator = class {
|
|
|
5453
5533
|
};
|
|
5454
5534
|
const additionalCards = [];
|
|
5455
5535
|
if (this.config.conductor?.public) {
|
|
5456
|
-
const { buildConductorCard } = await import("../../card-
|
|
5536
|
+
const { buildConductorCard } = await import("../../card-REW7BSWW.js");
|
|
5457
5537
|
additionalCards.push(
|
|
5458
5538
|
buildConductorCard(this.config.owner)
|
|
5459
5539
|
);
|
|
@@ -5761,11 +5841,11 @@ function sleep2(ms) {
|
|
|
5761
5841
|
}
|
|
5762
5842
|
|
|
5763
5843
|
// src/app/agentbnb-service.ts
|
|
5764
|
-
import { randomUUID as
|
|
5844
|
+
import { randomUUID as randomUUID9 } from "crypto";
|
|
5765
5845
|
|
|
5766
5846
|
// src/credit/escrow-receipt.ts
|
|
5767
5847
|
import { z as z8 } from "zod";
|
|
5768
|
-
import { randomUUID as
|
|
5848
|
+
import { randomUUID as randomUUID8 } from "crypto";
|
|
5769
5849
|
var EscrowReceiptSchema = z8.object({
|
|
5770
5850
|
requester_owner: z8.string().min(1),
|
|
5771
5851
|
requester_public_key: z8.string().min(1),
|
|
@@ -5785,7 +5865,7 @@ function createSignedEscrowReceipt(db, privateKey, publicKey, opts) {
|
|
|
5785
5865
|
card_id: opts.cardId,
|
|
5786
5866
|
...opts.skillId ? { skill_id: opts.skillId } : {},
|
|
5787
5867
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5788
|
-
nonce:
|
|
5868
|
+
nonce: randomUUID8()
|
|
5789
5869
|
};
|
|
5790
5870
|
const signature = signEscrowReceipt(receiptData, privateKey);
|
|
5791
5871
|
const receipt = {
|
|
@@ -6027,13 +6107,13 @@ var AgentBnBService = class {
|
|
|
6027
6107
|
if (!this.config.registry) {
|
|
6028
6108
|
throw new AgentBnBError("Registry is required for relay fallback.", "RELAY_NOT_AVAILABLE");
|
|
6029
6109
|
}
|
|
6030
|
-
const requesterId = `${this.config.owner}:req:${
|
|
6110
|
+
const requesterId = `${this.config.owner}:req:${randomUUID9()}`;
|
|
6031
6111
|
const tempRelay = new RelayClient({
|
|
6032
6112
|
registryUrl: this.config.registry,
|
|
6033
6113
|
owner: requesterId,
|
|
6034
6114
|
token: this.config.token,
|
|
6035
6115
|
card: {
|
|
6036
|
-
id:
|
|
6116
|
+
id: randomUUID9(),
|
|
6037
6117
|
owner: requesterId,
|
|
6038
6118
|
name: requesterId,
|
|
6039
6119
|
description: "Requester",
|
|
@@ -6142,15 +6222,94 @@ function isNetworkError(err) {
|
|
|
6142
6222
|
}
|
|
6143
6223
|
|
|
6144
6224
|
// skills/agentbnb/bootstrap.ts
|
|
6225
|
+
function findSoulMd(startDir) {
|
|
6226
|
+
let dir = startDir;
|
|
6227
|
+
while (true) {
|
|
6228
|
+
const candidate = join5(dir, "SOUL.md");
|
|
6229
|
+
if (existsSync6(candidate)) return candidate;
|
|
6230
|
+
const parent = dirname4(dir);
|
|
6231
|
+
if (parent === dir) return null;
|
|
6232
|
+
dir = parent;
|
|
6233
|
+
}
|
|
6234
|
+
}
|
|
6235
|
+
function resolveWorkspaceDir() {
|
|
6236
|
+
const soulPath = findSoulMd(process.cwd());
|
|
6237
|
+
if (soulPath) {
|
|
6238
|
+
const workspaceName = basename(dirname4(soulPath));
|
|
6239
|
+
return join5(homedir2(), ".agentbnb", workspaceName);
|
|
6240
|
+
}
|
|
6241
|
+
return join5(homedir2(), ".agentbnb");
|
|
6242
|
+
}
|
|
6243
|
+
function registerDecomposerCard(configDir, owner) {
|
|
6244
|
+
try {
|
|
6245
|
+
const db = openDatabase(join5(configDir, "registry.db"));
|
|
6246
|
+
const existing = db.prepare(
|
|
6247
|
+
"SELECT id FROM capability_cards WHERE owner = ? AND json_extract(data, '$.capability_type') = ?"
|
|
6248
|
+
).get(owner, "task_decomposition");
|
|
6249
|
+
if (existing) return;
|
|
6250
|
+
const cardId = randomUUID10();
|
|
6251
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
6252
|
+
const card = {
|
|
6253
|
+
spec_version: "2.0",
|
|
6254
|
+
id: cardId,
|
|
6255
|
+
owner,
|
|
6256
|
+
agent_name: `${owner}-decomposer`,
|
|
6257
|
+
capability_type: "task_decomposition",
|
|
6258
|
+
skills: [
|
|
6259
|
+
{
|
|
6260
|
+
id: "task-decomposition",
|
|
6261
|
+
name: "Task Decomposition",
|
|
6262
|
+
description: "Decomposes natural-language tasks into executable sub-task DAGs using the AgentBnB Rule Engine.",
|
|
6263
|
+
level: 1,
|
|
6264
|
+
category: "task_decomposition",
|
|
6265
|
+
inputs: [
|
|
6266
|
+
{
|
|
6267
|
+
name: "task",
|
|
6268
|
+
type: "text",
|
|
6269
|
+
description: "Natural language task description",
|
|
6270
|
+
required: true
|
|
6271
|
+
}
|
|
6272
|
+
],
|
|
6273
|
+
outputs: [
|
|
6274
|
+
{
|
|
6275
|
+
name: "subtasks",
|
|
6276
|
+
type: "json",
|
|
6277
|
+
description: "Array of SubTask objects with id, role, description, dependencies",
|
|
6278
|
+
required: true
|
|
6279
|
+
}
|
|
6280
|
+
],
|
|
6281
|
+
pricing: { credits_per_call: 1 }
|
|
6282
|
+
}
|
|
6283
|
+
],
|
|
6284
|
+
availability: { online: true },
|
|
6285
|
+
created_at: now,
|
|
6286
|
+
updated_at: now
|
|
6287
|
+
};
|
|
6288
|
+
db.prepare(
|
|
6289
|
+
"INSERT INTO capability_cards (id, owner, data, created_at, updated_at) VALUES (?, ?, ?, ?, ?)"
|
|
6290
|
+
).run(cardId, owner, JSON.stringify(card), now, now);
|
|
6291
|
+
process.stderr.write(
|
|
6292
|
+
`[agentbnb] registered task_decomposition card: ${cardId} (owner=${owner})
|
|
6293
|
+
`
|
|
6294
|
+
);
|
|
6295
|
+
} catch (err) {
|
|
6296
|
+
process.stderr.write(
|
|
6297
|
+
`[agentbnb] WARNING: failed to register task_decomposition card: ${String(err)}
|
|
6298
|
+
`
|
|
6299
|
+
);
|
|
6300
|
+
}
|
|
6301
|
+
}
|
|
6145
6302
|
async function activate(config = {}) {
|
|
6146
|
-
const configDir = getConfigDir();
|
|
6147
6303
|
if (!process.env["AGENTBNB_DIR"]) {
|
|
6148
|
-
|
|
6304
|
+
const workspaceDir = resolveWorkspaceDir();
|
|
6305
|
+
process.env["AGENTBNB_DIR"] = workspaceDir;
|
|
6149
6306
|
process.stderr.write(
|
|
6150
|
-
`[agentbnb] AGENTBNB_DIR
|
|
6307
|
+
`[agentbnb] AGENTBNB_DIR auto-configured to ${workspaceDir} for workspace isolation.
|
|
6151
6308
|
`
|
|
6152
6309
|
);
|
|
6153
|
-
}
|
|
6310
|
+
}
|
|
6311
|
+
const configDir = getConfigDir();
|
|
6312
|
+
if (process.env["AGENTBNB_DIR"] !== configDir) {
|
|
6154
6313
|
process.stderr.write(
|
|
6155
6314
|
`[agentbnb] WARNING: AGENTBNB_DIR (${process.env["AGENTBNB_DIR"]}) differs from resolved configDir (${configDir}).
|
|
6156
6315
|
`
|
|
@@ -6185,6 +6344,7 @@ async function activate(config = {}) {
|
|
|
6185
6344
|
relay: config.relay
|
|
6186
6345
|
};
|
|
6187
6346
|
const startDisposition = await service.ensureRunning(opts);
|
|
6347
|
+
registerDecomposerCard(configDir, agentConfig.owner);
|
|
6188
6348
|
const status = await service.getNodeStatus();
|
|
6189
6349
|
const onSigterm = () => {
|
|
6190
6350
|
if (startDisposition === "started") {
|
package/package.json
CHANGED
package/skills/agentbnb/SKILL.md
CHANGED
|
@@ -179,6 +179,41 @@ agentbnb config set tier2 50 # notify-after under 50 credits
|
|
|
179
179
|
agentbnb config set reserve 20 # keep 20 credit reserve
|
|
180
180
|
```
|
|
181
181
|
|
|
182
|
+
## Workspace Isolation
|
|
183
|
+
|
|
184
|
+
Each OpenClaw workspace gets its own isolated data directory at `~/.agentbnb/<workspace-name>/`.
|
|
185
|
+
AgentBnB auto-detects the workspace name from the SOUL.md location in your working directory.
|
|
186
|
+
|
|
187
|
+
- Install from your agent's workspace directory for automatic isolation
|
|
188
|
+
- Verify: `agentbnb config show` — config path should contain your workspace name
|
|
189
|
+
- If no SOUL.md is found, falls back to shared `~/.agentbnb/` (not recommended)
|
|
190
|
+
|
|
191
|
+
To see and manage published cards:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
agentbnb cards list
|
|
195
|
+
agentbnb cards delete <card-id>
|
|
196
|
+
agentbnb cards delete <card-id> --force
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## SOUL.md Capability Metadata
|
|
200
|
+
|
|
201
|
+
Add metadata bullets inside skill H2 sections to declare routing labels:
|
|
202
|
+
|
|
203
|
+
```markdown
|
|
204
|
+
## My Skill Name
|
|
205
|
+
Short description of what this skill does.
|
|
206
|
+
- capability_types: financial_analysis, data_retrieval
|
|
207
|
+
- requires: web_search
|
|
208
|
+
- visibility: public
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
| Field | Description |
|
|
212
|
+
|-------|-------------|
|
|
213
|
+
| `capability_types` | Routing labels for Conductor matching (comma-separated) |
|
|
214
|
+
| `requires` | Capabilities this skill depends on internally |
|
|
215
|
+
| `visibility` | `public` (default) or `private` (excluded from Hub) |
|
|
216
|
+
|
|
182
217
|
## CLI Reference
|
|
183
218
|
|
|
184
219
|
```bash
|