@botbuddy/cli 1.73.0 → 1.73.2

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.73.2
4
+
5
+ - `bb doctor --fix` keeps the worktree's own BB session. It renews that session in place, fresh or lapsed, and re-checks the stack-lease capability on the same session (`renew_agent_session` with `host` and `worktree`). Before, it registered a new session, which replaced the old one and cut the bb-status band off from the session's tickets and pull requests. A closed session, another Claude session's cache, or a server that returns no capability verdict still gets a new session as before.
6
+
7
+ ## 1.73.1
8
+
9
+ - A coordinator's bb-status row counts its project the way Linear does: duplicate tickets are left out, like canceled ones, and the row's percent and total follow those counts. Before, a Supply Guard project with four duplicates showed `2 done · … · 4 todo` at 25% instead of 2 of 4 done at 50%.
10
+
3
11
  ## 1.73.0
4
12
 
5
13
  - The bb-status band is redrawn (BOT-3223). Its first line shows a red context badge once the session has used more than 30% of its context, then one badge per active bb wait, such as `⏳ Codex review PR 1655 · 4m ↗`, linking to the wait (three at most, then `+N more`); the line wraps. Below it the epic leads a tree: its tickets nest under it, and each PR nests under the ticket its branch or title names; tickets outside the epic and PRs naming no ticket follow, marked "no epic" or "no ticket". Each row is an id link (`BOT-123 ↗`, `PR 456 ↗`), a coloured status badge in Linear's and GitHub's colours, and the title, with the badges in one column. The band's plugin version moves to 1.4.0, so `bb update` installs it.
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.73.0",
3
- "source_commit": "6b876cc1b10ca1c5c7b088ea4e9afed3cad244bc",
4
- "source_sha256": "9505b68bc947e163a7415f881062303ff6e210b872c8928725152ab3e921b5ec",
2
+ "release_version": "1.73.2",
3
+ "source_commit": "a68b7621d7a09d47f21817aa4142cc569d413308",
4
+ "source_sha256": "121a9bd036dd71b421a3e5cabc790e46bf1c7412bbd22b16ee737e1c821b2afb",
5
5
  "target": "darwin-arm64",
6
- "sha256": "501fb0b34089c732ef076d5426184205d468ceef5a0d394defc2516c5c820513"
6
+ "sha256": "ca76663fcf476ee7388bbc2121861b8f54dc5bb959cf43abc500279365a4a77b"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.73.0",
3
- "source_commit": "6b876cc1b10ca1c5c7b088ea4e9afed3cad244bc",
4
- "source_sha256": "9505b68bc947e163a7415f881062303ff6e210b872c8928725152ab3e921b5ec",
2
+ "release_version": "1.73.2",
3
+ "source_commit": "a68b7621d7a09d47f21817aa4142cc569d413308",
4
+ "source_sha256": "121a9bd036dd71b421a3e5cabc790e46bf1c7412bbd22b16ee737e1c821b2afb",
5
5
  "target": "linux-x64",
6
- "sha256": "e12c6d215cda4a772a12d97f10e59c504768ccb74bf9d1b8bb0ddb4ac66ffa48"
6
+ "sha256": "019bb0e768691f06645ce50408446a9b76894b99d23203d427b2435631e0baf4"
7
7
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "release_version": "1.73.0",
4
- "source_commit": "6b876cc1b10ca1c5c7b088ea4e9afed3cad244bc",
5
- "source_sha256": "9505b68bc947e163a7415f881062303ff6e210b872c8928725152ab3e921b5ec",
3
+ "release_version": "1.73.2",
4
+ "source_commit": "a68b7621d7a09d47f21817aa4142cc569d413308",
5
+ "source_sha256": "121a9bd036dd71b421a3e5cabc790e46bf1c7412bbd22b16ee737e1c821b2afb",
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": "501fb0b34089c732ef076d5426184205d468ceef5a0d394defc2516c5c820513",
11
+ "sha256": "ca76663fcf476ee7388bbc2121861b8f54dc5bb959cf43abc500279365a4a77b",
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": "e12c6d215cda4a772a12d97f10e59c504768ccb74bf9d1b8bb0ddb4ac66ffa48",
18
+ "sha256": "019bb0e768691f06645ce50408446a9b76894b99d23203d427b2435631e0baf4",
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.0",
3
+ "version": "1.73.2",
4
4
  "description": "BotBuddy — Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -289,5 +289,5 @@ export async function doctorAgentAuth({
289
289
  }
290
290
 
291
291
  export function doctorHelp() {
292
- return "bb doctor [--fix] [--print-exports] [--json]\nbb doctor --only git_transport [--remote <name>] [--url <push url>] [--fix] [--json]\n\nChecks the client key, repo binding, cached agent session, this worktree's stack-lease capability (registered host + attested machine), and whether git's SSH push connection carries a keepalive (git_transport). --fix mints a replacement session and (re)establishes the stack-lease capability; --print-exports prints its canonical shell exports. When the client key is unreachable (a Background LaunchAgent cannot read the login Keychain), --fix mints from the tier-2 MCP key exported under the binding's mcp_env name (env only, never Keychain).\n\ngit_transport: git opens the SSH connection BEFORE the pre-push hook runs, so a long hook lets it idle until it is dropped and the push dies (exit 141) after every gate passed. ok = ServerAliveInterval > 0 on the push's ssh; n/a = not an ssh remote; needs_fix / unknown = not provable. --fix sets git config --local core.sshCommand \"ssh -o ServerAliveInterval=20 -o ServerAliveCountMax=60\" only when nothing is configured; an existing GIT_SSH_COMMAND, core.sshCommand or GIT_SSH is never overwritten (the exact edit is printed instead).\n\n--only git_transport runs just that check — no sign-in, no network, well under a second — for a pre-push hook: exit 0 ok/n/a, 3 needs_fix/unknown (remedy on stderr), 4 usage. A hook passes its $1 as --remote and its $2 (the URL this push goes to) as --url; without --url every push URL of the remote (default: the branch's push remote, else origin) is checked.";
292
+ return "bb doctor [--fix] [--print-exports] [--json]\nbb doctor --only git_transport [--remote <name>] [--url <push url>] [--fix] [--json]\n\nChecks the client key, repo binding, cached agent session, this worktree's stack-lease capability (registered host + attested machine), and whether git's SSH push connection carries a keepalive (git_transport). --fix renews this harness session's own BB session in place (keeping its tickets and PRs) and re-attests the stack-lease capability on it, or mints a replacement session when that session is closed or belongs to another harness session; --print-exports prints its canonical shell exports. When the client key is unreachable (a Background LaunchAgent cannot read the login Keychain), --fix mints from the tier-2 MCP key exported under the binding's mcp_env name (env only, never Keychain).\n\ngit_transport: git opens the SSH connection BEFORE the pre-push hook runs, so a long hook lets it idle until it is dropped and the push dies (exit 141) after every gate passed. ok = ServerAliveInterval > 0 on the push's ssh; n/a = not an ssh remote; needs_fix / unknown = not provable. --fix sets git config --local core.sshCommand \"ssh -o ServerAliveInterval=20 -o ServerAliveCountMax=60\" only when nothing is configured; an existing GIT_SSH_COMMAND, core.sshCommand or GIT_SSH is never overwritten (the exact edit is printed instead).\n\n--only git_transport runs just that check — no sign-in, no network, well under a second — for a pre-push hook: exit 0 ok/n/a, 3 needs_fix/unknown (remedy on stderr), 4 usage. A hook passes its $1 as --remote and its $2 (the URL this push goes to) as --url; without --url every push URL of the remote (default: the branch's push remote, else origin) is checked.";
293
293
  }
@@ -319,8 +319,23 @@ export async function selfHealAgentSession({
319
319
  // (same session_id, so its ticket/PR edges keep feeding the bb-status band)
320
320
  // before falling back to a new mint, which would start an unlinked session.
321
321
  // A closed session, another harness's cache, or any renewal failure keeps the
322
- // existing mint path. `force` (doctor --fix) still re-registers to re-attest.
323
- if (!force && current && ownCache && current.session_id && current.agent_id && (renewal || !isFresh(current, now()))) {
322
+ // existing mint path.
323
+ // BOT-3219: `force` (doctor --fix) renews in place too, fresh or lapsed, and
324
+ // re-attests the stack-lease capability on that renewal. Only a renewal that
325
+ // returns a capability verdict replaces the forced mint, so an older server
326
+ // that ignores the attestation fields still gets the re-attesting mint.
327
+ let attest = null;
328
+ if (force && !renewal) {
329
+ const [attestBranch, attestHardware, attestHost] = await Promise.all([branch(), hardwareId(), machineHostFn()]);
330
+ attest = {
331
+ host: attestHost,
332
+ // The same worktree register_agent would attest below.
333
+ worktree: registrationWorktree,
334
+ ...(attestHardware ? { machine_uuid: attestHardware } : {}),
335
+ ...(attestBranch ? { branch: attestBranch } : {}),
336
+ };
337
+ }
338
+ if (current && ownCache && current.session_id && current.agent_id && (renewal || attest || !isFresh(current, now()))) {
324
339
  const { renewHarnessSession } = await import("./session-bootstrap.mjs");
325
340
  const renewedState = await renewHarnessSession({
326
341
  cwd,
@@ -332,8 +347,13 @@ export async function selfHealAgentSession({
332
347
  writeState,
333
348
  // Already inside this worktree's state lock.
334
349
  transaction: (_options, operation) => operation(cwd),
350
+ force: !!attest,
351
+ attest,
335
352
  }).catch(() => null);
336
- if (renewedState?.agent_session_token && (!renewal || renewedState.agent_session_token !== rejectedCredential.token)) {
353
+ const capability = renewedState?.stack_lease_capability;
354
+ const attested = !attest || (capability && typeof capability.status === "string");
355
+ if (attested && renewedState?.agent_session_token && (!renewal || renewedState.agent_session_token !== rejectedCredential.token)) {
356
+ const { checked_at: _checkedAt, ...verdict } = capability ?? {};
337
357
  return withIdentity({
338
358
  token: renewedState.agent_session_token,
339
359
  sessionId: sessionId ?? renewedState.session_id,
@@ -341,7 +361,7 @@ export async function selfHealAgentSession({
341
361
  source: "renewed",
342
362
  mintedWith,
343
363
  ticketSignals: null,
344
- stackLeaseCapability: null,
364
+ stackLeaseCapability: attest ? verdict : null,
345
365
  }, renewedState);
346
366
  }
347
367
  }
@@ -181,6 +181,13 @@ export async function renewHarnessSession({
181
181
  readState = readAgentState,
182
182
  writeState = writeAgentState,
183
183
  transaction = withHarnessBootstrapLock,
184
+ // BOT-3219: `bb doctor --fix` renews a still-fresh session too, so it can
185
+ // re-attest the worktree's stack-lease capability on the SAME session. A
186
+ // fresh session's bearer is reissued unchanged by the server.
187
+ force = false,
188
+ // BOT-3219: { host, worktree, machine_uuid?, branch? } — the server runs the
189
+ // register_agent worktree attestation and returns `stack_lease_capability`.
190
+ attest = null,
184
191
  } = {}) {
185
192
  if (typeof harnessSessionId !== "string" || !harnessSessionId) {
186
193
  throw renewalError("session_identity_mismatch", "renewal requires this harness session's id");
@@ -193,11 +200,20 @@ export async function renewHarnessSession({
193
200
  if (String(cached.harness_session_id ?? "").toLowerCase() !== harness) {
194
201
  throw renewalError("session_identity_mismatch", "the cached session belongs to another harness session");
195
202
  }
196
- if (Date.parse(cached.expires_at) > now()) return cached;
203
+ if (!force && Date.parse(cached.expires_at) > now()) return cached;
204
+ const attestation = attest && typeof attest.host === "string" && attest.host && typeof attest.worktree === "string" && attest.worktree
205
+ ? Object.fromEntries(Object.entries({
206
+ host: attest.host,
207
+ worktree: attest.worktree,
208
+ machine_uuid: attest.machine_uuid,
209
+ branch: attest.branch,
210
+ }).filter(([, value]) => typeof value === "string" && value))
211
+ : {};
197
212
  const response = await call("renew_agent_session", {
198
213
  session_id: cached.session_id,
199
214
  agent_id: cached.agent_id,
200
215
  harness_session_id: harness,
216
+ ...attestation,
201
217
  }, { ...callOptions, ...(cached.tenant ? { tenant: cached.tenant } : {}) });
202
218
  if (!response?.ok || response.isError) {
203
219
  if (response?.auth) throw renewalError("renewal_unauthorized", "run `bb doctor --fix`, or `bb mcp setup` if the MCP key is missing");
@@ -215,14 +231,21 @@ export async function renewHarnessSession({
215
231
  || !(Date.parse(data.expires_at) > now())) {
216
232
  throw renewalError("session_renewal_failed", "renew_agent_session returned a different or unusable session");
217
233
  }
234
+ // BOT-3219: a re-attesting renewal reports ONLY its own verdict; an earlier
235
+ // registration's cached verdict must never stand in for a missing one.
236
+ const { stack_lease_capability: _priorVerdict, ...base } = cached;
218
237
  const state = {
219
- ...cached,
238
+ ...(attestation.host ? base : cached),
220
239
  agent_session_token: data.session_token,
221
240
  minted_at: new Date(now()).toISOString(),
222
241
  expires_at: new Date(Date.parse(data.expires_at)).toISOString(),
223
242
  ...(typeof data.session_token_generation === "string" && data.session_token_generation
224
243
  ? { session_token_generation: data.session_token_generation }
225
244
  : {}),
245
+ // BOT-3219: the re-attested verdict, cached so a plain `bb doctor` reports it.
246
+ ...(data.stack_lease_capability && typeof data.stack_lease_capability.status === "string"
247
+ ? { stack_lease_capability: { ...data.stack_lease_capability, checked_at: new Date(now()).toISOString() } }
248
+ : {}),
226
249
  };
227
250
  await writeState(root, state);
228
251
  return state;
@@ -457,7 +457,14 @@ export async function readStatus({
457
457
  // BOT-3213: the project this session coordinates carries its counts by state.
458
458
  if (coordinator && coordinator.linear_project_id === epic.id) {
459
459
  epic.role = "coordinator";
460
- if (coordinator.counts) epic.counts = coordinator.counts;
460
+ if (coordinator.counts) {
461
+ // The counts are the project's own (canceled and duplicate excluded, as
462
+ // Linear does); v_epics counts duplicates, so the row follows the counts.
463
+ epic.counts = coordinator.counts;
464
+ epic.done = coordinator.counts.done;
465
+ epic.total = coordinator.counts.total;
466
+ epic.percent = epic.total ? Math.round((100 * epic.done) / epic.total) : 0;
467
+ }
461
468
  if (!epic.identifier && PROJECT_IDENTIFIER.test(coordinator.identifier || "")) epic.identifier = coordinator.identifier;
462
469
  }
463
470
  }