agentbnb 5.1.11 → 7.0.0-beta.1

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 (60) hide show
  1. package/README.md +245 -39
  2. package/dist/{card-RSGDCHCV.js → card-REW7BSWW.js} +1 -1
  3. package/dist/{chunk-FLY3WIQR.js → chunk-2HSUPCBT.js} +3 -3
  4. package/dist/{chunk-WGZ5AGOX.js → chunk-3CIMVISQ.js} +24 -1
  5. package/dist/{chunk-NH2FIERR.js → chunk-574W3HHE.js} +1 -1
  6. package/dist/{chunk-WTXRY7R2.js → chunk-APEG4QIN.js} +157 -9
  7. package/dist/chunk-BP3L2TET.js +148 -0
  8. package/dist/{chunk-NLAWT4DT.js → chunk-CWYPTQRQ.js} +7 -7
  9. package/dist/{chunk-UKT6H7YT.js → chunk-DUW6RX6I.js} +5 -2
  10. package/dist/chunk-EAD4A4KG.js +430 -0
  11. package/dist/{chunk-QT7TEVNV.js → chunk-EHSHB7TY.js} +23 -1
  12. package/dist/{chunk-B5FTAGFN.js → chunk-ETGOKDFR.js} +75 -75
  13. package/dist/{chunk-5KFI5X7B.js → chunk-F53QQIM2.js} +1 -1
  14. package/dist/{chunk-MLS6IGGG.js → chunk-FK2MDNTB.js} +117 -117
  15. package/dist/{chunk-EGUOAHCW.js → chunk-GO4FVRVN.js} +15 -13
  16. package/dist/{chunk-CRFCWD6V.js → chunk-J2K5S5MX.js} +136 -173
  17. package/dist/chunk-K5FO42YF.js +1136 -0
  18. package/dist/{chunk-DFBX3BBD.js → chunk-KA2VIEGM.js} +211 -16
  19. package/dist/chunk-NWIQJ2CL.js +108 -0
  20. package/dist/chunk-OCSU2S6W.js +168 -0
  21. package/dist/{chunk-QQFBFV4V.js → chunk-PGDBUUGR.js} +60 -19
  22. package/dist/{chunk-QITOPASZ.js → chunk-PSQHUZ7X.js} +1 -1
  23. package/dist/{chunk-C6KPAFCC.js → chunk-PU7LXOQ3.js} +23 -1
  24. package/dist/{chunk-JOY533UH.js → chunk-TW65F5EU.js} +1 -1
  25. package/dist/{chunk-ZX5623ER.js → chunk-VMH2YS2I.js} +1 -1
  26. package/dist/{chunk-XND2DWTZ.js → chunk-VPQ44XKE.js} +2 -2
  27. package/dist/{chunk-CSATDXZC.js → chunk-Y7T6IMM3.js} +1 -1
  28. package/dist/cli/index.js +755 -379
  29. package/dist/{client-T5MTY3CS.js → client-HRYRJKSA.js} +3 -3
  30. package/dist/{conduct-WU3VEXB6.js → conduct-JNYJCDHQ.js} +14 -13
  31. package/dist/conduct-KJUD2RTB.js +22 -0
  32. package/dist/{conductor-mode-ZMTFZGJP.js → conductor-mode-2VVFMKVE.js} +313 -14
  33. package/dist/conductor-mode-VGUU54QI.js +276 -0
  34. package/dist/execute-I4PKSNJM.js +12 -0
  35. package/dist/execute-MOXSSA3Q.js +15 -0
  36. package/dist/index.d.ts +795 -2
  37. package/dist/index.js +861 -111
  38. package/dist/{process-guard-CC7CNRQJ.js → process-guard-QCCBGILS.js} +1 -1
  39. package/dist/publish-capability-TS6CNR5G.js +12 -0
  40. package/dist/reliability-metrics-QG7WC5QK.js +18 -0
  41. package/dist/{request-VOXBFUOG.js → request-E7TA7COA.js} +19 -18
  42. package/dist/{serve-skill-IH7UAJNR.js → serve-skill-HIOWYKRU.js} +13 -11
  43. package/dist/{server-JVQW2TID.js → server-I63CXFX3.js} +17 -16
  44. package/dist/{service-coordinator-EYRDTHL5.js → service-coordinator-XBNT3SMU.js} +369 -260
  45. package/dist/skill-config-FETXPNVP.js +22 -0
  46. package/dist/skills/agentbnb/bootstrap.js +430 -84
  47. package/dist/websocket-client-5MH6QRJK.js +7 -0
  48. package/dist/{websocket-client-WRN3HO73.js → websocket-client-PFGVTXNE.js} +1 -1
  49. package/openclaw.plugin.json +2 -2
  50. package/package.json +2 -1
  51. package/skills/agentbnb/SKILL.md +35 -0
  52. package/skills/agentbnb/bootstrap.ts +126 -8
  53. package/skills/agentbnb/install.sh +49 -9
  54. package/dist/chunk-EANI2N2V.js +0 -309
  55. package/dist/chunk-EPIWHNB2.js +0 -946
  56. package/dist/conduct-6LKIJJKQ.js +0 -21
  57. package/dist/conductor-mode-Q4IIDY5E.js +0 -123
  58. package/dist/execute-4D4ITQCL.js +0 -10
  59. package/dist/execute-T7Y6RKSW.js +0 -13
  60. package/dist/websocket-client-6IIDGXKB.js +0 -7
@@ -1,26 +1,51 @@
1
1
  import {
2
2
  settleProviderEarning
3
- } from "./chunk-UKT6H7YT.js";
4
- import {
5
- getCard,
6
- insertRequestLog,
7
- updateReputation
8
- } from "./chunk-DFBX3BBD.js";
3
+ } from "./chunk-DUW6RX6I.js";
9
4
  import {
10
5
  getBalance,
11
6
  holdEscrow,
12
7
  releaseEscrow,
13
8
  settleEscrow
14
- } from "./chunk-EANI2N2V.js";
9
+ } from "./chunk-J2K5S5MX.js";
15
10
  import {
16
11
  verifyEscrowReceipt
17
- } from "./chunk-5KFI5X7B.js";
12
+ } from "./chunk-F53QQIM2.js";
13
+ import {
14
+ loadConfig
15
+ } from "./chunk-75OC6E4F.js";
16
+ import {
17
+ getCard,
18
+ insertRequestLog,
19
+ updateReputation
20
+ } from "./chunk-KA2VIEGM.js";
18
21
  import {
19
22
  AgentBnBError
20
- } from "./chunk-WGZ5AGOX.js";
23
+ } from "./chunk-3CIMVISQ.js";
21
24
 
22
25
  // src/gateway/execute.ts
23
26
  import { randomUUID } from "crypto";
27
+ async function notifyTelegramSkillExecuted(opts) {
28
+ const cfg = loadConfig();
29
+ if (!cfg?.telegram_notifications) return;
30
+ const token = cfg.telegram_bot_token ?? process.env["TELEGRAM_BOT_TOKEN"];
31
+ const chatId = cfg.telegram_chat_id ?? process.env["TELEGRAM_CHAT_ID"];
32
+ if (!token || !chatId) return;
33
+ const balance = getBalance(opts.creditDb, opts.owner);
34
+ const skillLabel = opts.skillId ? `${opts.skillName} (${opts.skillId})` : opts.skillName;
35
+ const text = [
36
+ "[AgentBnB] Skill executed",
37
+ `Skill: ${skillLabel}`,
38
+ `Requester: ${opts.requester}`,
39
+ `Earned: +${opts.creditsEarned} credits`,
40
+ `Balance: ${balance} credits`,
41
+ `Latency: ${opts.latencyMs}ms`
42
+ ].join("\n");
43
+ await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
44
+ method: "POST",
45
+ headers: { "Content-Type": "application/json" },
46
+ body: JSON.stringify({ chat_id: chatId, text })
47
+ });
48
+ }
24
49
  async function executeCapabilityRequest(opts) {
25
50
  const {
26
51
  registryDb,
@@ -52,7 +77,8 @@ async function executeCapabilityRequest(opts) {
52
77
  status: "failure",
53
78
  latency_ms: 0,
54
79
  credits_charged: 0,
55
- created_at: (/* @__PURE__ */ new Date()).toISOString()
80
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
81
+ failure_reason: "auth_error"
56
82
  });
57
83
  } catch {
58
84
  }
@@ -107,9 +133,11 @@ async function executeCapabilityRequest(opts) {
107
133
  }
108
134
  const startMs = Date.now();
109
135
  const receiptData = isRemoteEscrow ? { receipt_released: true } : void 0;
110
- const handleFailure = (status, latencyMs, message) => {
136
+ const handleFailure = (status, latencyMs, message, failureReason = "bad_execution") => {
111
137
  if (!isRemoteEscrow && escrowId) releaseEscrow(creditDb, escrowId);
112
- updateReputation(registryDb, cardId, false, latencyMs);
138
+ if (failureReason === "bad_execution" || failureReason === "auth_error") {
139
+ updateReputation(registryDb, cardId, false, latencyMs);
140
+ }
113
141
  try {
114
142
  insertRequestLog(registryDb, {
115
143
  id: randomUUID(),
@@ -120,7 +148,8 @@ async function executeCapabilityRequest(opts) {
120
148
  status,
121
149
  latency_ms: latencyMs,
122
150
  credits_charged: 0,
123
- created_at: (/* @__PURE__ */ new Date()).toISOString()
151
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
152
+ failure_reason: failureReason
124
153
  });
125
154
  } catch {
126
155
  }
@@ -150,6 +179,16 @@ async function executeCapabilityRequest(opts) {
150
179
  });
151
180
  } catch {
152
181
  }
182
+ notifyTelegramSkillExecuted({
183
+ creditDb,
184
+ owner: card.owner,
185
+ skillName: cardName,
186
+ skillId: resolvedSkillId ?? null,
187
+ requester,
188
+ creditsEarned: creditsNeeded,
189
+ latencyMs
190
+ }).catch(() => {
191
+ });
153
192
  const successResult = isRemoteEscrow ? {
154
193
  ...typeof result === "object" && result !== null ? result : { data: result },
155
194
  receipt_settled: true,
@@ -167,23 +206,24 @@ async function executeCapabilityRequest(opts) {
167
206
  return handleFailure(
168
207
  "failure",
169
208
  Date.now() - startMs,
170
- "No skill_id specified and no skills registered on this provider."
209
+ "No skill_id specified and no skills registered on this provider.",
210
+ "not_found"
171
211
  );
172
212
  }
173
213
  }
174
214
  try {
175
215
  const execResult = await skillExecutor.execute(targetSkillId, params, onProgress);
176
216
  if (!execResult.success) {
177
- return handleFailure("failure", execResult.latency_ms, execResult.error ?? "Execution failed");
217
+ return handleFailure("failure", execResult.latency_ms, execResult.error ?? "Execution failed", "bad_execution");
178
218
  }
179
219
  return handleSuccess(execResult.result, execResult.latency_ms);
180
220
  } catch (err) {
181
221
  const message = err instanceof Error ? err.message : "Execution error";
182
- return handleFailure("failure", Date.now() - startMs, message);
222
+ return handleFailure("failure", Date.now() - startMs, message, "bad_execution");
183
223
  }
184
224
  }
185
225
  if (!handlerUrl) {
186
- return handleFailure("failure", Date.now() - startMs, "No skill executor or handler URL configured");
226
+ return handleFailure("failure", Date.now() - startMs, "No skill executor or handler URL configured", "bad_execution");
187
227
  }
188
228
  const controller = new AbortController();
189
229
  const timer = setTimeout(() => controller.abort(), timeoutMs);
@@ -196,7 +236,7 @@ async function executeCapabilityRequest(opts) {
196
236
  });
197
237
  clearTimeout(timer);
198
238
  if (!response.ok) {
199
- return handleFailure("failure", Date.now() - startMs, `Handler returned ${response.status}`);
239
+ return handleFailure("failure", Date.now() - startMs, `Handler returned ${response.status}`, "bad_execution");
200
240
  }
201
241
  const result = await response.json();
202
242
  return handleSuccess(result, Date.now() - startMs);
@@ -206,7 +246,8 @@ async function executeCapabilityRequest(opts) {
206
246
  return handleFailure(
207
247
  isTimeout ? "timeout" : "failure",
208
248
  Date.now() - startMs,
209
- isTimeout ? "Execution timeout" : "Handler error"
249
+ isTimeout ? "Execution timeout" : "Handler error",
250
+ isTimeout ? "timeout" : "bad_execution"
210
251
  );
211
252
  }
212
253
  }
@@ -2,7 +2,7 @@ import {
2
2
  generateKeyPair,
3
3
  loadKeyPair,
4
4
  saveKeyPair
5
- } from "./chunk-5KFI5X7B.js";
5
+ } from "./chunk-F53QQIM2.js";
6
6
 
7
7
  // src/identity/identity.ts
8
8
  import { z } from "zod";
@@ -70,6 +70,27 @@ var RelayProgressMessageSchema = z.object({
70
70
  message: z.string().optional()
71
71
  // optional status message
72
72
  });
73
+ var HeartbeatMessageSchema = z.object({
74
+ type: z.literal("heartbeat"),
75
+ owner: z.string().min(1),
76
+ capacity: z.object({
77
+ current_load: z.number(),
78
+ max_concurrent: z.number(),
79
+ queue_depth: z.number()
80
+ }),
81
+ self_summary: z.object({
82
+ capabilities: z.array(z.string()),
83
+ success_rate: z.number(),
84
+ credit_balance: z.number(),
85
+ total_completed: z.number(),
86
+ provider_number: z.number(),
87
+ reliability: z.object({
88
+ current_streak: z.number(),
89
+ repeat_hire_rate: z.number(),
90
+ avg_feedback: z.number()
91
+ })
92
+ })
93
+ });
73
94
  var RelayMessageSchema = z.discriminatedUnion("type", [
74
95
  RegisterMessageSchema,
75
96
  RegisteredMessageSchema,
@@ -78,7 +99,8 @@ var RelayMessageSchema = z.discriminatedUnion("type", [
78
99
  RelayResponseMessageSchema,
79
100
  ResponseMessageSchema,
80
101
  ErrorMessageSchema,
81
- RelayProgressMessageSchema
102
+ RelayProgressMessageSchema,
103
+ HeartbeatMessageSchema
82
104
  ]);
83
105
 
84
106
  // src/relay/websocket-client.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RelayMessageSchema
3
- } from "./chunk-QT7TEVNV.js";
3
+ } from "./chunk-EHSHB7TY.js";
4
4
 
5
5
  // src/relay/websocket-client.ts
6
6
  import WebSocket from "ws";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AgentBnBError
3
- } from "./chunk-WGZ5AGOX.js";
3
+ } from "./chunk-3CIMVISQ.js";
4
4
 
5
5
  // src/cli/remote-registry.ts
6
6
  var RegistryTimeoutError = class extends AgentBnBError {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  signEscrowReceipt
3
- } from "./chunk-5KFI5X7B.js";
3
+ } from "./chunk-F53QQIM2.js";
4
4
  import {
5
5
  AgentBnBError
6
- } from "./chunk-WGZ5AGOX.js";
6
+ } from "./chunk-3CIMVISQ.js";
7
7
 
8
8
  // src/gateway/client.ts
9
9
  import { randomUUID } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AgentBnBError
3
- } from "./chunk-WGZ5AGOX.js";
3
+ } from "./chunk-3CIMVISQ.js";
4
4
 
5
5
  // src/autonomy/tiers.ts
6
6
  import { randomUUID } from "crypto";