agentbnb 8.4.3 → 8.4.5
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-5SIGMKOD.js +1086 -0
- package/dist/{chunk-6FZ4WYQL.js → chunk-JDAFLPR7.js} +15 -0
- package/dist/{chunk-J46N2TCC.js → chunk-OPRCWXD5.js} +1 -1
- package/dist/chunk-RF4A5X5U.js +62 -0
- package/dist/cli/index.js +79 -33
- package/dist/{conductor-mode-PXTMYGK5.js → conductor-mode-2F5OP7Q4.js} +3 -2
- package/dist/{execute-UP46R7KS.js → execute-6EJSVBFB.js} +4 -1
- package/dist/{execute-UAD5T3BQ.js → execute-VRTABQ6F.js} +2 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +904 -473
- package/dist/{openclaw-setup-LVSGMXDF.js → openclaw-setup-5ZWWRVF3.js} +2 -2
- package/dist/{serve-skill-6RKMVDMK.js → serve-skill-UD7TLSRN.js} +4 -1
- package/dist/{server-QG3FKU5Q.js → server-GSG5T2TZ.js} +20 -17
- package/dist/{service-coordinator-2HDVHDFD.js → service-coordinator-ZO7QHQ6U.js} +101 -7
- package/dist/skills/agentbnb/bootstrap.js +277 -738
- package/package.json +18 -12
- package/skills/agentbnb/SKILL.md +114 -183
- package/skills/agentbnb/install.sh +0 -0
- package/dist/chunk-PMRTQ2RL.js +0 -443
- package/dist/chunk-R4F4XII4.js +0 -264
- package/dist/client-OKJJ3UP2.js +0 -19
- package/dist/{chunk-PCQEHIGF.js → chunk-UNXCKETK.js} +3 -3
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
performInit,
|
|
13
13
|
publishFromSoulV2
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UNXCKETK.js";
|
|
15
15
|
import "./chunk-AZKVGC5T.js";
|
|
16
16
|
import {
|
|
17
17
|
getPricingStats
|
|
18
18
|
} from "./chunk-CFHCG5FE.js";
|
|
19
|
-
import "./chunk-WK2QSO4E.js";
|
|
20
19
|
import "./chunk-G5WKW3ED.js";
|
|
20
|
+
import "./chunk-WK2QSO4E.js";
|
|
21
21
|
import "./chunk-HU46M4JA.js";
|
|
22
22
|
import "./chunk-GIEJVKZZ.js";
|
|
23
23
|
import "./chunk-U6LP4KWN.js";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executeCapabilityRequest
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JDAFLPR7.js";
|
|
4
|
+
import "./chunk-RF4A5X5U.js";
|
|
5
|
+
import "./chunk-WK2QSO4E.js";
|
|
4
6
|
import "./chunk-2PP5MQPD.js";
|
|
5
7
|
import "./chunk-PIPCGRCR.js";
|
|
6
8
|
import {
|
|
@@ -10,6 +12,7 @@ import {
|
|
|
10
12
|
RelayClient
|
|
11
13
|
} from "./chunk-NX27AFPA.js";
|
|
12
14
|
import "./chunk-PQIP7EXY.js";
|
|
15
|
+
import "./chunk-GIEJVKZZ.js";
|
|
13
16
|
import "./chunk-U6LP4KWN.js";
|
|
14
17
|
import "./chunk-3XPBFF6H.js";
|
|
15
18
|
import {
|
|
@@ -107,10 +107,22 @@ import { z as z2 } from "zod";
|
|
|
107
107
|
var statusInputSchema = {
|
|
108
108
|
_unused: z2.string().optional().describe("No parameters needed")
|
|
109
109
|
};
|
|
110
|
+
function readLocalBalance(creditDbPath, creditKey) {
|
|
111
|
+
const creditDb = openCreditDb(creditDbPath);
|
|
112
|
+
try {
|
|
113
|
+
return getBalance(creditDb, creditKey);
|
|
114
|
+
} catch {
|
|
115
|
+
return 0;
|
|
116
|
+
} finally {
|
|
117
|
+
creditDb.close();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
110
120
|
async function handleStatus(ctx) {
|
|
111
121
|
try {
|
|
112
|
-
let balance = 0;
|
|
113
122
|
const creditKey = ctx.identity.agent_id ?? ctx.identity.owner;
|
|
123
|
+
const local_balance = readLocalBalance(ctx.config.credit_db_path, creditKey);
|
|
124
|
+
let registry_balance = null;
|
|
125
|
+
let sync_needed = false;
|
|
114
126
|
if (ctx.config.registry) {
|
|
115
127
|
try {
|
|
116
128
|
const keys = loadKeyPair(ctx.configDir);
|
|
@@ -119,28 +131,19 @@ async function handleStatus(ctx) {
|
|
|
119
131
|
ownerPublicKey: ctx.identity.public_key,
|
|
120
132
|
privateKey: keys.privateKey
|
|
121
133
|
});
|
|
122
|
-
|
|
134
|
+
registry_balance = await ledger.getBalance(creditKey);
|
|
135
|
+
sync_needed = Math.abs(registry_balance - local_balance) > 1;
|
|
123
136
|
} catch {
|
|
124
|
-
const creditDb = openCreditDb(ctx.config.credit_db_path);
|
|
125
|
-
try {
|
|
126
|
-
balance = getBalance(creditDb, creditKey);
|
|
127
|
-
} finally {
|
|
128
|
-
creditDb.close();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
} else {
|
|
132
|
-
const creditDb = openCreditDb(ctx.config.credit_db_path);
|
|
133
|
-
try {
|
|
134
|
-
balance = getBalance(creditDb, creditKey);
|
|
135
|
-
} finally {
|
|
136
|
-
creditDb.close();
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
+
const balance = registry_balance ?? local_balance;
|
|
139
140
|
const result = {
|
|
140
141
|
agent_id: ctx.identity.agent_id,
|
|
141
142
|
owner: ctx.identity.owner,
|
|
142
143
|
public_key: ctx.identity.public_key,
|
|
143
144
|
balance,
|
|
145
|
+
local_balance,
|
|
146
|
+
...ctx.config.registry ? { registry_balance, sync_needed } : {},
|
|
144
147
|
registry_url: ctx.config.registry ?? null,
|
|
145
148
|
config_dir: ctx.configDir
|
|
146
149
|
};
|
|
@@ -251,7 +254,7 @@ function registerPublishTool(server, ctx) {
|
|
|
251
254
|
}
|
|
252
255
|
|
|
253
256
|
// src/mcp/server.ts
|
|
254
|
-
var VERSION = true ? "8.4.
|
|
257
|
+
var VERSION = true ? "8.4.5" : "0.0.0-dev";
|
|
255
258
|
async function startMcpServer() {
|
|
256
259
|
const config = loadConfig();
|
|
257
260
|
if (!config) {
|
|
@@ -274,7 +277,7 @@ async function startMcpServer() {
|
|
|
274
277
|
registerPublishTool(server, ctx);
|
|
275
278
|
const { registerRequestTool } = await import("./request-XWEOIVB3.js");
|
|
276
279
|
const { registerConductTool } = await import("./conduct-TE4YAXKR.js");
|
|
277
|
-
const { registerServeSkillTool } = await import("./serve-skill-
|
|
280
|
+
const { registerServeSkillTool } = await import("./serve-skill-UD7TLSRN.js");
|
|
278
281
|
registerRequestTool(server, ctx);
|
|
279
282
|
registerConductTool(server, ctx);
|
|
280
283
|
registerServeSkillTool(server, ctx);
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
executeCapabilityBatch,
|
|
10
10
|
executeCapabilityRequest
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-JDAFLPR7.js";
|
|
12
12
|
import {
|
|
13
13
|
StructuredFeedbackSchema
|
|
14
14
|
} from "./chunk-AUBHR7HH.js";
|
|
@@ -23,11 +23,6 @@ import {
|
|
|
23
23
|
detectApiKeys,
|
|
24
24
|
getPricingStats
|
|
25
25
|
} from "./chunk-CFHCG5FE.js";
|
|
26
|
-
import {
|
|
27
|
-
createLedger,
|
|
28
|
-
deriveAgentId,
|
|
29
|
-
identityAuthPlugin
|
|
30
|
-
} from "./chunk-WK2QSO4E.js";
|
|
31
26
|
import {
|
|
32
27
|
listPendingRequests,
|
|
33
28
|
resolvePendingRequest
|
|
@@ -37,6 +32,14 @@ import {
|
|
|
37
32
|
getAutonomyTier,
|
|
38
33
|
insertAuditEvent
|
|
39
34
|
} from "./chunk-G5WKW3ED.js";
|
|
35
|
+
import {
|
|
36
|
+
syncCreditsFromRegistry
|
|
37
|
+
} from "./chunk-RF4A5X5U.js";
|
|
38
|
+
import {
|
|
39
|
+
createLedger,
|
|
40
|
+
deriveAgentId,
|
|
41
|
+
identityAuthPlugin
|
|
42
|
+
} from "./chunk-WK2QSO4E.js";
|
|
40
43
|
import "./chunk-2PP5MQPD.js";
|
|
41
44
|
import "./chunk-PIPCGRCR.js";
|
|
42
45
|
import {
|
|
@@ -2655,6 +2658,75 @@ async function creditRoutesPlugin(fastify, options) {
|
|
|
2655
2658
|
} catch {
|
|
2656
2659
|
}
|
|
2657
2660
|
initFreeTierTable(creditDb);
|
|
2661
|
+
if (!process.env.ADMIN_TOKEN) {
|
|
2662
|
+
console.warn("[agentbnb] ADMIN_TOKEN not set \u2014 POST /api/credits/grant will return 401 for admin override grants");
|
|
2663
|
+
}
|
|
2664
|
+
fastify.get("/api/credits/balance", {
|
|
2665
|
+
schema: {
|
|
2666
|
+
tags: ["credits"],
|
|
2667
|
+
summary: "Get credit balance by owner query param (public, no auth required)",
|
|
2668
|
+
querystring: {
|
|
2669
|
+
type: "object",
|
|
2670
|
+
properties: { owner: { type: "string", description: "Agent owner name" } },
|
|
2671
|
+
required: ["owner"]
|
|
2672
|
+
},
|
|
2673
|
+
response: {
|
|
2674
|
+
200: {
|
|
2675
|
+
type: "object",
|
|
2676
|
+
properties: {
|
|
2677
|
+
owner: { type: "string" },
|
|
2678
|
+
balance: { type: "number" }
|
|
2679
|
+
}
|
|
2680
|
+
},
|
|
2681
|
+
400: { type: "object", properties: { error: { type: "string" } } }
|
|
2682
|
+
}
|
|
2683
|
+
}
|
|
2684
|
+
}, async (request, reply) => {
|
|
2685
|
+
const query = request.query;
|
|
2686
|
+
const owner = typeof query.owner === "string" ? query.owner.trim() : "";
|
|
2687
|
+
if (!owner) {
|
|
2688
|
+
return reply.code(400).send({ error: "owner query param required" });
|
|
2689
|
+
}
|
|
2690
|
+
const balance = getBalance(creditDb, owner);
|
|
2691
|
+
return reply.send({ owner, balance });
|
|
2692
|
+
});
|
|
2693
|
+
fastify.get("/api/credits/transactions", {
|
|
2694
|
+
schema: {
|
|
2695
|
+
tags: ["credits"],
|
|
2696
|
+
summary: "Get transaction history by query params (public, no auth required)",
|
|
2697
|
+
querystring: {
|
|
2698
|
+
type: "object",
|
|
2699
|
+
properties: {
|
|
2700
|
+
owner: { type: "string", description: "Agent owner name" },
|
|
2701
|
+
since: { type: "string", description: "ISO 8601 timestamp \u2014 only return transactions after this time" },
|
|
2702
|
+
limit: { type: "integer", description: "Max entries (default 50, max 100)" }
|
|
2703
|
+
},
|
|
2704
|
+
required: ["owner"]
|
|
2705
|
+
},
|
|
2706
|
+
response: {
|
|
2707
|
+
200: {
|
|
2708
|
+
type: "object",
|
|
2709
|
+
properties: {
|
|
2710
|
+
owner: { type: "string" },
|
|
2711
|
+
transactions: { type: "array" },
|
|
2712
|
+
limit: { type: "integer" }
|
|
2713
|
+
}
|
|
2714
|
+
},
|
|
2715
|
+
400: { type: "object", properties: { error: { type: "string" } } }
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
}, async (request, reply) => {
|
|
2719
|
+
const query = request.query;
|
|
2720
|
+
const owner = typeof query.owner === "string" ? query.owner.trim() : "";
|
|
2721
|
+
if (!owner) {
|
|
2722
|
+
return reply.code(400).send({ error: "owner query param required" });
|
|
2723
|
+
}
|
|
2724
|
+
const rawLimit = query.limit !== void 0 ? parseInt(query.limit, 10) : 50;
|
|
2725
|
+
const limit = Math.min(isNaN(rawLimit) || rawLimit < 1 ? 50 : rawLimit, 100);
|
|
2726
|
+
const since = typeof query.since === "string" && query.since.trim() ? query.since.trim() : void 0;
|
|
2727
|
+
const transactions = getTransactions(creditDb, owner, { limit, after: since });
|
|
2728
|
+
return reply.send({ owner, transactions, limit });
|
|
2729
|
+
});
|
|
2658
2730
|
await fastify.register(async (scope) => {
|
|
2659
2731
|
identityAuthPlugin(scope, { agentDb: creditDb });
|
|
2660
2732
|
scope.post("/api/credits/hold", {
|
|
@@ -5155,6 +5227,7 @@ import { spawn as spawn2 } from "child_process";
|
|
|
5155
5227
|
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
|
|
5156
5228
|
import { join as join2 } from "path";
|
|
5157
5229
|
import { randomUUID as randomUUID7 } from "crypto";
|
|
5230
|
+
import { Cron as Cron2 } from "croner";
|
|
5158
5231
|
function buildFallbackRelayCard(owner) {
|
|
5159
5232
|
return {
|
|
5160
5233
|
id: randomUUID7(),
|
|
@@ -5192,6 +5265,7 @@ var ServiceCoordinator = class {
|
|
|
5192
5265
|
inProcessStartup = false;
|
|
5193
5266
|
shutdownPromise = null;
|
|
5194
5267
|
signalHandlersRegistered = false;
|
|
5268
|
+
creditSyncJob = null;
|
|
5195
5269
|
constructor(config, guard) {
|
|
5196
5270
|
this.config = config;
|
|
5197
5271
|
this.guard = guard;
|
|
@@ -5356,6 +5430,22 @@ var ServiceCoordinator = class {
|
|
|
5356
5430
|
const idleJob = idleMonitor.start();
|
|
5357
5431
|
this.runtime.registerJob(idleJob);
|
|
5358
5432
|
console.log("IdleMonitor started (60s poll interval, 70% idle threshold)");
|
|
5433
|
+
if (this.config.registry) {
|
|
5434
|
+
const startupSync = await syncCreditsFromRegistry(this.config, this.runtime.creditDb);
|
|
5435
|
+
if (startupSync.synced) {
|
|
5436
|
+
console.log(`[agentbnb] credits synced: ${startupSync.remoteBalance} (was ${startupSync.localWas})`);
|
|
5437
|
+
} else {
|
|
5438
|
+
console.warn(`[agentbnb] credit sync skipped: ${startupSync.error}`);
|
|
5439
|
+
}
|
|
5440
|
+
this.creditSyncJob = new Cron2("*/5 * * * *", async () => {
|
|
5441
|
+
const result = await syncCreditsFromRegistry(this.config, this.runtime.creditDb);
|
|
5442
|
+
if (result.synced) {
|
|
5443
|
+
console.log(`[agentbnb] credits synced: ${result.remoteBalance} (was ${result.localWas})`);
|
|
5444
|
+
} else {
|
|
5445
|
+
console.warn(`[agentbnb] credit sync failed: ${result.error}`);
|
|
5446
|
+
}
|
|
5447
|
+
});
|
|
5448
|
+
}
|
|
5359
5449
|
this.gateway = createGatewayServer({
|
|
5360
5450
|
port: opts.port,
|
|
5361
5451
|
registryDb: this.runtime.registryDb,
|
|
@@ -5386,7 +5476,7 @@ var ServiceCoordinator = class {
|
|
|
5386
5476
|
}
|
|
5387
5477
|
if (opts.registryUrl && opts.relay) {
|
|
5388
5478
|
const { RelayClient } = await import("./websocket-client-3U27WJUU.js");
|
|
5389
|
-
const { executeCapabilityRequest: executeCapabilityRequest2 } = await import("./execute-
|
|
5479
|
+
const { executeCapabilityRequest: executeCapabilityRequest2 } = await import("./execute-6EJSVBFB.js");
|
|
5390
5480
|
const localCards = listCards(this.runtime.registryDb, this.config.owner);
|
|
5391
5481
|
const { primaryCard, additionalCards } = buildRelayRegistrationCards(this.config.owner, localCards);
|
|
5392
5482
|
if (this.config.conductor?.public) {
|
|
@@ -5445,6 +5535,10 @@ var ServiceCoordinator = class {
|
|
|
5445
5535
|
return;
|
|
5446
5536
|
}
|
|
5447
5537
|
this.shutdownPromise = (async () => {
|
|
5538
|
+
if (this.creditSyncJob) {
|
|
5539
|
+
this.creditSyncJob.stop();
|
|
5540
|
+
this.creditSyncJob = null;
|
|
5541
|
+
}
|
|
5448
5542
|
if (this.relayClient) {
|
|
5449
5543
|
this.relayClient.disconnect();
|
|
5450
5544
|
this.relayClient = null;
|