@brainbase-labs/cli 0.50.0 → 0.51.1

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.
Files changed (2) hide show
  1. package/dist/index.js +69 -23
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -36091,7 +36091,7 @@ function padStart(s, n) {
36091
36091
  // package.json
36092
36092
  var package_default = {
36093
36093
  name: "@brainbase-labs/cli",
36094
- version: "0.50.0",
36094
+ version: "0.51.1",
36095
36095
  description: "Pack, share, and install agent templates across harnesses (Claude Code, Codex, ...).",
36096
36096
  type: "module",
36097
36097
  bin: {
@@ -68334,6 +68334,9 @@ var import_picocolors30 = __toESM(require_picocolors(), 1);
68334
68334
  function sanitizeLabel(s3) {
68335
68335
  return s3.replace(/\u001b\][\s\S]*?(?:\u0007|\u001b\\|$)/g, "").replace(/\u001b\[[\u0030-\u003f]*[\u0020-\u002f]*[\u0040-\u007e]?/g, "").replace(/\u001b[\s\S]?/g, "").replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g, "");
68336
68336
  }
68337
+ function sanitizeLines(s3) {
68338
+ return s3.split(/\r\n|[\n\r\u2028\u2029]/).map(sanitizeLabel);
68339
+ }
68337
68340
 
68338
68341
  // src/cli/agent-status.ts
68339
68342
  function capabilityDrifted(field) {
@@ -79565,7 +79568,7 @@ Phone:
79565
79568
  search [--country <ISO2>] [--area-code <digits>] [--contains <pattern>]
79566
79569
  purchase <number> --yes | release --yes
79567
79570
  configure --greeting <text> (empty text is valid)
79568
- whitelist list | add <number> [--label <text>] | remove <entry-id>
79571
+ whitelist list | add <number> [--label <text>] | remove <entry-id> [--yes]
79569
79572
 
79570
79573
  GitHub/Linear connect: [--no-open] [--no-wait] [--timeout <seconds>]. JSON returns a pending link.
79571
79574
  Resume: github|linear wait --installation <id> [--timeout <seconds>]. Status also accepts --installation.
@@ -79574,7 +79577,7 @@ Slack/Linear secrets also accept environment variables, stdin JSON or a masked t
79574
79577
  New destructive operations require --yes, including with --json.
79575
79578
  `;
79576
79579
  var value = (key2) => ({ key: key2, names: [`--${key2}`], kind: "value" });
79577
- var bool = (key2) => ({ key: key2, names: [`--${key2}`], kind: "boolean" });
79580
+ var bool = (key2) => ({ key: key2, names: key2 === "yes" ? ["--yes", "-y"] : [`--${key2}`], kind: "boolean" });
79578
79581
  var configureFlags = {
79579
79582
  chat: { enabled: "enabled", models: "allowed_models", "prompts-file": "template_prompts", "computer-panel": "computer_panel_enabled", tabs: "computer_panel_tabs" },
79580
79583
  slack: { "stop-policy": "slack_stop_policy", "tool-approval": "slack_tool_approval_mode" },
@@ -79628,8 +79631,10 @@ function surfaceOptionDefinitions(surface, action) {
79628
79631
  if (surface === "phone") {
79629
79632
  if (action === "search")
79630
79633
  values2("country", "area-code", "contains");
79631
- if (action === "whitelist")
79634
+ if (action === "whitelist") {
79632
79635
  values2("label");
79636
+ booleans("yes");
79637
+ }
79633
79638
  if (action === "connect") {
79634
79639
  values2("number");
79635
79640
  booleans("yes");
@@ -79862,6 +79867,8 @@ async function runAgentSurface(cwd2, argv, deps = {}) {
79862
79867
  const mode = args[0];
79863
79868
  if (mode !== "add" && s3("label") !== undefined)
79864
79869
  throw new SurfaceCommandError("--label is only accepted by whitelist add.");
79870
+ if (mode !== "remove" && parsed.options.yes !== undefined)
79871
+ throw new SurfaceCommandError("--yes is only accepted by whitelist remove.");
79865
79872
  if (mode === "list") {
79866
79873
  expectArgs(args, 1, "phone whitelist list");
79867
79874
  out(await api4.whitelist(id));
@@ -86450,7 +86457,8 @@ async function agentNames(ids) {
86450
86457
  }
86451
86458
  function agentLabel(id, names) {
86452
86459
  const name = names.get(id.toLowerCase());
86453
- return name ? `${name} (${id})` : id;
86460
+ const safeId = sanitizeLabel(id);
86461
+ return name ? `${name} (${safeId})` : safeId;
86454
86462
  }
86455
86463
 
86456
86464
  // src/cli/task-list.ts
@@ -86508,8 +86516,8 @@ function formatTaskList(tasks, names, agentId, interfaceId, labelFiltered = fals
86508
86516
  for (const task of tasks) {
86509
86517
  const title = sanitizeLabel(task.title ?? "").trim() || import_picocolors65.default.dim("(untitled)");
86510
86518
  lines.push(` ${statusLabel(task.status)} ${import_picocolors65.default.bold(title)}`);
86511
- lines.push(` ${import_picocolors65.default.dim(task.id)}`);
86512
- lines.push(` ${import_picocolors65.default.dim(`agent ${agentLabel(task.agent_id, names)} · created ${task.created_at}`)}`);
86519
+ lines.push(` ${import_picocolors65.default.dim(sanitizeLabel(task.id))}`);
86520
+ lines.push(` ${import_picocolors65.default.dim(`agent ${agentLabel(task.agent_id, names)} · created ${sanitizeLabel(task.created_at)}`)}`);
86513
86521
  lines.push("");
86514
86522
  }
86515
86523
  lines.push(` ${import_picocolors65.default.dim("inspect one with")} ${import_picocolors65.default.cyan("brainbase task get <id>")}`, "");
@@ -86517,7 +86525,7 @@ function formatTaskList(tasks, names, agentId, interfaceId, labelFiltered = fals
86517
86525
  `);
86518
86526
  }
86519
86527
  function statusLabel(status) {
86520
- const padded = status.padEnd(14);
86528
+ const padded = sanitizeLabel(status).padEnd(14);
86521
86529
  switch (status) {
86522
86530
  case "success":
86523
86531
  return import_picocolors65.default.green(padded);
@@ -86563,49 +86571,60 @@ async function readEvalRuns(task) {
86563
86571
  }
86564
86572
  function format2(task, evals, names) {
86565
86573
  const lines = [""];
86566
- const title = task.title?.trim() || import_picocolors66.default.dim("(untitled)");
86574
+ const title = sanitizeLabel(task.title ?? "").trim() || import_picocolors66.default.dim("(untitled)");
86575
+ const id = sanitizeLabel(task.id);
86567
86576
  lines.push(` ${statusLabel(task.status)} ${import_picocolors66.default.bold(title)}`);
86568
86577
  lines.push("");
86569
- lines.push(` ${import_picocolors66.default.dim("task")} ${task.id}`);
86578
+ lines.push(` ${import_picocolors66.default.dim("task")} ${id}`);
86570
86579
  lines.push(` ${import_picocolors66.default.dim("agent")} ${agentLabel(task.agent_id, names)}`);
86571
- lines.push(` ${import_picocolors66.default.dim("created")} ${task.created_at}`);
86580
+ if (task.model !== undefined) {
86581
+ const model = task.model?.trim() ? sanitizeLabel(task.model) : import_picocolors66.default.dim("agent default");
86582
+ lines.push(` ${import_picocolors66.default.dim("model")} ${model}`);
86583
+ }
86584
+ lines.push(` ${import_picocolors66.default.dim("created")} ${sanitizeLabel(task.created_at)}`);
86572
86585
  if (task.parent_task_id) {
86573
- lines.push(` ${import_picocolors66.default.dim("parent")} ${task.parent_task_id}`);
86586
+ lines.push(` ${import_picocolors66.default.dim("parent")} ${sanitizeLabel(task.parent_task_id)}`);
86574
86587
  }
86575
86588
  if (task.machine_id) {
86576
- lines.push(` ${import_picocolors66.default.dim("machine")} ${task.machine_id}${task.machine_size ? ` (size ${task.machine_size})` : ""}`);
86589
+ const size2 = task.machine_size ? ` (size ${sanitizeLabel(task.machine_size)})` : "";
86590
+ lines.push(` ${import_picocolors66.default.dim("machine")} ${sanitizeLabel(task.machine_id)}${size2}`);
86577
86591
  }
86578
86592
  if (task.sandbox_id)
86579
- lines.push(` ${import_picocolors66.default.dim("sandbox")} ${task.sandbox_id}`);
86580
- const failure = failureSummary(task);
86593
+ lines.push(` ${import_picocolors66.default.dim("sandbox")} ${sanitizeLabel(task.sandbox_id)}`);
86594
+ const [failure, ...failureRest] = sanitizeLines(failureSummary(task) ?? "").filter((line2) => line2.trim());
86581
86595
  if (failure) {
86596
+ const label3 = " failure ";
86582
86597
  lines.push("");
86583
86598
  lines.push(` ${import_picocolors66.default.red("failure")} ${failure}`);
86599
+ for (const line2 of failureRest)
86600
+ lines.push(`${" ".repeat(label3.length)}${line2}`);
86584
86601
  }
86585
86602
  const metadata = Object.entries(task.metadata ?? {});
86586
86603
  if (metadata.length > 0) {
86587
86604
  lines.push("");
86588
86605
  lines.push(` ${import_picocolors66.default.bold(import_picocolors66.default.dim("METADATA"))}`);
86589
86606
  for (const [key2, value2] of metadata) {
86590
- lines.push(` ${import_picocolors66.default.dim(key2)} ${value2}`);
86607
+ lines.push(` ${import_picocolors66.default.dim(sanitizeLabel(key2))} ${sanitizeLabel(String(value2))}`);
86591
86608
  }
86592
86609
  }
86593
86610
  lines.push("");
86594
86611
  lines.push(` ${import_picocolors66.default.bold(import_picocolors66.default.dim("EVAL VERDICTS"))}`);
86595
86612
  if (evals.unavailable) {
86596
- lines.push(` ${import_picocolors66.default.dim(evals.unavailable)}`);
86613
+ lines.push(` ${import_picocolors66.default.dim(sanitizeLabel(evals.unavailable))}`);
86597
86614
  } else if (evals.runs.length === 0) {
86598
86615
  lines.push(` ${import_picocolors66.default.dim("none")}`);
86599
86616
  } else {
86600
86617
  for (const run of evals.runs) {
86601
- const verdict = run.passed === true ? import_picocolors66.default.green("pass") : run.passed === false ? import_picocolors66.default.red("fail") : import_picocolors66.default.dim(run.status);
86602
- lines.push(` ${verdict} ${run.eval_slug ?? run.eval_id}`);
86603
- if (run.reasoning)
86604
- lines.push(` ${import_picocolors66.default.dim(run.reasoning)}`);
86618
+ const verdict = run.passed === true ? import_picocolors66.default.green("pass") : run.passed === false ? import_picocolors66.default.red("fail") : import_picocolors66.default.dim(sanitizeLabel(run.status));
86619
+ lines.push(` ${verdict} ${sanitizeLabel(run.eval_slug ?? run.eval_id)}`);
86620
+ for (const line2 of sanitizeLines(run.reasoning ?? "")) {
86621
+ if (line2.trim())
86622
+ lines.push(` ${import_picocolors66.default.dim(line2)}`);
86623
+ }
86605
86624
  }
86606
86625
  }
86607
86626
  lines.push("");
86608
- lines.push(` ${import_picocolors66.default.dim("read its transcript with")} ${import_picocolors66.default.cyan(`brainbase task logs ${task.id}`)}`, "");
86627
+ lines.push(` ${import_picocolors66.default.dim("read its transcript with")} ${import_picocolors66.default.cyan(`brainbase task logs ${id}`)}`, "");
86609
86628
  return lines.join(`
86610
86629
  `);
86611
86630
  }
@@ -97097,7 +97116,32 @@ async function runBenchmark(sub, args, write3 = (value2) => process.stdout.write
97097
97116
  }
97098
97117
  }
97099
97118
 
97119
+ // src/ui/console-streams.ts
97120
+ import { format as format3 } from "node:util";
97121
+ function routeConsoleThroughStreams() {
97122
+ if (typeof globalThis.Bun === "undefined")
97123
+ return;
97124
+ const writer = (stream) => (...args) => {
97125
+ if (!stream.writable)
97126
+ return;
97127
+ stream.write(`${format3(...args)}
97128
+ `);
97129
+ };
97130
+ console.log = writer(process.stdout);
97131
+ console.info = writer(process.stdout);
97132
+ console.debug = writer(process.stdout);
97133
+ console.warn = writer(process.stderr);
97134
+ console.error = writer(process.stderr);
97135
+ const ignoreClosedReader = (error2) => {
97136
+ if (error2.code !== "EPIPE")
97137
+ throw error2;
97138
+ };
97139
+ process.stdout.on("error", ignoreClosedReader);
97140
+ process.stderr.on("error", ignoreClosedReader);
97141
+ }
97142
+
97100
97143
  // src/index.ts
97144
+ routeConsoleThroughStreams();
97101
97145
  var PROTECTED = new Set([
97102
97146
  "template",
97103
97147
  "skill",
@@ -97782,8 +97826,10 @@ ${didYouMean(cmd, COMMANDS3, "brainbase")}`);
97782
97826
  process14.exit(1);
97783
97827
  }
97784
97828
  } catch (err) {
97829
+ const message2 = sanitizeLines(err.message).join(`
97830
+ `);
97785
97831
  console.error(import_picocolors80.default.red(`
97786
- ${err.message}`));
97832
+ ${message2}`));
97787
97833
  if (err instanceof ApiError && err.status === 401 && !err.message.includes("brainbase login")) {
97788
97834
  console.error(` Run ${import_picocolors80.default.cyan("brainbase login")} to connect this device.`);
97789
97835
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainbase-labs/cli",
3
- "version": "0.50.0",
3
+ "version": "0.51.1",
4
4
  "description": "Pack, share, and install agent templates across harnesses (Claude Code, Codex, ...).",
5
5
  "type": "module",
6
6
  "bin": {