baro-ai 0.59.1 → 0.59.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/dist/runner.mjs CHANGED
@@ -3734,7 +3734,7 @@ var url = process.env.CONTROL_URL ?? "wss://api.baro.jigjoy.ai";
3734
3734
  var token = process.env.RUNNER_TOKEN;
3735
3735
  var httpBase = url.replace(/^ws/, "http").replace(/\/+$/, "");
3736
3736
  var credsPath = join(homedir(), ".baro", "credentials.json");
3737
- var VERSION = "0.59.1";
3737
+ var VERSION = "0.59.2";
3738
3738
  var updateCachePath = join(homedir(), ".baro", "update-check.json");
3739
3739
  function semverLt(a, b) {
3740
3740
  const pa = a.split(".").map(Number);
@@ -3882,6 +3882,7 @@ async function runGoal(d, emit, signal) {
3882
3882
  let passed = 0;
3883
3883
  let failed = 0;
3884
3884
  let doneSuccess = null;
3885
+ let lastErr = "";
3885
3886
  let stderrTail = "";
3886
3887
  let buf = "";
3887
3888
  child.stdout?.on("data", (chunk) => {
@@ -3903,6 +3904,11 @@ async function runGoal(d, emit, signal) {
3903
3904
  if (ev.type === "story_complete") passed++;
3904
3905
  else if (ev.type === "story_error") failed++;
3905
3906
  else if (ev.type === "done") doneSuccess = !!ev.success;
3907
+ const d2 = ev.data ?? {};
3908
+ const msg = d2.error ?? d2.message ?? ev.error;
3909
+ if (typeof msg === "string" && msg.trim() && (String(ev.type).includes("error") || String(ev.type).includes("fail") || ev.type === "done" && ev.success === false)) {
3910
+ lastErr = msg.trim();
3911
+ }
3906
3912
  }
3907
3913
  });
3908
3914
  child.stderr?.on("data", (chunk) => {
@@ -3911,13 +3917,15 @@ async function runGoal(d, emit, signal) {
3911
3917
  signal.addEventListener("abort", () => child.kill("SIGTERM"));
3912
3918
  child.on("close", (code) => {
3913
3919
  const ok = doneSuccess ?? (code === 0 && failed === 0 && passed > 0);
3914
- const errTail = stderrTail.trim().split("\n").filter(Boolean).slice(-3).join(" \xB7 ").slice(-500);
3920
+ const goalLines = new Set(d.goal.split("\n").map((s) => s.trim()).filter(Boolean));
3921
+ const errTail = stderrTail.trim().split("\n").map((s) => s.trim()).filter((l) => l && l !== "User goal:" && !l.startsWith("User goal:") && !goalLines.has(l)).slice(-3).join(" \xB7 ").slice(-500);
3915
3922
  resolve({
3916
3923
  success: ok,
3917
3924
  durationSecs: secs(),
3918
3925
  storiesPassed: passed,
3919
3926
  storiesTotal: stories.size || passed + failed,
3920
- error: ok ? null : errTail || (doneSuccess === false ? "run reported failure" : `exit ${code}`)
3927
+ // Prefer the real reason from the stream, then cleaned stderr, then a fallback.
3928
+ error: ok ? null : lastErr || errTail || (doneSuccess === false ? "run reported failure" : `exit ${code} \u2014 the run ended without a result (is the claude/codex CLI signed in on this runner?)`)
3921
3929
  });
3922
3930
  });
3923
3931
  child.on("error", (e) => resolve({ success: false, durationSecs: secs(), error: e.message }));