agentbnb 9.2.0 → 9.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.
Files changed (51) hide show
  1. package/README.md +22 -0
  2. package/dist/{card-VVXNKHDX.js → card-L3ZPPBVI.js} +2 -2
  3. package/dist/{chunk-Z7XWQ63B.js → chunk-2KSRFDKF.js} +1 -1
  4. package/dist/{chunk-WEZ7PSOE.js → chunk-563ZZUOA.js} +56 -22
  5. package/dist/chunk-5FXLZ5FX.js +16 -0
  6. package/dist/{chunk-ELFGYC22.js → chunk-7YJOBVWN.js} +3 -0
  7. package/dist/{chunk-V5TJXK3F.js → chunk-COOBXNXU.js} +5 -5
  8. package/dist/{chunk-EC6DIVE5.js → chunk-CPSV5WR2.js} +1 -1
  9. package/dist/{process-guard-6324CZDC.js → chunk-DG4FQ4MD.js} +1 -1
  10. package/dist/{chunk-MPS4RE7T.js → chunk-DT2IEL5U.js} +11 -0
  11. package/dist/chunk-EMVVFP2L.js +54 -0
  12. package/dist/{chunk-FK54LVDR.js → chunk-FVLHEI3Y.js} +5 -5
  13. package/dist/chunk-GIK2AZQH.js +23 -0
  14. package/dist/{chunk-B6AKTLXB.js → chunk-NISX3N7K.js} +16 -7
  15. package/dist/{chunk-CMGJ52SX.js → chunk-NLGLGR2K.js} +1 -1
  16. package/dist/{chunk-RNALIVRR.js → chunk-OFIRWD6B.js} +1 -1
  17. package/dist/{chunk-GGRH5PCD.js → chunk-OI46BKQF.js} +9 -9
  18. package/dist/{chunk-MQIT2F5V.js → chunk-OTAZIF65.js} +1 -1
  19. package/dist/{chunk-KKFP5Y2Z.js → chunk-OXU4QJSZ.js} +2 -2
  20. package/dist/{chunk-53Q2HHHH.js → chunk-PFAEZI32.js} +9 -9
  21. package/dist/{chunk-D7NH6YLM.js → chunk-UJXDBOKV.js} +12 -1
  22. package/dist/{chunk-UPWAXWY2.js → chunk-VDYHCI5F.js} +22 -1
  23. package/dist/{chunk-QG2LLVXP.js → chunk-WA23XRTN.js} +1 -1
  24. package/dist/cli/index.js +787 -97
  25. package/dist/{conduct-QLWXU2ZU.js → conduct-65BGO2EU.js} +13 -11
  26. package/dist/{conduct-JRLLA4PB.js → conduct-AALDEKTH.js} +13 -11
  27. package/dist/{conductor-mode-PFO2VLH6.js → conductor-mode-6S6ADNLW.js} +15 -15
  28. package/dist/{conductor-mode-66IITI4I.js → conductor-mode-HJHU4XLT.js} +2 -2
  29. package/dist/{credits-action-XERUEDF3.js → credits-action-CLLPNRDT.js} +15 -6
  30. package/dist/{execute-NOQVN7ZG.js → execute-R5STYWLD.js} +10 -10
  31. package/dist/{execute-YBNCDAOX.js → execute-YMPHTJPN.js} +2 -2
  32. package/dist/{openclaw-setup-4RIZRMXA.js → openclaw-setup-HUOBTGN4.js} +14 -12
  33. package/dist/{openclaw-skills-TQ2JVBRM.js → openclaw-skills-74372B6I.js} +2 -2
  34. package/dist/process-guard-IUMZ2GSD.js +8 -0
  35. package/dist/{publish-capability-2FMD3K6Z.js → publish-capability-OYXXXYAU.js} +3 -3
  36. package/dist/remote-registry-5TM7DMCO.js +16 -0
  37. package/dist/{request-EYN4CVXC.js → request-NEA66RCW.js} +63 -21
  38. package/dist/{serve-skill-NWERGVH5.js → serve-skill-VKNRBVWE.js} +16 -15
  39. package/dist/{server-UPOPLZ24.js → server-4TACULIV.js} +21 -17
  40. package/dist/{service-coordinator-ZOZTW2U6.js → service-coordinator-RE2KPWO4.js} +91 -31
  41. package/dist/{session-action-OSBZB4TX.js → session-action-UBWJTQVQ.js} +17 -2
  42. package/dist/skills/agentbnb/bootstrap.js +213 -24
  43. package/dist/{store-74EWU77V.js → store-GJJFFEQZ.js} +2 -2
  44. package/dist/{vc-action-A6VBKERF.js → vc-action-72TQVMY2.js} +13 -3
  45. package/openclaw.plugin.json +36 -5
  46. package/package.json +12 -18
  47. package/skills/agentbnb/SKILL.md +106 -75
  48. package/skills/agentbnb/install.sh +0 -0
  49. package/dist/{chunk-C56X7EFJ.js → chunk-QE42IJC4.js} +3 -3
  50. package/dist/{daemon-ETXXE4IS.js → daemon-OM2K3U7J.js} +1 -1
  51. package/dist/{did-action-ODWTBVXL.js → did-action-ERXWCVEJ.js} +1 -1
@@ -1,24 +1,24 @@
1
+ import {
2
+ createSessionState
3
+ } from "./chunk-EMVVFP2L.js";
1
4
  import {
2
5
  createLedger
3
- } from "./chunk-Z7XWQ63B.js";
6
+ } from "./chunk-2KSRFDKF.js";
4
7
  import {
5
8
  ensureIdentity
6
9
  } from "./chunk-AA25Z6FW.js";
7
- import {
8
- fetchRemoteCards,
9
- mergeResults
10
- } from "./chunk-ELFGYC22.js";
11
10
  import {
12
11
  searchCards
13
- } from "./chunk-EC6DIVE5.js";
12
+ } from "./chunk-CPSV5WR2.js";
14
13
  import {
15
14
  getBalance,
16
15
  openCreditDb
17
- } from "./chunk-D7NH6YLM.js";
16
+ } from "./chunk-UJXDBOKV.js";
18
17
  import {
19
18
  insertCard,
20
19
  openDatabase
21
- } from "./chunk-C56X7EFJ.js";
20
+ } from "./chunk-QE42IJC4.js";
21
+ import "./chunk-4XTYT4JW.js";
22
22
  import "./chunk-GZUTU6IZ.js";
23
23
  import "./chunk-QXRNW4OJ.js";
24
24
  import {
@@ -26,14 +26,17 @@ import {
26
26
  } from "./chunk-65GNX2KC.js";
27
27
  import "./chunk-YDGXKH2T.js";
28
28
  import "./chunk-J4RFJVXI.js";
29
- import {
30
- AnyCardSchema
31
- } from "./chunk-UVCNMRPS.js";
32
29
  import {
33
30
  getConfigDir,
34
31
  loadConfig
35
32
  } from "./chunk-3XPBFF6H.js";
36
- import "./chunk-4XTYT4JW.js";
33
+ import {
34
+ fetchRemoteCards,
35
+ mergeResults
36
+ } from "./chunk-7YJOBVWN.js";
37
+ import {
38
+ AnyCardSchema
39
+ } from "./chunk-UVCNMRPS.js";
37
40
  import "./chunk-3RG5ZIWI.js";
38
41
 
39
42
  // src/mcp/server.ts
@@ -262,7 +265,7 @@ function registerPublishTool(server, ctx) {
262
265
  }
263
266
 
264
267
  // src/mcp/server.ts
265
- var VERSION = true ? "9.2.0" : "0.0.0-dev";
268
+ var VERSION = true ? "9.2.2" : "0.0.0-dev";
266
269
  async function startMcpServer() {
267
270
  const config = loadConfig();
268
271
  if (!config) {
@@ -278,14 +281,15 @@ async function startMcpServer() {
278
281
  const ctx = {
279
282
  configDir,
280
283
  config,
281
- identity
284
+ identity,
285
+ consumerSession: createSessionState()
282
286
  };
283
287
  registerDiscoverTool(server, ctx);
284
288
  registerStatusTool(server, ctx);
285
289
  registerPublishTool(server, ctx);
286
- const { registerRequestTool } = await import("./request-EYN4CVXC.js");
287
- const { registerConductTool } = await import("./conduct-QLWXU2ZU.js");
288
- const { registerServeSkillTool } = await import("./serve-skill-NWERGVH5.js");
290
+ const { registerRequestTool } = await import("./request-NEA66RCW.js");
291
+ const { registerConductTool } = await import("./conduct-65BGO2EU.js");
292
+ const { registerServeSkillTool } = await import("./serve-skill-VKNRBVWE.js");
289
293
  registerRequestTool(server, ctx);
290
294
  registerConductTool(server, ctx);
291
295
  registerServeSkillTool(server, ctx);
@@ -2,14 +2,10 @@ import {
2
2
  executeCapabilityBatch,
3
3
  executeCapabilityRequest,
4
4
  notifyProviderEvent
5
- } from "./chunk-53Q2HHHH.js";
5
+ } from "./chunk-PFAEZI32.js";
6
6
  import {
7
7
  StructuredFeedbackSchema
8
8
  } from "./chunk-AUBHR7HH.js";
9
- import {
10
- ApiSkillConfigSchema,
11
- parseSkillsFile
12
- } from "./chunk-WX3GZVFG.js";
13
9
  import {
14
10
  decodeUCAN,
15
11
  verifyUCAN
@@ -23,7 +19,7 @@ import {
23
19
  } from "./chunk-TA73FIZU.js";
24
20
  import {
25
21
  syncCreditsFromRegistry
26
- } from "./chunk-KKFP5Y2Z.js";
22
+ } from "./chunk-OXU4QJSZ.js";
27
23
  import {
28
24
  resolveSelfCli
29
25
  } from "./chunk-7S4ZLFVI.js";
@@ -31,22 +27,33 @@ import {
31
27
  KNOWN_API_KEYS,
32
28
  buildDraftCard,
33
29
  detectApiKeys,
34
- getPricingStats
35
- } from "./chunk-UPWAXWY2.js";
30
+ getPricingStats,
31
+ probeRegistry
32
+ } from "./chunk-VDYHCI5F.js";
33
+ import {
34
+ TimeoutError,
35
+ withTimeout
36
+ } from "./chunk-GIK2AZQH.js";
37
+ import {
38
+ shouldSkipNetwork
39
+ } from "./chunk-5FXLZ5FX.js";
36
40
  import {
37
41
  createLedger,
38
42
  identityAuthPlugin,
39
43
  tryVerifyIdentity
40
- } from "./chunk-Z7XWQ63B.js";
44
+ } from "./chunk-2KSRFDKF.js";
41
45
  import {
42
46
  deriveAgentId
43
47
  } from "./chunk-AA25Z6FW.js";
48
+ import {
49
+ ApiSkillConfigSchema,
50
+ parseSkillsFile
51
+ } from "./chunk-WX3GZVFG.js";
44
52
  import {
45
53
  listPendingRequests,
46
54
  resolvePendingRequest
47
55
  } from "./chunk-5PV5YCSN.js";
48
- import "./chunk-FK54LVDR.js";
49
- import "./chunk-ELFGYC22.js";
56
+ import "./chunk-FVLHEI3Y.js";
50
57
  import {
51
58
  DEFAULT_AUTONOMY_CONFIG,
52
59
  getAutonomyTier,
@@ -57,11 +64,12 @@ import {
57
64
  computeReputation,
58
65
  filterCards,
59
66
  searchCards
60
- } from "./chunk-EC6DIVE5.js";
67
+ } from "./chunk-CPSV5WR2.js";
61
68
  import {
62
69
  NETWORK_FEE_RATE,
63
70
  bootstrapAgent,
64
71
  getBalance,
72
+ getEscrowStatus,
65
73
  getTransactions,
66
74
  holdEscrow,
67
75
  markEscrowAbandoned,
@@ -71,7 +79,7 @@ import {
71
79
  openCreditDb,
72
80
  releaseEscrow,
73
81
  settleEscrow
74
- } from "./chunk-D7NH6YLM.js";
82
+ } from "./chunk-UJXDBOKV.js";
75
83
  import {
76
84
  attachCanonicalAgentId,
77
85
  getCard,
@@ -88,7 +96,13 @@ import {
88
96
  updateCard,
89
97
  updateSkillAvailability,
90
98
  updateSkillIdleRate
91
- } from "./chunk-C56X7EFJ.js";
99
+ } from "./chunk-QE42IJC4.js";
100
+ import {
101
+ getActivityFeed,
102
+ getRequestLog,
103
+ getSkillRequestCount,
104
+ insertRequestLog
105
+ } from "./chunk-4XTYT4JW.js";
92
106
  import {
93
107
  emitProviderEvent
94
108
  } from "./chunk-GZUTU6IZ.js";
@@ -109,19 +123,14 @@ import {
109
123
  } from "./chunk-65GNX2KC.js";
110
124
  import "./chunk-YDGXKH2T.js";
111
125
  import "./chunk-J4RFJVXI.js";
112
- import {
113
- AgentBnBError,
114
- AnyCardSchema
115
- } from "./chunk-UVCNMRPS.js";
116
126
  import {
117
127
  getConfigDir
118
128
  } from "./chunk-3XPBFF6H.js";
129
+ import "./chunk-7YJOBVWN.js";
119
130
  import {
120
- getActivityFeed,
121
- getRequestLog,
122
- getSkillRequestCount,
123
- insertRequestLog
124
- } from "./chunk-4XTYT4JW.js";
131
+ AgentBnBError,
132
+ AnyCardSchema
133
+ } from "./chunk-UVCNMRPS.js";
125
134
  import "./chunk-3RG5ZIWI.js";
126
135
 
127
136
  // src/runtime/agent-runtime.ts
@@ -1180,8 +1189,8 @@ var AgentRuntime = class {
1180
1189
  }
1181
1190
  const modes = /* @__PURE__ */ new Map();
1182
1191
  if (this.conductorEnabled) {
1183
- const { ConductorMode } = await import("./conductor-mode-PFO2VLH6.js");
1184
- const { registerConductorCard, CONDUCTOR_OWNER } = await import("./card-VVXNKHDX.js");
1192
+ const { ConductorMode } = await import("./conductor-mode-6S6ADNLW.js");
1193
+ const { registerConductorCard, CONDUCTOR_OWNER } = await import("./card-L3ZPPBVI.js");
1185
1194
  const { loadPeers } = await import("./peers-7BMU2775.js");
1186
1195
  registerConductorCard(this.registryDb);
1187
1196
  const resolveAgentUrl = (owner) => {
@@ -3432,6 +3441,39 @@ async function creditRoutesPlugin(fastify, options) {
3432
3441
  const transactions = getTransactions(creditDb, owner, { limit, after: since });
3433
3442
  return reply.send({ owner, transactions, limit });
3434
3443
  });
3444
+ fastify.get("/api/credits/escrow/:id", {
3445
+ schema: {
3446
+ tags: ["credits"],
3447
+ summary: "Get escrow status by ID (public, no auth required)",
3448
+ params: {
3449
+ type: "object",
3450
+ properties: { id: { type: "string" } },
3451
+ required: ["id"]
3452
+ },
3453
+ response: {
3454
+ 200: {
3455
+ type: "object",
3456
+ properties: {
3457
+ id: { type: "string" },
3458
+ owner: { type: "string" },
3459
+ amount: { type: "number" },
3460
+ card_id: { type: "string" },
3461
+ status: { type: "string" },
3462
+ created_at: { type: "string" },
3463
+ settled_at: { type: ["string", "null"] }
3464
+ }
3465
+ },
3466
+ 404: { type: "object", properties: { error: { type: "string" } } }
3467
+ }
3468
+ }
3469
+ }, async (request, reply) => {
3470
+ const { id } = request.params;
3471
+ const escrow = getEscrowStatus(creditDb, id);
3472
+ if (!escrow) {
3473
+ return reply.code(404).send({ error: "Escrow record not found" });
3474
+ }
3475
+ return reply.send(escrow);
3476
+ });
3435
3477
  await fastify.register(async (scope) => {
3436
3478
  identityAuthPlugin(scope, { agentDb: creditDb });
3437
3479
  scope.post("/api/credits/hold", {
@@ -6262,6 +6304,7 @@ import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
6262
6304
  import { join as join2 } from "path";
6263
6305
  import { randomUUID as randomUUID8 } from "crypto";
6264
6306
  import { Cron as Cron2 } from "croner";
6307
+ var STARTUP_SYNC_BUDGET_MS = 3e3;
6265
6308
  function buildFallbackRelayCard(owner) {
6266
6309
  return {
6267
6310
  id: randomUUID8(),
@@ -6433,7 +6476,7 @@ var ServiceCoordinator = class {
6433
6476
  console.log("Conductor mode enabled \u2014 orchestrate/plan skills available via gateway");
6434
6477
  }
6435
6478
  if (opts.conductorEnabled && this.config.conductor?.public) {
6436
- const { buildConductorCard } = await import("./card-VVXNKHDX.js");
6479
+ const { buildConductorCard } = await import("./card-L3ZPPBVI.js");
6437
6480
  const conductorCard = attachCanonicalAgentId(
6438
6481
  this.runtime.registryDb,
6439
6482
  buildConductorCard(this.config.owner)
@@ -6465,11 +6508,28 @@ var ServiceCoordinator = class {
6465
6508
  this.runtime.registerJob(idleJob);
6466
6509
  console.log("IdleMonitor started (60s poll interval, 70% idle threshold)");
6467
6510
  if (this.config.registry) {
6468
- const startupSync = await syncCreditsFromRegistry(this.config, this.runtime.creditDb);
6469
- if (startupSync.synced) {
6470
- console.log(`[agentbnb] credits synced: ${startupSync.remoteBalance} (was ${startupSync.localWas})`);
6511
+ if (shouldSkipNetwork()) {
6512
+ console.warn("[agentbnb] credit sync skipped: test/offline mode");
6471
6513
  } else {
6472
- console.warn(`[agentbnb] credit sync skipped: ${startupSync.error}`);
6514
+ const reachable = await probeRegistry(this.config.registry);
6515
+ if (!reachable) {
6516
+ console.warn("[agentbnb] credit sync skipped: registry unreachable (will retry every 5m)");
6517
+ } else {
6518
+ try {
6519
+ const startupSync = await withTimeout(
6520
+ syncCreditsFromRegistry(this.config, this.runtime.creditDb),
6521
+ STARTUP_SYNC_BUDGET_MS
6522
+ );
6523
+ if (startupSync.synced) {
6524
+ console.log(`[agentbnb] credits synced: ${startupSync.remoteBalance} (was ${startupSync.localWas})`);
6525
+ } else {
6526
+ console.warn(`[agentbnb] credit sync skipped: ${startupSync.error}`);
6527
+ }
6528
+ } catch (err) {
6529
+ const reason = err instanceof TimeoutError ? `timeout after ${STARTUP_SYNC_BUDGET_MS}ms` : err.message;
6530
+ console.warn(`[agentbnb] credit sync skipped: ${reason} (will retry every 5m)`);
6531
+ }
6532
+ }
6473
6533
  }
6474
6534
  this.creditSyncJob = new Cron2("*/5 * * * *", async () => {
6475
6535
  const result = await syncCreditsFromRegistry(this.config, this.runtime.creditDb);
@@ -6510,7 +6570,7 @@ var ServiceCoordinator = class {
6510
6570
  }
6511
6571
  if (opts.registryUrl && opts.relay) {
6512
6572
  const { RelayClient } = await import("./websocket-client-FCPZOE4S.js");
6513
- const { executeCapabilityRequest: executeCapabilityRequest2 } = await import("./execute-NOQVN7ZG.js");
6573
+ const { executeCapabilityRequest: executeCapabilityRequest2 } = await import("./execute-R5STYWLD.js");
6514
6574
  const localCards = listCards(this.runtime.registryDb, this.config.owner);
6515
6575
  const { primaryCard, additionalCards } = buildRelayRegistrationCards(this.config.owner, localCards);
6516
6576
  if (this.config.conductor?.public) {
@@ -1,12 +1,15 @@
1
+ import {
2
+ shouldSkipNetwork
3
+ } from "./chunk-5FXLZ5FX.js";
1
4
  import {
2
5
  ensureIdentity
3
6
  } from "./chunk-AA25Z6FW.js";
4
7
  import "./chunk-65GNX2KC.js";
5
- import "./chunk-UVCNMRPS.js";
6
8
  import {
7
9
  getConfigDir,
8
10
  loadConfig
9
11
  } from "./chunk-3XPBFF6H.js";
12
+ import "./chunk-UVCNMRPS.js";
10
13
  import "./chunk-3RG5ZIWI.js";
11
14
 
12
15
  // src/cli/session-action.ts
@@ -18,6 +21,10 @@ async function sessionOpen(cardId, opts) {
18
21
  console.error("Error: No registry configured. Run `agentbnb init` first.");
19
22
  process.exit(1);
20
23
  }
24
+ if (shouldSkipNetwork()) {
25
+ console.error("Error: session open requires network access (currently in offline/test mode).");
26
+ process.exit(1);
27
+ }
21
28
  const configDir = getConfigDir();
22
29
  const identity = ensureIdentity(configDir, config.owner);
23
30
  const agentId = identity.agent_id ?? identity.owner;
@@ -25,7 +32,12 @@ async function sessionOpen(cardId, opts) {
25
32
  const WebSocket = (await import("ws")).default;
26
33
  const ws = new WebSocket(relayUrl);
27
34
  await new Promise((resolve, reject) => {
35
+ const connectTimer = setTimeout(() => {
36
+ ws.close();
37
+ reject(new Error("WebSocket connection timeout (10s)"));
38
+ }, 1e4);
28
39
  ws.on("open", () => {
40
+ clearTimeout(connectTimer);
29
41
  ws.send(JSON.stringify({
30
42
  type: "register",
31
43
  owner: identity.owner,
@@ -35,7 +47,10 @@ async function sessionOpen(cardId, opts) {
35
47
  }));
36
48
  resolve();
37
49
  });
38
- ws.on("error", reject);
50
+ ws.on("error", (err) => {
51
+ clearTimeout(connectTimer);
52
+ reject(err);
53
+ });
39
54
  });
40
55
  const sessionId = randomUUID();
41
56
  ws.send(JSON.stringify({