agentbnb 9.0.1 → 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.
- package/dist/{chunk-27VHBFUP.js → chunk-2SOHHB2O.js} +4 -4
- package/dist/{chunk-NZTLBAML.js → chunk-74OZGLIT.js} +1 -1
- package/dist/{chunk-BOBND3QV.js → chunk-76YORWFJ.js} +3 -3
- package/dist/{chunk-D4IJQ3TK.js → chunk-7S4ZLFVI.js} +0 -73
- package/dist/{chunk-UIPGGNRC.js → chunk-ERT77HKY.js} +1 -1
- package/dist/{chunk-W5J3PEQ6.js → chunk-FMKBCO2Q.js} +2 -2
- package/dist/{chunk-2GWOFP24.js → chunk-FUGWPKXN.js} +1 -1
- package/dist/{chunk-AZEGOADG.js → chunk-I3RRMAAD.js} +3 -3
- package/dist/chunk-QEDVPJKP.js +203 -0
- package/dist/{chunk-4FK45WJI.js → chunk-SMQDT7CT.js} +2 -2
- package/dist/chunk-TA73FIZU.js +75 -0
- package/dist/{chunk-LLL3KYEM.js → chunk-UQCQ2JCG.js} +5 -3
- package/dist/{chunk-TLT6F35V.js → chunk-YJ3RGKPU.js} +1 -1
- package/dist/{chunk-P3FDT7G5.js → chunk-Z4IDXMSP.js} +0 -200
- package/dist/cli/index.js +106 -29
- package/dist/{conduct-4NPMP4GL.js → conduct-UAEEMVFD.js} +7 -6
- package/dist/{conduct-5FTKINWU.js → conduct-URYWMA5T.js} +7 -6
- package/dist/{conductor-mode-ZWC5BZUL.js → conductor-mode-2UFN6BUL.js} +6 -5
- package/dist/credits-action-24EPLUHG.js +148 -0
- package/dist/daemon-A7DXZIQW.js +188 -0
- package/dist/{execute-JTPFFEH6.js → execute-2Z3XIUHR.js} +6 -5
- package/dist/{openclaw-setup-HVEVSKXQ.js → openclaw-setup-WA625DZA.js} +9 -8
- package/dist/{openclaw-skills-QLC4D6DZ.js → openclaw-skills-76ZWXHFM.js} +53 -36
- package/dist/{request-WX3VLXBT.js → request-KPKWBL5W.js} +5 -4
- package/dist/{serve-skill-C7JU24CF.js → serve-skill-QSUIK3ZF.js} +6 -5
- package/dist/{server-F4WXNK5B.js → server-TGV2OPUM.js} +10 -8
- package/dist/{service-coordinator-2NFUCXYX.js → service-coordinator-4JAUUNUL.js} +16 -12
- package/package.json +1 -1
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import {
|
|
2
|
+
syncCreditsFromRegistry
|
|
3
|
+
} from "./chunk-FMKBCO2Q.js";
|
|
4
|
+
import "./chunk-74OZGLIT.js";
|
|
5
|
+
import "./chunk-5CC6O6SO.js";
|
|
6
|
+
import {
|
|
7
|
+
getBalance,
|
|
8
|
+
getTransactions,
|
|
9
|
+
openCreditDb
|
|
10
|
+
} from "./chunk-Z4IDXMSP.js";
|
|
11
|
+
import "./chunk-YNBZLXYS.js";
|
|
12
|
+
import "./chunk-YDGXKH2T.js";
|
|
13
|
+
import {
|
|
14
|
+
getConfigDir,
|
|
15
|
+
loadConfig
|
|
16
|
+
} from "./chunk-3XPBFF6H.js";
|
|
17
|
+
import "./chunk-J4RFJVXI.js";
|
|
18
|
+
import "./chunk-UVCNMRPS.js";
|
|
19
|
+
|
|
20
|
+
// src/cli/credits-action.ts
|
|
21
|
+
import { join } from "path";
|
|
22
|
+
async function creditsSync() {
|
|
23
|
+
const config = loadConfig();
|
|
24
|
+
if (!config) {
|
|
25
|
+
console.error("Error: not initialized. Run `agentbnb init` first.");
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
if (!config.registry) {
|
|
29
|
+
console.error("Error: no registry configured. Run `agentbnb config set registry <url>`");
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
const creditDbPath = join(getConfigDir(), "credit.db");
|
|
33
|
+
const db = openCreditDb(creditDbPath);
|
|
34
|
+
try {
|
|
35
|
+
const localBefore = getBalance(db, config.owner);
|
|
36
|
+
console.log(`Syncing credits from ${config.registry}...`);
|
|
37
|
+
const result = await syncCreditsFromRegistry(config, db);
|
|
38
|
+
if (result.synced) {
|
|
39
|
+
const localAfter = getBalance(db, config.owner);
|
|
40
|
+
console.log(`Local: ${localBefore} \u2192 ${localAfter} credits`);
|
|
41
|
+
console.log(`Remote: ${result.remoteBalance ?? "?"} credits`);
|
|
42
|
+
} else {
|
|
43
|
+
console.error(`Sync failed: ${result.error ?? "unknown error"}`);
|
|
44
|
+
}
|
|
45
|
+
} finally {
|
|
46
|
+
db.close();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async function creditsHistory(opts) {
|
|
50
|
+
const config = loadConfig();
|
|
51
|
+
if (!config) {
|
|
52
|
+
console.error("Error: not initialized. Run `agentbnb init` first.");
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
const creditDbPath = join(getConfigDir(), "credit.db");
|
|
56
|
+
const db = openCreditDb(creditDbPath);
|
|
57
|
+
try {
|
|
58
|
+
const limit = opts.limit ? parseInt(opts.limit, 10) : 20;
|
|
59
|
+
const balance = getBalance(db, config.owner);
|
|
60
|
+
const txns = getTransactions(db, config.owner, limit);
|
|
61
|
+
if (opts.json) {
|
|
62
|
+
console.log(JSON.stringify({ balance, transactions: txns }, null, 2));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
console.log(`Balance: ${balance} credits`);
|
|
66
|
+
console.log(`
|
|
67
|
+
Recent transactions (last ${txns.length}):`);
|
|
68
|
+
if (txns.length === 0) {
|
|
69
|
+
console.log(" (none)");
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const col = (s, w) => s.slice(0, w).padEnd(w);
|
|
73
|
+
console.log(` ${col("Date", 20)} ${col("Amount", 8)} ${col("Reason", 28)} Ref`);
|
|
74
|
+
console.log(` ${"-".repeat(72)}`);
|
|
75
|
+
for (const tx of txns) {
|
|
76
|
+
const date = tx.created_at.slice(0, 19).replace("T", " ");
|
|
77
|
+
const amount = tx.amount >= 0 ? `+${tx.amount}` : String(tx.amount);
|
|
78
|
+
const ref = tx.reference_id ? tx.reference_id.slice(0, 12) + "..." : "";
|
|
79
|
+
console.log(` ${col(date, 20)} ${col(amount, 8)} ${col(formatReason(tx.reason), 28)} ${ref}`);
|
|
80
|
+
}
|
|
81
|
+
} finally {
|
|
82
|
+
db.close();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async function creditsGrant(agentId, amount) {
|
|
86
|
+
const config = loadConfig();
|
|
87
|
+
if (!config) {
|
|
88
|
+
console.error("Error: not initialized. Run `agentbnb init` first.");
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
if (!config.registry) {
|
|
92
|
+
console.error("Error: no registry configured.");
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
const adminToken = process.env["ADMIN_TOKEN"];
|
|
96
|
+
if (!adminToken) {
|
|
97
|
+
console.error("Error: ADMIN_TOKEN environment variable required for grant.");
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
const credits = parseInt(amount, 10);
|
|
101
|
+
if (!Number.isFinite(credits) || credits <= 0) {
|
|
102
|
+
console.error("Error: amount must be a positive integer.");
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
const registryUrl = config.registry.replace(/\/$/, "");
|
|
106
|
+
let res;
|
|
107
|
+
try {
|
|
108
|
+
res = await fetch(`${registryUrl}/api/credits/grant`, {
|
|
109
|
+
method: "POST",
|
|
110
|
+
headers: {
|
|
111
|
+
"Content-Type": "application/json",
|
|
112
|
+
"Authorization": `Bearer ${adminToken}`
|
|
113
|
+
},
|
|
114
|
+
body: JSON.stringify({ agent_id: agentId, amount: credits })
|
|
115
|
+
});
|
|
116
|
+
} catch (err) {
|
|
117
|
+
console.error("Error: failed to connect to registry \u2014", err.message);
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
if (!res.ok) {
|
|
121
|
+
const body2 = await res.json().catch(() => ({}));
|
|
122
|
+
console.error(`Error ${res.status}: ${body2["error"] ?? "unknown error"}`);
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
const body = await res.json();
|
|
126
|
+
console.log(`Granted ${credits} credits to ${agentId}. New balance: ${body["balance"] ?? "?"}`);
|
|
127
|
+
}
|
|
128
|
+
function formatReason(reason) {
|
|
129
|
+
const labels = {
|
|
130
|
+
bootstrap: "Initial grant",
|
|
131
|
+
escrow_hold: "Escrow hold",
|
|
132
|
+
escrow_release: "Escrow release",
|
|
133
|
+
settlement: "Settlement (earned)",
|
|
134
|
+
refund: "Refund",
|
|
135
|
+
remote_earning: "Remote earning",
|
|
136
|
+
remote_settlement_confirmed: "Remote confirmed",
|
|
137
|
+
network_fee: "Network fee (5%)",
|
|
138
|
+
provider_bonus: "Provider bonus",
|
|
139
|
+
voucher_hold: "Voucher hold",
|
|
140
|
+
voucher_settlement: "Voucher settlement"
|
|
141
|
+
};
|
|
142
|
+
return labels[reason] ?? reason;
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
creditsGrant,
|
|
146
|
+
creditsHistory,
|
|
147
|
+
creditsSync
|
|
148
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveSelfCli
|
|
3
|
+
} from "./chunk-7S4ZLFVI.js";
|
|
4
|
+
import {
|
|
5
|
+
getConfigDir
|
|
6
|
+
} from "./chunk-3XPBFF6H.js";
|
|
7
|
+
import "./chunk-UVCNMRPS.js";
|
|
8
|
+
|
|
9
|
+
// src/runtime/daemon.ts
|
|
10
|
+
import { spawn, execSync } from "child_process";
|
|
11
|
+
import {
|
|
12
|
+
writeFileSync,
|
|
13
|
+
readFileSync,
|
|
14
|
+
existsSync,
|
|
15
|
+
unlinkSync,
|
|
16
|
+
mkdirSync,
|
|
17
|
+
openSync
|
|
18
|
+
} from "fs";
|
|
19
|
+
import { join } from "path";
|
|
20
|
+
import { homedir } from "os";
|
|
21
|
+
var PID_FILE_NAME = "serve.pid";
|
|
22
|
+
var LOG_DIR_NAME = "logs";
|
|
23
|
+
var LOG_FILE_NAME = "serve.log";
|
|
24
|
+
var DAEMON_FLAGS = ["--daemon", "--status", "--stop", "--restart", "--startup"];
|
|
25
|
+
function isProcessRunning(pid) {
|
|
26
|
+
try {
|
|
27
|
+
process.kill(pid, 0);
|
|
28
|
+
return true;
|
|
29
|
+
} catch (err) {
|
|
30
|
+
const killErr = err;
|
|
31
|
+
if (killErr.code === "EPERM") return true;
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function readDaemonPid() {
|
|
36
|
+
const pidFile = join(getConfigDir(), PID_FILE_NAME);
|
|
37
|
+
if (!existsSync(pidFile)) return null;
|
|
38
|
+
const raw = readFileSync(pidFile, "utf-8").trim();
|
|
39
|
+
const pid = parseInt(raw, 10);
|
|
40
|
+
if (!Number.isFinite(pid)) {
|
|
41
|
+
unlinkSync(pidFile);
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
if (!isProcessRunning(pid)) {
|
|
45
|
+
unlinkSync(pidFile);
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return pid;
|
|
49
|
+
}
|
|
50
|
+
function startDaemon(serveArgs) {
|
|
51
|
+
if (readDaemonPid() !== null) {
|
|
52
|
+
console.log(
|
|
53
|
+
"AgentBnB serve daemon is already running. Use `agentbnb serve --restart` to restart."
|
|
54
|
+
);
|
|
55
|
+
process.exit(0);
|
|
56
|
+
}
|
|
57
|
+
const dir = getConfigDir();
|
|
58
|
+
const logDir = join(dir, LOG_DIR_NAME);
|
|
59
|
+
mkdirSync(logDir, { recursive: true });
|
|
60
|
+
const logFile = join(logDir, LOG_FILE_NAME);
|
|
61
|
+
const out = openSync(logFile, "a");
|
|
62
|
+
const err = openSync(logFile, "a");
|
|
63
|
+
const cleanArgs = serveArgs.filter(
|
|
64
|
+
(a) => !DAEMON_FLAGS.includes(a)
|
|
65
|
+
);
|
|
66
|
+
const entry = resolveSelfCli();
|
|
67
|
+
const child = spawn(process.execPath, [entry, "serve", ...cleanArgs], {
|
|
68
|
+
detached: true,
|
|
69
|
+
stdio: ["ignore", out, err],
|
|
70
|
+
env: { ...process.env, AGENTBNB_DAEMON: "1" }
|
|
71
|
+
});
|
|
72
|
+
child.unref();
|
|
73
|
+
const childPid = child.pid;
|
|
74
|
+
if (childPid === void 0) {
|
|
75
|
+
console.error("Failed to start daemon: no PID returned from spawn.");
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
writeFileSync(join(dir, PID_FILE_NAME), String(childPid));
|
|
79
|
+
console.log("AgentBnB serve started in background");
|
|
80
|
+
console.log(` PID: ${childPid}`);
|
|
81
|
+
console.log(` Log: ${logFile}`);
|
|
82
|
+
console.log(` Stop: agentbnb serve --stop`);
|
|
83
|
+
console.log(` Status: agentbnb serve --status`);
|
|
84
|
+
}
|
|
85
|
+
function daemonStatus() {
|
|
86
|
+
const pid = readDaemonPid();
|
|
87
|
+
const logFile = join(getConfigDir(), LOG_DIR_NAME, LOG_FILE_NAME);
|
|
88
|
+
if (pid !== null) {
|
|
89
|
+
console.log(`AgentBnB serve is running (PID: ${pid})`);
|
|
90
|
+
console.log(` Log: ${logFile}`);
|
|
91
|
+
} else {
|
|
92
|
+
console.log("AgentBnB serve is not running.");
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function stopDaemon() {
|
|
96
|
+
const dir = getConfigDir();
|
|
97
|
+
const pidFile = join(dir, PID_FILE_NAME);
|
|
98
|
+
const pid = readDaemonPid();
|
|
99
|
+
if (pid === null) {
|
|
100
|
+
console.log("AgentBnB serve is not running.");
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
process.kill(pid, "SIGTERM");
|
|
105
|
+
} catch {
|
|
106
|
+
}
|
|
107
|
+
if (existsSync(pidFile)) unlinkSync(pidFile);
|
|
108
|
+
console.log(`Stopped AgentBnB serve (PID: ${pid})`);
|
|
109
|
+
}
|
|
110
|
+
async function restartDaemon(serveArgs) {
|
|
111
|
+
stopDaemon();
|
|
112
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
113
|
+
startDaemon(serveArgs);
|
|
114
|
+
}
|
|
115
|
+
function registerStartup(serveArgs) {
|
|
116
|
+
const cleanArgs = serveArgs.filter(
|
|
117
|
+
(a) => !DAEMON_FLAGS.includes(a)
|
|
118
|
+
);
|
|
119
|
+
const entry = resolveSelfCli();
|
|
120
|
+
if (process.platform === "darwin") {
|
|
121
|
+
const plistDir = join(homedir(), "Library", "LaunchAgents");
|
|
122
|
+
mkdirSync(plistDir, { recursive: true });
|
|
123
|
+
const plistPath = join(plistDir, "dev.agentbnb.serve.plist");
|
|
124
|
+
const argsXml = ["serve", ...cleanArgs].map((a) => ` <string>${a}</string>`).join("\n");
|
|
125
|
+
const logPath = join(getConfigDir(), "logs", "serve.log");
|
|
126
|
+
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
127
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
128
|
+
<plist version="1.0">
|
|
129
|
+
<dict>
|
|
130
|
+
<key>Label</key><string>dev.agentbnb.serve</string>
|
|
131
|
+
<key>ProgramArguments</key>
|
|
132
|
+
<array>
|
|
133
|
+
<string>${process.execPath}</string>
|
|
134
|
+
<string>${entry}</string>
|
|
135
|
+
${argsXml}
|
|
136
|
+
</array>
|
|
137
|
+
<key>RunAtLoad</key><true/>
|
|
138
|
+
<key>KeepAlive</key><true/>
|
|
139
|
+
<key>StandardOutPath</key><string>${logPath}</string>
|
|
140
|
+
<key>StandardErrorPath</key><string>${logPath}</string>
|
|
141
|
+
<key>EnvironmentVariables</key>
|
|
142
|
+
<dict>
|
|
143
|
+
<key>PATH</key><string>/usr/local/bin:/usr/bin:/bin</string>
|
|
144
|
+
</dict>
|
|
145
|
+
</dict>
|
|
146
|
+
</plist>`;
|
|
147
|
+
writeFileSync(plistPath, plist);
|
|
148
|
+
try {
|
|
149
|
+
execSync(`launchctl unload ${plistPath} 2>/dev/null`, { stdio: "ignore" });
|
|
150
|
+
} catch {
|
|
151
|
+
}
|
|
152
|
+
execSync(`launchctl load ${plistPath}`);
|
|
153
|
+
console.log(`Registered startup: ${plistPath}`);
|
|
154
|
+
console.log("AgentBnB serve will auto-start on login.");
|
|
155
|
+
} else if (process.platform === "linux") {
|
|
156
|
+
const unitDir = join(homedir(), ".config", "systemd", "user");
|
|
157
|
+
mkdirSync(unitDir, { recursive: true });
|
|
158
|
+
const unitPath = join(unitDir, "agentbnb-serve.service");
|
|
159
|
+
const unit = `[Unit]
|
|
160
|
+
Description=AgentBnB Serve Daemon
|
|
161
|
+
After=network.target
|
|
162
|
+
|
|
163
|
+
[Service]
|
|
164
|
+
ExecStart=${process.execPath} ${entry} serve ${cleanArgs.join(" ")}
|
|
165
|
+
Restart=on-failure
|
|
166
|
+
RestartSec=5
|
|
167
|
+
Environment=NODE_ENV=production
|
|
168
|
+
|
|
169
|
+
[Install]
|
|
170
|
+
WantedBy=default.target
|
|
171
|
+
`;
|
|
172
|
+
writeFileSync(unitPath, unit);
|
|
173
|
+
execSync("systemctl --user daemon-reload");
|
|
174
|
+
execSync("systemctl --user enable agentbnb-serve");
|
|
175
|
+
console.log(`Registered startup: ${unitPath}`);
|
|
176
|
+
console.log("AgentBnB serve will auto-start on login.");
|
|
177
|
+
} else {
|
|
178
|
+
console.log("Startup registration not supported on this platform.");
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
export {
|
|
182
|
+
daemonStatus,
|
|
183
|
+
readDaemonPid,
|
|
184
|
+
registerStartup,
|
|
185
|
+
restartDaemon,
|
|
186
|
+
startDaemon,
|
|
187
|
+
stopDaemon
|
|
188
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executeCapabilityBatch,
|
|
3
3
|
executeCapabilityRequest
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-76YORWFJ.js";
|
|
5
|
+
import "./chunk-FMKBCO2Q.js";
|
|
6
|
+
import "./chunk-74OZGLIT.js";
|
|
7
7
|
import "./chunk-5CC6O6SO.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-ERT77HKY.js";
|
|
9
9
|
import "./chunk-ELFGYC22.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-QEDVPJKP.js";
|
|
11
|
+
import "./chunk-Z4IDXMSP.js";
|
|
11
12
|
import "./chunk-YNBZLXYS.js";
|
|
12
13
|
import "./chunk-YDGXKH2T.js";
|
|
13
14
|
import "./chunk-3XPBFF6H.js";
|
|
@@ -2,24 +2,25 @@ import {
|
|
|
2
2
|
appendHeartbeatTradingSection,
|
|
3
3
|
appendSoulMdTradingSection
|
|
4
4
|
} from "./chunk-WPB5LFGI.js";
|
|
5
|
+
import {
|
|
6
|
+
performInit,
|
|
7
|
+
publishFromSoulV2
|
|
8
|
+
} from "./chunk-2SOHHB2O.js";
|
|
5
9
|
import {
|
|
6
10
|
findSoulMd,
|
|
7
11
|
getOpenClawWorkspaceDir,
|
|
8
12
|
inferBrainDir,
|
|
9
13
|
scanAgents
|
|
10
14
|
} from "./chunk-RJNKX347.js";
|
|
11
|
-
import
|
|
12
|
-
performInit,
|
|
13
|
-
publishFromSoulV2
|
|
14
|
-
} from "./chunk-27VHBFUP.js";
|
|
15
|
-
import "./chunk-TLT6F35V.js";
|
|
15
|
+
import "./chunk-YJ3RGKPU.js";
|
|
16
16
|
import {
|
|
17
17
|
getPricingStats
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-FUGWPKXN.js";
|
|
19
19
|
import "./chunk-G5WKW3ED.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-74OZGLIT.js";
|
|
21
21
|
import "./chunk-5CC6O6SO.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-QEDVPJKP.js";
|
|
23
|
+
import "./chunk-Z4IDXMSP.js";
|
|
23
24
|
import "./chunk-YNBZLXYS.js";
|
|
24
25
|
import "./chunk-YDGXKH2T.js";
|
|
25
26
|
import "./chunk-3XPBFF6H.js";
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import { createInterface } from "readline";
|
|
8
8
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
9
9
|
import { join } from "path";
|
|
10
|
+
import { homedir } from "os";
|
|
10
11
|
import yaml from "js-yaml";
|
|
11
12
|
var OPENCLAW_COMMUNITY_SKILLS = /* @__PURE__ */ new Set([
|
|
12
13
|
"find-skills",
|
|
@@ -16,6 +17,18 @@ var OPENCLAW_COMMUNITY_SKILLS = /* @__PURE__ */ new Set([
|
|
|
16
17
|
"skill-vetter",
|
|
17
18
|
"tavily"
|
|
18
19
|
]);
|
|
20
|
+
var COMMUNITY_DIRS = [
|
|
21
|
+
join(homedir(), ".openclaw", "skills"),
|
|
22
|
+
join(homedir(), ".openclaw", "extensions")
|
|
23
|
+
];
|
|
24
|
+
function isCommunitySkill(skillPath) {
|
|
25
|
+
return COMMUNITY_DIRS.some((dir) => skillPath.startsWith(dir));
|
|
26
|
+
}
|
|
27
|
+
function isCommunitySkillByNameOrPath(name, skillPath) {
|
|
28
|
+
if (OPENCLAW_COMMUNITY_SKILLS.has(name)) return true;
|
|
29
|
+
if (skillPath && isCommunitySkill(skillPath)) return true;
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
19
32
|
async function prompt(question) {
|
|
20
33
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
21
34
|
try {
|
|
@@ -111,54 +124,57 @@ ${rpad(headers[0], 24)} ${rpad(headers[1], 8)} ${rpad(headers[2], 7)} ${rpad(hea
|
|
|
111
124
|
}
|
|
112
125
|
async function showAvailableSkills(configDir, sharedIds) {
|
|
113
126
|
try {
|
|
114
|
-
const { scanCapabilities, scanWorkspaceSkills, findSoulMd } = await import("./scanner-GP4AOCW6.js");
|
|
127
|
+
const { scanCapabilities, scanWorkspaceSkills, findSoulMd, inferBrainDir, getOpenClawWorkspaceDir } = await import("./scanner-GP4AOCW6.js");
|
|
115
128
|
const agentName = deriveAgentName(configDir);
|
|
116
129
|
if (!agentName) return;
|
|
117
|
-
const { homedir } = await import("os");
|
|
118
|
-
const { join: pathJoin } = await import("path");
|
|
119
|
-
const { getOpenClawWorkspaceDir } = await import("./scanner-GP4AOCW6.js");
|
|
120
130
|
const workspaceDir = getOpenClawWorkspaceDir();
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
const agentDir = pathJoin(agentsDir, agentName);
|
|
131
|
+
const brainDir = join(workspaceDir, "brains", agentName);
|
|
132
|
+
const home = homedir();
|
|
133
|
+
const agentDir = join(home, ".openclaw", "agents", agentName);
|
|
125
134
|
let effectiveBrainDir = "";
|
|
126
135
|
if (existsSync(brainDir)) {
|
|
127
136
|
effectiveBrainDir = brainDir;
|
|
128
137
|
} else {
|
|
129
138
|
const soulPath = findSoulMd(agentName);
|
|
130
139
|
if (soulPath) {
|
|
131
|
-
const { inferBrainDir } = await import("./scanner-GP4AOCW6.js");
|
|
132
140
|
effectiveBrainDir = inferBrainDir(soulPath, agentDir) || agentDir;
|
|
133
141
|
}
|
|
134
142
|
}
|
|
135
143
|
const agentCaps = effectiveBrainDir ? scanCapabilities(effectiveBrainDir) : [];
|
|
136
144
|
const workspaceCaps = scanWorkspaceSkills();
|
|
137
145
|
const seen = new Set(sharedIds);
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
146
|
+
const userSkills = [];
|
|
147
|
+
const communitySkills = [];
|
|
148
|
+
const classifyCaps = (caps, source) => {
|
|
149
|
+
for (const cap of caps) {
|
|
150
|
+
if (seen.has(cap.name)) continue;
|
|
142
151
|
seen.add(cap.name);
|
|
143
|
-
|
|
152
|
+
if (isCommunitySkillByNameOrPath(cap.name)) {
|
|
153
|
+
communitySkills.push(cap.name);
|
|
154
|
+
} else {
|
|
155
|
+
userSkills.push({ name: cap.name, description: cap.description, source, suggestedPrice: cap.suggestedPrice });
|
|
156
|
+
}
|
|
144
157
|
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
158
|
+
};
|
|
159
|
+
classifyCaps(agentCaps, "agent");
|
|
160
|
+
classifyCaps(workspaceCaps, "workspace");
|
|
161
|
+
if (userSkills.length === 0 && communitySkills.length === 0) return;
|
|
162
|
+
if (userSkills.length > 0) {
|
|
163
|
+
console.log("Your skills (available to share):");
|
|
164
|
+
for (let i = 0; i < userSkills.length; i++) {
|
|
165
|
+
const cap = userSkills[i];
|
|
166
|
+
const tag = cap.source === "workspace" ? " [workspace]" : "";
|
|
167
|
+
const desc = cap.description.slice(0, 50);
|
|
168
|
+
console.log(` [${i + 1}] ${cap.name}${tag} \u2014 ${desc} (${cap.suggestedPrice} cr)`);
|
|
151
169
|
}
|
|
170
|
+
console.log(`
|
|
171
|
+
Run 'agentbnb openclaw skills add' to share one.`);
|
|
152
172
|
}
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const desc = cap.description.slice(0, 50);
|
|
158
|
-
console.log(` \u2022 ${cap.name}${tag} \u2014 ${desc}`);
|
|
173
|
+
if (communitySkills.length > 0) {
|
|
174
|
+
console.log(`
|
|
175
|
+
Community skills (not shared):`);
|
|
176
|
+
console.log(` ${communitySkills.join(", ")}`);
|
|
159
177
|
}
|
|
160
|
-
console.log(`
|
|
161
|
-
Run 'agentbnb openclaw skills add' to share one.`);
|
|
162
178
|
console.log("");
|
|
163
179
|
} catch {
|
|
164
180
|
}
|
|
@@ -196,14 +212,11 @@ async function skillsAdd(opts) {
|
|
|
196
212
|
if (newSkill.command === void 0) delete newSkill["command"];
|
|
197
213
|
} else {
|
|
198
214
|
const { scanCapabilities, scanWorkspaceSkills, findSoulMd, inferBrainDir, getOpenClawWorkspaceDir } = await import("./scanner-GP4AOCW6.js");
|
|
199
|
-
const { homedir } = await import("os");
|
|
200
|
-
const { join: pathJoin } = await import("path");
|
|
201
215
|
const agentName = deriveAgentName(configDir);
|
|
202
216
|
const workspaceDir = getOpenClawWorkspaceDir();
|
|
203
|
-
const
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
const brainDir = pathJoin(brainsDir, agentName);
|
|
217
|
+
const home = homedir();
|
|
218
|
+
const agentDir = join(home, ".openclaw", "agents", agentName);
|
|
219
|
+
const brainDir = join(workspaceDir, "brains", agentName);
|
|
207
220
|
let effectiveBrainDir = "";
|
|
208
221
|
if (existsSync(brainDir)) {
|
|
209
222
|
effectiveBrainDir = brainDir;
|
|
@@ -215,9 +228,11 @@ async function skillsAdd(opts) {
|
|
|
215
228
|
}
|
|
216
229
|
const agentCaps = effectiveBrainDir ? scanCapabilities(effectiveBrainDir) : [];
|
|
217
230
|
const workspaceCaps = scanWorkspaceSkills();
|
|
218
|
-
const unsharedAgent = agentCaps.filter(
|
|
231
|
+
const unsharedAgent = agentCaps.filter(
|
|
232
|
+
(c) => !existingIds.has(c.name) && !isCommunitySkillByNameOrPath(c.name)
|
|
233
|
+
);
|
|
219
234
|
const unsharedWorkspace = workspaceCaps.filter(
|
|
220
|
-
(c) => !existingIds.has(c.name) && !unsharedAgent.some((a) => a.name === c.name)
|
|
235
|
+
(c) => !existingIds.has(c.name) && !unsharedAgent.some((a) => a.name === c.name) && !isCommunitySkillByNameOrPath(c.name)
|
|
221
236
|
);
|
|
222
237
|
if (unsharedAgent.length === 0 && unsharedWorkspace.length === 0) {
|
|
223
238
|
if (agentCaps.length === 0 && workspaceCaps.length === 0) {
|
|
@@ -407,6 +422,8 @@ Skill Performance \u2014 last ${days} days`);
|
|
|
407
422
|
console.log("");
|
|
408
423
|
}
|
|
409
424
|
export {
|
|
425
|
+
isCommunitySkill,
|
|
426
|
+
isCommunitySkillByNameOrPath,
|
|
410
427
|
skillsAdd,
|
|
411
428
|
skillsList,
|
|
412
429
|
skillsPrice,
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AutoRequestor,
|
|
3
3
|
requestViaTemporaryRelay
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UQCQ2JCG.js";
|
|
5
5
|
import {
|
|
6
6
|
BudgetManager,
|
|
7
7
|
DEFAULT_BUDGET_CONFIG
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YJ3RGKPU.js";
|
|
9
9
|
import "./chunk-5PV5YCSN.js";
|
|
10
10
|
import {
|
|
11
11
|
DEFAULT_AUTONOMY_CONFIG
|
|
12
12
|
} from "./chunk-G5WKW3ED.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-ERT77HKY.js";
|
|
14
14
|
import "./chunk-ELFGYC22.js";
|
|
15
|
+
import "./chunk-QEDVPJKP.js";
|
|
15
16
|
import {
|
|
16
17
|
openCreditDb
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-Z4IDXMSP.js";
|
|
18
19
|
import "./chunk-UR3MISL2.js";
|
|
19
20
|
import "./chunk-3466S65P.js";
|
|
20
21
|
import {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executeCapabilityRequest
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-76YORWFJ.js";
|
|
4
|
+
import "./chunk-FMKBCO2Q.js";
|
|
5
|
+
import "./chunk-74OZGLIT.js";
|
|
6
6
|
import "./chunk-5CC6O6SO.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-ERT77HKY.js";
|
|
8
8
|
import "./chunk-ELFGYC22.js";
|
|
9
|
+
import "./chunk-QEDVPJKP.js";
|
|
9
10
|
import {
|
|
10
11
|
openCreditDb
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Z4IDXMSP.js";
|
|
12
13
|
import {
|
|
13
14
|
RelayClient
|
|
14
15
|
} from "./chunk-UR3MISL2.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLedger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-74OZGLIT.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureIdentity
|
|
6
6
|
} from "./chunk-5CC6O6SO.js";
|
|
@@ -9,10 +9,12 @@ import {
|
|
|
9
9
|
mergeResults
|
|
10
10
|
} from "./chunk-ELFGYC22.js";
|
|
11
11
|
import {
|
|
12
|
-
getBalance,
|
|
13
|
-
openCreditDb,
|
|
14
12
|
searchCards
|
|
15
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-QEDVPJKP.js";
|
|
14
|
+
import {
|
|
15
|
+
getBalance,
|
|
16
|
+
openCreditDb
|
|
17
|
+
} from "./chunk-Z4IDXMSP.js";
|
|
16
18
|
import {
|
|
17
19
|
loadKeyPair
|
|
18
20
|
} from "./chunk-YNBZLXYS.js";
|
|
@@ -256,7 +258,7 @@ function registerPublishTool(server, ctx) {
|
|
|
256
258
|
}
|
|
257
259
|
|
|
258
260
|
// src/mcp/server.ts
|
|
259
|
-
var VERSION = true ? "9.0.
|
|
261
|
+
var VERSION = true ? "9.0.2" : "0.0.0-dev";
|
|
260
262
|
async function startMcpServer() {
|
|
261
263
|
const config = loadConfig();
|
|
262
264
|
if (!config) {
|
|
@@ -277,9 +279,9 @@ async function startMcpServer() {
|
|
|
277
279
|
registerDiscoverTool(server, ctx);
|
|
278
280
|
registerStatusTool(server, ctx);
|
|
279
281
|
registerPublishTool(server, ctx);
|
|
280
|
-
const { registerRequestTool } = await import("./request-
|
|
281
|
-
const { registerConductTool } = await import("./conduct-
|
|
282
|
-
const { registerServeSkillTool } = await import("./serve-skill-
|
|
282
|
+
const { registerRequestTool } = await import("./request-KPKWBL5W.js");
|
|
283
|
+
const { registerConductTool } = await import("./conduct-URYWMA5T.js");
|
|
284
|
+
const { registerServeSkillTool } = await import("./serve-skill-QSUIK3ZF.js");
|
|
283
285
|
registerRequestTool(server, ctx);
|
|
284
286
|
registerConductTool(server, ctx);
|
|
285
287
|
registerServeSkillTool(server, ctx);
|