agentbnb 8.3.2 → 8.4.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.
- package/dist/{card-T2XJZA5A.js → card-HYTD2BJQ.js} +1 -1
- package/dist/{chunk-S7DZHKCG.js → chunk-2PP5MQPD.js} +5 -3
- package/dist/{chunk-75OC6E4F.js → chunk-3XPBFF6H.js} +1 -0
- package/dist/{chunk-5AH3CMOX.js → chunk-3YQ73ZM6.js} +1 -1
- package/dist/{chunk-FELGHDCA.js → chunk-6FZ4WYQL.js} +38 -4
- package/dist/{chunk-D242QZCR.js → chunk-6XCN62YU.js} +10 -54
- package/dist/chunk-AZKVGC5T.js +53 -0
- package/dist/{chunk-NHVHLUYS.js → chunk-CFHCG5FE.js} +6 -217
- package/dist/{chunk-5AIYALBX.js → chunk-COA2D7QM.js} +4 -3
- package/dist/chunk-G5WKW3ED.js +41 -0
- package/dist/{chunk-F3KIEVJ2.js → chunk-HU46M4JA.js} +2 -87
- package/dist/{chunk-77KGEDH4.js → chunk-MZSVVG55.js} +2 -41
- package/dist/chunk-PCQEHIGF.js +750 -0
- package/dist/chunk-PIPCGRCR.js +91 -0
- package/dist/{chunk-QFPXZITP.js → chunk-PMRTQ2RL.js} +34 -0
- package/dist/{chunk-7IQE34QK.js → chunk-UF6R2RVN.js} +5 -3
- package/dist/{chunk-IGQNP3ZO.js → chunk-VAAEBCMU.js} +1 -1
- package/dist/chunk-VRPLSK34.js +214 -0
- package/dist/{chunk-BARHNIKG.js → chunk-WK2QSO4E.js} +1 -1
- package/dist/chunk-WPB5LFGI.js +132 -0
- package/dist/chunk-XGOA5J2K.js +173 -0
- package/dist/{chunk-VJ7XBEY6.js → chunk-Z5726VPY.js} +6 -6
- package/dist/cli/index.js +118 -789
- package/dist/conduct-FZPUMPCI.js +25 -0
- package/dist/{conduct-VYYBCPHA.js → conduct-J2NXU6RM.js} +12 -9
- package/dist/{conductor-mode-SBDCRIX6.js → conductor-mode-HNNMWZIH.js} +11 -8
- package/dist/config-IRWLG6IW.js +12 -0
- package/dist/{execute-FZLQGIXB.js → execute-UAD5T3BQ.js} +1 -1
- package/dist/{execute-TEZPQ5WP.js → execute-UP46R7KS.js} +6 -5
- package/dist/index.js +34 -0
- package/dist/openclaw-setup-KA72IIEW.js +296 -0
- package/dist/openclaw-skills-CT673RBL.js +370 -0
- package/dist/{peers-K7FSHPN3.js → peers-F2EWUMVQ.js} +2 -2
- package/dist/{publish-capability-HVYILTPR.js → publish-capability-GNH5FHKG.js} +2 -2
- package/dist/{request-KJNKR27T.js → request-IM3ZLAOA.js} +13 -9
- package/dist/scanner-F5VNV5FP.js +8 -0
- package/dist/{serve-skill-GC6NIQ5T.js → serve-skill-6RKMVDMK.js} +6 -5
- package/dist/{server-6I7GU2OZ.js → server-MH7FTZFN.js} +11 -9
- package/dist/{service-coordinator-LZJCAQSJ.js → service-coordinator-R5LZVM6A.js} +31 -26
- package/dist/skills/agentbnb/bootstrap.js +34 -2
- package/dist/store-4Z446745.js +32 -0
- package/dist/writer-4QJ3U3WE.js +16 -0
- package/package.json +1 -1
- package/skills/agentbnb/bootstrap.ts +45 -2
- package/dist/conduct-4JDMWBQD.js +0 -22
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
conductAction
|
|
3
|
+
} from "./chunk-Z5726VPY.js";
|
|
4
|
+
import "./chunk-UF6R2RVN.js";
|
|
5
|
+
import "./chunk-3MJT4PZG.js";
|
|
6
|
+
import "./chunk-6XCN62YU.js";
|
|
7
|
+
import "./chunk-AZKVGC5T.js";
|
|
8
|
+
import "./chunk-MZSVVG55.js";
|
|
9
|
+
import "./chunk-G5WKW3ED.js";
|
|
10
|
+
import "./chunk-2PP5MQPD.js";
|
|
11
|
+
import "./chunk-PIPCGRCR.js";
|
|
12
|
+
import "./chunk-HU46M4JA.js";
|
|
13
|
+
import "./chunk-NX27AFPA.js";
|
|
14
|
+
import "./chunk-PQIP7EXY.js";
|
|
15
|
+
import "./chunk-YKMBFQC2.js";
|
|
16
|
+
import "./chunk-GIEJVKZZ.js";
|
|
17
|
+
import "./chunk-U6LP4KWN.js";
|
|
18
|
+
import "./chunk-3YQ73ZM6.js";
|
|
19
|
+
import "./chunk-3XPBFF6H.js";
|
|
20
|
+
import "./chunk-COA2D7QM.js";
|
|
21
|
+
import "./chunk-WTHMHNKC.js";
|
|
22
|
+
import "./chunk-I7KWA7OB.js";
|
|
23
|
+
export {
|
|
24
|
+
conductAction
|
|
25
|
+
};
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
conductAction
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-Z5726VPY.js";
|
|
4
|
+
import "./chunk-UF6R2RVN.js";
|
|
5
5
|
import "./chunk-3MJT4PZG.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-6XCN62YU.js";
|
|
7
|
+
import "./chunk-AZKVGC5T.js";
|
|
8
|
+
import "./chunk-MZSVVG55.js";
|
|
9
|
+
import "./chunk-G5WKW3ED.js";
|
|
10
|
+
import "./chunk-2PP5MQPD.js";
|
|
11
|
+
import "./chunk-PIPCGRCR.js";
|
|
12
|
+
import "./chunk-HU46M4JA.js";
|
|
10
13
|
import "./chunk-NX27AFPA.js";
|
|
11
14
|
import "./chunk-PQIP7EXY.js";
|
|
12
15
|
import "./chunk-YKMBFQC2.js";
|
|
13
16
|
import "./chunk-GIEJVKZZ.js";
|
|
14
17
|
import "./chunk-U6LP4KWN.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-3YQ73ZM6.js";
|
|
19
|
+
import "./chunk-3XPBFF6H.js";
|
|
20
|
+
import "./chunk-COA2D7QM.js";
|
|
18
21
|
import "./chunk-WTHMHNKC.js";
|
|
19
22
|
import "./chunk-I7KWA7OB.js";
|
|
20
23
|
|
|
@@ -4,14 +4,17 @@ import {
|
|
|
4
4
|
matchSubTasks,
|
|
5
5
|
orchestrate,
|
|
6
6
|
validateAndNormalizeSubtasks
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-UF6R2RVN.js";
|
|
8
8
|
import "./chunk-3MJT4PZG.js";
|
|
9
|
+
import "./chunk-6XCN62YU.js";
|
|
9
10
|
import {
|
|
10
11
|
BudgetManager
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-AZKVGC5T.js";
|
|
13
|
+
import "./chunk-MZSVVG55.js";
|
|
14
|
+
import "./chunk-G5WKW3ED.js";
|
|
15
|
+
import "./chunk-2PP5MQPD.js";
|
|
16
|
+
import "./chunk-PIPCGRCR.js";
|
|
17
|
+
import "./chunk-HU46M4JA.js";
|
|
15
18
|
import "./chunk-NX27AFPA.js";
|
|
16
19
|
import "./chunk-PQIP7EXY.js";
|
|
17
20
|
import {
|
|
@@ -19,12 +22,12 @@ import {
|
|
|
19
22
|
} from "./chunk-YKMBFQC2.js";
|
|
20
23
|
import "./chunk-GIEJVKZZ.js";
|
|
21
24
|
import "./chunk-U6LP4KWN.js";
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-3YQ73ZM6.js";
|
|
26
|
+
import "./chunk-3XPBFF6H.js";
|
|
24
27
|
import {
|
|
25
28
|
getCardsByCapabilityType,
|
|
26
29
|
getCardsBySkillCapability
|
|
27
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-COA2D7QM.js";
|
|
28
31
|
import "./chunk-WTHMHNKC.js";
|
|
29
32
|
import "./chunk-I7KWA7OB.js";
|
|
30
33
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executeCapabilityBatch,
|
|
3
3
|
executeCapabilityRequest
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-6FZ4WYQL.js";
|
|
5
|
+
import "./chunk-2PP5MQPD.js";
|
|
6
|
+
import "./chunk-PIPCGRCR.js";
|
|
7
|
+
import "./chunk-HU46M4JA.js";
|
|
7
8
|
import "./chunk-U6LP4KWN.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-3XPBFF6H.js";
|
|
10
|
+
import "./chunk-COA2D7QM.js";
|
|
10
11
|
import "./chunk-WTHMHNKC.js";
|
|
11
12
|
import "./chunk-I7KWA7OB.js";
|
|
12
13
|
export {
|
package/dist/index.js
CHANGED
|
@@ -1614,6 +1614,29 @@ async function notifyTelegramSkillExecuted(opts) {
|
|
|
1614
1614
|
body: JSON.stringify({ chat_id: chatId, text })
|
|
1615
1615
|
});
|
|
1616
1616
|
}
|
|
1617
|
+
async function notifyTelegramSkillFailed(opts) {
|
|
1618
|
+
const cfg = loadConfig();
|
|
1619
|
+
if (!cfg?.telegram_notifications) return;
|
|
1620
|
+
const token = cfg.telegram_bot_token ?? process.env["TELEGRAM_BOT_TOKEN"];
|
|
1621
|
+
const chatId = cfg.telegram_chat_id ?? process.env["TELEGRAM_CHAT_ID"];
|
|
1622
|
+
if (!token || !chatId) return;
|
|
1623
|
+
const balance = getBalance(opts.creditDb, opts.owner);
|
|
1624
|
+
const skillLabel = opts.skillId ? `${opts.skillName} (${opts.skillId})` : opts.skillName;
|
|
1625
|
+
const text = [
|
|
1626
|
+
"[AgentBnB] Skill failed",
|
|
1627
|
+
`Skill: ${skillLabel}`,
|
|
1628
|
+
`Requester: ${opts.requester}`,
|
|
1629
|
+
`Reason: ${opts.failureReason}`,
|
|
1630
|
+
`Error: ${opts.message}`,
|
|
1631
|
+
`Balance: ${balance} credits`,
|
|
1632
|
+
`Latency: ${opts.latencyMs}ms`
|
|
1633
|
+
].join("\n");
|
|
1634
|
+
await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
|
|
1635
|
+
method: "POST",
|
|
1636
|
+
headers: { "Content-Type": "application/json" },
|
|
1637
|
+
body: JSON.stringify({ chat_id: chatId, text })
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1617
1640
|
async function executeCapabilityRequest(opts) {
|
|
1618
1641
|
const {
|
|
1619
1642
|
registryDb,
|
|
@@ -1714,6 +1737,17 @@ async function executeCapabilityRequest(opts) {
|
|
|
1714
1737
|
});
|
|
1715
1738
|
} catch {
|
|
1716
1739
|
}
|
|
1740
|
+
notifyTelegramSkillFailed({
|
|
1741
|
+
creditDb,
|
|
1742
|
+
owner: card.owner,
|
|
1743
|
+
skillName: cardName,
|
|
1744
|
+
skillId: resolvedSkillId ?? null,
|
|
1745
|
+
requester,
|
|
1746
|
+
latencyMs,
|
|
1747
|
+
failureReason,
|
|
1748
|
+
message
|
|
1749
|
+
}).catch(() => {
|
|
1750
|
+
});
|
|
1717
1751
|
return { success: false, error: { code: -32603, message } };
|
|
1718
1752
|
};
|
|
1719
1753
|
const handleSuccess = (result, latencyMs) => {
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import {
|
|
2
|
+
appendHeartbeatTradingSection,
|
|
3
|
+
appendSoulMdTradingSection
|
|
4
|
+
} from "./chunk-WPB5LFGI.js";
|
|
5
|
+
import {
|
|
6
|
+
scanAgents
|
|
7
|
+
} from "./chunk-XGOA5J2K.js";
|
|
8
|
+
import {
|
|
9
|
+
performInit,
|
|
10
|
+
publishFromSoulV2
|
|
11
|
+
} from "./chunk-PCQEHIGF.js";
|
|
12
|
+
import "./chunk-AZKVGC5T.js";
|
|
13
|
+
import {
|
|
14
|
+
getPricingStats
|
|
15
|
+
} from "./chunk-CFHCG5FE.js";
|
|
16
|
+
import "./chunk-WK2QSO4E.js";
|
|
17
|
+
import "./chunk-G5WKW3ED.js";
|
|
18
|
+
import "./chunk-HU46M4JA.js";
|
|
19
|
+
import "./chunk-GIEJVKZZ.js";
|
|
20
|
+
import "./chunk-U6LP4KWN.js";
|
|
21
|
+
import "./chunk-3XPBFF6H.js";
|
|
22
|
+
import {
|
|
23
|
+
parseSoulMd
|
|
24
|
+
} from "./chunk-VAAEBCMU.js";
|
|
25
|
+
import "./chunk-COA2D7QM.js";
|
|
26
|
+
import "./chunk-WTHMHNKC.js";
|
|
27
|
+
import "./chunk-I7KWA7OB.js";
|
|
28
|
+
|
|
29
|
+
// src/cli/openclaw-setup.ts
|
|
30
|
+
import { createInterface } from "readline";
|
|
31
|
+
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
32
|
+
import { join as joinPath } from "path";
|
|
33
|
+
import { homedir } from "os";
|
|
34
|
+
|
|
35
|
+
// src/workspace/gep-init.ts
|
|
36
|
+
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
37
|
+
import { join } from "path";
|
|
38
|
+
function initGepDir(brainDir) {
|
|
39
|
+
const gepDir = join(brainDir, "gep");
|
|
40
|
+
if (existsSync(gepDir)) return;
|
|
41
|
+
mkdirSync(gepDir, { recursive: true });
|
|
42
|
+
writeFileSync(join(gepDir, "genes.json"), "[]\n", "utf-8");
|
|
43
|
+
writeFileSync(join(gepDir, "capsules.json"), "[]\n", "utf-8");
|
|
44
|
+
writeFileSync(join(gepDir, "events.jsonl"), "", "utf-8");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// src/cli/openclaw-setup.ts
|
|
48
|
+
function heuristicPrice(skillName) {
|
|
49
|
+
const lower = skillName.toLowerCase();
|
|
50
|
+
if (/voice|tts|elevenlabs/.test(lower)) return 4;
|
|
51
|
+
if (/crawl|browser|cf/.test(lower)) return 3;
|
|
52
|
+
if (/scrape|stealth/.test(lower)) return 5;
|
|
53
|
+
if (/search|kb|knowledge/.test(lower)) return 2;
|
|
54
|
+
return 3;
|
|
55
|
+
}
|
|
56
|
+
async function prompt(question) {
|
|
57
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
58
|
+
try {
|
|
59
|
+
return await new Promise((resolve) => {
|
|
60
|
+
rl.question(question, (answer) => resolve(answer.trim()));
|
|
61
|
+
});
|
|
62
|
+
} finally {
|
|
63
|
+
rl.close();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async function detectFreePort(start = 3100) {
|
|
67
|
+
const net = await import("net");
|
|
68
|
+
for (let port = start; port < start + 100; port++) {
|
|
69
|
+
const available = await new Promise((resolve) => {
|
|
70
|
+
const server = net.createServer();
|
|
71
|
+
server.once("error", () => resolve(false));
|
|
72
|
+
server.once("listening", () => {
|
|
73
|
+
server.close();
|
|
74
|
+
resolve(true);
|
|
75
|
+
});
|
|
76
|
+
server.listen(port);
|
|
77
|
+
});
|
|
78
|
+
if (available) return port;
|
|
79
|
+
}
|
|
80
|
+
return start;
|
|
81
|
+
}
|
|
82
|
+
async function runOpenClawSetup(opts) {
|
|
83
|
+
console.log("AgentBnB Setup for OpenClaw Agents\n");
|
|
84
|
+
if (!opts.yes) {
|
|
85
|
+
console.log("How do you want to get started?");
|
|
86
|
+
console.log(" 1. Connect an existing agent");
|
|
87
|
+
console.log(" 2. Create a new trading agent (coming soon)");
|
|
88
|
+
console.log("");
|
|
89
|
+
const modeInput = await prompt("Select mode (default: 1): ");
|
|
90
|
+
const mode = modeInput === "" ? "1" : modeInput;
|
|
91
|
+
if (mode === "2") {
|
|
92
|
+
console.log("\nCreating new trading agents from templates is coming in a future release.");
|
|
93
|
+
console.log("For now, use Option 1 to connect an existing OpenClaw agent.");
|
|
94
|
+
process.exit(0);
|
|
95
|
+
}
|
|
96
|
+
if (mode !== "1") {
|
|
97
|
+
console.error("Invalid selection.");
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const agentsDir = joinPath(homedir(), ".openclaw", "agents");
|
|
102
|
+
const brainsDir = joinPath(homedir(), ".openclaw", "workspace", "brains");
|
|
103
|
+
if (!existsSync2(agentsDir) && !existsSync2(brainsDir)) {
|
|
104
|
+
console.error(`Error: OpenClaw directory not found at ${agentsDir}`);
|
|
105
|
+
console.error("Install OpenClaw first: https://openclaw.dev");
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
let agentName;
|
|
109
|
+
let agentBrainDir = "";
|
|
110
|
+
if (opts.agent) {
|
|
111
|
+
agentName = opts.agent;
|
|
112
|
+
agentBrainDir = existsSync2(joinPath(brainsDir, agentName)) ? joinPath(brainsDir, agentName) : "";
|
|
113
|
+
} else {
|
|
114
|
+
console.log("Scanning for available agents...\n");
|
|
115
|
+
const detected = scanAgents();
|
|
116
|
+
if (detected.length === 0) {
|
|
117
|
+
console.error("No agents found in ~/.openclaw/workspace/brains/ or ~/.openclaw/agents/");
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
console.log("Available agents:");
|
|
121
|
+
const maxNameLen2 = Math.max(...detected.map((d) => d.name.length));
|
|
122
|
+
detected.forEach((d, i) => {
|
|
123
|
+
const desc = d.description ? d.description.slice(0, 50) : "(no description)";
|
|
124
|
+
const skills = d.skillCount > 0 ? `, ${d.skillCount} skills` : "";
|
|
125
|
+
const brainIndicator = d.brainDir ? " [brain]" : "";
|
|
126
|
+
console.log(
|
|
127
|
+
` ${i + 1}. ${d.name.padEnd(maxNameLen2 + 2)} \u2014 ${desc}${skills}${brainIndicator}`
|
|
128
|
+
);
|
|
129
|
+
});
|
|
130
|
+
console.log("");
|
|
131
|
+
const input = await prompt(`Select agent (default: 1): `);
|
|
132
|
+
const idx = input === "" ? 0 : parseInt(input, 10) - 1;
|
|
133
|
+
if (isNaN(idx) || idx < 0 || idx >= detected.length) {
|
|
134
|
+
console.error("Invalid selection.");
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
const selected = detected[idx];
|
|
138
|
+
agentName = selected.name;
|
|
139
|
+
agentBrainDir = selected.brainDir;
|
|
140
|
+
}
|
|
141
|
+
const agentDir = joinPath(agentsDir, agentName);
|
|
142
|
+
let soulPath;
|
|
143
|
+
if (opts.soulPath) {
|
|
144
|
+
soulPath = opts.soulPath;
|
|
145
|
+
} else if (agentBrainDir && existsSync2(joinPath(agentBrainDir, "SOUL.md"))) {
|
|
146
|
+
soulPath = joinPath(agentBrainDir, "SOUL.md");
|
|
147
|
+
} else if (existsSync2(joinPath(agentDir, "SOUL.md"))) {
|
|
148
|
+
soulPath = joinPath(agentDir, "SOUL.md");
|
|
149
|
+
} else {
|
|
150
|
+
console.error(`Error: SOUL.md not found for agent "${agentName}"`);
|
|
151
|
+
console.error(`Checked: ${agentBrainDir ? agentBrainDir + "/SOUL.md, " : ""}${agentDir}/SOUL.md`);
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
console.log(`
|
|
155
|
+
Reading ${agentName}/SOUL.md...`);
|
|
156
|
+
const soulContent = readFileSync(soulPath, "utf-8");
|
|
157
|
+
const parsed = parseSoulMd(soulContent);
|
|
158
|
+
if (parsed.capabilities.length === 0) {
|
|
159
|
+
console.error("No skills (H2 sections) found in SOUL.md.");
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
const agentbnbDir = joinPath(agentDir, ".agentbnb");
|
|
163
|
+
const alreadyInit = existsSync2(joinPath(agentbnbDir, "config.json"));
|
|
164
|
+
process.env["AGENTBNB_DIR"] = agentbnbDir;
|
|
165
|
+
const pricingMap = {};
|
|
166
|
+
if (alreadyInit) {
|
|
167
|
+
try {
|
|
168
|
+
const { loadConfig: loadConfig2 } = await import("./config-IRWLG6IW.js");
|
|
169
|
+
const cfg2 = loadConfig2();
|
|
170
|
+
if (cfg2) {
|
|
171
|
+
const db2 = (await import("./store-4Z446745.js")).openDatabase(cfg2.db_path);
|
|
172
|
+
try {
|
|
173
|
+
for (const cap of parsed.capabilities) {
|
|
174
|
+
const stats = getPricingStats(db2, cap.name);
|
|
175
|
+
pricingMap[cap.name] = stats.count > 0 ? stats.median : heuristicPrice(cap.name);
|
|
176
|
+
}
|
|
177
|
+
} finally {
|
|
178
|
+
db2.close();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
} catch {
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
for (const cap of parsed.capabilities) {
|
|
185
|
+
if (!(cap.name in pricingMap)) {
|
|
186
|
+
pricingMap[cap.name] = cap.pricing ?? heuristicPrice(cap.name);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
console.log("\nDetected skills:");
|
|
190
|
+
const maxNameLen = Math.max(...parsed.capabilities.map((c) => c.name.length));
|
|
191
|
+
for (const cap of parsed.capabilities) {
|
|
192
|
+
const price = pricingMap[cap.name];
|
|
193
|
+
const desc = cap.description.split("\n")[0]?.trim().slice(0, 40) ?? "";
|
|
194
|
+
console.log(` ${cap.name.padEnd(maxNameLen + 2)} \u2014 ${desc.padEnd(42)} (suggested: ${price} cr)`);
|
|
195
|
+
}
|
|
196
|
+
if (!opts.yes) {
|
|
197
|
+
const answer = await prompt(`
|
|
198
|
+
Share ${parsed.capabilities.length} skill(s) on the AgentBnB network? [Y/n]: `);
|
|
199
|
+
if (answer.toLowerCase() === "n") {
|
|
200
|
+
console.log("Setup cancelled.");
|
|
201
|
+
process.exit(0);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
console.log("\nInitializing...");
|
|
205
|
+
if (!alreadyInit) {
|
|
206
|
+
const freePort = await detectFreePort();
|
|
207
|
+
await performInit({
|
|
208
|
+
owner: agentName,
|
|
209
|
+
port: String(freePort),
|
|
210
|
+
yes: true,
|
|
211
|
+
nonInteractive: true,
|
|
212
|
+
detect: false
|
|
213
|
+
});
|
|
214
|
+
console.log(` \u2713 Created ${agentbnbDir}/config.json`);
|
|
215
|
+
} else {
|
|
216
|
+
console.log(` \u2713 ${agentbnbDir}/config.json already exists`);
|
|
217
|
+
}
|
|
218
|
+
const { loadConfig } = await import("./config-IRWLG6IW.js");
|
|
219
|
+
const cfg = loadConfig();
|
|
220
|
+
if (!cfg) {
|
|
221
|
+
console.error("Error: config not found after init.");
|
|
222
|
+
process.exit(1);
|
|
223
|
+
}
|
|
224
|
+
const db = (await import("./store-4Z446745.js")).openDatabase(cfg.db_path);
|
|
225
|
+
try {
|
|
226
|
+
const card = publishFromSoulV2(db, soulContent, cfg.owner, void 0);
|
|
227
|
+
console.log(` \u2713 Published capability card (${card.skills.length} skill(s))`);
|
|
228
|
+
} finally {
|
|
229
|
+
db.close();
|
|
230
|
+
}
|
|
231
|
+
const { existsSync: fsExists, writeFileSync: fsWrite } = await import("fs");
|
|
232
|
+
const skillsYamlPath = joinPath(agentbnbDir, "skills.yaml");
|
|
233
|
+
if (!fsExists(skillsYamlPath)) {
|
|
234
|
+
const yamlLines = ["# AgentBnB skills configuration \u2014 generated by `agentbnb openclaw setup`", ""];
|
|
235
|
+
for (const cap of parsed.capabilities) {
|
|
236
|
+
const price = pricingMap[cap.name];
|
|
237
|
+
yamlLines.push(
|
|
238
|
+
`- id: ${cap.name}`,
|
|
239
|
+
` name: ${cap.name}`,
|
|
240
|
+
` description: "${cap.description.split("\n")[0]?.trim() ?? ""}"`,
|
|
241
|
+
` pricing:`,
|
|
242
|
+
` credits_per_call: ${price}`,
|
|
243
|
+
` type: command`,
|
|
244
|
+
` command: "echo 'TODO: implement ${cap.name}'"`,
|
|
245
|
+
""
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
fsWrite(skillsYamlPath, yamlLines.join("\n"), "utf-8");
|
|
249
|
+
console.log(` \u2713 Generated ${skillsYamlPath}`);
|
|
250
|
+
}
|
|
251
|
+
const effectiveBrainDir = agentBrainDir || agentDir;
|
|
252
|
+
try {
|
|
253
|
+
initGepDir(effectiveBrainDir);
|
|
254
|
+
console.log(` \u2713 Initialized evolution assets (gep/)`);
|
|
255
|
+
} catch {
|
|
256
|
+
}
|
|
257
|
+
const skillEntries = parsed.capabilities.map((cap) => ({
|
|
258
|
+
id: cap.name,
|
|
259
|
+
name: cap.name,
|
|
260
|
+
description: cap.description,
|
|
261
|
+
pricing: { credits_per_call: pricingMap[cap.name] }
|
|
262
|
+
}));
|
|
263
|
+
try {
|
|
264
|
+
appendSoulMdTradingSection(soulPath, skillEntries, agentbnbDir);
|
|
265
|
+
const currentContent = readFileSync(soulPath, "utf-8");
|
|
266
|
+
if (currentContent.includes("## AgentBnB Network Trading")) {
|
|
267
|
+
console.log(` \u2713 AgentBnB trading section present in SOUL.md`);
|
|
268
|
+
}
|
|
269
|
+
} catch {
|
|
270
|
+
}
|
|
271
|
+
const heartbeatCandidates = [
|
|
272
|
+
agentBrainDir ? joinPath(agentBrainDir, "HEARTBEAT.md") : null,
|
|
273
|
+
joinPath(agentDir, "HEARTBEAT.md")
|
|
274
|
+
].filter(Boolean);
|
|
275
|
+
for (const hbPath of heartbeatCandidates) {
|
|
276
|
+
if (fsExists(hbPath)) {
|
|
277
|
+
try {
|
|
278
|
+
appendHeartbeatTradingSection(hbPath, agentbnbDir);
|
|
279
|
+
console.log(` \u2713 Updated HEARTBEAT.md`);
|
|
280
|
+
} catch {
|
|
281
|
+
}
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
console.log(`
|
|
286
|
+
${agentName} is now on the AgentBnB network!`);
|
|
287
|
+
console.log(`Run 'openclaw daemon restart' to start earning.`);
|
|
288
|
+
console.log(`
|
|
289
|
+
Useful commands:`);
|
|
290
|
+
console.log(` AGENTBNB_DIR=${agentbnbDir} agentbnb openclaw skills list`);
|
|
291
|
+
console.log(` AGENTBNB_DIR=${agentbnbDir} agentbnb openclaw skills stats`);
|
|
292
|
+
console.log(` AGENTBNB_DIR=${agentbnbDir} agentbnb status`);
|
|
293
|
+
}
|
|
294
|
+
export {
|
|
295
|
+
runOpenClawSetup
|
|
296
|
+
};
|