@botbuddy/cli 1.68.0 → 1.68.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.68.1
4
+
5
+ - The bb-status band now binds a Claude Code session whose repo has no BotBuddy SessionStart hook, such as Supply Guard worktrees, instead of showing "BB identity belongs to another session". When the worktree has no session cache, an unbound one or an expired one, `bb status-band read` bootstraps this session once (ticketless, the same bootstrap `bb bootstrap` runs) and reads again. A cache another live session holds is never taken over.
6
+
3
7
  ## 1.68.0
4
8
 
5
9
  - The bb-status band for Claude Code now ships in this package. `bb setup` and `bb update` install it once, at user scope, through `bb status-band install`. They point the `botbuddy-labs` marketplace at the plugin inside the installed CLI, so every worktree shows the band with no plugin command, and no repo checkout is needed. The band's reads and live wake run from the installed CLI (`bb status-band read` and `bb status-band relay`).
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.68.0",
3
- "source_commit": "dacd86b04baacbb89711e0a72c52ee036fd17721",
4
- "source_sha256": "f857817d22c1d475d9b53f86b0ea73f2e6e0af18f306b1d079b21cc844413260",
2
+ "release_version": "1.68.1",
3
+ "source_commit": "910247e2ef698463c9c5e1e4949caac7c6bb343c",
4
+ "source_sha256": "cd971a2647c6424648a30ec47b69c5eff464f408888cd66b5ea9d23a37cf6b83",
5
5
  "target": "darwin-arm64",
6
- "sha256": "3a9d33c8cfd04bd4844025552464c02b55399fab1c5352fdc86799a62c8bec5e"
6
+ "sha256": "9cbc2b6f427cc6070f27492bd1693525bcbbc4dad66aacdd2d82c5fb7f64d834"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.68.0",
3
- "source_commit": "dacd86b04baacbb89711e0a72c52ee036fd17721",
4
- "source_sha256": "f857817d22c1d475d9b53f86b0ea73f2e6e0af18f306b1d079b21cc844413260",
2
+ "release_version": "1.68.1",
3
+ "source_commit": "910247e2ef698463c9c5e1e4949caac7c6bb343c",
4
+ "source_sha256": "cd971a2647c6424648a30ec47b69c5eff464f408888cd66b5ea9d23a37cf6b83",
5
5
  "target": "linux-x64",
6
- "sha256": "15fde9d3dd872809e9cc0aead517e7aef9a5398af55b4543269cdd90a6ffc96b"
6
+ "sha256": "2ace98b6231c22ae2cf20940ef61c5d08df4ed6af7735f8109bc91fe829eb1fb"
7
7
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "release_version": "1.68.0",
4
- "source_commit": "dacd86b04baacbb89711e0a72c52ee036fd17721",
5
- "source_sha256": "f857817d22c1d475d9b53f86b0ea73f2e6e0af18f306b1d079b21cc844413260",
3
+ "release_version": "1.68.1",
4
+ "source_commit": "910247e2ef698463c9c5e1e4949caac7c6bb343c",
5
+ "source_sha256": "cd971a2647c6424648a30ec47b69c5eff464f408888cd66b5ea9d23a37cf6b83",
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": "3a9d33c8cfd04bd4844025552464c02b55399fab1c5352fdc86799a62c8bec5e",
11
+ "sha256": "9cbc2b6f427cc6070f27492bd1693525bcbbc4dad66aacdd2d82c5fb7f64d834",
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": "15fde9d3dd872809e9cc0aead517e7aef9a5398af55b4543269cdd90a6ffc96b",
18
+ "sha256": "2ace98b6231c22ae2cf20940ef61c5d08df4ed6af7735f8109bc91fe829eb1fb",
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.68.0",
3
+ "version": "1.68.1",
4
4
  "description": "BotBuddy — Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -473,7 +473,48 @@ export async function readStatus({
473
473
  : null,
474
474
  };
475
475
  }
476
- export async function main(args, { out = process.stdout, cwd = process.cwd(), env = process.env } = {}) {
476
+ // BOT-3152 AC-5: a repo with no SessionStart bootstrap hook (Supply Guard) leaves
477
+ // the worktree cache missing, unbound (no harness id) or expired, so the band
478
+ // binds this session itself, once per read, through the same bootstrap
479
+ // `bb bootstrap` runs. A cache another harness session holds is never
480
+ // bootstrapped over: that session owns the worktree's identity.
481
+ const BINDABLE = new Set(["session_missing", "session_mismatch", "session_expired"]);
482
+ async function bindable(cwd, harnessSessionId, now) {
483
+ let state;
484
+ try {
485
+ state = JSON.parse(await readFile(join(await realpath(cwd), ".botbuddy/agent-state.json"), "utf8"));
486
+ } catch (error) {
487
+ return error?.code === "ENOENT";
488
+ }
489
+ const holder = typeof state?.harness_session_id === "string" ? state.harness_session_id.toLowerCase() : "";
490
+ if (!holder || holder === harnessSessionId.toLowerCase()) return true;
491
+ return !(Date.parse(state.expires_at) > now());
492
+ }
493
+ async function bootstrapBand({ cwd, harnessSessionId, branch }) {
494
+ const [{ bootstrapHarnessSession }, { getConfig }, { hostname }] = await Promise.all([
495
+ import("./session-bootstrap.mjs"),
496
+ import("./config.mjs"),
497
+ import("node:os"),
498
+ ]);
499
+ await bootstrapHarnessSession({
500
+ name: `${getConfig()?.agent_name || `botbuddy-${hostname()}`}-${harnessSessionId.slice(0, 8)}`,
501
+ type: "claude",
502
+ harnessSessionId,
503
+ cwd,
504
+ branch,
505
+ noTicketReason: "bb-status band bound a Claude Code session its repo did not bootstrap",
506
+ harness: "botbuddy-claude-band",
507
+ });
508
+ }
509
+
510
+ export async function main(args, {
511
+ out = process.stdout,
512
+ cwd = process.cwd(),
513
+ env = process.env,
514
+ read = readStatus,
515
+ bootstrap = bootstrapBand,
516
+ now = () => Date.now(),
517
+ } = {}) {
477
518
  try {
478
519
  args = [...args];
479
520
  const skipEpic = args.at(-1) === "--skip-epic";
@@ -484,13 +525,23 @@ export async function main(args, { out = process.stdout, cwd = process.cwd(), en
484
525
  (args.length === 4 && args[2] !== "--ticket-id")
485
526
  )
486
527
  refuse("invalid_arguments");
487
- const snapshot = await readStatus({
488
- cwd,
489
- harnessSessionId: args[1],
490
- ticketId: args[3],
491
- linearKey: env.LINEAR_BB_API_KEY,
492
- skipEpic,
493
- });
528
+ const request = { cwd, harnessSessionId: args[1], ticketId: args[3], linearKey: env.LINEAR_BB_API_KEY, skipEpic };
529
+ let snapshot;
530
+ try {
531
+ snapshot = await read(request);
532
+ } catch (error) {
533
+ if (!BINDABLE.has(error?.message) || !UUID.test(args[1]) || !(await bindable(cwd, args[1], now))) throw error;
534
+ let branch = null;
535
+ try {
536
+ branch = (await execFileAsync("git", ["branch", "--show-current"], { cwd })).stdout.trim() || null;
537
+ } catch { /* detached or not a repo: bootstrap without a branch */ }
538
+ try {
539
+ await bootstrap({ cwd, harnessSessionId: args[1].toLowerCase(), branch });
540
+ } catch {
541
+ throw error;
542
+ }
543
+ snapshot = await read(request);
544
+ }
494
545
  out.write(JSON.stringify(snapshot) + "\n");
495
546
  return 0;
496
547
  } catch (error) {