@brainbase-labs/cli 0.41.0 → 0.42.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/index.js +682 -350
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35182,7 +35182,7 @@ var require_dist2 = __commonJS((exports, module) => {
|
|
|
35182
35182
|
});
|
|
35183
35183
|
|
|
35184
35184
|
// src/index.ts
|
|
35185
|
-
var
|
|
35185
|
+
var import_picocolors69 = __toESM(require_picocolors(), 1);
|
|
35186
35186
|
import process14 from "node:process";
|
|
35187
35187
|
import fs91 from "node:fs";
|
|
35188
35188
|
|
|
@@ -36059,7 +36059,7 @@ function padStart(s, n) {
|
|
|
36059
36059
|
// package.json
|
|
36060
36060
|
var package_default = {
|
|
36061
36061
|
name: "@brainbase-labs/cli",
|
|
36062
|
-
version: "0.
|
|
36062
|
+
version: "0.42.0",
|
|
36063
36063
|
description: "Pack, share, and install agent templates across harnesses (Claude Code, Codex, ...).",
|
|
36064
36064
|
type: "module",
|
|
36065
36065
|
bin: {
|
|
@@ -54795,6 +54795,7 @@ function removeInstalledRecord(name, scope, cwd2) {
|
|
|
54795
54795
|
import fs54 from "node:fs";
|
|
54796
54796
|
|
|
54797
54797
|
// src/core/api-error-message.ts
|
|
54798
|
+
var MAX_TEXT_BODY = 500;
|
|
54798
54799
|
function apiErrorMessage(body, status) {
|
|
54799
54800
|
if (body && typeof body === "object") {
|
|
54800
54801
|
const obj = body;
|
|
@@ -54816,7 +54817,11 @@ function apiErrorMessage(body, status) {
|
|
|
54816
54817
|
}
|
|
54817
54818
|
}
|
|
54818
54819
|
} else if (typeof body === "string" && body.trim()) {
|
|
54819
|
-
|
|
54820
|
+
const text2 = body.trim();
|
|
54821
|
+
if (/^<(!doctype|html)\b/i.test(text2) || /<html[\s>]/i.test(text2.slice(0, 2000))) {
|
|
54822
|
+
return `HTTP ${status}: the server returned an error page instead of an answer. Try again shortly.`;
|
|
54823
|
+
}
|
|
54824
|
+
return text2.length > MAX_TEXT_BODY ? `${text2.slice(0, MAX_TEXT_BODY)}…` : text2;
|
|
54820
54825
|
}
|
|
54821
54826
|
return `HTTP ${status}`;
|
|
54822
54827
|
}
|
|
@@ -55167,6 +55172,8 @@ async function request(pathname, init = {}) {
|
|
|
55167
55172
|
let res;
|
|
55168
55173
|
let text2;
|
|
55169
55174
|
for (let attempt2 = 0;; attempt2 += 1) {
|
|
55175
|
+
if (init.signal?.aborted)
|
|
55176
|
+
throw init.signal.reason;
|
|
55170
55177
|
try {
|
|
55171
55178
|
res = await sendWithAuthRetry(refreshSessionAvailable ? currentSession : null, async (refreshed) => {
|
|
55172
55179
|
if (refreshed) {
|
|
@@ -55182,7 +55189,7 @@ async function request(pathname, init = {}) {
|
|
|
55182
55189
|
}
|
|
55183
55190
|
break;
|
|
55184
55191
|
} catch (error) {
|
|
55185
|
-
if (method2 !== "GET" || !(error instanceof NetworkApiError) || attempt2 >= GET_NETWORK_RETRY_DELAYS_MS.length) {
|
|
55192
|
+
if (init.signal?.aborted || method2 !== "GET" || !(error instanceof NetworkApiError) || attempt2 >= GET_NETWORK_RETRY_DELAYS_MS.length) {
|
|
55186
55193
|
throw error;
|
|
55187
55194
|
}
|
|
55188
55195
|
await new Promise((resolve) => setTimeout(resolve, GET_NETWORK_RETRY_DELAYS_MS[attempt2]));
|
|
@@ -55586,6 +55593,23 @@ async function connectionsRequest(pathname, init) {
|
|
|
55586
55593
|
throw err;
|
|
55587
55594
|
}
|
|
55588
55595
|
}
|
|
55596
|
+
async function mcpConnectLinkRequest(pathname, init) {
|
|
55597
|
+
try {
|
|
55598
|
+
return await request(pathname, init);
|
|
55599
|
+
} catch (err) {
|
|
55600
|
+
if (!(err instanceof ApiError))
|
|
55601
|
+
throw err;
|
|
55602
|
+
if (err.status === 404 && isUnroutedPath(err.body)) {
|
|
55603
|
+
throw new ApiError("This control plane does not support `brainbase mcp connect` yet. Update the server, or authorize the server in the web app.", 404, err.body);
|
|
55604
|
+
}
|
|
55605
|
+
const detail = err.body && typeof err.body === "object" ? err.body.detail : undefined;
|
|
55606
|
+
const message = detail && typeof detail === "object" && !Array.isArray(detail) ? detail.message : undefined;
|
|
55607
|
+
if (typeof message === "string" && message.trim()) {
|
|
55608
|
+
throw new ApiError(message.trim(), err.status, err.body);
|
|
55609
|
+
}
|
|
55610
|
+
throw err;
|
|
55611
|
+
}
|
|
55612
|
+
}
|
|
55589
55613
|
var api = {
|
|
55590
55614
|
listOrgs() {
|
|
55591
55615
|
return request("/orgs");
|
|
@@ -55731,6 +55755,12 @@ var api = {
|
|
|
55731
55755
|
listAgentMcpServers(agentId) {
|
|
55732
55756
|
return connectionsRequest(`/agents/${encodeURIComponent(agentId)}/mcp-servers`);
|
|
55733
55757
|
},
|
|
55758
|
+
createMcpConnectLink(agentId, server) {
|
|
55759
|
+
return mcpConnectLinkRequest(`/agents/${encodeURIComponent(agentId)}/mcp-connect-links`, { method: "POST", body: JSON.stringify({ server }) });
|
|
55760
|
+
},
|
|
55761
|
+
getMcpConnectLink(linkId, options = {}) {
|
|
55762
|
+
return mcpConnectLinkRequest(`/mcp-connect-links/${encodeURIComponent(linkId)}`, { signal: options.signal });
|
|
55763
|
+
},
|
|
55734
55764
|
listOrchestrations(orgId, teamId) {
|
|
55735
55765
|
return request(`/orgs/${encodeURIComponent(orgId)}/teams/${encodeURIComponent(teamId)}/orchestrations`);
|
|
55736
55766
|
},
|
|
@@ -62738,7 +62768,6 @@ function printSkillHelp() {
|
|
|
62738
62768
|
}
|
|
62739
62769
|
|
|
62740
62770
|
// src/cli/login.ts
|
|
62741
|
-
import { spawn } from "node:child_process";
|
|
62742
62771
|
var import_picocolors21 = __toESM(require_picocolors(), 1);
|
|
62743
62772
|
|
|
62744
62773
|
// src/core/login-poll.ts
|
|
@@ -62915,6 +62944,22 @@ async function awaitDeviceSession(options) {
|
|
|
62915
62944
|
throw new LoginTimeoutError(timeoutMs, lastError);
|
|
62916
62945
|
}
|
|
62917
62946
|
|
|
62947
|
+
// src/core/open-browser.ts
|
|
62948
|
+
import { spawn } from "node:child_process";
|
|
62949
|
+
function openInBrowser(url) {
|
|
62950
|
+
if (process.env.BRAINBASE_NON_INTERACTIVE)
|
|
62951
|
+
return;
|
|
62952
|
+
const [cmd, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? ["rundll32.exe", ["url.dll,FileProtocolHandler", url]] : ["xdg-open", [url]];
|
|
62953
|
+
try {
|
|
62954
|
+
const child = spawn(cmd, args, {
|
|
62955
|
+
stdio: "ignore",
|
|
62956
|
+
detached: true
|
|
62957
|
+
});
|
|
62958
|
+
child.on("error", () => {});
|
|
62959
|
+
child.unref();
|
|
62960
|
+
} catch {}
|
|
62961
|
+
}
|
|
62962
|
+
|
|
62918
62963
|
// src/ui/ink/WelcomeCard.tsx
|
|
62919
62964
|
var jsx_dev_runtime14 = __toESM(require_jsx_dev_runtime(), 1);
|
|
62920
62965
|
function WelcomeCard(props) {
|
|
@@ -63008,19 +63053,6 @@ function isInsecureWebBase(webBase) {
|
|
|
63008
63053
|
return false;
|
|
63009
63054
|
return !["127.0.0.1", "localhost", "[::1]", "::1"].includes(url.hostname);
|
|
63010
63055
|
}
|
|
63011
|
-
function openInBrowser(url) {
|
|
63012
|
-
if (process.env.BRAINBASE_NON_INTERACTIVE)
|
|
63013
|
-
return;
|
|
63014
|
-
const [cmd, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? ["rundll32.exe", ["url.dll,FileProtocolHandler", url]] : ["xdg-open", [url]];
|
|
63015
|
-
try {
|
|
63016
|
-
const child = spawn(cmd, args, {
|
|
63017
|
-
stdio: "ignore",
|
|
63018
|
-
detached: true
|
|
63019
|
-
});
|
|
63020
|
-
child.on("error", () => {});
|
|
63021
|
-
child.unref();
|
|
63022
|
-
} catch {}
|
|
63023
|
-
}
|
|
63024
63056
|
function displayUserCode(code) {
|
|
63025
63057
|
return code.replace(/[^A-Za-z0-9-]/g, "");
|
|
63026
63058
|
}
|
|
@@ -68754,7 +68786,7 @@ harness: ${scalar(seed.harness)}
|
|
|
68754
68786
|
|
|
68755
68787
|
# Agent-level model override. Omit it to leave the cloud value alone, or set
|
|
68756
68788
|
# null to clear an override that is already set.
|
|
68757
|
-
# default_model:
|
|
68789
|
+
# default_model: gpt-5.6-terra
|
|
68758
68790
|
|
|
68759
68791
|
agent:
|
|
68760
68792
|
name: ${scalar(seed.name)}
|
|
@@ -72971,7 +73003,7 @@ function printTokenHelp() {
|
|
|
72971
73003
|
}
|
|
72972
73004
|
|
|
72973
73005
|
// src/cli/mcp.ts
|
|
72974
|
-
var
|
|
73006
|
+
var import_picocolors53 = __toESM(require_picocolors(), 1);
|
|
72975
73007
|
|
|
72976
73008
|
// src/core/mcp-check/collect-servers.ts
|
|
72977
73009
|
import path96 from "node:path";
|
|
@@ -81289,6 +81321,47 @@ function probeServer(server, opts = { timeoutMs: DEFAULT_TIMEOUT_MS }) {
|
|
|
81289
81321
|
return probeWithConnector(server, sdkConnector, opts);
|
|
81290
81322
|
}
|
|
81291
81323
|
|
|
81324
|
+
// src/ui/wait-spinner.ts
|
|
81325
|
+
var import_picocolors52 = __toESM(require_picocolors(), 1);
|
|
81326
|
+
function waitSpinner(output = process.stdout) {
|
|
81327
|
+
const unicode = process.platform !== "win32" ? process.env.TERM !== "linux" : Boolean(process.env.WT_SESSION) || process.env.TERM_PROGRAM === "vscode";
|
|
81328
|
+
const frames = unicode ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"];
|
|
81329
|
+
const delay2 = unicode ? 80 : 120;
|
|
81330
|
+
const bar = unicode ? "│" : "|";
|
|
81331
|
+
const symbols = unicode ? ["◇", "■", "▲"] : ["o", "x", "x"];
|
|
81332
|
+
const showCursor = () => output.write("\x1B[?25h");
|
|
81333
|
+
let timer;
|
|
81334
|
+
let message = "";
|
|
81335
|
+
return {
|
|
81336
|
+
start(text2) {
|
|
81337
|
+
message = text2.replace(/\.+$/, "");
|
|
81338
|
+
output.write(`${import_picocolors52.default.gray(bar)}
|
|
81339
|
+
\x1B[?25l`);
|
|
81340
|
+
process.once("exit", showCursor);
|
|
81341
|
+
let frame = 0;
|
|
81342
|
+
let dots = 0;
|
|
81343
|
+
const draw = () => {
|
|
81344
|
+
output.write(`\r\x1B[J${import_picocolors52.default.magenta(frames[frame])} ${message}${".".repeat(Math.floor(dots)).slice(0, 3)}`);
|
|
81345
|
+
frame = (frame + 1) % frames.length;
|
|
81346
|
+
dots = dots < frames.length ? dots + 0.125 : 0;
|
|
81347
|
+
};
|
|
81348
|
+
draw();
|
|
81349
|
+
timer = setInterval(draw, delay2);
|
|
81350
|
+
},
|
|
81351
|
+
stop(text2, code = 0) {
|
|
81352
|
+
if (timer === undefined)
|
|
81353
|
+
return;
|
|
81354
|
+
clearInterval(timer);
|
|
81355
|
+
timer = undefined;
|
|
81356
|
+
const symbol = code === 0 ? import_picocolors52.default.green(symbols[0]) : import_picocolors52.default.red(code === 1 ? symbols[1] : symbols[2]);
|
|
81357
|
+
output.write(`\r\x1B[J${symbol} ${text2}
|
|
81358
|
+
`);
|
|
81359
|
+
showCursor();
|
|
81360
|
+
process.removeListener("exit", showCursor);
|
|
81361
|
+
}
|
|
81362
|
+
};
|
|
81363
|
+
}
|
|
81364
|
+
|
|
81292
81365
|
// src/cli/mcp.ts
|
|
81293
81366
|
function timeoutMs(env3) {
|
|
81294
81367
|
const raw = env3.BRAINBASE_MCP_CHECK_TIMEOUT_MS;
|
|
@@ -81335,17 +81408,17 @@ async function runMcpCheck(cwd2, options) {
|
|
|
81335
81408
|
function renderHuman(report2) {
|
|
81336
81409
|
const lines = [];
|
|
81337
81410
|
if (report2.check_status === "skipped") {
|
|
81338
|
-
lines.push(
|
|
81411
|
+
lines.push(import_picocolors53.default.dim("No MCP servers configured — nothing to check."));
|
|
81339
81412
|
return lines.join(`
|
|
81340
81413
|
`) + `
|
|
81341
81414
|
`;
|
|
81342
81415
|
}
|
|
81343
81416
|
for (const s3 of report2.servers) {
|
|
81344
|
-
const mark = s3.status === "ok" ?
|
|
81345
|
-
const detail = s3.status === "ok" ?
|
|
81417
|
+
const mark = s3.status === "ok" ? import_picocolors53.default.green("✓") : s3.status === "auth_failed" ? import_picocolors53.default.red("✗") : import_picocolors53.default.yellow("⚠");
|
|
81418
|
+
const detail = s3.status === "ok" ? import_picocolors53.default.dim(`${s3.tool_count} tool${s3.tool_count === 1 ? "" : "s"}`) : import_picocolors53.default.dim(s3.status + (s3.error ? ` — ${s3.error}` : ""));
|
|
81346
81419
|
lines.push(` ${mark} ${s3.name} ${detail}`);
|
|
81347
81420
|
}
|
|
81348
|
-
const summary = report2.check_status === "ok" ?
|
|
81421
|
+
const summary = report2.check_status === "ok" ? import_picocolors53.default.green("All MCP servers connected.") : import_picocolors53.default.yellow("Some MCP servers are unhealthy.");
|
|
81349
81422
|
lines.push("", summary);
|
|
81350
81423
|
return lines.join(`
|
|
81351
81424
|
`) + `
|
|
@@ -81441,12 +81514,12 @@ function isUnhealthy(server) {
|
|
|
81441
81514
|
}
|
|
81442
81515
|
function renderServerList(servers) {
|
|
81443
81516
|
if (servers.length === 0) {
|
|
81444
|
-
return
|
|
81517
|
+
return import_picocolors53.default.dim("No MCP servers configured for this agent.") + `
|
|
81445
81518
|
`;
|
|
81446
81519
|
}
|
|
81447
81520
|
const lines = [""];
|
|
81448
81521
|
for (const s3 of servers) {
|
|
81449
|
-
const mark = s3.auth === "oauth_expired" ?
|
|
81522
|
+
const mark = s3.auth === "oauth_expired" ? import_picocolors53.default.red("✗") : s3.auth === "oauth_required" || isUnhealthy(s3) ? import_picocolors53.default.yellow("!") : !s3.is_enabled ? import_picocolors53.default.dim("·") : import_picocolors53.default.green("✓");
|
|
81450
81523
|
const bits = [sanitizeLabel(s3.transport)];
|
|
81451
81524
|
if (!s3.is_enabled)
|
|
81452
81525
|
bits.push("disabled");
|
|
@@ -81462,10 +81535,10 @@ function renderServerList(servers) {
|
|
|
81462
81535
|
const expiry = describeExpiry(s3);
|
|
81463
81536
|
if (expiry)
|
|
81464
81537
|
bits.push(expiry);
|
|
81465
|
-
lines.push(` ${mark} ${
|
|
81538
|
+
lines.push(` ${mark} ${import_picocolors53.default.bold(sanitizeLabel(s3.name))} ${import_picocolors53.default.dim(bits.join(" · "))}`);
|
|
81466
81539
|
}
|
|
81467
81540
|
if (servers.some((s3) => s3.auth === "oauth_required" || s3.auth === "oauth_expired")) {
|
|
81468
|
-
lines.push("",
|
|
81541
|
+
lines.push("", import_picocolors53.default.dim("Run `brainbase mcp connect <name>` to authorize a server."));
|
|
81469
81542
|
}
|
|
81470
81543
|
lines.push("");
|
|
81471
81544
|
return lines.join(`
|
|
@@ -81489,7 +81562,255 @@ function describeExpiry(server, now2 = Date.now()) {
|
|
|
81489
81562
|
const days = Math.round(hours / 24);
|
|
81490
81563
|
return days > MAX_EXPIRY_DAYS ? `expires in >${MAX_EXPIRY_DAYS}d` : `expires in ${days}d`;
|
|
81491
81564
|
}
|
|
81492
|
-
|
|
81565
|
+
var CONNECT_USAGE = `Usage: brainbase mcp connect <name> [--json] [--no-open] [--no-wait]
|
|
81566
|
+
`;
|
|
81567
|
+
var POLL_INTERVAL_MS = 1000;
|
|
81568
|
+
function connectUsageError(options) {
|
|
81569
|
+
if (options.json) {
|
|
81570
|
+
(options.write ?? ((s3) => process.stdout.write(s3)))(JSON.stringify({ error: CONNECT_USAGE.trim() }) + `
|
|
81571
|
+
`);
|
|
81572
|
+
} else {
|
|
81573
|
+
(options.writeErr ?? ((s3) => process.stderr.write(s3)))(CONNECT_USAGE);
|
|
81574
|
+
}
|
|
81575
|
+
return 1;
|
|
81576
|
+
}
|
|
81577
|
+
var MAX_CONSECUTIVE_POLL_FAILURES = 5;
|
|
81578
|
+
var WAITING_MESSAGE = "Waiting for you to approve in the browser (Ctrl-C to cancel)";
|
|
81579
|
+
async function runMcpConnect(cwd2, name, options) {
|
|
81580
|
+
const write = options.write ?? ((s3) => process.stdout.write(s3));
|
|
81581
|
+
const writeErr = options.writeErr ?? ((s3) => process.stderr.write(s3));
|
|
81582
|
+
const fetchServers = options.fetchServers ?? ((id) => api.listAgentMcpServers(id));
|
|
81583
|
+
const resolveAgentId = options.resolveAgentId ?? ((dir) => readLink(dir)?.agent_id ?? null);
|
|
81584
|
+
const createLink = options.createLink ?? ((id, server) => api.createMcpConnectLink(id, server));
|
|
81585
|
+
const getLink = options.getLink ?? ((id, signal2) => api.getMcpConnectLink(id, { signal: signal2 }));
|
|
81586
|
+
const openUrl = options.openUrl ?? openInBrowser;
|
|
81587
|
+
const interactive = options.interactive ?? isInteractive();
|
|
81588
|
+
const fail2 = (message) => {
|
|
81589
|
+
if (options.json)
|
|
81590
|
+
write(JSON.stringify({ error: message }) + `
|
|
81591
|
+
`);
|
|
81592
|
+
else
|
|
81593
|
+
writeErr(message + `
|
|
81594
|
+
`);
|
|
81595
|
+
return 1;
|
|
81596
|
+
};
|
|
81597
|
+
if (!name || name.startsWith("-"))
|
|
81598
|
+
return connectUsageError(options);
|
|
81599
|
+
const agentId = resolveAgentId(cwd2);
|
|
81600
|
+
if (!agentId) {
|
|
81601
|
+
return fail2("This folder is not linked to any agent. Run `brainbase link` first.");
|
|
81602
|
+
}
|
|
81603
|
+
let servers;
|
|
81604
|
+
try {
|
|
81605
|
+
servers = (await fetchServers(agentId)).servers;
|
|
81606
|
+
} catch (err) {
|
|
81607
|
+
return fail2(`brainbase mcp connect failed: ${sanitizeLabel(err.message)}`);
|
|
81608
|
+
}
|
|
81609
|
+
const label = sanitizeLabel(name);
|
|
81610
|
+
const matches2 = servers.filter((s3) => s3.name === name);
|
|
81611
|
+
const own = matches2.find((s3) => s3.source_kind !== "orchestration");
|
|
81612
|
+
if (!own) {
|
|
81613
|
+
const inherited = matches2[0];
|
|
81614
|
+
if (inherited) {
|
|
81615
|
+
const source = sanitizeLabel(String(inherited.source_name ?? inherited.source_id ?? "an orchestration"));
|
|
81616
|
+
return fail2(`${label} is inherited from ${source}. Connecting an orchestration's MCP server from the CLI is not supported yet; authorize it in the web app.`);
|
|
81617
|
+
}
|
|
81618
|
+
const known = [...new Set(servers.map((s3) => sanitizeLabel(s3.name)))];
|
|
81619
|
+
return fail2(known.length > 0 ? `No MCP server named "${label}" on this agent. Known servers: ${known.join(", ")}.` : `No MCP server named "${label}" on this agent. It has no MCP servers.`);
|
|
81620
|
+
}
|
|
81621
|
+
if (own.auth === "none")
|
|
81622
|
+
return fail2(`${label} does not use OAuth.`);
|
|
81623
|
+
let link2;
|
|
81624
|
+
try {
|
|
81625
|
+
link2 = await createLink(agentId, own.name);
|
|
81626
|
+
} catch (err) {
|
|
81627
|
+
return fail2(`Could not create a connect link for ${label}: ${sanitizeLabel(err.message)}`);
|
|
81628
|
+
}
|
|
81629
|
+
const url2 = safeLinkUrl(link2?.url);
|
|
81630
|
+
if (!url2 || typeof link2.link_id !== "string" || !link2.link_id) {
|
|
81631
|
+
return fail2("The server returned an unusable connect link.");
|
|
81632
|
+
}
|
|
81633
|
+
if (options.json) {
|
|
81634
|
+
write(JSON.stringify({
|
|
81635
|
+
link_id: link2.link_id,
|
|
81636
|
+
url: url2,
|
|
81637
|
+
expires_at: link2.expires_at,
|
|
81638
|
+
server: link2.server
|
|
81639
|
+
}) + `
|
|
81640
|
+
`);
|
|
81641
|
+
return 0;
|
|
81642
|
+
}
|
|
81643
|
+
write(`Open this link to authorize ${import_picocolors53.default.bold(label)}:
|
|
81644
|
+
|
|
81645
|
+
${import_picocolors53.default.cyan(url2)}
|
|
81646
|
+
|
|
81647
|
+
`);
|
|
81648
|
+
write(import_picocolors53.default.dim(`${describeLinkLifetime(link2.expires_at)}
|
|
81649
|
+
`));
|
|
81650
|
+
if (!options.noOpen && interactive) {
|
|
81651
|
+
write(import_picocolors53.default.dim(`Opening your browser…
|
|
81652
|
+
`));
|
|
81653
|
+
openUrl(url2);
|
|
81654
|
+
}
|
|
81655
|
+
if (options.noWait) {
|
|
81656
|
+
write(import_picocolors53.default.dim("Not waiting. Run `brainbase mcp list` to see when it is authorized.\n"));
|
|
81657
|
+
return 0;
|
|
81658
|
+
}
|
|
81659
|
+
const controller = new AbortController;
|
|
81660
|
+
const onInterrupt = () => controller.abort();
|
|
81661
|
+
const signal = options.signal ?? controller.signal;
|
|
81662
|
+
const stdoutIsTTY = options.stdoutIsTTY ?? process.stdout.isTTY === true;
|
|
81663
|
+
const spinner = interactive && stdoutIsTTY ? (options.spinner ?? (() => waitSpinner()))() : null;
|
|
81664
|
+
if (spinner)
|
|
81665
|
+
spinner.start(WAITING_MESSAGE);
|
|
81666
|
+
else
|
|
81667
|
+
write(`${WAITING_MESSAGE}
|
|
81668
|
+
`);
|
|
81669
|
+
if (!options.signal)
|
|
81670
|
+
process.on("SIGINT", onInterrupt);
|
|
81671
|
+
let outcome;
|
|
81672
|
+
try {
|
|
81673
|
+
outcome = await waitForConnectLink(link2.link_id, {
|
|
81674
|
+
getLink,
|
|
81675
|
+
intervalMs: options.pollIntervalMs ?? POLL_INTERVAL_MS,
|
|
81676
|
+
signal
|
|
81677
|
+
});
|
|
81678
|
+
} finally {
|
|
81679
|
+
if (!options.signal)
|
|
81680
|
+
process.removeListener("SIGINT", onInterrupt);
|
|
81681
|
+
}
|
|
81682
|
+
const finish = (ok, message) => {
|
|
81683
|
+
if (spinner) {
|
|
81684
|
+
spinner.stop(message, ok ? 0 : 2);
|
|
81685
|
+
} else if (ok) {
|
|
81686
|
+
write(`${import_picocolors53.default.green("✔")} ${message}
|
|
81687
|
+
`);
|
|
81688
|
+
} else {
|
|
81689
|
+
writeErr(`${message}
|
|
81690
|
+
`);
|
|
81691
|
+
}
|
|
81692
|
+
};
|
|
81693
|
+
switch (outcome.kind) {
|
|
81694
|
+
case "connected":
|
|
81695
|
+
finish(true, `${label} authorized. Your agent can use it on its next turn.`);
|
|
81696
|
+
return 0;
|
|
81697
|
+
case "failed":
|
|
81698
|
+
finish(false, describeConnectFailure(label, outcome.errorCode));
|
|
81699
|
+
return 1;
|
|
81700
|
+
case "expired":
|
|
81701
|
+
finish(false, `The link expired. Run brainbase mcp connect ${label} again.`);
|
|
81702
|
+
return 1;
|
|
81703
|
+
case "cancelled":
|
|
81704
|
+
spinner?.stop("Cancelled.", 1);
|
|
81705
|
+
writeErr(`Stopped waiting. The link still works until it expires, and finishing in the browser will still authorize ${label}.
|
|
81706
|
+
`);
|
|
81707
|
+
return 130;
|
|
81708
|
+
case "error":
|
|
81709
|
+
finish(false, sanitizeLabel(outcome.message));
|
|
81710
|
+
return 1;
|
|
81711
|
+
}
|
|
81712
|
+
}
|
|
81713
|
+
function safeLinkUrl(raw) {
|
|
81714
|
+
if (typeof raw !== "string")
|
|
81715
|
+
return null;
|
|
81716
|
+
let parsed;
|
|
81717
|
+
try {
|
|
81718
|
+
parsed = new URL(raw);
|
|
81719
|
+
} catch {
|
|
81720
|
+
return null;
|
|
81721
|
+
}
|
|
81722
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:")
|
|
81723
|
+
return null;
|
|
81724
|
+
return parsed.toString();
|
|
81725
|
+
}
|
|
81726
|
+
function describeLinkLifetime(expiresAt, now2 = Date.now()) {
|
|
81727
|
+
const at3 = expiresAt ? Date.parse(expiresAt) : NaN;
|
|
81728
|
+
const minutes = Math.round((at3 - now2) / 60000);
|
|
81729
|
+
if (!Number.isFinite(minutes) || minutes < 1 || minutes > 120) {
|
|
81730
|
+
return "The link works once.";
|
|
81731
|
+
}
|
|
81732
|
+
return `The link works once and expires in ${minutes} minute${minutes === 1 ? "" : "s"}.`;
|
|
81733
|
+
}
|
|
81734
|
+
function describeConnectFailure(label, errorCode) {
|
|
81735
|
+
switch (errorCode) {
|
|
81736
|
+
case "superseded":
|
|
81737
|
+
return `Another authorization for ${label} started, so this one was cancelled.`;
|
|
81738
|
+
case "access_denied":
|
|
81739
|
+
case "authorization_cancelled":
|
|
81740
|
+
return `Authorization for ${label} was declined in the browser. Run brainbase mcp connect ${label} to try again.`;
|
|
81741
|
+
default: {
|
|
81742
|
+
const code = errorCode ? ` (${sanitizeLabel(errorCode)})` : "";
|
|
81743
|
+
return `Authorization for ${label} did not complete${code}. Run brainbase mcp connect ${label} to try again.`;
|
|
81744
|
+
}
|
|
81745
|
+
}
|
|
81746
|
+
}
|
|
81747
|
+
function isTransientPollError(err) {
|
|
81748
|
+
if (!(err instanceof ApiError))
|
|
81749
|
+
return true;
|
|
81750
|
+
const status = err.status;
|
|
81751
|
+
return status === undefined || status >= 500 || status === 408 || status === 429;
|
|
81752
|
+
}
|
|
81753
|
+
function abortableSleep(ms2, signal) {
|
|
81754
|
+
return new Promise((resolve) => {
|
|
81755
|
+
if (signal.aborted)
|
|
81756
|
+
return resolve();
|
|
81757
|
+
const done = () => {
|
|
81758
|
+
clearTimeout(timer);
|
|
81759
|
+
signal.removeEventListener("abort", done);
|
|
81760
|
+
resolve();
|
|
81761
|
+
};
|
|
81762
|
+
const timer = setTimeout(done, ms2);
|
|
81763
|
+
signal.addEventListener("abort", done, { once: true });
|
|
81764
|
+
});
|
|
81765
|
+
}
|
|
81766
|
+
async function waitForConnectLink(linkId, options) {
|
|
81767
|
+
const { getLink, intervalMs, signal } = options;
|
|
81768
|
+
const maxFailures = options.maxConsecutiveFailures ?? MAX_CONSECUTIVE_POLL_FAILURES;
|
|
81769
|
+
const aborted2 = new Promise((resolve) => {
|
|
81770
|
+
if (signal.aborted)
|
|
81771
|
+
resolve("aborted");
|
|
81772
|
+
else
|
|
81773
|
+
signal.addEventListener("abort", () => resolve("aborted"), { once: true });
|
|
81774
|
+
});
|
|
81775
|
+
let failures = 0;
|
|
81776
|
+
while (true) {
|
|
81777
|
+
await abortableSleep(intervalMs, signal);
|
|
81778
|
+
if (signal.aborted)
|
|
81779
|
+
return { kind: "cancelled" };
|
|
81780
|
+
const result2 = await Promise.race([
|
|
81781
|
+
getLink(linkId, signal).then((state) => ({ ok: true, state }), (error2) => ({ ok: false, error: error2 })),
|
|
81782
|
+
aborted2
|
|
81783
|
+
]);
|
|
81784
|
+
if (result2 === "aborted")
|
|
81785
|
+
return { kind: "cancelled" };
|
|
81786
|
+
if (!result2.ok) {
|
|
81787
|
+
const message = result2.error?.message ?? String(result2.error);
|
|
81788
|
+
if (!isTransientPollError(result2.error)) {
|
|
81789
|
+
return { kind: "error", message: `Could not check the link: ${message}` };
|
|
81790
|
+
}
|
|
81791
|
+
failures += 1;
|
|
81792
|
+
if (failures >= maxFailures) {
|
|
81793
|
+
return {
|
|
81794
|
+
kind: "error",
|
|
81795
|
+
message: `Lost contact with Brainbase while waiting (${message}). If you finished in the browser, check with \`brainbase mcp list\`.`
|
|
81796
|
+
};
|
|
81797
|
+
}
|
|
81798
|
+
continue;
|
|
81799
|
+
}
|
|
81800
|
+
failures = 0;
|
|
81801
|
+
switch (result2.state?.status) {
|
|
81802
|
+
case "connected":
|
|
81803
|
+
return { kind: "connected" };
|
|
81804
|
+
case "failed":
|
|
81805
|
+
return { kind: "failed", errorCode: result2.state.error_code ?? null };
|
|
81806
|
+
case "expired":
|
|
81807
|
+
return { kind: "expired" };
|
|
81808
|
+
default:
|
|
81809
|
+
break;
|
|
81810
|
+
}
|
|
81811
|
+
}
|
|
81812
|
+
}
|
|
81813
|
+
async function runMcp(cwd2, sub, argv, options) {
|
|
81493
81814
|
const writeErr = options.writeErr ?? ((s3) => process.stderr.write(s3));
|
|
81494
81815
|
switch (sub) {
|
|
81495
81816
|
case "check": {
|
|
@@ -81498,20 +81819,25 @@ async function runMcp(cwd2, sub, _argv, options) {
|
|
|
81498
81819
|
}
|
|
81499
81820
|
case "list":
|
|
81500
81821
|
return runMcpList(cwd2, options);
|
|
81822
|
+
case "connect": {
|
|
81823
|
+
if (argv.length > 1)
|
|
81824
|
+
return connectUsageError(options);
|
|
81825
|
+
return runMcpConnect(cwd2, argv[0], options);
|
|
81826
|
+
}
|
|
81501
81827
|
default:
|
|
81502
81828
|
writeErr(`Unknown mcp subcommand: ${sub ?? "(none)"}
|
|
81503
81829
|
`);
|
|
81504
|
-
writeErr(`Usage: brainbase mcp <check|list
|
|
81830
|
+
writeErr(`Usage: brainbase mcp <check|list|connect <name>> [--json]
|
|
81505
81831
|
`);
|
|
81506
81832
|
return 1;
|
|
81507
81833
|
}
|
|
81508
81834
|
}
|
|
81509
81835
|
|
|
81510
81836
|
// src/cli/task.ts
|
|
81511
|
-
var
|
|
81837
|
+
var import_picocolors58 = __toESM(require_picocolors(), 1);
|
|
81512
81838
|
|
|
81513
81839
|
// src/cli/task-create.ts
|
|
81514
|
-
var
|
|
81840
|
+
var import_picocolors54 = __toESM(require_picocolors(), 1);
|
|
81515
81841
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
81516
81842
|
|
|
81517
81843
|
// src/core/interfaces-api.ts
|
|
@@ -81803,10 +82129,7 @@ var REASON_HINTS = {
|
|
|
81803
82129
|
nothing_live: "Nothing is live yet, so there is nothing to roll back from.",
|
|
81804
82130
|
release_already_live: "That release is already live.",
|
|
81805
82131
|
audience_empty: "Nobody can open it yet. Set the audience with `brainbase interface access <id> --everyone` or `--people <ids>`.",
|
|
81806
|
-
slug_unavailable: "Pick another address."
|
|
81807
|
-
harness_unsupported: "Switch the agent to a harness that supports interfaces (Kafka, Claude Code, Codex, Qwen Code or OpenCode).",
|
|
81808
|
-
snapshot_too_old: "Update the agent to a newer version and try again.",
|
|
81809
|
-
service_unconfigured: "Interfaces are not set up on this control plane."
|
|
82132
|
+
slug_unavailable: "Pick another address."
|
|
81810
82133
|
};
|
|
81811
82134
|
function usesPat() {
|
|
81812
82135
|
if (process.env.BRAINBASE_TOKEN?.trim())
|
|
@@ -82423,24 +82746,24 @@ async function waitForCreatedTask(created, options, dependencies) {
|
|
|
82423
82746
|
return;
|
|
82424
82747
|
}
|
|
82425
82748
|
if (outcome.kind === "timeout") {
|
|
82426
|
-
console.log(
|
|
82749
|
+
console.log(import_picocolors54.default.yellow(`Timed out after ${options.timeoutSeconds}s with the task still ${status}.`));
|
|
82427
82750
|
return;
|
|
82428
82751
|
}
|
|
82429
82752
|
if (outcome.kind === "interrupted") {
|
|
82430
|
-
console.log(
|
|
82753
|
+
console.log(import_picocolors54.default.yellow("Interrupted. The task is still running."));
|
|
82431
82754
|
return;
|
|
82432
82755
|
}
|
|
82433
|
-
console.log(code === 0 ?
|
|
82756
|
+
console.log(code === 0 ? import_picocolors54.default.green("Task completed.") : import_picocolors54.default.red(`Task finished as ${status}.`));
|
|
82434
82757
|
} finally {
|
|
82435
82758
|
process.removeListener("SIGINT", onSigint);
|
|
82436
82759
|
}
|
|
82437
82760
|
}
|
|
82438
82761
|
|
|
82439
82762
|
// src/cli/task-get.ts
|
|
82440
|
-
var
|
|
82763
|
+
var import_picocolors56 = __toESM(require_picocolors(), 1);
|
|
82441
82764
|
|
|
82442
82765
|
// src/cli/task-list.ts
|
|
82443
|
-
var
|
|
82766
|
+
var import_picocolors55 = __toESM(require_picocolors(), 1);
|
|
82444
82767
|
var INTERFACE_THREAD_METADATA_KEY = "brainbase_interface_id";
|
|
82445
82768
|
async function runTaskList(options) {
|
|
82446
82769
|
if (!options.json)
|
|
@@ -82460,23 +82783,23 @@ function formatTaskList(tasks, agentId, interfaceId) {
|
|
|
82460
82783
|
const lines = [""];
|
|
82461
82784
|
if (tasks.length === 0 && interfaceId) {
|
|
82462
82785
|
const id = sanitizeLabel(interfaceId);
|
|
82463
|
-
lines.push(` ${
|
|
82786
|
+
lines.push(` ${import_picocolors55.default.dim(`No build conversations for interface ${id}.`)}`, "", ` ${import_picocolors55.default.dim("start one with")} ${import_picocolors55.default.cyan(`brainbase interface build ${id} "..."`)}`, "");
|
|
82464
82787
|
return lines.join(`
|
|
82465
82788
|
`);
|
|
82466
82789
|
}
|
|
82467
82790
|
if (tasks.length === 0) {
|
|
82468
|
-
lines.push(` ${
|
|
82791
|
+
lines.push(` ${import_picocolors55.default.dim(agentId ? `No tasks for agent ${agentId}.` : "No tasks yet.")}`, "", ` ${import_picocolors55.default.dim("start one with")} ${import_picocolors55.default.cyan('brainbase task create --message "..."')}`, "");
|
|
82469
82792
|
return lines.join(`
|
|
82470
82793
|
`);
|
|
82471
82794
|
}
|
|
82472
82795
|
for (const task of tasks) {
|
|
82473
|
-
const title = sanitizeLabel(task.title ?? "").trim() ||
|
|
82474
|
-
lines.push(` ${statusLabel(task.status)} ${
|
|
82475
|
-
lines.push(` ${
|
|
82476
|
-
lines.push(` ${
|
|
82796
|
+
const title = sanitizeLabel(task.title ?? "").trim() || import_picocolors55.default.dim("(untitled)");
|
|
82797
|
+
lines.push(` ${statusLabel(task.status)} ${import_picocolors55.default.bold(title)}`);
|
|
82798
|
+
lines.push(` ${import_picocolors55.default.dim(task.id)}`);
|
|
82799
|
+
lines.push(` ${import_picocolors55.default.dim(`agent ${task.agent_id} · created ${task.created_at}`)}`);
|
|
82477
82800
|
lines.push("");
|
|
82478
82801
|
}
|
|
82479
|
-
lines.push(` ${
|
|
82802
|
+
lines.push(` ${import_picocolors55.default.dim("inspect one with")} ${import_picocolors55.default.cyan("brainbase task get <id>")}`, "");
|
|
82480
82803
|
return lines.join(`
|
|
82481
82804
|
`);
|
|
82482
82805
|
}
|
|
@@ -82484,16 +82807,16 @@ function statusLabel(status) {
|
|
|
82484
82807
|
const padded = status.padEnd(14);
|
|
82485
82808
|
switch (status) {
|
|
82486
82809
|
case "success":
|
|
82487
|
-
return
|
|
82810
|
+
return import_picocolors55.default.green(padded);
|
|
82488
82811
|
case "fail":
|
|
82489
|
-
return
|
|
82812
|
+
return import_picocolors55.default.red(padded);
|
|
82490
82813
|
case "need_more_info":
|
|
82491
|
-
return
|
|
82814
|
+
return import_picocolors55.default.yellow(padded);
|
|
82492
82815
|
case "running":
|
|
82493
82816
|
case "initializing":
|
|
82494
|
-
return
|
|
82817
|
+
return import_picocolors55.default.cyan(padded);
|
|
82495
82818
|
default:
|
|
82496
|
-
return
|
|
82819
|
+
return import_picocolors55.default.dim(padded);
|
|
82497
82820
|
}
|
|
82498
82821
|
}
|
|
82499
82822
|
|
|
@@ -82527,49 +82850,49 @@ async function readEvalRuns(task) {
|
|
|
82527
82850
|
}
|
|
82528
82851
|
function format(task, evals) {
|
|
82529
82852
|
const lines = [""];
|
|
82530
|
-
const title = task.title?.trim() ||
|
|
82531
|
-
lines.push(` ${statusLabel(task.status)} ${
|
|
82853
|
+
const title = task.title?.trim() || import_picocolors56.default.dim("(untitled)");
|
|
82854
|
+
lines.push(` ${statusLabel(task.status)} ${import_picocolors56.default.bold(title)}`);
|
|
82532
82855
|
lines.push("");
|
|
82533
|
-
lines.push(` ${
|
|
82534
|
-
lines.push(` ${
|
|
82535
|
-
lines.push(` ${
|
|
82856
|
+
lines.push(` ${import_picocolors56.default.dim("task")} ${task.id}`);
|
|
82857
|
+
lines.push(` ${import_picocolors56.default.dim("agent")} ${task.agent_id}`);
|
|
82858
|
+
lines.push(` ${import_picocolors56.default.dim("created")} ${task.created_at}`);
|
|
82536
82859
|
if (task.parent_task_id) {
|
|
82537
|
-
lines.push(` ${
|
|
82860
|
+
lines.push(` ${import_picocolors56.default.dim("parent")} ${task.parent_task_id}`);
|
|
82538
82861
|
}
|
|
82539
82862
|
if (task.machine_id) {
|
|
82540
|
-
lines.push(` ${
|
|
82863
|
+
lines.push(` ${import_picocolors56.default.dim("machine")} ${task.machine_id}${task.machine_size ? ` (${task.machine_size})` : ""}`);
|
|
82541
82864
|
}
|
|
82542
82865
|
if (task.sandbox_id)
|
|
82543
|
-
lines.push(` ${
|
|
82866
|
+
lines.push(` ${import_picocolors56.default.dim("sandbox")} ${task.sandbox_id}`);
|
|
82544
82867
|
const failure = failureSummary(task);
|
|
82545
82868
|
if (failure) {
|
|
82546
82869
|
lines.push("");
|
|
82547
|
-
lines.push(` ${
|
|
82870
|
+
lines.push(` ${import_picocolors56.default.red("failure")} ${failure}`);
|
|
82548
82871
|
}
|
|
82549
82872
|
const metadata = Object.entries(task.metadata ?? {});
|
|
82550
82873
|
if (metadata.length > 0) {
|
|
82551
82874
|
lines.push("");
|
|
82552
|
-
lines.push(` ${
|
|
82875
|
+
lines.push(` ${import_picocolors56.default.bold(import_picocolors56.default.dim("METADATA"))}`);
|
|
82553
82876
|
for (const [key2, value] of metadata) {
|
|
82554
|
-
lines.push(` ${
|
|
82877
|
+
lines.push(` ${import_picocolors56.default.dim(key2)} ${value}`);
|
|
82555
82878
|
}
|
|
82556
82879
|
}
|
|
82557
82880
|
lines.push("");
|
|
82558
|
-
lines.push(` ${
|
|
82881
|
+
lines.push(` ${import_picocolors56.default.bold(import_picocolors56.default.dim("EVAL VERDICTS"))}`);
|
|
82559
82882
|
if (evals.unavailable) {
|
|
82560
|
-
lines.push(` ${
|
|
82883
|
+
lines.push(` ${import_picocolors56.default.dim(evals.unavailable)}`);
|
|
82561
82884
|
} else if (evals.runs.length === 0) {
|
|
82562
|
-
lines.push(` ${
|
|
82885
|
+
lines.push(` ${import_picocolors56.default.dim("none")}`);
|
|
82563
82886
|
} else {
|
|
82564
82887
|
for (const run of evals.runs) {
|
|
82565
|
-
const verdict = run.passed === true ?
|
|
82888
|
+
const verdict = run.passed === true ? import_picocolors56.default.green("pass") : run.passed === false ? import_picocolors56.default.red("fail") : import_picocolors56.default.dim(run.status);
|
|
82566
82889
|
lines.push(` ${verdict} ${run.eval_slug ?? run.eval_id}`);
|
|
82567
82890
|
if (run.reasoning)
|
|
82568
|
-
lines.push(` ${
|
|
82891
|
+
lines.push(` ${import_picocolors56.default.dim(run.reasoning)}`);
|
|
82569
82892
|
}
|
|
82570
82893
|
}
|
|
82571
82894
|
lines.push("");
|
|
82572
|
-
lines.push(` ${
|
|
82895
|
+
lines.push(` ${import_picocolors56.default.dim("read its transcript with")} ${import_picocolors56.default.cyan(`brainbase task logs ${task.id}`)}`, "");
|
|
82573
82896
|
return lines.join(`
|
|
82574
82897
|
`);
|
|
82575
82898
|
}
|
|
@@ -82586,7 +82909,7 @@ function failureSummary(task) {
|
|
|
82586
82909
|
}
|
|
82587
82910
|
|
|
82588
82911
|
// src/cli/task-logs.ts
|
|
82589
|
-
var
|
|
82912
|
+
var import_picocolors57 = __toESM(require_picocolors(), 1);
|
|
82590
82913
|
|
|
82591
82914
|
// src/core/task-events.ts
|
|
82592
82915
|
var DEFAULT_RETRY_BUDGET_MS = 60000;
|
|
@@ -82722,14 +83045,14 @@ async function runTaskLogs(taskId, options = {}, dependencies = {}) {
|
|
|
82722
83045
|
console.log(renderEvent(event));
|
|
82723
83046
|
}
|
|
82724
83047
|
if (ordered.length === 0) {
|
|
82725
|
-
console.log(
|
|
83048
|
+
console.log(import_picocolors57.default.dim("No events for this task yet."));
|
|
82726
83049
|
}
|
|
82727
83050
|
}
|
|
82728
83051
|
async function followTranscript(taskId, options, dependencies) {
|
|
82729
83052
|
const backfill = options.limit === undefined ? "" : `?backfill=${options.limit}`;
|
|
82730
83053
|
const { url: url2, resolveBearer } = await masStreamTarget(`/tasks/${encodeURIComponent(taskId)}/events/stream${backfill}`);
|
|
82731
83054
|
if (!options.json) {
|
|
82732
|
-
console.log(
|
|
83055
|
+
console.log(import_picocolors57.default.dim(`Following task ${taskId} — Ctrl-C to stop.`));
|
|
82733
83056
|
}
|
|
82734
83057
|
const setExitCode = dependencies.setExitCode ?? ((code) => process.exitCode = code);
|
|
82735
83058
|
const controller = new AbortController;
|
|
@@ -82757,10 +83080,10 @@ async function followTranscript(taskId, options, dependencies) {
|
|
|
82757
83080
|
} else if (options.json) {
|
|
82758
83081
|
console.log(JSON.stringify(frame));
|
|
82759
83082
|
} else {
|
|
82760
|
-
console.log(
|
|
83083
|
+
console.log(import_picocolors57.default.dim(frame.type));
|
|
82761
83084
|
}
|
|
82762
83085
|
},
|
|
82763
|
-
onReconnect: (reason) => console.error(
|
|
83086
|
+
onReconnect: (reason) => console.error(import_picocolors57.default.dim(`reconnecting — ${reason}`))
|
|
82764
83087
|
});
|
|
82765
83088
|
if (interruptCode !== undefined)
|
|
82766
83089
|
setExitCode(interruptCode);
|
|
@@ -83444,64 +83767,64 @@ async function runTask(cwd2, sub, args) {
|
|
|
83444
83767
|
function printHelp4() {
|
|
83445
83768
|
const out = [];
|
|
83446
83769
|
out.push("");
|
|
83447
|
-
out.push(` ${
|
|
83770
|
+
out.push(` ${import_picocolors58.default.bold("brainbase task")} ${import_picocolors58.default.dim("<sub> [options]")}`);
|
|
83448
83771
|
out.push("");
|
|
83449
|
-
out.push(` ${
|
|
83450
|
-
out.push(` ${
|
|
83451
|
-
out.push(` ${
|
|
83452
|
-
out.push(` ${
|
|
83453
|
-
out.push(` ${
|
|
83454
|
-
out.push(` ${
|
|
83455
|
-
out.push(` ${
|
|
83772
|
+
out.push(` ${import_picocolors58.default.cyan("create")} ${import_picocolors58.default.dim("--message <text>")} ${import_picocolors58.default.dim("create a task and start its first run")}`);
|
|
83773
|
+
out.push(` ${import_picocolors58.default.cyan("list | ls")} ${import_picocolors58.default.dim("recent tasks you can reach (--json for scripts)")}`);
|
|
83774
|
+
out.push(` ${import_picocolors58.default.cyan("get")} ${import_picocolors58.default.dim("<task-id>")} ${import_picocolors58.default.dim("one task: status, agent, machine, eval verdicts")}`);
|
|
83775
|
+
out.push(` ${import_picocolors58.default.cyan("logs")} ${import_picocolors58.default.dim("<task-id> [--follow]")} ${import_picocolors58.default.dim("one line per event in the task's transcript, or tail it live")}`);
|
|
83776
|
+
out.push(` ${import_picocolors58.default.cyan("send")} ${import_picocolors58.default.dim("<task-id> <message>")} ${import_picocolors58.default.dim("send a follow-up, including while the agent is running")}`);
|
|
83777
|
+
out.push(` ${import_picocolors58.default.cyan("stop")} ${import_picocolors58.default.dim("<task-id>")} ${import_picocolors58.default.dim("stop execution and cancel pending follow-ups, retaining their text")}`);
|
|
83778
|
+
out.push(` ${import_picocolors58.default.cyan("delete")} ${import_picocolors58.default.dim("<task-id>")} ${import_picocolors58.default.dim("permanently delete a stopped task and tear down its sandbox (--yes to skip the prompt)")}`);
|
|
83456
83779
|
out.push("");
|
|
83457
|
-
out.push(` ${
|
|
83458
|
-
out.push(` ${
|
|
83459
|
-
out.push(` ${
|
|
83460
|
-
out.push(` ${
|
|
83461
|
-
out.push(` ${
|
|
83462
|
-
out.push(` ${
|
|
83463
|
-
out.push(` ${
|
|
83464
|
-
out.push(` ${
|
|
83780
|
+
out.push(` ${import_picocolors58.default.bold("create flags")}`);
|
|
83781
|
+
out.push(` ${import_picocolors58.default.dim("--message <text>")} required first user message`);
|
|
83782
|
+
out.push(` ${import_picocolors58.default.dim("--agent <id>")} override the claimed agent in brainbase.agent.yaml`);
|
|
83783
|
+
out.push(` ${import_picocolors58.default.dim("--interface <id>")} open it as a build conversation for this interface (agent defaults to the interface's)`);
|
|
83784
|
+
out.push(` ${import_picocolors58.default.dim("--title <text>")} optional task title`);
|
|
83785
|
+
out.push(` ${import_picocolors58.default.dim("--model <id>")} optional model override`);
|
|
83786
|
+
out.push(` ${import_picocolors58.default.dim("--wait")} block until the task finishes; exit 1 unless it succeeded`);
|
|
83787
|
+
out.push(` ${import_picocolors58.default.dim("--timeout <secs>")} give up waiting after <secs> and exit 1 (needs --wait)`);
|
|
83465
83788
|
out.push("");
|
|
83466
|
-
out.push(` ${
|
|
83467
|
-
out.push(` ${
|
|
83468
|
-
out.push(` ${
|
|
83469
|
-
out.push(` ${
|
|
83789
|
+
out.push(` ${import_picocolors58.default.bold("list flags")}`);
|
|
83790
|
+
out.push(` ${import_picocolors58.default.dim("--agent <id>")} only this agent's tasks`);
|
|
83791
|
+
out.push(` ${import_picocolors58.default.dim("--interface <id>")} only this interface's build conversations (hidden from a plain list)`);
|
|
83792
|
+
out.push(` ${import_picocolors58.default.dim("--limit <n>")} cap the page (1-200, server default 50)`);
|
|
83470
83793
|
out.push("");
|
|
83471
|
-
out.push(` ${
|
|
83472
|
-
out.push(` ${
|
|
83473
|
-
out.push(` ${
|
|
83794
|
+
out.push(` ${import_picocolors58.default.bold("logs flags")}`);
|
|
83795
|
+
out.push(` ${import_picocolors58.default.dim("--limit <n>")} stop after <n> events instead of the whole transcript; with --follow, the first page size`);
|
|
83796
|
+
out.push(` ${import_picocolors58.default.dim("--follow, -f")} stay attached and print events as they land, until the task finishes`);
|
|
83474
83797
|
out.push("");
|
|
83475
|
-
out.push(` ${
|
|
83476
|
-
out.push(` ${
|
|
83477
|
-
out.push(` ${
|
|
83478
|
-
out.push(` ${
|
|
83798
|
+
out.push(` ${import_picocolors58.default.bold("send flags")}`);
|
|
83799
|
+
out.push(` ${import_picocolors58.default.dim("--input-id <uuid>")} recover the same request using its original ID and identical message`);
|
|
83800
|
+
out.push(` ${import_picocolors58.default.dim(" omit it to send a new follow-up; an unconfirmed receipt is never automatically replayed")}`);
|
|
83801
|
+
out.push(` ${import_picocolors58.default.dim(" admission disabled/recovery unavailable means no input was admitted; retry the same ID after recovery")}`);
|
|
83479
83802
|
out.push("");
|
|
83480
|
-
out.push(` ${
|
|
83481
|
-
out.push(` ${
|
|
83482
|
-
out.push(` ${
|
|
83803
|
+
out.push(` ${import_picocolors58.default.bold("send and stop flags")}`);
|
|
83804
|
+
out.push(` ${import_picocolors58.default.dim("--generation <n>")} retain the printed generation when retrying; defaults to a fresh snapshot for a new operation`);
|
|
83805
|
+
out.push(` ${import_picocolors58.default.dim(" Stop errors may follow queued-input cancellation; retry the printed command to avoid stopping newer work")}`);
|
|
83483
83806
|
out.push("");
|
|
83484
|
-
out.push(` ${
|
|
83485
|
-
out.push(` ${
|
|
83486
|
-
out.push(` ${
|
|
83487
|
-
out.push(` ${
|
|
83807
|
+
out.push(` ${import_picocolors58.default.bold("every subcommand")}`);
|
|
83808
|
+
out.push(` ${import_picocolors58.default.dim("--json")} machine-readable output — create prints task_id, agent_id and status; list, get, logs, send and stop print the raw records; delete prints id and deleted`);
|
|
83809
|
+
out.push(` ${import_picocolors58.default.dim(" send and stop include expected_generation for safe retries; send also reports idempotency_replayed when present")}`);
|
|
83810
|
+
out.push(` ${import_picocolors58.default.dim(" logs --follow --json prints one record per line, since a live stream has no end to close on")}`);
|
|
83488
83811
|
out.push("");
|
|
83489
|
-
out.push(` ${
|
|
83490
|
-
out.push(` ${
|
|
83491
|
-
out.push(` ${
|
|
83492
|
-
out.push(` ${
|
|
83812
|
+
out.push(` ${import_picocolors58.default.dim("Exit codes with --wait:")} ${import_picocolors58.default.dim("0 succeeded · 1 failed, needs input, or timed out · 130 interrupted")}`);
|
|
83813
|
+
out.push(` ${import_picocolors58.default.dim("Exit codes with --follow:")} ${import_picocolors58.default.dim("0 task reached a terminal state · 1 stream refused, or unreachable for 60s · 130 interrupted (Ctrl-C) · 143 terminated")}`);
|
|
83814
|
+
out.push(` ${import_picocolors58.default.dim("Exit codes with send:")} ${import_picocolors58.default.dim("0 queued, dispatching, submitted or completed · 1 unconfirmed, cancelled, failed or request error")}`);
|
|
83815
|
+
out.push(` ${import_picocolors58.default.dim("Ctrl-C while waiting or following logs detaches; use task stop to cancel remote work.")}`);
|
|
83493
83816
|
out.push("");
|
|
83494
|
-
out.push(` ${
|
|
83817
|
+
out.push(` ${import_picocolors58.default.dim("Flag-like values:")} use ${import_picocolors58.default.cyan("--flag=value")} or ${import_picocolors58.default.cyan("--flag -- <value>")}`);
|
|
83495
83818
|
out.push("");
|
|
83496
83819
|
console.log(out.join(`
|
|
83497
83820
|
`));
|
|
83498
83821
|
}
|
|
83499
83822
|
|
|
83500
83823
|
// src/cli/machine.ts
|
|
83501
|
-
var
|
|
83824
|
+
var import_picocolors61 = __toESM(require_picocolors(), 1);
|
|
83502
83825
|
|
|
83503
83826
|
// src/cli/machine-list.ts
|
|
83504
|
-
var
|
|
83827
|
+
var import_picocolors59 = __toESM(require_picocolors(), 1);
|
|
83505
83828
|
async function runMachineList(args = {}) {
|
|
83506
83829
|
if (!args.json)
|
|
83507
83830
|
banner("machine list — sandboxes you can reach");
|
|
@@ -83518,7 +83841,7 @@ async function runMachineList(args = {}) {
|
|
|
83518
83841
|
function formatMachineList(machines, includedDead) {
|
|
83519
83842
|
const lines = [""];
|
|
83520
83843
|
if (machines.length === 0) {
|
|
83521
|
-
lines.push(` ${
|
|
83844
|
+
lines.push(` ${import_picocolors59.default.dim(includedDead ? "No machines." : "No live machines. Pass --all to include torn-down ones.")}`, "");
|
|
83522
83845
|
return lines.join(`
|
|
83523
83846
|
`);
|
|
83524
83847
|
}
|
|
@@ -83542,21 +83865,21 @@ function formatMachineList(machines, includedDead) {
|
|
|
83542
83865
|
row.kind.padEnd(kindWidth),
|
|
83543
83866
|
row.dead ? status : statusTint(row.status, status),
|
|
83544
83867
|
row.size.padEnd(sizeWidth),
|
|
83545
|
-
|
|
83868
|
+
import_picocolors59.default.dim(row.age)
|
|
83546
83869
|
].join(" ");
|
|
83547
|
-
lines.push(` ${row.dead ?
|
|
83870
|
+
lines.push(` ${row.dead ? import_picocolors59.default.dim(cells) : cells}`);
|
|
83548
83871
|
}
|
|
83549
|
-
lines.push("", ` ${
|
|
83872
|
+
lines.push("", ` ${import_picocolors59.default.dim("tear one down with")} ${import_picocolors59.default.cyan("brainbase machine rm <id>")}`, "");
|
|
83550
83873
|
return lines.join(`
|
|
83551
83874
|
`);
|
|
83552
83875
|
}
|
|
83553
83876
|
function statusTint(status, padded) {
|
|
83554
83877
|
switch (status) {
|
|
83555
83878
|
case "running":
|
|
83556
|
-
return
|
|
83879
|
+
return import_picocolors59.default.green(padded);
|
|
83557
83880
|
case "stopped":
|
|
83558
83881
|
case "starting":
|
|
83559
|
-
return
|
|
83882
|
+
return import_picocolors59.default.yellow(padded);
|
|
83560
83883
|
default:
|
|
83561
83884
|
return padded;
|
|
83562
83885
|
}
|
|
@@ -83579,7 +83902,7 @@ function age(createdAt) {
|
|
|
83579
83902
|
}
|
|
83580
83903
|
|
|
83581
83904
|
// src/cli/machine-rm.ts
|
|
83582
|
-
var
|
|
83905
|
+
var import_picocolors60 = __toESM(require_picocolors(), 1);
|
|
83583
83906
|
async function runMachineRm(args, dependencies = {}) {
|
|
83584
83907
|
const setExitCode = dependencies.setExitCode ?? ((code) => process.exitCode = code);
|
|
83585
83908
|
const machineId = args.machineId?.trim();
|
|
@@ -83593,7 +83916,7 @@ async function runMachineRm(args, dependencies = {}) {
|
|
|
83593
83916
|
if (args.json) {
|
|
83594
83917
|
console.log(JSON.stringify({ id: machineId, torn_down: false, outcome: "declined" }, null, 2));
|
|
83595
83918
|
} else {
|
|
83596
|
-
console.log(` ${
|
|
83919
|
+
console.log(` ${import_picocolors60.default.dim("Left alone.")}`);
|
|
83597
83920
|
}
|
|
83598
83921
|
return;
|
|
83599
83922
|
}
|
|
@@ -83611,7 +83934,7 @@ async function promptForTeardown(args) {
|
|
|
83611
83934
|
return true;
|
|
83612
83935
|
if (!args.json) {
|
|
83613
83936
|
console.log(`
|
|
83614
|
-
${
|
|
83937
|
+
${import_picocolors60.default.red("This destroys the sandbox.")} ${import_picocolors60.default.dim("Anything not committed out of it is lost. The machine row is kept for cost history.")}
|
|
83615
83938
|
`);
|
|
83616
83939
|
}
|
|
83617
83940
|
const answer = await se({
|
|
@@ -83623,9 +83946,9 @@ async function promptForTeardown(args) {
|
|
|
83623
83946
|
function formatMachineRm(machine) {
|
|
83624
83947
|
const lines = [""];
|
|
83625
83948
|
if (machine.destroyed_at) {
|
|
83626
|
-
lines.push(` ${
|
|
83949
|
+
lines.push(` ${import_picocolors60.default.green("✓")} ${machine.kind} sandbox ${machine.id} is torn down.`, ` ${import_picocolors60.default.dim(`destroyed_at ${machine.destroyed_at}`)}`);
|
|
83627
83950
|
} else {
|
|
83628
|
-
lines.push(` ${
|
|
83951
|
+
lines.push(` ${import_picocolors60.default.yellow("!")} ${machine.id} came back without a teardown timestamp (status ${machine.status}).`, ` ${import_picocolors60.default.dim("Re-check with `brainbase machine ls --all` before assuming it stopped billing.")}`);
|
|
83629
83952
|
}
|
|
83630
83953
|
lines.push("");
|
|
83631
83954
|
return lines.join(`
|
|
@@ -83666,28 +83989,28 @@ async function runMachine(sub, args, opts) {
|
|
|
83666
83989
|
function printHelp5() {
|
|
83667
83990
|
const out = [];
|
|
83668
83991
|
out.push("");
|
|
83669
|
-
out.push(` ${
|
|
83992
|
+
out.push(` ${import_picocolors61.default.bold("brainbase machine")} ${import_picocolors61.default.dim("<sub> [options]")}`);
|
|
83670
83993
|
out.push("");
|
|
83671
|
-
out.push(` ${
|
|
83672
|
-
out.push(` ${
|
|
83994
|
+
out.push(` ${import_picocolors61.default.cyan("ls")} ${import_picocolors61.default.dim("list your sandboxes — live ones only unless --all")}`);
|
|
83995
|
+
out.push(` ${import_picocolors61.default.cyan("rm")} ${import_picocolors61.default.dim("<id>")} ${import_picocolors61.default.dim("tear a sandbox down (terminal; the row is kept for cost history)")}`);
|
|
83673
83996
|
out.push("");
|
|
83674
|
-
out.push(` ${
|
|
83675
|
-
out.push(` ${
|
|
83676
|
-
out.push(` ${
|
|
83677
|
-
out.push(` ${
|
|
83997
|
+
out.push(` ${import_picocolors61.default.dim("--all")} ${import_picocolors61.default.dim("for ls: include machines already torn down")}`);
|
|
83998
|
+
out.push(` ${import_picocolors61.default.dim("--limit <n>")} ${import_picocolors61.default.dim("for ls: how many to fetch (1-200, default 50)")}`);
|
|
83999
|
+
out.push(` ${import_picocolors61.default.dim("--yes, -y")} ${import_picocolors61.default.dim("for rm: skip the confirmation")}`);
|
|
84000
|
+
out.push(` ${import_picocolors61.default.dim("--json")} ${import_picocolors61.default.dim("machine-readable output")}`);
|
|
83678
84001
|
out.push("");
|
|
83679
84002
|
console.log(out.join(`
|
|
83680
84003
|
`));
|
|
83681
84004
|
}
|
|
83682
84005
|
|
|
83683
84006
|
// src/cli/interface.ts
|
|
83684
|
-
var
|
|
84007
|
+
var import_picocolors67 = __toESM(require_picocolors(), 1);
|
|
83685
84008
|
|
|
83686
84009
|
// src/cli/interface-build.ts
|
|
83687
|
-
var
|
|
84010
|
+
var import_picocolors63 = __toESM(require_picocolors(), 1);
|
|
83688
84011
|
|
|
83689
84012
|
// src/cli/interface-common.ts
|
|
83690
|
-
var
|
|
84013
|
+
var import_picocolors62 = __toESM(require_picocolors(), 1);
|
|
83691
84014
|
var JSON_FLAG = { key: "json", names: ["--json"], kind: "boolean" };
|
|
83692
84015
|
var YES_FLAG = { key: "yes", names: ["--yes", "-y"], kind: "boolean" };
|
|
83693
84016
|
var KEY_FLAG = {
|
|
@@ -83749,7 +84072,7 @@ function progress(json) {
|
|
|
83749
84072
|
return json ? (line) => console.error(line) : (line) => console.log(line);
|
|
83750
84073
|
}
|
|
83751
84074
|
function field(label, value) {
|
|
83752
|
-
return ` ${
|
|
84075
|
+
return ` ${import_picocolors62.default.dim(label.padEnd(12))}${value}`;
|
|
83753
84076
|
}
|
|
83754
84077
|
function interruption(deps) {
|
|
83755
84078
|
if (deps.signal)
|
|
@@ -83783,7 +84106,7 @@ async function confirmChange(options) {
|
|
|
83783
84106
|
const confirm = options.deps.confirm ?? promptConfirm;
|
|
83784
84107
|
const accepted = await confirm(options.question);
|
|
83785
84108
|
if (!accepted)
|
|
83786
|
-
console.log(` ${
|
|
84109
|
+
console.log(` ${import_picocolors62.default.dim("Left alone.")}`);
|
|
83787
84110
|
return accepted;
|
|
83788
84111
|
}
|
|
83789
84112
|
async function promptConfirm(message) {
|
|
@@ -83925,28 +84248,28 @@ function buildExitCode(outcome) {
|
|
|
83925
84248
|
function reportBuild(say, interfaceId, outcome, timeoutSeconds) {
|
|
83926
84249
|
switch (outcome.kind) {
|
|
83927
84250
|
case "built":
|
|
83928
|
-
say(` ${
|
|
84251
|
+
say(` ${import_picocolors63.default.dim("build")} ${safe(outcome.build.id)} ${import_picocolors63.default.green("succeeded")}`);
|
|
83929
84252
|
say("");
|
|
83930
|
-
say(` ${
|
|
84253
|
+
say(` ${import_picocolors63.default.dim("Next:")} ${import_picocolors63.default.cyan(`brainbase interface publish ${safe(interfaceId)}`)}`);
|
|
83931
84254
|
return;
|
|
83932
84255
|
case "failed": {
|
|
83933
84256
|
const reason = outcome.build?.error_summary ?? outcome.operation?.error ?? outcome.operation?.reason ?? null;
|
|
83934
|
-
say(` ${
|
|
84257
|
+
say(` ${import_picocolors63.default.dim("build")} ${outcome.build ? safe(outcome.build.id) : import_picocolors63.default.dim("none")} ${import_picocolors63.default.red("failed")}`);
|
|
83935
84258
|
if (reason)
|
|
83936
84259
|
say(` ${safeBlock(reason).split(`
|
|
83937
84260
|
`).join(`
|
|
83938
84261
|
`)}`);
|
|
83939
|
-
say(` ${
|
|
84262
|
+
say(` ${import_picocolors63.default.dim("Try again with")} ${import_picocolors63.default.cyan(`brainbase interface rebuild ${safe(interfaceId)}`)}`);
|
|
83940
84263
|
return;
|
|
83941
84264
|
}
|
|
83942
84265
|
case "busy":
|
|
83943
|
-
say(` ${
|
|
84266
|
+
say(` ${import_picocolors63.default.yellow(safe(outcome.message))}`);
|
|
83944
84267
|
return;
|
|
83945
84268
|
case "timeout":
|
|
83946
|
-
say(` ${
|
|
84269
|
+
say(` ${import_picocolors63.default.yellow(`Still building after ${timeoutSeconds}s.`)} ${import_picocolors63.default.dim(`It keeps going; check \`brainbase interface builds ${safe(interfaceId)}\`.`)}`);
|
|
83947
84270
|
return;
|
|
83948
84271
|
case "interrupted":
|
|
83949
|
-
say(` ${
|
|
84272
|
+
say(` ${import_picocolors63.default.yellow("Stopped waiting.")} ${import_picocolors63.default.dim(`The build keeps going; check \`brainbase interface builds ${safe(interfaceId)}\`.`)}`);
|
|
83950
84273
|
return;
|
|
83951
84274
|
default: {
|
|
83952
84275
|
const unreachable = outcome;
|
|
@@ -83993,8 +84316,8 @@ async function build(ctx) {
|
|
|
83993
84316
|
throw held;
|
|
83994
84317
|
}
|
|
83995
84318
|
const reattach = `brainbase task logs ${safe(taskId)} --follow`;
|
|
83996
|
-
say(` ${
|
|
83997
|
-
say(` ${
|
|
84319
|
+
say(` ${import_picocolors63.default.dim("Build conversation")} ${import_picocolors63.default.bold(safe(taskId))} ${import_picocolors63.default.dim(`on ${safe(before2.name)}`)}`);
|
|
84320
|
+
say(` ${import_picocolors63.default.dim(`If this stops early, reattach with \`${reattach}\`.`)}`);
|
|
83998
84321
|
const finish = (result2, exitCode) => {
|
|
83999
84322
|
if (json)
|
|
84000
84323
|
console.log(JSON.stringify({ type: "result", task_id: taskId, ...result2 }));
|
|
@@ -84011,13 +84334,13 @@ async function build(ctx) {
|
|
|
84011
84334
|
});
|
|
84012
84335
|
} catch (error2) {
|
|
84013
84336
|
say("");
|
|
84014
|
-
say(` ${
|
|
84015
|
-
say(` ${
|
|
84337
|
+
say(` ${import_picocolors63.default.red(`Lost the conversation's event stream: ${safe(error2.message)}`)}`);
|
|
84338
|
+
say(` ${import_picocolors63.default.dim(`Conversation ${safe(taskId)} may still be running. Reattach with`)} ${import_picocolors63.default.cyan(reattach)}`);
|
|
84016
84339
|
finish({ version_id: null, build_id: null, status: "stream_lost", task_status: null }, 1);
|
|
84017
84340
|
return;
|
|
84018
84341
|
}
|
|
84019
84342
|
if (followExit !== undefined) {
|
|
84020
|
-
say(` ${
|
|
84343
|
+
say(` ${import_picocolors63.default.yellow("Stopped following.")} ${import_picocolors63.default.dim(`The conversation keeps running. Reattach with \`${reattach}\`.`)}`);
|
|
84021
84344
|
finish({ version_id: null, build_id: null, status: "interrupted", task_status: null }, followExit);
|
|
84022
84345
|
return;
|
|
84023
84346
|
}
|
|
@@ -84032,7 +84355,7 @@ async function build(ctx) {
|
|
|
84032
84355
|
if (settled.kind !== "terminal") {
|
|
84033
84356
|
const interrupted = settled.kind === "interrupted";
|
|
84034
84357
|
const status2 = settled.task?.status ?? null;
|
|
84035
|
-
say(` ${
|
|
84358
|
+
say(` ${import_picocolors63.default.yellow(interrupted ? "Stopped." : `The conversation is still ${safe(status2 ?? "running")}.`)} ${import_picocolors63.default.dim(`Check it with \`brainbase task get ${safe(taskId)}\`.`)}`);
|
|
84036
84359
|
finish({ version_id: null, build_id: null, status: interrupted ? "interrupted" : "task_unsettled", task_status: status2 }, interrupted ? SIGINT_EXIT_CODE : 1);
|
|
84037
84360
|
return;
|
|
84038
84361
|
}
|
|
@@ -84052,36 +84375,36 @@ async function build(ctx) {
|
|
|
84052
84375
|
}
|
|
84053
84376
|
const codes = [exitCodeForTaskStatus(task.status)];
|
|
84054
84377
|
say("");
|
|
84055
|
-
say(` ${
|
|
84378
|
+
say(` ${import_picocolors63.default.dim("conversation")} ${safe(taskId)} ${import_picocolors63.default.dim("ended")} ${safe(task.status)}`);
|
|
84056
84379
|
if (mine?.status === "failed") {
|
|
84057
84380
|
codes.push(1);
|
|
84058
84381
|
const why = [mine.reason, mine.error].filter(Boolean).map((part) => safe(part)).join(": ");
|
|
84059
|
-
say(` ${
|
|
84382
|
+
say(` ${import_picocolors63.default.red(`This conversation's build work failed${why ? ` (${why})` : ""}.`)}`);
|
|
84060
84383
|
} else if (task.status !== "success" && task.status !== "need_more_info") {
|
|
84061
|
-
say(` ${
|
|
84384
|
+
say(` ${import_picocolors63.default.red(`The conversation finished as ${safe(task.status)}.`)} ${import_picocolors63.default.dim(`See \`brainbase task logs ${safe(taskId)}\`.`)}`);
|
|
84062
84385
|
}
|
|
84063
84386
|
if (task.status === "need_more_info") {
|
|
84064
84387
|
const question = await lastAgentMessage(taskId);
|
|
84065
84388
|
say("");
|
|
84066
84389
|
if (question) {
|
|
84067
|
-
say(` ${
|
|
84390
|
+
say(` ${import_picocolors63.default.bold("The agent asks:")}`);
|
|
84068
84391
|
say(` ${safeBlock(question).split(`
|
|
84069
84392
|
`).join(`
|
|
84070
84393
|
`)}`);
|
|
84071
84394
|
} else {
|
|
84072
|
-
say(` ${
|
|
84395
|
+
say(` ${import_picocolors63.default.bold("The agent needs more from you before it can go on.")}`);
|
|
84073
84396
|
}
|
|
84074
84397
|
say("");
|
|
84075
|
-
say(` ${
|
|
84076
|
-
say(` ${
|
|
84398
|
+
say(` ${import_picocolors63.default.dim("Reply with")} ${import_picocolors63.default.cyan(`brainbase task send ${safe(taskId)} "<reply>"`)}`);
|
|
84399
|
+
say(` ${import_picocolors63.default.dim("then follow it with")} ${import_picocolors63.default.cyan(reattach)}`);
|
|
84077
84400
|
}
|
|
84078
84401
|
let status;
|
|
84079
84402
|
let buildId = null;
|
|
84080
84403
|
if (versionId) {
|
|
84081
84404
|
say("");
|
|
84082
|
-
say(` ${
|
|
84405
|
+
say(` ${import_picocolors63.default.dim("version")} ${safe(versionId)}`);
|
|
84083
84406
|
if (!json)
|
|
84084
|
-
say(` ${
|
|
84407
|
+
say(` ${import_picocolors63.default.dim("Waiting for its build...")}`);
|
|
84085
84408
|
const buildKey = `${key2}-build`;
|
|
84086
84409
|
let outcome;
|
|
84087
84410
|
try {
|
|
@@ -84091,7 +84414,7 @@ async function build(ctx) {
|
|
|
84091
84414
|
signal: stop.signal,
|
|
84092
84415
|
now: deps.now,
|
|
84093
84416
|
idempotencyKey: buildKey,
|
|
84094
|
-
onStall: () => say(` ${
|
|
84417
|
+
onStall: () => say(` ${import_picocolors63.default.yellow("The build looks stalled; still waiting in case another worker picks it up.")}`)
|
|
84095
84418
|
});
|
|
84096
84419
|
} catch (error2) {
|
|
84097
84420
|
if (error2 instanceof LostResponseError) {
|
|
@@ -84107,9 +84430,9 @@ async function build(ctx) {
|
|
|
84107
84430
|
status = noVersionStatus(mine?.status === "failed", task.status);
|
|
84108
84431
|
if (status === "no_version") {
|
|
84109
84432
|
codes.push(1);
|
|
84110
|
-
say(` ${
|
|
84433
|
+
say(` ${import_picocolors63.default.red("The conversation finished without committing a version, so there is nothing to build.")}`);
|
|
84111
84434
|
} else if (task.status !== "need_more_info") {
|
|
84112
|
-
say(` ${
|
|
84435
|
+
say(` ${import_picocolors63.default.dim("This conversation produced no version, so there is nothing to build.")}`);
|
|
84113
84436
|
}
|
|
84114
84437
|
}
|
|
84115
84438
|
if (!json)
|
|
@@ -84124,10 +84447,10 @@ async function build(ctx) {
|
|
|
84124
84447
|
var buildCommands = { build };
|
|
84125
84448
|
|
|
84126
84449
|
// src/cli/interface-lifecycle.ts
|
|
84127
|
-
var
|
|
84450
|
+
var import_picocolors65 = __toESM(require_picocolors(), 1);
|
|
84128
84451
|
|
|
84129
84452
|
// src/cli/interface-read.ts
|
|
84130
|
-
var
|
|
84453
|
+
var import_picocolors64 = __toESM(require_picocolors(), 1);
|
|
84131
84454
|
function interfaceState(row) {
|
|
84132
84455
|
if (row.archived_at)
|
|
84133
84456
|
return "archived";
|
|
@@ -84146,11 +84469,11 @@ function threadsLabel(shared) {
|
|
|
84146
84469
|
function stateTint(state) {
|
|
84147
84470
|
switch (state) {
|
|
84148
84471
|
case "live":
|
|
84149
|
-
return
|
|
84472
|
+
return import_picocolors64.default.green;
|
|
84150
84473
|
case "building":
|
|
84151
|
-
return
|
|
84474
|
+
return import_picocolors64.default.yellow;
|
|
84152
84475
|
case "archived":
|
|
84153
|
-
return
|
|
84476
|
+
return import_picocolors64.default.dim;
|
|
84154
84477
|
case "draft":
|
|
84155
84478
|
return (cell) => cell;
|
|
84156
84479
|
default: {
|
|
@@ -84183,7 +84506,7 @@ async function list(ctx) {
|
|
|
84183
84506
|
banner("interface list — dashboards you can see");
|
|
84184
84507
|
if (shown.length === 0) {
|
|
84185
84508
|
console.log(`
|
|
84186
|
-
${
|
|
84509
|
+
${import_picocolors64.default.dim(onlyArchived ? "No archived interfaces." : "No interfaces. Create one with `brainbase interface create`.")}
|
|
84187
84510
|
`);
|
|
84188
84511
|
return;
|
|
84189
84512
|
}
|
|
@@ -84196,7 +84519,7 @@ async function list(ctx) {
|
|
|
84196
84519
|
row.audience_mode === "org" ? "everyone" : "chosen",
|
|
84197
84520
|
ago(row.last_edited_at ?? row.created_at, now2)
|
|
84198
84521
|
]);
|
|
84199
|
-
console.log(["", ...table(cells, [null,
|
|
84522
|
+
console.log(["", ...table(cells, [null, import_picocolors64.default.bold, null, null, null, import_picocolors64.default.dim]), ""].join(`
|
|
84200
84523
|
`));
|
|
84201
84524
|
});
|
|
84202
84525
|
}
|
|
@@ -84217,13 +84540,13 @@ async function get2(ctx) {
|
|
|
84217
84540
|
out.push(field("id", safe(row.id)));
|
|
84218
84541
|
out.push(field("agent", safe(row.agent_id)));
|
|
84219
84542
|
out.push(field("state", stateTint(state)(state)));
|
|
84220
|
-
out.push(field("address", row.live_release ? safe(row.live_release.url) : `${safe(row.slug)} ${
|
|
84543
|
+
out.push(field("address", row.live_release ? safe(row.live_release.url) : `${safe(row.slug)} ${import_picocolors64.default.dim("(nothing live yet)")}`));
|
|
84221
84544
|
out.push(field("audience", audienceLabel(row)));
|
|
84222
84545
|
out.push(field("threads", threadsLabel(row.share_agent_threads)));
|
|
84223
|
-
out.push(field("live", row.live_release ? `${safe(row.live_release.id)} ${
|
|
84224
|
-
out.push(field("draft", row.draft_version_id ? safe(row.draft_version_id) :
|
|
84546
|
+
out.push(field("live", row.live_release ? `${safe(row.live_release.id)} ${import_picocolors64.default.dim(`published ${ago(row.live_release.published_at)}`)}` : import_picocolors64.default.dim("none")));
|
|
84547
|
+
out.push(field("draft", row.draft_version_id ? safe(row.draft_version_id) : import_picocolors64.default.dim("none yet")));
|
|
84225
84548
|
if (row.running_generation) {
|
|
84226
|
-
out.push(field("building", `conversation ${safe(row.running_generation.thread_id ?? "")} ${
|
|
84549
|
+
out.push(field("building", `conversation ${safe(row.running_generation.thread_id ?? "")} ${import_picocolors64.default.dim(`(follow it with \`brainbase task logs ${safe(row.running_generation.thread_id ?? "")} --follow\`)`)}`));
|
|
84227
84550
|
}
|
|
84228
84551
|
if (row.archived_at)
|
|
84229
84552
|
out.push(field("archived", ago(row.archived_at)));
|
|
@@ -84252,7 +84575,7 @@ async function open(ctx) {
|
|
|
84252
84575
|
}
|
|
84253
84576
|
console.log(safe(url2));
|
|
84254
84577
|
if (new URL(url2).hostname.endsWith("vercel.app")) {
|
|
84255
|
-
console.error(
|
|
84578
|
+
console.error(import_picocolors64.default.yellow("This is the raw Vercel deployment address, which sits behind Vercel protection and will not open for viewers. The control plane has no public interfaces domain configured."));
|
|
84256
84579
|
}
|
|
84257
84580
|
});
|
|
84258
84581
|
}
|
|
@@ -84290,7 +84613,7 @@ async function history(ctx, name) {
|
|
|
84290
84613
|
banner(`interface ${name} — ${safe(id)}`);
|
|
84291
84614
|
if (rows.length === 0) {
|
|
84292
84615
|
console.log(`
|
|
84293
|
-
${
|
|
84616
|
+
${import_picocolors64.default.dim(`No ${name} yet.`)}
|
|
84294
84617
|
`);
|
|
84295
84618
|
return;
|
|
84296
84619
|
}
|
|
@@ -84343,7 +84666,7 @@ function exactlyOne(parsed, flags) {
|
|
|
84343
84666
|
}
|
|
84344
84667
|
function peopleLine(access) {
|
|
84345
84668
|
const ids = grantIds(access);
|
|
84346
|
-
return ids.length ? ids.map(safe).join(", ") :
|
|
84669
|
+
return ids.length ? ids.map(safe).join(", ") : import_picocolors65.default.dim("nobody named");
|
|
84347
84670
|
}
|
|
84348
84671
|
function printAccess(row, access) {
|
|
84349
84672
|
console.log([
|
|
@@ -84430,11 +84753,11 @@ async function create3(ctx) {
|
|
|
84430
84753
|
const id = safe(created.id);
|
|
84431
84754
|
const out = [
|
|
84432
84755
|
"",
|
|
84433
|
-
` ${
|
|
84756
|
+
` ${import_picocolors65.default.green("Created")} ${import_picocolors65.default.bold(safe(created.name))}`,
|
|
84434
84757
|
"",
|
|
84435
84758
|
field("id", id),
|
|
84436
84759
|
field("agent", safe(created.agent_id)),
|
|
84437
|
-
field("address", `${safe(created.slug)} ${
|
|
84760
|
+
field("address", `${safe(created.slug)} ${import_picocolors65.default.dim("(nothing live yet)")}`),
|
|
84438
84761
|
field("threads", threadsLabel(created.share_agent_threads))
|
|
84439
84762
|
];
|
|
84440
84763
|
if (access) {
|
|
@@ -84446,11 +84769,11 @@ async function create3(ctx) {
|
|
|
84446
84769
|
out.push("", ` Nobody can open it until you choose who can: \`brainbase interface access ${id} --everyone\` or \`--people <ids>\`.`);
|
|
84447
84770
|
}
|
|
84448
84771
|
if (created.share_agent_threads) {
|
|
84449
|
-
out.push(` ${
|
|
84772
|
+
out.push(` ${import_picocolors65.default.dim(`To show viewers only their own conversations: \`brainbase interface threads ${id} --private\`.`)}`);
|
|
84450
84773
|
}
|
|
84451
84774
|
if (note)
|
|
84452
84775
|
out.push("", ` ${safe(note)}`);
|
|
84453
|
-
out.push("", ` ${
|
|
84776
|
+
out.push("", ` ${import_picocolors65.default.dim(`Next: \`brainbase interface build ${id} "<what to build>"\``)}`, "");
|
|
84454
84777
|
console.log(out.join(`
|
|
84455
84778
|
`));
|
|
84456
84779
|
if (readFailed) {
|
|
@@ -84575,7 +84898,7 @@ async function threads(ctx) {
|
|
|
84575
84898
|
printJson({ id: row.id, share_agent_threads: row.share_agent_threads });
|
|
84576
84899
|
return;
|
|
84577
84900
|
}
|
|
84578
|
-
const already = wanted === null ? "" : ` ${
|
|
84901
|
+
const already = wanted === null ? "" : ` ${import_picocolors65.default.dim("(already set; nothing changed)")}`;
|
|
84579
84902
|
console.log(`
|
|
84580
84903
|
${field("threads", `${threadsLabel(row.share_agent_threads)}${already}`)}
|
|
84581
84904
|
`);
|
|
@@ -84614,7 +84937,7 @@ async function rename(ctx) {
|
|
|
84614
84937
|
return;
|
|
84615
84938
|
}
|
|
84616
84939
|
console.log(`
|
|
84617
|
-
Renamed ${safe(updated.id)} to ${
|
|
84940
|
+
Renamed ${safe(updated.id)} to ${import_picocolors65.default.bold(safe(updated.name))}.
|
|
84618
84941
|
`);
|
|
84619
84942
|
});
|
|
84620
84943
|
}
|
|
@@ -84650,7 +84973,7 @@ async function address(ctx) {
|
|
|
84650
84973
|
}
|
|
84651
84974
|
const where = updated.live_release ? safe(updated.live_release.url) : safe(updated.slug);
|
|
84652
84975
|
console.log(`
|
|
84653
|
-
${safe(updated.name)} is now at ${
|
|
84976
|
+
${safe(updated.name)} is now at ${import_picocolors65.default.bold(where)}.
|
|
84654
84977
|
`);
|
|
84655
84978
|
});
|
|
84656
84979
|
}
|
|
@@ -84742,13 +85065,13 @@ var lifecycleCommands = {
|
|
|
84742
85065
|
};
|
|
84743
85066
|
|
|
84744
85067
|
// src/cli/interface-release.ts
|
|
84745
|
-
var
|
|
85068
|
+
var import_picocolors66 = __toESM(require_picocolors(), 1);
|
|
84746
85069
|
var PUBLISH_TIMEOUT_SECONDS = 300;
|
|
84747
85070
|
var REBUILD_USAGE = "brainbase interface rebuild <id> [--version <version id>]";
|
|
84748
85071
|
var PUBLISH_USAGE = "brainbase interface publish <id> [--build <build id>]";
|
|
84749
85072
|
var ROLLBACK_USAGE = "brainbase interface rollback <id> --release <release id>";
|
|
84750
85073
|
function warn(line) {
|
|
84751
|
-
console.error(
|
|
85074
|
+
console.error(import_picocolors66.default.yellow(line));
|
|
84752
85075
|
}
|
|
84753
85076
|
function text3(value) {
|
|
84754
85077
|
return typeof value === "string" && value.trim() ? value : null;
|
|
@@ -84765,7 +85088,7 @@ async function follow(operationId, what, options) {
|
|
|
84765
85088
|
intervalMs: options.deps.pollIntervalMs,
|
|
84766
85089
|
signal: stop.signal,
|
|
84767
85090
|
now: options.deps.now,
|
|
84768
|
-
onStatus: (operation) => say(
|
|
85091
|
+
onStatus: (operation) => say(import_picocolors66.default.dim(` ${what} ${operation.status}`)),
|
|
84769
85092
|
onStall: () => warn(`The ${what} looks stalled: its worker stopped checking in. Still waiting, in case another worker picks it up.`)
|
|
84770
85093
|
});
|
|
84771
85094
|
if (outcome.kind === "settled") {
|
|
@@ -84784,7 +85107,7 @@ function reportUnsuccessful(result2, what, options) {
|
|
|
84784
85107
|
if (options.json) {
|
|
84785
85108
|
printJson({ outcome: result2.outcome, operation_id: result2.operationId, operation: result2.operation });
|
|
84786
85109
|
} else if (result2.outcome === "failed") {
|
|
84787
|
-
console.error(
|
|
85110
|
+
console.error(import_picocolors66.default.red(`The ${what} failed (operation ${id}):`));
|
|
84788
85111
|
console.error(safeBlock(result2.operation?.error ?? "Brainbase gave no reason."));
|
|
84789
85112
|
} else if (result2.outcome === "timeout") {
|
|
84790
85113
|
warn(`Stopped waiting after ${Math.round(options.timeoutMs / 1000)}s. The ${what} keeps running on the server (operation ${id}).`);
|
|
@@ -84843,7 +85166,7 @@ async function rebuild(ctx) {
|
|
|
84843
85166
|
if (json)
|
|
84844
85167
|
printJson({ outcome: "started", operation_id: operationId, operation });
|
|
84845
85168
|
else
|
|
84846
|
-
console.log(
|
|
85169
|
+
console.log(import_picocolors66.default.dim(` Follow it with \`brainbase interface builds ${safe(id)}\`.`));
|
|
84847
85170
|
return;
|
|
84848
85171
|
}
|
|
84849
85172
|
const result2 = await follow(operationId, "build", { json, timeoutMs: waitMs, deps: ctx.deps });
|
|
@@ -84855,8 +85178,8 @@ async function rebuild(ctx) {
|
|
|
84855
85178
|
}
|
|
84856
85179
|
const buildId = safe(result2.operation?.build_id ?? "");
|
|
84857
85180
|
const version2 = safe(result2.operation?.source_version_id ?? "");
|
|
84858
|
-
console.log(
|
|
84859
|
-
console.log(
|
|
85181
|
+
console.log(import_picocolors66.default.green(`✓ Build ${buildId} succeeded${version2 ? ` (version ${version2})` : ""}.`));
|
|
85182
|
+
console.log(import_picocolors66.default.dim(` Publish it with \`brainbase interface publish ${safe(id)} --build ${buildId}\`.`));
|
|
84860
85183
|
});
|
|
84861
85184
|
}
|
|
84862
85185
|
function liveBuildOf(row, releases) {
|
|
@@ -84914,7 +85237,7 @@ function describeBuild(buildId, builds) {
|
|
|
84914
85237
|
const build2 = builds.find((candidate) => candidate.id === buildId);
|
|
84915
85238
|
if (!build2)
|
|
84916
85239
|
return `build ${safe(buildId)}`;
|
|
84917
|
-
return `build ${safe(build2.id)} ${
|
|
85240
|
+
return `build ${safe(build2.id)} ${import_picocolors66.default.dim(`(version ${safe(build2.source_version_id)}, built ${ago(build2.created_at)})`)}`;
|
|
84918
85241
|
}
|
|
84919
85242
|
function reportAlreadyLive(json, buildId, releaseId, url2) {
|
|
84920
85243
|
if (json) {
|
|
@@ -84968,8 +85291,8 @@ async function publish(ctx) {
|
|
|
84968
85291
|
}
|
|
84969
85292
|
if (!json) {
|
|
84970
85293
|
console.log("");
|
|
84971
|
-
console.log(` ${
|
|
84972
|
-
console.log(` ${
|
|
85294
|
+
console.log(` ${import_picocolors66.default.dim("Live now".padEnd(14))}${liveBuildId ? `${describeBuild(liveBuildId, builds)} at ${safe(row.live_release?.url)}` : row.live_release ? `release ${safe(row.live_release.id)} at ${safe(row.live_release.url)}` : import_picocolors66.default.dim("nothing")}`);
|
|
85295
|
+
console.log(` ${import_picocolors66.default.dim("Will publish".padEnd(14))}${describeBuild(buildId, builds)}`);
|
|
84973
85296
|
console.log("");
|
|
84974
85297
|
}
|
|
84975
85298
|
const proceed = await confirmChange({
|
|
@@ -85012,7 +85335,7 @@ async function publish(ctx) {
|
|
|
85012
85335
|
if (json)
|
|
85013
85336
|
printJson({ outcome: "started", operation_id: operationId, operation });
|
|
85014
85337
|
else
|
|
85015
|
-
console.log(
|
|
85338
|
+
console.log(import_picocolors66.default.dim(` Check it with \`brainbase interface get ${safe(id)}\`.`));
|
|
85016
85339
|
return;
|
|
85017
85340
|
}
|
|
85018
85341
|
const result2 = await follow(operationId, "publish", { json, timeoutMs: waitMs, deps: ctx.deps });
|
|
@@ -85029,11 +85352,11 @@ async function publish(ctx) {
|
|
|
85029
85352
|
printJson({ outcome: "succeeded", operation_id: operationId, operation: result2.operation, url: url2 });
|
|
85030
85353
|
return;
|
|
85031
85354
|
}
|
|
85032
|
-
console.log(
|
|
85355
|
+
console.log(import_picocolors66.default.green(`✓ Build ${safe(buildId)} is live.`));
|
|
85033
85356
|
if (url2)
|
|
85034
85357
|
console.log(` ${safe(url2)}`);
|
|
85035
85358
|
if (urlUnread) {
|
|
85036
|
-
console.log(
|
|
85359
|
+
console.log(import_picocolors66.default.dim(` Its address could not be read just now; see it with \`brainbase interface open ${safe(id)}\`.`));
|
|
85037
85360
|
}
|
|
85038
85361
|
});
|
|
85039
85362
|
}
|
|
@@ -85069,8 +85392,8 @@ async function rollback(ctx) {
|
|
|
85069
85392
|
}
|
|
85070
85393
|
if (!json) {
|
|
85071
85394
|
console.log("");
|
|
85072
|
-
console.log(` ${
|
|
85073
|
-
console.log(` ${
|
|
85395
|
+
console.log(` ${import_picocolors66.default.dim("Live now".padEnd(20))}release ${safe(row.live_release.id)} at ${safe(row.live_release.url)}`);
|
|
85396
|
+
console.log(` ${import_picocolors66.default.dim("Will be live again".padEnd(20))}release ${safe(releaseId)}`);
|
|
85074
85397
|
console.log("");
|
|
85075
85398
|
}
|
|
85076
85399
|
const proceed = await confirmChange({
|
|
@@ -85103,7 +85426,7 @@ async function rollback(ctx) {
|
|
|
85103
85426
|
printJson(release);
|
|
85104
85427
|
return;
|
|
85105
85428
|
}
|
|
85106
|
-
console.log(
|
|
85429
|
+
console.log(import_picocolors66.default.green(`✓ Release ${safe(release.id)} is live again (build ${safe(release.build_id)}).`));
|
|
85107
85430
|
console.log(` ${safe(release.url)}`);
|
|
85108
85431
|
});
|
|
85109
85432
|
}
|
|
@@ -85137,14 +85460,14 @@ async function runInterface(cwd2, sub, args, deps = {}) {
|
|
|
85137
85460
|
await command({ cwd: cwd2, args, deps });
|
|
85138
85461
|
}
|
|
85139
85462
|
function line(command, args, description) {
|
|
85140
|
-
return ` ${
|
|
85141
|
-
${
|
|
85463
|
+
return ` ${import_picocolors67.default.cyan(command)}${args ? ` ${import_picocolors67.default.dim(args)}` : ""}
|
|
85464
|
+
${import_picocolors67.default.dim(description)}`;
|
|
85142
85465
|
}
|
|
85143
85466
|
function printHelp6() {
|
|
85144
85467
|
const out = [];
|
|
85145
85468
|
out.push("");
|
|
85146
|
-
out.push(` ${
|
|
85147
|
-
out.push(` ${
|
|
85469
|
+
out.push(` ${import_picocolors67.default.bold("brainbase interface")} ${import_picocolors67.default.dim("<sub> [options]")}`);
|
|
85470
|
+
out.push(` ${import_picocolors67.default.dim("Dashboards for an agent: build them in a conversation, publish them, choose who can open them.")}`);
|
|
85148
85471
|
out.push("");
|
|
85149
85472
|
out.push(line("ls", "[--agent <id>] [--archived | --only-archived]", "list interfaces you can see"));
|
|
85150
85473
|
out.push(line("get", "<id>", "one interface: address, audience, live release, draft, running build conversation"));
|
|
@@ -85163,14 +85486,14 @@ function printHelp6() {
|
|
|
85163
85486
|
out.push(line("publish", "<id> [--build <id>]", "make a build live (default: the newest succeeded build)"));
|
|
85164
85487
|
out.push(line("rollback", "<id> --release <id>", "make an earlier release live again"));
|
|
85165
85488
|
out.push("");
|
|
85166
|
-
out.push(` ${
|
|
85167
|
-
out.push(` ${
|
|
85168
|
-
out.push(` ${
|
|
85169
|
-
out.push(` ${
|
|
85170
|
-
out.push(` ${
|
|
85489
|
+
out.push(` ${import_picocolors67.default.dim("--json")} machine-readable output; never prompts`);
|
|
85490
|
+
out.push(` ${import_picocolors67.default.dim("--yes, -y")} skip confirmation (required without a terminal)`);
|
|
85491
|
+
out.push(` ${import_picocolors67.default.dim("--no-wait")} for rebuild and publish: return the operation at once`);
|
|
85492
|
+
out.push(` ${import_picocolors67.default.dim("--timeout <seconds>")} for build, rebuild and publish: how long to wait (builds 900, publish 300)`);
|
|
85493
|
+
out.push(` ${import_picocolors67.default.dim("--idempotency-key <key>")} replay a create, build, rebuild, publish or rollback whose answer was lost`);
|
|
85171
85494
|
out.push("");
|
|
85172
|
-
out.push(` ${
|
|
85173
|
-
out.push(` ${
|
|
85495
|
+
out.push(` ${import_picocolors67.default.dim("People are user ids, or `me`. Audience members also need access to the agent.")}`);
|
|
85496
|
+
out.push(` ${import_picocolors67.default.dim("Exit codes: 0 done, 1 refused or failed, 130 interrupted (the server keeps working).")}`);
|
|
85174
85497
|
out.push("");
|
|
85175
85498
|
console.log(out.join(`
|
|
85176
85499
|
`));
|
|
@@ -88263,7 +88586,7 @@ async function runBenchmarkPhase(specPathInput, resultPathInput, expectedPhase,
|
|
|
88263
88586
|
}
|
|
88264
88587
|
|
|
88265
88588
|
// src/cli/benchmark-control.ts
|
|
88266
|
-
var
|
|
88589
|
+
var import_picocolors68 = __toESM(require_picocolors(), 1);
|
|
88267
88590
|
import fs89 from "node:fs";
|
|
88268
88591
|
import path101 from "node:path";
|
|
88269
88592
|
|
|
@@ -91277,20 +91600,20 @@ async function emitCursorPages(output, fetchPage, options) {
|
|
|
91277
91600
|
function commandHelp() {
|
|
91278
91601
|
return [
|
|
91279
91602
|
"",
|
|
91280
|
-
` ${
|
|
91603
|
+
` ${import_picocolors68.default.bold("brainbase benchmark")} ${import_picocolors68.default.dim("<command> [options]")}`,
|
|
91281
91604
|
"",
|
|
91282
|
-
` ${
|
|
91283
|
-
` ${
|
|
91284
|
-
` ${
|
|
91285
|
-
` ${
|
|
91286
|
-
` ${
|
|
91605
|
+
` ${import_picocolors68.default.cyan("init | list | show | create | validate | pull | push")}`,
|
|
91606
|
+
` ${import_picocolors68.default.cyan("publish | revisions | import | export | archive | restore")}`,
|
|
91607
|
+
` ${import_picocolors68.default.cyan("run plan|start|watch|list|show|cancel|resume")}`,
|
|
91608
|
+
` ${import_picocolors68.default.cyan("results | diagnoses | attempt | artifacts | export-results")}`,
|
|
91609
|
+
` ${import_picocolors68.default.cyan("history | baseline show|set|clear")}`,
|
|
91287
91610
|
"",
|
|
91288
|
-
` ${
|
|
91611
|
+
` ${import_picocolors68.default.dim("Use --agent to override brainbase.agent.yaml, and --json or --jsonl for automation.")}`,
|
|
91289
91612
|
"",
|
|
91290
|
-
` ${
|
|
91291
|
-
` ${
|
|
91292
|
-
` ${
|
|
91293
|
-
` ${
|
|
91613
|
+
` ${import_picocolors68.default.bold("benchmark runtime (machine-only)")}`,
|
|
91614
|
+
` ${import_picocolors68.default.cyan("hydrate")} ${import_picocolors68.default.dim("--spec <path> --result <path> --json")}`,
|
|
91615
|
+
` ${import_picocolors68.default.cyan("evaluate")} ${import_picocolors68.default.dim("--spec <path> --result <path> --json")}`,
|
|
91616
|
+
` ${import_picocolors68.default.cyan("capabilities")} ${import_picocolors68.default.dim("--json")}`,
|
|
91294
91617
|
""
|
|
91295
91618
|
].join(`
|
|
91296
91619
|
`);
|
|
@@ -92709,178 +93032,181 @@ var SUBCOMMAND_OWNED_FLAGS = {
|
|
|
92709
93032
|
function help() {
|
|
92710
93033
|
const out = [];
|
|
92711
93034
|
out.push("");
|
|
92712
|
-
out.push(` ${brandTint("◆")} ${
|
|
92713
|
-
out.push(` ${
|
|
93035
|
+
out.push(` ${brandTint("◆")} ${import_picocolors69.default.bold("brainbase")} ${import_picocolors69.default.dim(`v${VERSION}`)}`);
|
|
93036
|
+
out.push(` ${import_picocolors69.default.dim("connect your local agent to the brainbase platform")}`);
|
|
92714
93037
|
out.push("");
|
|
92715
93038
|
out.push(divider("USAGE"));
|
|
92716
93039
|
out.push("");
|
|
92717
|
-
out.push(` ${
|
|
93040
|
+
out.push(` ${import_picocolors69.default.bold("brainbase")} ${import_picocolors69.default.dim("<command> [options]")}`);
|
|
92718
93041
|
out.push("");
|
|
92719
93042
|
out.push(divider("AUTH"));
|
|
92720
93043
|
out.push("");
|
|
92721
|
-
out.push(` ${
|
|
92722
|
-
out.push(` ${
|
|
92723
|
-
out.push(` ${
|
|
93044
|
+
out.push(` ${import_picocolors69.default.cyan("login")} ${import_picocolors69.default.dim(" open the web app and connect this device")}`);
|
|
93045
|
+
out.push(` ${import_picocolors69.default.cyan("logout")} ${import_picocolors69.default.dim(" clear the local session")}`);
|
|
93046
|
+
out.push(` ${import_picocolors69.default.cyan("whoami")} ${import_picocolors69.default.dim("[--json]")} ${import_picocolors69.default.dim(" show which credential is in use and what it covers")}`);
|
|
92724
93047
|
out.push("");
|
|
92725
93048
|
out.push(divider("DISCOVERY"));
|
|
92726
93049
|
out.push("");
|
|
92727
|
-
out.push(` ${
|
|
92728
|
-
out.push(` ${
|
|
93050
|
+
out.push(` ${import_picocolors69.default.cyan("team list")} ${import_picocolors69.default.dim("show the teams you can create agents in")}`);
|
|
93051
|
+
out.push(` ${import_picocolors69.default.cyan("agent list")} ${import_picocolors69.default.dim("show a team's agents and their ids")}`);
|
|
92729
93052
|
out.push("");
|
|
92730
93053
|
out.push(divider("LINKED AGENT"));
|
|
92731
93054
|
out.push("");
|
|
92732
|
-
out.push(` ${
|
|
92733
|
-
out.push(` ${
|
|
92734
|
-
out.push(` ${
|
|
92735
|
-
out.push(` ${
|
|
92736
|
-
out.push(` ${
|
|
92737
|
-
out.push(` ${
|
|
92738
|
-
out.push(` ${
|
|
92739
|
-
out.push(` ${
|
|
92740
|
-
out.push(` ${
|
|
92741
|
-
out.push(` ${
|
|
92742
|
-
out.push(` ${
|
|
92743
|
-
out.push(` ${
|
|
92744
|
-
out.push(` ${
|
|
92745
|
-
out.push(` ${
|
|
92746
|
-
out.push(` ${
|
|
93055
|
+
out.push(` ${import_picocolors69.default.cyan("agent init")} ${import_picocolors69.default.dim("write a starter brainbase.agent.yaml here — offline, no login needed")}`);
|
|
93056
|
+
out.push(` ${import_picocolors69.default.cyan("agent create")} ${import_picocolors69.default.dim("claim an unclaimed brainbase.agent.yaml and create the cloud agent")}`);
|
|
93057
|
+
out.push(` ${import_picocolors69.default.cyan("agent pull")} ${import_picocolors69.default.dim("[<id>]")} ${import_picocolors69.default.dim("bring cloud changes into this folder (--force to override; --run-entrypoint to also execute the agent entrypoint; --link to link first)")}`);
|
|
93058
|
+
out.push(` ${import_picocolors69.default.cyan("agent push")} ${import_picocolors69.default.dim("send local changes to the cloud (--force to overwrite cloud-side conflicts with local)")}`);
|
|
93059
|
+
out.push(` ${import_picocolors69.default.cyan("agent delete")} ${import_picocolors69.default.dim("<id>")} ${import_picocolors69.default.dim("permanently delete a cloud agent and every task it has run")}`);
|
|
93060
|
+
out.push(` ${import_picocolors69.default.cyan("agent unpack")} ${import_picocolors69.default.dim("install the claimed agent into a harness layout")}`);
|
|
93061
|
+
out.push(` ${import_picocolors69.default.cyan("link")} ${import_picocolors69.default.dim("attach this folder to an existing agent")}`);
|
|
93062
|
+
out.push(` ${import_picocolors69.default.cyan("agent status")} ${import_picocolors69.default.dim("show what would pull and what would push")}`);
|
|
93063
|
+
out.push(` ${import_picocolors69.default.cyan("agent connections")} ${import_picocolors69.default.dim("show which integrations this agent is wired to (--json for CI)")}`);
|
|
93064
|
+
out.push(` ${import_picocolors69.default.cyan("agent connect")} ${import_picocolors69.default.dim("<name>")} ${import_picocolors69.default.dim("connect slack or meeting from the terminal")}`);
|
|
93065
|
+
out.push(` ${import_picocolors69.default.cyan("agent disconnect")} ${import_picocolors69.default.dim("<name>")} ${import_picocolors69.default.dim("revoke a slack or meeting install")}`);
|
|
93066
|
+
out.push(` ${import_picocolors69.default.cyan("agent env")} ${import_picocolors69.default.dim("print export lines for `eval $(brainbase agent env)`")}`);
|
|
93067
|
+
out.push(` ${import_picocolors69.default.cyan("run")} ${import_picocolors69.default.dim("<cmd> [args...]")} ${import_picocolors69.default.dim("run <cmd> with secrets.env loaded into env")}`);
|
|
93068
|
+
out.push(` ${import_picocolors69.default.cyan("status")} ${import_picocolors69.default.dim("show what this folder is linked to")}`);
|
|
93069
|
+
out.push(` ${import_picocolors69.default.cyan("unlink")} ${import_picocolors69.default.dim("disconnect this folder")}`);
|
|
92747
93070
|
out.push("");
|
|
92748
93071
|
out.push(divider("TASKS"));
|
|
92749
93072
|
out.push("");
|
|
92750
|
-
out.push(` ${
|
|
92751
|
-
out.push(` ${
|
|
92752
|
-
out.push(` ${
|
|
92753
|
-
out.push(` ${
|
|
92754
|
-
out.push(` ${
|
|
92755
|
-
out.push(` ${
|
|
92756
|
-
out.push(` ${
|
|
93073
|
+
out.push(` ${import_picocolors69.default.cyan("task create")} ${import_picocolors69.default.dim("--message <text>")} ${import_picocolors69.default.dim("create a managed task and start its first run (--wait to block on it; --interface <id> for a build conversation)")}`);
|
|
93074
|
+
out.push(` ${import_picocolors69.default.cyan("task list")} ${import_picocolors69.default.dim("recent tasks you can reach (--interface <id> for its build conversations)")}`);
|
|
93075
|
+
out.push(` ${import_picocolors69.default.cyan("task get")} ${import_picocolors69.default.dim("<task-id>")} ${import_picocolors69.default.dim("one task: status, agent, machine, eval verdicts")}`);
|
|
93076
|
+
out.push(` ${import_picocolors69.default.cyan("task logs")} ${import_picocolors69.default.dim("<task-id> [--follow]")} ${import_picocolors69.default.dim("one line per event in the task's transcript, or tail it live")}`);
|
|
93077
|
+
out.push(` ${import_picocolors69.default.cyan("task send")} ${import_picocolors69.default.dim("<task-id> <message>")} ${import_picocolors69.default.dim("send a follow-up during execution, or queue it for the next turn")}`);
|
|
93078
|
+
out.push(` ${import_picocolors69.default.cyan("task stop")} ${import_picocolors69.default.dim("<task-id>")} ${import_picocolors69.default.dim("stop execution and cancel pending follow-ups, retaining their text")}`);
|
|
93079
|
+
out.push(` ${import_picocolors69.default.cyan("task delete")} ${import_picocolors69.default.dim("<task-id>")} ${import_picocolors69.default.dim("permanently delete a stopped task and tear down its sandbox")}`);
|
|
92757
93080
|
out.push("");
|
|
92758
93081
|
out.push(divider("INTERFACES"));
|
|
92759
93082
|
out.push("");
|
|
92760
|
-
out.push(` ${
|
|
92761
|
-
out.push(` ${
|
|
92762
|
-
out.push(` ${
|
|
92763
|
-
out.push(` ${
|
|
92764
|
-
out.push(` ${
|
|
92765
|
-
out.push(` ${
|
|
92766
|
-
out.push(` ${
|
|
93083
|
+
out.push(` ${import_picocolors69.default.cyan("interface ls")} ${import_picocolors69.default.dim("dashboards you can see (--agent to narrow)")}`);
|
|
93084
|
+
out.push(` ${import_picocolors69.default.cyan("interface create")} ${import_picocolors69.default.dim("--name <n>")} ${import_picocolors69.default.dim("create one on an agent, with who can open it")}`);
|
|
93085
|
+
out.push(` ${import_picocolors69.default.cyan("interface build")} ${import_picocolors69.default.dim('<id> "<ask>"')} ${import_picocolors69.default.dim("describe a change; the agent builds it while you watch")}`);
|
|
93086
|
+
out.push(` ${import_picocolors69.default.cyan("interface publish")} ${import_picocolors69.default.dim("<id>")} ${import_picocolors69.default.dim("make the newest succeeded build live")}`);
|
|
93087
|
+
out.push(` ${import_picocolors69.default.cyan("interface rollback")} ${import_picocolors69.default.dim("<id>")} ${import_picocolors69.default.dim("make an earlier release live again (--release <id>)")}`);
|
|
93088
|
+
out.push(` ${import_picocolors69.default.cyan("interface access")} ${import_picocolors69.default.dim("<id>")} ${import_picocolors69.default.dim("show or set who can open it")}`);
|
|
93089
|
+
out.push(` ${import_picocolors69.default.cyan("interface --help")} ${import_picocolors69.default.dim("every interface subcommand")}`);
|
|
92767
93090
|
out.push("");
|
|
92768
93091
|
out.push(divider("SANDBOXES"));
|
|
92769
93092
|
out.push("");
|
|
92770
|
-
out.push(` ${
|
|
92771
|
-
out.push(` ${
|
|
93093
|
+
out.push(` ${import_picocolors69.default.cyan("machine ls")} ${import_picocolors69.default.dim("[--all]")} ${import_picocolors69.default.dim("list your sandboxes — live ones only unless --all")}`);
|
|
93094
|
+
out.push(` ${import_picocolors69.default.cyan("machine rm")} ${import_picocolors69.default.dim("<id>")} ${import_picocolors69.default.dim("tear a sandbox down (it bills until you do)")}`);
|
|
92772
93095
|
out.push("");
|
|
92773
93096
|
out.push(divider("BENCHMARKS"));
|
|
92774
93097
|
out.push("");
|
|
92775
|
-
out.push(` ${
|
|
92776
|
-
out.push(` ${
|
|
92777
|
-
out.push(` ${
|
|
92778
|
-
out.push(` ${
|
|
92779
|
-
out.push(` ${
|
|
93098
|
+
out.push(` ${import_picocolors69.default.cyan("benchmark list")} ${import_picocolors69.default.dim("list benchmarks for the linked agent")}`);
|
|
93099
|
+
out.push(` ${import_picocolors69.default.cyan("benchmark init")} ${import_picocolors69.default.dim("[directory]")} ${import_picocolors69.default.dim("scaffold a local benchmark")}`);
|
|
93100
|
+
out.push(` ${import_picocolors69.default.cyan("benchmark create")} ${import_picocolors69.default.dim("[path|-]")} ${import_picocolors69.default.dim("create a benchmark draft")}`);
|
|
93101
|
+
out.push(` ${import_picocolors69.default.cyan("benchmark run")} ${import_picocolors69.default.dim("<benchmark> --yes")} ${import_picocolors69.default.dim("plan and start a benchmark run")}`);
|
|
93102
|
+
out.push(` ${import_picocolors69.default.cyan("benchmark results")} ${import_picocolors69.default.dim("<run>")} ${import_picocolors69.default.dim("inspect normalized benchmark results")}`);
|
|
92780
93103
|
out.push("");
|
|
92781
93104
|
out.push(divider("BENCHMARK RUNTIME"));
|
|
92782
93105
|
out.push("");
|
|
92783
|
-
out.push(` ${
|
|
92784
|
-
out.push(` ${
|
|
92785
|
-
out.push(` ${
|
|
93106
|
+
out.push(` ${import_picocolors69.default.cyan("benchmark hydrate")} ${import_picocolors69.default.dim("--spec <path> --result <path> --json")}`);
|
|
93107
|
+
out.push(` ${import_picocolors69.default.cyan("benchmark evaluate")} ${import_picocolors69.default.dim("--spec <path> --result <path> --json")}`);
|
|
93108
|
+
out.push(` ${import_picocolors69.default.cyan("benchmark capabilities")} ${import_picocolors69.default.dim("--json")}`);
|
|
92786
93109
|
out.push("");
|
|
92787
93110
|
out.push(divider("ORCHESTRATIONS"));
|
|
92788
93111
|
out.push("");
|
|
92789
|
-
out.push(` ${
|
|
92790
|
-
out.push(` ${
|
|
92791
|
-
out.push(` ${
|
|
92792
|
-
out.push(` ${
|
|
92793
|
-
out.push(` ${
|
|
92794
|
-
out.push(` ${
|
|
93112
|
+
out.push(` ${import_picocolors69.default.cyan("orchestration create")} ${import_picocolors69.default.dim("claim a local orchestration manifest and create it in the cloud")}`);
|
|
93113
|
+
out.push(` ${import_picocolors69.default.cyan("orchestration list")} ${import_picocolors69.default.dim("list orchestrations under a team")}`);
|
|
93114
|
+
out.push(` ${import_picocolors69.default.cyan("orchestration pull")} ${import_picocolors69.default.dim("<id>")} ${import_picocolors69.default.dim("recursively fetch an orchestration + every member agent")}`);
|
|
93115
|
+
out.push(` ${import_picocolors69.default.cyan("orchestration push")} ${import_picocolors69.default.dim("recursively push each member, then update the graph")}`);
|
|
93116
|
+
out.push(` ${import_picocolors69.default.cyan("orchestration status")} ${import_picocolors69.default.dim("show what would push and what would pull")}`);
|
|
93117
|
+
out.push(` ${import_picocolors69.default.cyan("orchestration delete")} ${import_picocolors69.default.dim("<id>")} ${import_picocolors69.default.dim("permanently delete an orchestration graph (member agents are kept)")}`);
|
|
92795
93118
|
out.push("");
|
|
92796
93119
|
out.push(divider("TEMPLATES"));
|
|
92797
93120
|
out.push("");
|
|
92798
|
-
out.push(` ${
|
|
92799
|
-
out.push(` ${
|
|
92800
|
-
out.push(` ${
|
|
92801
|
-
out.push(` ${
|
|
92802
|
-
out.push(` ${
|
|
92803
|
-
out.push(` ${
|
|
92804
|
-
out.push(` ${
|
|
93121
|
+
out.push(` ${import_picocolors69.default.cyan("template pack")} ${import_picocolors69.default.dim("bundle the current agent into a template")}`);
|
|
93122
|
+
out.push(` ${import_picocolors69.default.cyan("template publish")} ${import_picocolors69.default.dim("upload a template to the registry")}`);
|
|
93123
|
+
out.push(` ${import_picocolors69.default.cyan("template search")} ${import_picocolors69.default.dim("[query]")} ${import_picocolors69.default.dim("search the registry")}`);
|
|
93124
|
+
out.push(` ${import_picocolors69.default.cyan("template info")} ${import_picocolors69.default.dim("<creator/slug>")} ${import_picocolors69.default.dim("show registry details for a template")}`);
|
|
93125
|
+
out.push(` ${import_picocolors69.default.cyan("template onboard")} ${import_picocolors69.default.dim("<creator/slug>")} ${import_picocolors69.default.dim("install (or refresh) a template")}`);
|
|
93126
|
+
out.push(` ${import_picocolors69.default.cyan("template list")} ${import_picocolors69.default.dim("show installed templates")}`);
|
|
93127
|
+
out.push(` ${import_picocolors69.default.cyan("template remove")} ${import_picocolors69.default.dim("<creator/slug>")} ${import_picocolors69.default.dim("uninstall a template")}`);
|
|
92805
93128
|
out.push("");
|
|
92806
93129
|
out.push(divider("SKILLS"));
|
|
92807
93130
|
out.push("");
|
|
92808
|
-
out.push(` ${
|
|
92809
|
-
out.push(` ${
|
|
92810
|
-
out.push(` ${
|
|
92811
|
-
out.push(` ${
|
|
92812
|
-
out.push(` ${
|
|
92813
|
-
out.push(` ${
|
|
92814
|
-
out.push(` ${
|
|
93131
|
+
out.push(` ${import_picocolors69.default.cyan("skill add")} ${import_picocolors69.default.dim("<source>")} ${import_picocolors69.default.dim("install a skill (github / git / brainbase)")}`);
|
|
93132
|
+
out.push(` ${import_picocolors69.default.cyan("skill list")} ${import_picocolors69.default.dim("show locally installed skills + their source")}`);
|
|
93133
|
+
out.push(` ${import_picocolors69.default.cyan("skill update")} ${import_picocolors69.default.dim("<slug>")} ${import_picocolors69.default.dim("re-fetch a skill from its recorded source")}`);
|
|
93134
|
+
out.push(` ${import_picocolors69.default.cyan("skill remove")} ${import_picocolors69.default.dim("<slug>")} ${import_picocolors69.default.dim("uninstall a skill")}`);
|
|
93135
|
+
out.push(` ${import_picocolors69.default.cyan("skill search")} ${import_picocolors69.default.dim("[query]")} ${import_picocolors69.default.dim("search the brainbase skill registry")}`);
|
|
93136
|
+
out.push(` ${import_picocolors69.default.cyan("skill info")} ${import_picocolors69.default.dim("<creator/slug>")} ${import_picocolors69.default.dim("show registry details for a skill")}`);
|
|
93137
|
+
out.push(` ${import_picocolors69.default.cyan("skill publish")} ${import_picocolors69.default.dim("[dir]")} ${import_picocolors69.default.dim("publish a SKILL.md folder (defaults to .)")}`);
|
|
92815
93138
|
out.push("");
|
|
92816
93139
|
out.push(divider("CLI TOKENS"));
|
|
92817
93140
|
out.push("");
|
|
92818
|
-
out.push(` ${
|
|
92819
|
-
out.push(` ${
|
|
92820
|
-
out.push(` ${
|
|
92821
|
-
out.push(` ${
|
|
93141
|
+
out.push(` ${import_picocolors69.default.cyan("token create")} ${import_picocolors69.default.dim("issue a long-lived CLI key for CI / scripts")}`);
|
|
93142
|
+
out.push(` ${import_picocolors69.default.cyan("token list")} ${import_picocolors69.default.dim("show your tokens")}`);
|
|
93143
|
+
out.push(` ${import_picocolors69.default.cyan("token rename")} ${import_picocolors69.default.dim("<id>")} ${import_picocolors69.default.dim("relabel a token")}`);
|
|
93144
|
+
out.push(` ${import_picocolors69.default.cyan("token revoke")} ${import_picocolors69.default.dim("<id>")} ${import_picocolors69.default.dim("revoke a token")}`);
|
|
92822
93145
|
out.push("");
|
|
92823
93146
|
out.push(divider("MCP"));
|
|
92824
93147
|
out.push("");
|
|
92825
|
-
out.push(` ${
|
|
92826
|
-
out.push(` ${
|
|
93148
|
+
out.push(` ${import_picocolors69.default.cyan("mcp check")} ${import_picocolors69.default.dim("[--json]")} ${import_picocolors69.default.dim("verify MCP server connectivity through the brainbase proxy (runs at sandbox bootstrap)")}`);
|
|
93149
|
+
out.push(` ${import_picocolors69.default.cyan("mcp list")} ${import_picocolors69.default.dim("[--json]")} ${import_picocolors69.default.dim("show configured servers with OAuth state and expiry")}`);
|
|
93150
|
+
out.push(` ${import_picocolors69.default.cyan("mcp connect")} ${import_picocolors69.default.dim("<name>")} ${import_picocolors69.default.dim("authorize an OAuth-backed server: prints a single-use link, opens it, waits for approval")}`);
|
|
92827
93151
|
out.push("");
|
|
92828
93152
|
out.push(divider("FLAGS"));
|
|
92829
93153
|
out.push("");
|
|
92830
|
-
out.push(` ${
|
|
92831
|
-
out.push(` ${
|
|
92832
|
-
out.push(` ${
|
|
93154
|
+
out.push(` ${import_picocolors69.default.dim("--harness <id>")} force harness for onboard / sync (e.g. claude-code)`);
|
|
93155
|
+
out.push(` ${import_picocolors69.default.dim("--scope <s>")} force scope: global | project`);
|
|
93156
|
+
out.push(` ${import_picocolors69.default.dim("--yes, -y")} skip confirmations / auto-overwrite`);
|
|
92833
93157
|
out.push(` ${" ".repeat("--yes, -y".length)} required for destructive commands with no terminal (pipes, CI)`);
|
|
92834
|
-
out.push(` ${
|
|
92835
|
-
out.push(` ${
|
|
92836
|
-
out.push(` ${
|
|
92837
|
-
out.push(` ${
|
|
92838
|
-
out.push(` ${
|
|
92839
|
-
out.push(` ${
|
|
92840
|
-
out.push(` ${
|
|
92841
|
-
out.push(` ${
|
|
92842
|
-
out.push(` ${
|
|
92843
|
-
out.push(` ${
|
|
92844
|
-
out.push(` ${
|
|
92845
|
-
out.push(` ${
|
|
92846
|
-
out.push(` ${
|
|
92847
|
-
out.push(` ${
|
|
92848
|
-
out.push(` ${
|
|
92849
|
-
out.push(` ${
|
|
92850
|
-
out.push(` ${
|
|
92851
|
-
out.push(` ${
|
|
92852
|
-
out.push(` ${
|
|
92853
|
-
out.push(` ${
|
|
92854
|
-
out.push(` ${
|
|
92855
|
-
out.push(` ${
|
|
93158
|
+
out.push(` ${import_picocolors69.default.dim("--agent <id>")} for link/task create: use this agent id explicitly (task list: filter to it)`);
|
|
93159
|
+
out.push(` ${import_picocolors69.default.dim("--message <text>")} for task create: required first user message`);
|
|
93160
|
+
out.push(` ${import_picocolors69.default.dim("--title <text>")} for task create: optional task title`);
|
|
93161
|
+
out.push(` ${import_picocolors69.default.dim("--model <id>")} for task create: optional model override`);
|
|
93162
|
+
out.push(` ${import_picocolors69.default.dim("--wait")} for task create: block until the task finishes; exit 1 unless it succeeded`);
|
|
93163
|
+
out.push(` ${import_picocolors69.default.dim("--timeout <secs>")} for task create --wait: give up after <secs> and exit 1`);
|
|
93164
|
+
out.push(` ${import_picocolors69.default.dim("--limit <n>")} for task list (1-200), task logs (events to print; with --follow, the first page size) and machine ls`);
|
|
93165
|
+
out.push(` ${import_picocolors69.default.dim("--follow, -f")} for task logs: stay attached and print events as they land`);
|
|
93166
|
+
out.push(` ${import_picocolors69.default.dim("--org <id-or-slug>")} pick the organization (team/agent list, agent create, orchestration create/list)`);
|
|
93167
|
+
out.push(` ${import_picocolors69.default.dim("--team <id>")} pick the team, same commands (works without --org)`);
|
|
93168
|
+
out.push(` ${import_picocolors69.default.dim("--json")} machine-readable output for supported commands`);
|
|
93169
|
+
out.push(` ${import_picocolors69.default.dim("--no-tracking")} for link / agent pull --link: skip routing LLM traffic through brainbase`);
|
|
93170
|
+
out.push(` ${import_picocolors69.default.dim("--link")} for agent pull: link this folder to the agent first, as \`brainbase link --agent <id> --yes\` would, in one process`);
|
|
93171
|
+
out.push(` ${import_picocolors69.default.dim("--track")} for agent create: enable tracking non-interactively (off without a TTY)`);
|
|
93172
|
+
out.push(` ${import_picocolors69.default.dim("--shell <sh|fish>")} for agent env: pick output format (auto-detected from $SHELL)`);
|
|
93173
|
+
out.push(` ${import_picocolors69.default.dim("--bot-token <t>")} for agent connect slack (or BRAINBASE_SLACK_BOT_TOKEN, or stdin)`);
|
|
93174
|
+
out.push(` ${import_picocolors69.default.dim("--signing-secret <s>")} for agent connect slack (or BRAINBASE_SLACK_SIGNING_SECRET, or stdin)`);
|
|
93175
|
+
out.push(` ${import_picocolors69.default.dim("--bot-name <name>")} for agent connect meeting: the bot's display name`);
|
|
93176
|
+
out.push(` ${import_picocolors69.default.dim("--full")} for agent init: write a commented template covering every block`);
|
|
93177
|
+
out.push(` ${import_picocolors69.default.dim("--minimal")} for agent init: write the starter manifest (the default)`);
|
|
93178
|
+
out.push(` ${import_picocolors69.default.dim("--all")} for template list: include installs from other folders; for machine ls: include torn-down machines`);
|
|
93179
|
+
out.push(` ${import_picocolors69.default.dim("--web <url>")} for login: web app URL (default https://app.brainbaselabs.com)`);
|
|
93180
|
+
out.push(` ${import_picocolors69.default.dim("--no-open")} for mcp connect: print the link without opening a browser (implied with no terminal)`);
|
|
93181
|
+
out.push(` ${import_picocolors69.default.dim("--no-wait")} for mcp connect: print the link and exit instead of waiting for approval`);
|
|
92856
93182
|
out.push("");
|
|
92857
93183
|
out.push(divider("ENV"));
|
|
92858
93184
|
out.push("");
|
|
92859
|
-
out.push(` ${
|
|
92860
|
-
out.push(` ${
|
|
92861
|
-
out.push(` ${
|
|
92862
|
-
out.push(` ${
|
|
92863
|
-
out.push(` ${
|
|
92864
|
-
out.push(` ${
|
|
92865
|
-
out.push(` ${
|
|
92866
|
-
out.push(` ${
|
|
92867
|
-
out.push(` ${
|
|
92868
|
-
out.push(` ${
|
|
92869
|
-
out.push(` ${
|
|
93185
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_HOME")} override the local config dir (default ~/.brainbase)`);
|
|
93186
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_DEBUG")} print full stack traces on error (any value; unset to disable)`);
|
|
93187
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_WEB_URL")} override the web app URL used by login`);
|
|
93188
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_CONTROL_PLANE_URL")} override the MAS host (/v2/cli; task and interface commands use /v2/tasks and /v2/interfaces)`);
|
|
93189
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_API_URL")} legacy KLS host override (uses /api/cli; proxy/registry fallback)`);
|
|
93190
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_PROXY_URL")} override the model-proxy URL used by harness traffic (default https://api.v1.brainbaselabs.com)`);
|
|
93191
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_REGISTRY_URL")} override the registry API URL (default https://api.v1.brainbaselabs.com)`);
|
|
93192
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_TOKEN")} long-lived CLI PAT; the only PAT control-plane commands accept (token.json is not read there)`);
|
|
93193
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_SKIP_AUTH")} bypass the auth gate for development`);
|
|
93194
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_NON_INTERACTIVE")} force non-interactive mode — skip/auto-default prompts (CI & agents)`);
|
|
93195
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_RUN_ENTRYPOINT")} =1 → agent pull executes the agent entrypoint (sandbox boots; or pass --run-entrypoint)`);
|
|
92870
93196
|
out.push("");
|
|
92871
|
-
out.push(` ${
|
|
92872
|
-
out.push(` ${
|
|
92873
|
-
out.push(` ${
|
|
92874
|
-
out.push(` ${
|
|
92875
|
-
out.push(` ${
|
|
92876
|
-
out.push(` ${
|
|
92877
|
-
out.push(` ${
|
|
93197
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_MEMORY_MCP_URL")} override the built-in memory MCP host`);
|
|
93198
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_BROWSER_MCP_URL")} override the built-in browser MCP host`);
|
|
93199
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_SLACK_MCP_URL")} override the built-in Slack MCP host`);
|
|
93200
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_MEETING_MCP_URL")} override the built-in meeting MCP host`);
|
|
93201
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_GITHUB_MCP_URL")} override the built-in GitHub MCP host`);
|
|
93202
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_LINEAR_MCP_URL")} override the built-in Linear MCP host`);
|
|
93203
|
+
out.push(` ${import_picocolors69.default.dim("BRAINBASE_ORCHESTRATION_MCP_URL")} override the built-in orchestration MCP host`);
|
|
92878
93204
|
out.push("");
|
|
92879
93205
|
out.push(divider("HARNESSES"));
|
|
92880
93206
|
out.push("");
|
|
92881
|
-
out.push(` ${
|
|
92882
|
-
out.push(` ${
|
|
92883
|
-
out.push(` ${
|
|
93207
|
+
out.push(` ${import_picocolors69.default.dim("•")} ${import_picocolors69.default.bold("claude-code")} ${import_picocolors69.default.dim("skills, mcps, agents, commands, playbooks, instructions, files")}`);
|
|
93208
|
+
out.push(` ${import_picocolors69.default.dim("•")} ${import_picocolors69.default.bold("codex")} ${import_picocolors69.default.dim("skills, mcps, commands, playbooks, instructions, files")}`);
|
|
93209
|
+
out.push(` ${import_picocolors69.default.dim("•")} ${import_picocolors69.default.bold("kafka")} ${import_picocolors69.default.dim("skills, mcps, agents, commands, playbooks, instructions, files")}`);
|
|
92884
93210
|
out.push("");
|
|
92885
93211
|
console.log(out.join(`
|
|
92886
93212
|
`));
|
|
@@ -93034,13 +93360,13 @@ async function requireAuth(cmd) {
|
|
|
93034
93360
|
if (STORED_PAT_COMMANDS.has(cmd) && readToken())
|
|
93035
93361
|
return;
|
|
93036
93362
|
console.error("");
|
|
93037
|
-
console.error(` ${brandTint("◆")} ${
|
|
93363
|
+
console.error(` ${brandTint("◆")} ${import_picocolors69.default.bold("brainbase")}`);
|
|
93038
93364
|
console.error("");
|
|
93039
|
-
console.error(` ${
|
|
93365
|
+
console.error(` ${import_picocolors69.default.red("✗")} You need to sign in to use ${import_picocolors69.default.bold("brainbase " + cmd)}.`);
|
|
93040
93366
|
if (status.reason)
|
|
93041
|
-
console.error(` ${
|
|
93367
|
+
console.error(` ${import_picocolors69.default.dim(status.reason)}`);
|
|
93042
93368
|
console.error("");
|
|
93043
|
-
console.error(` Run ${
|
|
93369
|
+
console.error(` Run ${import_picocolors69.default.cyan("brainbase login")} to connect this device.`);
|
|
93044
93370
|
console.error("");
|
|
93045
93371
|
process14.exit(1);
|
|
93046
93372
|
}
|
|
@@ -93114,6 +93440,8 @@ async function main() {
|
|
|
93114
93440
|
const limitParsed = limitRaw === undefined ? NaN : Number(limitRaw);
|
|
93115
93441
|
const limitFlag = Number.isInteger(limitParsed) && limitParsed >= 1 && limitParsed <= 200 ? limitParsed : undefined;
|
|
93116
93442
|
const archivedFlag = hasFlag2(sharedArgs, "--archived");
|
|
93443
|
+
const noOpenFlag = hasFlag2(sharedArgs, "--no-open");
|
|
93444
|
+
const noWaitFlag = hasFlag2(sharedArgs, "--no-wait");
|
|
93117
93445
|
ensureSkillResolversRegistered();
|
|
93118
93446
|
try {
|
|
93119
93447
|
await requireAuth(cmd);
|
|
@@ -93276,7 +93604,11 @@ async function main() {
|
|
|
93276
93604
|
}
|
|
93277
93605
|
case "mcp": {
|
|
93278
93606
|
const sub = argv.shift();
|
|
93279
|
-
const code = await runMcp(cwd2, sub, argv, {
|
|
93607
|
+
const code = await runMcp(cwd2, sub, argv, {
|
|
93608
|
+
json: jsonFlag,
|
|
93609
|
+
noOpen: noOpenFlag,
|
|
93610
|
+
noWait: noWaitFlag
|
|
93611
|
+
});
|
|
93280
93612
|
process14.exitCode = code;
|
|
93281
93613
|
break;
|
|
93282
93614
|
}
|
|
@@ -93287,10 +93619,10 @@ async function main() {
|
|
|
93287
93619
|
process14.exit(1);
|
|
93288
93620
|
}
|
|
93289
93621
|
} catch (err) {
|
|
93290
|
-
console.error(
|
|
93622
|
+
console.error(import_picocolors69.default.red(`
|
|
93291
93623
|
${err.message}`));
|
|
93292
93624
|
if (err instanceof ApiError && err.status === 401) {
|
|
93293
|
-
console.error(` Run ${
|
|
93625
|
+
console.error(` Run ${import_picocolors69.default.cyan("brainbase login")} to connect this device.`);
|
|
93294
93626
|
}
|
|
93295
93627
|
if (process14.env.BRAINBASE_DEBUG)
|
|
93296
93628
|
console.error(err.stack);
|