@botbuddy/cli 1.84.0 → 1.85.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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.85.1
4
+
5
+ - `bb bootstrap` connects in a reused worktree when you are signed in as the owner (BOT-3253): another session's stale cached session is retired with its own credential instead of failing with `agent_identity_required`, and a cached credential the server no longer accepts is left to expire. A session that is still live keeps its cache and waits, and the command names it and says what to do next.
6
+
7
+ ## 1.85.0
8
+
9
+ - `bb release-notes digest --release <version> --voice internal|external` prints one production release's notes as Markdown, JSON (the bbrn-digest-1 schema) or Slack Block Kit (`--format`), byte for byte as the API returns them when piped, so a GitHub Actions step can post it to your own Slack or email (BOT-3204). On a terminal, control characters in a note print as visible escapes. `--repository owner/name` names the repository when a version exists in more than one; `--json` prints the whole answer.
10
+
3
11
  ## 1.84.0
4
12
 
5
13
  - `bb wait` tells the staging suspect to act (BOT-3287): a wait ended because you were elected release manager says your change may have broken staging and to fix staging as a priority; a `staging-release` wake on a red train for the suspect PR says to call `claim_release_manager` now (seat open) or names the release manager (seat held); a wake with `reason: cancelled` says the run did not release your PR and how to re-arm with `after_run=<run_id>`.
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.84.0",
3
- "source_commit": "4122a36c869b9a83a460f5a22f35b893a4a72afc",
4
- "source_sha256": "b86a6b6fa46c92581ae1325ad301176dc3267137c3426c82a21a0b33c2bcca69",
2
+ "release_version": "1.85.1",
3
+ "source_commit": "686354d23b98bb6efdd2113834f98544bb169057",
4
+ "source_sha256": "b0d0b455d8d3c18fafdc66817cbbc62789b3ce0ae87184c32036a2a8ff2f1161",
5
5
  "target": "darwin-arm64",
6
- "sha256": "c19990b17a4a41f4fffe010584a544fa87ba597dd8b17f9f7efea98bb4f8fa3a"
6
+ "sha256": "119ce386d86f16bd2d084bf1f555a2752f8b5d9efbfb2744be999f953beb8eda"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.84.0",
3
- "source_commit": "4122a36c869b9a83a460f5a22f35b893a4a72afc",
4
- "source_sha256": "b86a6b6fa46c92581ae1325ad301176dc3267137c3426c82a21a0b33c2bcca69",
2
+ "release_version": "1.85.1",
3
+ "source_commit": "686354d23b98bb6efdd2113834f98544bb169057",
4
+ "source_sha256": "b0d0b455d8d3c18fafdc66817cbbc62789b3ce0ae87184c32036a2a8ff2f1161",
5
5
  "target": "linux-x64",
6
- "sha256": "f6d5ad986be0d473fea2bed4eb9ca5dcedc450b11ae0e0d798ea41f7bfe3d8bc"
6
+ "sha256": "474d3fc0ac7566916ef52cfe705fe46477f2e37e8267a1094a22564854c7c21d"
7
7
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "release_version": "1.84.0",
4
- "source_commit": "4122a36c869b9a83a460f5a22f35b893a4a72afc",
5
- "source_sha256": "b86a6b6fa46c92581ae1325ad301176dc3267137c3426c82a21a0b33c2bcca69",
3
+ "release_version": "1.85.1",
4
+ "source_commit": "686354d23b98bb6efdd2113834f98544bb169057",
5
+ "source_sha256": "b0d0b455d8d3c18fafdc66817cbbc62789b3ce0ae87184c32036a2a8ff2f1161",
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": "c19990b17a4a41f4fffe010584a544fa87ba597dd8b17f9f7efea98bb4f8fa3a",
11
+ "sha256": "119ce386d86f16bd2d084bf1f555a2752f8b5d9efbfb2744be999f953beb8eda",
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": "f6d5ad986be0d473fea2bed4eb9ca5dcedc450b11ae0e0d798ea41f7bfe3d8bc",
18
+ "sha256": "474d3fc0ac7566916ef52cfe705fe46477f2e37e8267a1094a22564854c7c21d",
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.84.0",
3
+ "version": "1.85.1",
4
4
  "description": "BotBuddy — Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
package/src/commands.mjs CHANGED
@@ -353,6 +353,8 @@ ${bold("EVIDENCE")} (${cyan("bb help evidence")})
353
353
  Publish a note to your team, or its external wording to customers
354
354
  release-notes withdraw <source_key>
355
355
  Take a note out of every feed (kept, never deleted)
356
+ release-notes digest --release <v> --voice internal|external
357
+ Print one release's notes as Markdown, JSON or Slack Block Kit
356
358
  release-notes grants list|add|remove
357
359
  Owners grant members the release-note submit or manage scope
358
360
  release-notes tags [group|add|retire|view]
@@ -50,12 +50,10 @@ export async function claudeHolderActive(holder, worktree, { env = process.env,
50
50
  // Returns false (never bind), true (bootstrap as is), or { aside } — another
51
51
  // holder's cache to move out of the way first. The bootstrap would otherwise
52
52
  // try to retire that BB session and discard the new one when it cannot: the
53
- // server refuses the retirement for a live session (which would end the waits
54
- // other sessions still run on its token), and refuses it for an EXPIRED one too
55
- // whenever the durable credential is an owner bearer, since close_session needs
56
- // an agent identity (BOT-3252: the band then stayed on "belongs to another
57
- // session" forever in a reused worktree). Set aside, a live session expires on
58
- // its own once nothing renews it; the file is kept for recovery.
53
+ // server refuses the retirement for a session that is live in BB (which would
54
+ // end the waits other sessions still run on its token), even when its Claude
55
+ // session has gone. Set aside, a live session expires on its own once nothing
56
+ // renews it; the file is kept for recovery.
59
57
  export async function bindable(cwd, harnessSessionId, now, holderActive) {
60
58
  let state;
61
59
  let root;
@@ -12,6 +12,7 @@ export const RELEASE_NOTES_USAGE = `Usage: bb release-notes submit <note.json> [
12
12
  bb release-notes withdraw <source_key> [--tenant <slug>] [--json]
13
13
  bb release-notes list [--tag <group>=<value>]... [--type <type>] [--state <state>] [--cursor <cursor>] [--json]
14
14
  bb release-notes get <source_key> [--json]
15
+ bb release-notes digest --release <version> --voice internal|external [--format markdown|json|slack] [--repository owner/name] [--json]
15
16
  bb release-notes grants list [--tenant <slug>] [--json]
16
17
  bb release-notes grants add <email> <submit|manage> [--tenant <slug>] [--json]
17
18
  bb release-notes grants remove <email> <submit|manage> [--tenant <slug>] [--json]
@@ -101,6 +102,18 @@ own sign-in. A value is retired, never deleted: notes that carry it keep it.
101
102
  --internal-only marks a group that is never shown externally (one-way).
102
103
  view --show shows the tag and its filter, --tag-only the tag, --hide neither.
103
104
 
105
+ Digest (BOT-3204). digest prints one production release's notes, exactly as
106
+ the API returns them (byte for byte when piped; on a terminal, control
107
+ characters print as visible escapes): markdown, json (the bbrn-digest-1
108
+ schema) or slack ({"messages": [...]}: each message is a Block Kit payload for
109
+ your own incoming webhook; BotBuddy posts nothing). voice internal is your
110
+ team's wording with source keys and pull requests; voice external holds only
111
+ published external wording and never falls back to internal text. A release
112
+ with no notes prints an explicit empty digest. --json prints the whole answer
113
+ (tenant, version, note_count, content_type, body). Refusals: release_unknown,
114
+ repository_required, release_not_shipped, no_previous_release,
115
+ release_range_unavailable, entitlement_missing, scope_missing.
116
+
104
117
  Exit codes: 0 stored or read · 1 refused or not found · 2 usage · 3 authentication · 5 BotBuddy unreachable.
105
118
 
106
119
  Viewer keys and origins (tenant owners, BOT-3158):
@@ -114,6 +127,8 @@ export async function cmdReleaseNotes(args, {
114
127
  call = callToolJson,
115
128
  log = console.log,
116
129
  errorLog = console.error,
130
+ write = (text) => process.stdout.write(text),
131
+ isTTY = process.stdout.isTTY === true,
117
132
  } = {}) {
118
133
  if (args.length === 0 || ["help", "--help", "-h"].includes(args[0])) {
119
134
  (args.length === 0 ? errorLog : log)(RELEASE_NOTES_USAGE);
@@ -128,6 +143,8 @@ export async function cmdReleaseNotes(args, {
128
143
  // BOT-3158: viewer keys and allowed origins.
129
144
  if (args[0] === "keys") return await cmdReleaseNotesKeys(args.slice(1), { resolveAuth, call, log, errorLog });
130
145
  if (args[0] === "origins") return await cmdReleaseNotesOrigins(args.slice(1), { resolveAuth, call, log, errorLog });
146
+ // BOT-3204: the per-release digest.
147
+ if (args[0] === "digest") return await cmdDigest(args.slice(1), { resolveAuth, call, log, errorLog, write, isTTY });
131
148
  const json = args.includes("--json");
132
149
  let rest = args.filter((a) => a !== "--json");
133
150
  // BOT-3260: --pack <pack.json>, anywhere after submit.
@@ -505,6 +522,57 @@ async function cmdPublish(action, argv, { resolveAuth, call, log, errorLog }) {
505
522
  return CALL_EXIT.OK;
506
523
  }
507
524
 
525
+ // ── BOT-3204: bb release-notes digest ─────────────────────────────────
526
+
527
+ const DIGEST_TOOL = "get_release_note_digest";
528
+ const DIGEST_FLAGS = { "--release": "release", "--voice": "voice", "--format": "format", "--repository": "repository" };
529
+
530
+ export async function cmdDigest(argv, { resolveAuth, call, log, errorLog, write, isTTY = false }) {
531
+ const json = argv.includes("--json");
532
+ const args = {};
533
+ for (let i = 0; i < argv.length; i++) {
534
+ const a = argv[i];
535
+ if (a === "--json") continue;
536
+ const key = DIGEST_FLAGS[a];
537
+ const v = argv[i + 1];
538
+ if (!key || !v || v.startsWith("--") || key in args) {
539
+ errorLog(RELEASE_NOTES_USAGE);
540
+ return 2;
541
+ }
542
+ args[key] = v;
543
+ i++;
544
+ }
545
+ if (!args.release || !args.voice) {
546
+ errorLog(RELEASE_NOTES_USAGE);
547
+ return 2;
548
+ }
549
+
550
+ let result;
551
+ try {
552
+ const resolved = await resolveAuth({ toolName: DIGEST_TOOL, preferSession: true });
553
+ result = resolved?.error || !resolved?.auth
554
+ ? { ok: false, auth: true }
555
+ : await call(DIGEST_TOOL, args, { auth: resolved.auth, signal: AbortSignal.timeout(60_000) });
556
+ } catch {
557
+ result = { ok: false, status: null };
558
+ }
559
+ const data = result?.data;
560
+ if (result?.ok && data?.ok === true && typeof data.body === "string") {
561
+ // Piped or redirected, the API's document is written unchanged: no
562
+ // trailing newline is added or removed. On a terminal, note text could
563
+ // carry control sequences, so they print as visible escapes (tabs kept).
564
+ if (json) log(JSON.stringify(data));
565
+ else write(isTTY ? data.body.split("\t").map(termClean).join("\t") : data.body);
566
+ return CALL_EXIT.OK;
567
+ }
568
+ if (result?.ok && data?.ok !== false) {
569
+ if (json) log(JSON.stringify({ ok: false, error: "receipt_unavailable" }));
570
+ errorLog("✗ BotBuddy did not return a digest. Retry the same command; a digest is a read and changes nothing.");
571
+ return CALL_EXIT.ERROR;
572
+ }
573
+ return printRefusalOrFailure(result, json, log, errorLog, "Nothing was changed.");
574
+ }
575
+
508
576
  // ── BOT-3166: bb release-notes list | get ──────────────────────────────
509
577
 
510
578
  function readUsage(errorLog) {
@@ -474,7 +474,20 @@ export async function bootstrapHarnessSession({
474
474
  }
475
475
  retired = confirm;
476
476
  }
477
- if (!retired?.ok || retired.isError) {
477
+ // BOT-3253: close_session needs an agent identity, so an owner sign-in is
478
+ // always refused here. The cached session's own bearer can retire it, and
479
+ // if_stale still protects a live holder. A bearer the server rejects is
480
+ // dead for every process reading this cache, so that session is left to
481
+ // expire on its own.
482
+ let leftToExpire = false;
483
+ if ((retired?.data?.error || retired?.error) === "agent_identity_required" && cached.session_token) {
484
+ const own = await call("close_session", cachedCloseArgs, {
485
+ auth: { "x-agent-api-key": cached.session_token },
486
+ }).catch((error) => ({ ok: false, error: error?.message }));
487
+ if (own?.auth && !own.code) leftToExpire = true;
488
+ else retired = own;
489
+ }
490
+ if (!leftToExpire && (!retired?.ok || retired.isError)) {
478
491
  try {
479
492
  await discardNewSession();
480
493
  } catch (discardError) {
@@ -482,8 +495,15 @@ export async function bootstrapHarnessSession({
482
495
  // orphan and fail closed (propagating any marker-write failure).
483
496
  await recordOrphanAndFail({ session, cwd: worktree, retirementError: discardError });
484
497
  }
485
- throw new Error(retired?.data?.error || retired?.error || "cached harness session is still live or could not be retired");
498
+ const refusal = retired?.data?.error || retired?.error;
499
+ if (refusal === "session_still_active") {
500
+ throw Object.assign(new Error(
501
+ `session_still_active: BB session ${cached.session_id} is still live and holds this worktree's session cache, so it was left running. Use another worktree, or retry once that session has ended.`,
502
+ ), { code: refusal });
503
+ }
504
+ throw new Error(refusal || "cached harness session is still live or could not be retired");
486
505
  }
506
+ replacedCachedSession = { session_id: cached.session_id, retired: !leftToExpire };
487
507
  await clearHarnessSession(cached.session_id, {
488
508
  cwd: worktree,
489
509
  sessionToken: cached.session_token,