bazilion 0.1.1 → 0.2.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/dist/cli.js +282 -56
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +451 -65
- package/dist/daemon.js.map +1 -1
- package/dist/worker.js +18 -18
- package/dist/worker.js.map +1 -1
- package/package.json +3 -3
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 defineCommand20, 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.2.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: {
|
|
@@ -1878,9 +1878,233 @@ var profileCommand = defineCommand11({
|
|
|
1878
1878
|
}
|
|
1879
1879
|
});
|
|
1880
1880
|
|
|
1881
|
-
// src/commands/
|
|
1881
|
+
// src/commands/profile-group.ts
|
|
1882
|
+
import { spawn as spawn3 } from "child_process";
|
|
1883
|
+
import { randomBytes as randomBytes2 } from "crypto";
|
|
1884
|
+
import { readFileSync as readFileSync5, rmSync as rmSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
1885
|
+
import { tmpdir as tmpdir2 } from "os";
|
|
1886
|
+
import { join as join3 } from "path";
|
|
1882
1887
|
import { defineCommand as defineCommand12 } from "citty";
|
|
1888
|
+
var createCmd3 = defineCommand12({
|
|
1889
|
+
meta: { name: "create", description: "Create a new profile group (team template)" },
|
|
1890
|
+
args: {
|
|
1891
|
+
id: { type: "positional", required: true, description: "Profile group slug" },
|
|
1892
|
+
name: { type: "string", description: "Display name (defaults to slug)" },
|
|
1893
|
+
"user-md-file": {
|
|
1894
|
+
type: "string",
|
|
1895
|
+
description: "Path to a starter USER.md; seeded into a freshly-created target group"
|
|
1896
|
+
}
|
|
1897
|
+
},
|
|
1898
|
+
async run({ args }) {
|
|
1899
|
+
const body = { id: args.id };
|
|
1900
|
+
if (args.name) body.name = args.name;
|
|
1901
|
+
if (args["user-md-file"]) body.userMd = readFileSync5(args["user-md-file"], "utf8");
|
|
1902
|
+
const client = createClient2();
|
|
1903
|
+
const created = await client.post("/api/profile-groups", body);
|
|
1904
|
+
console.log(`created profile group ${created.id}`);
|
|
1905
|
+
}
|
|
1906
|
+
});
|
|
1883
1907
|
var listCmd7 = defineCommand12({
|
|
1908
|
+
meta: { name: "list", description: "List profile groups" },
|
|
1909
|
+
async run() {
|
|
1910
|
+
const client = createClient2();
|
|
1911
|
+
const list = await client.get("/api/profile-groups");
|
|
1912
|
+
if (list.length === 0) {
|
|
1913
|
+
console.log("(no profile groups)");
|
|
1914
|
+
return;
|
|
1915
|
+
}
|
|
1916
|
+
const rows = list.map((g) => [g.id, String(g.memberCount), g.name]);
|
|
1917
|
+
for (const line of columnize(rows)) console.log(line);
|
|
1918
|
+
}
|
|
1919
|
+
});
|
|
1920
|
+
var showCmd4 = defineCommand12({
|
|
1921
|
+
meta: { name: "show", description: "Show profile group details + members" },
|
|
1922
|
+
args: {
|
|
1923
|
+
id: { type: "positional", required: true },
|
|
1924
|
+
json: { type: "boolean", description: "Emit full JSON (members + basics)" }
|
|
1925
|
+
},
|
|
1926
|
+
async run({ args }) {
|
|
1927
|
+
const client = createClient2();
|
|
1928
|
+
const detail = await client.get(`/api/profile-groups/${args.id}`);
|
|
1929
|
+
if (args.json) {
|
|
1930
|
+
console.log(JSON.stringify(detail, null, 2));
|
|
1931
|
+
return;
|
|
1932
|
+
}
|
|
1933
|
+
console.log(`# ${detail.group.id}`);
|
|
1934
|
+
console.log(`name: ${detail.group.name}`);
|
|
1935
|
+
console.log(
|
|
1936
|
+
`user-md: ${detail.group.userMd ? `${detail.group.userMd.length} chars` : "(none)"}`
|
|
1937
|
+
);
|
|
1938
|
+
console.log("");
|
|
1939
|
+
if (detail.members.length === 0) {
|
|
1940
|
+
console.log("(no members)");
|
|
1941
|
+
return;
|
|
1942
|
+
}
|
|
1943
|
+
console.log("members:");
|
|
1944
|
+
const rows = [
|
|
1945
|
+
["#", "profile", "agent-name", "model-override", "reasoning"],
|
|
1946
|
+
...detail.members.map((m) => [
|
|
1947
|
+
String(m.position),
|
|
1948
|
+
m.profileId,
|
|
1949
|
+
m.agentName,
|
|
1950
|
+
m.modelOverride ?? "-",
|
|
1951
|
+
m.reasoningLevel ?? "-"
|
|
1952
|
+
])
|
|
1953
|
+
];
|
|
1954
|
+
for (const line of columnize(rows)) console.log(` ${line}`);
|
|
1955
|
+
}
|
|
1956
|
+
});
|
|
1957
|
+
var updateCmd2 = defineCommand12({
|
|
1958
|
+
meta: { name: "update", description: "Update profile group basics (name, user-md)" },
|
|
1959
|
+
args: {
|
|
1960
|
+
id: { type: "positional", required: true },
|
|
1961
|
+
name: { type: "string", description: "New display name" },
|
|
1962
|
+
"user-md-file": {
|
|
1963
|
+
type: "string",
|
|
1964
|
+
description: "Path to new USER.md content (pass empty string to clear)"
|
|
1965
|
+
}
|
|
1966
|
+
},
|
|
1967
|
+
async run({ args }) {
|
|
1968
|
+
const body = {};
|
|
1969
|
+
if (args.name !== void 0) body.name = args.name;
|
|
1970
|
+
if (args["user-md-file"] !== void 0) {
|
|
1971
|
+
body.userMd = args["user-md-file"] === "" ? null : readFileSync5(args["user-md-file"], "utf8");
|
|
1972
|
+
}
|
|
1973
|
+
if (Object.keys(body).length === 0) {
|
|
1974
|
+
throw new Error("nothing to update \u2014 pass at least one of --name/--user-md-file");
|
|
1975
|
+
}
|
|
1976
|
+
const client = createClient2();
|
|
1977
|
+
const updated = await client.patch(`/api/profile-groups/${args.id}`, body);
|
|
1978
|
+
console.log(`updated profile group ${updated.id}`);
|
|
1979
|
+
}
|
|
1980
|
+
});
|
|
1981
|
+
var editCmd3 = defineCommand12({
|
|
1982
|
+
meta: { name: "edit", description: "Edit the member array in $EDITOR (JSON)" },
|
|
1983
|
+
args: {
|
|
1984
|
+
id: { type: "positional", required: true }
|
|
1985
|
+
},
|
|
1986
|
+
async run({ args }) {
|
|
1987
|
+
const client = createClient2();
|
|
1988
|
+
const detail = await client.get(`/api/profile-groups/${args.id}`);
|
|
1989
|
+
const editable = detail.members.map((m) => ({
|
|
1990
|
+
profileId: m.profileId,
|
|
1991
|
+
agentName: m.agentName,
|
|
1992
|
+
modelOverride: m.modelOverride,
|
|
1993
|
+
reasoningLevel: m.reasoningLevel
|
|
1994
|
+
}));
|
|
1995
|
+
const before = `${JSON.stringify(editable, null, 2)}
|
|
1996
|
+
`;
|
|
1997
|
+
const tmpPath = join3(
|
|
1998
|
+
tmpdir2(),
|
|
1999
|
+
`bazilion-profile-group-${args.id}-${randomBytes2(4).toString("hex")}.json`
|
|
2000
|
+
);
|
|
2001
|
+
writeFileSync3(tmpPath, before);
|
|
2002
|
+
try {
|
|
2003
|
+
const editor = process.env.EDITOR ?? process.env.VISUAL ?? "vi";
|
|
2004
|
+
const code = await new Promise((resolve3, reject) => {
|
|
2005
|
+
const child = spawn3(editor, [tmpPath], { stdio: "inherit" });
|
|
2006
|
+
child.on("error", reject);
|
|
2007
|
+
child.on("close", (c) => resolve3(c ?? 0));
|
|
2008
|
+
});
|
|
2009
|
+
if (code !== 0) throw new Error(`editor exited with code ${code}`);
|
|
2010
|
+
const after = readFileSync5(tmpPath, "utf8");
|
|
2011
|
+
if (after === before) {
|
|
2012
|
+
console.log("(no changes)");
|
|
2013
|
+
return;
|
|
2014
|
+
}
|
|
2015
|
+
let parsed;
|
|
2016
|
+
try {
|
|
2017
|
+
parsed = JSON.parse(after);
|
|
2018
|
+
} catch (err) {
|
|
2019
|
+
throw new Error(`invalid JSON: ${err.message}`);
|
|
2020
|
+
}
|
|
2021
|
+
if (!Array.isArray(parsed)) {
|
|
2022
|
+
throw new Error("expected a JSON array of members");
|
|
2023
|
+
}
|
|
2024
|
+
const body = {
|
|
2025
|
+
members: parsed.map((s, i) => {
|
|
2026
|
+
const row = s;
|
|
2027
|
+
if (!row || typeof row.profileId !== "string" || typeof row.agentName !== "string") {
|
|
2028
|
+
throw new Error(`member ${i}: profileId and agentName are required strings`);
|
|
2029
|
+
}
|
|
2030
|
+
return {
|
|
2031
|
+
profileId: row.profileId,
|
|
2032
|
+
agentName: row.agentName,
|
|
2033
|
+
modelOverride: row.modelOverride ?? null,
|
|
2034
|
+
reasoningLevel: row.reasoningLevel === null || row.reasoningLevel === void 0 ? null : row.reasoningLevel
|
|
2035
|
+
};
|
|
2036
|
+
})
|
|
2037
|
+
};
|
|
2038
|
+
await client.put(`/api/profile-groups/${args.id}/members`, body);
|
|
2039
|
+
console.log(`saved ${body.members.length} member(s)`);
|
|
2040
|
+
} finally {
|
|
2041
|
+
try {
|
|
2042
|
+
rmSync3(tmpPath, { force: true });
|
|
2043
|
+
} catch {
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
});
|
|
2048
|
+
var deleteCmd3 = defineCommand12({
|
|
2049
|
+
meta: { name: "delete", description: "Delete a profile group (does not affect spawned agents)" },
|
|
2050
|
+
args: {
|
|
2051
|
+
id: { type: "positional", required: true }
|
|
2052
|
+
},
|
|
2053
|
+
async run({ args }) {
|
|
2054
|
+
const client = createClient2();
|
|
2055
|
+
await client.del(`/api/profile-groups/${args.id}`);
|
|
2056
|
+
console.log(`deleted profile group ${args.id}`);
|
|
2057
|
+
}
|
|
2058
|
+
});
|
|
2059
|
+
var spawnCmd2 = defineCommand12({
|
|
2060
|
+
meta: { name: "spawn", description: "Spawn the whole team into a group (transactional)" },
|
|
2061
|
+
args: {
|
|
2062
|
+
id: { type: "positional", required: true },
|
|
2063
|
+
group: {
|
|
2064
|
+
type: "string",
|
|
2065
|
+
description: "Target group slug (overrides the template default)"
|
|
2066
|
+
},
|
|
2067
|
+
"user-md-file": {
|
|
2068
|
+
type: "string",
|
|
2069
|
+
description: "Path to USER.md content to seed (only takes effect on a fresh target group)"
|
|
2070
|
+
}
|
|
2071
|
+
},
|
|
2072
|
+
async run({ args }) {
|
|
2073
|
+
const body = {};
|
|
2074
|
+
if (args.group) body.groupSlug = args.group;
|
|
2075
|
+
if (args["user-md-file"]) body.userMd = readFileSync5(args["user-md-file"], "utf8");
|
|
2076
|
+
const client = createClient2();
|
|
2077
|
+
const result = await client.post(
|
|
2078
|
+
`/api/profile-groups/${args.id}/spawn`,
|
|
2079
|
+
body
|
|
2080
|
+
);
|
|
2081
|
+
console.log(`spawned ${result.agents.length} agent(s) into group ${result.groupSlug}`);
|
|
2082
|
+
const rows = result.agents.map((a) => [a.id, a.name]);
|
|
2083
|
+
for (const line of columnize(rows)) console.log(` ${line}`);
|
|
2084
|
+
if (result.orphanAgentIds && result.orphanAgentIds.length > 0) {
|
|
2085
|
+
console.error("");
|
|
2086
|
+
console.error(`warning: ${result.orphanAgentIds.length} orphan agent dir(s) left on disk:`);
|
|
2087
|
+
for (const id of result.orphanAgentIds) console.error(` ${id}`);
|
|
2088
|
+
process.exitCode = 1;
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
});
|
|
2092
|
+
var profileGroupCommand = defineCommand12({
|
|
2093
|
+
meta: { name: "profile-group", description: "Manage profile groups" },
|
|
2094
|
+
subCommands: {
|
|
2095
|
+
create: createCmd3,
|
|
2096
|
+
list: listCmd7,
|
|
2097
|
+
show: showCmd4,
|
|
2098
|
+
update: updateCmd2,
|
|
2099
|
+
edit: editCmd3,
|
|
2100
|
+
delete: deleteCmd3,
|
|
2101
|
+
spawn: spawnCmd2
|
|
2102
|
+
}
|
|
2103
|
+
});
|
|
2104
|
+
|
|
2105
|
+
// src/commands/provider.ts
|
|
2106
|
+
import { defineCommand as defineCommand13 } from "citty";
|
|
2107
|
+
var listCmd8 = defineCommand13({
|
|
1884
2108
|
meta: {
|
|
1885
2109
|
name: "list",
|
|
1886
2110
|
description: "List all providers with enabled/disabled state and curated model counts"
|
|
@@ -1906,7 +2130,7 @@ var listCmd7 = defineCommand12({
|
|
|
1906
2130
|
for (const line of columnize(rows)) console.log(line);
|
|
1907
2131
|
}
|
|
1908
2132
|
});
|
|
1909
|
-
var modelsCmd =
|
|
2133
|
+
var modelsCmd = defineCommand13({
|
|
1910
2134
|
meta: {
|
|
1911
2135
|
name: "models",
|
|
1912
2136
|
description: "Show curated + catalog + live models for one provider"
|
|
@@ -1938,7 +2162,7 @@ var modelsCmd = defineCommand12({
|
|
|
1938
2162
|
}
|
|
1939
2163
|
}
|
|
1940
2164
|
});
|
|
1941
|
-
var modelsSetCmd =
|
|
2165
|
+
var modelsSetCmd = defineCommand13({
|
|
1942
2166
|
meta: {
|
|
1943
2167
|
name: "models-set",
|
|
1944
2168
|
description: "Replace the curated model list for a provider (comma-separated)"
|
|
@@ -1963,7 +2187,7 @@ var modelsSetCmd = defineCommand12({
|
|
|
1963
2187
|
for (const m of saved.models) console.log(` ${m}`);
|
|
1964
2188
|
}
|
|
1965
2189
|
});
|
|
1966
|
-
var enableCmd =
|
|
2190
|
+
var enableCmd = defineCommand13({
|
|
1967
2191
|
meta: { name: "enable", description: "Toggle a provider on so agents can use it" },
|
|
1968
2192
|
args: {
|
|
1969
2193
|
name: { type: "positional", required: true, description: "Provider id (e.g. anthropic)" }
|
|
@@ -1977,7 +2201,7 @@ var enableCmd = defineCommand12({
|
|
|
1977
2201
|
console.log(`${res.name}: enabled`);
|
|
1978
2202
|
}
|
|
1979
2203
|
});
|
|
1980
|
-
var disableCmd =
|
|
2204
|
+
var disableCmd = defineCommand13({
|
|
1981
2205
|
meta: {
|
|
1982
2206
|
name: "disable",
|
|
1983
2207
|
description: "Toggle a provider off \u2014 agents will refuse its model strings"
|
|
@@ -1994,7 +2218,7 @@ var disableCmd = defineCommand12({
|
|
|
1994
2218
|
console.log(`${res.name}: disabled`);
|
|
1995
2219
|
}
|
|
1996
2220
|
});
|
|
1997
|
-
var testCmd =
|
|
2221
|
+
var testCmd = defineCommand13({
|
|
1998
2222
|
meta: { name: "test", description: "Send a single chat to a model and print the reply" },
|
|
1999
2223
|
args: {
|
|
2000
2224
|
model: {
|
|
@@ -2015,10 +2239,10 @@ var testCmd = defineCommand12({
|
|
|
2015
2239
|
}
|
|
2016
2240
|
}
|
|
2017
2241
|
});
|
|
2018
|
-
var providerCommand =
|
|
2242
|
+
var providerCommand = defineCommand13({
|
|
2019
2243
|
meta: { name: "provider", description: "Manage and test LLM providers" },
|
|
2020
2244
|
subCommands: {
|
|
2021
|
-
list:
|
|
2245
|
+
list: listCmd8,
|
|
2022
2246
|
enable: enableCmd,
|
|
2023
2247
|
disable: disableCmd,
|
|
2024
2248
|
models: modelsCmd,
|
|
@@ -2028,8 +2252,8 @@ var providerCommand = defineCommand12({
|
|
|
2028
2252
|
});
|
|
2029
2253
|
|
|
2030
2254
|
// src/commands/send.ts
|
|
2031
|
-
import { defineCommand as
|
|
2032
|
-
var sendCommand =
|
|
2255
|
+
import { defineCommand as defineCommand14 } from "citty";
|
|
2256
|
+
var sendCommand = defineCommand14({
|
|
2033
2257
|
meta: {
|
|
2034
2258
|
name: "send",
|
|
2035
2259
|
description: "Send a message from one agent to another"
|
|
@@ -2051,14 +2275,14 @@ var sendCommand = defineCommand13({
|
|
|
2051
2275
|
});
|
|
2052
2276
|
|
|
2053
2277
|
// src/commands/serve.ts
|
|
2054
|
-
import { spawn as
|
|
2278
|
+
import { spawn as spawn4 } from "child_process";
|
|
2055
2279
|
import { existsSync as existsSync4 } from "fs";
|
|
2056
|
-
import { join as
|
|
2057
|
-
import { defineCommand as
|
|
2058
|
-
var bundledDaemonEntry =
|
|
2059
|
-
var sourceDaemonEntry =
|
|
2280
|
+
import { join as join4 } from "path";
|
|
2281
|
+
import { defineCommand as defineCommand15 } from "citty";
|
|
2282
|
+
var bundledDaemonEntry = join4(import.meta.dirname, "daemon.js");
|
|
2283
|
+
var sourceDaemonEntry = join4(import.meta.dirname, "..", "..", "..", "daemon", "src", "index.ts");
|
|
2060
2284
|
var daemonEntry = existsSync4(bundledDaemonEntry) ? bundledDaemonEntry : sourceDaemonEntry;
|
|
2061
|
-
var serveCommand =
|
|
2285
|
+
var serveCommand = defineCommand15({
|
|
2062
2286
|
meta: {
|
|
2063
2287
|
name: "serve",
|
|
2064
2288
|
description: "Start the bazilion daemon (HTTP API)"
|
|
@@ -2091,7 +2315,7 @@ var serveCommand = defineCommand14({
|
|
|
2091
2315
|
console.log(`starting bazilion daemon at http://${host}:${port}`);
|
|
2092
2316
|
console.log("(web UI runs separately: cd apps/web && pnpm dev)");
|
|
2093
2317
|
const nodeArgs = daemonEntry.endsWith(".ts") ? ["--import", "tsx/esm", daemonEntry] : [daemonEntry];
|
|
2094
|
-
const proc =
|
|
2318
|
+
const proc = spawn4("node", nodeArgs, {
|
|
2095
2319
|
env,
|
|
2096
2320
|
stdio: "inherit"
|
|
2097
2321
|
});
|
|
@@ -2125,10 +2349,10 @@ var serveCommand = defineCommand14({
|
|
|
2125
2349
|
});
|
|
2126
2350
|
|
|
2127
2351
|
// src/commands/skill.ts
|
|
2128
|
-
import { existsSync as existsSync5, readFileSync as
|
|
2352
|
+
import { existsSync as existsSync5, readFileSync as readFileSync6, statSync } from "fs";
|
|
2129
2353
|
import { basename, resolve as resolve2 } from "path";
|
|
2130
|
-
import { defineCommand as
|
|
2131
|
-
var
|
|
2354
|
+
import { defineCommand as defineCommand16 } from "citty";
|
|
2355
|
+
var listCmd9 = defineCommand16({
|
|
2132
2356
|
meta: { name: "list", description: "List installed skills (or those attached to an agent)" },
|
|
2133
2357
|
args: {
|
|
2134
2358
|
agent: { type: "string", description: "Filter to skills attached to this agent" }
|
|
@@ -2160,7 +2384,7 @@ var listCmd8 = defineCommand15({
|
|
|
2160
2384
|
for (const line of columnize(rows)) console.log(line);
|
|
2161
2385
|
}
|
|
2162
2386
|
});
|
|
2163
|
-
var importCmd =
|
|
2387
|
+
var importCmd = defineCommand16({
|
|
2164
2388
|
meta: {
|
|
2165
2389
|
name: "import",
|
|
2166
2390
|
description: "Import skills from openclaw, a directory, or a local .zip archive"
|
|
@@ -2179,7 +2403,7 @@ var importCmd = defineCommand15({
|
|
|
2179
2403
|
const isLocalZip = args.from.toLowerCase().endsWith(".zip") && existsSync5(absFrom) && statSync(absFrom).isFile();
|
|
2180
2404
|
let result;
|
|
2181
2405
|
if (isLocalZip) {
|
|
2182
|
-
const bytes =
|
|
2406
|
+
const bytes = readFileSync6(absFrom);
|
|
2183
2407
|
const file = new File([bytes], basename(absFrom), { type: "application/zip" });
|
|
2184
2408
|
const fd = new FormData();
|
|
2185
2409
|
fd.set("file", file);
|
|
@@ -2204,7 +2428,7 @@ var importCmd = defineCommand15({
|
|
|
2204
2428
|
}
|
|
2205
2429
|
}
|
|
2206
2430
|
});
|
|
2207
|
-
var rmCmd4 =
|
|
2431
|
+
var rmCmd4 = defineCommand16({
|
|
2208
2432
|
meta: { name: "rm", description: "Remove an installed skill" },
|
|
2209
2433
|
args: {
|
|
2210
2434
|
name: { type: "positional", required: true }
|
|
@@ -2215,10 +2439,10 @@ var rmCmd4 = defineCommand15({
|
|
|
2215
2439
|
console.log(`removed skill ${args.name}`);
|
|
2216
2440
|
}
|
|
2217
2441
|
});
|
|
2218
|
-
var skillCommand =
|
|
2442
|
+
var skillCommand = defineCommand16({
|
|
2219
2443
|
meta: { name: "skill", description: "Manage the skill library" },
|
|
2220
2444
|
subCommands: {
|
|
2221
|
-
list:
|
|
2445
|
+
list: listCmd9,
|
|
2222
2446
|
import: importCmd,
|
|
2223
2447
|
rm: rmCmd4
|
|
2224
2448
|
}
|
|
@@ -2226,7 +2450,7 @@ var skillCommand = defineCommand15({
|
|
|
2226
2450
|
|
|
2227
2451
|
// src/commands/token.ts
|
|
2228
2452
|
import { networkInterfaces } from "os";
|
|
2229
|
-
import { defineCommand as
|
|
2453
|
+
import { defineCommand as defineCommand17 } from "citty";
|
|
2230
2454
|
import qrcode from "qrcode-terminal";
|
|
2231
2455
|
function tokenRow(t) {
|
|
2232
2456
|
const last = t.lastUsedAt ? new Date(t.lastUsedAt).toISOString() : "(never)";
|
|
@@ -2260,7 +2484,7 @@ function resolveQrServer(override) {
|
|
|
2260
2484
|
if (detected.warning) console.warn(`\u26A0 ${detected.warning}`);
|
|
2261
2485
|
return detected.origin;
|
|
2262
2486
|
}
|
|
2263
|
-
var
|
|
2487
|
+
var createCmd4 = defineCommand17({
|
|
2264
2488
|
meta: { name: "create", description: "Mint a new web token (shown once)" },
|
|
2265
2489
|
args: {
|
|
2266
2490
|
label: { type: "positional", required: true, description: "Human-readable label" },
|
|
@@ -2291,7 +2515,7 @@ var createCmd3 = defineCommand16({
|
|
|
2291
2515
|
qrcode.generate(pairUrl, { small: true }, (qr) => console.log(qr));
|
|
2292
2516
|
}
|
|
2293
2517
|
});
|
|
2294
|
-
var
|
|
2518
|
+
var listCmd10 = defineCommand17({
|
|
2295
2519
|
meta: { name: "list", description: "List web tokens" },
|
|
2296
2520
|
args: {
|
|
2297
2521
|
all: { type: "boolean", description: "Include revoked tokens" }
|
|
@@ -2307,7 +2531,7 @@ var listCmd9 = defineCommand16({
|
|
|
2307
2531
|
for (const line of columnize(tokens.map(tokenRow))) console.log(line);
|
|
2308
2532
|
}
|
|
2309
2533
|
});
|
|
2310
|
-
var showLocalCmd =
|
|
2534
|
+
var showLocalCmd = defineCommand17({
|
|
2311
2535
|
meta: {
|
|
2312
2536
|
name: "show-local",
|
|
2313
2537
|
description: "Print the bootstrap web token stored in ~/.bazilion/auth.json"
|
|
@@ -2317,7 +2541,7 @@ var showLocalCmd = defineCommand16({
|
|
|
2317
2541
|
console.log(readAuthFile(paths.authFile).token);
|
|
2318
2542
|
}
|
|
2319
2543
|
});
|
|
2320
|
-
var revokeCmd =
|
|
2544
|
+
var revokeCmd = defineCommand17({
|
|
2321
2545
|
meta: { name: "revoke", description: "Revoke a web token" },
|
|
2322
2546
|
args: {
|
|
2323
2547
|
id: { type: "positional", required: true }
|
|
@@ -2328,19 +2552,19 @@ var revokeCmd = defineCommand16({
|
|
|
2328
2552
|
console.log(`revoked token ${args.id}`);
|
|
2329
2553
|
}
|
|
2330
2554
|
});
|
|
2331
|
-
var tokenCommand =
|
|
2555
|
+
var tokenCommand = defineCommand17({
|
|
2332
2556
|
meta: { name: "token", description: "Manage web tokens for API/CLI clients" },
|
|
2333
2557
|
subCommands: {
|
|
2334
|
-
create:
|
|
2335
|
-
list:
|
|
2558
|
+
create: createCmd4,
|
|
2559
|
+
list: listCmd10,
|
|
2336
2560
|
revoke: revokeCmd,
|
|
2337
2561
|
"show-local": showLocalCmd
|
|
2338
2562
|
}
|
|
2339
2563
|
});
|
|
2340
2564
|
|
|
2341
2565
|
// src/commands/trigger.ts
|
|
2342
|
-
import { defineCommand as
|
|
2343
|
-
var addCmd2 =
|
|
2566
|
+
import { defineCommand as defineCommand18 } from "citty";
|
|
2567
|
+
var addCmd2 = defineCommand18({
|
|
2344
2568
|
meta: { name: "add", description: "Add a heartbeat / cron trigger to an agent" },
|
|
2345
2569
|
args: {
|
|
2346
2570
|
agent: { type: "positional", required: true },
|
|
@@ -2388,7 +2612,7 @@ function triggerRow(t) {
|
|
|
2388
2612
|
const msgPreview = t.message.length > 60 ? `${t.message.slice(0, 60)}\u2026` : t.message;
|
|
2389
2613
|
return [t.id, state, spec, `last: ${last}`, `"${msgPreview}"`];
|
|
2390
2614
|
}
|
|
2391
|
-
var
|
|
2615
|
+
var listCmd11 = defineCommand18({
|
|
2392
2616
|
meta: { name: "list", description: "List triggers for an agent" },
|
|
2393
2617
|
args: {
|
|
2394
2618
|
agent: { type: "positional", required: true }
|
|
@@ -2405,7 +2629,7 @@ var listCmd10 = defineCommand17({
|
|
|
2405
2629
|
for (const line of columnize(triggers.map(triggerRow))) console.log(line);
|
|
2406
2630
|
}
|
|
2407
2631
|
});
|
|
2408
|
-
var rmCmd5 =
|
|
2632
|
+
var rmCmd5 = defineCommand18({
|
|
2409
2633
|
meta: { name: "rm", description: "Delete a trigger" },
|
|
2410
2634
|
args: {
|
|
2411
2635
|
id: { type: "positional", required: true }
|
|
@@ -2416,7 +2640,7 @@ var rmCmd5 = defineCommand17({
|
|
|
2416
2640
|
console.log(`removed trigger ${args.id}`);
|
|
2417
2641
|
}
|
|
2418
2642
|
});
|
|
2419
|
-
var enableCmd2 =
|
|
2643
|
+
var enableCmd2 = defineCommand18({
|
|
2420
2644
|
meta: { name: "enable", description: "Enable a trigger" },
|
|
2421
2645
|
args: {
|
|
2422
2646
|
id: { type: "positional", required: true }
|
|
@@ -2428,7 +2652,7 @@ var enableCmd2 = defineCommand17({
|
|
|
2428
2652
|
console.log(`enabled trigger ${args.id}`);
|
|
2429
2653
|
}
|
|
2430
2654
|
});
|
|
2431
|
-
var disableCmd2 =
|
|
2655
|
+
var disableCmd2 = defineCommand18({
|
|
2432
2656
|
meta: { name: "disable", description: "Disable a trigger" },
|
|
2433
2657
|
args: {
|
|
2434
2658
|
id: { type: "positional", required: true }
|
|
@@ -2440,11 +2664,11 @@ var disableCmd2 = defineCommand17({
|
|
|
2440
2664
|
console.log(`disabled trigger ${args.id}`);
|
|
2441
2665
|
}
|
|
2442
2666
|
});
|
|
2443
|
-
var triggerCommand =
|
|
2667
|
+
var triggerCommand = defineCommand18({
|
|
2444
2668
|
meta: { name: "trigger", description: "Manage agent heartbeats / cron triggers" },
|
|
2445
2669
|
subCommands: {
|
|
2446
2670
|
add: addCmd2,
|
|
2447
|
-
list:
|
|
2671
|
+
list: listCmd11,
|
|
2448
2672
|
rm: rmCmd5,
|
|
2449
2673
|
enable: enableCmd2,
|
|
2450
2674
|
disable: disableCmd2
|
|
@@ -2452,9 +2676,9 @@ var triggerCommand = defineCommand17({
|
|
|
2452
2676
|
});
|
|
2453
2677
|
|
|
2454
2678
|
// src/commands/uninstall.ts
|
|
2455
|
-
import { existsSync as existsSync6, readdirSync as readdirSync2, rmSync as
|
|
2456
|
-
import { join as
|
|
2457
|
-
import { defineCommand as
|
|
2679
|
+
import { existsSync as existsSync6, readdirSync as readdirSync2, rmSync as rmSync4 } from "fs";
|
|
2680
|
+
import { join as join5 } from "path";
|
|
2681
|
+
import { defineCommand as defineCommand19 } from "citty";
|
|
2458
2682
|
function makeLineReader() {
|
|
2459
2683
|
let buffer = "";
|
|
2460
2684
|
let ended = false;
|
|
@@ -2499,10 +2723,10 @@ async function askYes(readLine, prompt) {
|
|
|
2499
2723
|
}
|
|
2500
2724
|
function removePath(p) {
|
|
2501
2725
|
if (!existsSync6(p)) return false;
|
|
2502
|
-
|
|
2726
|
+
rmSync4(p, { recursive: true, force: true });
|
|
2503
2727
|
return true;
|
|
2504
2728
|
}
|
|
2505
|
-
var uninstallCommand =
|
|
2729
|
+
var uninstallCommand = defineCommand19({
|
|
2506
2730
|
meta: {
|
|
2507
2731
|
name: "uninstall",
|
|
2508
2732
|
description: "Wipe bazilion state from ~/.bazilion (or BAZILION_HOME)"
|
|
@@ -2520,12 +2744,12 @@ var uninstallCommand = defineCommand18({
|
|
|
2520
2744
|
},
|
|
2521
2745
|
async run({ args }) {
|
|
2522
2746
|
const paths = resolveCliPaths(args.home);
|
|
2523
|
-
const dbFile =
|
|
2524
|
-
const profilesDir =
|
|
2525
|
-
const agentsDir =
|
|
2526
|
-
const groupsDir =
|
|
2527
|
-
const skillsDir =
|
|
2528
|
-
const logsDir =
|
|
2747
|
+
const dbFile = join5(paths.home, "bazilion.db");
|
|
2748
|
+
const profilesDir = join5(paths.home, "profiles");
|
|
2749
|
+
const agentsDir = join5(paths.home, "agents");
|
|
2750
|
+
const groupsDir = join5(paths.home, "groups");
|
|
2751
|
+
const skillsDir = join5(paths.home, "skills");
|
|
2752
|
+
const logsDir = join5(paths.home, "logs");
|
|
2529
2753
|
if (!existsSync6(paths.home)) {
|
|
2530
2754
|
console.log(`nothing to remove: ${paths.home} does not exist`);
|
|
2531
2755
|
return;
|
|
@@ -2565,7 +2789,7 @@ var uninstallCommand = defineCommand18({
|
|
|
2565
2789
|
if (removePath(p)) console.log(`removed ${p}`);
|
|
2566
2790
|
}
|
|
2567
2791
|
if (readdirSync2(paths.home).length === 0) {
|
|
2568
|
-
|
|
2792
|
+
rmSync4(paths.home, { recursive: true, force: true });
|
|
2569
2793
|
console.log(`removed ${paths.home}`);
|
|
2570
2794
|
} else {
|
|
2571
2795
|
console.log(`${paths.home} still has unmanaged files; left in place`);
|
|
@@ -2580,7 +2804,7 @@ var uninstallCommand = defineCommand18({
|
|
|
2580
2804
|
|
|
2581
2805
|
// src/index.ts
|
|
2582
2806
|
var VERSION = package_default.version;
|
|
2583
|
-
var main =
|
|
2807
|
+
var main = defineCommand20({
|
|
2584
2808
|
meta: {
|
|
2585
2809
|
name: "bazilion",
|
|
2586
2810
|
version: VERSION,
|
|
@@ -2589,6 +2813,7 @@ var main = defineCommand19({
|
|
|
2589
2813
|
subCommands: {
|
|
2590
2814
|
login: loginCommand,
|
|
2591
2815
|
profile: profileCommand,
|
|
2816
|
+
"profile-group": profileGroupCommand,
|
|
2592
2817
|
group: groupCommand,
|
|
2593
2818
|
agent: agentCommand,
|
|
2594
2819
|
skill: skillCommand,
|
|
@@ -2660,6 +2885,7 @@ function printTopLevelHelp() {
|
|
|
2660
2885
|
title: "catalog",
|
|
2661
2886
|
items: [
|
|
2662
2887
|
["profile", "Manage profiles (templates agents are spawned from)"],
|
|
2888
|
+
["profile-group", "Manage profile groups (preconfigured team templates)"],
|
|
2663
2889
|
["group", "Manage groups (collaboration context \u2014 filesystem root + USER.md + roster)"],
|
|
2664
2890
|
["skill", "Manage the skill library"],
|
|
2665
2891
|
["provider", "Manage and test LLM providers"],
|