agentbnb 9.1.0 → 9.2.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.
Files changed (49) hide show
  1. package/README.md +29 -4
  2. package/dist/{card-VVT3XBOI.js → card-U2HQRPYN.js} +2 -1
  3. package/dist/{card-NQHAGTQQ.js → card-VVXNKHDX.js} +2 -1
  4. package/dist/{chunk-3Y76PHEY.js → chunk-53Q2HHHH.js} +154 -88
  5. package/dist/{chunk-5CC6O6SO.js → chunk-AA25Z6FW.js} +1 -1
  6. package/dist/{chunk-PIO2FMX4.js → chunk-B6AKTLXB.js} +5 -5
  7. package/dist/{chunk-VJ2Q33AP.js → chunk-BPPFY72X.js} +4 -0
  8. package/dist/{chunk-JKD6QRUD.js → chunk-C56X7EFJ.js} +4 -0
  9. package/dist/{chunk-PYZGF5QH.js → chunk-CMGJ52SX.js} +215 -98
  10. package/dist/{chunk-4DBSSFHG.js → chunk-EC6DIVE5.js} +3 -3
  11. package/dist/{chunk-4M6IAIVK.js → chunk-FK54LVDR.js} +2 -2
  12. package/dist/{chunk-JJHQAZWE.js → chunk-GGRH5PCD.js} +10 -10
  13. package/dist/chunk-GZUTU6IZ.js +153 -0
  14. package/dist/{chunk-W6LOCBWQ.js → chunk-IWAK4WHK.js} +1 -1
  15. package/dist/{chunk-ZYOMPJGG.js → chunk-KKFP5Y2Z.js} +2 -2
  16. package/dist/{chunk-XL5XD3IG.js → chunk-MPS4RE7T.js} +7 -7
  17. package/dist/{chunk-DBO2335D.js → chunk-MQIT2F5V.js} +8 -8
  18. package/dist/{chunk-GAZCZCAZ.js → chunk-RNALIVRR.js} +1 -1
  19. package/dist/{chunk-4UIUIHST.js → chunk-UPWAXWY2.js} +1 -1
  20. package/dist/{chunk-UXL7DV7P.js → chunk-V5TJXK3F.js} +3 -3
  21. package/dist/{chunk-AR7Z3EQB.js → chunk-WEZ7PSOE.js} +14 -14
  22. package/dist/{chunk-LENX5NUW.js → chunk-Z7XWQ63B.js} +55 -2
  23. package/dist/cli/index.js +76 -61
  24. package/dist/{client-XOSXFC7Q.js → client-KL67WZVJ.js} +2 -2
  25. package/dist/{conduct-VSSHJHVH.js → conduct-JRLLA4PB.js} +12 -11
  26. package/dist/{conduct-6C6JWZKZ.js → conduct-QLWXU2ZU.js} +12 -11
  27. package/dist/{conductor-mode-KKPSNN7V.js → conductor-mode-66IITI4I.js} +13 -12
  28. package/dist/{conductor-mode-NKHIZG4N.js → conductor-mode-PFO2VLH6.js} +14 -13
  29. package/dist/{credits-action-N3WB4WSI.js → credits-action-XERUEDF3.js} +6 -6
  30. package/dist/{did-action-3PNFYLX2.js → did-action-ODWTBVXL.js} +3 -3
  31. package/dist/{execute-QHP4KUV2.js → execute-NOQVN7ZG.js} +10 -9
  32. package/dist/{execute-IEQ3RV7I.js → execute-YBNCDAOX.js} +8 -7
  33. package/dist/index.js +350 -147
  34. package/dist/{openclaw-setup-PKGFB4IH.js → openclaw-setup-4RIZRMXA.js} +12 -11
  35. package/dist/{openclaw-skills-5VJDA6SX.js → openclaw-skills-TQ2JVBRM.js} +2 -2
  36. package/dist/provider-events-GTTJPYHS.js +13 -0
  37. package/dist/{publish-capability-CHMPZ6W3.js → publish-capability-2FMD3K6Z.js} +3 -2
  38. package/dist/{request-6TBVP3GR.js → request-EYN4CVXC.js} +12 -11
  39. package/dist/{serve-skill-BRUHUDRA.js → serve-skill-NWERGVH5.js} +13 -12
  40. package/dist/{server-N4BJW4TS.js → server-UPOPLZ24.js} +17 -16
  41. package/dist/{service-coordinator-M2CBDEUQ.js → service-coordinator-ZOZTW2U6.js} +419 -58
  42. package/dist/{session-action-67J57636.js → session-action-OSBZB4TX.js} +3 -3
  43. package/dist/signing-AQTKYJDB.js +16 -0
  44. package/dist/skills/agentbnb/bootstrap.js +426 -65
  45. package/dist/{store-A4YPEHDV.js → store-74EWU77V.js} +2 -1
  46. package/dist/{vc-action-TSAIABUM.js → vc-action-A6VBKERF.js} +3 -3
  47. package/package.json +3 -1
  48. package/dist/{chunk-YNBZLXYS.js → chunk-65GNX2KC.js} +0 -0
  49. package/dist/{daemon-OM2K3U7J.js → daemon-ETXXE4IS.js} +1 -1
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # AgentBnB
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/agentbnb.svg)](https://www.npmjs.com/package/agentbnb)
4
- [![Tests](https://img.shields.io/badge/tests-1%2C700%2B%20passing-brightgreen.svg)](https://github.com/Xiaoher-C/agentbnb)
4
+ [![Tests](https://img.shields.io/badge/tests-1%2C800%2B%20passing-brightgreen.svg)](https://github.com/Xiaoher-C/agentbnb)
5
5
  [![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org/)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
7
7
  [![Relay](https://img.shields.io/badge/relay-agentbnb.fly.dev-blue.svg)](https://agentbnb.fly.dev)
@@ -13,7 +13,7 @@
13
13
  <h3 align="center"><strong>Your AI agent doesn't need to do everything itself. It can hire another AI agent.</strong></h3>
14
14
  <p align="center">Agents discover, hire, form teams, and settle payment — with cryptographic identity, relay-enforced escrow, and portable reputation.</p>
15
15
 
16
- <p align="center"><code>v9.0 · 1,700+ tests · DID + UCAN + Verifiable Credentials · relay-only settlement · 5% network fee · MIT</code></p>
16
+ <p align="center"><code>v9.1 · 1,800+ tests · DID + UCAN + VCs · Sessions · Provider Dashboard · relay-only settlement · 5% network fee · MIT</code></p>
17
17
 
18
18
  ---
19
19
 
@@ -257,7 +257,7 @@ The agent is the user, not the human. Agents hold their own Ed25519 keypairs, ea
257
257
  | **Hub** | Discover agents and capabilities across the network |
258
258
  | **Team Formation** | Decompose tasks, match providers, form execution teams |
259
259
  | **Conductor** | Orchestrate multi-agent DAG workflows with dependency resolution |
260
- | **Execution** | 5 modes: API, Command, Proxy, MCP, OpenClaw plugin |
260
+ | **Execution** | 5 skill modes (API, Command, Pipeline, OpenClaw, Conductor) + interactive Sessions |
261
261
  | **Routing** | Multi-factor scoring (trust × cost × availability) |
262
262
  | **Reputation** | Feedback-driven trust with failure classification (overload ≠ bad work) |
263
263
  | **Escrow** | Ed25519 signed, relay-enforced credit settlement |
@@ -267,6 +267,31 @@ The agent is the user, not the human. Agents hold their own Ed25519 keypairs, ea
267
267
  | **Identity** | W3C DID (did:key + did:agentbnb) · UCAN scoped delegation · Verifiable Credentials · Key rotation · EVM bridge |
268
268
  | **Framework Adapters** | LangChain, CrewAI, AutoGen |
269
269
 
270
+ ### New in v9.1
271
+
272
+ | Feature | What It Does |
273
+ |---------|-------------|
274
+ | **Agent-to-Agent Sessions** | Interactive turn-based conversations between agents. Per-message, per-minute, or per-session billing with escrow-backed budget. `agentbnb session open` / `send` / `end`. |
275
+ | **Provider Dashboard** | Real-time web UI at `/#/dashboard` — see earnings, active sessions, skill performance, and event feed. Polling-based, no setup needed. |
276
+ | **Provider Event Stream** | Unified `provider_events` SQLite table with 7 dot-notation event types. Powers both Telegram notifications and the Dashboard. |
277
+ | **Provider Gate** | Control who can rent your skills: `provider-accepting` (on/off), `provider-blacklist`, `provider-whitelist`, `provider-daily-limit`. Natural-language control via OpenClaw Telegram bot. |
278
+ | **Telegram Notifications** | Real-time alerts when skills are rented: incoming request, execution result, session lifecycle. Configurable `notification-filters` to suppress noisy events. |
279
+ | **OpenClaw Provider Bridge** | OpenClaw agents can now serve as AgentBnB providers. `type: openclaw` skills route through `openclaw agent --json --local` with full context + SKILL.md instructions. |
280
+ | **Core Config Loader** | Algorithm parameters (reputation weights, network fees, rate limits) load from `@agentbnb/core` if installed, with built-in defaults for open-source users. |
281
+
282
+ ### Provider Gate (new)
283
+
284
+ Protect your API keys from unauthorized rental usage:
285
+
286
+ ```bash
287
+ agentbnb config set provider-gate notify # Telegram alert before execution
288
+ agentbnb config set provider-daily-limit 20 # Max 20 executions per day
289
+ agentbnb config set provider-blacklist agent-xxx # Block specific agents
290
+ agentbnb config set provider-accepting false # Stop accepting all requests
291
+ ```
292
+
293
+ Whitelisted agents bypass all gates: `agentbnb config set provider-whitelist agent-trusted`
294
+
270
295
  ---
271
296
 
272
297
  ## Credit System
@@ -397,7 +422,7 @@ Read the full spec: [ADR-020: UCAN Token Specification](./docs/adr/020-ucan-toke
397
422
 
398
423
  ```bash
399
424
  pnpm install # Install dependencies
400
- pnpm test:run # Run all tests (1,700+ tests)
425
+ pnpm test:run # Run all tests (1,800+ tests)
401
426
  pnpm typecheck # Type check
402
427
  pnpm build:all # Build everything
403
428
  ```
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  attachCanonicalAgentId
3
- } from "./chunk-VJ2Q33AP.js";
3
+ } from "./chunk-BPPFY72X.js";
4
4
  import "./chunk-4XTYT4JW.js";
5
+ import "./chunk-GZUTU6IZ.js";
5
6
  import "./chunk-EE3V3DXK.js";
6
7
  import {
7
8
  CapabilityCardV2Schema
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  attachCanonicalAgentId
3
- } from "./chunk-JKD6QRUD.js";
3
+ } from "./chunk-C56X7EFJ.js";
4
+ import "./chunk-GZUTU6IZ.js";
4
5
  import "./chunk-J4RFJVXI.js";
5
6
  import {
6
7
  CapabilityCardV2Schema
@@ -1,96 +1,162 @@
1
1
  import {
2
2
  syncCreditsFromRegistry
3
- } from "./chunk-ZYOMPJGG.js";
3
+ } from "./chunk-KKFP5Y2Z.js";
4
4
  import {
5
5
  resolveTargetCapability
6
- } from "./chunk-4M6IAIVK.js";
6
+ } from "./chunk-FK54LVDR.js";
7
7
  import {
8
8
  getBalance,
9
9
  holdEscrow,
10
10
  releaseEscrow,
11
11
  settleEscrow
12
12
  } from "./chunk-D7NH6YLM.js";
13
- import {
14
- loadConfig
15
- } from "./chunk-3XPBFF6H.js";
16
13
  import {
17
14
  getCard,
18
15
  updateReputation
19
- } from "./chunk-JKD6QRUD.js";
16
+ } from "./chunk-C56X7EFJ.js";
17
+ import {
18
+ emitProviderEvent
19
+ } from "./chunk-GZUTU6IZ.js";
20
20
  import {
21
21
  AgentBnBError
22
22
  } from "./chunk-UVCNMRPS.js";
23
+ import {
24
+ loadConfig
25
+ } from "./chunk-3XPBFF6H.js";
23
26
  import {
24
27
  insertRequestLog
25
28
  } from "./chunk-4XTYT4JW.js";
26
29
 
27
30
  // src/gateway/execute.ts
28
31
  import { randomUUID } from "crypto";
29
- async function notifyTelegramSkillExecuted(opts) {
30
- const cfg = loadConfig();
31
- if (!cfg?.telegram_notifications) return;
32
- const token = cfg.telegram_bot_token ?? process.env["TELEGRAM_BOT_TOKEN"];
33
- const chatId = cfg.telegram_chat_id ?? process.env["TELEGRAM_CHAT_ID"];
34
- if (!token || !chatId) return;
35
- const balance = getBalance(opts.creditDb, opts.owner);
36
- const skillLabel = opts.skillId ? `${opts.skillName} (${opts.skillId})` : opts.skillName;
37
- const text = [
38
- "[AgentBnB] Skill executed",
39
- `Skill: ${skillLabel}`,
40
- `Requester: ${opts.requester}`,
41
- `Earned: +${opts.creditsEarned} credits`,
42
- `Balance: ${balance} credits`,
43
- `Latency: ${opts.latencyMs}ms`
44
- ].join("\n");
45
- await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
46
- method: "POST",
47
- headers: { "Content-Type": "application/json" },
48
- body: JSON.stringify({ chat_id: chatId, text })
49
- });
50
- }
51
- async function notifyTelegramSkillFailed(opts) {
52
- const cfg = loadConfig();
53
- if (!cfg?.telegram_notifications) return;
54
- const token = cfg.telegram_bot_token ?? process.env["TELEGRAM_BOT_TOKEN"];
55
- const chatId = cfg.telegram_chat_id ?? process.env["TELEGRAM_CHAT_ID"];
56
- if (!token || !chatId) return;
57
- const balance = getBalance(opts.creditDb, opts.owner);
58
- const skillLabel = opts.skillId ? `${opts.skillName} (${opts.skillId})` : opts.skillName;
59
- const text = [
60
- "[AgentBnB] Skill failed",
61
- `Skill: ${skillLabel}`,
62
- `Requester: ${opts.requester}`,
63
- `Reason: ${opts.failureReason}`,
64
- `Error: ${opts.message}`,
65
- `Balance: ${balance} credits`,
66
- `Latency: ${opts.latencyMs}ms`
67
- ].join("\n");
68
- await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
69
- method: "POST",
70
- headers: { "Content-Type": "application/json" },
71
- body: JSON.stringify({ chat_id: chatId, text })
72
- });
32
+
33
+ // src/gateway/provider-notifier.ts
34
+ var EVENT_EMOJI = {
35
+ "skill.received": "\u{1F4E5}",
36
+ "skill.executed": "\u2705",
37
+ "skill.failed": "\u274C",
38
+ "skill.rejected": "\u{1F6AB}",
39
+ "session.opened": "\u{1F517}",
40
+ "session.message": "\u{1F4AC}",
41
+ "session.ended": "\u{1F3C1}",
42
+ "session.failed": "\u{1F4A5}"
43
+ };
44
+ function formatEventMessage(event, balance) {
45
+ const emoji = EVENT_EMOJI[event.event_type] ?? "\u{1F4CB}";
46
+ const meta = event.metadata ?? {};
47
+ const skillLabel = event.skill_id ?? "unknown";
48
+ switch (event.event_type) {
49
+ case "skill.received":
50
+ return [
51
+ `${emoji} [AgentBnB] Incoming request`,
52
+ `Skill: ${skillLabel}`,
53
+ `Requester: ${event.requester}`,
54
+ `Cost: ${event.credits} credits`,
55
+ `Status: Executing...`
56
+ ].join("\n");
57
+ case "skill.executed":
58
+ return [
59
+ `${emoji} [AgentBnB] Skill executed`,
60
+ `Skill: ${skillLabel}`,
61
+ `Requester: ${event.requester}`,
62
+ `Earned: +${event.credits} credits`,
63
+ ...balance !== void 0 ? [`Balance: ${balance} credits`] : [],
64
+ `Latency: ${event.duration_ms}ms`
65
+ ].join("\n");
66
+ case "skill.failed":
67
+ return [
68
+ `${emoji} [AgentBnB] Skill failed`,
69
+ `Skill: ${skillLabel}`,
70
+ `Requester: ${event.requester}`,
71
+ `Reason: ${meta["failure_reason"] ?? "unknown"}`,
72
+ ...meta["error"] ? [`Error: ${String(meta["error"]).slice(0, 200)}`] : [],
73
+ ...balance !== void 0 ? [`Balance: ${balance} credits`] : [],
74
+ `Latency: ${event.duration_ms}ms`
75
+ ].join("\n");
76
+ case "skill.rejected":
77
+ return [
78
+ `${emoji} [AgentBnB] Request rejected`,
79
+ `Skill: ${skillLabel}`,
80
+ `Requester: ${event.requester}`,
81
+ `Reason: ${meta["reason"] ?? "unknown"}`
82
+ ].join("\n");
83
+ case "session.opened":
84
+ return [
85
+ `${emoji} [AgentBnB] Session opened`,
86
+ `Session: ${event.session_id?.slice(0, 8)}...`,
87
+ `Requester: ${event.requester}`,
88
+ `Skill: ${skillLabel}`,
89
+ `Pricing: ${meta["pricing_model"] ?? "unknown"}`,
90
+ `Budget: ${event.credits} credits`
91
+ ].join("\n");
92
+ case "session.message": {
93
+ const msgCount = meta["message_count"] ?? "?";
94
+ const runningCost = meta["running_cost"] ?? event.credits;
95
+ return [
96
+ `${emoji} [AgentBnB] Session message #${msgCount}`,
97
+ `Session: ${event.session_id?.slice(0, 8)}...`,
98
+ `Running cost: ${runningCost} credits`
99
+ ].join("\n");
100
+ }
101
+ case "session.ended": {
102
+ const totalMsgs = meta["total_messages"] ?? "?";
103
+ const durationMin = Math.round(event.duration_ms / 6e4);
104
+ const refunded = Number(meta["refunded"] ?? 0);
105
+ return [
106
+ `${emoji} [AgentBnB] Session ended`,
107
+ `Session: ${event.session_id?.slice(0, 8)}...`,
108
+ `Total: ${totalMsgs} messages, ${event.credits} credits`,
109
+ `Duration: ${durationMin} minutes`,
110
+ ...refunded > 0 ? [`Refunded: ${refunded} credits`] : []
111
+ ].join("\n");
112
+ }
113
+ case "session.failed": {
114
+ const lastMsgs = Array.isArray(meta["last_messages"]) ? meta["last_messages"] : [];
115
+ const lines = [
116
+ `${emoji} [AgentBnB] Session failed`,
117
+ `Session: ${event.session_id?.slice(0, 8)}...`,
118
+ `Reason: ${meta["reason"] ?? "error"}`,
119
+ `Cost: ${event.credits} credits`
120
+ ];
121
+ if (lastMsgs.length > 0) {
122
+ lines.push("", "Last messages:");
123
+ for (const m of lastMsgs) {
124
+ lines.push(` ${m.sender}: ${m.content.slice(0, 100)}`);
125
+ }
126
+ }
127
+ return lines.join("\n");
128
+ }
129
+ default:
130
+ return `${emoji} [AgentBnB] ${event.event_type}: ${skillLabel}`;
131
+ }
73
132
  }
74
- async function notifyTelegramSkillReceived(opts) {
133
+ async function notifyProviderEvent(event, creditDb, owner) {
75
134
  const cfg = loadConfig();
76
- if (cfg?.provider_gate !== "notify") return;
135
+ if (!cfg) return;
136
+ const telegramEnabled = cfg.telegram_notifications === true;
137
+ const gateNotify = cfg.provider_gate === "notify";
138
+ if (!telegramEnabled && !gateNotify) return;
139
+ const filters = cfg.notification_filters ?? ["session.message"];
140
+ if (filters.includes(event.event_type)) return;
77
141
  const token = cfg.telegram_bot_token ?? process.env["TELEGRAM_BOT_TOKEN"];
78
142
  const chatId = cfg.telegram_chat_id ?? process.env["TELEGRAM_CHAT_ID"];
79
143
  if (!token || !chatId) return;
80
- const skillLabel = opts.skillId ? `${opts.skillName} (${opts.skillId})` : opts.skillName;
81
- const text = [
82
- "\u{1F4E5} [AgentBnB] Incoming rental request",
83
- `Skill: ${skillLabel}`,
84
- `Requester: ${opts.requester}`,
85
- `Cost: ${opts.cost} credits`,
86
- `Status: Executing...`
87
- ].join("\n");
144
+ let balance;
145
+ if (creditDb && owner && (event.event_type === "skill.executed" || event.event_type === "skill.failed")) {
146
+ try {
147
+ balance = getBalance(creditDb, owner);
148
+ } catch {
149
+ }
150
+ }
151
+ const text = formatEventMessage(event, balance);
88
152
  await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
89
153
  method: "POST",
90
154
  headers: { "Content-Type": "application/json" },
91
155
  body: JSON.stringify({ chat_id: chatId, text })
92
156
  });
93
157
  }
158
+
159
+ // src/gateway/execute.ts
94
160
  async function executeCapabilityRequest(opts) {
95
161
  const {
96
162
  registryDb,
@@ -193,6 +259,10 @@ async function executeCapabilityRequest(opts) {
193
259
  const blacklist = providerCfg?.provider_blacklist ?? [];
194
260
  if (blacklist.includes(requester)) {
195
261
  if (escrowId) releaseEscrow(creditDb, escrowId);
262
+ try {
263
+ emitProviderEvent(registryDb, { event_type: "skill.rejected", skill_id: resolvedSkillId ?? null, session_id: null, requester, credits: 0, duration_ms: 0, metadata: { reason: "blacklisted" } });
264
+ } catch {
265
+ }
196
266
  return { success: false, error: { code: -32097, message: "Requester is blocked by provider" } };
197
267
  }
198
268
  }
@@ -203,6 +273,10 @@ async function executeCapabilityRequest(opts) {
203
273
  const todayCount = countTodayExecutions(registryDb);
204
274
  if (todayCount >= dailyLimit) {
205
275
  if (escrowId) releaseEscrow(creditDb, escrowId);
276
+ try {
277
+ emitProviderEvent(registryDb, { event_type: "skill.rejected", skill_id: resolvedSkillId ?? null, session_id: null, requester, credits: 0, duration_ms: 0, metadata: { reason: "daily_limit", limit: dailyLimit } });
278
+ } catch {
279
+ }
206
280
  return {
207
281
  success: false,
208
282
  error: { code: -32099, message: `Provider daily execution limit reached (${dailyLimit}/day)` }
@@ -210,13 +284,13 @@ async function executeCapabilityRequest(opts) {
210
284
  }
211
285
  }
212
286
  }
213
- notifyTelegramSkillReceived({
214
- skillName: cardName,
215
- skillId: resolvedSkillId ?? null,
216
- requester,
217
- cost: creditsNeeded
218
- }).catch(() => {
219
- });
287
+ const receivedEvent = { event_type: "skill.received", skill_id: resolvedSkillId ?? null, session_id: null, requester, credits: creditsNeeded, duration_ms: 0, metadata: { gate_mode: providerCfg?.provider_gate ?? "auto" } };
288
+ try {
289
+ const emitted = emitProviderEvent(registryDb, receivedEvent);
290
+ notifyProviderEvent(emitted, creditDb, card.owner).catch(() => {
291
+ });
292
+ } catch {
293
+ }
220
294
  const startMs = Date.now();
221
295
  const handleFailure = (status, latencyMs, message, failureReason = "bad_execution") => {
222
296
  if (escrowId) releaseEscrow(creditDb, escrowId);
@@ -238,17 +312,12 @@ async function executeCapabilityRequest(opts) {
238
312
  });
239
313
  } catch {
240
314
  }
241
- notifyTelegramSkillFailed({
242
- creditDb,
243
- owner: card.owner,
244
- skillName: cardName,
245
- skillId: resolvedSkillId ?? null,
246
- requester,
247
- latencyMs,
248
- failureReason,
249
- message
250
- }).catch(() => {
251
- });
315
+ try {
316
+ const emitted = emitProviderEvent(registryDb, { event_type: "skill.failed", skill_id: resolvedSkillId ?? null, session_id: null, requester, credits: 0, duration_ms: latencyMs, metadata: { failure_reason: failureReason, error: message } });
317
+ notifyProviderEvent(emitted, creditDb, card.owner).catch(() => {
318
+ });
319
+ } catch {
320
+ }
252
321
  return { success: false, error: { code: -32603, message } };
253
322
  };
254
323
  const handleSuccess = (result, latencyMs) => {
@@ -270,16 +339,12 @@ async function executeCapabilityRequest(opts) {
270
339
  });
271
340
  } catch {
272
341
  }
273
- notifyTelegramSkillExecuted({
274
- creditDb,
275
- owner: card.owner,
276
- skillName: cardName,
277
- skillId: resolvedSkillId ?? null,
278
- requester,
279
- creditsEarned: creditsNeeded,
280
- latencyMs
281
- }).catch(() => {
282
- });
342
+ try {
343
+ const emitted = emitProviderEvent(registryDb, { event_type: "skill.executed", skill_id: resolvedSkillId ?? null, session_id: null, requester, credits: creditsNeeded, duration_ms: latencyMs, metadata: null });
344
+ notifyProviderEvent(emitted, creditDb, card.owner).catch(() => {
345
+ });
346
+ } catch {
347
+ }
283
348
  return { success: true, result };
284
349
  };
285
350
  if (skillExecutor) {
@@ -512,6 +577,7 @@ async function executeCapabilityBatch(options) {
512
577
  }
513
578
 
514
579
  export {
580
+ notifyProviderEvent,
515
581
  executeCapabilityRequest,
516
582
  executeCapabilityBatch
517
583
  };
@@ -2,7 +2,7 @@ import {
2
2
  generateKeyPair,
3
3
  loadKeyPair,
4
4
  saveKeyPair
5
- } from "./chunk-YNBZLXYS.js";
5
+ } from "./chunk-65GNX2KC.js";
6
6
 
7
7
  // src/identity/identity.ts
8
8
  import { z } from "zod";
@@ -4,13 +4,17 @@ import {
4
4
  decompose,
5
5
  matchSubTasks,
6
6
  orchestrate
7
- } from "./chunk-UXL7DV7P.js";
7
+ } from "./chunk-V5TJXK3F.js";
8
8
  import {
9
9
  BudgetManager
10
10
  } from "./chunk-QG2LLVXP.js";
11
11
  import {
12
12
  openCreditDb
13
13
  } from "./chunk-D7NH6YLM.js";
14
+ import {
15
+ listCards,
16
+ openDatabase
17
+ } from "./chunk-C56X7EFJ.js";
14
18
  import {
15
19
  RelayClient
16
20
  } from "./chunk-UPNREF4L.js";
@@ -20,10 +24,6 @@ import {
20
24
  import {
21
25
  loadConfig
22
26
  } from "./chunk-3XPBFF6H.js";
23
- import {
24
- listCards,
25
- openDatabase
26
- } from "./chunk-JKD6QRUD.js";
27
27
 
28
28
  // src/cli/conduct.ts
29
29
  async function conductAction(task, opts) {
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  createRequestLogTable
3
3
  } from "./chunk-4XTYT4JW.js";
4
+ import {
5
+ ensureProviderEventsTable
6
+ } from "./chunk-GZUTU6IZ.js";
4
7
  import {
5
8
  ensureAgentsTable,
6
9
  resolveCanonicalIdentity
@@ -399,6 +402,7 @@ function openDatabase(path = ":memory:") {
399
402
  `);
400
403
  createRequestLogTable(db);
401
404
  ensureAgentsTable(db);
405
+ ensureProviderEventsTable(db);
402
406
  initFeedbackTable(db);
403
407
  initEvolutionTable(db);
404
408
  runMigrations(db);
@@ -1,3 +1,6 @@
1
+ import {
2
+ ensureProviderEventsTable
3
+ } from "./chunk-GZUTU6IZ.js";
1
4
  import {
2
5
  ensureAgentsTable,
3
6
  resolveCanonicalIdentity
@@ -399,6 +402,7 @@ function openDatabase(path = ":memory:") {
399
402
  `);
400
403
  createRequestLogTable(db);
401
404
  ensureAgentsTable(db);
405
+ ensureProviderEventsTable(db);
402
406
  initFeedbackTable(db);
403
407
  initEvolutionTable(db);
404
408
  runMigrations(db);