agentbnb 9.0.0 → 9.0.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 (30) hide show
  1. package/dist/{chunk-27VHBFUP.js → chunk-2SOHHB2O.js} +4 -4
  2. package/dist/{chunk-NZTLBAML.js → chunk-74OZGLIT.js} +1 -1
  3. package/dist/{chunk-BOBND3QV.js → chunk-76YORWFJ.js} +3 -3
  4. package/dist/{chunk-D4IJQ3TK.js → chunk-7S4ZLFVI.js} +0 -73
  5. package/dist/{chunk-UIPGGNRC.js → chunk-ERT77HKY.js} +1 -1
  6. package/dist/{chunk-W5J3PEQ6.js → chunk-FMKBCO2Q.js} +2 -2
  7. package/dist/{chunk-2GWOFP24.js → chunk-FUGWPKXN.js} +1 -1
  8. package/dist/{chunk-AZEGOADG.js → chunk-I3RRMAAD.js} +3 -3
  9. package/dist/chunk-QEDVPJKP.js +203 -0
  10. package/dist/{chunk-4FK45WJI.js → chunk-SMQDT7CT.js} +2 -2
  11. package/dist/chunk-TA73FIZU.js +75 -0
  12. package/dist/{chunk-LLL3KYEM.js → chunk-UQCQ2JCG.js} +5 -3
  13. package/dist/{chunk-TLT6F35V.js → chunk-YJ3RGKPU.js} +1 -1
  14. package/dist/{chunk-P3FDT7G5.js → chunk-Z4IDXMSP.js} +0 -200
  15. package/dist/cli/index.js +106 -29
  16. package/dist/{conduct-4NPMP4GL.js → conduct-UAEEMVFD.js} +7 -6
  17. package/dist/{conduct-5FTKINWU.js → conduct-URYWMA5T.js} +7 -6
  18. package/dist/{conductor-mode-ZWC5BZUL.js → conductor-mode-2UFN6BUL.js} +6 -5
  19. package/dist/credits-action-24EPLUHG.js +148 -0
  20. package/dist/daemon-A7DXZIQW.js +188 -0
  21. package/dist/{execute-JTPFFEH6.js → execute-2Z3XIUHR.js} +6 -5
  22. package/dist/{openclaw-setup-HVEVSKXQ.js → openclaw-setup-WA625DZA.js} +9 -8
  23. package/dist/{openclaw-skills-QLC4D6DZ.js → openclaw-skills-76ZWXHFM.js} +53 -36
  24. package/dist/{request-WX3VLXBT.js → request-KPKWBL5W.js} +5 -4
  25. package/dist/{serve-skill-C7JU24CF.js → serve-skill-QSUIK3ZF.js} +6 -5
  26. package/dist/{server-Z6P3AHKN.js → server-TGV2OPUM.js} +10 -8
  27. package/dist/{service-coordinator-PLUPMPSC.js → service-coordinator-4JAUUNUL.js} +32 -12
  28. package/dist/skills/agentbnb/bootstrap.js +16 -0
  29. package/package.json +1 -1
  30. package/skills/agentbnb/SKILL.md +46 -1
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  DEFAULT_BUDGET_CONFIG
3
- } from "./chunk-TLT6F35V.js";
3
+ } from "./chunk-YJ3RGKPU.js";
4
4
  import {
5
5
  KNOWN_API_KEYS,
6
6
  buildDraftCard,
7
7
  detectApiKeys,
8
8
  detectOpenPorts
9
- } from "./chunk-2GWOFP24.js";
9
+ } from "./chunk-FUGWPKXN.js";
10
10
  import {
11
11
  DEFAULT_AUTONOMY_CONFIG
12
12
  } from "./chunk-G5WKW3ED.js";
13
13
  import {
14
14
  createLedger
15
- } from "./chunk-NZTLBAML.js";
15
+ } from "./chunk-74OZGLIT.js";
16
16
  import {
17
17
  loadOrRepairIdentity
18
18
  } from "./chunk-5CC6O6SO.js";
@@ -21,7 +21,7 @@ import {
21
21
  getBalance,
22
22
  migrateOwner,
23
23
  openCreditDb
24
- } from "./chunk-P3FDT7G5.js";
24
+ } from "./chunk-Z4IDXMSP.js";
25
25
  import {
26
26
  getConfigDir,
27
27
  loadConfig,
@@ -10,7 +10,7 @@ import {
10
10
  openCreditDb,
11
11
  releaseEscrow,
12
12
  settleEscrow
13
- } from "./chunk-P3FDT7G5.js";
13
+ } from "./chunk-Z4IDXMSP.js";
14
14
  import {
15
15
  signEscrowReceipt,
16
16
  verifyEscrowReceipt
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  syncCreditsFromRegistry
3
- } from "./chunk-W5J3PEQ6.js";
3
+ } from "./chunk-FMKBCO2Q.js";
4
4
  import {
5
5
  resolveTargetCapability
6
- } from "./chunk-UIPGGNRC.js";
6
+ } from "./chunk-ERT77HKY.js";
7
7
  import {
8
8
  getBalance,
9
9
  holdEscrow,
10
10
  releaseEscrow,
11
11
  settleEscrow
12
- } from "./chunk-P3FDT7G5.js";
12
+ } from "./chunk-Z4IDXMSP.js";
13
13
  import {
14
14
  loadConfig
15
15
  } from "./chunk-3XPBFF6H.js";
@@ -2,76 +2,6 @@ import {
2
2
  AgentBnBError
3
3
  } from "./chunk-UVCNMRPS.js";
4
4
 
5
- // src/discovery/mdns.ts
6
- import { Bonjour } from "bonjour-service";
7
- var bonjourInstance = null;
8
- function getBonjour() {
9
- if (bonjourInstance === null) {
10
- bonjourInstance = new Bonjour();
11
- }
12
- return bonjourInstance;
13
- }
14
- function announceGateway(owner, port, metadata) {
15
- const bonjour = getBonjour();
16
- const txt = {
17
- owner,
18
- version: "1.0",
19
- ...metadata
20
- };
21
- bonjour.publish({
22
- name: owner,
23
- type: "agentbnb",
24
- port,
25
- txt
26
- });
27
- }
28
- function discoverLocalAgents(onFound, onDown) {
29
- const bonjour = getBonjour();
30
- const browser = bonjour.find({ type: "agentbnb" });
31
- browser.on("up", (service) => {
32
- const addresses = service.addresses ?? [];
33
- const ipv4Addresses = addresses.filter((addr) => !addr.includes(":"));
34
- const host = ipv4Addresses.length > 0 ? ipv4Addresses[0] : service.host;
35
- const url = `http://${host}:${service.port}`;
36
- const owner = service.txt?.owner ?? service.name;
37
- onFound({
38
- name: service.name,
39
- url,
40
- owner
41
- });
42
- });
43
- if (onDown) {
44
- browser.on("down", (service) => {
45
- const addresses = service.addresses ?? [];
46
- const ipv4Addresses = addresses.filter((addr) => !addr.includes(":"));
47
- const host = ipv4Addresses.length > 0 ? ipv4Addresses[0] : service.host;
48
- const url = `http://${host}:${service.port}`;
49
- const owner = service.txt?.owner ?? service.name;
50
- onDown({
51
- name: service.name,
52
- url,
53
- owner
54
- });
55
- });
56
- }
57
- return {
58
- stop: () => browser.stop()
59
- };
60
- }
61
- async function stopAnnouncement() {
62
- if (bonjourInstance === null) {
63
- return;
64
- }
65
- const instance = bonjourInstance;
66
- bonjourInstance = null;
67
- await new Promise((resolve2) => {
68
- instance.unpublishAll(() => {
69
- instance.destroy();
70
- resolve2();
71
- });
72
- });
73
- }
74
-
75
5
  // src/runtime/resolve-self-cli.ts
76
6
  import { execFileSync } from "child_process";
77
7
  import { existsSync, realpathSync } from "fs";
@@ -207,8 +137,5 @@ function extractErrorMessage(err) {
207
137
  }
208
138
 
209
139
  export {
210
- announceGateway,
211
- discoverLocalAgents,
212
- stopAnnouncement,
213
140
  resolveSelfCli
214
141
  };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-ELFGYC22.js";
4
4
  import {
5
5
  searchCards
6
- } from "./chunk-P3FDT7G5.js";
6
+ } from "./chunk-QEDVPJKP.js";
7
7
  import {
8
8
  getCard
9
9
  } from "./chunk-NLQCHO7N.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createLedger
3
- } from "./chunk-NZTLBAML.js";
3
+ } from "./chunk-74OZGLIT.js";
4
4
  import {
5
5
  loadOrRepairIdentity
6
6
  } from "./chunk-5CC6O6SO.js";
7
7
  import {
8
8
  getBalance
9
- } from "./chunk-P3FDT7G5.js";
9
+ } from "./chunk-Z4IDXMSP.js";
10
10
  import {
11
11
  canonicalizeCreditOwner
12
12
  } from "./chunk-YDGXKH2T.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  searchCards
3
- } from "./chunk-P3FDT7G5.js";
3
+ } from "./chunk-QEDVPJKP.js";
4
4
 
5
5
  // src/registry/pricing.ts
6
6
  function getPricingStats(db, query) {
@@ -4,13 +4,13 @@ import {
4
4
  decompose,
5
5
  matchSubTasks,
6
6
  orchestrate
7
- } from "./chunk-4FK45WJI.js";
7
+ } from "./chunk-SMQDT7CT.js";
8
8
  import {
9
9
  BudgetManager
10
- } from "./chunk-TLT6F35V.js";
10
+ } from "./chunk-YJ3RGKPU.js";
11
11
  import {
12
12
  openCreditDb
13
- } from "./chunk-P3FDT7G5.js";
13
+ } from "./chunk-Z4IDXMSP.js";
14
14
  import {
15
15
  RelayClient
16
16
  } from "./chunk-UR3MISL2.js";
@@ -0,0 +1,203 @@
1
+ import {
2
+ getFeedbackForProvider
3
+ } from "./chunk-NLQCHO7N.js";
4
+
5
+ // src/feedback/reputation.ts
6
+ var QUALITY_SCORES = {
7
+ excellent: 1,
8
+ good: 0.8,
9
+ acceptable: 0.6,
10
+ poor: 0.3,
11
+ failed: 0
12
+ };
13
+ var COST_VALUE_SCORES = {
14
+ great: 1,
15
+ fair: 0.6,
16
+ overpriced: 0.2
17
+ };
18
+ var DECAY_DAYS = 30;
19
+ var WEIGHTS = {
20
+ rating: 0.4,
21
+ quality: 0.3,
22
+ would_reuse: 0.2,
23
+ cost_value: 0.1
24
+ };
25
+ function computeReputation(feedbacks) {
26
+ if (feedbacks.length === 0) return 0.5;
27
+ const now = Date.now();
28
+ let weightedSum = 0;
29
+ let totalWeight = 0;
30
+ for (const fb of feedbacks) {
31
+ const feedbackDate = new Date(fb.timestamp).getTime();
32
+ const ageDays = Math.max(0, (now - feedbackDate) / (1e3 * 60 * 60 * 24));
33
+ const recencyWeight = Math.exp(-ageDays / DECAY_DAYS);
34
+ const ratingScore = (fb.rating - 1) / 4;
35
+ const qualityScore = QUALITY_SCORES[fb.result_quality];
36
+ const reuseScore = fb.would_reuse ? 1 : 0;
37
+ const costScore = COST_VALUE_SCORES[fb.cost_value_ratio];
38
+ const componentScore = WEIGHTS.rating * ratingScore + WEIGHTS.quality * qualityScore + WEIGHTS.would_reuse * reuseScore + WEIGHTS.cost_value * costScore;
39
+ weightedSum += recencyWeight * componentScore;
40
+ totalWeight += recencyWeight;
41
+ }
42
+ if (totalWeight === 0) return 0.5;
43
+ const raw = weightedSum / totalWeight;
44
+ return Math.max(0, Math.min(1, raw));
45
+ }
46
+ function getReputationScore(db, agentId) {
47
+ const feedbacks = getFeedbackForProvider(db, agentId);
48
+ return computeReputation(feedbacks);
49
+ }
50
+
51
+ // src/registry/matcher.ts
52
+ var CACHE_MAX_ENTRIES = 100;
53
+ var CACHE_TTL_MS = 3e4;
54
+ var dbCaches = /* @__PURE__ */ new WeakMap();
55
+ function getDbCache(db) {
56
+ let cache = dbCaches.get(db);
57
+ if (!cache) {
58
+ cache = /* @__PURE__ */ new Map();
59
+ dbCaches.set(db, cache);
60
+ }
61
+ return cache;
62
+ }
63
+ function cacheKey(query, filters) {
64
+ return `${query}|${filters.level ?? ""}|${filters.online ?? ""}|${(filters.apis_used ?? []).join(",")}|${filters.min_reputation ?? ""}`;
65
+ }
66
+ function evictCache(cache) {
67
+ const now = Date.now();
68
+ for (const [key, entry] of cache) {
69
+ if (entry.expiresAt <= now) cache.delete(key);
70
+ }
71
+ while (cache.size > CACHE_MAX_ENTRIES) {
72
+ const firstKey = cache.keys().next().value;
73
+ cache.delete(firstKey);
74
+ }
75
+ }
76
+ function searchCards(db, query, filters = {}) {
77
+ const cache = getDbCache(db);
78
+ const key = cacheKey(query, filters);
79
+ const cached = cache.get(key);
80
+ if (cached && cached.expiresAt > Date.now()) {
81
+ return cached.results;
82
+ }
83
+ const trimmedQuery = query.trim();
84
+ const exactSkillMatches = findCardsByExactSkillId(db, trimmedQuery, filters);
85
+ const words = query.trim().split(/\s+/).map((w) => w.replace(/["*^{}():]/g, "")).filter((w) => w.length > 0);
86
+ if (words.length === 0) {
87
+ return exactSkillMatches;
88
+ }
89
+ const ftsQuery = words.map((w) => `"${w}"`).join(" OR ");
90
+ const conditions = [];
91
+ const params = [ftsQuery];
92
+ if (filters.level !== void 0) {
93
+ conditions.push(`json_extract(cc.data, '$.level') = ?`);
94
+ params.push(filters.level);
95
+ }
96
+ if (filters.online !== void 0) {
97
+ conditions.push(`json_extract(cc.data, '$.availability.online') = ?`);
98
+ params.push(filters.online ? 1 : 0);
99
+ }
100
+ const whereClause = conditions.length > 0 ? `AND ${conditions.join(" AND ")}` : "";
101
+ const sql = `
102
+ SELECT cc.data
103
+ FROM capability_cards cc
104
+ JOIN cards_fts ON cc.rowid = cards_fts.rowid
105
+ WHERE cards_fts MATCH ?
106
+ ${whereClause}
107
+ ORDER BY bm25(cards_fts)
108
+ LIMIT 50
109
+ `;
110
+ const stmt = db.prepare(sql);
111
+ const rows = stmt.all(...params);
112
+ const results = rows.map((row) => JSON.parse(row.data));
113
+ const mergedResults = mergeByCardId(exactSkillMatches, results);
114
+ let filtered = mergedResults;
115
+ if (filters.apis_used && filters.apis_used.length > 0) {
116
+ const requiredApis = filters.apis_used;
117
+ filtered = filtered.filter((card) => {
118
+ const cardApis = card.metadata?.apis_used ?? [];
119
+ return requiredApis.every((api) => cardApis.includes(api));
120
+ });
121
+ }
122
+ if (filters.min_reputation !== void 0 && filters.min_reputation > 0) {
123
+ filtered = applyReputationFilter(db, filtered, filters.min_reputation);
124
+ }
125
+ evictCache(cache);
126
+ cache.set(key, { results: filtered, expiresAt: Date.now() + CACHE_TTL_MS });
127
+ return filtered;
128
+ }
129
+ function mergeByCardId(primary, secondary) {
130
+ const seen = /* @__PURE__ */ new Set();
131
+ const merged = [];
132
+ for (const card of primary) {
133
+ if (seen.has(card.id)) continue;
134
+ seen.add(card.id);
135
+ merged.push(card);
136
+ }
137
+ for (const card of secondary) {
138
+ if (seen.has(card.id)) continue;
139
+ seen.add(card.id);
140
+ merged.push(card);
141
+ }
142
+ return merged;
143
+ }
144
+ function findCardsByExactSkillId(db, query, filters) {
145
+ if (query.length === 0) return [];
146
+ const rows = db.prepare("SELECT data FROM capability_cards").all();
147
+ const cards = rows.map((row) => JSON.parse(row.data));
148
+ return cards.filter((card) => {
149
+ if (filters.level !== void 0 && card.level !== filters.level) return false;
150
+ if (filters.online !== void 0 && card.availability?.online !== filters.online) return false;
151
+ const asRecord = card;
152
+ const skills = asRecord["skills"];
153
+ if (!Array.isArray(skills)) return false;
154
+ return skills.some((skill) => String(skill["id"] ?? "") === query);
155
+ });
156
+ }
157
+ function filterCards(db, filters) {
158
+ const conditions = [];
159
+ const params = [];
160
+ if (filters.level !== void 0) {
161
+ conditions.push(`json_extract(data, '$.level') = ?`);
162
+ params.push(filters.level);
163
+ }
164
+ if (filters.online !== void 0) {
165
+ conditions.push(`json_extract(data, '$.availability.online') = ?`);
166
+ params.push(filters.online ? 1 : 0);
167
+ }
168
+ const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
169
+ const sql = `SELECT data FROM capability_cards ${whereClause}`;
170
+ const stmt = db.prepare(sql);
171
+ const rows = stmt.all(...params);
172
+ let cards = rows.map((row) => JSON.parse(row.data));
173
+ if (filters.min_reputation !== void 0 && filters.min_reputation > 0) {
174
+ cards = applyReputationFilter(db, cards, filters.min_reputation);
175
+ }
176
+ return cards;
177
+ }
178
+ function applyReputationFilter(db, cards, minReputation) {
179
+ const owners = [...new Set(cards.map((c) => c.owner))];
180
+ const reputationMap = /* @__PURE__ */ new Map();
181
+ for (const owner of owners) {
182
+ reputationMap.set(owner, getReputationScore(db, owner));
183
+ }
184
+ return cards.filter((card) => {
185
+ const score = reputationMap.get(card.owner) ?? 0.5;
186
+ return score >= minReputation;
187
+ });
188
+ }
189
+ function buildReputationMap(db, owners) {
190
+ const unique = [...new Set(owners)];
191
+ const map = /* @__PURE__ */ new Map();
192
+ for (const owner of unique) {
193
+ map.set(owner, getReputationScore(db, owner));
194
+ }
195
+ return map;
196
+ }
197
+
198
+ export {
199
+ computeReputation,
200
+ searchCards,
201
+ filterCards,
202
+ buildReputationMap
203
+ };
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-3MJT4PZG.js";
4
4
  import {
5
5
  scorePeers
6
- } from "./chunk-LLL3KYEM.js";
6
+ } from "./chunk-UQCQ2JCG.js";
7
7
  import {
8
8
  fetchRemoteCards
9
9
  } from "./chunk-ELFGYC22.js";
10
10
  import {
11
11
  searchCards
12
- } from "./chunk-P3FDT7G5.js";
12
+ } from "./chunk-QEDVPJKP.js";
13
13
  import {
14
14
  requestCapability,
15
15
  requestCapabilityBatch
@@ -0,0 +1,75 @@
1
+ // src/discovery/mdns.ts
2
+ import { Bonjour } from "bonjour-service";
3
+ var bonjourInstance = null;
4
+ function getBonjour() {
5
+ if (bonjourInstance === null) {
6
+ bonjourInstance = new Bonjour();
7
+ }
8
+ return bonjourInstance;
9
+ }
10
+ function announceGateway(owner, port, metadata) {
11
+ const bonjour = getBonjour();
12
+ const txt = {
13
+ owner,
14
+ version: "1.0",
15
+ ...metadata
16
+ };
17
+ bonjour.publish({
18
+ name: owner,
19
+ type: "agentbnb",
20
+ port,
21
+ txt
22
+ });
23
+ }
24
+ function discoverLocalAgents(onFound, onDown) {
25
+ const bonjour = getBonjour();
26
+ const browser = bonjour.find({ type: "agentbnb" });
27
+ browser.on("up", (service) => {
28
+ const addresses = service.addresses ?? [];
29
+ const ipv4Addresses = addresses.filter((addr) => !addr.includes(":"));
30
+ const host = ipv4Addresses.length > 0 ? ipv4Addresses[0] : service.host;
31
+ const url = `http://${host}:${service.port}`;
32
+ const owner = service.txt?.owner ?? service.name;
33
+ onFound({
34
+ name: service.name,
35
+ url,
36
+ owner
37
+ });
38
+ });
39
+ if (onDown) {
40
+ browser.on("down", (service) => {
41
+ const addresses = service.addresses ?? [];
42
+ const ipv4Addresses = addresses.filter((addr) => !addr.includes(":"));
43
+ const host = ipv4Addresses.length > 0 ? ipv4Addresses[0] : service.host;
44
+ const url = `http://${host}:${service.port}`;
45
+ const owner = service.txt?.owner ?? service.name;
46
+ onDown({
47
+ name: service.name,
48
+ url,
49
+ owner
50
+ });
51
+ });
52
+ }
53
+ return {
54
+ stop: () => browser.stop()
55
+ };
56
+ }
57
+ async function stopAnnouncement() {
58
+ if (bonjourInstance === null) {
59
+ return;
60
+ }
61
+ const instance = bonjourInstance;
62
+ bonjourInstance = null;
63
+ await new Promise((resolve) => {
64
+ instance.unpublishAll(() => {
65
+ instance.destroy();
66
+ resolve();
67
+ });
68
+ });
69
+ }
70
+
71
+ export {
72
+ announceGateway,
73
+ discoverLocalAgents,
74
+ stopAnnouncement
75
+ };
@@ -7,16 +7,18 @@ import {
7
7
  } from "./chunk-G5WKW3ED.js";
8
8
  import {
9
9
  resolveTargetCapability
10
- } from "./chunk-UIPGGNRC.js";
10
+ } from "./chunk-ERT77HKY.js";
11
11
  import {
12
12
  fetchRemoteCards
13
13
  } from "./chunk-ELFGYC22.js";
14
+ import {
15
+ searchCards
16
+ } from "./chunk-QEDVPJKP.js";
14
17
  import {
15
18
  holdEscrow,
16
19
  releaseEscrow,
17
- searchCards,
18
20
  settleEscrow
19
- } from "./chunk-P3FDT7G5.js";
21
+ } from "./chunk-Z4IDXMSP.js";
20
22
  import {
21
23
  RelayClient
22
24
  } from "./chunk-UR3MISL2.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getBalance
3
- } from "./chunk-P3FDT7G5.js";
3
+ } from "./chunk-Z4IDXMSP.js";
4
4
 
5
5
  // src/credit/budget.ts
6
6
  var DEFAULT_BUDGET_CONFIG = {