@brainbase-labs/cli 0.41.1 → 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 +674 -344
- 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: {
|
|
@@ -55172,6 +55172,8 @@ async function request(pathname, init = {}) {
|
|
|
55172
55172
|
let res;
|
|
55173
55173
|
let text2;
|
|
55174
55174
|
for (let attempt2 = 0;; attempt2 += 1) {
|
|
55175
|
+
if (init.signal?.aborted)
|
|
55176
|
+
throw init.signal.reason;
|
|
55175
55177
|
try {
|
|
55176
55178
|
res = await sendWithAuthRetry(refreshSessionAvailable ? currentSession : null, async (refreshed) => {
|
|
55177
55179
|
if (refreshed) {
|
|
@@ -55187,7 +55189,7 @@ async function request(pathname, init = {}) {
|
|
|
55187
55189
|
}
|
|
55188
55190
|
break;
|
|
55189
55191
|
} catch (error) {
|
|
55190
|
-
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) {
|
|
55191
55193
|
throw error;
|
|
55192
55194
|
}
|
|
55193
55195
|
await new Promise((resolve) => setTimeout(resolve, GET_NETWORK_RETRY_DELAYS_MS[attempt2]));
|
|
@@ -55591,6 +55593,23 @@ async function connectionsRequest(pathname, init) {
|
|
|
55591
55593
|
throw err;
|
|
55592
55594
|
}
|
|
55593
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
|
+
}
|
|
55594
55613
|
var api = {
|
|
55595
55614
|
listOrgs() {
|
|
55596
55615
|
return request("/orgs");
|
|
@@ -55736,6 +55755,12 @@ var api = {
|
|
|
55736
55755
|
listAgentMcpServers(agentId) {
|
|
55737
55756
|
return connectionsRequest(`/agents/${encodeURIComponent(agentId)}/mcp-servers`);
|
|
55738
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
|
+
},
|
|
55739
55764
|
listOrchestrations(orgId, teamId) {
|
|
55740
55765
|
return request(`/orgs/${encodeURIComponent(orgId)}/teams/${encodeURIComponent(teamId)}/orchestrations`);
|
|
55741
55766
|
},
|
|
@@ -62743,7 +62768,6 @@ function printSkillHelp() {
|
|
|
62743
62768
|
}
|
|
62744
62769
|
|
|
62745
62770
|
// src/cli/login.ts
|
|
62746
|
-
import { spawn } from "node:child_process";
|
|
62747
62771
|
var import_picocolors21 = __toESM(require_picocolors(), 1);
|
|
62748
62772
|
|
|
62749
62773
|
// src/core/login-poll.ts
|
|
@@ -62920,6 +62944,22 @@ async function awaitDeviceSession(options) {
|
|
|
62920
62944
|
throw new LoginTimeoutError(timeoutMs, lastError);
|
|
62921
62945
|
}
|
|
62922
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
|
+
|
|
62923
62963
|
// src/ui/ink/WelcomeCard.tsx
|
|
62924
62964
|
var jsx_dev_runtime14 = __toESM(require_jsx_dev_runtime(), 1);
|
|
62925
62965
|
function WelcomeCard(props) {
|
|
@@ -63013,19 +63053,6 @@ function isInsecureWebBase(webBase) {
|
|
|
63013
63053
|
return false;
|
|
63014
63054
|
return !["127.0.0.1", "localhost", "[::1]", "::1"].includes(url.hostname);
|
|
63015
63055
|
}
|
|
63016
|
-
function openInBrowser(url) {
|
|
63017
|
-
if (process.env.BRAINBASE_NON_INTERACTIVE)
|
|
63018
|
-
return;
|
|
63019
|
-
const [cmd, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? ["rundll32.exe", ["url.dll,FileProtocolHandler", url]] : ["xdg-open", [url]];
|
|
63020
|
-
try {
|
|
63021
|
-
const child = spawn(cmd, args, {
|
|
63022
|
-
stdio: "ignore",
|
|
63023
|
-
detached: true
|
|
63024
|
-
});
|
|
63025
|
-
child.on("error", () => {});
|
|
63026
|
-
child.unref();
|
|
63027
|
-
} catch {}
|
|
63028
|
-
}
|
|
63029
63056
|
function displayUserCode(code) {
|
|
63030
63057
|
return code.replace(/[^A-Za-z0-9-]/g, "");
|
|
63031
63058
|
}
|
|
@@ -72976,7 +73003,7 @@ function printTokenHelp() {
|
|
|
72976
73003
|
}
|
|
72977
73004
|
|
|
72978
73005
|
// src/cli/mcp.ts
|
|
72979
|
-
var
|
|
73006
|
+
var import_picocolors53 = __toESM(require_picocolors(), 1);
|
|
72980
73007
|
|
|
72981
73008
|
// src/core/mcp-check/collect-servers.ts
|
|
72982
73009
|
import path96 from "node:path";
|
|
@@ -81294,6 +81321,47 @@ function probeServer(server, opts = { timeoutMs: DEFAULT_TIMEOUT_MS }) {
|
|
|
81294
81321
|
return probeWithConnector(server, sdkConnector, opts);
|
|
81295
81322
|
}
|
|
81296
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
|
+
|
|
81297
81365
|
// src/cli/mcp.ts
|
|
81298
81366
|
function timeoutMs(env3) {
|
|
81299
81367
|
const raw = env3.BRAINBASE_MCP_CHECK_TIMEOUT_MS;
|
|
@@ -81340,17 +81408,17 @@ async function runMcpCheck(cwd2, options) {
|
|
|
81340
81408
|
function renderHuman(report2) {
|
|
81341
81409
|
const lines = [];
|
|
81342
81410
|
if (report2.check_status === "skipped") {
|
|
81343
|
-
lines.push(
|
|
81411
|
+
lines.push(import_picocolors53.default.dim("No MCP servers configured — nothing to check."));
|
|
81344
81412
|
return lines.join(`
|
|
81345
81413
|
`) + `
|
|
81346
81414
|
`;
|
|
81347
81415
|
}
|
|
81348
81416
|
for (const s3 of report2.servers) {
|
|
81349
|
-
const mark = s3.status === "ok" ?
|
|
81350
|
-
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}` : ""));
|
|
81351
81419
|
lines.push(` ${mark} ${s3.name} ${detail}`);
|
|
81352
81420
|
}
|
|
81353
|
-
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.");
|
|
81354
81422
|
lines.push("", summary);
|
|
81355
81423
|
return lines.join(`
|
|
81356
81424
|
`) + `
|
|
@@ -81446,12 +81514,12 @@ function isUnhealthy(server) {
|
|
|
81446
81514
|
}
|
|
81447
81515
|
function renderServerList(servers) {
|
|
81448
81516
|
if (servers.length === 0) {
|
|
81449
|
-
return
|
|
81517
|
+
return import_picocolors53.default.dim("No MCP servers configured for this agent.") + `
|
|
81450
81518
|
`;
|
|
81451
81519
|
}
|
|
81452
81520
|
const lines = [""];
|
|
81453
81521
|
for (const s3 of servers) {
|
|
81454
|
-
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("✓");
|
|
81455
81523
|
const bits = [sanitizeLabel(s3.transport)];
|
|
81456
81524
|
if (!s3.is_enabled)
|
|
81457
81525
|
bits.push("disabled");
|
|
@@ -81467,10 +81535,10 @@ function renderServerList(servers) {
|
|
|
81467
81535
|
const expiry = describeExpiry(s3);
|
|
81468
81536
|
if (expiry)
|
|
81469
81537
|
bits.push(expiry);
|
|
81470
|
-
lines.push(` ${mark} ${
|
|
81538
|
+
lines.push(` ${mark} ${import_picocolors53.default.bold(sanitizeLabel(s3.name))} ${import_picocolors53.default.dim(bits.join(" · "))}`);
|
|
81471
81539
|
}
|
|
81472
81540
|
if (servers.some((s3) => s3.auth === "oauth_required" || s3.auth === "oauth_expired")) {
|
|
81473
|
-
lines.push("",
|
|
81541
|
+
lines.push("", import_picocolors53.default.dim("Run `brainbase mcp connect <name>` to authorize a server."));
|
|
81474
81542
|
}
|
|
81475
81543
|
lines.push("");
|
|
81476
81544
|
return lines.join(`
|
|
@@ -81494,7 +81562,255 @@ function describeExpiry(server, now2 = Date.now()) {
|
|
|
81494
81562
|
const days = Math.round(hours / 24);
|
|
81495
81563
|
return days > MAX_EXPIRY_DAYS ? `expires in >${MAX_EXPIRY_DAYS}d` : `expires in ${days}d`;
|
|
81496
81564
|
}
|
|
81497
|
-
|
|
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) {
|
|
81498
81814
|
const writeErr = options.writeErr ?? ((s3) => process.stderr.write(s3));
|
|
81499
81815
|
switch (sub) {
|
|
81500
81816
|
case "check": {
|
|
@@ -81503,20 +81819,25 @@ async function runMcp(cwd2, sub, _argv, options) {
|
|
|
81503
81819
|
}
|
|
81504
81820
|
case "list":
|
|
81505
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
|
+
}
|
|
81506
81827
|
default:
|
|
81507
81828
|
writeErr(`Unknown mcp subcommand: ${sub ?? "(none)"}
|
|
81508
81829
|
`);
|
|
81509
|
-
writeErr(`Usage: brainbase mcp <check|list
|
|
81830
|
+
writeErr(`Usage: brainbase mcp <check|list|connect <name>> [--json]
|
|
81510
81831
|
`);
|
|
81511
81832
|
return 1;
|
|
81512
81833
|
}
|
|
81513
81834
|
}
|
|
81514
81835
|
|
|
81515
81836
|
// src/cli/task.ts
|
|
81516
|
-
var
|
|
81837
|
+
var import_picocolors58 = __toESM(require_picocolors(), 1);
|
|
81517
81838
|
|
|
81518
81839
|
// src/cli/task-create.ts
|
|
81519
|
-
var
|
|
81840
|
+
var import_picocolors54 = __toESM(require_picocolors(), 1);
|
|
81520
81841
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
81521
81842
|
|
|
81522
81843
|
// src/core/interfaces-api.ts
|
|
@@ -82425,24 +82746,24 @@ async function waitForCreatedTask(created, options, dependencies) {
|
|
|
82425
82746
|
return;
|
|
82426
82747
|
}
|
|
82427
82748
|
if (outcome.kind === "timeout") {
|
|
82428
|
-
console.log(
|
|
82749
|
+
console.log(import_picocolors54.default.yellow(`Timed out after ${options.timeoutSeconds}s with the task still ${status}.`));
|
|
82429
82750
|
return;
|
|
82430
82751
|
}
|
|
82431
82752
|
if (outcome.kind === "interrupted") {
|
|
82432
|
-
console.log(
|
|
82753
|
+
console.log(import_picocolors54.default.yellow("Interrupted. The task is still running."));
|
|
82433
82754
|
return;
|
|
82434
82755
|
}
|
|
82435
|
-
console.log(code === 0 ?
|
|
82756
|
+
console.log(code === 0 ? import_picocolors54.default.green("Task completed.") : import_picocolors54.default.red(`Task finished as ${status}.`));
|
|
82436
82757
|
} finally {
|
|
82437
82758
|
process.removeListener("SIGINT", onSigint);
|
|
82438
82759
|
}
|
|
82439
82760
|
}
|
|
82440
82761
|
|
|
82441
82762
|
// src/cli/task-get.ts
|
|
82442
|
-
var
|
|
82763
|
+
var import_picocolors56 = __toESM(require_picocolors(), 1);
|
|
82443
82764
|
|
|
82444
82765
|
// src/cli/task-list.ts
|
|
82445
|
-
var
|
|
82766
|
+
var import_picocolors55 = __toESM(require_picocolors(), 1);
|
|
82446
82767
|
var INTERFACE_THREAD_METADATA_KEY = "brainbase_interface_id";
|
|
82447
82768
|
async function runTaskList(options) {
|
|
82448
82769
|
if (!options.json)
|
|
@@ -82462,23 +82783,23 @@ function formatTaskList(tasks, agentId, interfaceId) {
|
|
|
82462
82783
|
const lines = [""];
|
|
82463
82784
|
if (tasks.length === 0 && interfaceId) {
|
|
82464
82785
|
const id = sanitizeLabel(interfaceId);
|
|
82465
|
-
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} "..."`)}`, "");
|
|
82466
82787
|
return lines.join(`
|
|
82467
82788
|
`);
|
|
82468
82789
|
}
|
|
82469
82790
|
if (tasks.length === 0) {
|
|
82470
|
-
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 "..."')}`, "");
|
|
82471
82792
|
return lines.join(`
|
|
82472
82793
|
`);
|
|
82473
82794
|
}
|
|
82474
82795
|
for (const task of tasks) {
|
|
82475
|
-
const title = sanitizeLabel(task.title ?? "").trim() ||
|
|
82476
|
-
lines.push(` ${statusLabel(task.status)} ${
|
|
82477
|
-
lines.push(` ${
|
|
82478
|
-
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}`)}`);
|
|
82479
82800
|
lines.push("");
|
|
82480
82801
|
}
|
|
82481
|
-
lines.push(` ${
|
|
82802
|
+
lines.push(` ${import_picocolors55.default.dim("inspect one with")} ${import_picocolors55.default.cyan("brainbase task get <id>")}`, "");
|
|
82482
82803
|
return lines.join(`
|
|
82483
82804
|
`);
|
|
82484
82805
|
}
|
|
@@ -82486,16 +82807,16 @@ function statusLabel(status) {
|
|
|
82486
82807
|
const padded = status.padEnd(14);
|
|
82487
82808
|
switch (status) {
|
|
82488
82809
|
case "success":
|
|
82489
|
-
return
|
|
82810
|
+
return import_picocolors55.default.green(padded);
|
|
82490
82811
|
case "fail":
|
|
82491
|
-
return
|
|
82812
|
+
return import_picocolors55.default.red(padded);
|
|
82492
82813
|
case "need_more_info":
|
|
82493
|
-
return
|
|
82814
|
+
return import_picocolors55.default.yellow(padded);
|
|
82494
82815
|
case "running":
|
|
82495
82816
|
case "initializing":
|
|
82496
|
-
return
|
|
82817
|
+
return import_picocolors55.default.cyan(padded);
|
|
82497
82818
|
default:
|
|
82498
|
-
return
|
|
82819
|
+
return import_picocolors55.default.dim(padded);
|
|
82499
82820
|
}
|
|
82500
82821
|
}
|
|
82501
82822
|
|
|
@@ -82529,49 +82850,49 @@ async function readEvalRuns(task) {
|
|
|
82529
82850
|
}
|
|
82530
82851
|
function format(task, evals) {
|
|
82531
82852
|
const lines = [""];
|
|
82532
|
-
const title = task.title?.trim() ||
|
|
82533
|
-
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)}`);
|
|
82534
82855
|
lines.push("");
|
|
82535
|
-
lines.push(` ${
|
|
82536
|
-
lines.push(` ${
|
|
82537
|
-
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}`);
|
|
82538
82859
|
if (task.parent_task_id) {
|
|
82539
|
-
lines.push(` ${
|
|
82860
|
+
lines.push(` ${import_picocolors56.default.dim("parent")} ${task.parent_task_id}`);
|
|
82540
82861
|
}
|
|
82541
82862
|
if (task.machine_id) {
|
|
82542
|
-
lines.push(` ${
|
|
82863
|
+
lines.push(` ${import_picocolors56.default.dim("machine")} ${task.machine_id}${task.machine_size ? ` (${task.machine_size})` : ""}`);
|
|
82543
82864
|
}
|
|
82544
82865
|
if (task.sandbox_id)
|
|
82545
|
-
lines.push(` ${
|
|
82866
|
+
lines.push(` ${import_picocolors56.default.dim("sandbox")} ${task.sandbox_id}`);
|
|
82546
82867
|
const failure = failureSummary(task);
|
|
82547
82868
|
if (failure) {
|
|
82548
82869
|
lines.push("");
|
|
82549
|
-
lines.push(` ${
|
|
82870
|
+
lines.push(` ${import_picocolors56.default.red("failure")} ${failure}`);
|
|
82550
82871
|
}
|
|
82551
82872
|
const metadata = Object.entries(task.metadata ?? {});
|
|
82552
82873
|
if (metadata.length > 0) {
|
|
82553
82874
|
lines.push("");
|
|
82554
|
-
lines.push(` ${
|
|
82875
|
+
lines.push(` ${import_picocolors56.default.bold(import_picocolors56.default.dim("METADATA"))}`);
|
|
82555
82876
|
for (const [key2, value] of metadata) {
|
|
82556
|
-
lines.push(` ${
|
|
82877
|
+
lines.push(` ${import_picocolors56.default.dim(key2)} ${value}`);
|
|
82557
82878
|
}
|
|
82558
82879
|
}
|
|
82559
82880
|
lines.push("");
|
|
82560
|
-
lines.push(` ${
|
|
82881
|
+
lines.push(` ${import_picocolors56.default.bold(import_picocolors56.default.dim("EVAL VERDICTS"))}`);
|
|
82561
82882
|
if (evals.unavailable) {
|
|
82562
|
-
lines.push(` ${
|
|
82883
|
+
lines.push(` ${import_picocolors56.default.dim(evals.unavailable)}`);
|
|
82563
82884
|
} else if (evals.runs.length === 0) {
|
|
82564
|
-
lines.push(` ${
|
|
82885
|
+
lines.push(` ${import_picocolors56.default.dim("none")}`);
|
|
82565
82886
|
} else {
|
|
82566
82887
|
for (const run of evals.runs) {
|
|
82567
|
-
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);
|
|
82568
82889
|
lines.push(` ${verdict} ${run.eval_slug ?? run.eval_id}`);
|
|
82569
82890
|
if (run.reasoning)
|
|
82570
|
-
lines.push(` ${
|
|
82891
|
+
lines.push(` ${import_picocolors56.default.dim(run.reasoning)}`);
|
|
82571
82892
|
}
|
|
82572
82893
|
}
|
|
82573
82894
|
lines.push("");
|
|
82574
|
-
lines.push(` ${
|
|
82895
|
+
lines.push(` ${import_picocolors56.default.dim("read its transcript with")} ${import_picocolors56.default.cyan(`brainbase task logs ${task.id}`)}`, "");
|
|
82575
82896
|
return lines.join(`
|
|
82576
82897
|
`);
|
|
82577
82898
|
}
|
|
@@ -82588,7 +82909,7 @@ function failureSummary(task) {
|
|
|
82588
82909
|
}
|
|
82589
82910
|
|
|
82590
82911
|
// src/cli/task-logs.ts
|
|
82591
|
-
var
|
|
82912
|
+
var import_picocolors57 = __toESM(require_picocolors(), 1);
|
|
82592
82913
|
|
|
82593
82914
|
// src/core/task-events.ts
|
|
82594
82915
|
var DEFAULT_RETRY_BUDGET_MS = 60000;
|
|
@@ -82724,14 +83045,14 @@ async function runTaskLogs(taskId, options = {}, dependencies = {}) {
|
|
|
82724
83045
|
console.log(renderEvent(event));
|
|
82725
83046
|
}
|
|
82726
83047
|
if (ordered.length === 0) {
|
|
82727
|
-
console.log(
|
|
83048
|
+
console.log(import_picocolors57.default.dim("No events for this task yet."));
|
|
82728
83049
|
}
|
|
82729
83050
|
}
|
|
82730
83051
|
async function followTranscript(taskId, options, dependencies) {
|
|
82731
83052
|
const backfill = options.limit === undefined ? "" : `?backfill=${options.limit}`;
|
|
82732
83053
|
const { url: url2, resolveBearer } = await masStreamTarget(`/tasks/${encodeURIComponent(taskId)}/events/stream${backfill}`);
|
|
82733
83054
|
if (!options.json) {
|
|
82734
|
-
console.log(
|
|
83055
|
+
console.log(import_picocolors57.default.dim(`Following task ${taskId} — Ctrl-C to stop.`));
|
|
82735
83056
|
}
|
|
82736
83057
|
const setExitCode = dependencies.setExitCode ?? ((code) => process.exitCode = code);
|
|
82737
83058
|
const controller = new AbortController;
|
|
@@ -82759,10 +83080,10 @@ async function followTranscript(taskId, options, dependencies) {
|
|
|
82759
83080
|
} else if (options.json) {
|
|
82760
83081
|
console.log(JSON.stringify(frame));
|
|
82761
83082
|
} else {
|
|
82762
|
-
console.log(
|
|
83083
|
+
console.log(import_picocolors57.default.dim(frame.type));
|
|
82763
83084
|
}
|
|
82764
83085
|
},
|
|
82765
|
-
onReconnect: (reason) => console.error(
|
|
83086
|
+
onReconnect: (reason) => console.error(import_picocolors57.default.dim(`reconnecting — ${reason}`))
|
|
82766
83087
|
});
|
|
82767
83088
|
if (interruptCode !== undefined)
|
|
82768
83089
|
setExitCode(interruptCode);
|
|
@@ -83446,64 +83767,64 @@ async function runTask(cwd2, sub, args) {
|
|
|
83446
83767
|
function printHelp4() {
|
|
83447
83768
|
const out = [];
|
|
83448
83769
|
out.push("");
|
|
83449
|
-
out.push(` ${
|
|
83770
|
+
out.push(` ${import_picocolors58.default.bold("brainbase task")} ${import_picocolors58.default.dim("<sub> [options]")}`);
|
|
83450
83771
|
out.push("");
|
|
83451
|
-
out.push(` ${
|
|
83452
|
-
out.push(` ${
|
|
83453
|
-
out.push(` ${
|
|
83454
|
-
out.push(` ${
|
|
83455
|
-
out.push(` ${
|
|
83456
|
-
out.push(` ${
|
|
83457
|
-
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)")}`);
|
|
83458
83779
|
out.push("");
|
|
83459
|
-
out.push(` ${
|
|
83460
|
-
out.push(` ${
|
|
83461
|
-
out.push(` ${
|
|
83462
|
-
out.push(` ${
|
|
83463
|
-
out.push(` ${
|
|
83464
|
-
out.push(` ${
|
|
83465
|
-
out.push(` ${
|
|
83466
|
-
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)`);
|
|
83467
83788
|
out.push("");
|
|
83468
|
-
out.push(` ${
|
|
83469
|
-
out.push(` ${
|
|
83470
|
-
out.push(` ${
|
|
83471
|
-
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)`);
|
|
83472
83793
|
out.push("");
|
|
83473
|
-
out.push(` ${
|
|
83474
|
-
out.push(` ${
|
|
83475
|
-
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`);
|
|
83476
83797
|
out.push("");
|
|
83477
|
-
out.push(` ${
|
|
83478
|
-
out.push(` ${
|
|
83479
|
-
out.push(` ${
|
|
83480
|
-
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")}`);
|
|
83481
83802
|
out.push("");
|
|
83482
|
-
out.push(` ${
|
|
83483
|
-
out.push(` ${
|
|
83484
|
-
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")}`);
|
|
83485
83806
|
out.push("");
|
|
83486
|
-
out.push(` ${
|
|
83487
|
-
out.push(` ${
|
|
83488
|
-
out.push(` ${
|
|
83489
|
-
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")}`);
|
|
83490
83811
|
out.push("");
|
|
83491
|
-
out.push(` ${
|
|
83492
|
-
out.push(` ${
|
|
83493
|
-
out.push(` ${
|
|
83494
|
-
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.")}`);
|
|
83495
83816
|
out.push("");
|
|
83496
|
-
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>")}`);
|
|
83497
83818
|
out.push("");
|
|
83498
83819
|
console.log(out.join(`
|
|
83499
83820
|
`));
|
|
83500
83821
|
}
|
|
83501
83822
|
|
|
83502
83823
|
// src/cli/machine.ts
|
|
83503
|
-
var
|
|
83824
|
+
var import_picocolors61 = __toESM(require_picocolors(), 1);
|
|
83504
83825
|
|
|
83505
83826
|
// src/cli/machine-list.ts
|
|
83506
|
-
var
|
|
83827
|
+
var import_picocolors59 = __toESM(require_picocolors(), 1);
|
|
83507
83828
|
async function runMachineList(args = {}) {
|
|
83508
83829
|
if (!args.json)
|
|
83509
83830
|
banner("machine list — sandboxes you can reach");
|
|
@@ -83520,7 +83841,7 @@ async function runMachineList(args = {}) {
|
|
|
83520
83841
|
function formatMachineList(machines, includedDead) {
|
|
83521
83842
|
const lines = [""];
|
|
83522
83843
|
if (machines.length === 0) {
|
|
83523
|
-
lines.push(` ${
|
|
83844
|
+
lines.push(` ${import_picocolors59.default.dim(includedDead ? "No machines." : "No live machines. Pass --all to include torn-down ones.")}`, "");
|
|
83524
83845
|
return lines.join(`
|
|
83525
83846
|
`);
|
|
83526
83847
|
}
|
|
@@ -83544,21 +83865,21 @@ function formatMachineList(machines, includedDead) {
|
|
|
83544
83865
|
row.kind.padEnd(kindWidth),
|
|
83545
83866
|
row.dead ? status : statusTint(row.status, status),
|
|
83546
83867
|
row.size.padEnd(sizeWidth),
|
|
83547
|
-
|
|
83868
|
+
import_picocolors59.default.dim(row.age)
|
|
83548
83869
|
].join(" ");
|
|
83549
|
-
lines.push(` ${row.dead ?
|
|
83870
|
+
lines.push(` ${row.dead ? import_picocolors59.default.dim(cells) : cells}`);
|
|
83550
83871
|
}
|
|
83551
|
-
lines.push("", ` ${
|
|
83872
|
+
lines.push("", ` ${import_picocolors59.default.dim("tear one down with")} ${import_picocolors59.default.cyan("brainbase machine rm <id>")}`, "");
|
|
83552
83873
|
return lines.join(`
|
|
83553
83874
|
`);
|
|
83554
83875
|
}
|
|
83555
83876
|
function statusTint(status, padded) {
|
|
83556
83877
|
switch (status) {
|
|
83557
83878
|
case "running":
|
|
83558
|
-
return
|
|
83879
|
+
return import_picocolors59.default.green(padded);
|
|
83559
83880
|
case "stopped":
|
|
83560
83881
|
case "starting":
|
|
83561
|
-
return
|
|
83882
|
+
return import_picocolors59.default.yellow(padded);
|
|
83562
83883
|
default:
|
|
83563
83884
|
return padded;
|
|
83564
83885
|
}
|
|
@@ -83581,7 +83902,7 @@ function age(createdAt) {
|
|
|
83581
83902
|
}
|
|
83582
83903
|
|
|
83583
83904
|
// src/cli/machine-rm.ts
|
|
83584
|
-
var
|
|
83905
|
+
var import_picocolors60 = __toESM(require_picocolors(), 1);
|
|
83585
83906
|
async function runMachineRm(args, dependencies = {}) {
|
|
83586
83907
|
const setExitCode = dependencies.setExitCode ?? ((code) => process.exitCode = code);
|
|
83587
83908
|
const machineId = args.machineId?.trim();
|
|
@@ -83595,7 +83916,7 @@ async function runMachineRm(args, dependencies = {}) {
|
|
|
83595
83916
|
if (args.json) {
|
|
83596
83917
|
console.log(JSON.stringify({ id: machineId, torn_down: false, outcome: "declined" }, null, 2));
|
|
83597
83918
|
} else {
|
|
83598
|
-
console.log(` ${
|
|
83919
|
+
console.log(` ${import_picocolors60.default.dim("Left alone.")}`);
|
|
83599
83920
|
}
|
|
83600
83921
|
return;
|
|
83601
83922
|
}
|
|
@@ -83613,7 +83934,7 @@ async function promptForTeardown(args) {
|
|
|
83613
83934
|
return true;
|
|
83614
83935
|
if (!args.json) {
|
|
83615
83936
|
console.log(`
|
|
83616
|
-
${
|
|
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.")}
|
|
83617
83938
|
`);
|
|
83618
83939
|
}
|
|
83619
83940
|
const answer = await se({
|
|
@@ -83625,9 +83946,9 @@ async function promptForTeardown(args) {
|
|
|
83625
83946
|
function formatMachineRm(machine) {
|
|
83626
83947
|
const lines = [""];
|
|
83627
83948
|
if (machine.destroyed_at) {
|
|
83628
|
-
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}`)}`);
|
|
83629
83950
|
} else {
|
|
83630
|
-
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.")}`);
|
|
83631
83952
|
}
|
|
83632
83953
|
lines.push("");
|
|
83633
83954
|
return lines.join(`
|
|
@@ -83668,28 +83989,28 @@ async function runMachine(sub, args, opts) {
|
|
|
83668
83989
|
function printHelp5() {
|
|
83669
83990
|
const out = [];
|
|
83670
83991
|
out.push("");
|
|
83671
|
-
out.push(` ${
|
|
83992
|
+
out.push(` ${import_picocolors61.default.bold("brainbase machine")} ${import_picocolors61.default.dim("<sub> [options]")}`);
|
|
83672
83993
|
out.push("");
|
|
83673
|
-
out.push(` ${
|
|
83674
|
-
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)")}`);
|
|
83675
83996
|
out.push("");
|
|
83676
|
-
out.push(` ${
|
|
83677
|
-
out.push(` ${
|
|
83678
|
-
out.push(` ${
|
|
83679
|
-
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")}`);
|
|
83680
84001
|
out.push("");
|
|
83681
84002
|
console.log(out.join(`
|
|
83682
84003
|
`));
|
|
83683
84004
|
}
|
|
83684
84005
|
|
|
83685
84006
|
// src/cli/interface.ts
|
|
83686
|
-
var
|
|
84007
|
+
var import_picocolors67 = __toESM(require_picocolors(), 1);
|
|
83687
84008
|
|
|
83688
84009
|
// src/cli/interface-build.ts
|
|
83689
|
-
var
|
|
84010
|
+
var import_picocolors63 = __toESM(require_picocolors(), 1);
|
|
83690
84011
|
|
|
83691
84012
|
// src/cli/interface-common.ts
|
|
83692
|
-
var
|
|
84013
|
+
var import_picocolors62 = __toESM(require_picocolors(), 1);
|
|
83693
84014
|
var JSON_FLAG = { key: "json", names: ["--json"], kind: "boolean" };
|
|
83694
84015
|
var YES_FLAG = { key: "yes", names: ["--yes", "-y"], kind: "boolean" };
|
|
83695
84016
|
var KEY_FLAG = {
|
|
@@ -83751,7 +84072,7 @@ function progress(json) {
|
|
|
83751
84072
|
return json ? (line) => console.error(line) : (line) => console.log(line);
|
|
83752
84073
|
}
|
|
83753
84074
|
function field(label, value) {
|
|
83754
|
-
return ` ${
|
|
84075
|
+
return ` ${import_picocolors62.default.dim(label.padEnd(12))}${value}`;
|
|
83755
84076
|
}
|
|
83756
84077
|
function interruption(deps) {
|
|
83757
84078
|
if (deps.signal)
|
|
@@ -83785,7 +84106,7 @@ async function confirmChange(options) {
|
|
|
83785
84106
|
const confirm = options.deps.confirm ?? promptConfirm;
|
|
83786
84107
|
const accepted = await confirm(options.question);
|
|
83787
84108
|
if (!accepted)
|
|
83788
|
-
console.log(` ${
|
|
84109
|
+
console.log(` ${import_picocolors62.default.dim("Left alone.")}`);
|
|
83789
84110
|
return accepted;
|
|
83790
84111
|
}
|
|
83791
84112
|
async function promptConfirm(message) {
|
|
@@ -83927,28 +84248,28 @@ function buildExitCode(outcome) {
|
|
|
83927
84248
|
function reportBuild(say, interfaceId, outcome, timeoutSeconds) {
|
|
83928
84249
|
switch (outcome.kind) {
|
|
83929
84250
|
case "built":
|
|
83930
|
-
say(` ${
|
|
84251
|
+
say(` ${import_picocolors63.default.dim("build")} ${safe(outcome.build.id)} ${import_picocolors63.default.green("succeeded")}`);
|
|
83931
84252
|
say("");
|
|
83932
|
-
say(` ${
|
|
84253
|
+
say(` ${import_picocolors63.default.dim("Next:")} ${import_picocolors63.default.cyan(`brainbase interface publish ${safe(interfaceId)}`)}`);
|
|
83933
84254
|
return;
|
|
83934
84255
|
case "failed": {
|
|
83935
84256
|
const reason = outcome.build?.error_summary ?? outcome.operation?.error ?? outcome.operation?.reason ?? null;
|
|
83936
|
-
say(` ${
|
|
84257
|
+
say(` ${import_picocolors63.default.dim("build")} ${outcome.build ? safe(outcome.build.id) : import_picocolors63.default.dim("none")} ${import_picocolors63.default.red("failed")}`);
|
|
83937
84258
|
if (reason)
|
|
83938
84259
|
say(` ${safeBlock(reason).split(`
|
|
83939
84260
|
`).join(`
|
|
83940
84261
|
`)}`);
|
|
83941
|
-
say(` ${
|
|
84262
|
+
say(` ${import_picocolors63.default.dim("Try again with")} ${import_picocolors63.default.cyan(`brainbase interface rebuild ${safe(interfaceId)}`)}`);
|
|
83942
84263
|
return;
|
|
83943
84264
|
}
|
|
83944
84265
|
case "busy":
|
|
83945
|
-
say(` ${
|
|
84266
|
+
say(` ${import_picocolors63.default.yellow(safe(outcome.message))}`);
|
|
83946
84267
|
return;
|
|
83947
84268
|
case "timeout":
|
|
83948
|
-
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)}\`.`)}`);
|
|
83949
84270
|
return;
|
|
83950
84271
|
case "interrupted":
|
|
83951
|
-
say(` ${
|
|
84272
|
+
say(` ${import_picocolors63.default.yellow("Stopped waiting.")} ${import_picocolors63.default.dim(`The build keeps going; check \`brainbase interface builds ${safe(interfaceId)}\`.`)}`);
|
|
83952
84273
|
return;
|
|
83953
84274
|
default: {
|
|
83954
84275
|
const unreachable = outcome;
|
|
@@ -83995,8 +84316,8 @@ async function build(ctx) {
|
|
|
83995
84316
|
throw held;
|
|
83996
84317
|
}
|
|
83997
84318
|
const reattach = `brainbase task logs ${safe(taskId)} --follow`;
|
|
83998
|
-
say(` ${
|
|
83999
|
-
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}\`.`)}`);
|
|
84000
84321
|
const finish = (result2, exitCode) => {
|
|
84001
84322
|
if (json)
|
|
84002
84323
|
console.log(JSON.stringify({ type: "result", task_id: taskId, ...result2 }));
|
|
@@ -84013,13 +84334,13 @@ async function build(ctx) {
|
|
|
84013
84334
|
});
|
|
84014
84335
|
} catch (error2) {
|
|
84015
84336
|
say("");
|
|
84016
|
-
say(` ${
|
|
84017
|
-
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)}`);
|
|
84018
84339
|
finish({ version_id: null, build_id: null, status: "stream_lost", task_status: null }, 1);
|
|
84019
84340
|
return;
|
|
84020
84341
|
}
|
|
84021
84342
|
if (followExit !== undefined) {
|
|
84022
|
-
say(` ${
|
|
84343
|
+
say(` ${import_picocolors63.default.yellow("Stopped following.")} ${import_picocolors63.default.dim(`The conversation keeps running. Reattach with \`${reattach}\`.`)}`);
|
|
84023
84344
|
finish({ version_id: null, build_id: null, status: "interrupted", task_status: null }, followExit);
|
|
84024
84345
|
return;
|
|
84025
84346
|
}
|
|
@@ -84034,7 +84355,7 @@ async function build(ctx) {
|
|
|
84034
84355
|
if (settled.kind !== "terminal") {
|
|
84035
84356
|
const interrupted = settled.kind === "interrupted";
|
|
84036
84357
|
const status2 = settled.task?.status ?? null;
|
|
84037
|
-
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)}\`.`)}`);
|
|
84038
84359
|
finish({ version_id: null, build_id: null, status: interrupted ? "interrupted" : "task_unsettled", task_status: status2 }, interrupted ? SIGINT_EXIT_CODE : 1);
|
|
84039
84360
|
return;
|
|
84040
84361
|
}
|
|
@@ -84054,36 +84375,36 @@ async function build(ctx) {
|
|
|
84054
84375
|
}
|
|
84055
84376
|
const codes = [exitCodeForTaskStatus(task.status)];
|
|
84056
84377
|
say("");
|
|
84057
|
-
say(` ${
|
|
84378
|
+
say(` ${import_picocolors63.default.dim("conversation")} ${safe(taskId)} ${import_picocolors63.default.dim("ended")} ${safe(task.status)}`);
|
|
84058
84379
|
if (mine?.status === "failed") {
|
|
84059
84380
|
codes.push(1);
|
|
84060
84381
|
const why = [mine.reason, mine.error].filter(Boolean).map((part) => safe(part)).join(": ");
|
|
84061
|
-
say(` ${
|
|
84382
|
+
say(` ${import_picocolors63.default.red(`This conversation's build work failed${why ? ` (${why})` : ""}.`)}`);
|
|
84062
84383
|
} else if (task.status !== "success" && task.status !== "need_more_info") {
|
|
84063
|
-
say(` ${
|
|
84384
|
+
say(` ${import_picocolors63.default.red(`The conversation finished as ${safe(task.status)}.`)} ${import_picocolors63.default.dim(`See \`brainbase task logs ${safe(taskId)}\`.`)}`);
|
|
84064
84385
|
}
|
|
84065
84386
|
if (task.status === "need_more_info") {
|
|
84066
84387
|
const question = await lastAgentMessage(taskId);
|
|
84067
84388
|
say("");
|
|
84068
84389
|
if (question) {
|
|
84069
|
-
say(` ${
|
|
84390
|
+
say(` ${import_picocolors63.default.bold("The agent asks:")}`);
|
|
84070
84391
|
say(` ${safeBlock(question).split(`
|
|
84071
84392
|
`).join(`
|
|
84072
84393
|
`)}`);
|
|
84073
84394
|
} else {
|
|
84074
|
-
say(` ${
|
|
84395
|
+
say(` ${import_picocolors63.default.bold("The agent needs more from you before it can go on.")}`);
|
|
84075
84396
|
}
|
|
84076
84397
|
say("");
|
|
84077
|
-
say(` ${
|
|
84078
|
-
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)}`);
|
|
84079
84400
|
}
|
|
84080
84401
|
let status;
|
|
84081
84402
|
let buildId = null;
|
|
84082
84403
|
if (versionId) {
|
|
84083
84404
|
say("");
|
|
84084
|
-
say(` ${
|
|
84405
|
+
say(` ${import_picocolors63.default.dim("version")} ${safe(versionId)}`);
|
|
84085
84406
|
if (!json)
|
|
84086
|
-
say(` ${
|
|
84407
|
+
say(` ${import_picocolors63.default.dim("Waiting for its build...")}`);
|
|
84087
84408
|
const buildKey = `${key2}-build`;
|
|
84088
84409
|
let outcome;
|
|
84089
84410
|
try {
|
|
@@ -84093,7 +84414,7 @@ async function build(ctx) {
|
|
|
84093
84414
|
signal: stop.signal,
|
|
84094
84415
|
now: deps.now,
|
|
84095
84416
|
idempotencyKey: buildKey,
|
|
84096
|
-
onStall: () => say(` ${
|
|
84417
|
+
onStall: () => say(` ${import_picocolors63.default.yellow("The build looks stalled; still waiting in case another worker picks it up.")}`)
|
|
84097
84418
|
});
|
|
84098
84419
|
} catch (error2) {
|
|
84099
84420
|
if (error2 instanceof LostResponseError) {
|
|
@@ -84109,9 +84430,9 @@ async function build(ctx) {
|
|
|
84109
84430
|
status = noVersionStatus(mine?.status === "failed", task.status);
|
|
84110
84431
|
if (status === "no_version") {
|
|
84111
84432
|
codes.push(1);
|
|
84112
|
-
say(` ${
|
|
84433
|
+
say(` ${import_picocolors63.default.red("The conversation finished without committing a version, so there is nothing to build.")}`);
|
|
84113
84434
|
} else if (task.status !== "need_more_info") {
|
|
84114
|
-
say(` ${
|
|
84435
|
+
say(` ${import_picocolors63.default.dim("This conversation produced no version, so there is nothing to build.")}`);
|
|
84115
84436
|
}
|
|
84116
84437
|
}
|
|
84117
84438
|
if (!json)
|
|
@@ -84126,10 +84447,10 @@ async function build(ctx) {
|
|
|
84126
84447
|
var buildCommands = { build };
|
|
84127
84448
|
|
|
84128
84449
|
// src/cli/interface-lifecycle.ts
|
|
84129
|
-
var
|
|
84450
|
+
var import_picocolors65 = __toESM(require_picocolors(), 1);
|
|
84130
84451
|
|
|
84131
84452
|
// src/cli/interface-read.ts
|
|
84132
|
-
var
|
|
84453
|
+
var import_picocolors64 = __toESM(require_picocolors(), 1);
|
|
84133
84454
|
function interfaceState(row) {
|
|
84134
84455
|
if (row.archived_at)
|
|
84135
84456
|
return "archived";
|
|
@@ -84148,11 +84469,11 @@ function threadsLabel(shared) {
|
|
|
84148
84469
|
function stateTint(state) {
|
|
84149
84470
|
switch (state) {
|
|
84150
84471
|
case "live":
|
|
84151
|
-
return
|
|
84472
|
+
return import_picocolors64.default.green;
|
|
84152
84473
|
case "building":
|
|
84153
|
-
return
|
|
84474
|
+
return import_picocolors64.default.yellow;
|
|
84154
84475
|
case "archived":
|
|
84155
|
-
return
|
|
84476
|
+
return import_picocolors64.default.dim;
|
|
84156
84477
|
case "draft":
|
|
84157
84478
|
return (cell) => cell;
|
|
84158
84479
|
default: {
|
|
@@ -84185,7 +84506,7 @@ async function list(ctx) {
|
|
|
84185
84506
|
banner("interface list — dashboards you can see");
|
|
84186
84507
|
if (shown.length === 0) {
|
|
84187
84508
|
console.log(`
|
|
84188
|
-
${
|
|
84509
|
+
${import_picocolors64.default.dim(onlyArchived ? "No archived interfaces." : "No interfaces. Create one with `brainbase interface create`.")}
|
|
84189
84510
|
`);
|
|
84190
84511
|
return;
|
|
84191
84512
|
}
|
|
@@ -84198,7 +84519,7 @@ async function list(ctx) {
|
|
|
84198
84519
|
row.audience_mode === "org" ? "everyone" : "chosen",
|
|
84199
84520
|
ago(row.last_edited_at ?? row.created_at, now2)
|
|
84200
84521
|
]);
|
|
84201
|
-
console.log(["", ...table(cells, [null,
|
|
84522
|
+
console.log(["", ...table(cells, [null, import_picocolors64.default.bold, null, null, null, import_picocolors64.default.dim]), ""].join(`
|
|
84202
84523
|
`));
|
|
84203
84524
|
});
|
|
84204
84525
|
}
|
|
@@ -84219,13 +84540,13 @@ async function get2(ctx) {
|
|
|
84219
84540
|
out.push(field("id", safe(row.id)));
|
|
84220
84541
|
out.push(field("agent", safe(row.agent_id)));
|
|
84221
84542
|
out.push(field("state", stateTint(state)(state)));
|
|
84222
|
-
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)")}`));
|
|
84223
84544
|
out.push(field("audience", audienceLabel(row)));
|
|
84224
84545
|
out.push(field("threads", threadsLabel(row.share_agent_threads)));
|
|
84225
|
-
out.push(field("live", row.live_release ? `${safe(row.live_release.id)} ${
|
|
84226
|
-
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")));
|
|
84227
84548
|
if (row.running_generation) {
|
|
84228
|
-
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\`)`)}`));
|
|
84229
84550
|
}
|
|
84230
84551
|
if (row.archived_at)
|
|
84231
84552
|
out.push(field("archived", ago(row.archived_at)));
|
|
@@ -84254,7 +84575,7 @@ async function open(ctx) {
|
|
|
84254
84575
|
}
|
|
84255
84576
|
console.log(safe(url2));
|
|
84256
84577
|
if (new URL(url2).hostname.endsWith("vercel.app")) {
|
|
84257
|
-
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."));
|
|
84258
84579
|
}
|
|
84259
84580
|
});
|
|
84260
84581
|
}
|
|
@@ -84292,7 +84613,7 @@ async function history(ctx, name) {
|
|
|
84292
84613
|
banner(`interface ${name} — ${safe(id)}`);
|
|
84293
84614
|
if (rows.length === 0) {
|
|
84294
84615
|
console.log(`
|
|
84295
|
-
${
|
|
84616
|
+
${import_picocolors64.default.dim(`No ${name} yet.`)}
|
|
84296
84617
|
`);
|
|
84297
84618
|
return;
|
|
84298
84619
|
}
|
|
@@ -84345,7 +84666,7 @@ function exactlyOne(parsed, flags) {
|
|
|
84345
84666
|
}
|
|
84346
84667
|
function peopleLine(access) {
|
|
84347
84668
|
const ids = grantIds(access);
|
|
84348
|
-
return ids.length ? ids.map(safe).join(", ") :
|
|
84669
|
+
return ids.length ? ids.map(safe).join(", ") : import_picocolors65.default.dim("nobody named");
|
|
84349
84670
|
}
|
|
84350
84671
|
function printAccess(row, access) {
|
|
84351
84672
|
console.log([
|
|
@@ -84432,11 +84753,11 @@ async function create3(ctx) {
|
|
|
84432
84753
|
const id = safe(created.id);
|
|
84433
84754
|
const out = [
|
|
84434
84755
|
"",
|
|
84435
|
-
` ${
|
|
84756
|
+
` ${import_picocolors65.default.green("Created")} ${import_picocolors65.default.bold(safe(created.name))}`,
|
|
84436
84757
|
"",
|
|
84437
84758
|
field("id", id),
|
|
84438
84759
|
field("agent", safe(created.agent_id)),
|
|
84439
|
-
field("address", `${safe(created.slug)} ${
|
|
84760
|
+
field("address", `${safe(created.slug)} ${import_picocolors65.default.dim("(nothing live yet)")}`),
|
|
84440
84761
|
field("threads", threadsLabel(created.share_agent_threads))
|
|
84441
84762
|
];
|
|
84442
84763
|
if (access) {
|
|
@@ -84448,11 +84769,11 @@ async function create3(ctx) {
|
|
|
84448
84769
|
out.push("", ` Nobody can open it until you choose who can: \`brainbase interface access ${id} --everyone\` or \`--people <ids>\`.`);
|
|
84449
84770
|
}
|
|
84450
84771
|
if (created.share_agent_threads) {
|
|
84451
|
-
out.push(` ${
|
|
84772
|
+
out.push(` ${import_picocolors65.default.dim(`To show viewers only their own conversations: \`brainbase interface threads ${id} --private\`.`)}`);
|
|
84452
84773
|
}
|
|
84453
84774
|
if (note)
|
|
84454
84775
|
out.push("", ` ${safe(note)}`);
|
|
84455
|
-
out.push("", ` ${
|
|
84776
|
+
out.push("", ` ${import_picocolors65.default.dim(`Next: \`brainbase interface build ${id} "<what to build>"\``)}`, "");
|
|
84456
84777
|
console.log(out.join(`
|
|
84457
84778
|
`));
|
|
84458
84779
|
if (readFailed) {
|
|
@@ -84577,7 +84898,7 @@ async function threads(ctx) {
|
|
|
84577
84898
|
printJson({ id: row.id, share_agent_threads: row.share_agent_threads });
|
|
84578
84899
|
return;
|
|
84579
84900
|
}
|
|
84580
|
-
const already = wanted === null ? "" : ` ${
|
|
84901
|
+
const already = wanted === null ? "" : ` ${import_picocolors65.default.dim("(already set; nothing changed)")}`;
|
|
84581
84902
|
console.log(`
|
|
84582
84903
|
${field("threads", `${threadsLabel(row.share_agent_threads)}${already}`)}
|
|
84583
84904
|
`);
|
|
@@ -84616,7 +84937,7 @@ async function rename(ctx) {
|
|
|
84616
84937
|
return;
|
|
84617
84938
|
}
|
|
84618
84939
|
console.log(`
|
|
84619
|
-
Renamed ${safe(updated.id)} to ${
|
|
84940
|
+
Renamed ${safe(updated.id)} to ${import_picocolors65.default.bold(safe(updated.name))}.
|
|
84620
84941
|
`);
|
|
84621
84942
|
});
|
|
84622
84943
|
}
|
|
@@ -84652,7 +84973,7 @@ async function address(ctx) {
|
|
|
84652
84973
|
}
|
|
84653
84974
|
const where = updated.live_release ? safe(updated.live_release.url) : safe(updated.slug);
|
|
84654
84975
|
console.log(`
|
|
84655
|
-
${safe(updated.name)} is now at ${
|
|
84976
|
+
${safe(updated.name)} is now at ${import_picocolors65.default.bold(where)}.
|
|
84656
84977
|
`);
|
|
84657
84978
|
});
|
|
84658
84979
|
}
|
|
@@ -84744,13 +85065,13 @@ var lifecycleCommands = {
|
|
|
84744
85065
|
};
|
|
84745
85066
|
|
|
84746
85067
|
// src/cli/interface-release.ts
|
|
84747
|
-
var
|
|
85068
|
+
var import_picocolors66 = __toESM(require_picocolors(), 1);
|
|
84748
85069
|
var PUBLISH_TIMEOUT_SECONDS = 300;
|
|
84749
85070
|
var REBUILD_USAGE = "brainbase interface rebuild <id> [--version <version id>]";
|
|
84750
85071
|
var PUBLISH_USAGE = "brainbase interface publish <id> [--build <build id>]";
|
|
84751
85072
|
var ROLLBACK_USAGE = "brainbase interface rollback <id> --release <release id>";
|
|
84752
85073
|
function warn(line) {
|
|
84753
|
-
console.error(
|
|
85074
|
+
console.error(import_picocolors66.default.yellow(line));
|
|
84754
85075
|
}
|
|
84755
85076
|
function text3(value) {
|
|
84756
85077
|
return typeof value === "string" && value.trim() ? value : null;
|
|
@@ -84767,7 +85088,7 @@ async function follow(operationId, what, options) {
|
|
|
84767
85088
|
intervalMs: options.deps.pollIntervalMs,
|
|
84768
85089
|
signal: stop.signal,
|
|
84769
85090
|
now: options.deps.now,
|
|
84770
|
-
onStatus: (operation) => say(
|
|
85091
|
+
onStatus: (operation) => say(import_picocolors66.default.dim(` ${what} ${operation.status}`)),
|
|
84771
85092
|
onStall: () => warn(`The ${what} looks stalled: its worker stopped checking in. Still waiting, in case another worker picks it up.`)
|
|
84772
85093
|
});
|
|
84773
85094
|
if (outcome.kind === "settled") {
|
|
@@ -84786,7 +85107,7 @@ function reportUnsuccessful(result2, what, options) {
|
|
|
84786
85107
|
if (options.json) {
|
|
84787
85108
|
printJson({ outcome: result2.outcome, operation_id: result2.operationId, operation: result2.operation });
|
|
84788
85109
|
} else if (result2.outcome === "failed") {
|
|
84789
|
-
console.error(
|
|
85110
|
+
console.error(import_picocolors66.default.red(`The ${what} failed (operation ${id}):`));
|
|
84790
85111
|
console.error(safeBlock(result2.operation?.error ?? "Brainbase gave no reason."));
|
|
84791
85112
|
} else if (result2.outcome === "timeout") {
|
|
84792
85113
|
warn(`Stopped waiting after ${Math.round(options.timeoutMs / 1000)}s. The ${what} keeps running on the server (operation ${id}).`);
|
|
@@ -84845,7 +85166,7 @@ async function rebuild(ctx) {
|
|
|
84845
85166
|
if (json)
|
|
84846
85167
|
printJson({ outcome: "started", operation_id: operationId, operation });
|
|
84847
85168
|
else
|
|
84848
|
-
console.log(
|
|
85169
|
+
console.log(import_picocolors66.default.dim(` Follow it with \`brainbase interface builds ${safe(id)}\`.`));
|
|
84849
85170
|
return;
|
|
84850
85171
|
}
|
|
84851
85172
|
const result2 = await follow(operationId, "build", { json, timeoutMs: waitMs, deps: ctx.deps });
|
|
@@ -84857,8 +85178,8 @@ async function rebuild(ctx) {
|
|
|
84857
85178
|
}
|
|
84858
85179
|
const buildId = safe(result2.operation?.build_id ?? "");
|
|
84859
85180
|
const version2 = safe(result2.operation?.source_version_id ?? "");
|
|
84860
|
-
console.log(
|
|
84861
|
-
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}\`.`));
|
|
84862
85183
|
});
|
|
84863
85184
|
}
|
|
84864
85185
|
function liveBuildOf(row, releases) {
|
|
@@ -84916,7 +85237,7 @@ function describeBuild(buildId, builds) {
|
|
|
84916
85237
|
const build2 = builds.find((candidate) => candidate.id === buildId);
|
|
84917
85238
|
if (!build2)
|
|
84918
85239
|
return `build ${safe(buildId)}`;
|
|
84919
|
-
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)})`)}`;
|
|
84920
85241
|
}
|
|
84921
85242
|
function reportAlreadyLive(json, buildId, releaseId, url2) {
|
|
84922
85243
|
if (json) {
|
|
@@ -84970,8 +85291,8 @@ async function publish(ctx) {
|
|
|
84970
85291
|
}
|
|
84971
85292
|
if (!json) {
|
|
84972
85293
|
console.log("");
|
|
84973
|
-
console.log(` ${
|
|
84974
|
-
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)}`);
|
|
84975
85296
|
console.log("");
|
|
84976
85297
|
}
|
|
84977
85298
|
const proceed = await confirmChange({
|
|
@@ -85014,7 +85335,7 @@ async function publish(ctx) {
|
|
|
85014
85335
|
if (json)
|
|
85015
85336
|
printJson({ outcome: "started", operation_id: operationId, operation });
|
|
85016
85337
|
else
|
|
85017
|
-
console.log(
|
|
85338
|
+
console.log(import_picocolors66.default.dim(` Check it with \`brainbase interface get ${safe(id)}\`.`));
|
|
85018
85339
|
return;
|
|
85019
85340
|
}
|
|
85020
85341
|
const result2 = await follow(operationId, "publish", { json, timeoutMs: waitMs, deps: ctx.deps });
|
|
@@ -85031,11 +85352,11 @@ async function publish(ctx) {
|
|
|
85031
85352
|
printJson({ outcome: "succeeded", operation_id: operationId, operation: result2.operation, url: url2 });
|
|
85032
85353
|
return;
|
|
85033
85354
|
}
|
|
85034
|
-
console.log(
|
|
85355
|
+
console.log(import_picocolors66.default.green(`✓ Build ${safe(buildId)} is live.`));
|
|
85035
85356
|
if (url2)
|
|
85036
85357
|
console.log(` ${safe(url2)}`);
|
|
85037
85358
|
if (urlUnread) {
|
|
85038
|
-
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)}\`.`));
|
|
85039
85360
|
}
|
|
85040
85361
|
});
|
|
85041
85362
|
}
|
|
@@ -85071,8 +85392,8 @@ async function rollback(ctx) {
|
|
|
85071
85392
|
}
|
|
85072
85393
|
if (!json) {
|
|
85073
85394
|
console.log("");
|
|
85074
|
-
console.log(` ${
|
|
85075
|
-
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)}`);
|
|
85076
85397
|
console.log("");
|
|
85077
85398
|
}
|
|
85078
85399
|
const proceed = await confirmChange({
|
|
@@ -85105,7 +85426,7 @@ async function rollback(ctx) {
|
|
|
85105
85426
|
printJson(release);
|
|
85106
85427
|
return;
|
|
85107
85428
|
}
|
|
85108
|
-
console.log(
|
|
85429
|
+
console.log(import_picocolors66.default.green(`✓ Release ${safe(release.id)} is live again (build ${safe(release.build_id)}).`));
|
|
85109
85430
|
console.log(` ${safe(release.url)}`);
|
|
85110
85431
|
});
|
|
85111
85432
|
}
|
|
@@ -85139,14 +85460,14 @@ async function runInterface(cwd2, sub, args, deps = {}) {
|
|
|
85139
85460
|
await command({ cwd: cwd2, args, deps });
|
|
85140
85461
|
}
|
|
85141
85462
|
function line(command, args, description) {
|
|
85142
|
-
return ` ${
|
|
85143
|
-
${
|
|
85463
|
+
return ` ${import_picocolors67.default.cyan(command)}${args ? ` ${import_picocolors67.default.dim(args)}` : ""}
|
|
85464
|
+
${import_picocolors67.default.dim(description)}`;
|
|
85144
85465
|
}
|
|
85145
85466
|
function printHelp6() {
|
|
85146
85467
|
const out = [];
|
|
85147
85468
|
out.push("");
|
|
85148
|
-
out.push(` ${
|
|
85149
|
-
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.")}`);
|
|
85150
85471
|
out.push("");
|
|
85151
85472
|
out.push(line("ls", "[--agent <id>] [--archived | --only-archived]", "list interfaces you can see"));
|
|
85152
85473
|
out.push(line("get", "<id>", "one interface: address, audience, live release, draft, running build conversation"));
|
|
@@ -85165,14 +85486,14 @@ function printHelp6() {
|
|
|
85165
85486
|
out.push(line("publish", "<id> [--build <id>]", "make a build live (default: the newest succeeded build)"));
|
|
85166
85487
|
out.push(line("rollback", "<id> --release <id>", "make an earlier release live again"));
|
|
85167
85488
|
out.push("");
|
|
85168
|
-
out.push(` ${
|
|
85169
|
-
out.push(` ${
|
|
85170
|
-
out.push(` ${
|
|
85171
|
-
out.push(` ${
|
|
85172
|
-
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`);
|
|
85173
85494
|
out.push("");
|
|
85174
|
-
out.push(` ${
|
|
85175
|
-
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).")}`);
|
|
85176
85497
|
out.push("");
|
|
85177
85498
|
console.log(out.join(`
|
|
85178
85499
|
`));
|
|
@@ -88265,7 +88586,7 @@ async function runBenchmarkPhase(specPathInput, resultPathInput, expectedPhase,
|
|
|
88265
88586
|
}
|
|
88266
88587
|
|
|
88267
88588
|
// src/cli/benchmark-control.ts
|
|
88268
|
-
var
|
|
88589
|
+
var import_picocolors68 = __toESM(require_picocolors(), 1);
|
|
88269
88590
|
import fs89 from "node:fs";
|
|
88270
88591
|
import path101 from "node:path";
|
|
88271
88592
|
|
|
@@ -91279,20 +91600,20 @@ async function emitCursorPages(output, fetchPage, options) {
|
|
|
91279
91600
|
function commandHelp() {
|
|
91280
91601
|
return [
|
|
91281
91602
|
"",
|
|
91282
|
-
` ${
|
|
91603
|
+
` ${import_picocolors68.default.bold("brainbase benchmark")} ${import_picocolors68.default.dim("<command> [options]")}`,
|
|
91283
91604
|
"",
|
|
91284
|
-
` ${
|
|
91285
|
-
` ${
|
|
91286
|
-
` ${
|
|
91287
|
-
` ${
|
|
91288
|
-
` ${
|
|
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")}`,
|
|
91289
91610
|
"",
|
|
91290
|
-
` ${
|
|
91611
|
+
` ${import_picocolors68.default.dim("Use --agent to override brainbase.agent.yaml, and --json or --jsonl for automation.")}`,
|
|
91291
91612
|
"",
|
|
91292
|
-
` ${
|
|
91293
|
-
` ${
|
|
91294
|
-
` ${
|
|
91295
|
-
` ${
|
|
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")}`,
|
|
91296
91617
|
""
|
|
91297
91618
|
].join(`
|
|
91298
91619
|
`);
|
|
@@ -92711,178 +93032,181 @@ var SUBCOMMAND_OWNED_FLAGS = {
|
|
|
92711
93032
|
function help() {
|
|
92712
93033
|
const out = [];
|
|
92713
93034
|
out.push("");
|
|
92714
|
-
out.push(` ${brandTint("◆")} ${
|
|
92715
|
-
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")}`);
|
|
92716
93037
|
out.push("");
|
|
92717
93038
|
out.push(divider("USAGE"));
|
|
92718
93039
|
out.push("");
|
|
92719
|
-
out.push(` ${
|
|
93040
|
+
out.push(` ${import_picocolors69.default.bold("brainbase")} ${import_picocolors69.default.dim("<command> [options]")}`);
|
|
92720
93041
|
out.push("");
|
|
92721
93042
|
out.push(divider("AUTH"));
|
|
92722
93043
|
out.push("");
|
|
92723
|
-
out.push(` ${
|
|
92724
|
-
out.push(` ${
|
|
92725
|
-
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")}`);
|
|
92726
93047
|
out.push("");
|
|
92727
93048
|
out.push(divider("DISCOVERY"));
|
|
92728
93049
|
out.push("");
|
|
92729
|
-
out.push(` ${
|
|
92730
|
-
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")}`);
|
|
92731
93052
|
out.push("");
|
|
92732
93053
|
out.push(divider("LINKED AGENT"));
|
|
92733
93054
|
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(` ${
|
|
92747
|
-
out.push(` ${
|
|
92748
|
-
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")}`);
|
|
92749
93070
|
out.push("");
|
|
92750
93071
|
out.push(divider("TASKS"));
|
|
92751
93072
|
out.push("");
|
|
92752
|
-
out.push(` ${
|
|
92753
|
-
out.push(` ${
|
|
92754
|
-
out.push(` ${
|
|
92755
|
-
out.push(` ${
|
|
92756
|
-
out.push(` ${
|
|
92757
|
-
out.push(` ${
|
|
92758
|
-
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")}`);
|
|
92759
93080
|
out.push("");
|
|
92760
93081
|
out.push(divider("INTERFACES"));
|
|
92761
93082
|
out.push("");
|
|
92762
|
-
out.push(` ${
|
|
92763
|
-
out.push(` ${
|
|
92764
|
-
out.push(` ${
|
|
92765
|
-
out.push(` ${
|
|
92766
|
-
out.push(` ${
|
|
92767
|
-
out.push(` ${
|
|
92768
|
-
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")}`);
|
|
92769
93090
|
out.push("");
|
|
92770
93091
|
out.push(divider("SANDBOXES"));
|
|
92771
93092
|
out.push("");
|
|
92772
|
-
out.push(` ${
|
|
92773
|
-
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)")}`);
|
|
92774
93095
|
out.push("");
|
|
92775
93096
|
out.push(divider("BENCHMARKS"));
|
|
92776
93097
|
out.push("");
|
|
92777
|
-
out.push(` ${
|
|
92778
|
-
out.push(` ${
|
|
92779
|
-
out.push(` ${
|
|
92780
|
-
out.push(` ${
|
|
92781
|
-
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")}`);
|
|
92782
93103
|
out.push("");
|
|
92783
93104
|
out.push(divider("BENCHMARK RUNTIME"));
|
|
92784
93105
|
out.push("");
|
|
92785
|
-
out.push(` ${
|
|
92786
|
-
out.push(` ${
|
|
92787
|
-
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")}`);
|
|
92788
93109
|
out.push("");
|
|
92789
93110
|
out.push(divider("ORCHESTRATIONS"));
|
|
92790
93111
|
out.push("");
|
|
92791
|
-
out.push(` ${
|
|
92792
|
-
out.push(` ${
|
|
92793
|
-
out.push(` ${
|
|
92794
|
-
out.push(` ${
|
|
92795
|
-
out.push(` ${
|
|
92796
|
-
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)")}`);
|
|
92797
93118
|
out.push("");
|
|
92798
93119
|
out.push(divider("TEMPLATES"));
|
|
92799
93120
|
out.push("");
|
|
92800
|
-
out.push(` ${
|
|
92801
|
-
out.push(` ${
|
|
92802
|
-
out.push(` ${
|
|
92803
|
-
out.push(` ${
|
|
92804
|
-
out.push(` ${
|
|
92805
|
-
out.push(` ${
|
|
92806
|
-
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")}`);
|
|
92807
93128
|
out.push("");
|
|
92808
93129
|
out.push(divider("SKILLS"));
|
|
92809
93130
|
out.push("");
|
|
92810
|
-
out.push(` ${
|
|
92811
|
-
out.push(` ${
|
|
92812
|
-
out.push(` ${
|
|
92813
|
-
out.push(` ${
|
|
92814
|
-
out.push(` ${
|
|
92815
|
-
out.push(` ${
|
|
92816
|
-
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 .)")}`);
|
|
92817
93138
|
out.push("");
|
|
92818
93139
|
out.push(divider("CLI TOKENS"));
|
|
92819
93140
|
out.push("");
|
|
92820
|
-
out.push(` ${
|
|
92821
|
-
out.push(` ${
|
|
92822
|
-
out.push(` ${
|
|
92823
|
-
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")}`);
|
|
92824
93145
|
out.push("");
|
|
92825
93146
|
out.push(divider("MCP"));
|
|
92826
93147
|
out.push("");
|
|
92827
|
-
out.push(` ${
|
|
92828
|
-
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")}`);
|
|
92829
93151
|
out.push("");
|
|
92830
93152
|
out.push(divider("FLAGS"));
|
|
92831
93153
|
out.push("");
|
|
92832
|
-
out.push(` ${
|
|
92833
|
-
out.push(` ${
|
|
92834
|
-
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`);
|
|
92835
93157
|
out.push(` ${" ".repeat("--yes, -y".length)} required for destructive commands with no terminal (pipes, CI)`);
|
|
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(` ${
|
|
92856
|
-
out.push(` ${
|
|
92857
|
-
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`);
|
|
92858
93182
|
out.push("");
|
|
92859
93183
|
out.push(divider("ENV"));
|
|
92860
93184
|
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(` ${
|
|
92870
|
-
out.push(` ${
|
|
92871
|
-
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)`);
|
|
92872
93196
|
out.push("");
|
|
92873
|
-
out.push(` ${
|
|
92874
|
-
out.push(` ${
|
|
92875
|
-
out.push(` ${
|
|
92876
|
-
out.push(` ${
|
|
92877
|
-
out.push(` ${
|
|
92878
|
-
out.push(` ${
|
|
92879
|
-
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`);
|
|
92880
93204
|
out.push("");
|
|
92881
93205
|
out.push(divider("HARNESSES"));
|
|
92882
93206
|
out.push("");
|
|
92883
|
-
out.push(` ${
|
|
92884
|
-
out.push(` ${
|
|
92885
|
-
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")}`);
|
|
92886
93210
|
out.push("");
|
|
92887
93211
|
console.log(out.join(`
|
|
92888
93212
|
`));
|
|
@@ -93036,13 +93360,13 @@ async function requireAuth(cmd) {
|
|
|
93036
93360
|
if (STORED_PAT_COMMANDS.has(cmd) && readToken())
|
|
93037
93361
|
return;
|
|
93038
93362
|
console.error("");
|
|
93039
|
-
console.error(` ${brandTint("◆")} ${
|
|
93363
|
+
console.error(` ${brandTint("◆")} ${import_picocolors69.default.bold("brainbase")}`);
|
|
93040
93364
|
console.error("");
|
|
93041
|
-
console.error(` ${
|
|
93365
|
+
console.error(` ${import_picocolors69.default.red("✗")} You need to sign in to use ${import_picocolors69.default.bold("brainbase " + cmd)}.`);
|
|
93042
93366
|
if (status.reason)
|
|
93043
|
-
console.error(` ${
|
|
93367
|
+
console.error(` ${import_picocolors69.default.dim(status.reason)}`);
|
|
93044
93368
|
console.error("");
|
|
93045
|
-
console.error(` Run ${
|
|
93369
|
+
console.error(` Run ${import_picocolors69.default.cyan("brainbase login")} to connect this device.`);
|
|
93046
93370
|
console.error("");
|
|
93047
93371
|
process14.exit(1);
|
|
93048
93372
|
}
|
|
@@ -93116,6 +93440,8 @@ async function main() {
|
|
|
93116
93440
|
const limitParsed = limitRaw === undefined ? NaN : Number(limitRaw);
|
|
93117
93441
|
const limitFlag = Number.isInteger(limitParsed) && limitParsed >= 1 && limitParsed <= 200 ? limitParsed : undefined;
|
|
93118
93442
|
const archivedFlag = hasFlag2(sharedArgs, "--archived");
|
|
93443
|
+
const noOpenFlag = hasFlag2(sharedArgs, "--no-open");
|
|
93444
|
+
const noWaitFlag = hasFlag2(sharedArgs, "--no-wait");
|
|
93119
93445
|
ensureSkillResolversRegistered();
|
|
93120
93446
|
try {
|
|
93121
93447
|
await requireAuth(cmd);
|
|
@@ -93278,7 +93604,11 @@ async function main() {
|
|
|
93278
93604
|
}
|
|
93279
93605
|
case "mcp": {
|
|
93280
93606
|
const sub = argv.shift();
|
|
93281
|
-
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
|
+
});
|
|
93282
93612
|
process14.exitCode = code;
|
|
93283
93613
|
break;
|
|
93284
93614
|
}
|
|
@@ -93289,10 +93619,10 @@ async function main() {
|
|
|
93289
93619
|
process14.exit(1);
|
|
93290
93620
|
}
|
|
93291
93621
|
} catch (err) {
|
|
93292
|
-
console.error(
|
|
93622
|
+
console.error(import_picocolors69.default.red(`
|
|
93293
93623
|
${err.message}`));
|
|
93294
93624
|
if (err instanceof ApiError && err.status === 401) {
|
|
93295
|
-
console.error(` Run ${
|
|
93625
|
+
console.error(` Run ${import_picocolors69.default.cyan("brainbase login")} to connect this device.`);
|
|
93296
93626
|
}
|
|
93297
93627
|
if (process14.env.BRAINBASE_DEBUG)
|
|
93298
93628
|
console.error(err.stack);
|