baro-ai 0.72.0 → 0.72.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/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.72.0";
3737
+ var VERSION = "0.72.1";
3738
3738
  var updateCachePath = join(homedir(), ".baro", "update-check.json");
3739
3739
  function semverLt(a, b) {
3740
3740
  const pa = a.split(".").map(Number);
@@ -3915,8 +3915,11 @@ async function runGoal(d, emit, signal) {
3915
3915
  const child = spawn(
3916
3916
  baroBin,
3917
3917
  ["--headless", d.goal, "--cwd", cwd, "--llm", d.route?.backend ?? "claude", "--parallel", String(d.parallel), "--timeout", String(d.timeoutSecs), ...d.quick ? ["--quick"] : [], ...d.followUp ? ["--continue"] : []],
3918
- { cwd, env, stdio: ["ignore", "pipe", "pipe"] }
3918
+ // stdin is piped: baro --headless forwards JSON command lines
3919
+ // (agent_message) into the orchestrator's stdin lane.
3920
+ { cwd, env, stdio: ["pipe", "pipe", "pipe"] }
3919
3921
  );
3922
+ activeChild = child;
3920
3923
  const started = Date.now();
3921
3924
  const secs = () => Math.max(1, Math.round((Date.now() - started) / 1e3));
3922
3925
  const stories = /* @__PURE__ */ new Set();
@@ -3958,6 +3961,7 @@ async function runGoal(d, emit, signal) {
3958
3961
  });
3959
3962
  signal.addEventListener("abort", () => child.kill("SIGTERM"));
3960
3963
  child.on("close", (code) => {
3964
+ if (activeChild === child) activeChild = null;
3961
3965
  const ok = doneSuccess ?? (code === 0 && failed === 0 && passed > 0);
3962
3966
  const goalLines = new Set(d.goal.split("\n").map((s) => s.trim()).filter(Boolean));
3963
3967
  const isNoise = (l) => /no stdin data received|redirect stdin explicitly|proceeding without it/i.test(l);
@@ -4028,6 +4032,7 @@ ${fails || r.out.slice(-500)}`);
4028
4032
  var rejected;
4029
4033
  var currentWs = null;
4030
4034
  var inflight = /* @__PURE__ */ new Map();
4035
+ var activeChild = null;
4031
4036
  var send = (m) => {
4032
4037
  if (currentWs?.readyState === import_websocket.default.OPEN) currentWs.send(encode(m));
4033
4038
  };
@@ -4040,6 +4045,13 @@ function handleMessage(m) {
4040
4045
  send({ t: "pong", ts: m.ts });
4041
4046
  } else if (m.t === "cancel") {
4042
4047
  inflight.get(m.storyId)?.abort();
4048
+ } else if (m.t === "agent_message") {
4049
+ const { storyId, text } = m;
4050
+ const stdin = activeChild?.stdin;
4051
+ if (stdin && stdin.writable && !stdin.destroyed) {
4052
+ stdin.write(`${JSON.stringify({ type: "agent_message", id: storyId, text })}
4053
+ `);
4054
+ }
4043
4055
  } else if (m.t === "dispatch_run") {
4044
4056
  const d = m;
4045
4057
  if (inflight.has(d.runId)) return;