bazilion 0.5.1 → 0.7.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 +17 -12
- package/dist/cli.js +383 -152
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +238 -14064
- package/dist/daemon.js.map +1 -1
- package/dist/web/client/assets/AgentAvatar-JYijLvZ2.js +1 -0
- package/dist/web/client/assets/AgentTabs-DioGqUVR.js +1 -0
- package/dist/web/client/assets/Button-ByiV6fpd.js +1 -0
- package/dist/web/client/assets/ChatPane-DzEgOEqS.js +74 -0
- package/dist/web/client/assets/ConfigTabs-pY-V0Rie.js +1 -0
- package/dist/web/client/assets/FieldRow-CNKma5LE.js +1 -0
- package/dist/web/client/assets/MembersEditor-C6UpqDdV.js +1 -0
- package/dist/web/client/assets/SpawnTeamModal-BEkNCKXm.js +1 -0
- package/dist/web/client/assets/TemplatesTabs-Da7mg9FI.js +1 -0
- package/dist/web/client/assets/_id-BdKmo0gb.js +1 -0
- package/dist/web/client/assets/_id-LT6Ejjr0.js +1 -0
- package/dist/web/client/assets/_id-MR2XjWh0.js +1 -0
- package/dist/web/client/assets/_id-_6jIt0_-.js +1 -0
- package/dist/web/client/assets/agents-0arKbVYG.js +1 -0
- package/dist/web/client/assets/config-BSAVT-17.js +3 -0
- package/dist/web/client/assets/groups-BqTkhHes.js +1 -0
- package/dist/web/client/assets/inbox-ozoCXzr5.js +1 -0
- package/dist/web/client/assets/index-iayCEuU2.js +12 -0
- package/dist/web/client/assets/jsx-runtime-DGeXAQPT.js +1 -0
- package/dist/web/client/assets/login-D8lNr2SX.js +1 -0
- package/dist/web/client/assets/mcp-BLnngDsj.js +1 -0
- package/dist/web/client/assets/memory-D1GQjEvN.js +1 -0
- package/dist/web/client/assets/preload-helper-CvnapA2_.js +1 -0
- package/dist/web/client/assets/profile-groups-C2yJPTaE.js +1 -0
- package/dist/web/client/assets/profiles-BV7AAZjj.js +1 -0
- package/dist/web/client/assets/routes-DSHQLA7K.js +1 -0
- package/dist/web/client/assets/services-BbCJe1Du.js +1 -0
- package/dist/web/client/assets/skills-C6czKR5I.js +1 -0
- package/dist/web/client/assets/styles-C06axZZk.css +2 -0
- package/dist/web/client/assets/telegram-gE4j8gte.js +1 -0
- package/dist/web/client/assets/tokens-D2_O9ARe.js +1 -0
- package/dist/web/client/assets/triggers-WljnfEfJ.js +1 -0
- package/dist/web/client/assets/welcome-Dn-zvmBE.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-81NrHA5d.js +16 -0
- package/dist/web/server/assets/_id-BKev9H1p.js +12 -0
- package/dist/web/server/assets/_id-BNwlbWHP.js +24 -0
- package/dist/web/server/assets/_id-BqnDy_Ca.js +16 -0
- package/dist/web/server/assets/_id-CRqqi8IE.js +161 -0
- package/dist/web/server/assets/_id-CXg-Blec.js +367 -0
- package/dist/web/server/assets/_id-CnQflrRv.js +16 -0
- package/dist/web/server/assets/_id-D0ytyXGY.js +662 -0
- package/dist/web/server/assets/_id-D8duqgd5.js +27 -0
- package/dist/web/server/assets/_id-DDixKEud.js +467 -0
- package/dist/web/server/assets/_id-D_Ew11ED.js +28 -0
- package/dist/web/server/assets/_id-Sjw0zhA6.js +38 -0
- package/dist/web/server/assets/_tanstack-start-manifest_v-DBlFH2gg.js +178 -0
- package/dist/web/server/assets/agents-C7SBPN0M.js +210 -0
- package/dist/web/server/assets/agents-ChcAJUI5.js +14 -0
- package/dist/web/server/assets/agents-k5QURC4I.js +26 -0
- package/dist/web/server/assets/auth-DzRAMwVt.js +26 -0
- package/dist/web/server/assets/config-Bq3o924J.js +12 -0
- package/dist/web/server/assets/config-CHaCv89D.js +19 -0
- package/dist/web/server/assets/config-CdVjqjin.js +391 -0
- package/dist/web/server/assets/createServerRpc-CeKECg65.js +12 -0
- package/dist/web/server/assets/createSsrRpc-ZBGxhl8t.js +16 -0
- package/dist/web/server/assets/daemon-client-2NRMzlTr.js +96 -0
- package/dist/web/server/assets/empty-plugin-adapters-DKUlnwwl.js +5 -0
- package/dist/web/server/assets/groups-CbSwND2r.js +12 -0
- package/dist/web/server/assets/groups-CeRRlZaZ.js +150 -0
- package/dist/web/server/assets/groups-pk4CYSuf.js +21 -0
- package/dist/web/server/assets/inbox-Bxb3W04M.js +27 -0
- package/dist/web/server/assets/inbox-CkiSvD14.js +42 -0
- package/dist/web/server/assets/inbox-DU27iHv_.js +133 -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-BU_kKENi.js +268 -0
- package/dist/web/server/assets/mcp-BsFKEoXt.js +12 -0
- package/dist/web/server/assets/mcp-CKqwG4mt.js +12 -0
- package/dist/web/server/assets/memory-BaYnfm7K.js +28 -0
- package/dist/web/server/assets/memory-CQaqWnyM.js +284 -0
- package/dist/web/server/assets/memory-Ns2-Z31p.js +16 -0
- package/dist/web/server/assets/profile-groups-CiU06yN1.js +28 -0
- package/dist/web/server/assets/profile-groups-D21MYoLM.js +208 -0
- package/dist/web/server/assets/profile-groups-aoJleXHP.js +12 -0
- package/dist/web/server/assets/profiles-C6a3RKgu.js +26 -0
- package/dist/web/server/assets/profiles-CZ5NkmVw.js +12 -0
- package/dist/web/server/assets/profiles-LxcC_L6n.js +453 -0
- package/dist/web/server/assets/router-BpBZgRwn.js +460 -0
- package/dist/web/server/assets/routes-C61gBiXa.js +57 -0
- package/dist/web/server/assets/routes-Ce2VWrU9.js +33 -0
- package/dist/web/server/assets/routes-V9URcp1v.js +14 -0
- package/dist/web/server/assets/services-B91w2f-X.js +94 -0
- package/dist/web/server/assets/services-Ccc5s2bS.js +17 -0
- package/dist/web/server/assets/services-DhRiNeq0.js +12 -0
- package/dist/web/server/assets/skills-CFIWVg32.js +12 -0
- package/dist/web/server/assets/skills-CpsyR_WA.js +12 -0
- package/dist/web/server/assets/skills-dLyBZb3B.js +261 -0
- package/dist/web/server/assets/start-CYDpZ6cb.js +4 -0
- package/dist/web/server/assets/telegram-BdaUIjvs.js +12 -0
- package/dist/web/server/assets/telegram-DfAddLdv.js +583 -0
- package/dist/web/server/assets/telegram-T3l9KtiE.js +12 -0
- package/dist/web/server/assets/tokens-BCz3PSoT.js +12 -0
- package/dist/web/server/assets/tokens-CkKqrtk-.js +193 -0
- package/dist/web/server/assets/tokens-DdpnfV_Y.js +14 -0
- package/dist/web/server/assets/triggers-BcH_6PW1.js +26 -0
- package/dist/web/server/assets/triggers-BcTTwMfy.js +16 -0
- package/dist/web/server/assets/triggers-BzJG1nN5.js +191 -0
- package/dist/web/server/assets/welcome-CP4CZ9B6.js +85 -0
- package/dist/web/server/assets/wire-constants-Deb4NxBb.js +16 -0
- package/dist/web/server/server.js +5911 -0
- package/dist/web-server.js +42 -0
- package/dist/web-server.js.map +1 -0
- package/dist/worker.js +65 -2
- package/dist/worker.js.map +1 -1
- package/package.json +18 -12
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.7.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"
|
|
@@ -49,20 +49,26 @@ var package_default = {
|
|
|
49
49
|
access: "public"
|
|
50
50
|
},
|
|
51
51
|
dependencies: {
|
|
52
|
-
"@earendil-works/pi-agent-core": "^0.
|
|
53
|
-
"@earendil-works/pi-ai": "^0.
|
|
54
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
55
|
-
"@hono/node-server": "^2.0.
|
|
52
|
+
"@earendil-works/pi-agent-core": "^0.79.10",
|
|
53
|
+
"@earendil-works/pi-ai": "^0.79.10",
|
|
54
|
+
"@earendil-works/pi-coding-agent": "^0.79.10",
|
|
55
|
+
"@hono/node-server": "^2.0.6",
|
|
56
56
|
"@mozilla/readability": "^0.6.0",
|
|
57
|
+
"@tanstack/react-router": "1.170.16",
|
|
57
58
|
"@tobilu/qmd": "^2.5.3",
|
|
58
59
|
"adm-zip": "^0.5.17",
|
|
59
60
|
citty: "^0.2.2",
|
|
60
|
-
|
|
61
|
+
dompurify: "^3.4.11",
|
|
62
|
+
grammy: "^1.44.0",
|
|
63
|
+
hono: "^4.12.26",
|
|
61
64
|
linkedom: "^0.18.12",
|
|
62
|
-
|
|
65
|
+
"lucide-react": "^1.21.0",
|
|
66
|
+
playwright: "^1.61.0",
|
|
63
67
|
"qrcode-terminal": "^0.12.0",
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
react: "^19.2.7",
|
|
69
|
+
"react-dom": "^19.2.7",
|
|
70
|
+
typebox: "^1.3.0",
|
|
71
|
+
undici: "^8.5.0",
|
|
66
72
|
yaml: "^2.9.0"
|
|
67
73
|
},
|
|
68
74
|
devDependencies: {
|
|
@@ -866,8 +872,11 @@ var openaiLoginCmd = defineCommand2({
|
|
|
866
872
|
if (status.accountId) console.log(`account: ${status.accountId}`);
|
|
867
873
|
console.log(`access token expires: ${formatExpiry(status.expiresAt)}`);
|
|
868
874
|
console.log("");
|
|
869
|
-
console.log(`enable the 'openai-codex' provider on /config and
|
|
870
|
-
console.log("(e.g. gpt-5.3-codex, gpt-5.4, gpt-5.5) to start using it.");
|
|
875
|
+
console.log(`enable the 'openai-codex' provider on /config and save at least one model`);
|
|
876
|
+
console.log("(e.g. gpt-5.3-codex-spark, gpt-5.4, gpt-5.5) to start using it.");
|
|
877
|
+
console.log("CLI equivalent:");
|
|
878
|
+
console.log(" bazilion provider enable openai-codex");
|
|
879
|
+
console.log(" bazilion provider models-set openai-codex gpt-5.3-codex-spark");
|
|
871
880
|
}
|
|
872
881
|
});
|
|
873
882
|
var openaiLogoutCmd = defineCommand2({
|
|
@@ -1243,9 +1252,226 @@ var configCommand = defineCommand5({
|
|
|
1243
1252
|
}
|
|
1244
1253
|
});
|
|
1245
1254
|
|
|
1246
|
-
// src/commands/
|
|
1255
|
+
// src/commands/dashboard.ts
|
|
1256
|
+
import { spawn as spawn2 } from "child_process";
|
|
1257
|
+
import { existsSync as existsSync3 } from "fs";
|
|
1258
|
+
import { connect } from "net";
|
|
1259
|
+
import { join as join2 } from "path";
|
|
1247
1260
|
import { defineCommand as defineCommand6 } from "citty";
|
|
1248
|
-
var
|
|
1261
|
+
var bundledDaemonEntry = join2(import.meta.dirname, "daemon.js");
|
|
1262
|
+
var sourceDaemonEntry = join2(import.meta.dirname, "..", "..", "..", "daemon", "src", "index.ts");
|
|
1263
|
+
var daemonEntry = existsSync3(bundledDaemonEntry) ? bundledDaemonEntry : sourceDaemonEntry;
|
|
1264
|
+
var bundledWebServerEntry = join2(import.meta.dirname, "web-server.js");
|
|
1265
|
+
var sourceWebServerEntry = join2(import.meta.dirname, "..", "web-server.ts");
|
|
1266
|
+
var webServerEntry = existsSync3(bundledWebServerEntry) ? bundledWebServerEntry : sourceWebServerEntry;
|
|
1267
|
+
var bundledWebDist = join2(import.meta.dirname, "web");
|
|
1268
|
+
var sourceWebDist = join2(import.meta.dirname, "..", "..", "..", "web", "dist");
|
|
1269
|
+
var webDist = existsSync3(bundledWebDist) ? bundledWebDist : sourceWebDist;
|
|
1270
|
+
function nodeArgs(entry2) {
|
|
1271
|
+
return entry2.endsWith(".ts") ? ["--import", "tsx/esm", entry2] : [entry2];
|
|
1272
|
+
}
|
|
1273
|
+
async function responds(url) {
|
|
1274
|
+
try {
|
|
1275
|
+
const res = await fetch(url);
|
|
1276
|
+
return res.status >= 200 && res.status < 500;
|
|
1277
|
+
} catch {
|
|
1278
|
+
return false;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
function probeHost(host) {
|
|
1282
|
+
if (host === "0.0.0.0") return "127.0.0.1";
|
|
1283
|
+
if (host === "::") return "::1";
|
|
1284
|
+
return host;
|
|
1285
|
+
}
|
|
1286
|
+
function isTcpPortOpen(host, port) {
|
|
1287
|
+
return new Promise((resolve3) => {
|
|
1288
|
+
const socket = connect({ host: probeHost(host), port: Number(port) });
|
|
1289
|
+
const done = (open) => {
|
|
1290
|
+
socket.removeAllListeners();
|
|
1291
|
+
socket.destroy();
|
|
1292
|
+
resolve3(open);
|
|
1293
|
+
};
|
|
1294
|
+
socket.setTimeout(600);
|
|
1295
|
+
socket.once("connect", () => done(true));
|
|
1296
|
+
socket.once("timeout", () => done(false));
|
|
1297
|
+
socket.once("error", () => done(false));
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
async function bazilionDaemonRunning(url, port) {
|
|
1301
|
+
try {
|
|
1302
|
+
const res = await fetch(`${url}/api/health`);
|
|
1303
|
+
if (res.ok) {
|
|
1304
|
+
const body = await res.json().catch(() => null);
|
|
1305
|
+
if (body?.ok === true) return true;
|
|
1306
|
+
}
|
|
1307
|
+
} catch {
|
|
1308
|
+
return false;
|
|
1309
|
+
}
|
|
1310
|
+
throw new Error(
|
|
1311
|
+
`port ${port} is already serving HTTP, but it is not a healthy bazilion daemon. Re-run with --daemon-port <free-port>.`
|
|
1312
|
+
);
|
|
1313
|
+
}
|
|
1314
|
+
async function bazilionWebRunning(url, port) {
|
|
1315
|
+
try {
|
|
1316
|
+
const res = await fetch(url);
|
|
1317
|
+
if (res.status >= 200 && res.status < 500) {
|
|
1318
|
+
const html = await res.text();
|
|
1319
|
+
if (html.includes("<title>bazilion</title>") || html.includes(">bazilion<")) {
|
|
1320
|
+
return true;
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
} catch {
|
|
1324
|
+
return false;
|
|
1325
|
+
}
|
|
1326
|
+
throw new Error(
|
|
1327
|
+
`port ${port} is already serving HTTP, but it is not the bazilion web UI. Re-run with --port <free-port>.`
|
|
1328
|
+
);
|
|
1329
|
+
}
|
|
1330
|
+
async function waitFor(url, label, timeoutMs = 2e4) {
|
|
1331
|
+
const start = Date.now();
|
|
1332
|
+
while (Date.now() - start < timeoutMs) {
|
|
1333
|
+
if (await responds(url)) return;
|
|
1334
|
+
await new Promise((r) => setTimeout(r, 150));
|
|
1335
|
+
}
|
|
1336
|
+
throw new Error(`timed out waiting for ${label} at ${url}`);
|
|
1337
|
+
}
|
|
1338
|
+
function openBrowser(url) {
|
|
1339
|
+
const platform = process.platform;
|
|
1340
|
+
const cmd = platform === "darwin" ? "open" : platform === "win32" ? "cmd" : process.env.BROWSER || "xdg-open";
|
|
1341
|
+
const args = platform === "win32" ? ["/c", "start", "", url] : [url];
|
|
1342
|
+
const proc = spawn2(cmd, args, { detached: true, stdio: "ignore" });
|
|
1343
|
+
proc.unref();
|
|
1344
|
+
}
|
|
1345
|
+
function spawnProcess(label, entry2, env) {
|
|
1346
|
+
if (!existsSync3(entry2)) {
|
|
1347
|
+
throw new Error(`${label} entry not found at ${entry2}`);
|
|
1348
|
+
}
|
|
1349
|
+
return spawn2(process.execPath, nodeArgs(entry2), {
|
|
1350
|
+
env,
|
|
1351
|
+
stdio: "inherit"
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
var dashboardCommand = defineCommand6({
|
|
1355
|
+
meta: {
|
|
1356
|
+
name: "dashboard",
|
|
1357
|
+
description: "Start the bazilion daemon and bundled web UI"
|
|
1358
|
+
},
|
|
1359
|
+
args: {
|
|
1360
|
+
port: { type: "string", description: "Web UI port (default 4322)" },
|
|
1361
|
+
host: {
|
|
1362
|
+
type: "string",
|
|
1363
|
+
description: "Web UI host (default 127.0.0.1). Use loopback unless you know why not."
|
|
1364
|
+
},
|
|
1365
|
+
"daemon-port": { type: "string", description: "Daemon port (default 4321)" },
|
|
1366
|
+
"daemon-host": {
|
|
1367
|
+
type: "string",
|
|
1368
|
+
description: "Daemon host (default 127.0.0.1). Use loopback unless you know why not."
|
|
1369
|
+
},
|
|
1370
|
+
open: {
|
|
1371
|
+
type: "boolean",
|
|
1372
|
+
description: "Open the dashboard in your browser (default true)",
|
|
1373
|
+
default: true
|
|
1374
|
+
}
|
|
1375
|
+
},
|
|
1376
|
+
async run({ args }) {
|
|
1377
|
+
const webHost = args.host ?? "127.0.0.1";
|
|
1378
|
+
const webPort = args.port ?? "4322";
|
|
1379
|
+
const daemonHost = args["daemon-host"] ?? "127.0.0.1";
|
|
1380
|
+
const daemonPort = args["daemon-port"] ?? "4321";
|
|
1381
|
+
const daemonUrl = `http://${daemonHost}:${daemonPort}`;
|
|
1382
|
+
const webUrl = `http://${webHost}:${webPort}`;
|
|
1383
|
+
const authFile = resolveCliPaths().authFile;
|
|
1384
|
+
if (webHost !== "127.0.0.1" && webHost !== "localhost" && webHost !== "::1") {
|
|
1385
|
+
console.error("");
|
|
1386
|
+
console.error(
|
|
1387
|
+
`warning: binding web UI to ${webHost} - the dashboard may be reachable beyond loopback.`
|
|
1388
|
+
);
|
|
1389
|
+
console.error(" keep it behind a trusted network or a TLS proxy.");
|
|
1390
|
+
console.error("");
|
|
1391
|
+
}
|
|
1392
|
+
const children = [];
|
|
1393
|
+
let signalled = false;
|
|
1394
|
+
const terminateChildren = () => {
|
|
1395
|
+
signalled = true;
|
|
1396
|
+
for (const child of children) {
|
|
1397
|
+
try {
|
|
1398
|
+
child.kill("SIGTERM");
|
|
1399
|
+
} catch {
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
try {
|
|
1404
|
+
const daemonRunning = await bazilionDaemonRunning(daemonUrl, daemonPort);
|
|
1405
|
+
if (daemonRunning) {
|
|
1406
|
+
console.log(`using existing bazilion daemon at ${daemonUrl}`);
|
|
1407
|
+
} else {
|
|
1408
|
+
if (await isTcpPortOpen(daemonHost, daemonPort)) {
|
|
1409
|
+
throw new Error(
|
|
1410
|
+
`daemon port ${daemonPort} is already in use. Re-run with --daemon-port <free-port>.`
|
|
1411
|
+
);
|
|
1412
|
+
}
|
|
1413
|
+
console.log(`starting bazilion daemon at ${daemonUrl}`);
|
|
1414
|
+
const daemon = spawnProcess("daemon", daemonEntry, {
|
|
1415
|
+
...process.env,
|
|
1416
|
+
HOST: daemonHost,
|
|
1417
|
+
PORT: daemonPort
|
|
1418
|
+
});
|
|
1419
|
+
children.push(daemon);
|
|
1420
|
+
await waitFor(`${daemonUrl}/api/health`, "bazilion daemon");
|
|
1421
|
+
}
|
|
1422
|
+
const webRunning = await bazilionWebRunning(webUrl, webPort);
|
|
1423
|
+
if (webRunning) {
|
|
1424
|
+
console.log(`using existing bazilion web UI at ${webUrl}`);
|
|
1425
|
+
} else {
|
|
1426
|
+
if (await isTcpPortOpen(webHost, webPort)) {
|
|
1427
|
+
throw new Error(
|
|
1428
|
+
`web UI port ${webPort} is already in use. Re-run with --port <free-port>.`
|
|
1429
|
+
);
|
|
1430
|
+
}
|
|
1431
|
+
if (!existsSync3(join2(webDist, "server", "server.js"))) {
|
|
1432
|
+
throw new Error(
|
|
1433
|
+
`bazilion web UI bundle not found at ${webDist}. Run "pnpm --filter @bazilion/web build" from a source checkout, or reinstall the published package.`
|
|
1434
|
+
);
|
|
1435
|
+
}
|
|
1436
|
+
console.log(`starting bazilion web UI at ${webUrl}`);
|
|
1437
|
+
const web = spawnProcess("web UI", webServerEntry, {
|
|
1438
|
+
...process.env,
|
|
1439
|
+
WEB_HOST: webHost,
|
|
1440
|
+
WEB_PORT: webPort,
|
|
1441
|
+
BAZILION_DAEMON: daemonUrl,
|
|
1442
|
+
BAZILION_WEB_DIST: webDist
|
|
1443
|
+
});
|
|
1444
|
+
children.push(web);
|
|
1445
|
+
await waitFor(webUrl, "bazilion web UI");
|
|
1446
|
+
}
|
|
1447
|
+
console.log("");
|
|
1448
|
+
console.log(`dashboard: ${webUrl}`);
|
|
1449
|
+
console.log(`token: ${authFile}`);
|
|
1450
|
+
if (args.open) openBrowser(webUrl);
|
|
1451
|
+
} catch (err) {
|
|
1452
|
+
terminateChildren();
|
|
1453
|
+
throw err;
|
|
1454
|
+
}
|
|
1455
|
+
if (children.length === 0) return;
|
|
1456
|
+
process.on("SIGINT", terminateChildren);
|
|
1457
|
+
process.on("SIGTERM", terminateChildren);
|
|
1458
|
+
await new Promise((resolve3) => {
|
|
1459
|
+
let remaining = children.length;
|
|
1460
|
+
for (const child of children) {
|
|
1461
|
+
child.on("close", (code) => {
|
|
1462
|
+
remaining--;
|
|
1463
|
+
if (!signalled && code && code !== 0) process.exitCode = code;
|
|
1464
|
+
if (remaining === 0) resolve3();
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
});
|
|
1468
|
+
if (signalled) process.exitCode = 0;
|
|
1469
|
+
}
|
|
1470
|
+
});
|
|
1471
|
+
|
|
1472
|
+
// src/commands/doctor.ts
|
|
1473
|
+
import { defineCommand as defineCommand7 } from "citty";
|
|
1474
|
+
var doctorCommand = defineCommand7({
|
|
1249
1475
|
meta: { name: "doctor", description: "Diagnose your bazilion install" },
|
|
1250
1476
|
async run() {
|
|
1251
1477
|
const client = createClient2();
|
|
@@ -1284,7 +1510,7 @@ var doctorCommand = defineCommand6({
|
|
|
1284
1510
|
check("all skills parse", false, `${r.skills.parseErrors} skill(s) have errors`);
|
|
1285
1511
|
}
|
|
1286
1512
|
console.log();
|
|
1287
|
-
console.log("providers (at least one
|
|
1513
|
+
console.log("providers (enable one and save at least one model for chat)");
|
|
1288
1514
|
if (r.providers.configured.length === 0) {
|
|
1289
1515
|
console.log(" - no cloud providers configured");
|
|
1290
1516
|
console.log(" (set e.g. ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY)");
|
|
@@ -1344,7 +1570,10 @@ var doctorCommand = defineCommand6({
|
|
|
1344
1570
|
todo.push(" - set a cloud api key (ANTHROPIC_API_KEY / OPENAI_API_KEY / GEMINI_API_KEY)");
|
|
1345
1571
|
todo.push(" or make sure LMStudio / Ollama is running locally");
|
|
1346
1572
|
}
|
|
1347
|
-
if (!hasProfiles)
|
|
1573
|
+
if (!hasProfiles) {
|
|
1574
|
+
todo.push(" - enable a provider: bazilion provider enable <provider>");
|
|
1575
|
+
todo.push(" - save a model: bazilion provider models-set <provider> <model-id>");
|
|
1576
|
+
}
|
|
1348
1577
|
if (!hasAgents) todo.push(" - spawn an agent: bazilion agent spawn --profile <id>");
|
|
1349
1578
|
for (const line of todo) console.log(line);
|
|
1350
1579
|
} else {
|
|
@@ -1356,8 +1585,8 @@ var doctorCommand = defineCommand6({
|
|
|
1356
1585
|
// src/commands/group.ts
|
|
1357
1586
|
import { readFileSync as readFileSync3 } from "fs";
|
|
1358
1587
|
import { stdin as stdin2 } from "process";
|
|
1359
|
-
import { defineCommand as
|
|
1360
|
-
var addCmd =
|
|
1588
|
+
import { defineCommand as defineCommand8 } from "citty";
|
|
1589
|
+
var addCmd = defineCommand8({
|
|
1361
1590
|
meta: {
|
|
1362
1591
|
name: "add",
|
|
1363
1592
|
description: "Register a group at ~/.bazilion/groups/<slug>/ (use --link to point at an existing tree)"
|
|
@@ -1381,7 +1610,7 @@ var addCmd = defineCommand7({
|
|
|
1381
1610
|
console.log(`registered group ${g.id} at ${g.path}`);
|
|
1382
1611
|
}
|
|
1383
1612
|
});
|
|
1384
|
-
var listCmd3 =
|
|
1613
|
+
var listCmd3 = defineCommand8({
|
|
1385
1614
|
meta: { name: "list", description: "List groups" },
|
|
1386
1615
|
async run() {
|
|
1387
1616
|
const client = createClient2();
|
|
@@ -1394,7 +1623,7 @@ var listCmd3 = defineCommand7({
|
|
|
1394
1623
|
for (const line of columnize(rows)) console.log(line);
|
|
1395
1624
|
}
|
|
1396
1625
|
});
|
|
1397
|
-
var rmCmd2 =
|
|
1626
|
+
var rmCmd2 = defineCommand8({
|
|
1398
1627
|
meta: { name: "rm", description: "Remove a group registration" },
|
|
1399
1628
|
args: {
|
|
1400
1629
|
id: { type: "positional", required: true }
|
|
@@ -1410,7 +1639,7 @@ async function readStdin() {
|
|
|
1410
1639
|
for await (const chunk of stdin2) chunks.push(chunk);
|
|
1411
1640
|
return Buffer.concat(chunks).toString("utf8");
|
|
1412
1641
|
}
|
|
1413
|
-
var userMdShowCmd =
|
|
1642
|
+
var userMdShowCmd = defineCommand8({
|
|
1414
1643
|
meta: { name: "show", description: "Print the group's USER.md" },
|
|
1415
1644
|
args: { id: { type: "positional", required: true } },
|
|
1416
1645
|
async run({ args }) {
|
|
@@ -1420,7 +1649,7 @@ var userMdShowCmd = defineCommand7({
|
|
|
1420
1649
|
if (g.userMd && !g.userMd.endsWith("\n")) process.stdout.write("\n");
|
|
1421
1650
|
}
|
|
1422
1651
|
});
|
|
1423
|
-
var userMdSetCmd =
|
|
1652
|
+
var userMdSetCmd = defineCommand8({
|
|
1424
1653
|
meta: {
|
|
1425
1654
|
name: "set",
|
|
1426
1655
|
description: "Replace the group's USER.md (from --file, --from-stdin, or inline text)"
|
|
@@ -1446,7 +1675,7 @@ var userMdSetCmd = defineCommand7({
|
|
|
1446
1675
|
console.log(`updated USER.md for group ${args.id} (${content.length} bytes)`);
|
|
1447
1676
|
}
|
|
1448
1677
|
});
|
|
1449
|
-
var userMdClearCmd =
|
|
1678
|
+
var userMdClearCmd = defineCommand8({
|
|
1450
1679
|
meta: { name: "clear", description: "Clear the group's USER.md to empty" },
|
|
1451
1680
|
args: { id: { type: "positional", required: true } },
|
|
1452
1681
|
async run({ args }) {
|
|
@@ -1456,7 +1685,7 @@ var userMdClearCmd = defineCommand7({
|
|
|
1456
1685
|
console.log(`cleared USER.md for group ${args.id}`);
|
|
1457
1686
|
}
|
|
1458
1687
|
});
|
|
1459
|
-
var userMdCmd =
|
|
1688
|
+
var userMdCmd = defineCommand8({
|
|
1460
1689
|
meta: { name: "user-md", description: "View or edit a group's USER.md" },
|
|
1461
1690
|
subCommands: {
|
|
1462
1691
|
show: userMdShowCmd,
|
|
@@ -1464,7 +1693,7 @@ var userMdCmd = defineCommand7({
|
|
|
1464
1693
|
clear: userMdClearCmd
|
|
1465
1694
|
}
|
|
1466
1695
|
});
|
|
1467
|
-
var topicFormatShowCmd =
|
|
1696
|
+
var topicFormatShowCmd = defineCommand8({
|
|
1468
1697
|
meta: { name: "show", description: "Print the group's Telegram topic-name template" },
|
|
1469
1698
|
args: { id: { type: "positional", required: true } },
|
|
1470
1699
|
async run({ args }) {
|
|
@@ -1473,7 +1702,7 @@ var topicFormatShowCmd = defineCommand7({
|
|
|
1473
1702
|
console.log(g.telegramTopicNameFormat ?? "(default naming)");
|
|
1474
1703
|
}
|
|
1475
1704
|
});
|
|
1476
|
-
var topicFormatSetCmd =
|
|
1705
|
+
var topicFormatSetCmd = defineCommand8({
|
|
1477
1706
|
meta: {
|
|
1478
1707
|
name: "set",
|
|
1479
1708
|
description: "Set the topic-name template. Tokens: {agent.name} {group.name} {group.slug} (must include {agent.name})"
|
|
@@ -1493,7 +1722,7 @@ var topicFormatSetCmd = defineCommand7({
|
|
|
1493
1722
|
console.log(`set topic-name template for group ${args.id}: ${g.telegramTopicNameFormat}`);
|
|
1494
1723
|
}
|
|
1495
1724
|
});
|
|
1496
|
-
var topicFormatClearCmd =
|
|
1725
|
+
var topicFormatClearCmd = defineCommand8({
|
|
1497
1726
|
meta: { name: "clear", description: "Clear the template (revert to built-in naming)" },
|
|
1498
1727
|
args: { id: { type: "positional", required: true } },
|
|
1499
1728
|
async run({ args }) {
|
|
@@ -1503,7 +1732,7 @@ var topicFormatClearCmd = defineCommand7({
|
|
|
1503
1732
|
console.log(`cleared topic-name template for group ${args.id}`);
|
|
1504
1733
|
}
|
|
1505
1734
|
});
|
|
1506
|
-
var topicFormatCmd =
|
|
1735
|
+
var topicFormatCmd = defineCommand8({
|
|
1507
1736
|
meta: {
|
|
1508
1737
|
name: "topic-format",
|
|
1509
1738
|
description: "View or edit a group's Telegram forum-topic name template"
|
|
@@ -1514,7 +1743,7 @@ var topicFormatCmd = defineCommand7({
|
|
|
1514
1743
|
clear: topicFormatClearCmd
|
|
1515
1744
|
}
|
|
1516
1745
|
});
|
|
1517
|
-
var groupCommand =
|
|
1746
|
+
var groupCommand = defineCommand8({
|
|
1518
1747
|
meta: { name: "group", description: "Manage groups (collaboration contexts)" },
|
|
1519
1748
|
subCommands: {
|
|
1520
1749
|
add: addCmd,
|
|
@@ -1526,7 +1755,7 @@ var groupCommand = defineCommand7({
|
|
|
1526
1755
|
});
|
|
1527
1756
|
|
|
1528
1757
|
// src/commands/inbox.ts
|
|
1529
|
-
import { defineCommand as
|
|
1758
|
+
import { defineCommand as defineCommand9 } from "citty";
|
|
1530
1759
|
function decodeText(payload) {
|
|
1531
1760
|
try {
|
|
1532
1761
|
const obj = JSON.parse(payload);
|
|
@@ -1542,7 +1771,7 @@ function messageRow(m) {
|
|
|
1542
1771
|
const preview = text.length > 60 ? `${text.slice(0, 60)}\u2026` : text;
|
|
1543
1772
|
return [m.id, state, when, `from:${m.fromAgentId.slice(0, 8)}`, `"${preview}"`];
|
|
1544
1773
|
}
|
|
1545
|
-
var listCmd4 =
|
|
1774
|
+
var listCmd4 = defineCommand9({
|
|
1546
1775
|
meta: { name: "list", description: "List messages in an agent inbox" },
|
|
1547
1776
|
args: {
|
|
1548
1777
|
agent: { type: "positional", required: true, description: "Recipient agent id" },
|
|
@@ -1561,7 +1790,7 @@ var listCmd4 = defineCommand8({
|
|
|
1561
1790
|
for (const line of columnize(messages.map(messageRow))) console.log(line);
|
|
1562
1791
|
}
|
|
1563
1792
|
});
|
|
1564
|
-
var showCmd2 =
|
|
1793
|
+
var showCmd2 = defineCommand9({
|
|
1565
1794
|
meta: { name: "show", description: "Show a single message in full" },
|
|
1566
1795
|
args: {
|
|
1567
1796
|
id: { type: "positional", required: true, description: "Message id" }
|
|
@@ -1581,7 +1810,7 @@ var showCmd2 = defineCommand8({
|
|
|
1581
1810
|
console.log(decodeText(m.payload));
|
|
1582
1811
|
}
|
|
1583
1812
|
});
|
|
1584
|
-
var readCmd =
|
|
1813
|
+
var readCmd = defineCommand9({
|
|
1585
1814
|
meta: { name: "read", description: "Mark a message as read" },
|
|
1586
1815
|
args: {
|
|
1587
1816
|
id: { type: "positional", required: true, description: "Message id" }
|
|
@@ -1592,7 +1821,7 @@ var readCmd = defineCommand8({
|
|
|
1592
1821
|
console.log(`marked read: ${args.id}`);
|
|
1593
1822
|
}
|
|
1594
1823
|
});
|
|
1595
|
-
var inboxCommand =
|
|
1824
|
+
var inboxCommand = defineCommand9({
|
|
1596
1825
|
meta: { name: "inbox", description: "Inspect agent inboxes" },
|
|
1597
1826
|
subCommands: {
|
|
1598
1827
|
list: listCmd4,
|
|
@@ -1602,8 +1831,8 @@ var inboxCommand = defineCommand8({
|
|
|
1602
1831
|
});
|
|
1603
1832
|
|
|
1604
1833
|
// src/commands/login.ts
|
|
1605
|
-
import { existsSync as
|
|
1606
|
-
import { defineCommand as
|
|
1834
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
1835
|
+
import { defineCommand as defineCommand10 } from "citty";
|
|
1607
1836
|
function normalizeServer(raw) {
|
|
1608
1837
|
let url;
|
|
1609
1838
|
try {
|
|
@@ -1623,7 +1852,7 @@ async function verifyToken(server, token) {
|
|
|
1623
1852
|
if (res.status === 401) throw new Error("server rejected token (401)");
|
|
1624
1853
|
if (!res.ok) throw new Error(`server returned ${res.status} from /api/health`);
|
|
1625
1854
|
}
|
|
1626
|
-
var loginCommand =
|
|
1855
|
+
var loginCommand = defineCommand10({
|
|
1627
1856
|
meta: {
|
|
1628
1857
|
name: "login",
|
|
1629
1858
|
description: "Save a remote bazilion server + token pair to auth.json"
|
|
@@ -1636,7 +1865,7 @@ var loginCommand = defineCommand9({
|
|
|
1636
1865
|
},
|
|
1637
1866
|
async run({ args }) {
|
|
1638
1867
|
const paths = resolveCliPaths();
|
|
1639
|
-
if (!
|
|
1868
|
+
if (!existsSync4(paths.authFile)) {
|
|
1640
1869
|
throw new Error(
|
|
1641
1870
|
`${paths.authFile} not found. Start the daemon with "bazilion serve" first \u2014 login stores the remote there.`
|
|
1642
1871
|
);
|
|
@@ -1671,7 +1900,7 @@ var loginCommand = defineCommand9({
|
|
|
1671
1900
|
});
|
|
1672
1901
|
|
|
1673
1902
|
// src/commands/mcp.ts
|
|
1674
|
-
import { defineCommand as
|
|
1903
|
+
import { defineCommand as defineCommand11 } from "citty";
|
|
1675
1904
|
function serverRow(s) {
|
|
1676
1905
|
const where = s.transport === "stdio" ? `${s.command} ${s.args.join(" ")}`.trim() : s.url ?? "";
|
|
1677
1906
|
return [
|
|
@@ -1683,7 +1912,7 @@ function serverRow(s) {
|
|
|
1683
1912
|
where
|
|
1684
1913
|
];
|
|
1685
1914
|
}
|
|
1686
|
-
var addCmd2 =
|
|
1915
|
+
var addCmd2 = defineCommand11({
|
|
1687
1916
|
meta: { name: "add", description: "Register an MCP server" },
|
|
1688
1917
|
args: {
|
|
1689
1918
|
name: { type: "positional", required: true, description: "Unique name ([a-zA-Z0-9_])" },
|
|
@@ -1710,7 +1939,7 @@ var addCmd2 = defineCommand10({
|
|
|
1710
1939
|
console.log(`${server.id} ${server.name} ${server.transport}`);
|
|
1711
1940
|
}
|
|
1712
1941
|
});
|
|
1713
|
-
var listCmd5 =
|
|
1942
|
+
var listCmd5 = defineCommand11({
|
|
1714
1943
|
meta: { name: "list", description: "List MCP servers" },
|
|
1715
1944
|
async run() {
|
|
1716
1945
|
const client = createClient2();
|
|
@@ -1722,7 +1951,7 @@ var listCmd5 = defineCommand10({
|
|
|
1722
1951
|
for (const line of columnize(servers.map(serverRow))) console.log(line);
|
|
1723
1952
|
}
|
|
1724
1953
|
});
|
|
1725
|
-
var showCmd3 =
|
|
1954
|
+
var showCmd3 = defineCommand11({
|
|
1726
1955
|
meta: { name: "show", description: "Show one MCP server" },
|
|
1727
1956
|
args: { id: { type: "positional", required: true } },
|
|
1728
1957
|
async run({ args }) {
|
|
@@ -1731,7 +1960,7 @@ var showCmd3 = defineCommand10({
|
|
|
1731
1960
|
console.log(JSON.stringify(server, null, 2));
|
|
1732
1961
|
}
|
|
1733
1962
|
});
|
|
1734
|
-
var rmCmd3 =
|
|
1963
|
+
var rmCmd3 = defineCommand11({
|
|
1735
1964
|
meta: { name: "rm", description: "Delete an MCP server" },
|
|
1736
1965
|
args: { id: { type: "positional", required: true } },
|
|
1737
1966
|
async run({ args }) {
|
|
@@ -1740,7 +1969,7 @@ var rmCmd3 = defineCommand10({
|
|
|
1740
1969
|
console.log(`removed MCP server ${args.id}`);
|
|
1741
1970
|
}
|
|
1742
1971
|
});
|
|
1743
|
-
var enableCmd =
|
|
1972
|
+
var enableCmd = defineCommand11({
|
|
1744
1973
|
meta: { name: "enable", description: "Enable an MCP server" },
|
|
1745
1974
|
args: { id: { type: "positional", required: true } },
|
|
1746
1975
|
async run({ args }) {
|
|
@@ -1749,7 +1978,7 @@ var enableCmd = defineCommand10({
|
|
|
1749
1978
|
console.log(`enabled MCP server ${args.id}`);
|
|
1750
1979
|
}
|
|
1751
1980
|
});
|
|
1752
|
-
var disableCmd =
|
|
1981
|
+
var disableCmd = defineCommand11({
|
|
1753
1982
|
meta: { name: "disable", description: "Disable an MCP server" },
|
|
1754
1983
|
args: { id: { type: "positional", required: true } },
|
|
1755
1984
|
async run({ args }) {
|
|
@@ -1758,7 +1987,7 @@ var disableCmd = defineCommand10({
|
|
|
1758
1987
|
console.log(`disabled MCP server ${args.id}`);
|
|
1759
1988
|
}
|
|
1760
1989
|
});
|
|
1761
|
-
var testCmd =
|
|
1990
|
+
var testCmd = defineCommand11({
|
|
1762
1991
|
meta: { name: "test", description: "Connect to a server and list its tools" },
|
|
1763
1992
|
args: { id: { type: "positional", required: true } },
|
|
1764
1993
|
async run({ args }) {
|
|
@@ -1776,7 +2005,7 @@ var testCmd = defineCommand10({
|
|
|
1776
2005
|
for (const t of tools) console.log(` ${t.name} ${t.description}`);
|
|
1777
2006
|
}
|
|
1778
2007
|
});
|
|
1779
|
-
var mcpCommand =
|
|
2008
|
+
var mcpCommand = defineCommand11({
|
|
1780
2009
|
meta: { name: "mcp", description: "Manage MCP servers" },
|
|
1781
2010
|
subCommands: {
|
|
1782
2011
|
add: addCmd2,
|
|
@@ -1790,11 +2019,11 @@ var mcpCommand = defineCommand10({
|
|
|
1790
2019
|
});
|
|
1791
2020
|
|
|
1792
2021
|
// src/commands/memory.ts
|
|
1793
|
-
import { defineCommand as
|
|
2022
|
+
import { defineCommand as defineCommand12 } from "citty";
|
|
1794
2023
|
function encodeKey(key) {
|
|
1795
2024
|
return key.split("/").map(encodeURIComponent).join("/");
|
|
1796
2025
|
}
|
|
1797
|
-
var writeCmd =
|
|
2026
|
+
var writeCmd = defineCommand12({
|
|
1798
2027
|
meta: { name: "write", description: "Write an entry into a group's shared memory" },
|
|
1799
2028
|
args: {
|
|
1800
2029
|
group: { type: "positional", required: true, description: "Group slug" },
|
|
@@ -1810,7 +2039,7 @@ var writeCmd = defineCommand11({
|
|
|
1810
2039
|
console.log(`wrote ${entry2.key} (${entry2.content.length} bytes)`);
|
|
1811
2040
|
}
|
|
1812
2041
|
});
|
|
1813
|
-
var readCmd2 =
|
|
2042
|
+
var readCmd2 = defineCommand12({
|
|
1814
2043
|
meta: { name: "read", description: "Read an entry from a group's shared memory" },
|
|
1815
2044
|
args: {
|
|
1816
2045
|
group: { type: "positional", required: true, description: "Group slug" },
|
|
@@ -1824,7 +2053,7 @@ var readCmd2 = defineCommand11({
|
|
|
1824
2053
|
console.log(entry2.content);
|
|
1825
2054
|
}
|
|
1826
2055
|
});
|
|
1827
|
-
var searchCmd =
|
|
2056
|
+
var searchCmd = defineCommand12({
|
|
1828
2057
|
meta: { name: "search", description: "Search a group's shared memory" },
|
|
1829
2058
|
args: {
|
|
1830
2059
|
group: { type: "positional", required: true, description: "Group slug" },
|
|
@@ -1845,7 +2074,7 @@ var searchCmd = defineCommand11({
|
|
|
1845
2074
|
}
|
|
1846
2075
|
}
|
|
1847
2076
|
});
|
|
1848
|
-
var listCmd6 =
|
|
2077
|
+
var listCmd6 = defineCommand12({
|
|
1849
2078
|
meta: { name: "list", description: "List all entries in a group's shared memory" },
|
|
1850
2079
|
args: {
|
|
1851
2080
|
group: { type: "positional", required: true, description: "Group slug" }
|
|
@@ -1862,7 +2091,7 @@ var listCmd6 = defineCommand11({
|
|
|
1862
2091
|
}
|
|
1863
2092
|
}
|
|
1864
2093
|
});
|
|
1865
|
-
var rmCmd4 =
|
|
2094
|
+
var rmCmd4 = defineCommand12({
|
|
1866
2095
|
meta: { name: "rm", description: "Remove an entry from a group's shared memory" },
|
|
1867
2096
|
args: {
|
|
1868
2097
|
group: { type: "positional", required: true, description: "Group slug" },
|
|
@@ -1874,7 +2103,7 @@ var rmCmd4 = defineCommand11({
|
|
|
1874
2103
|
console.log(`removed ${args.key}`);
|
|
1875
2104
|
}
|
|
1876
2105
|
});
|
|
1877
|
-
var memoryCommand =
|
|
2106
|
+
var memoryCommand = defineCommand12({
|
|
1878
2107
|
meta: {
|
|
1879
2108
|
name: "memory",
|
|
1880
2109
|
description: "Manage a group's shared memory (BM25-indexed markdown notes)"
|
|
@@ -1889,11 +2118,11 @@ var memoryCommand = defineCommand11({
|
|
|
1889
2118
|
});
|
|
1890
2119
|
|
|
1891
2120
|
// src/commands/profile.ts
|
|
1892
|
-
import { spawn as
|
|
2121
|
+
import { spawn as spawn3 } from "child_process";
|
|
1893
2122
|
import { randomBytes } from "crypto";
|
|
1894
2123
|
import { readFileSync as readFileSync5, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
1895
2124
|
import { tmpdir } from "os";
|
|
1896
|
-
import { join as
|
|
2125
|
+
import { join as join3 } from "path";
|
|
1897
2126
|
|
|
1898
2127
|
// ../../packages/api-types/src/index.ts
|
|
1899
2128
|
var PROFILE_FILES = [
|
|
@@ -1907,7 +2136,7 @@ var PROFILE_FILES = [
|
|
|
1907
2136
|
];
|
|
1908
2137
|
|
|
1909
2138
|
// src/commands/profile.ts
|
|
1910
|
-
import { defineCommand as
|
|
2139
|
+
import { defineCommand as defineCommand13 } from "citty";
|
|
1911
2140
|
function splitCsv(v) {
|
|
1912
2141
|
if (!v) return void 0;
|
|
1913
2142
|
const out = v.split(",").map((s) => s.trim()).filter(Boolean);
|
|
@@ -1918,7 +2147,7 @@ function parseSkillsMode(v) {
|
|
|
1918
2147
|
if (v === "all" || v === "selected") return v;
|
|
1919
2148
|
throw new Error(`--skills-mode must be 'all' or 'selected', got '${v}'`);
|
|
1920
2149
|
}
|
|
1921
|
-
var createCmd2 =
|
|
2150
|
+
var createCmd2 = defineCommand13({
|
|
1922
2151
|
meta: { name: "create", description: "Create a new profile" },
|
|
1923
2152
|
args: {
|
|
1924
2153
|
id: { type: "positional", required: true, description: "Profile slug" },
|
|
@@ -1986,7 +2215,7 @@ var createCmd2 = defineCommand12({
|
|
|
1986
2215
|
console.log(`created profile ${profile.id} at ${profile.dir}`);
|
|
1987
2216
|
}
|
|
1988
2217
|
});
|
|
1989
|
-
var listCmd7 =
|
|
2218
|
+
var listCmd7 = defineCommand13({
|
|
1990
2219
|
meta: { name: "list", description: "List profiles" },
|
|
1991
2220
|
async run() {
|
|
1992
2221
|
const client = createClient2();
|
|
@@ -1999,7 +2228,7 @@ var listCmd7 = defineCommand12({
|
|
|
1999
2228
|
for (const line of columnize(rows)) console.log(line);
|
|
2000
2229
|
}
|
|
2001
2230
|
});
|
|
2002
|
-
var showCmd4 =
|
|
2231
|
+
var showCmd4 = defineCommand13({
|
|
2003
2232
|
meta: { name: "show", description: "Show profile details" },
|
|
2004
2233
|
args: {
|
|
2005
2234
|
id: { type: "positional", required: true }
|
|
@@ -2025,7 +2254,7 @@ var showCmd4 = defineCommand12({
|
|
|
2025
2254
|
}
|
|
2026
2255
|
}
|
|
2027
2256
|
});
|
|
2028
|
-
var editCmd2 =
|
|
2257
|
+
var editCmd2 = defineCommand13({
|
|
2029
2258
|
meta: { name: "edit", description: "Open a profile file in $EDITOR" },
|
|
2030
2259
|
args: {
|
|
2031
2260
|
id: { type: "positional", required: true },
|
|
@@ -2044,12 +2273,12 @@ var editCmd2 = defineCommand12({
|
|
|
2044
2273
|
const { content } = await client.get(
|
|
2045
2274
|
`/api/profiles/${args.id}/files/${file}`
|
|
2046
2275
|
);
|
|
2047
|
-
const tmpPath =
|
|
2276
|
+
const tmpPath = join3(tmpdir(), `bazilion-${args.id}-${file}-${randomBytes(4).toString("hex")}`);
|
|
2048
2277
|
writeFileSync3(tmpPath, content);
|
|
2049
2278
|
try {
|
|
2050
2279
|
const editor = process.env.EDITOR ?? process.env.VISUAL ?? "vi";
|
|
2051
2280
|
const code = await new Promise((resolve3, reject) => {
|
|
2052
|
-
const child =
|
|
2281
|
+
const child = spawn3(editor, [tmpPath], { stdio: "inherit" });
|
|
2053
2282
|
child.on("error", reject);
|
|
2054
2283
|
child.on("close", (c) => resolve3(c ?? 0));
|
|
2055
2284
|
});
|
|
@@ -2070,7 +2299,7 @@ var editCmd2 = defineCommand12({
|
|
|
2070
2299
|
}
|
|
2071
2300
|
}
|
|
2072
2301
|
});
|
|
2073
|
-
var updateCmd =
|
|
2302
|
+
var updateCmd = defineCommand13({
|
|
2074
2303
|
meta: {
|
|
2075
2304
|
name: "update",
|
|
2076
2305
|
description: "Update profile settings (name, model, skills-mode, skills)"
|
|
@@ -2104,7 +2333,7 @@ var updateCmd = defineCommand12({
|
|
|
2104
2333
|
console.log(`updated profile ${profile.id}`);
|
|
2105
2334
|
}
|
|
2106
2335
|
});
|
|
2107
|
-
var deleteCmd2 =
|
|
2336
|
+
var deleteCmd2 = defineCommand13({
|
|
2108
2337
|
meta: { name: "delete", description: "Permanently delete a profile and its files" },
|
|
2109
2338
|
args: {
|
|
2110
2339
|
id: { type: "positional", required: true }
|
|
@@ -2115,7 +2344,7 @@ var deleteCmd2 = defineCommand12({
|
|
|
2115
2344
|
console.log(`deleted profile ${args.id}`);
|
|
2116
2345
|
}
|
|
2117
2346
|
});
|
|
2118
|
-
var profileCommand =
|
|
2347
|
+
var profileCommand = defineCommand13({
|
|
2119
2348
|
meta: { name: "profile", description: "Manage profiles" },
|
|
2120
2349
|
subCommands: {
|
|
2121
2350
|
create: createCmd2,
|
|
@@ -2128,13 +2357,13 @@ var profileCommand = defineCommand12({
|
|
|
2128
2357
|
});
|
|
2129
2358
|
|
|
2130
2359
|
// src/commands/profile-group.ts
|
|
2131
|
-
import { spawn as
|
|
2360
|
+
import { spawn as spawn4 } from "child_process";
|
|
2132
2361
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
2133
2362
|
import { readFileSync as readFileSync6, rmSync as rmSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
2134
2363
|
import { tmpdir as tmpdir2 } from "os";
|
|
2135
|
-
import { join as
|
|
2136
|
-
import { defineCommand as
|
|
2137
|
-
var createCmd3 =
|
|
2364
|
+
import { join as join4 } from "path";
|
|
2365
|
+
import { defineCommand as defineCommand14 } from "citty";
|
|
2366
|
+
var createCmd3 = defineCommand14({
|
|
2138
2367
|
meta: { name: "create", description: "Create a new profile group (team template)" },
|
|
2139
2368
|
args: {
|
|
2140
2369
|
id: { type: "positional", required: true, description: "Profile group slug" },
|
|
@@ -2153,7 +2382,7 @@ var createCmd3 = defineCommand13({
|
|
|
2153
2382
|
console.log(`created profile group ${created.id}`);
|
|
2154
2383
|
}
|
|
2155
2384
|
});
|
|
2156
|
-
var listCmd8 =
|
|
2385
|
+
var listCmd8 = defineCommand14({
|
|
2157
2386
|
meta: { name: "list", description: "List profile groups" },
|
|
2158
2387
|
async run() {
|
|
2159
2388
|
const client = createClient2();
|
|
@@ -2166,7 +2395,7 @@ var listCmd8 = defineCommand13({
|
|
|
2166
2395
|
for (const line of columnize(rows)) console.log(line);
|
|
2167
2396
|
}
|
|
2168
2397
|
});
|
|
2169
|
-
var showCmd5 =
|
|
2398
|
+
var showCmd5 = defineCommand14({
|
|
2170
2399
|
meta: { name: "show", description: "Show profile group details + members" },
|
|
2171
2400
|
args: {
|
|
2172
2401
|
id: { type: "positional", required: true },
|
|
@@ -2203,7 +2432,7 @@ var showCmd5 = defineCommand13({
|
|
|
2203
2432
|
for (const line of columnize(rows)) console.log(` ${line}`);
|
|
2204
2433
|
}
|
|
2205
2434
|
});
|
|
2206
|
-
var updateCmd2 =
|
|
2435
|
+
var updateCmd2 = defineCommand14({
|
|
2207
2436
|
meta: { name: "update", description: "Update profile group basics (name, user-md)" },
|
|
2208
2437
|
args: {
|
|
2209
2438
|
id: { type: "positional", required: true },
|
|
@@ -2227,7 +2456,7 @@ var updateCmd2 = defineCommand13({
|
|
|
2227
2456
|
console.log(`updated profile group ${updated.id}`);
|
|
2228
2457
|
}
|
|
2229
2458
|
});
|
|
2230
|
-
var editCmd3 =
|
|
2459
|
+
var editCmd3 = defineCommand14({
|
|
2231
2460
|
meta: { name: "edit", description: "Edit the member array in $EDITOR (JSON)" },
|
|
2232
2461
|
args: {
|
|
2233
2462
|
id: { type: "positional", required: true }
|
|
@@ -2243,7 +2472,7 @@ var editCmd3 = defineCommand13({
|
|
|
2243
2472
|
}));
|
|
2244
2473
|
const before = `${JSON.stringify(editable, null, 2)}
|
|
2245
2474
|
`;
|
|
2246
|
-
const tmpPath =
|
|
2475
|
+
const tmpPath = join4(
|
|
2247
2476
|
tmpdir2(),
|
|
2248
2477
|
`bazilion-profile-group-${args.id}-${randomBytes2(4).toString("hex")}.json`
|
|
2249
2478
|
);
|
|
@@ -2251,7 +2480,7 @@ var editCmd3 = defineCommand13({
|
|
|
2251
2480
|
try {
|
|
2252
2481
|
const editor = process.env.EDITOR ?? process.env.VISUAL ?? "vi";
|
|
2253
2482
|
const code = await new Promise((resolve3, reject) => {
|
|
2254
|
-
const child =
|
|
2483
|
+
const child = spawn4(editor, [tmpPath], { stdio: "inherit" });
|
|
2255
2484
|
child.on("error", reject);
|
|
2256
2485
|
child.on("close", (c) => resolve3(c ?? 0));
|
|
2257
2486
|
});
|
|
@@ -2294,7 +2523,7 @@ var editCmd3 = defineCommand13({
|
|
|
2294
2523
|
}
|
|
2295
2524
|
}
|
|
2296
2525
|
});
|
|
2297
|
-
var deleteCmd3 =
|
|
2526
|
+
var deleteCmd3 = defineCommand14({
|
|
2298
2527
|
meta: { name: "delete", description: "Delete a profile group (does not affect spawned agents)" },
|
|
2299
2528
|
args: {
|
|
2300
2529
|
id: { type: "positional", required: true }
|
|
@@ -2305,7 +2534,7 @@ var deleteCmd3 = defineCommand13({
|
|
|
2305
2534
|
console.log(`deleted profile group ${args.id}`);
|
|
2306
2535
|
}
|
|
2307
2536
|
});
|
|
2308
|
-
var spawnCmd2 =
|
|
2537
|
+
var spawnCmd2 = defineCommand14({
|
|
2309
2538
|
meta: { name: "spawn", description: "Spawn the whole team into a group (transactional)" },
|
|
2310
2539
|
args: {
|
|
2311
2540
|
id: { type: "positional", required: true },
|
|
@@ -2338,7 +2567,7 @@ var spawnCmd2 = defineCommand13({
|
|
|
2338
2567
|
}
|
|
2339
2568
|
}
|
|
2340
2569
|
});
|
|
2341
|
-
var profileGroupCommand =
|
|
2570
|
+
var profileGroupCommand = defineCommand14({
|
|
2342
2571
|
meta: { name: "profile-group", description: "Manage profile groups" },
|
|
2343
2572
|
subCommands: {
|
|
2344
2573
|
create: createCmd3,
|
|
@@ -2352,8 +2581,8 @@ var profileGroupCommand = defineCommand13({
|
|
|
2352
2581
|
});
|
|
2353
2582
|
|
|
2354
2583
|
// src/commands/provider.ts
|
|
2355
|
-
import { defineCommand as
|
|
2356
|
-
var listCmd9 =
|
|
2584
|
+
import { defineCommand as defineCommand15 } from "citty";
|
|
2585
|
+
var listCmd9 = defineCommand15({
|
|
2357
2586
|
meta: {
|
|
2358
2587
|
name: "list",
|
|
2359
2588
|
description: "List all providers with enabled/disabled state and curated model counts"
|
|
@@ -2379,7 +2608,7 @@ var listCmd9 = defineCommand14({
|
|
|
2379
2608
|
for (const line of columnize(rows)) console.log(line);
|
|
2380
2609
|
}
|
|
2381
2610
|
});
|
|
2382
|
-
var modelsCmd =
|
|
2611
|
+
var modelsCmd = defineCommand15({
|
|
2383
2612
|
meta: {
|
|
2384
2613
|
name: "models",
|
|
2385
2614
|
description: "Show curated + catalog + live models for one provider"
|
|
@@ -2411,7 +2640,7 @@ var modelsCmd = defineCommand14({
|
|
|
2411
2640
|
}
|
|
2412
2641
|
}
|
|
2413
2642
|
});
|
|
2414
|
-
var modelsSetCmd =
|
|
2643
|
+
var modelsSetCmd = defineCommand15({
|
|
2415
2644
|
meta: {
|
|
2416
2645
|
name: "models-set",
|
|
2417
2646
|
description: "Replace the curated model list for a provider (comma-separated)"
|
|
@@ -2436,7 +2665,7 @@ var modelsSetCmd = defineCommand14({
|
|
|
2436
2665
|
for (const m of saved.models) console.log(` ${m}`);
|
|
2437
2666
|
}
|
|
2438
2667
|
});
|
|
2439
|
-
var enableCmd2 =
|
|
2668
|
+
var enableCmd2 = defineCommand15({
|
|
2440
2669
|
meta: { name: "enable", description: "Toggle a provider on so agents can use it" },
|
|
2441
2670
|
args: {
|
|
2442
2671
|
name: { type: "positional", required: true, description: "Provider id (e.g. anthropic)" }
|
|
@@ -2450,7 +2679,7 @@ var enableCmd2 = defineCommand14({
|
|
|
2450
2679
|
console.log(`${res.name}: enabled`);
|
|
2451
2680
|
}
|
|
2452
2681
|
});
|
|
2453
|
-
var disableCmd2 =
|
|
2682
|
+
var disableCmd2 = defineCommand15({
|
|
2454
2683
|
meta: {
|
|
2455
2684
|
name: "disable",
|
|
2456
2685
|
description: "Toggle a provider off \u2014 agents will refuse its model strings"
|
|
@@ -2467,7 +2696,7 @@ var disableCmd2 = defineCommand14({
|
|
|
2467
2696
|
console.log(`${res.name}: disabled`);
|
|
2468
2697
|
}
|
|
2469
2698
|
});
|
|
2470
|
-
var testCmd2 =
|
|
2699
|
+
var testCmd2 = defineCommand15({
|
|
2471
2700
|
meta: { name: "test", description: "Send a single chat to a model and print the reply" },
|
|
2472
2701
|
args: {
|
|
2473
2702
|
model: {
|
|
@@ -2488,7 +2717,7 @@ var testCmd2 = defineCommand14({
|
|
|
2488
2717
|
}
|
|
2489
2718
|
}
|
|
2490
2719
|
});
|
|
2491
|
-
var providerCommand =
|
|
2720
|
+
var providerCommand = defineCommand15({
|
|
2492
2721
|
meta: { name: "provider", description: "Manage and test LLM providers" },
|
|
2493
2722
|
subCommands: {
|
|
2494
2723
|
list: listCmd9,
|
|
@@ -2501,8 +2730,8 @@ var providerCommand = defineCommand14({
|
|
|
2501
2730
|
});
|
|
2502
2731
|
|
|
2503
2732
|
// src/commands/send.ts
|
|
2504
|
-
import { defineCommand as
|
|
2505
|
-
var sendCommand =
|
|
2733
|
+
import { defineCommand as defineCommand16 } from "citty";
|
|
2734
|
+
var sendCommand = defineCommand16({
|
|
2506
2735
|
meta: {
|
|
2507
2736
|
name: "send",
|
|
2508
2737
|
description: "Send a message from one agent to another"
|
|
@@ -2524,14 +2753,14 @@ var sendCommand = defineCommand15({
|
|
|
2524
2753
|
});
|
|
2525
2754
|
|
|
2526
2755
|
// 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 =
|
|
2756
|
+
import { spawn as spawn5 } from "child_process";
|
|
2757
|
+
import { existsSync as existsSync5 } from "fs";
|
|
2758
|
+
import { join as join5 } from "path";
|
|
2759
|
+
import { defineCommand as defineCommand17 } from "citty";
|
|
2760
|
+
var bundledDaemonEntry2 = join5(import.meta.dirname, "daemon.js");
|
|
2761
|
+
var sourceDaemonEntry2 = join5(import.meta.dirname, "..", "..", "..", "daemon", "src", "index.ts");
|
|
2762
|
+
var daemonEntry2 = existsSync5(bundledDaemonEntry2) ? bundledDaemonEntry2 : sourceDaemonEntry2;
|
|
2763
|
+
var serveCommand = defineCommand17({
|
|
2535
2764
|
meta: {
|
|
2536
2765
|
name: "serve",
|
|
2537
2766
|
description: "Start the bazilion daemon (HTTP API)"
|
|
@@ -2544,9 +2773,9 @@ var serveCommand = defineCommand16({
|
|
|
2544
2773
|
}
|
|
2545
2774
|
},
|
|
2546
2775
|
async run({ args }) {
|
|
2547
|
-
if (!
|
|
2776
|
+
if (!existsSync5(daemonEntry2)) {
|
|
2548
2777
|
throw new Error(
|
|
2549
|
-
`bazilion daemon not found at ${
|
|
2778
|
+
`bazilion daemon not found at ${daemonEntry2}. Are you running from a development checkout?`
|
|
2550
2779
|
);
|
|
2551
2780
|
}
|
|
2552
2781
|
const env = { ...process.env };
|
|
@@ -2563,8 +2792,8 @@ var serveCommand = defineCommand16({
|
|
|
2563
2792
|
}
|
|
2564
2793
|
console.log(`starting bazilion daemon at http://${host}:${port}`);
|
|
2565
2794
|
console.log("(web UI runs separately: cd apps/web && pnpm dev)");
|
|
2566
|
-
const
|
|
2567
|
-
const proc =
|
|
2795
|
+
const nodeArgs2 = daemonEntry2.endsWith(".ts") ? ["--import", "tsx/esm", daemonEntry2] : [daemonEntry2];
|
|
2796
|
+
const proc = spawn5("node", nodeArgs2, {
|
|
2568
2797
|
env,
|
|
2569
2798
|
stdio: "inherit"
|
|
2570
2799
|
});
|
|
@@ -2598,10 +2827,10 @@ var serveCommand = defineCommand16({
|
|
|
2598
2827
|
});
|
|
2599
2828
|
|
|
2600
2829
|
// src/commands/skill.ts
|
|
2601
|
-
import { existsSync as
|
|
2830
|
+
import { existsSync as existsSync6, readFileSync as readFileSync7, statSync } from "fs";
|
|
2602
2831
|
import { basename as basename2, resolve as resolve2 } from "path";
|
|
2603
|
-
import { defineCommand as
|
|
2604
|
-
var listCmd10 =
|
|
2832
|
+
import { defineCommand as defineCommand18 } from "citty";
|
|
2833
|
+
var listCmd10 = defineCommand18({
|
|
2605
2834
|
meta: { name: "list", description: "List installed skills (or those attached to an agent)" },
|
|
2606
2835
|
args: {
|
|
2607
2836
|
agent: { type: "string", description: "Filter to skills attached to this agent" }
|
|
@@ -2633,7 +2862,7 @@ var listCmd10 = defineCommand17({
|
|
|
2633
2862
|
for (const line of columnize(rows)) console.log(line);
|
|
2634
2863
|
}
|
|
2635
2864
|
});
|
|
2636
|
-
var importCmd =
|
|
2865
|
+
var importCmd = defineCommand18({
|
|
2637
2866
|
meta: {
|
|
2638
2867
|
name: "import",
|
|
2639
2868
|
description: "Import skills from openclaw, a directory, or a local .zip archive"
|
|
@@ -2649,7 +2878,7 @@ var importCmd = defineCommand17({
|
|
|
2649
2878
|
async run({ args }) {
|
|
2650
2879
|
const client = createClient2();
|
|
2651
2880
|
const absFrom = resolve2(args.from);
|
|
2652
|
-
const isLocalZip = args.from.toLowerCase().endsWith(".zip") &&
|
|
2881
|
+
const isLocalZip = args.from.toLowerCase().endsWith(".zip") && existsSync6(absFrom) && statSync(absFrom).isFile();
|
|
2653
2882
|
let result;
|
|
2654
2883
|
if (isLocalZip) {
|
|
2655
2884
|
const bytes = readFileSync7(absFrom);
|
|
@@ -2677,7 +2906,7 @@ var importCmd = defineCommand17({
|
|
|
2677
2906
|
}
|
|
2678
2907
|
}
|
|
2679
2908
|
});
|
|
2680
|
-
var rmCmd5 =
|
|
2909
|
+
var rmCmd5 = defineCommand18({
|
|
2681
2910
|
meta: { name: "rm", description: "Remove an installed skill" },
|
|
2682
2911
|
args: {
|
|
2683
2912
|
name: { type: "positional", required: true }
|
|
@@ -2688,7 +2917,7 @@ var rmCmd5 = defineCommand17({
|
|
|
2688
2917
|
console.log(`removed skill ${args.name}`);
|
|
2689
2918
|
}
|
|
2690
2919
|
});
|
|
2691
|
-
var skillCommand =
|
|
2920
|
+
var skillCommand = defineCommand18({
|
|
2692
2921
|
meta: { name: "skill", description: "Manage the skill library" },
|
|
2693
2922
|
subCommands: {
|
|
2694
2923
|
list: listCmd10,
|
|
@@ -2698,8 +2927,8 @@ var skillCommand = defineCommand17({
|
|
|
2698
2927
|
});
|
|
2699
2928
|
|
|
2700
2929
|
// src/commands/telegram.ts
|
|
2701
|
-
import { defineCommand as
|
|
2702
|
-
var setCmd2 =
|
|
2930
|
+
import { defineCommand as defineCommand19 } from "citty";
|
|
2931
|
+
var setCmd2 = defineCommand19({
|
|
2703
2932
|
meta: {
|
|
2704
2933
|
name: "set",
|
|
2705
2934
|
description: "Save bot token + supergroup chat ID (paired write)"
|
|
@@ -2717,7 +2946,7 @@ var setCmd2 = defineCommand18({
|
|
|
2717
2946
|
console.log(`saved \xB7 token ${state.botTokenPreview} \xB7 chat ${state.chatId}`);
|
|
2718
2947
|
}
|
|
2719
2948
|
});
|
|
2720
|
-
var clearCmd =
|
|
2949
|
+
var clearCmd = defineCommand19({
|
|
2721
2950
|
meta: {
|
|
2722
2951
|
name: "clear",
|
|
2723
2952
|
description: "Remove stored bot token + chat ID"
|
|
@@ -2728,7 +2957,7 @@ var clearCmd = defineCommand18({
|
|
|
2728
2957
|
console.log("cleared");
|
|
2729
2958
|
}
|
|
2730
2959
|
});
|
|
2731
|
-
var showCmd6 =
|
|
2960
|
+
var showCmd6 = defineCommand19({
|
|
2732
2961
|
meta: {
|
|
2733
2962
|
name: "show",
|
|
2734
2963
|
description: "Show what credentials are stored (token is masked)"
|
|
@@ -2749,7 +2978,7 @@ var showCmd6 = defineCommand18({
|
|
|
2749
2978
|
}
|
|
2750
2979
|
}
|
|
2751
2980
|
});
|
|
2752
|
-
var reconnectCmd =
|
|
2981
|
+
var reconnectCmd = defineCommand19({
|
|
2753
2982
|
meta: {
|
|
2754
2983
|
name: "reconnect",
|
|
2755
2984
|
description: "Apply a pending supergroup chat-id migration + re-activate the bot"
|
|
@@ -2760,7 +2989,7 @@ var reconnectCmd = defineCommand18({
|
|
|
2760
2989
|
console.log(`reconnected \xB7 chat ${state.chatId}`);
|
|
2761
2990
|
}
|
|
2762
2991
|
});
|
|
2763
|
-
var configCmd =
|
|
2992
|
+
var configCmd = defineCommand19({
|
|
2764
2993
|
meta: {
|
|
2765
2994
|
name: "config",
|
|
2766
2995
|
description: "Manage Telegram credentials (bot token + chat ID)"
|
|
@@ -2771,7 +3000,7 @@ var configCmd = defineCommand18({
|
|
|
2771
3000
|
show: showCmd6
|
|
2772
3001
|
}
|
|
2773
3002
|
});
|
|
2774
|
-
var healthCmd =
|
|
3003
|
+
var healthCmd = defineCommand19({
|
|
2775
3004
|
meta: {
|
|
2776
3005
|
name: "health",
|
|
2777
3006
|
description: "Run the four-step preflight against the Telegram Bot API"
|
|
@@ -2805,7 +3034,7 @@ var healthCmd = defineCommand18({
|
|
|
2805
3034
|
if (!allOk) process.exitCode = 1;
|
|
2806
3035
|
}
|
|
2807
3036
|
});
|
|
2808
|
-
var botStatusCmd =
|
|
3037
|
+
var botStatusCmd = defineCommand19({
|
|
2809
3038
|
meta: {
|
|
2810
3039
|
name: "status",
|
|
2811
3040
|
description: "Show polling state of the live bot"
|
|
@@ -2830,7 +3059,7 @@ var botStatusCmd = defineCommand18({
|
|
|
2830
3059
|
if (!p.running) process.exitCode = 1;
|
|
2831
3060
|
}
|
|
2832
3061
|
});
|
|
2833
|
-
var botRestartCmd =
|
|
3062
|
+
var botRestartCmd = defineCommand19({
|
|
2834
3063
|
meta: {
|
|
2835
3064
|
name: "restart",
|
|
2836
3065
|
description: "Force-restart the bot (tears down + brings up from current creds)"
|
|
@@ -2841,7 +3070,7 @@ var botRestartCmd = defineCommand18({
|
|
|
2841
3070
|
console.log("restart requested");
|
|
2842
3071
|
}
|
|
2843
3072
|
});
|
|
2844
|
-
var botCmd =
|
|
3073
|
+
var botCmd = defineCommand19({
|
|
2845
3074
|
meta: {
|
|
2846
3075
|
name: "bot",
|
|
2847
3076
|
description: "Inspect / control the live polling bot"
|
|
@@ -2851,7 +3080,7 @@ var botCmd = defineCommand18({
|
|
|
2851
3080
|
restart: botRestartCmd
|
|
2852
3081
|
}
|
|
2853
3082
|
});
|
|
2854
|
-
var bindCmd =
|
|
3083
|
+
var bindCmd = defineCommand19({
|
|
2855
3084
|
meta: {
|
|
2856
3085
|
name: "bind",
|
|
2857
3086
|
description: "Create a Telegram topic for an agent (manual fallback for /talk)"
|
|
@@ -2869,7 +3098,7 @@ var bindCmd = defineCommand18({
|
|
|
2869
3098
|
console.log(` ${result.deepLink}`);
|
|
2870
3099
|
}
|
|
2871
3100
|
});
|
|
2872
|
-
var unbindCmd =
|
|
3101
|
+
var unbindCmd = defineCommand19({
|
|
2873
3102
|
meta: {
|
|
2874
3103
|
name: "unbind",
|
|
2875
3104
|
description: "Clear an agent's Telegram topic binding (topic stays in Telegram as orphan)"
|
|
@@ -2883,7 +3112,7 @@ var unbindCmd = defineCommand18({
|
|
|
2883
3112
|
console.log(`unbound agent ${args.agent}`);
|
|
2884
3113
|
}
|
|
2885
3114
|
});
|
|
2886
|
-
var listBindingsCmd =
|
|
3115
|
+
var listBindingsCmd = defineCommand19({
|
|
2887
3116
|
meta: {
|
|
2888
3117
|
name: "list",
|
|
2889
3118
|
description: "List agents and their Telegram topic bindings"
|
|
@@ -2911,7 +3140,7 @@ var listBindingsCmd = defineCommand18({
|
|
|
2911
3140
|
}
|
|
2912
3141
|
}
|
|
2913
3142
|
});
|
|
2914
|
-
var allowCmd =
|
|
3143
|
+
var allowCmd = defineCommand19({
|
|
2915
3144
|
meta: { name: "allow", description: "Add a Telegram user id to the allowlist" },
|
|
2916
3145
|
args: {
|
|
2917
3146
|
userId: { type: "positional", required: true, description: "Numeric Telegram user id" },
|
|
@@ -2928,7 +3157,7 @@ var allowCmd = defineCommand18({
|
|
|
2928
3157
|
console.log(`allowed ${u.userId} (${u.role})`);
|
|
2929
3158
|
}
|
|
2930
3159
|
});
|
|
2931
|
-
var denyCmd =
|
|
3160
|
+
var denyCmd = defineCommand19({
|
|
2932
3161
|
meta: { name: "deny", description: "Remove a Telegram user id from the allowlist" },
|
|
2933
3162
|
args: { userId: { type: "positional", required: true } },
|
|
2934
3163
|
async run({ args }) {
|
|
@@ -2937,7 +3166,7 @@ var denyCmd = defineCommand18({
|
|
|
2937
3166
|
console.log(`removed ${args.userId}`);
|
|
2938
3167
|
}
|
|
2939
3168
|
});
|
|
2940
|
-
var allowedCmd =
|
|
3169
|
+
var allowedCmd = defineCommand19({
|
|
2941
3170
|
meta: { name: "allowed", description: "List allowlisted Telegram users" },
|
|
2942
3171
|
async run() {
|
|
2943
3172
|
const client = createClient2();
|
|
@@ -2952,7 +3181,7 @@ var allowedCmd = defineCommand18({
|
|
|
2952
3181
|
}
|
|
2953
3182
|
}
|
|
2954
3183
|
});
|
|
2955
|
-
var telegramCommand =
|
|
3184
|
+
var telegramCommand = defineCommand19({
|
|
2956
3185
|
meta: {
|
|
2957
3186
|
name: "telegram",
|
|
2958
3187
|
description: "Telegram integration: credentials, health, bot lifecycle, bindings, access"
|
|
@@ -2973,7 +3202,7 @@ var telegramCommand = defineCommand18({
|
|
|
2973
3202
|
|
|
2974
3203
|
// src/commands/token.ts
|
|
2975
3204
|
import { networkInterfaces } from "os";
|
|
2976
|
-
import { defineCommand as
|
|
3205
|
+
import { defineCommand as defineCommand20 } from "citty";
|
|
2977
3206
|
import qrcode from "qrcode-terminal";
|
|
2978
3207
|
function tokenRow(t) {
|
|
2979
3208
|
const last = t.lastUsedAt ? new Date(t.lastUsedAt).toISOString() : "(never)";
|
|
@@ -3007,7 +3236,7 @@ function resolveQrServer(override) {
|
|
|
3007
3236
|
if (detected.warning) console.warn(`\u26A0 ${detected.warning}`);
|
|
3008
3237
|
return detected.origin;
|
|
3009
3238
|
}
|
|
3010
|
-
var createCmd4 =
|
|
3239
|
+
var createCmd4 = defineCommand20({
|
|
3011
3240
|
meta: { name: "create", description: "Mint a new web token (shown once)" },
|
|
3012
3241
|
args: {
|
|
3013
3242
|
label: { type: "positional", required: true, description: "Human-readable label" },
|
|
@@ -3038,7 +3267,7 @@ var createCmd4 = defineCommand19({
|
|
|
3038
3267
|
qrcode.generate(pairUrl, { small: true }, (qr) => console.log(qr));
|
|
3039
3268
|
}
|
|
3040
3269
|
});
|
|
3041
|
-
var listCmd11 =
|
|
3270
|
+
var listCmd11 = defineCommand20({
|
|
3042
3271
|
meta: { name: "list", description: "List web tokens" },
|
|
3043
3272
|
args: {
|
|
3044
3273
|
all: { type: "boolean", description: "Include revoked tokens" }
|
|
@@ -3054,7 +3283,7 @@ var listCmd11 = defineCommand19({
|
|
|
3054
3283
|
for (const line of columnize(tokens.map(tokenRow))) console.log(line);
|
|
3055
3284
|
}
|
|
3056
3285
|
});
|
|
3057
|
-
var showLocalCmd =
|
|
3286
|
+
var showLocalCmd = defineCommand20({
|
|
3058
3287
|
meta: {
|
|
3059
3288
|
name: "show-local",
|
|
3060
3289
|
description: "Print the bootstrap web token stored in ~/.bazilion/auth.json"
|
|
@@ -3064,7 +3293,7 @@ var showLocalCmd = defineCommand19({
|
|
|
3064
3293
|
console.log(readAuthFile(paths.authFile).token);
|
|
3065
3294
|
}
|
|
3066
3295
|
});
|
|
3067
|
-
var revokeCmd =
|
|
3296
|
+
var revokeCmd = defineCommand20({
|
|
3068
3297
|
meta: { name: "revoke", description: "Revoke a web token" },
|
|
3069
3298
|
args: {
|
|
3070
3299
|
id: { type: "positional", required: true }
|
|
@@ -3075,7 +3304,7 @@ var revokeCmd = defineCommand19({
|
|
|
3075
3304
|
console.log(`revoked token ${args.id}`);
|
|
3076
3305
|
}
|
|
3077
3306
|
});
|
|
3078
|
-
var tokenCommand =
|
|
3307
|
+
var tokenCommand = defineCommand20({
|
|
3079
3308
|
meta: { name: "token", description: "Manage web tokens for API/CLI clients" },
|
|
3080
3309
|
subCommands: {
|
|
3081
3310
|
create: createCmd4,
|
|
@@ -3086,8 +3315,8 @@ var tokenCommand = defineCommand19({
|
|
|
3086
3315
|
});
|
|
3087
3316
|
|
|
3088
3317
|
// src/commands/trigger.ts
|
|
3089
|
-
import { defineCommand as
|
|
3090
|
-
var addCmd3 =
|
|
3318
|
+
import { defineCommand as defineCommand21 } from "citty";
|
|
3319
|
+
var addCmd3 = defineCommand21({
|
|
3091
3320
|
meta: { name: "add", description: "Add a heartbeat / cron trigger to an agent" },
|
|
3092
3321
|
args: {
|
|
3093
3322
|
agent: { type: "positional", required: true },
|
|
@@ -3135,7 +3364,7 @@ function triggerRow(t) {
|
|
|
3135
3364
|
const msgPreview = t.message.length > 60 ? `${t.message.slice(0, 60)}\u2026` : t.message;
|
|
3136
3365
|
return [t.id, state, spec, `last: ${last}`, `"${msgPreview}"`];
|
|
3137
3366
|
}
|
|
3138
|
-
var listCmd12 =
|
|
3367
|
+
var listCmd12 = defineCommand21({
|
|
3139
3368
|
meta: { name: "list", description: "List triggers for an agent" },
|
|
3140
3369
|
args: {
|
|
3141
3370
|
agent: { type: "positional", required: true }
|
|
@@ -3152,7 +3381,7 @@ var listCmd12 = defineCommand20({
|
|
|
3152
3381
|
for (const line of columnize(triggers.map(triggerRow))) console.log(line);
|
|
3153
3382
|
}
|
|
3154
3383
|
});
|
|
3155
|
-
var rmCmd6 =
|
|
3384
|
+
var rmCmd6 = defineCommand21({
|
|
3156
3385
|
meta: { name: "rm", description: "Delete a trigger" },
|
|
3157
3386
|
args: {
|
|
3158
3387
|
id: { type: "positional", required: true }
|
|
@@ -3163,7 +3392,7 @@ var rmCmd6 = defineCommand20({
|
|
|
3163
3392
|
console.log(`removed trigger ${args.id}`);
|
|
3164
3393
|
}
|
|
3165
3394
|
});
|
|
3166
|
-
var enableCmd3 =
|
|
3395
|
+
var enableCmd3 = defineCommand21({
|
|
3167
3396
|
meta: { name: "enable", description: "Enable a trigger" },
|
|
3168
3397
|
args: {
|
|
3169
3398
|
id: { type: "positional", required: true }
|
|
@@ -3175,7 +3404,7 @@ var enableCmd3 = defineCommand20({
|
|
|
3175
3404
|
console.log(`enabled trigger ${args.id}`);
|
|
3176
3405
|
}
|
|
3177
3406
|
});
|
|
3178
|
-
var disableCmd3 =
|
|
3407
|
+
var disableCmd3 = defineCommand21({
|
|
3179
3408
|
meta: { name: "disable", description: "Disable a trigger" },
|
|
3180
3409
|
args: {
|
|
3181
3410
|
id: { type: "positional", required: true }
|
|
@@ -3187,7 +3416,7 @@ var disableCmd3 = defineCommand20({
|
|
|
3187
3416
|
console.log(`disabled trigger ${args.id}`);
|
|
3188
3417
|
}
|
|
3189
3418
|
});
|
|
3190
|
-
var triggerCommand =
|
|
3419
|
+
var triggerCommand = defineCommand21({
|
|
3191
3420
|
meta: { name: "trigger", description: "Manage agent heartbeats / cron triggers" },
|
|
3192
3421
|
subCommands: {
|
|
3193
3422
|
add: addCmd3,
|
|
@@ -3199,9 +3428,9 @@ var triggerCommand = defineCommand20({
|
|
|
3199
3428
|
});
|
|
3200
3429
|
|
|
3201
3430
|
// src/commands/uninstall.ts
|
|
3202
|
-
import { existsSync as
|
|
3203
|
-
import { join as
|
|
3204
|
-
import { defineCommand as
|
|
3431
|
+
import { existsSync as existsSync7, readdirSync as readdirSync2, rmSync as rmSync4 } from "fs";
|
|
3432
|
+
import { join as join6 } from "path";
|
|
3433
|
+
import { defineCommand as defineCommand22 } from "citty";
|
|
3205
3434
|
function makeLineReader() {
|
|
3206
3435
|
let buffer = "";
|
|
3207
3436
|
let ended = false;
|
|
@@ -3245,11 +3474,11 @@ async function askYes(readLine, prompt) {
|
|
|
3245
3474
|
return answer === "y" || answer === "yes";
|
|
3246
3475
|
}
|
|
3247
3476
|
function removePath(p) {
|
|
3248
|
-
if (!
|
|
3477
|
+
if (!existsSync7(p)) return false;
|
|
3249
3478
|
rmSync4(p, { recursive: true, force: true });
|
|
3250
3479
|
return true;
|
|
3251
3480
|
}
|
|
3252
|
-
var uninstallCommand =
|
|
3481
|
+
var uninstallCommand = defineCommand22({
|
|
3253
3482
|
meta: {
|
|
3254
3483
|
name: "uninstall",
|
|
3255
3484
|
description: "Wipe bazilion state from ~/.bazilion (or BAZILION_HOME)"
|
|
@@ -3267,13 +3496,13 @@ var uninstallCommand = defineCommand21({
|
|
|
3267
3496
|
},
|
|
3268
3497
|
async run({ args }) {
|
|
3269
3498
|
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 (!
|
|
3499
|
+
const dbFile = join6(paths.home, "bazilion.db");
|
|
3500
|
+
const profilesDir = join6(paths.home, "profiles");
|
|
3501
|
+
const agentsDir = join6(paths.home, "agents");
|
|
3502
|
+
const groupsDir = join6(paths.home, "groups");
|
|
3503
|
+
const skillsDir = join6(paths.home, "skills");
|
|
3504
|
+
const logsDir = join6(paths.home, "logs");
|
|
3505
|
+
if (!existsSync7(paths.home)) {
|
|
3277
3506
|
console.log(`nothing to remove: ${paths.home} does not exist`);
|
|
3278
3507
|
return;
|
|
3279
3508
|
}
|
|
@@ -3327,7 +3556,7 @@ var uninstallCommand = defineCommand21({
|
|
|
3327
3556
|
|
|
3328
3557
|
// src/index.ts
|
|
3329
3558
|
var VERSION = package_default.version;
|
|
3330
|
-
var main =
|
|
3559
|
+
var main = defineCommand23({
|
|
3331
3560
|
meta: {
|
|
3332
3561
|
name: "bazilion",
|
|
3333
3562
|
version: VERSION,
|
|
@@ -3347,6 +3576,7 @@ var main = defineCommand22({
|
|
|
3347
3576
|
inbox: inboxCommand,
|
|
3348
3577
|
config: configCommand,
|
|
3349
3578
|
serve: serveCommand,
|
|
3579
|
+
dashboard: dashboardCommand,
|
|
3350
3580
|
doctor: doctorCommand,
|
|
3351
3581
|
backup: backupCommand,
|
|
3352
3582
|
trigger: triggerCommand,
|
|
@@ -3402,6 +3632,7 @@ function printTopLevelHelp() {
|
|
|
3402
3632
|
title: "setup",
|
|
3403
3633
|
items: [
|
|
3404
3634
|
["serve", "Start the bazilion daemon (auto-bootstraps ~/.bazilion on first run)"],
|
|
3635
|
+
["dashboard", "Start the daemon + bundled web UI, then open the dashboard"],
|
|
3405
3636
|
["doctor", "Diagnose your bazilion install"],
|
|
3406
3637
|
["uninstall", "Wipe bazilion state from ~/.bazilion (or BAZILION_HOME)"]
|
|
3407
3638
|
]
|