@botbuddy/cli 1.73.3 → 1.73.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.73.6
4
+
5
+ - `bb stack run --callback-port` no longer refuses a callback tunnel just because the serving host is busy (BOT-2860). Before it opens the real `-R`, the GatewayPorts probe proves that the host keeps reverse forwards on loopback, using a spare host port. It gave up after 2 ports that already had a listener, and parallel sessions' tunnels crowd exactly the ranges it picks from. It now tries up to 20 ports (`PROBE_PORT_ATTEMPTS`), skipping busy ones, within a 60 s overall budget (`DEFAULT_PROBE_BUDGET_MS`) after which it refuses. Only a busy port moves it on: a wildcard bind, a missing `lsof`, an unconfirmed forward or a timeout still refuse at once.
6
+
7
+ ## 1.73.5
8
+
9
+ - The bb-status band's badges are compact rounded pills in Claude Code Desktop, shaped like Claude's own buttons (BOT-3230). Each status, the context alarm, every wait and the staging-red banner is one pill: a rounded rectangle in its darker colour with white words and icon. Before, a rounded border drew a whole empty row above and below the words. Each wait's and staging's `↗` link stays beside its pill. Failure notes such as `Guessed from branch · Couldn't load staging` now sit on their own line under the tree, so the first row's title keeps its full width instead of wrapping one word per line. The terminal draws its badges as before. The plugin version moves to 1.4.3, so `bb update` installs it.
10
+
11
+ ## 1.73.4
12
+
13
+ - A new Claude Code session in a repo where both the bb-session start-up hook and the bb-status band run is registered by the hook again. The band's first read at session start bootstrapped the same session at the same moment, and both bootstraps failed: the session stayed unregistered for minutes and the model never got its BB identity. For its session's first 30 seconds `bb status-band read` (with the new `--session-started-at`) now leaves the bootstrap to the hook and answers `session_starting` with `retry_after_ms`; the band shows "Connecting this session to BB…" and reads once more when told. A session the hook did not register is still bound by the band after that window. The band's plugin version moves to 1.4.2.
14
+
3
15
  ## 1.73.3
4
16
 
5
17
  - The bb-status band is tidied after its first live look (BOT-3228). It says "project", never "epic": tickets outside the session's project read "no project" or "other project". A failed read is one short, single-spaced note, such as `Couldn't load project · Couldn't load staging`, and a band that had to guess its tickets from the branch says `Guessed from branch`. Badges are a darker shade of their colour with white letters and icons, rounded outside the terminal, and the staging-red banner is the same red badge as the context alarm. Wait badges use plain words (`Staging status`, `Codex review PR 1655`, `Timer`, `Playwright lane 8`). PRs nest under their ticket by indent, with no trunk line, and the band's rows are evenly spaced. The band now reads correctly when Claude's working directory is a subfolder of the worktree. The plugin version moves to 1.4.1, so `bb update` installs it.
@@ -11,7 +11,7 @@
11
11
  "name": "bb-status",
12
12
  "source": "./bb-status",
13
13
  "description": "BB session status above the prompt: tickets, PRs with review counts, epic, staging, context use and active waits, for BotBuddy and Supply Guard sessions",
14
- "version": "1.4.1"
14
+ "version": "1.4.3"
15
15
  },
16
16
  {
17
17
  "name": "bb-session",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bb-status",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "BB session status above the prompt: tickets, PRs with review counts, epic, staging, context use and active waits, live only while the session is on screen.",
5
5
  "author": {
6
6
  "name": "BotBuddy"
@@ -64,6 +64,13 @@ ticket". Each row is three columns: the tree and id link (`BOT-123 ↗`,
64
64
  epic, GitHub for PRs; a tint on Desktop, a solid fill with contrasting ink in the
65
65
  terminal), and the title.
66
66
 
67
+ **BOT-3222 start-up registration.** The `bb-session` plugin's SessionStart hook
68
+ registers the session with BB before the first prompt. For the session's first
69
+ 30 s the band passes `--session-started-at` and its read never bootstraps: it
70
+ answers `session_starting` and the band shows "Connecting this session to BB…",
71
+ then reads once more. Only a session the hook did not register is bound by the
72
+ band after that.
73
+
67
74
  ## Install
68
75
 
69
76
  The bb CLI ships this mod and installs it (BOT-3152). `bb setup` and `bb update`
@@ -199,3 +206,11 @@ rounded (`borderStyle: "round"`) outside the terminal; the staging banner is the
199
206
  same red badge as the context alarm. PRs nest by indent with no trunk line, and
200
207
  rows sit in one column Box with an even `rowGap`. The read runs from the
201
208
  worktree root even when Claude's working directory is a subfolder.
209
+
210
+ **BOT-3230 pills.** On Desktop and the other graphical surfaces every badge
211
+ (status, context alarm, wait, staging red) is one SVG pill: a rounded rect
212
+ (6px radius, 22px tall) in the badge's darker fill, with the white icon and
213
+ words inside, its width estimated from the words. A Claude Code `Box` has no
214
+ corner radius, and a border draws a whole row above and below. Links stay
215
+ `Link` elements beside the pill. Failure notes are their own dim line under
216
+ the tree. The terminal keeps filled `Box` badges.
@@ -33,6 +33,10 @@ let unbound = false;
33
33
  let context = null;
34
34
  // BOT-3213: the tenant's ticket prefix the adapter named with ticket_missing.
35
35
  let hintPrefix = null;
36
+ // BOT-3222: when this Claude session started, so the adapter leaves the
37
+ // session's bootstrap to the bb-session hook in its first 30 s.
38
+ let sessionStartedAt = null;
39
+ let retryAfterMs = null;
36
40
  // BOT-3212: the waits badge pulses once, for PULSE_MS, when the count changes.
37
41
  const PULSE_MS = 2000;
38
42
  let pulsing = false;
@@ -41,6 +45,7 @@ const ERRORS = {
41
45
  linear_key_missing:
42
46
  "Export LINEAR_BB_API_KEY to Claude Desktop before using Live.",
43
47
  session_missing: "Connect BB in this worktree before using Live.",
48
+ session_starting: "Connecting this session to BB…",
44
49
  harness_session_missing:
45
50
  "This Claude session has no supported session identifier.",
46
51
  session_mismatch:
@@ -337,6 +342,7 @@ async function refresh($, { wake = false, keep = false } = {}) {
337
342
  const cwd = await $.session.cwd();
338
343
  const argv = ["bb", "status-band", "read", "--harness-session-id", harness];
339
344
  if (selectedTicket) argv.push("--ticket-id", selectedTicket);
345
+ if (Number.isSafeInteger(sessionStartedAt) && sessionStartedAt > 0) argv.push("--session-started-at", String(sessionStartedAt));
340
346
  // BOT-3135: a wake re-read skips the slow epic read and keeps the last one.
341
347
  const previous = wake ? snapshot : null;
342
348
  if (previous) argv.push("--skip-epic");
@@ -363,6 +369,7 @@ async function refresh($, { wake = false, keep = false } = {}) {
363
369
  }
364
370
  if (result.exitCode !== 0) {
365
371
  hintPrefix = data?.error === "ticket_missing" && /^[A-Z]{2,10}$/.test(data.prefix ?? "") ? data.prefix : null;
372
+ retryAfterMs = data?.error === "session_starting" && Number.isFinite(data.retry_after_ms) ? Math.min(Math.max(data.retry_after_ms, 1000), 30000) : null;
366
373
  throw new Error(
367
374
  typeof data.error === "string" ? data.error : "source_unavailable",
368
375
  );
@@ -402,6 +409,22 @@ async function refresh($, { wake = false, keep = false } = {}) {
402
409
  errorCode = Object.hasOwn(ERRORS, error.message)
403
410
  ? error.message
404
411
  : "status_unavailable";
412
+ // BOT-3222: the hook is still registering this session; read once more
413
+ // when the adapter says, unless another read has started since.
414
+ if (errorCode === "session_starting") {
415
+ const after = retryAfterMs ?? 30000;
416
+ void (async () => {
417
+ await delay($, after + 500);
418
+ if (request !== generation || errorCode !== "session_starting" || mode !== "live") return;
419
+ // Codex P2 on #1661: a hidden session stays parked; followVisibility
420
+ // reads once when a surface draws it again.
421
+ if (parked || !(await onScreen($))) {
422
+ parked = true;
423
+ return;
424
+ }
425
+ await refresh($);
426
+ })();
427
+ }
405
428
  }
406
429
  } finally {
407
430
  if (request === generation) {
@@ -789,10 +812,76 @@ function inked(source, bg) {
789
812
  .replace(/#[0-9a-f]{6}\b/gi, "#ffffff")
790
813
  .replace(/@BG@/g, bg);
791
814
  }
792
- function rounded() {
793
- return surface === "terminal" ? {} : { borderStyle: "round" };
815
+ // BOT-3230: off the terminal every badge is one SVG pill — a rounded rect in
816
+ // its fill, the icon and words in white — the only element that can draw a
817
+ // corner radius (Jono, 2026-11-14: "I want it to look like Details"). A Box
818
+ // border drew a whole row above and below the words. The terminal keeps the
819
+ // filled Box.
820
+ const PILL = { h: 22, rx: 6, pad: 8, icon: 12, gap: 5, font: 13 };
821
+ const RED = "#c62828"; // the context alarm's and staging red's one fill
822
+ function pills() {
823
+ return surface !== "terminal";
824
+ }
825
+ // The system font's advance at 13px, estimated per character, slightly over
826
+ // so the words never touch the rounded end.
827
+ function glyphPx(ch) {
828
+ if (ch === " ") return 3.6;
829
+ if (/[il.,:;'|!·]/.test(ch)) return 3.3;
830
+ if (/[fjrt\/()\[\]]/.test(ch)) return 4.4;
831
+ if (/[mw]/.test(ch)) return 10.2;
832
+ if (/[MW%]/.test(ch)) return 11;
833
+ if (/[A-Z]/.test(ch)) return 8.1;
834
+ if (/[0-9]/.test(ch)) return 7.1;
835
+ if (/[a-z]/.test(ch)) return 6.5;
836
+ if (ch.codePointAt(0) > 0x2000) return 15; // ⏳ ▲ and other symbols
837
+ return 7.1;
838
+ }
839
+ function textPx(text, bold) {
840
+ const w = [...String(text)].reduce((n, ch) => n + glyphPx(ch), 0);
841
+ return Math.ceil(w * (bold ? 1.06 : 1));
794
842
  }
795
- function statusBadge(el, key, spec) {
843
+ function xml(text) {
844
+ return String(text).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
845
+ }
846
+ // The pill's own width; `slot` (≥ it) widens the drawing, never the pill, so
847
+ // a column of pills lines up.
848
+ function pillWidth({ text, icon, bold }) {
849
+ return PILL.pad * 2 + (icon ? PILL.icon + (text ? PILL.gap : 0) : 0) + (text ? textPx(text, bold) : 0);
850
+ }
851
+ function pillSource({ text, icon, fill, bold }, slot) {
852
+ const w = pillWidth({ text, icon, bold });
853
+ const outer = Math.max(w, slot || 0);
854
+ let x = PILL.pad;
855
+ let body = `<rect x="0" y="0" width="${w}" height="${PILL.h}" rx="${PILL.rx}" fill="${fill}"/>`;
856
+ if (icon) {
857
+ body += String(icon).replace(/^<svg /, `<svg x="${x}" y="${(PILL.h - PILL.icon) / 2}" `);
858
+ x += PILL.icon + (text ? PILL.gap : 0);
859
+ }
860
+ if (text)
861
+ body += `<text x="${x}" y="15" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif" font-size="${PILL.font}"${bold ? ' font-weight="600"' : ""} fill="#ffffff">${xml(text)}</text>`;
862
+ return { width: outer, source: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${outer} ${PILL.h}" width="${outer}" height="${PILL.h}">${body}</svg>` };
863
+ }
864
+ function pillSvg(el, pill, slot) {
865
+ const { width, source } = pillSource(pill, slot);
866
+ return el.Svg({ alt: pill.alt || pill.text, width, height: PILL.h, source });
867
+ }
868
+ function statusText(spec) {
869
+ return spec.status.map((part) => part.text).join(" · ");
870
+ }
871
+ // The pill's alt: what its icon said (kind and state), then any further parts
872
+ // (a PR's review count, a project's done/total). When the pill shows a status
873
+ // the icon does not say (a conflicted open PR reads "Conflict"), that status
874
+ // leads the parts, so the alt never drops a warning (Codex P2, PR #1662).
875
+ function statusPill(spec) {
876
+ const said = (spec.iconAlt || "").toLowerCase();
877
+ const first = (spec.status[0]?.text || "").toLowerCase();
878
+ const rest = spec.status.slice(first && said.endsWith(first) ? 1 : 0).map((part) => part.text);
879
+ const alt = spec.iconAlt ? [spec.iconAlt, ...rest].join(" · ") : statusText(spec);
880
+ return { text: statusText(spec), icon: spec.iconSource, fill: badgeColors(spec.hex).bg, alt };
881
+ }
882
+ function statusBadge(el, key, spec, slot) {
883
+ if (pills() && spec.iconSource && typeof el.Svg === "function")
884
+ return [el.Box({ key, flexDirection: "row", flexShrink: 0, children: [pillSvg(el, statusPill(spec), slot)] })];
796
885
  if (!spec.status.length) return spec.icon ? [spec.icon] : [];
797
886
  const { bg, fg, muted } = badgeColors(spec.hex);
798
887
  const children = spec.icon ? [spec.icon] : [];
@@ -800,7 +889,7 @@ function statusBadge(el, key, spec) {
800
889
  if (i) children.push(el.Text({ color: muted, children: [" · "] }));
801
890
  children.push(el.Text({ color: part.muted ? muted : fg, children: [part.text] }));
802
891
  });
803
- return [el.Box({ key, flexDirection: "row", flexShrink: 0, backgroundColor: bg, ...rounded(), borderColor: bg, paddingX: 1, children })];
892
+ return [el.Box({ key, flexDirection: "row", flexShrink: 0, backgroundColor: bg, paddingX: 1, children })];
804
893
  }
805
894
  function bandLine(el, spec, widths, right) {
806
895
  const ids = [];
@@ -814,7 +903,9 @@ function bandLine(el, spec, widths, right) {
814
903
  if (spec.note) title.push(dim(el, " " + spec.note));
815
904
  const children = [
816
905
  el.Box({ key: spec.key + "-ids", flexDirection: "row", width: widths.ids, flexShrink: 0, children: ids }),
817
- el.Box({ key: spec.key + "-status", flexDirection: "row", width: widths.status, flexShrink: 0, children: statusBadge(el, spec.key + "-badge", spec) }),
906
+ // Off the terminal every pill is drawn at the widest pill's width (pixels),
907
+ // so the column needs no cell width of its own.
908
+ el.Box({ key: spec.key + "-status", flexDirection: "row", ...(widths.statusPx ? {} : { width: widths.status }), flexShrink: 0, children: statusBadge(el, spec.key + "-badge", spec, widths.statusPx) }),
818
909
  el.Box({ key: spec.key + "-title", flexDirection: "row", flexGrow: 1, flexShrink: 1, minWidth: 0, flexWrap: "wrap", children: title }),
819
910
  ];
820
911
  if (right && right.length)
@@ -846,24 +937,37 @@ function waitBadges(el, key, w, now) {
846
937
  if (!w || !Number.isSafeInteger(w.count) || w.count < 1) return [];
847
938
  const style = pulsing ? { bold: true } : {};
848
939
  const { bg, fg } = badgeColors(ICON.violet);
849
- const shape = { backgroundColor: bg, ...rounded(), borderColor: bg, paddingX: 1 };
940
+ const shape = { backgroundColor: bg, paddingX: 1 };
941
+ const svg = pills() && typeof el.Svg === "function";
850
942
  // An older BB lists no items: the one count badge, as before.
851
943
  if (!Array.isArray(w.items) || !w.items.length) {
852
944
  const text = waitsText(w, now);
853
- return text ? [el.Box({ key: key + "-waits", flexDirection: "row", flexShrink: 0, ...shape, children: [el.Text({ color: fg, ...style, children: [text] })] })] : [];
945
+ if (!text) return [];
946
+ if (svg) return [el.Box({ key: key + "-waits", flexDirection: "row", flexShrink: 0, children: [pillSvg(el, { text, fill: bg, bold: pulsing })] })];
947
+ return [el.Box({ key: key + "-waits", flexDirection: "row", flexShrink: 0, ...shape, children: [el.Text({ color: fg, ...style, children: [text] })] })];
854
948
  }
855
- const out = w.items.slice(0, MAX_WAIT_BADGES).map((i) =>
856
- el.Box({
949
+ const out = w.items.slice(0, MAX_WAIT_BADGES).map((i) => {
950
+ const text = "⏳ " + i.label + " · " + shortAge(i.created_at, now);
951
+ if (svg)
952
+ return el.Box({
953
+ key: key + "-wait-" + i.id,
954
+ flexDirection: "row",
955
+ flexShrink: 0,
956
+ alignItems: "center",
957
+ columnGap: 1,
958
+ children: [pillSvg(el, { text, fill: bg, bold: pulsing }), el.Link({ href: LINKS.wait(i.id), label: "↗" })],
959
+ });
960
+ return el.Box({
857
961
  key: key + "-wait-" + i.id,
858
962
  flexDirection: "row",
859
963
  flexShrink: 0,
860
964
  ...shape,
861
965
  children: [
862
- el.Text({ color: fg, ...style, children: ["⏳ " + i.label + " · " + shortAge(i.created_at, now) + " "] }),
966
+ el.Text({ color: fg, ...style, children: [text + " "] }),
863
967
  el.Link({ href: LINKS.wait(i.id), label: "↗" }),
864
968
  ],
865
- }),
866
- );
969
+ });
970
+ });
867
971
  if (w.count > out.length) out.push(dim(el, "+" + (w.count - out.length) + " more"));
868
972
  return out;
869
973
  }
@@ -872,11 +976,13 @@ function contextLine(el, key, waits = null) {
872
976
  const alarm = contextAlarm(context);
873
977
  if (alarm)
874
978
  children.push(
875
- el.Box({ key: key + "-ctx", flexDirection: "row", flexShrink: 0, backgroundColor: "error", ...rounded(), borderColor: "error", paddingX: 1, children: [el.Text({ color: "#ffffff", bold: true, children: [alarm] })] }),
979
+ pills() && typeof el.Svg === "function"
980
+ ? el.Box({ key: key + "-ctx", flexDirection: "row", flexShrink: 0, children: [pillSvg(el, { text: alarm, fill: RED, bold: true })] })
981
+ : el.Box({ key: key + "-ctx", flexDirection: "row", flexShrink: 0, backgroundColor: "error", paddingX: 1, children: [el.Text({ color: "#ffffff", bold: true, children: [alarm] })] }),
876
982
  );
877
983
  children.push(...waitBadges(el, key, waits, currentTime));
878
984
  if (!children.length) return null;
879
- return el.Box({ key, flexDirection: "row", flexWrap: "wrap", columnGap: 1, rowGap: 0, children });
985
+ return el.Box({ key, flexDirection: "row", flexWrap: "wrap", alignItems: "center", columnGap: 1, rowGap: 0, children });
880
986
  }
881
987
  async function readContext($) {
882
988
  try {
@@ -902,22 +1008,24 @@ function shortAge(fromIso, now) {
902
1008
  return hours < 48 ? hours + "h" : Math.floor(hours / 24) + "d";
903
1009
  }
904
1010
  function stagingBanner(el, key, since) {
1011
+ const text = "▲ Staging red" + (since ? " " + shortAge(since, currentTime) : "");
905
1012
  return el.Box({
906
1013
  key,
907
1014
  flexDirection: "row",
1015
+ alignItems: "center",
908
1016
  columnGap: 1,
909
1017
  children: [
910
1018
  // BOT-3228: the same red badge, white lettering, as the context alarm.
911
- el.Box({
912
- key: key + "-badge",
913
- flexDirection: "row",
914
- flexShrink: 0,
915
- backgroundColor: "error",
916
- ...rounded(),
917
- borderColor: "error",
918
- paddingX: 1,
919
- children: [el.Text({ color: "#ffffff", bold: true, children: ["▲ Staging red" + (since ? " " + shortAge(since, currentTime) : "")] })],
920
- }),
1019
+ pills() && typeof el.Svg === "function"
1020
+ ? el.Box({ key: key + "-badge", flexDirection: "row", flexShrink: 0, children: [pillSvg(el, { text, fill: RED, bold: true })] })
1021
+ : el.Box({
1022
+ key: key + "-badge",
1023
+ flexDirection: "row",
1024
+ flexShrink: 0,
1025
+ backgroundColor: "error",
1026
+ paddingX: 1,
1027
+ children: [el.Text({ color: "#ffffff", bold: true, children: [text] })],
1028
+ }),
921
1029
  el.Link({ href: LINKS.staging, label: "Open staging ↗" }),
922
1030
  ],
923
1031
  });
@@ -954,6 +1062,8 @@ function bandLines(el, $, inPane) {
954
1062
  prefix,
955
1063
  ids: [{ label: t.key, href: LINKS.ticket(t.key), out: OUT.ticket(s.tenant, t.key) }],
956
1064
  icon: lead(el, "◆", "#ffffff", "ticket " + t.status, inked(ticketIcon(t.status), badgeColors(ticketHex(t.status)).bg)),
1065
+ iconSource: inked(ticketIcon(t.status), badgeColors(ticketHex(t.status)).bg),
1066
+ iconAlt: "ticket " + t.status,
957
1067
  hex: ticketHex(t.status),
958
1068
  status: [{ text: t.status }],
959
1069
  title: t.title,
@@ -970,6 +1080,8 @@ function bandLines(el, $, inPane) {
970
1080
  prefix,
971
1081
  ids: [{ label: "PR " + p.number, href: LINKS.pr(p.repo, p.number), out: OUT.pr(p.repo, p.number) }],
972
1082
  icon: lead(el, "⎇", "#ffffff", "pr " + p.state, inked(prIcon(p.state), badgeColors(hex).bg)),
1083
+ iconSource: inked(prIcon(p.state), badgeColors(hex).bg),
1084
+ iconAlt: "pr " + p.state,
973
1085
  hex,
974
1086
  status,
975
1087
  title: p.title,
@@ -989,6 +1101,8 @@ function bandLines(el, $, inPane) {
989
1101
  },
990
1102
  ],
991
1103
  icon: lead(el, "◇", "#ffffff", "project " + s.epic.state + " " + s.epic.percent + "%", inked(epicIcon(s.epic.state, s.epic.percent), badgeColors(epicHex(s.epic.state)).bg)),
1104
+ iconSource: inked(epicIcon(s.epic.state, s.epic.percent), badgeColors(epicHex(s.epic.state)).bg),
1105
+ iconAlt: "project " + s.epic.state + " " + s.epic.percent + "%",
992
1106
  hex: epicHex(s.epic.state),
993
1107
  status: [{ text: s.epic.percent + "%" }, ...(Number.isSafeInteger(s.epic.total) && s.epic.total > 0 ? [{ text: s.epic.done + "/" + s.epic.total, muted: true }] : [])],
994
1108
  // BOT-3213: the project a coordinator session runs, with its tickets by state.
@@ -1030,15 +1144,24 @@ function bandLines(el, $, inPane) {
1030
1144
  if (s.staging == null) notes.push(UNREAD.staging);
1031
1145
  const right = [...tag];
1032
1146
  if (stale()) right.push(el.Text({ color: "warning", children: ["STALE"] }));
1033
- if (notes.length) right.push(el.Text({ key: k("line-notes"), dimColor: true, children: [notes.join(" · ")] }));
1147
+ // BOT-3230: the notes are their own line under the tree. In the first row
1148
+ // they were a column that never shrank, squeezing the title to a word a line.
1149
+ const noteLine = notes.length
1150
+ ? el.Box({ key: k("line-notes-row"), flexDirection: "row", children: [el.Text({ key: k("line-notes"), dimColor: true, wrap: "wrap", children: [notes.join(" · ")] })] })
1151
+ : null;
1034
1152
  if (details) right.push(details);
1153
+ const svgPills = pills() && typeof el.Svg === "function";
1035
1154
  const widths = {
1036
1155
  ids: Math.max(0, ...specs.map((x) => idsWidth(x.ids, x.prefix))),
1037
1156
  status: Math.max(0, ...specs.map(statusWidth)),
1157
+ statusPx: svgPills ? Math.max(0, ...specs.filter((x) => x.iconSource).map((x) => pillWidth(statusPill(x)))) : 0,
1038
1158
  };
1039
1159
  const lines = specs.length
1040
1160
  ? specs.map((spec, i) => bandLine(el, spec, widths, i === 0 ? right : null))
1041
- : [el.Box({ key: k("line-notes-only"), flexDirection: "row", columnGap: 1, children: right })];
1161
+ : right.length
1162
+ ? [el.Box({ key: k("line-notes-only"), flexDirection: "row", columnGap: 1, children: right })]
1163
+ : [];
1164
+ if (noteLine) lines.push(noteLine);
1042
1165
  // BOT-3223 AC-1: context alarm and wait badges lead, on one wrapping line.
1043
1166
  const ctx = contextLine(el, k("line-context"), s.waits);
1044
1167
  if (ctx) lines.unshift(ctx);
@@ -1063,6 +1186,7 @@ export function register(on) {
1063
1186
  immediate: true,
1064
1187
  });
1065
1188
  parked = false;
1189
+ sessionStartedAt = await $.clock.now();
1066
1190
  await readContext($);
1067
1191
  if (await onScreen($)) await refresh($);
1068
1192
  else parked = true;
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.73.3",
3
- "source_commit": "1d11f9a0881e212eda6474d158c2d30ca54abfce",
4
- "source_sha256": "13855ea27a4a26cf5ea2d49ce058d4e8ba459a78d49aa123f351eb8834f67b27",
2
+ "release_version": "1.73.6",
3
+ "source_commit": "8723f67290b9eea90d6c618a2472431c302e45ce",
4
+ "source_sha256": "62a99d9813094a12205e3e3384f21b71077069ebb039966614cc64ca7117576b",
5
5
  "target": "darwin-arm64",
6
- "sha256": "756319e58995c75e35175fceda15be53222c72a0cfa831e2edfee2a72ef43786"
6
+ "sha256": "4b3005f197c53290306a9671740784f6080fd4b999168cbf0004d445b69091a1"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.73.3",
3
- "source_commit": "1d11f9a0881e212eda6474d158c2d30ca54abfce",
4
- "source_sha256": "13855ea27a4a26cf5ea2d49ce058d4e8ba459a78d49aa123f351eb8834f67b27",
2
+ "release_version": "1.73.6",
3
+ "source_commit": "8723f67290b9eea90d6c618a2472431c302e45ce",
4
+ "source_sha256": "62a99d9813094a12205e3e3384f21b71077069ebb039966614cc64ca7117576b",
5
5
  "target": "linux-x64",
6
- "sha256": "2d292e6c266e2f797d39cd409aa103983242eb31d2fd4440f995e5161dcad272"
6
+ "sha256": "994535444d843cf29e359e447b376f14725714d46f214430bcddb05617711165"
7
7
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "release_version": "1.73.3",
4
- "source_commit": "1d11f9a0881e212eda6474d158c2d30ca54abfce",
5
- "source_sha256": "13855ea27a4a26cf5ea2d49ce058d4e8ba459a78d49aa123f351eb8834f67b27",
3
+ "release_version": "1.73.6",
4
+ "source_commit": "8723f67290b9eea90d6c618a2472431c302e45ce",
5
+ "source_sha256": "62a99d9813094a12205e3e3384f21b71077069ebb039966614cc64ca7117576b",
6
6
  "targets": {
7
7
  "darwin-arm64": {
8
8
  "goos": "darwin",
9
9
  "goarch": "arm64",
10
10
  "binary": "daemon/bin/darwin-arm64/botbuddy-daemon",
11
- "sha256": "756319e58995c75e35175fceda15be53222c72a0cfa831e2edfee2a72ef43786",
11
+ "sha256": "4b3005f197c53290306a9671740784f6080fd4b999168cbf0004d445b69091a1",
12
12
  "mode": "0755"
13
13
  },
14
14
  "linux-x64": {
15
15
  "goos": "linux",
16
16
  "goarch": "amd64",
17
17
  "binary": "daemon/bin/linux-x64/botbuddy-daemon",
18
- "sha256": "2d292e6c266e2f797d39cd409aa103983242eb31d2fd4440f995e5161dcad272",
18
+ "sha256": "994535444d843cf29e359e447b376f14725714d46f214430bcddb05617711165",
19
19
  "mode": "0755"
20
20
  }
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbuddy/cli",
3
- "version": "1.73.3",
3
+ "version": "1.73.6",
4
4
  "description": "BotBuddy — Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -400,6 +400,19 @@ export function randomProbePort(random = Math.random) {
400
400
 
401
401
  const REMOTE_FORWARD_BUSY = /remote port forwarding failed|address already in use|cannot listen/i;
402
402
  export const DEFAULT_PROBE_READY_MS = 10_000;
403
+ /**
404
+ * BOT-2860: how many host ports the GatewayPorts probe may try. Only a BUSY port (a listener before
405
+ * the probe, a foreign listener beside it, or sshd refusing the bind) moves on to another port;
406
+ * every other outcome refuses at once, so a larger budget never weakens fail-closed. Parallel
407
+ * sessions' tunnels crowd TUNNEL_PORT_RANGES on a busy host, and two picks were not enough there.
408
+ */
409
+ export const PROBE_PORT_ATTEMPTS = TUNNEL_PORT_PICKS;
410
+ /**
411
+ * BOT-2860 (review): the whole probe's time budget. With PROBE_PORT_ATTEMPTS tries on a slow host
412
+ * (each remote check may take up to its spawnSync timeout), the probe could otherwise run for
413
+ * minutes; once this is spent no further port is tried and the probe refuses.
414
+ */
415
+ export const DEFAULT_PROBE_BUDGET_MS = 60_000;
403
416
 
404
417
  /**
405
418
  * Codex #1134 P1: the probe's LOCAL destination is a port this process holds for the whole probe —
@@ -439,11 +452,13 @@ function listenSilent(port) {
439
452
  * exposed even if sshd binds it wildcard), asks
440
453
  * the host which address P really holds (`verifyCallbackLoopback` with `port: P`), and kills the
441
454
  * probe. Fail closed: an exposed bind, lsof missing, or a listener that never appears is
442
- * CALLBACK_NOT_LOOPBACK; a busy P is retried once on another port, then refused.
455
+ * CALLBACK_NOT_LOOPBACK; a busy P is retried on another port, at most PROBE_PORT_ATTEMPTS ports in
456
+ * all, then refused.
443
457
  */
444
458
  export async function probeGatewayPorts({
445
459
  sshBin = "ssh", sshTarget, env = process.env, spawnImpl = spawn, run = spawnSync, pickProbePort = randomProbePort,
446
- holdLocalPort = holdSilentLocalPort, readyTimeoutMs = DEFAULT_PROBE_READY_MS, attempts = 2,
460
+ holdLocalPort = holdSilentLocalPort, readyTimeoutMs = DEFAULT_PROBE_READY_MS, attempts = PROBE_PORT_ATTEMPTS,
461
+ budgetMs = DEFAULT_PROBE_BUDGET_MS, now = Date.now,
447
462
  sleep = (ms) => new Promise((r) => setTimeout(r, ms)),
448
463
  }) {
449
464
  const fail = (why) => tunnelError("CALLBACK_NOT_LOOPBACK",
@@ -452,7 +467,13 @@ export async function probeGatewayPorts({
452
467
  "(or clientspecified) on the host, or run without --callback-port.");
453
468
  const tried = new Set();
454
469
  let busyTail = "";
470
+ const budgetEnds = now() + budgetMs;
471
+ let spent = 0;
455
472
  for (let attempt = 1; attempt <= attempts; attempt++) {
473
+ if (attempt > 1 && now() > budgetEnds) {
474
+ throw fail(`the host refused ${spent} probe ports and the probe's ${Math.round(budgetMs / 1000)}s budget is spent: ${busyTail}`);
475
+ }
476
+ spent = attempt;
456
477
  // BOT-2503: an invalid or serving-band pick never reaches ssh; at most TUNNEL_PORT_PICKS picks.
457
478
  let port = null;
458
479
  for (let i = 0; port == null && i < TUNNEL_PORT_PICKS; i++) {
@@ -575,6 +575,10 @@ export async function readStatus({
575
575
  // for HOLDER_IDLE_MS is gone; one with no transcript on this host keeps the
576
576
  // BB-expiry rule.
577
577
  const BINDABLE = new Set(["session_missing", "session_mismatch", "session_expired"]);
578
+ // BOT-3222: the bb-session hook's bootstrap is bounded at 20 s (hooks.json
579
+ // timeout 30 s); the band waits this long after its session starts before it
580
+ // bootstraps a session itself.
581
+ export const START_GRACE_MS = 30_000;
578
582
  const HOLDER_IDLE_MS = 30 * 60 * 1000;
579
583
  const UUID_ONLY = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
580
584
  // true: the holder's transcript was written within HOLDER_IDLE_MS; false: it
@@ -750,6 +754,14 @@ export async function main(args, {
750
754
  args = [...args];
751
755
  const skipEpic = args.at(-1) === "--skip-epic";
752
756
  if (skipEpic) args.pop();
757
+ // BOT-3222: when the band's Claude session started (ms since the epoch).
758
+ let startedAt = null;
759
+ if (args.at(-2) === "--session-started-at") {
760
+ const value = args.at(-1);
761
+ if (!/^[0-9]{1,15}$/.test(value)) refuse("invalid_arguments");
762
+ startedAt = Number(value);
763
+ args.splice(-2, 2);
764
+ }
753
765
  if (args.length !== 2 && args.length !== 4) refuse("invalid_arguments");
754
766
  if (
755
767
  args[0] !== "--harness-session-id" ||
@@ -768,6 +780,16 @@ export async function main(args, {
768
780
  } catch (error) {
769
781
  const bind = BINDABLE.has(error?.message) && UUID.test(args[1]) ? await bindable(cwd, args[1], now, holderActive) : false;
770
782
  if (!bind) throw error;
783
+ // BOT-3222: the bb-session SessionStart hook registers this session; a
784
+ // band bootstrap racing it for the same harness id makes BOTH fail. Inside
785
+ // the hook's window the band leaves the bootstrap to the hook and asks to
786
+ // be read again once the window has passed.
787
+ const left = startedAt === null ? 0 : startedAt + START_GRACE_MS - now();
788
+ if (left > 0) {
789
+ const starting = new Error("session_starting");
790
+ starting.retryAfterMs = Math.min(left, START_GRACE_MS);
791
+ throw starting;
792
+ }
771
793
  let branch = null;
772
794
  try {
773
795
  branch = (await execFileAsync("git", ["branch", "--show-current"], { cwd })).stdout.trim() || null;
@@ -795,7 +817,8 @@ export async function main(args, {
795
817
  } catch (error) {
796
818
  const known = /^[a-z_]+$/.test(error?.message ?? "") ? error.message : "status_unavailable";
797
819
  const prefix = known === "ticket_missing" && /^[A-Z]{2,10}$/.test(error?.prefix ?? "") ? { prefix: error.prefix } : {};
798
- out.write(JSON.stringify({ error: known, ...prefix }) + "\n");
820
+ const retry = known === "session_starting" && Number.isFinite(error?.retryAfterMs) ? { retry_after_ms: Math.ceil(error.retryAfterMs) } : {};
821
+ out.write(JSON.stringify({ error: known, ...prefix, ...retry }) + "\n");
799
822
  return 1;
800
823
  }
801
824
  }