bazilion 0.5.0 → 0.6.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.
- package/README.md +14 -9
- package/dist/cli.js +365 -140
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +4452 -16989
- package/dist/daemon.js.map +1 -1
- package/dist/web/client/assets/AgentAvatar-Cq7PVBE_.js +1 -0
- package/dist/web/client/assets/AgentTabs-M5K8emJ8.js +1 -0
- package/dist/web/client/assets/Button-BefUtjMZ.js +1 -0
- package/dist/web/client/assets/ChatPane-C8zQfpzH.js +74 -0
- package/dist/web/client/assets/ConfigTabs-DRqAymcN.js +1 -0
- package/dist/web/client/assets/FieldRow-BqWnxZiX.js +1 -0
- package/dist/web/client/assets/MembersEditor-B-47GLUb.js +1 -0
- package/dist/web/client/assets/SpawnTeamModal-DiiC7Nc0.js +1 -0
- package/dist/web/client/assets/TemplatesTabs-DB4KERTQ.js +1 -0
- package/dist/web/client/assets/_id-B7gv1aPQ.js +1 -0
- package/dist/web/client/assets/_id-C7d1AqS0.js +1 -0
- package/dist/web/client/assets/_id-DhiwjC8u.js +1 -0
- package/dist/web/client/assets/_id-p8lUuNFm.js +1 -0
- package/dist/web/client/assets/agents-v8G-wt0M.js +1 -0
- package/dist/web/client/assets/config-BdmYpS_y.js +3 -0
- package/dist/web/client/assets/groups-DiY_ExGM.js +1 -0
- package/dist/web/client/assets/inbox-DtfVx246.js +1 -0
- package/dist/web/client/assets/index-BQUL6oyH.js +12 -0
- package/dist/web/client/assets/login-CVS70W9g.js +1 -0
- package/dist/web/client/assets/mcp-BDLQq8OZ.js +1 -0
- package/dist/web/client/assets/memory-6GGuAXwx.js +1 -0
- package/dist/web/client/assets/profile-groups-BA8rwZMA.js +1 -0
- package/dist/web/client/assets/profiles-C0aAcPZg.js +1 -0
- package/dist/web/client/assets/routes-DgAhnKFw.js +1 -0
- package/dist/web/client/assets/services-BZ86QEah.js +1 -0
- package/dist/web/client/assets/skills-mv_NNNwo.js +1 -0
- package/dist/web/client/assets/styles-CmqUskDu.css +2 -0
- package/dist/web/client/assets/telegram-5f9WXs3x.js +1 -0
- package/dist/web/client/assets/tokens-DHiYsFUh.js +1 -0
- package/dist/web/client/assets/triggers-CjC8Ljrz.js +1 -0
- package/dist/web/client/assets/welcome-C-Cu-ziL.js +1 -0
- package/dist/web/client/assets/wire-constants-BkT5-597.js +1 -0
- package/dist/web/client/baziu.svg +8 -0
- package/dist/web/server/assets/AgentAvatar-8gTAy_tP.js +37 -0
- package/dist/web/server/assets/AgentTabs-BOjTN7QF.js +34 -0
- package/dist/web/server/assets/Button-Dsnw22OF.js +17 -0
- package/dist/web/server/assets/ChatPane-BvpswYvF.js +1084 -0
- package/dist/web/server/assets/ConfigTabs-CyuxzesF.js +41 -0
- package/dist/web/server/assets/FieldRow-DwyqycWI.js +94 -0
- package/dist/web/server/assets/MembersEditor-BWQztvrX.js +131 -0
- package/dist/web/server/assets/Sidebar-DmEiewRN.js +529 -0
- package/dist/web/server/assets/SpawnTeamModal-dSN421k_.js +107 -0
- package/dist/web/server/assets/TemplatesTabs---7h5GYa.js +30 -0
- package/dist/web/server/assets/_id-BZ-YCWSw.js +16 -0
- package/dist/web/server/assets/_id-Bm4-_AP-.js +367 -0
- package/dist/web/server/assets/_id-C78M9_j9.js +12 -0
- package/dist/web/server/assets/_id-CGZbudCl.js +28 -0
- package/dist/web/server/assets/_id-CHNm7EAd.js +161 -0
- package/dist/web/server/assets/_id-CrQbC5L8.js +16 -0
- package/dist/web/server/assets/_id-Crcw2HhT.js +38 -0
- package/dist/web/server/assets/_id-CvIGhq4U.js +16 -0
- package/dist/web/server/assets/_id-DF3pfi9M.js +27 -0
- package/dist/web/server/assets/_id-Dc8P9sy2.js +24 -0
- package/dist/web/server/assets/_id-GJk3EYTT.js +662 -0
- package/dist/web/server/assets/_id-pd4S7LTi.js +467 -0
- package/dist/web/server/assets/_tanstack-start-manifest_v-CPyKYMJg.js +174 -0
- package/dist/web/server/assets/agents-70EwQJR6.js +210 -0
- package/dist/web/server/assets/agents-Ds4lcREv.js +26 -0
- package/dist/web/server/assets/agents-K4Smhnq3.js +14 -0
- package/dist/web/server/assets/auth-DpAGLHpA.js +26 -0
- package/dist/web/server/assets/config-CMXUx_IF.js +19 -0
- package/dist/web/server/assets/config-DQbCsY_l.js +382 -0
- package/dist/web/server/assets/config-DxCGYgR9.js +12 -0
- package/dist/web/server/assets/createServerRpc-CBTntoKx.js +12 -0
- package/dist/web/server/assets/createSsrRpc-DHBVUN8O.js +16 -0
- package/dist/web/server/assets/daemon-client-2NRMzlTr.js +96 -0
- package/dist/web/server/assets/empty-plugin-adapters-Bos_V2s-.js +5 -0
- package/dist/web/server/assets/groups-CXVew7BP.js +150 -0
- package/dist/web/server/assets/groups-Cms8cvH5.js +12 -0
- package/dist/web/server/assets/groups-Dmcvw5ya.js +21 -0
- package/dist/web/server/assets/inbox-0QfwsrGo.js +27 -0
- package/dist/web/server/assets/inbox-8HybA2Ws.js +133 -0
- package/dist/web/server/assets/inbox-B7UWoICA.js +42 -0
- package/dist/web/server/assets/login-CNznncgA.js +58 -0
- package/dist/web/server/assets/login-CQybKk7Y.js +74 -0
- package/dist/web/server/assets/mcp-42BrkI1I.js +12 -0
- package/dist/web/server/assets/mcp-DIa0kIOf.js +268 -0
- package/dist/web/server/assets/mcp-DsTjY3uz.js +12 -0
- package/dist/web/server/assets/memory-BfrMp8iY.js +284 -0
- package/dist/web/server/assets/memory-Dr0lOM2y.js +28 -0
- package/dist/web/server/assets/memory-EEgLDfCj.js +16 -0
- package/dist/web/server/assets/profile-groups-BW5gU-fG.js +12 -0
- package/dist/web/server/assets/profile-groups-B_kIT6BU.js +208 -0
- package/dist/web/server/assets/profile-groups-C5isDI2t.js +28 -0
- package/dist/web/server/assets/profiles-BP1v-jna.js +453 -0
- package/dist/web/server/assets/profiles-BbPTpmyq.js +26 -0
- package/dist/web/server/assets/profiles-Cy5auEj8.js +12 -0
- package/dist/web/server/assets/router-CL100-Ly.js +460 -0
- package/dist/web/server/assets/routes-CzJLQxcS.js +14 -0
- package/dist/web/server/assets/routes-D2H1Hnoh.js +57 -0
- package/dist/web/server/assets/routes-Dzk8jvIo.js +33 -0
- package/dist/web/server/assets/services-Bgj6M2gC.js +12 -0
- package/dist/web/server/assets/services-DEgYsWJ4.js +17 -0
- package/dist/web/server/assets/services-DFenjiw0.js +94 -0
- package/dist/web/server/assets/skills-BASIP_rT.js +12 -0
- package/dist/web/server/assets/skills-C-JPRCHh.js +12 -0
- package/dist/web/server/assets/skills-DZXN680t.js +261 -0
- package/dist/web/server/assets/start-cOXH7eTI.js +4 -0
- package/dist/web/server/assets/telegram-BbvqVWxa.js +583 -0
- package/dist/web/server/assets/telegram-Bq49AtnP.js +12 -0
- package/dist/web/server/assets/telegram-sUckI94O.js +12 -0
- package/dist/web/server/assets/tokens-BERRE0wB.js +14 -0
- package/dist/web/server/assets/tokens-CImgxhDI.js +193 -0
- package/dist/web/server/assets/tokens-Dwn00iV7.js +12 -0
- package/dist/web/server/assets/triggers-DtexqbNH.js +16 -0
- package/dist/web/server/assets/triggers-TyIjwSYn.js +26 -0
- package/dist/web/server/assets/triggers-_iSeahif.js +191 -0
- package/dist/web/server/assets/welcome-BkQ9NC5K.js +81 -0
- package/dist/web/server/assets/wire-constants-Deb4NxBb.js +16 -0
- package/dist/web/server/server.js +5899 -0
- package/dist/web-server.js +42 -0
- package/dist/web-server.js.map +1 -0
- package/package.json +10 -4
package/dist/cli.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { defineCommand as
|
|
4
|
+
import { defineCommand as defineCommand23, runCommand, showUsage } from "citty";
|
|
5
5
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "bazilion",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.6.0",
|
|
10
10
|
description: "Multi-agent runtime CLI \u2014 spawn LLM agents, manage profiles/groups/skills, and run the local daemon.",
|
|
11
11
|
license: "MIT",
|
|
12
12
|
repository: {
|
|
@@ -40,7 +40,7 @@ var package_default = {
|
|
|
40
40
|
"LICENSE"
|
|
41
41
|
],
|
|
42
42
|
scripts: {
|
|
43
|
-
build: "tsup"
|
|
43
|
+
build: "pnpm --filter @bazilion/web build && tsup"
|
|
44
44
|
},
|
|
45
45
|
engines: {
|
|
46
46
|
node: ">=24.0.0"
|
|
@@ -52,15 +52,21 @@ var package_default = {
|
|
|
52
52
|
"@earendil-works/pi-agent-core": "^0.77.0",
|
|
53
53
|
"@earendil-works/pi-ai": "^0.77.0",
|
|
54
54
|
"@earendil-works/pi-coding-agent": "^0.77.0",
|
|
55
|
+
"@tanstack/react-router": "1.170.16",
|
|
55
56
|
"@hono/node-server": "^2.0.4",
|
|
56
57
|
"@mozilla/readability": "^0.6.0",
|
|
57
58
|
"@tobilu/qmd": "^2.5.3",
|
|
58
59
|
"adm-zip": "^0.5.17",
|
|
59
60
|
citty: "^0.2.2",
|
|
61
|
+
dompurify: "^3.4.7",
|
|
62
|
+
grammy: "^1.43.0",
|
|
60
63
|
hono: "^4.12.23",
|
|
61
64
|
linkedom: "^0.18.12",
|
|
65
|
+
"lucide-react": "^1.17.0",
|
|
62
66
|
playwright: "^1.60.0",
|
|
63
67
|
"qrcode-terminal": "^0.12.0",
|
|
68
|
+
react: "^19.2.6",
|
|
69
|
+
"react-dom": "^19.2.6",
|
|
64
70
|
typebox: "^1.1.39",
|
|
65
71
|
undici: "^8.3.0",
|
|
66
72
|
yaml: "^2.9.0"
|
|
@@ -1243,9 +1249,226 @@ var configCommand = defineCommand5({
|
|
|
1243
1249
|
}
|
|
1244
1250
|
});
|
|
1245
1251
|
|
|
1246
|
-
// src/commands/
|
|
1252
|
+
// src/commands/dashboard.ts
|
|
1253
|
+
import { spawn as spawn2 } from "child_process";
|
|
1254
|
+
import { existsSync as existsSync3 } from "fs";
|
|
1255
|
+
import { connect } from "net";
|
|
1256
|
+
import { join as join2 } from "path";
|
|
1247
1257
|
import { defineCommand as defineCommand6 } from "citty";
|
|
1248
|
-
var
|
|
1258
|
+
var bundledDaemonEntry = join2(import.meta.dirname, "daemon.js");
|
|
1259
|
+
var sourceDaemonEntry = join2(import.meta.dirname, "..", "..", "..", "daemon", "src", "index.ts");
|
|
1260
|
+
var daemonEntry = existsSync3(bundledDaemonEntry) ? bundledDaemonEntry : sourceDaemonEntry;
|
|
1261
|
+
var bundledWebServerEntry = join2(import.meta.dirname, "web-server.js");
|
|
1262
|
+
var sourceWebServerEntry = join2(import.meta.dirname, "..", "web-server.ts");
|
|
1263
|
+
var webServerEntry = existsSync3(bundledWebServerEntry) ? bundledWebServerEntry : sourceWebServerEntry;
|
|
1264
|
+
var bundledWebDist = join2(import.meta.dirname, "web");
|
|
1265
|
+
var sourceWebDist = join2(import.meta.dirname, "..", "..", "..", "web", "dist");
|
|
1266
|
+
var webDist = existsSync3(bundledWebDist) ? bundledWebDist : sourceWebDist;
|
|
1267
|
+
function nodeArgs(entry2) {
|
|
1268
|
+
return entry2.endsWith(".ts") ? ["--import", "tsx/esm", entry2] : [entry2];
|
|
1269
|
+
}
|
|
1270
|
+
async function responds(url) {
|
|
1271
|
+
try {
|
|
1272
|
+
const res = await fetch(url);
|
|
1273
|
+
return res.status >= 200 && res.status < 500;
|
|
1274
|
+
} catch {
|
|
1275
|
+
return false;
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
function probeHost(host) {
|
|
1279
|
+
if (host === "0.0.0.0") return "127.0.0.1";
|
|
1280
|
+
if (host === "::") return "::1";
|
|
1281
|
+
return host;
|
|
1282
|
+
}
|
|
1283
|
+
function isTcpPortOpen(host, port) {
|
|
1284
|
+
return new Promise((resolve3) => {
|
|
1285
|
+
const socket = connect({ host: probeHost(host), port: Number(port) });
|
|
1286
|
+
const done = (open) => {
|
|
1287
|
+
socket.removeAllListeners();
|
|
1288
|
+
socket.destroy();
|
|
1289
|
+
resolve3(open);
|
|
1290
|
+
};
|
|
1291
|
+
socket.setTimeout(600);
|
|
1292
|
+
socket.once("connect", () => done(true));
|
|
1293
|
+
socket.once("timeout", () => done(false));
|
|
1294
|
+
socket.once("error", () => done(false));
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
async function bazilionDaemonRunning(url, port) {
|
|
1298
|
+
try {
|
|
1299
|
+
const res = await fetch(`${url}/api/health`);
|
|
1300
|
+
if (res.ok) {
|
|
1301
|
+
const body = await res.json().catch(() => null);
|
|
1302
|
+
if (body?.ok === true) return true;
|
|
1303
|
+
}
|
|
1304
|
+
} catch {
|
|
1305
|
+
return false;
|
|
1306
|
+
}
|
|
1307
|
+
throw new Error(
|
|
1308
|
+
`port ${port} is already serving HTTP, but it is not a healthy bazilion daemon. Re-run with --daemon-port <free-port>.`
|
|
1309
|
+
);
|
|
1310
|
+
}
|
|
1311
|
+
async function bazilionWebRunning(url, port) {
|
|
1312
|
+
try {
|
|
1313
|
+
const res = await fetch(url);
|
|
1314
|
+
if (res.status >= 200 && res.status < 500) {
|
|
1315
|
+
const html = await res.text();
|
|
1316
|
+
if (html.includes("<title>bazilion</title>") || html.includes(">bazilion<")) {
|
|
1317
|
+
return true;
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
} catch {
|
|
1321
|
+
return false;
|
|
1322
|
+
}
|
|
1323
|
+
throw new Error(
|
|
1324
|
+
`port ${port} is already serving HTTP, but it is not the bazilion web UI. Re-run with --port <free-port>.`
|
|
1325
|
+
);
|
|
1326
|
+
}
|
|
1327
|
+
async function waitFor(url, label, timeoutMs = 2e4) {
|
|
1328
|
+
const start = Date.now();
|
|
1329
|
+
while (Date.now() - start < timeoutMs) {
|
|
1330
|
+
if (await responds(url)) return;
|
|
1331
|
+
await new Promise((r) => setTimeout(r, 150));
|
|
1332
|
+
}
|
|
1333
|
+
throw new Error(`timed out waiting for ${label} at ${url}`);
|
|
1334
|
+
}
|
|
1335
|
+
function openBrowser(url) {
|
|
1336
|
+
const platform = process.platform;
|
|
1337
|
+
const cmd = platform === "darwin" ? "open" : platform === "win32" ? "cmd" : process.env.BROWSER || "xdg-open";
|
|
1338
|
+
const args = platform === "win32" ? ["/c", "start", "", url] : [url];
|
|
1339
|
+
const proc = spawn2(cmd, args, { detached: true, stdio: "ignore" });
|
|
1340
|
+
proc.unref();
|
|
1341
|
+
}
|
|
1342
|
+
function spawnProcess(label, entry2, env) {
|
|
1343
|
+
if (!existsSync3(entry2)) {
|
|
1344
|
+
throw new Error(`${label} entry not found at ${entry2}`);
|
|
1345
|
+
}
|
|
1346
|
+
return spawn2(process.execPath, nodeArgs(entry2), {
|
|
1347
|
+
env,
|
|
1348
|
+
stdio: "inherit"
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
var dashboardCommand = defineCommand6({
|
|
1352
|
+
meta: {
|
|
1353
|
+
name: "dashboard",
|
|
1354
|
+
description: "Start the bazilion daemon and bundled web UI"
|
|
1355
|
+
},
|
|
1356
|
+
args: {
|
|
1357
|
+
port: { type: "string", description: "Web UI port (default 4322)" },
|
|
1358
|
+
host: {
|
|
1359
|
+
type: "string",
|
|
1360
|
+
description: "Web UI host (default 127.0.0.1). Use loopback unless you know why not."
|
|
1361
|
+
},
|
|
1362
|
+
"daemon-port": { type: "string", description: "Daemon port (default 4321)" },
|
|
1363
|
+
"daemon-host": {
|
|
1364
|
+
type: "string",
|
|
1365
|
+
description: "Daemon host (default 127.0.0.1). Use loopback unless you know why not."
|
|
1366
|
+
},
|
|
1367
|
+
open: {
|
|
1368
|
+
type: "boolean",
|
|
1369
|
+
description: "Open the dashboard in your browser (default true)",
|
|
1370
|
+
default: true
|
|
1371
|
+
}
|
|
1372
|
+
},
|
|
1373
|
+
async run({ args }) {
|
|
1374
|
+
const webHost = args.host ?? "127.0.0.1";
|
|
1375
|
+
const webPort = args.port ?? "4322";
|
|
1376
|
+
const daemonHost = args["daemon-host"] ?? "127.0.0.1";
|
|
1377
|
+
const daemonPort = args["daemon-port"] ?? "4321";
|
|
1378
|
+
const daemonUrl = `http://${daemonHost}:${daemonPort}`;
|
|
1379
|
+
const webUrl = `http://${webHost}:${webPort}`;
|
|
1380
|
+
const authFile = resolveCliPaths().authFile;
|
|
1381
|
+
if (webHost !== "127.0.0.1" && webHost !== "localhost" && webHost !== "::1") {
|
|
1382
|
+
console.error("");
|
|
1383
|
+
console.error(
|
|
1384
|
+
`warning: binding web UI to ${webHost} - the dashboard may be reachable beyond loopback.`
|
|
1385
|
+
);
|
|
1386
|
+
console.error(" keep it behind a trusted network or a TLS proxy.");
|
|
1387
|
+
console.error("");
|
|
1388
|
+
}
|
|
1389
|
+
const children = [];
|
|
1390
|
+
let signalled = false;
|
|
1391
|
+
const terminateChildren = () => {
|
|
1392
|
+
signalled = true;
|
|
1393
|
+
for (const child of children) {
|
|
1394
|
+
try {
|
|
1395
|
+
child.kill("SIGTERM");
|
|
1396
|
+
} catch {
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
};
|
|
1400
|
+
try {
|
|
1401
|
+
const daemonRunning = await bazilionDaemonRunning(daemonUrl, daemonPort);
|
|
1402
|
+
if (daemonRunning) {
|
|
1403
|
+
console.log(`using existing bazilion daemon at ${daemonUrl}`);
|
|
1404
|
+
} else {
|
|
1405
|
+
if (await isTcpPortOpen(daemonHost, daemonPort)) {
|
|
1406
|
+
throw new Error(
|
|
1407
|
+
`daemon port ${daemonPort} is already in use. Re-run with --daemon-port <free-port>.`
|
|
1408
|
+
);
|
|
1409
|
+
}
|
|
1410
|
+
console.log(`starting bazilion daemon at ${daemonUrl}`);
|
|
1411
|
+
const daemon = spawnProcess("daemon", daemonEntry, {
|
|
1412
|
+
...process.env,
|
|
1413
|
+
HOST: daemonHost,
|
|
1414
|
+
PORT: daemonPort
|
|
1415
|
+
});
|
|
1416
|
+
children.push(daemon);
|
|
1417
|
+
await waitFor(`${daemonUrl}/api/health`, "bazilion daemon");
|
|
1418
|
+
}
|
|
1419
|
+
const webRunning = await bazilionWebRunning(webUrl, webPort);
|
|
1420
|
+
if (webRunning) {
|
|
1421
|
+
console.log(`using existing bazilion web UI at ${webUrl}`);
|
|
1422
|
+
} else {
|
|
1423
|
+
if (await isTcpPortOpen(webHost, webPort)) {
|
|
1424
|
+
throw new Error(
|
|
1425
|
+
`web UI port ${webPort} is already in use. Re-run with --port <free-port>.`
|
|
1426
|
+
);
|
|
1427
|
+
}
|
|
1428
|
+
if (!existsSync3(join2(webDist, "server", "server.js"))) {
|
|
1429
|
+
throw new Error(
|
|
1430
|
+
`bazilion web UI bundle not found at ${webDist}. Run "pnpm --filter @bazilion/web build" from a source checkout, or reinstall the published package.`
|
|
1431
|
+
);
|
|
1432
|
+
}
|
|
1433
|
+
console.log(`starting bazilion web UI at ${webUrl}`);
|
|
1434
|
+
const web = spawnProcess("web UI", webServerEntry, {
|
|
1435
|
+
...process.env,
|
|
1436
|
+
WEB_HOST: webHost,
|
|
1437
|
+
WEB_PORT: webPort,
|
|
1438
|
+
BAZILION_DAEMON: daemonUrl,
|
|
1439
|
+
BAZILION_WEB_DIST: webDist
|
|
1440
|
+
});
|
|
1441
|
+
children.push(web);
|
|
1442
|
+
await waitFor(webUrl, "bazilion web UI");
|
|
1443
|
+
}
|
|
1444
|
+
console.log("");
|
|
1445
|
+
console.log(`dashboard: ${webUrl}`);
|
|
1446
|
+
console.log(`token: ${authFile}`);
|
|
1447
|
+
if (args.open) openBrowser(webUrl);
|
|
1448
|
+
} catch (err) {
|
|
1449
|
+
terminateChildren();
|
|
1450
|
+
throw err;
|
|
1451
|
+
}
|
|
1452
|
+
if (children.length === 0) return;
|
|
1453
|
+
process.on("SIGINT", terminateChildren);
|
|
1454
|
+
process.on("SIGTERM", terminateChildren);
|
|
1455
|
+
await new Promise((resolve3) => {
|
|
1456
|
+
let remaining = children.length;
|
|
1457
|
+
for (const child of children) {
|
|
1458
|
+
child.on("close", (code) => {
|
|
1459
|
+
remaining--;
|
|
1460
|
+
if (!signalled && code && code !== 0) process.exitCode = code;
|
|
1461
|
+
if (remaining === 0) resolve3();
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
});
|
|
1465
|
+
if (signalled) process.exitCode = 0;
|
|
1466
|
+
}
|
|
1467
|
+
});
|
|
1468
|
+
|
|
1469
|
+
// src/commands/doctor.ts
|
|
1470
|
+
import { defineCommand as defineCommand7 } from "citty";
|
|
1471
|
+
var doctorCommand = defineCommand7({
|
|
1249
1472
|
meta: { name: "doctor", description: "Diagnose your bazilion install" },
|
|
1250
1473
|
async run() {
|
|
1251
1474
|
const client = createClient2();
|
|
@@ -1356,8 +1579,8 @@ var doctorCommand = defineCommand6({
|
|
|
1356
1579
|
// src/commands/group.ts
|
|
1357
1580
|
import { readFileSync as readFileSync3 } from "fs";
|
|
1358
1581
|
import { stdin as stdin2 } from "process";
|
|
1359
|
-
import { defineCommand as
|
|
1360
|
-
var addCmd =
|
|
1582
|
+
import { defineCommand as defineCommand8 } from "citty";
|
|
1583
|
+
var addCmd = defineCommand8({
|
|
1361
1584
|
meta: {
|
|
1362
1585
|
name: "add",
|
|
1363
1586
|
description: "Register a group at ~/.bazilion/groups/<slug>/ (use --link to point at an existing tree)"
|
|
@@ -1381,7 +1604,7 @@ var addCmd = defineCommand7({
|
|
|
1381
1604
|
console.log(`registered group ${g.id} at ${g.path}`);
|
|
1382
1605
|
}
|
|
1383
1606
|
});
|
|
1384
|
-
var listCmd3 =
|
|
1607
|
+
var listCmd3 = defineCommand8({
|
|
1385
1608
|
meta: { name: "list", description: "List groups" },
|
|
1386
1609
|
async run() {
|
|
1387
1610
|
const client = createClient2();
|
|
@@ -1394,7 +1617,7 @@ var listCmd3 = defineCommand7({
|
|
|
1394
1617
|
for (const line of columnize(rows)) console.log(line);
|
|
1395
1618
|
}
|
|
1396
1619
|
});
|
|
1397
|
-
var rmCmd2 =
|
|
1620
|
+
var rmCmd2 = defineCommand8({
|
|
1398
1621
|
meta: { name: "rm", description: "Remove a group registration" },
|
|
1399
1622
|
args: {
|
|
1400
1623
|
id: { type: "positional", required: true }
|
|
@@ -1410,7 +1633,7 @@ async function readStdin() {
|
|
|
1410
1633
|
for await (const chunk of stdin2) chunks.push(chunk);
|
|
1411
1634
|
return Buffer.concat(chunks).toString("utf8");
|
|
1412
1635
|
}
|
|
1413
|
-
var userMdShowCmd =
|
|
1636
|
+
var userMdShowCmd = defineCommand8({
|
|
1414
1637
|
meta: { name: "show", description: "Print the group's USER.md" },
|
|
1415
1638
|
args: { id: { type: "positional", required: true } },
|
|
1416
1639
|
async run({ args }) {
|
|
@@ -1420,7 +1643,7 @@ var userMdShowCmd = defineCommand7({
|
|
|
1420
1643
|
if (g.userMd && !g.userMd.endsWith("\n")) process.stdout.write("\n");
|
|
1421
1644
|
}
|
|
1422
1645
|
});
|
|
1423
|
-
var userMdSetCmd =
|
|
1646
|
+
var userMdSetCmd = defineCommand8({
|
|
1424
1647
|
meta: {
|
|
1425
1648
|
name: "set",
|
|
1426
1649
|
description: "Replace the group's USER.md (from --file, --from-stdin, or inline text)"
|
|
@@ -1446,7 +1669,7 @@ var userMdSetCmd = defineCommand7({
|
|
|
1446
1669
|
console.log(`updated USER.md for group ${args.id} (${content.length} bytes)`);
|
|
1447
1670
|
}
|
|
1448
1671
|
});
|
|
1449
|
-
var userMdClearCmd =
|
|
1672
|
+
var userMdClearCmd = defineCommand8({
|
|
1450
1673
|
meta: { name: "clear", description: "Clear the group's USER.md to empty" },
|
|
1451
1674
|
args: { id: { type: "positional", required: true } },
|
|
1452
1675
|
async run({ args }) {
|
|
@@ -1456,7 +1679,7 @@ var userMdClearCmd = defineCommand7({
|
|
|
1456
1679
|
console.log(`cleared USER.md for group ${args.id}`);
|
|
1457
1680
|
}
|
|
1458
1681
|
});
|
|
1459
|
-
var userMdCmd =
|
|
1682
|
+
var userMdCmd = defineCommand8({
|
|
1460
1683
|
meta: { name: "user-md", description: "View or edit a group's USER.md" },
|
|
1461
1684
|
subCommands: {
|
|
1462
1685
|
show: userMdShowCmd,
|
|
@@ -1464,7 +1687,7 @@ var userMdCmd = defineCommand7({
|
|
|
1464
1687
|
clear: userMdClearCmd
|
|
1465
1688
|
}
|
|
1466
1689
|
});
|
|
1467
|
-
var topicFormatShowCmd =
|
|
1690
|
+
var topicFormatShowCmd = defineCommand8({
|
|
1468
1691
|
meta: { name: "show", description: "Print the group's Telegram topic-name template" },
|
|
1469
1692
|
args: { id: { type: "positional", required: true } },
|
|
1470
1693
|
async run({ args }) {
|
|
@@ -1473,7 +1696,7 @@ var topicFormatShowCmd = defineCommand7({
|
|
|
1473
1696
|
console.log(g.telegramTopicNameFormat ?? "(default naming)");
|
|
1474
1697
|
}
|
|
1475
1698
|
});
|
|
1476
|
-
var topicFormatSetCmd =
|
|
1699
|
+
var topicFormatSetCmd = defineCommand8({
|
|
1477
1700
|
meta: {
|
|
1478
1701
|
name: "set",
|
|
1479
1702
|
description: "Set the topic-name template. Tokens: {agent.name} {group.name} {group.slug} (must include {agent.name})"
|
|
@@ -1493,7 +1716,7 @@ var topicFormatSetCmd = defineCommand7({
|
|
|
1493
1716
|
console.log(`set topic-name template for group ${args.id}: ${g.telegramTopicNameFormat}`);
|
|
1494
1717
|
}
|
|
1495
1718
|
});
|
|
1496
|
-
var topicFormatClearCmd =
|
|
1719
|
+
var topicFormatClearCmd = defineCommand8({
|
|
1497
1720
|
meta: { name: "clear", description: "Clear the template (revert to built-in naming)" },
|
|
1498
1721
|
args: { id: { type: "positional", required: true } },
|
|
1499
1722
|
async run({ args }) {
|
|
@@ -1503,7 +1726,7 @@ var topicFormatClearCmd = defineCommand7({
|
|
|
1503
1726
|
console.log(`cleared topic-name template for group ${args.id}`);
|
|
1504
1727
|
}
|
|
1505
1728
|
});
|
|
1506
|
-
var topicFormatCmd =
|
|
1729
|
+
var topicFormatCmd = defineCommand8({
|
|
1507
1730
|
meta: {
|
|
1508
1731
|
name: "topic-format",
|
|
1509
1732
|
description: "View or edit a group's Telegram forum-topic name template"
|
|
@@ -1514,7 +1737,7 @@ var topicFormatCmd = defineCommand7({
|
|
|
1514
1737
|
clear: topicFormatClearCmd
|
|
1515
1738
|
}
|
|
1516
1739
|
});
|
|
1517
|
-
var groupCommand =
|
|
1740
|
+
var groupCommand = defineCommand8({
|
|
1518
1741
|
meta: { name: "group", description: "Manage groups (collaboration contexts)" },
|
|
1519
1742
|
subCommands: {
|
|
1520
1743
|
add: addCmd,
|
|
@@ -1526,7 +1749,7 @@ var groupCommand = defineCommand7({
|
|
|
1526
1749
|
});
|
|
1527
1750
|
|
|
1528
1751
|
// src/commands/inbox.ts
|
|
1529
|
-
import { defineCommand as
|
|
1752
|
+
import { defineCommand as defineCommand9 } from "citty";
|
|
1530
1753
|
function decodeText(payload) {
|
|
1531
1754
|
try {
|
|
1532
1755
|
const obj = JSON.parse(payload);
|
|
@@ -1542,7 +1765,7 @@ function messageRow(m) {
|
|
|
1542
1765
|
const preview = text.length > 60 ? `${text.slice(0, 60)}\u2026` : text;
|
|
1543
1766
|
return [m.id, state, when, `from:${m.fromAgentId.slice(0, 8)}`, `"${preview}"`];
|
|
1544
1767
|
}
|
|
1545
|
-
var listCmd4 =
|
|
1768
|
+
var listCmd4 = defineCommand9({
|
|
1546
1769
|
meta: { name: "list", description: "List messages in an agent inbox" },
|
|
1547
1770
|
args: {
|
|
1548
1771
|
agent: { type: "positional", required: true, description: "Recipient agent id" },
|
|
@@ -1561,7 +1784,7 @@ var listCmd4 = defineCommand8({
|
|
|
1561
1784
|
for (const line of columnize(messages.map(messageRow))) console.log(line);
|
|
1562
1785
|
}
|
|
1563
1786
|
});
|
|
1564
|
-
var showCmd2 =
|
|
1787
|
+
var showCmd2 = defineCommand9({
|
|
1565
1788
|
meta: { name: "show", description: "Show a single message in full" },
|
|
1566
1789
|
args: {
|
|
1567
1790
|
id: { type: "positional", required: true, description: "Message id" }
|
|
@@ -1581,7 +1804,7 @@ var showCmd2 = defineCommand8({
|
|
|
1581
1804
|
console.log(decodeText(m.payload));
|
|
1582
1805
|
}
|
|
1583
1806
|
});
|
|
1584
|
-
var readCmd =
|
|
1807
|
+
var readCmd = defineCommand9({
|
|
1585
1808
|
meta: { name: "read", description: "Mark a message as read" },
|
|
1586
1809
|
args: {
|
|
1587
1810
|
id: { type: "positional", required: true, description: "Message id" }
|
|
@@ -1592,7 +1815,7 @@ var readCmd = defineCommand8({
|
|
|
1592
1815
|
console.log(`marked read: ${args.id}`);
|
|
1593
1816
|
}
|
|
1594
1817
|
});
|
|
1595
|
-
var inboxCommand =
|
|
1818
|
+
var inboxCommand = defineCommand9({
|
|
1596
1819
|
meta: { name: "inbox", description: "Inspect agent inboxes" },
|
|
1597
1820
|
subCommands: {
|
|
1598
1821
|
list: listCmd4,
|
|
@@ -1602,8 +1825,8 @@ var inboxCommand = defineCommand8({
|
|
|
1602
1825
|
});
|
|
1603
1826
|
|
|
1604
1827
|
// src/commands/login.ts
|
|
1605
|
-
import { existsSync as
|
|
1606
|
-
import { defineCommand as
|
|
1828
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
1829
|
+
import { defineCommand as defineCommand10 } from "citty";
|
|
1607
1830
|
function normalizeServer(raw) {
|
|
1608
1831
|
let url;
|
|
1609
1832
|
try {
|
|
@@ -1623,7 +1846,7 @@ async function verifyToken(server, token) {
|
|
|
1623
1846
|
if (res.status === 401) throw new Error("server rejected token (401)");
|
|
1624
1847
|
if (!res.ok) throw new Error(`server returned ${res.status} from /api/health`);
|
|
1625
1848
|
}
|
|
1626
|
-
var loginCommand =
|
|
1849
|
+
var loginCommand = defineCommand10({
|
|
1627
1850
|
meta: {
|
|
1628
1851
|
name: "login",
|
|
1629
1852
|
description: "Save a remote bazilion server + token pair to auth.json"
|
|
@@ -1636,7 +1859,7 @@ var loginCommand = defineCommand9({
|
|
|
1636
1859
|
},
|
|
1637
1860
|
async run({ args }) {
|
|
1638
1861
|
const paths = resolveCliPaths();
|
|
1639
|
-
if (!
|
|
1862
|
+
if (!existsSync4(paths.authFile)) {
|
|
1640
1863
|
throw new Error(
|
|
1641
1864
|
`${paths.authFile} not found. Start the daemon with "bazilion serve" first \u2014 login stores the remote there.`
|
|
1642
1865
|
);
|
|
@@ -1671,7 +1894,7 @@ var loginCommand = defineCommand9({
|
|
|
1671
1894
|
});
|
|
1672
1895
|
|
|
1673
1896
|
// src/commands/mcp.ts
|
|
1674
|
-
import { defineCommand as
|
|
1897
|
+
import { defineCommand as defineCommand11 } from "citty";
|
|
1675
1898
|
function serverRow(s) {
|
|
1676
1899
|
const where = s.transport === "stdio" ? `${s.command} ${s.args.join(" ")}`.trim() : s.url ?? "";
|
|
1677
1900
|
return [
|
|
@@ -1683,7 +1906,7 @@ function serverRow(s) {
|
|
|
1683
1906
|
where
|
|
1684
1907
|
];
|
|
1685
1908
|
}
|
|
1686
|
-
var addCmd2 =
|
|
1909
|
+
var addCmd2 = defineCommand11({
|
|
1687
1910
|
meta: { name: "add", description: "Register an MCP server" },
|
|
1688
1911
|
args: {
|
|
1689
1912
|
name: { type: "positional", required: true, description: "Unique name ([a-zA-Z0-9_])" },
|
|
@@ -1710,7 +1933,7 @@ var addCmd2 = defineCommand10({
|
|
|
1710
1933
|
console.log(`${server.id} ${server.name} ${server.transport}`);
|
|
1711
1934
|
}
|
|
1712
1935
|
});
|
|
1713
|
-
var listCmd5 =
|
|
1936
|
+
var listCmd5 = defineCommand11({
|
|
1714
1937
|
meta: { name: "list", description: "List MCP servers" },
|
|
1715
1938
|
async run() {
|
|
1716
1939
|
const client = createClient2();
|
|
@@ -1722,7 +1945,7 @@ var listCmd5 = defineCommand10({
|
|
|
1722
1945
|
for (const line of columnize(servers.map(serverRow))) console.log(line);
|
|
1723
1946
|
}
|
|
1724
1947
|
});
|
|
1725
|
-
var showCmd3 =
|
|
1948
|
+
var showCmd3 = defineCommand11({
|
|
1726
1949
|
meta: { name: "show", description: "Show one MCP server" },
|
|
1727
1950
|
args: { id: { type: "positional", required: true } },
|
|
1728
1951
|
async run({ args }) {
|
|
@@ -1731,7 +1954,7 @@ var showCmd3 = defineCommand10({
|
|
|
1731
1954
|
console.log(JSON.stringify(server, null, 2));
|
|
1732
1955
|
}
|
|
1733
1956
|
});
|
|
1734
|
-
var rmCmd3 =
|
|
1957
|
+
var rmCmd3 = defineCommand11({
|
|
1735
1958
|
meta: { name: "rm", description: "Delete an MCP server" },
|
|
1736
1959
|
args: { id: { type: "positional", required: true } },
|
|
1737
1960
|
async run({ args }) {
|
|
@@ -1740,7 +1963,7 @@ var rmCmd3 = defineCommand10({
|
|
|
1740
1963
|
console.log(`removed MCP server ${args.id}`);
|
|
1741
1964
|
}
|
|
1742
1965
|
});
|
|
1743
|
-
var enableCmd =
|
|
1966
|
+
var enableCmd = defineCommand11({
|
|
1744
1967
|
meta: { name: "enable", description: "Enable an MCP server" },
|
|
1745
1968
|
args: { id: { type: "positional", required: true } },
|
|
1746
1969
|
async run({ args }) {
|
|
@@ -1749,7 +1972,7 @@ var enableCmd = defineCommand10({
|
|
|
1749
1972
|
console.log(`enabled MCP server ${args.id}`);
|
|
1750
1973
|
}
|
|
1751
1974
|
});
|
|
1752
|
-
var disableCmd =
|
|
1975
|
+
var disableCmd = defineCommand11({
|
|
1753
1976
|
meta: { name: "disable", description: "Disable an MCP server" },
|
|
1754
1977
|
args: { id: { type: "positional", required: true } },
|
|
1755
1978
|
async run({ args }) {
|
|
@@ -1758,7 +1981,7 @@ var disableCmd = defineCommand10({
|
|
|
1758
1981
|
console.log(`disabled MCP server ${args.id}`);
|
|
1759
1982
|
}
|
|
1760
1983
|
});
|
|
1761
|
-
var testCmd =
|
|
1984
|
+
var testCmd = defineCommand11({
|
|
1762
1985
|
meta: { name: "test", description: "Connect to a server and list its tools" },
|
|
1763
1986
|
args: { id: { type: "positional", required: true } },
|
|
1764
1987
|
async run({ args }) {
|
|
@@ -1776,7 +1999,7 @@ var testCmd = defineCommand10({
|
|
|
1776
1999
|
for (const t of tools) console.log(` ${t.name} ${t.description}`);
|
|
1777
2000
|
}
|
|
1778
2001
|
});
|
|
1779
|
-
var mcpCommand =
|
|
2002
|
+
var mcpCommand = defineCommand11({
|
|
1780
2003
|
meta: { name: "mcp", description: "Manage MCP servers" },
|
|
1781
2004
|
subCommands: {
|
|
1782
2005
|
add: addCmd2,
|
|
@@ -1790,11 +2013,11 @@ var mcpCommand = defineCommand10({
|
|
|
1790
2013
|
});
|
|
1791
2014
|
|
|
1792
2015
|
// src/commands/memory.ts
|
|
1793
|
-
import { defineCommand as
|
|
2016
|
+
import { defineCommand as defineCommand12 } from "citty";
|
|
1794
2017
|
function encodeKey(key) {
|
|
1795
2018
|
return key.split("/").map(encodeURIComponent).join("/");
|
|
1796
2019
|
}
|
|
1797
|
-
var writeCmd =
|
|
2020
|
+
var writeCmd = defineCommand12({
|
|
1798
2021
|
meta: { name: "write", description: "Write an entry into a group's shared memory" },
|
|
1799
2022
|
args: {
|
|
1800
2023
|
group: { type: "positional", required: true, description: "Group slug" },
|
|
@@ -1810,7 +2033,7 @@ var writeCmd = defineCommand11({
|
|
|
1810
2033
|
console.log(`wrote ${entry2.key} (${entry2.content.length} bytes)`);
|
|
1811
2034
|
}
|
|
1812
2035
|
});
|
|
1813
|
-
var readCmd2 =
|
|
2036
|
+
var readCmd2 = defineCommand12({
|
|
1814
2037
|
meta: { name: "read", description: "Read an entry from a group's shared memory" },
|
|
1815
2038
|
args: {
|
|
1816
2039
|
group: { type: "positional", required: true, description: "Group slug" },
|
|
@@ -1824,7 +2047,7 @@ var readCmd2 = defineCommand11({
|
|
|
1824
2047
|
console.log(entry2.content);
|
|
1825
2048
|
}
|
|
1826
2049
|
});
|
|
1827
|
-
var searchCmd =
|
|
2050
|
+
var searchCmd = defineCommand12({
|
|
1828
2051
|
meta: { name: "search", description: "Search a group's shared memory" },
|
|
1829
2052
|
args: {
|
|
1830
2053
|
group: { type: "positional", required: true, description: "Group slug" },
|
|
@@ -1845,7 +2068,7 @@ var searchCmd = defineCommand11({
|
|
|
1845
2068
|
}
|
|
1846
2069
|
}
|
|
1847
2070
|
});
|
|
1848
|
-
var listCmd6 =
|
|
2071
|
+
var listCmd6 = defineCommand12({
|
|
1849
2072
|
meta: { name: "list", description: "List all entries in a group's shared memory" },
|
|
1850
2073
|
args: {
|
|
1851
2074
|
group: { type: "positional", required: true, description: "Group slug" }
|
|
@@ -1862,7 +2085,7 @@ var listCmd6 = defineCommand11({
|
|
|
1862
2085
|
}
|
|
1863
2086
|
}
|
|
1864
2087
|
});
|
|
1865
|
-
var rmCmd4 =
|
|
2088
|
+
var rmCmd4 = defineCommand12({
|
|
1866
2089
|
meta: { name: "rm", description: "Remove an entry from a group's shared memory" },
|
|
1867
2090
|
args: {
|
|
1868
2091
|
group: { type: "positional", required: true, description: "Group slug" },
|
|
@@ -1874,7 +2097,7 @@ var rmCmd4 = defineCommand11({
|
|
|
1874
2097
|
console.log(`removed ${args.key}`);
|
|
1875
2098
|
}
|
|
1876
2099
|
});
|
|
1877
|
-
var memoryCommand =
|
|
2100
|
+
var memoryCommand = defineCommand12({
|
|
1878
2101
|
meta: {
|
|
1879
2102
|
name: "memory",
|
|
1880
2103
|
description: "Manage a group's shared memory (BM25-indexed markdown notes)"
|
|
@@ -1889,11 +2112,11 @@ var memoryCommand = defineCommand11({
|
|
|
1889
2112
|
});
|
|
1890
2113
|
|
|
1891
2114
|
// src/commands/profile.ts
|
|
1892
|
-
import { spawn as
|
|
2115
|
+
import { spawn as spawn3 } from "child_process";
|
|
1893
2116
|
import { randomBytes } from "crypto";
|
|
1894
2117
|
import { readFileSync as readFileSync5, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
1895
2118
|
import { tmpdir } from "os";
|
|
1896
|
-
import { join as
|
|
2119
|
+
import { join as join3 } from "path";
|
|
1897
2120
|
|
|
1898
2121
|
// ../../packages/api-types/src/index.ts
|
|
1899
2122
|
var PROFILE_FILES = [
|
|
@@ -1907,7 +2130,7 @@ var PROFILE_FILES = [
|
|
|
1907
2130
|
];
|
|
1908
2131
|
|
|
1909
2132
|
// src/commands/profile.ts
|
|
1910
|
-
import { defineCommand as
|
|
2133
|
+
import { defineCommand as defineCommand13 } from "citty";
|
|
1911
2134
|
function splitCsv(v) {
|
|
1912
2135
|
if (!v) return void 0;
|
|
1913
2136
|
const out = v.split(",").map((s) => s.trim()).filter(Boolean);
|
|
@@ -1918,7 +2141,7 @@ function parseSkillsMode(v) {
|
|
|
1918
2141
|
if (v === "all" || v === "selected") return v;
|
|
1919
2142
|
throw new Error(`--skills-mode must be 'all' or 'selected', got '${v}'`);
|
|
1920
2143
|
}
|
|
1921
|
-
var createCmd2 =
|
|
2144
|
+
var createCmd2 = defineCommand13({
|
|
1922
2145
|
meta: { name: "create", description: "Create a new profile" },
|
|
1923
2146
|
args: {
|
|
1924
2147
|
id: { type: "positional", required: true, description: "Profile slug" },
|
|
@@ -1986,7 +2209,7 @@ var createCmd2 = defineCommand12({
|
|
|
1986
2209
|
console.log(`created profile ${profile.id} at ${profile.dir}`);
|
|
1987
2210
|
}
|
|
1988
2211
|
});
|
|
1989
|
-
var listCmd7 =
|
|
2212
|
+
var listCmd7 = defineCommand13({
|
|
1990
2213
|
meta: { name: "list", description: "List profiles" },
|
|
1991
2214
|
async run() {
|
|
1992
2215
|
const client = createClient2();
|
|
@@ -1999,7 +2222,7 @@ var listCmd7 = defineCommand12({
|
|
|
1999
2222
|
for (const line of columnize(rows)) console.log(line);
|
|
2000
2223
|
}
|
|
2001
2224
|
});
|
|
2002
|
-
var showCmd4 =
|
|
2225
|
+
var showCmd4 = defineCommand13({
|
|
2003
2226
|
meta: { name: "show", description: "Show profile details" },
|
|
2004
2227
|
args: {
|
|
2005
2228
|
id: { type: "positional", required: true }
|
|
@@ -2025,7 +2248,7 @@ var showCmd4 = defineCommand12({
|
|
|
2025
2248
|
}
|
|
2026
2249
|
}
|
|
2027
2250
|
});
|
|
2028
|
-
var editCmd2 =
|
|
2251
|
+
var editCmd2 = defineCommand13({
|
|
2029
2252
|
meta: { name: "edit", description: "Open a profile file in $EDITOR" },
|
|
2030
2253
|
args: {
|
|
2031
2254
|
id: { type: "positional", required: true },
|
|
@@ -2044,12 +2267,12 @@ var editCmd2 = defineCommand12({
|
|
|
2044
2267
|
const { content } = await client.get(
|
|
2045
2268
|
`/api/profiles/${args.id}/files/${file}`
|
|
2046
2269
|
);
|
|
2047
|
-
const tmpPath =
|
|
2270
|
+
const tmpPath = join3(tmpdir(), `bazilion-${args.id}-${file}-${randomBytes(4).toString("hex")}`);
|
|
2048
2271
|
writeFileSync3(tmpPath, content);
|
|
2049
2272
|
try {
|
|
2050
2273
|
const editor = process.env.EDITOR ?? process.env.VISUAL ?? "vi";
|
|
2051
2274
|
const code = await new Promise((resolve3, reject) => {
|
|
2052
|
-
const child =
|
|
2275
|
+
const child = spawn3(editor, [tmpPath], { stdio: "inherit" });
|
|
2053
2276
|
child.on("error", reject);
|
|
2054
2277
|
child.on("close", (c) => resolve3(c ?? 0));
|
|
2055
2278
|
});
|
|
@@ -2070,7 +2293,7 @@ var editCmd2 = defineCommand12({
|
|
|
2070
2293
|
}
|
|
2071
2294
|
}
|
|
2072
2295
|
});
|
|
2073
|
-
var updateCmd =
|
|
2296
|
+
var updateCmd = defineCommand13({
|
|
2074
2297
|
meta: {
|
|
2075
2298
|
name: "update",
|
|
2076
2299
|
description: "Update profile settings (name, model, skills-mode, skills)"
|
|
@@ -2104,7 +2327,7 @@ var updateCmd = defineCommand12({
|
|
|
2104
2327
|
console.log(`updated profile ${profile.id}`);
|
|
2105
2328
|
}
|
|
2106
2329
|
});
|
|
2107
|
-
var deleteCmd2 =
|
|
2330
|
+
var deleteCmd2 = defineCommand13({
|
|
2108
2331
|
meta: { name: "delete", description: "Permanently delete a profile and its files" },
|
|
2109
2332
|
args: {
|
|
2110
2333
|
id: { type: "positional", required: true }
|
|
@@ -2115,7 +2338,7 @@ var deleteCmd2 = defineCommand12({
|
|
|
2115
2338
|
console.log(`deleted profile ${args.id}`);
|
|
2116
2339
|
}
|
|
2117
2340
|
});
|
|
2118
|
-
var profileCommand =
|
|
2341
|
+
var profileCommand = defineCommand13({
|
|
2119
2342
|
meta: { name: "profile", description: "Manage profiles" },
|
|
2120
2343
|
subCommands: {
|
|
2121
2344
|
create: createCmd2,
|
|
@@ -2128,13 +2351,13 @@ var profileCommand = defineCommand12({
|
|
|
2128
2351
|
});
|
|
2129
2352
|
|
|
2130
2353
|
// src/commands/profile-group.ts
|
|
2131
|
-
import { spawn as
|
|
2354
|
+
import { spawn as spawn4 } from "child_process";
|
|
2132
2355
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
2133
2356
|
import { readFileSync as readFileSync6, rmSync as rmSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
2134
2357
|
import { tmpdir as tmpdir2 } from "os";
|
|
2135
|
-
import { join as
|
|
2136
|
-
import { defineCommand as
|
|
2137
|
-
var createCmd3 =
|
|
2358
|
+
import { join as join4 } from "path";
|
|
2359
|
+
import { defineCommand as defineCommand14 } from "citty";
|
|
2360
|
+
var createCmd3 = defineCommand14({
|
|
2138
2361
|
meta: { name: "create", description: "Create a new profile group (team template)" },
|
|
2139
2362
|
args: {
|
|
2140
2363
|
id: { type: "positional", required: true, description: "Profile group slug" },
|
|
@@ -2153,7 +2376,7 @@ var createCmd3 = defineCommand13({
|
|
|
2153
2376
|
console.log(`created profile group ${created.id}`);
|
|
2154
2377
|
}
|
|
2155
2378
|
});
|
|
2156
|
-
var listCmd8 =
|
|
2379
|
+
var listCmd8 = defineCommand14({
|
|
2157
2380
|
meta: { name: "list", description: "List profile groups" },
|
|
2158
2381
|
async run() {
|
|
2159
2382
|
const client = createClient2();
|
|
@@ -2166,7 +2389,7 @@ var listCmd8 = defineCommand13({
|
|
|
2166
2389
|
for (const line of columnize(rows)) console.log(line);
|
|
2167
2390
|
}
|
|
2168
2391
|
});
|
|
2169
|
-
var showCmd5 =
|
|
2392
|
+
var showCmd5 = defineCommand14({
|
|
2170
2393
|
meta: { name: "show", description: "Show profile group details + members" },
|
|
2171
2394
|
args: {
|
|
2172
2395
|
id: { type: "positional", required: true },
|
|
@@ -2203,7 +2426,7 @@ var showCmd5 = defineCommand13({
|
|
|
2203
2426
|
for (const line of columnize(rows)) console.log(` ${line}`);
|
|
2204
2427
|
}
|
|
2205
2428
|
});
|
|
2206
|
-
var updateCmd2 =
|
|
2429
|
+
var updateCmd2 = defineCommand14({
|
|
2207
2430
|
meta: { name: "update", description: "Update profile group basics (name, user-md)" },
|
|
2208
2431
|
args: {
|
|
2209
2432
|
id: { type: "positional", required: true },
|
|
@@ -2227,7 +2450,7 @@ var updateCmd2 = defineCommand13({
|
|
|
2227
2450
|
console.log(`updated profile group ${updated.id}`);
|
|
2228
2451
|
}
|
|
2229
2452
|
});
|
|
2230
|
-
var editCmd3 =
|
|
2453
|
+
var editCmd3 = defineCommand14({
|
|
2231
2454
|
meta: { name: "edit", description: "Edit the member array in $EDITOR (JSON)" },
|
|
2232
2455
|
args: {
|
|
2233
2456
|
id: { type: "positional", required: true }
|
|
@@ -2243,7 +2466,7 @@ var editCmd3 = defineCommand13({
|
|
|
2243
2466
|
}));
|
|
2244
2467
|
const before = `${JSON.stringify(editable, null, 2)}
|
|
2245
2468
|
`;
|
|
2246
|
-
const tmpPath =
|
|
2469
|
+
const tmpPath = join4(
|
|
2247
2470
|
tmpdir2(),
|
|
2248
2471
|
`bazilion-profile-group-${args.id}-${randomBytes2(4).toString("hex")}.json`
|
|
2249
2472
|
);
|
|
@@ -2251,7 +2474,7 @@ var editCmd3 = defineCommand13({
|
|
|
2251
2474
|
try {
|
|
2252
2475
|
const editor = process.env.EDITOR ?? process.env.VISUAL ?? "vi";
|
|
2253
2476
|
const code = await new Promise((resolve3, reject) => {
|
|
2254
|
-
const child =
|
|
2477
|
+
const child = spawn4(editor, [tmpPath], { stdio: "inherit" });
|
|
2255
2478
|
child.on("error", reject);
|
|
2256
2479
|
child.on("close", (c) => resolve3(c ?? 0));
|
|
2257
2480
|
});
|
|
@@ -2294,7 +2517,7 @@ var editCmd3 = defineCommand13({
|
|
|
2294
2517
|
}
|
|
2295
2518
|
}
|
|
2296
2519
|
});
|
|
2297
|
-
var deleteCmd3 =
|
|
2520
|
+
var deleteCmd3 = defineCommand14({
|
|
2298
2521
|
meta: { name: "delete", description: "Delete a profile group (does not affect spawned agents)" },
|
|
2299
2522
|
args: {
|
|
2300
2523
|
id: { type: "positional", required: true }
|
|
@@ -2305,7 +2528,7 @@ var deleteCmd3 = defineCommand13({
|
|
|
2305
2528
|
console.log(`deleted profile group ${args.id}`);
|
|
2306
2529
|
}
|
|
2307
2530
|
});
|
|
2308
|
-
var spawnCmd2 =
|
|
2531
|
+
var spawnCmd2 = defineCommand14({
|
|
2309
2532
|
meta: { name: "spawn", description: "Spawn the whole team into a group (transactional)" },
|
|
2310
2533
|
args: {
|
|
2311
2534
|
id: { type: "positional", required: true },
|
|
@@ -2338,7 +2561,7 @@ var spawnCmd2 = defineCommand13({
|
|
|
2338
2561
|
}
|
|
2339
2562
|
}
|
|
2340
2563
|
});
|
|
2341
|
-
var profileGroupCommand =
|
|
2564
|
+
var profileGroupCommand = defineCommand14({
|
|
2342
2565
|
meta: { name: "profile-group", description: "Manage profile groups" },
|
|
2343
2566
|
subCommands: {
|
|
2344
2567
|
create: createCmd3,
|
|
@@ -2352,8 +2575,8 @@ var profileGroupCommand = defineCommand13({
|
|
|
2352
2575
|
});
|
|
2353
2576
|
|
|
2354
2577
|
// src/commands/provider.ts
|
|
2355
|
-
import { defineCommand as
|
|
2356
|
-
var listCmd9 =
|
|
2578
|
+
import { defineCommand as defineCommand15 } from "citty";
|
|
2579
|
+
var listCmd9 = defineCommand15({
|
|
2357
2580
|
meta: {
|
|
2358
2581
|
name: "list",
|
|
2359
2582
|
description: "List all providers with enabled/disabled state and curated model counts"
|
|
@@ -2379,7 +2602,7 @@ var listCmd9 = defineCommand14({
|
|
|
2379
2602
|
for (const line of columnize(rows)) console.log(line);
|
|
2380
2603
|
}
|
|
2381
2604
|
});
|
|
2382
|
-
var modelsCmd =
|
|
2605
|
+
var modelsCmd = defineCommand15({
|
|
2383
2606
|
meta: {
|
|
2384
2607
|
name: "models",
|
|
2385
2608
|
description: "Show curated + catalog + live models for one provider"
|
|
@@ -2411,7 +2634,7 @@ var modelsCmd = defineCommand14({
|
|
|
2411
2634
|
}
|
|
2412
2635
|
}
|
|
2413
2636
|
});
|
|
2414
|
-
var modelsSetCmd =
|
|
2637
|
+
var modelsSetCmd = defineCommand15({
|
|
2415
2638
|
meta: {
|
|
2416
2639
|
name: "models-set",
|
|
2417
2640
|
description: "Replace the curated model list for a provider (comma-separated)"
|
|
@@ -2436,7 +2659,7 @@ var modelsSetCmd = defineCommand14({
|
|
|
2436
2659
|
for (const m of saved.models) console.log(` ${m}`);
|
|
2437
2660
|
}
|
|
2438
2661
|
});
|
|
2439
|
-
var enableCmd2 =
|
|
2662
|
+
var enableCmd2 = defineCommand15({
|
|
2440
2663
|
meta: { name: "enable", description: "Toggle a provider on so agents can use it" },
|
|
2441
2664
|
args: {
|
|
2442
2665
|
name: { type: "positional", required: true, description: "Provider id (e.g. anthropic)" }
|
|
@@ -2450,7 +2673,7 @@ var enableCmd2 = defineCommand14({
|
|
|
2450
2673
|
console.log(`${res.name}: enabled`);
|
|
2451
2674
|
}
|
|
2452
2675
|
});
|
|
2453
|
-
var disableCmd2 =
|
|
2676
|
+
var disableCmd2 = defineCommand15({
|
|
2454
2677
|
meta: {
|
|
2455
2678
|
name: "disable",
|
|
2456
2679
|
description: "Toggle a provider off \u2014 agents will refuse its model strings"
|
|
@@ -2467,7 +2690,7 @@ var disableCmd2 = defineCommand14({
|
|
|
2467
2690
|
console.log(`${res.name}: disabled`);
|
|
2468
2691
|
}
|
|
2469
2692
|
});
|
|
2470
|
-
var testCmd2 =
|
|
2693
|
+
var testCmd2 = defineCommand15({
|
|
2471
2694
|
meta: { name: "test", description: "Send a single chat to a model and print the reply" },
|
|
2472
2695
|
args: {
|
|
2473
2696
|
model: {
|
|
@@ -2488,7 +2711,7 @@ var testCmd2 = defineCommand14({
|
|
|
2488
2711
|
}
|
|
2489
2712
|
}
|
|
2490
2713
|
});
|
|
2491
|
-
var providerCommand =
|
|
2714
|
+
var providerCommand = defineCommand15({
|
|
2492
2715
|
meta: { name: "provider", description: "Manage and test LLM providers" },
|
|
2493
2716
|
subCommands: {
|
|
2494
2717
|
list: listCmd9,
|
|
@@ -2501,8 +2724,8 @@ var providerCommand = defineCommand14({
|
|
|
2501
2724
|
});
|
|
2502
2725
|
|
|
2503
2726
|
// src/commands/send.ts
|
|
2504
|
-
import { defineCommand as
|
|
2505
|
-
var sendCommand =
|
|
2727
|
+
import { defineCommand as defineCommand16 } from "citty";
|
|
2728
|
+
var sendCommand = defineCommand16({
|
|
2506
2729
|
meta: {
|
|
2507
2730
|
name: "send",
|
|
2508
2731
|
description: "Send a message from one agent to another"
|
|
@@ -2524,14 +2747,14 @@ var sendCommand = defineCommand15({
|
|
|
2524
2747
|
});
|
|
2525
2748
|
|
|
2526
2749
|
// src/commands/serve.ts
|
|
2527
|
-
import { spawn as
|
|
2528
|
-
import { existsSync as
|
|
2529
|
-
import { join as
|
|
2530
|
-
import { defineCommand as
|
|
2531
|
-
var
|
|
2532
|
-
var
|
|
2533
|
-
var
|
|
2534
|
-
var serveCommand =
|
|
2750
|
+
import { spawn as spawn5 } from "child_process";
|
|
2751
|
+
import { existsSync as existsSync5 } from "fs";
|
|
2752
|
+
import { join as join5 } from "path";
|
|
2753
|
+
import { defineCommand as defineCommand17 } from "citty";
|
|
2754
|
+
var bundledDaemonEntry2 = join5(import.meta.dirname, "daemon.js");
|
|
2755
|
+
var sourceDaemonEntry2 = join5(import.meta.dirname, "..", "..", "..", "daemon", "src", "index.ts");
|
|
2756
|
+
var daemonEntry2 = existsSync5(bundledDaemonEntry2) ? bundledDaemonEntry2 : sourceDaemonEntry2;
|
|
2757
|
+
var serveCommand = defineCommand17({
|
|
2535
2758
|
meta: {
|
|
2536
2759
|
name: "serve",
|
|
2537
2760
|
description: "Start the bazilion daemon (HTTP API)"
|
|
@@ -2544,9 +2767,9 @@ var serveCommand = defineCommand16({
|
|
|
2544
2767
|
}
|
|
2545
2768
|
},
|
|
2546
2769
|
async run({ args }) {
|
|
2547
|
-
if (!
|
|
2770
|
+
if (!existsSync5(daemonEntry2)) {
|
|
2548
2771
|
throw new Error(
|
|
2549
|
-
`bazilion daemon not found at ${
|
|
2772
|
+
`bazilion daemon not found at ${daemonEntry2}. Are you running from a development checkout?`
|
|
2550
2773
|
);
|
|
2551
2774
|
}
|
|
2552
2775
|
const env = { ...process.env };
|
|
@@ -2563,8 +2786,8 @@ var serveCommand = defineCommand16({
|
|
|
2563
2786
|
}
|
|
2564
2787
|
console.log(`starting bazilion daemon at http://${host}:${port}`);
|
|
2565
2788
|
console.log("(web UI runs separately: cd apps/web && pnpm dev)");
|
|
2566
|
-
const
|
|
2567
|
-
const proc =
|
|
2789
|
+
const nodeArgs2 = daemonEntry2.endsWith(".ts") ? ["--import", "tsx/esm", daemonEntry2] : [daemonEntry2];
|
|
2790
|
+
const proc = spawn5("node", nodeArgs2, {
|
|
2568
2791
|
env,
|
|
2569
2792
|
stdio: "inherit"
|
|
2570
2793
|
});
|
|
@@ -2598,10 +2821,10 @@ var serveCommand = defineCommand16({
|
|
|
2598
2821
|
});
|
|
2599
2822
|
|
|
2600
2823
|
// src/commands/skill.ts
|
|
2601
|
-
import { existsSync as
|
|
2824
|
+
import { existsSync as existsSync6, readFileSync as readFileSync7, statSync } from "fs";
|
|
2602
2825
|
import { basename as basename2, resolve as resolve2 } from "path";
|
|
2603
|
-
import { defineCommand as
|
|
2604
|
-
var listCmd10 =
|
|
2826
|
+
import { defineCommand as defineCommand18 } from "citty";
|
|
2827
|
+
var listCmd10 = defineCommand18({
|
|
2605
2828
|
meta: { name: "list", description: "List installed skills (or those attached to an agent)" },
|
|
2606
2829
|
args: {
|
|
2607
2830
|
agent: { type: "string", description: "Filter to skills attached to this agent" }
|
|
@@ -2633,7 +2856,7 @@ var listCmd10 = defineCommand17({
|
|
|
2633
2856
|
for (const line of columnize(rows)) console.log(line);
|
|
2634
2857
|
}
|
|
2635
2858
|
});
|
|
2636
|
-
var importCmd =
|
|
2859
|
+
var importCmd = defineCommand18({
|
|
2637
2860
|
meta: {
|
|
2638
2861
|
name: "import",
|
|
2639
2862
|
description: "Import skills from openclaw, a directory, or a local .zip archive"
|
|
@@ -2649,7 +2872,7 @@ var importCmd = defineCommand17({
|
|
|
2649
2872
|
async run({ args }) {
|
|
2650
2873
|
const client = createClient2();
|
|
2651
2874
|
const absFrom = resolve2(args.from);
|
|
2652
|
-
const isLocalZip = args.from.toLowerCase().endsWith(".zip") &&
|
|
2875
|
+
const isLocalZip = args.from.toLowerCase().endsWith(".zip") && existsSync6(absFrom) && statSync(absFrom).isFile();
|
|
2653
2876
|
let result;
|
|
2654
2877
|
if (isLocalZip) {
|
|
2655
2878
|
const bytes = readFileSync7(absFrom);
|
|
@@ -2677,7 +2900,7 @@ var importCmd = defineCommand17({
|
|
|
2677
2900
|
}
|
|
2678
2901
|
}
|
|
2679
2902
|
});
|
|
2680
|
-
var rmCmd5 =
|
|
2903
|
+
var rmCmd5 = defineCommand18({
|
|
2681
2904
|
meta: { name: "rm", description: "Remove an installed skill" },
|
|
2682
2905
|
args: {
|
|
2683
2906
|
name: { type: "positional", required: true }
|
|
@@ -2688,7 +2911,7 @@ var rmCmd5 = defineCommand17({
|
|
|
2688
2911
|
console.log(`removed skill ${args.name}`);
|
|
2689
2912
|
}
|
|
2690
2913
|
});
|
|
2691
|
-
var skillCommand =
|
|
2914
|
+
var skillCommand = defineCommand18({
|
|
2692
2915
|
meta: { name: "skill", description: "Manage the skill library" },
|
|
2693
2916
|
subCommands: {
|
|
2694
2917
|
list: listCmd10,
|
|
@@ -2698,8 +2921,8 @@ var skillCommand = defineCommand17({
|
|
|
2698
2921
|
});
|
|
2699
2922
|
|
|
2700
2923
|
// src/commands/telegram.ts
|
|
2701
|
-
import { defineCommand as
|
|
2702
|
-
var setCmd2 =
|
|
2924
|
+
import { defineCommand as defineCommand19 } from "citty";
|
|
2925
|
+
var setCmd2 = defineCommand19({
|
|
2703
2926
|
meta: {
|
|
2704
2927
|
name: "set",
|
|
2705
2928
|
description: "Save bot token + supergroup chat ID (paired write)"
|
|
@@ -2717,7 +2940,7 @@ var setCmd2 = defineCommand18({
|
|
|
2717
2940
|
console.log(`saved \xB7 token ${state.botTokenPreview} \xB7 chat ${state.chatId}`);
|
|
2718
2941
|
}
|
|
2719
2942
|
});
|
|
2720
|
-
var clearCmd =
|
|
2943
|
+
var clearCmd = defineCommand19({
|
|
2721
2944
|
meta: {
|
|
2722
2945
|
name: "clear",
|
|
2723
2946
|
description: "Remove stored bot token + chat ID"
|
|
@@ -2728,7 +2951,7 @@ var clearCmd = defineCommand18({
|
|
|
2728
2951
|
console.log("cleared");
|
|
2729
2952
|
}
|
|
2730
2953
|
});
|
|
2731
|
-
var showCmd6 =
|
|
2954
|
+
var showCmd6 = defineCommand19({
|
|
2732
2955
|
meta: {
|
|
2733
2956
|
name: "show",
|
|
2734
2957
|
description: "Show what credentials are stored (token is masked)"
|
|
@@ -2749,7 +2972,7 @@ var showCmd6 = defineCommand18({
|
|
|
2749
2972
|
}
|
|
2750
2973
|
}
|
|
2751
2974
|
});
|
|
2752
|
-
var reconnectCmd =
|
|
2975
|
+
var reconnectCmd = defineCommand19({
|
|
2753
2976
|
meta: {
|
|
2754
2977
|
name: "reconnect",
|
|
2755
2978
|
description: "Apply a pending supergroup chat-id migration + re-activate the bot"
|
|
@@ -2760,7 +2983,7 @@ var reconnectCmd = defineCommand18({
|
|
|
2760
2983
|
console.log(`reconnected \xB7 chat ${state.chatId}`);
|
|
2761
2984
|
}
|
|
2762
2985
|
});
|
|
2763
|
-
var configCmd =
|
|
2986
|
+
var configCmd = defineCommand19({
|
|
2764
2987
|
meta: {
|
|
2765
2988
|
name: "config",
|
|
2766
2989
|
description: "Manage Telegram credentials (bot token + chat ID)"
|
|
@@ -2771,7 +2994,7 @@ var configCmd = defineCommand18({
|
|
|
2771
2994
|
show: showCmd6
|
|
2772
2995
|
}
|
|
2773
2996
|
});
|
|
2774
|
-
var healthCmd =
|
|
2997
|
+
var healthCmd = defineCommand19({
|
|
2775
2998
|
meta: {
|
|
2776
2999
|
name: "health",
|
|
2777
3000
|
description: "Run the four-step preflight against the Telegram Bot API"
|
|
@@ -2805,7 +3028,7 @@ var healthCmd = defineCommand18({
|
|
|
2805
3028
|
if (!allOk) process.exitCode = 1;
|
|
2806
3029
|
}
|
|
2807
3030
|
});
|
|
2808
|
-
var botStatusCmd =
|
|
3031
|
+
var botStatusCmd = defineCommand19({
|
|
2809
3032
|
meta: {
|
|
2810
3033
|
name: "status",
|
|
2811
3034
|
description: "Show polling state of the live bot"
|
|
@@ -2830,7 +3053,7 @@ var botStatusCmd = defineCommand18({
|
|
|
2830
3053
|
if (!p.running) process.exitCode = 1;
|
|
2831
3054
|
}
|
|
2832
3055
|
});
|
|
2833
|
-
var botRestartCmd =
|
|
3056
|
+
var botRestartCmd = defineCommand19({
|
|
2834
3057
|
meta: {
|
|
2835
3058
|
name: "restart",
|
|
2836
3059
|
description: "Force-restart the bot (tears down + brings up from current creds)"
|
|
@@ -2841,7 +3064,7 @@ var botRestartCmd = defineCommand18({
|
|
|
2841
3064
|
console.log("restart requested");
|
|
2842
3065
|
}
|
|
2843
3066
|
});
|
|
2844
|
-
var botCmd =
|
|
3067
|
+
var botCmd = defineCommand19({
|
|
2845
3068
|
meta: {
|
|
2846
3069
|
name: "bot",
|
|
2847
3070
|
description: "Inspect / control the live polling bot"
|
|
@@ -2851,7 +3074,7 @@ var botCmd = defineCommand18({
|
|
|
2851
3074
|
restart: botRestartCmd
|
|
2852
3075
|
}
|
|
2853
3076
|
});
|
|
2854
|
-
var bindCmd =
|
|
3077
|
+
var bindCmd = defineCommand19({
|
|
2855
3078
|
meta: {
|
|
2856
3079
|
name: "bind",
|
|
2857
3080
|
description: "Create a Telegram topic for an agent (manual fallback for /talk)"
|
|
@@ -2869,7 +3092,7 @@ var bindCmd = defineCommand18({
|
|
|
2869
3092
|
console.log(` ${result.deepLink}`);
|
|
2870
3093
|
}
|
|
2871
3094
|
});
|
|
2872
|
-
var unbindCmd =
|
|
3095
|
+
var unbindCmd = defineCommand19({
|
|
2873
3096
|
meta: {
|
|
2874
3097
|
name: "unbind",
|
|
2875
3098
|
description: "Clear an agent's Telegram topic binding (topic stays in Telegram as orphan)"
|
|
@@ -2883,7 +3106,7 @@ var unbindCmd = defineCommand18({
|
|
|
2883
3106
|
console.log(`unbound agent ${args.agent}`);
|
|
2884
3107
|
}
|
|
2885
3108
|
});
|
|
2886
|
-
var listBindingsCmd =
|
|
3109
|
+
var listBindingsCmd = defineCommand19({
|
|
2887
3110
|
meta: {
|
|
2888
3111
|
name: "list",
|
|
2889
3112
|
description: "List agents and their Telegram topic bindings"
|
|
@@ -2911,7 +3134,7 @@ var listBindingsCmd = defineCommand18({
|
|
|
2911
3134
|
}
|
|
2912
3135
|
}
|
|
2913
3136
|
});
|
|
2914
|
-
var allowCmd =
|
|
3137
|
+
var allowCmd = defineCommand19({
|
|
2915
3138
|
meta: { name: "allow", description: "Add a Telegram user id to the allowlist" },
|
|
2916
3139
|
args: {
|
|
2917
3140
|
userId: { type: "positional", required: true, description: "Numeric Telegram user id" },
|
|
@@ -2928,7 +3151,7 @@ var allowCmd = defineCommand18({
|
|
|
2928
3151
|
console.log(`allowed ${u.userId} (${u.role})`);
|
|
2929
3152
|
}
|
|
2930
3153
|
});
|
|
2931
|
-
var denyCmd =
|
|
3154
|
+
var denyCmd = defineCommand19({
|
|
2932
3155
|
meta: { name: "deny", description: "Remove a Telegram user id from the allowlist" },
|
|
2933
3156
|
args: { userId: { type: "positional", required: true } },
|
|
2934
3157
|
async run({ args }) {
|
|
@@ -2937,7 +3160,7 @@ var denyCmd = defineCommand18({
|
|
|
2937
3160
|
console.log(`removed ${args.userId}`);
|
|
2938
3161
|
}
|
|
2939
3162
|
});
|
|
2940
|
-
var allowedCmd =
|
|
3163
|
+
var allowedCmd = defineCommand19({
|
|
2941
3164
|
meta: { name: "allowed", description: "List allowlisted Telegram users" },
|
|
2942
3165
|
async run() {
|
|
2943
3166
|
const client = createClient2();
|
|
@@ -2952,7 +3175,7 @@ var allowedCmd = defineCommand18({
|
|
|
2952
3175
|
}
|
|
2953
3176
|
}
|
|
2954
3177
|
});
|
|
2955
|
-
var telegramCommand =
|
|
3178
|
+
var telegramCommand = defineCommand19({
|
|
2956
3179
|
meta: {
|
|
2957
3180
|
name: "telegram",
|
|
2958
3181
|
description: "Telegram integration: credentials, health, bot lifecycle, bindings, access"
|
|
@@ -2973,7 +3196,7 @@ var telegramCommand = defineCommand18({
|
|
|
2973
3196
|
|
|
2974
3197
|
// src/commands/token.ts
|
|
2975
3198
|
import { networkInterfaces } from "os";
|
|
2976
|
-
import { defineCommand as
|
|
3199
|
+
import { defineCommand as defineCommand20 } from "citty";
|
|
2977
3200
|
import qrcode from "qrcode-terminal";
|
|
2978
3201
|
function tokenRow(t) {
|
|
2979
3202
|
const last = t.lastUsedAt ? new Date(t.lastUsedAt).toISOString() : "(never)";
|
|
@@ -3007,7 +3230,7 @@ function resolveQrServer(override) {
|
|
|
3007
3230
|
if (detected.warning) console.warn(`\u26A0 ${detected.warning}`);
|
|
3008
3231
|
return detected.origin;
|
|
3009
3232
|
}
|
|
3010
|
-
var createCmd4 =
|
|
3233
|
+
var createCmd4 = defineCommand20({
|
|
3011
3234
|
meta: { name: "create", description: "Mint a new web token (shown once)" },
|
|
3012
3235
|
args: {
|
|
3013
3236
|
label: { type: "positional", required: true, description: "Human-readable label" },
|
|
@@ -3038,7 +3261,7 @@ var createCmd4 = defineCommand19({
|
|
|
3038
3261
|
qrcode.generate(pairUrl, { small: true }, (qr) => console.log(qr));
|
|
3039
3262
|
}
|
|
3040
3263
|
});
|
|
3041
|
-
var listCmd11 =
|
|
3264
|
+
var listCmd11 = defineCommand20({
|
|
3042
3265
|
meta: { name: "list", description: "List web tokens" },
|
|
3043
3266
|
args: {
|
|
3044
3267
|
all: { type: "boolean", description: "Include revoked tokens" }
|
|
@@ -3054,7 +3277,7 @@ var listCmd11 = defineCommand19({
|
|
|
3054
3277
|
for (const line of columnize(tokens.map(tokenRow))) console.log(line);
|
|
3055
3278
|
}
|
|
3056
3279
|
});
|
|
3057
|
-
var showLocalCmd =
|
|
3280
|
+
var showLocalCmd = defineCommand20({
|
|
3058
3281
|
meta: {
|
|
3059
3282
|
name: "show-local",
|
|
3060
3283
|
description: "Print the bootstrap web token stored in ~/.bazilion/auth.json"
|
|
@@ -3064,7 +3287,7 @@ var showLocalCmd = defineCommand19({
|
|
|
3064
3287
|
console.log(readAuthFile(paths.authFile).token);
|
|
3065
3288
|
}
|
|
3066
3289
|
});
|
|
3067
|
-
var revokeCmd =
|
|
3290
|
+
var revokeCmd = defineCommand20({
|
|
3068
3291
|
meta: { name: "revoke", description: "Revoke a web token" },
|
|
3069
3292
|
args: {
|
|
3070
3293
|
id: { type: "positional", required: true }
|
|
@@ -3075,7 +3298,7 @@ var revokeCmd = defineCommand19({
|
|
|
3075
3298
|
console.log(`revoked token ${args.id}`);
|
|
3076
3299
|
}
|
|
3077
3300
|
});
|
|
3078
|
-
var tokenCommand =
|
|
3301
|
+
var tokenCommand = defineCommand20({
|
|
3079
3302
|
meta: { name: "token", description: "Manage web tokens for API/CLI clients" },
|
|
3080
3303
|
subCommands: {
|
|
3081
3304
|
create: createCmd4,
|
|
@@ -3086,8 +3309,8 @@ var tokenCommand = defineCommand19({
|
|
|
3086
3309
|
});
|
|
3087
3310
|
|
|
3088
3311
|
// src/commands/trigger.ts
|
|
3089
|
-
import { defineCommand as
|
|
3090
|
-
var addCmd3 =
|
|
3312
|
+
import { defineCommand as defineCommand21 } from "citty";
|
|
3313
|
+
var addCmd3 = defineCommand21({
|
|
3091
3314
|
meta: { name: "add", description: "Add a heartbeat / cron trigger to an agent" },
|
|
3092
3315
|
args: {
|
|
3093
3316
|
agent: { type: "positional", required: true },
|
|
@@ -3135,7 +3358,7 @@ function triggerRow(t) {
|
|
|
3135
3358
|
const msgPreview = t.message.length > 60 ? `${t.message.slice(0, 60)}\u2026` : t.message;
|
|
3136
3359
|
return [t.id, state, spec, `last: ${last}`, `"${msgPreview}"`];
|
|
3137
3360
|
}
|
|
3138
|
-
var listCmd12 =
|
|
3361
|
+
var listCmd12 = defineCommand21({
|
|
3139
3362
|
meta: { name: "list", description: "List triggers for an agent" },
|
|
3140
3363
|
args: {
|
|
3141
3364
|
agent: { type: "positional", required: true }
|
|
@@ -3152,7 +3375,7 @@ var listCmd12 = defineCommand20({
|
|
|
3152
3375
|
for (const line of columnize(triggers.map(triggerRow))) console.log(line);
|
|
3153
3376
|
}
|
|
3154
3377
|
});
|
|
3155
|
-
var rmCmd6 =
|
|
3378
|
+
var rmCmd6 = defineCommand21({
|
|
3156
3379
|
meta: { name: "rm", description: "Delete a trigger" },
|
|
3157
3380
|
args: {
|
|
3158
3381
|
id: { type: "positional", required: true }
|
|
@@ -3163,7 +3386,7 @@ var rmCmd6 = defineCommand20({
|
|
|
3163
3386
|
console.log(`removed trigger ${args.id}`);
|
|
3164
3387
|
}
|
|
3165
3388
|
});
|
|
3166
|
-
var enableCmd3 =
|
|
3389
|
+
var enableCmd3 = defineCommand21({
|
|
3167
3390
|
meta: { name: "enable", description: "Enable a trigger" },
|
|
3168
3391
|
args: {
|
|
3169
3392
|
id: { type: "positional", required: true }
|
|
@@ -3175,7 +3398,7 @@ var enableCmd3 = defineCommand20({
|
|
|
3175
3398
|
console.log(`enabled trigger ${args.id}`);
|
|
3176
3399
|
}
|
|
3177
3400
|
});
|
|
3178
|
-
var disableCmd3 =
|
|
3401
|
+
var disableCmd3 = defineCommand21({
|
|
3179
3402
|
meta: { name: "disable", description: "Disable a trigger" },
|
|
3180
3403
|
args: {
|
|
3181
3404
|
id: { type: "positional", required: true }
|
|
@@ -3187,7 +3410,7 @@ var disableCmd3 = defineCommand20({
|
|
|
3187
3410
|
console.log(`disabled trigger ${args.id}`);
|
|
3188
3411
|
}
|
|
3189
3412
|
});
|
|
3190
|
-
var triggerCommand =
|
|
3413
|
+
var triggerCommand = defineCommand21({
|
|
3191
3414
|
meta: { name: "trigger", description: "Manage agent heartbeats / cron triggers" },
|
|
3192
3415
|
subCommands: {
|
|
3193
3416
|
add: addCmd3,
|
|
@@ -3199,9 +3422,9 @@ var triggerCommand = defineCommand20({
|
|
|
3199
3422
|
});
|
|
3200
3423
|
|
|
3201
3424
|
// src/commands/uninstall.ts
|
|
3202
|
-
import { existsSync as
|
|
3203
|
-
import { join as
|
|
3204
|
-
import { defineCommand as
|
|
3425
|
+
import { existsSync as existsSync7, readdirSync as readdirSync2, rmSync as rmSync4 } from "fs";
|
|
3426
|
+
import { join as join6 } from "path";
|
|
3427
|
+
import { defineCommand as defineCommand22 } from "citty";
|
|
3205
3428
|
function makeLineReader() {
|
|
3206
3429
|
let buffer = "";
|
|
3207
3430
|
let ended = false;
|
|
@@ -3245,11 +3468,11 @@ async function askYes(readLine, prompt) {
|
|
|
3245
3468
|
return answer === "y" || answer === "yes";
|
|
3246
3469
|
}
|
|
3247
3470
|
function removePath(p) {
|
|
3248
|
-
if (!
|
|
3471
|
+
if (!existsSync7(p)) return false;
|
|
3249
3472
|
rmSync4(p, { recursive: true, force: true });
|
|
3250
3473
|
return true;
|
|
3251
3474
|
}
|
|
3252
|
-
var uninstallCommand =
|
|
3475
|
+
var uninstallCommand = defineCommand22({
|
|
3253
3476
|
meta: {
|
|
3254
3477
|
name: "uninstall",
|
|
3255
3478
|
description: "Wipe bazilion state from ~/.bazilion (or BAZILION_HOME)"
|
|
@@ -3267,13 +3490,13 @@ var uninstallCommand = defineCommand21({
|
|
|
3267
3490
|
},
|
|
3268
3491
|
async run({ args }) {
|
|
3269
3492
|
const paths = resolveCliPaths(args.home);
|
|
3270
|
-
const dbFile =
|
|
3271
|
-
const profilesDir =
|
|
3272
|
-
const agentsDir =
|
|
3273
|
-
const groupsDir =
|
|
3274
|
-
const skillsDir =
|
|
3275
|
-
const logsDir =
|
|
3276
|
-
if (!
|
|
3493
|
+
const dbFile = join6(paths.home, "bazilion.db");
|
|
3494
|
+
const profilesDir = join6(paths.home, "profiles");
|
|
3495
|
+
const agentsDir = join6(paths.home, "agents");
|
|
3496
|
+
const groupsDir = join6(paths.home, "groups");
|
|
3497
|
+
const skillsDir = join6(paths.home, "skills");
|
|
3498
|
+
const logsDir = join6(paths.home, "logs");
|
|
3499
|
+
if (!existsSync7(paths.home)) {
|
|
3277
3500
|
console.log(`nothing to remove: ${paths.home} does not exist`);
|
|
3278
3501
|
return;
|
|
3279
3502
|
}
|
|
@@ -3327,7 +3550,7 @@ var uninstallCommand = defineCommand21({
|
|
|
3327
3550
|
|
|
3328
3551
|
// src/index.ts
|
|
3329
3552
|
var VERSION = package_default.version;
|
|
3330
|
-
var main =
|
|
3553
|
+
var main = defineCommand23({
|
|
3331
3554
|
meta: {
|
|
3332
3555
|
name: "bazilion",
|
|
3333
3556
|
version: VERSION,
|
|
@@ -3347,6 +3570,7 @@ var main = defineCommand22({
|
|
|
3347
3570
|
inbox: inboxCommand,
|
|
3348
3571
|
config: configCommand,
|
|
3349
3572
|
serve: serveCommand,
|
|
3573
|
+
dashboard: dashboardCommand,
|
|
3350
3574
|
doctor: doctorCommand,
|
|
3351
3575
|
backup: backupCommand,
|
|
3352
3576
|
trigger: triggerCommand,
|
|
@@ -3402,6 +3626,7 @@ function printTopLevelHelp() {
|
|
|
3402
3626
|
title: "setup",
|
|
3403
3627
|
items: [
|
|
3404
3628
|
["serve", "Start the bazilion daemon (auto-bootstraps ~/.bazilion on first run)"],
|
|
3629
|
+
["dashboard", "Start the daemon + bundled web UI, then open the dashboard"],
|
|
3405
3630
|
["doctor", "Diagnose your bazilion install"],
|
|
3406
3631
|
["uninstall", "Wipe bazilion state from ~/.bazilion (or BAZILION_HOME)"]
|
|
3407
3632
|
]
|