@botbuddy/cli 1.63.0 → 1.63.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.
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.63.0",
3
- "source_commit": "cfcfef9b5adb90a7a7dfb2fd8cfad0206464149a",
4
- "source_sha256": "9f30dd9147ad173965dfc2a5f1c8b209c32d760a82c3edd6cbf560108e95a5f0",
2
+ "release_version": "1.63.2",
3
+ "source_commit": "939471e66dbf29af8577cc67e98eda0f40f4987d",
4
+ "source_sha256": "06cbf9386642c6a6a9e3382470973e5ac6f31212986237344ff75ce9ee01a483",
5
5
  "target": "darwin-arm64",
6
- "sha256": "5d57767abb24be43ba64e17b57d9aa396c4149f4b89101e6a0346da57ec5ea41"
6
+ "sha256": "7d1b100551b99a4293fd52a070f82fedcc464628a92aa8148b3d2ca80be43774"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "release_version": "1.63.0",
3
- "source_commit": "cfcfef9b5adb90a7a7dfb2fd8cfad0206464149a",
4
- "source_sha256": "9f30dd9147ad173965dfc2a5f1c8b209c32d760a82c3edd6cbf560108e95a5f0",
2
+ "release_version": "1.63.2",
3
+ "source_commit": "939471e66dbf29af8577cc67e98eda0f40f4987d",
4
+ "source_sha256": "06cbf9386642c6a6a9e3382470973e5ac6f31212986237344ff75ce9ee01a483",
5
5
  "target": "linux-x64",
6
- "sha256": "33e0e6ba075a7486a02e4a3638bce10e1df41ddfe8315685e285cf144a149ea7"
6
+ "sha256": "dc2005642302fbd4192ef944716095b46f03bafb0f46d02c83531fdff577c12f"
7
7
  }
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schema_version": 1,
3
- "release_version": "1.63.0",
4
- "source_commit": "cfcfef9b5adb90a7a7dfb2fd8cfad0206464149a",
5
- "source_sha256": "9f30dd9147ad173965dfc2a5f1c8b209c32d760a82c3edd6cbf560108e95a5f0",
3
+ "release_version": "1.63.2",
4
+ "source_commit": "939471e66dbf29af8577cc67e98eda0f40f4987d",
5
+ "source_sha256": "06cbf9386642c6a6a9e3382470973e5ac6f31212986237344ff75ce9ee01a483",
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": "5d57767abb24be43ba64e17b57d9aa396c4149f4b89101e6a0346da57ec5ea41",
11
+ "sha256": "7d1b100551b99a4293fd52a070f82fedcc464628a92aa8148b3d2ca80be43774",
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": "33e0e6ba075a7486a02e4a3638bce10e1df41ddfe8315685e285cf144a149ea7",
18
+ "sha256": "dc2005642302fbd4192ef944716095b46f03bafb0f46d02c83531fdff577c12f",
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.63.0",
3
+ "version": "1.63.2",
4
4
  "description": "BotBuddy \u2014 Swarm coordination CLI for multi-agent workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,6 +10,7 @@ import { WaitCheckpointError } from "./wait-checkpoint.mjs";
10
10
  const MAX_ARTIFACT_BYTES = 256 * 1024;
11
11
  const MAX_RECEIPT_BYTES = 64 * 1024;
12
12
  const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
13
+ const COMMAND_STATUSES = new Set(["success", "failure", "cancelled", "timed_out", "owner_lost"]);
13
14
  const TERMINAL_OUTCOMES = new Set(["matched", "timeout", "error", "superseded", "lease_lost", "abandoned", "cancelled"]);
14
15
 
15
16
  // Persisted != delivered. Await the stream callback before exiting, including
@@ -73,16 +74,37 @@ async function receiptFromArtifact(path) {
73
74
  const buffer = Buffer.alloc(MAX_ARTIFACT_BYTES + 1);
74
75
  const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
75
76
  if (bytesRead > MAX_ARTIFACT_BYTES) throw new Error("unbounded artifact");
76
- const receipts = [];
77
- for (const line of buffer.subarray(0, bytesRead).toString("utf8").split(/\r?\n/)) {
78
- if (!line.trimStart().startsWith("{")) continue;
79
- let value;
80
- try { value = JSON.parse(line); } catch { continue; }
81
- if (value?.schema_version === 1 && typeof value.outcome === "string") receipts.push(value);
77
+ const content = buffer.subarray(0, bytesRead).toString("utf8");
78
+ let values;
79
+ try { values = [JSON.parse(content)]; }
80
+ catch {
81
+ values = [];
82
+ for (const line of content.split(/\r?\n/)) {
83
+ if (!line.trimStart().startsWith("{")) continue;
84
+ // A partial JSON document alongside a receipt is ambiguous. In
85
+ // particular, never ignore a pretty command receipt and accept a later
86
+ // wait line from the same artifact.
87
+ values.push(JSON.parse(line));
88
+ }
82
89
  }
90
+ const receipts = values.filter((value) => value?.schema_version === 1 &&
91
+ (typeof value.outcome === "string" || (typeof value.run_id === "string" && typeof value.status === "string")));
83
92
  if (receipts.length !== 1) throw new Error("expected exactly one receipt");
84
- return receipts[0];
85
- } catch {
93
+ const [receipt] = receipts;
94
+ if (!receipt.outcome && UUID.test(receipt.run_id) && COMMAND_STATUSES.has(receipt.status)) {
95
+ // A diagnostic, never evidence that this caller owns the command or that
96
+ // its workload passed. Only a validated UUID may enter recovery argv;
97
+ // never echo command text, logs, paths, or recovery_command from the file.
98
+ const recovery = `Run bb run inspect ${receipt.run_id} from the owning checkout; preserve the command receipt and read its bounded_log for the workload verdict. Do not rerun unchanged validation.`;
99
+ const error = new WaitCheckpointError("wait_result_wrong_artifact", `This is a command-run receipt, not a bb wait receipt. ${recovery}`);
100
+ error.recoveryArgv = ["run", "inspect", receipt.run_id];
101
+ error.recovery = recovery;
102
+ throw error;
103
+ }
104
+ if (typeof receipt.outcome !== "string") throw new Error("not a wait receipt");
105
+ return receipt;
106
+ } catch (error) {
107
+ if (error instanceof WaitCheckpointError) throw error;
86
108
  // Never echo arbitrary artifact contents (which may include credentials).
87
109
  throw new WaitCheckpointError("wait_observation_gap", "completion artifact must contain exactly one bounded terminal receipt");
88
110
  } finally { await handle?.close(); }
package/src/wait.mjs CHANGED
@@ -241,7 +241,8 @@ SUBCOMMANDS (saved waits live in this worktree's .botbuddy/waits/)
241
241
  bb wait result [<local_wait_id>] [--from-file <path> --exit-code <n>]
242
242
  read a terminal receipt without re-arming or acknowledging;
243
243
  --from-file validates redirected output AFTER the original
244
- command exits (see EXAMPLES)
244
+ wait command exits (see EXAMPLES). Command-run .receipt.json files
245
+ belong to bb run inspect <run_id>, not bb wait result.
245
246
  bb wait resume <local_wait_id> recover one explicitly named saved wait
246
247
  bb wait cancel <local_wait_id> explicitly stop one saved wait
247
248
  bb wait acknowledge <local_wait_id> mark one saved terminal receipt read (after acting on it)