baro-ai 0.71.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/cli.mjs CHANGED
@@ -43212,10 +43212,35 @@ function matchCommit(story, commits) {
43212
43212
  }
43213
43213
 
43214
43214
  // ../baro-orchestrator/src/tui-protocol.ts
43215
+ import { stdin } from "process";
43216
+ import { createInterface } from "readline";
43215
43217
  function emit(event) {
43216
43218
  const line = JSON.stringify(event) + "\n";
43217
43219
  process.stdout.write(line);
43218
43220
  }
43221
+ function subscribeCommands(handler) {
43222
+ const rl = createInterface({ input: stdin });
43223
+ rl.on("line", (line) => {
43224
+ const trimmed = line.trim();
43225
+ if (!trimmed) return;
43226
+ let cmd;
43227
+ try {
43228
+ cmd = JSON.parse(trimmed);
43229
+ } catch {
43230
+ return;
43231
+ }
43232
+ if (!cmd || typeof cmd !== "object" || typeof cmd.type !== "string") {
43233
+ return;
43234
+ }
43235
+ Promise.resolve(handler(cmd)).catch((err) => {
43236
+ process.stderr.write(
43237
+ `[tui-protocol] command handler error: ${err?.message ?? String(err)}
43238
+ `
43239
+ );
43240
+ });
43241
+ });
43242
+ return () => rl.close();
43243
+ }
43219
43244
 
43220
43245
  // ../baro-orchestrator/src/participants/git-coordinator.ts
43221
43246
  var GitCoordinator = class extends BaseObserver {
@@ -44353,7 +44378,7 @@ var Operator = class extends BaseObserver {
44353
44378
  AgentTargetedMessage.create({
44354
44379
  recipientId: cmd.storyId,
44355
44380
  text: cmd.message,
44356
- metadata: { source: "operator" }
44381
+ metadata: { source: cmd.source ?? "operator" }
44357
44382
  })
44358
44383
  );
44359
44384
  return;
@@ -48714,6 +48739,7 @@ async function orchestrate(config) {
48714
48739
  const operator = new Operator(config.operatorHooks ?? {});
48715
48740
  operator.setEnvironment(env);
48716
48741
  operator.join(env);
48742
+ config.onOperatorReady?.(operator);
48717
48743
  const useGit = config.withGit ?? await isInsideGitRepo(config.cwd);
48718
48744
  const gitGate = new GitGate();
48719
48745
  let baseSha = null;
@@ -49030,6 +49056,17 @@ function tokenizeForHints(text) {
49030
49056
  return out;
49031
49057
  }
49032
49058
 
49059
+ // ../baro-orchestrator/src/stdin-commands.ts
49060
+ function handleStdinCommand(cmd, ctx) {
49061
+ if (cmd.type !== "agent_message") return;
49062
+ const { id, text } = cmd;
49063
+ if (typeof id !== "string" || !id || typeof text !== "string" || !text.trim()) return;
49064
+ const operator = ctx.getOperator();
49065
+ if (!operator) return;
49066
+ operator.dispatch({ kind: "redirect", storyId: id, message: text, source: "user" });
49067
+ (ctx.emitEvent ?? emit)({ type: "story_log", id, line: `[you \u2192 ${id}] ${text}` });
49068
+ }
49069
+
49033
49070
  // ../baro-orchestrator/scripts/cli.ts
49034
49071
  function parseArgs2(argv) {
49035
49072
  const args = {
@@ -49287,9 +49324,16 @@ async function main() {
49287
49324
  `);
49288
49325
  process.exit(2);
49289
49326
  }
49327
+ let operatorRef = null;
49328
+ subscribeCommands((cmd) => {
49329
+ handleStdinCommand(cmd, { getOperator: () => operatorRef });
49330
+ });
49290
49331
  const config = {
49291
49332
  prdPath,
49292
49333
  cwd,
49334
+ onOperatorReady: (operator) => {
49335
+ operatorRef = operator;
49336
+ },
49293
49337
  parallel: args.parallel,
49294
49338
  timeoutSecs: args.timeout,
49295
49339
  overrideModel: args.model ?? null,