baro-ai 0.57.0 → 0.57.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
@@ -22243,7 +22243,7 @@ var require_websocket_server = __commonJS({
22243
22243
 
22244
22244
  // ../baro-memory/dist/vectra-store.js
22245
22245
  import { LocalIndex } from "vectra";
22246
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, existsSync as existsSync3, renameSync, rmSync as rmSync2, readdirSync, statSync as statSync2, lstatSync } from "fs";
22246
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync3, existsSync as existsSync3, renameSync, rmSync as rmSync2, readdirSync as readdirSync2, statSync as statSync2, lstatSync } from "fs";
22247
22247
  import { join as join3 } from "path";
22248
22248
  import { tmpdir as tmpdir2, homedir } from "os";
22249
22249
  async function createMemoryStore(config) {
@@ -22259,9 +22259,9 @@ async function createMemoryStore(config) {
22259
22259
  }
22260
22260
  const sessionPath = cfg.sessionPath || join3(tmpdir2(), `baro-memory-${process.pid}-${Date.now()}`);
22261
22261
  validateSessionPath(sessionPath);
22262
- mkdirSync2(sessionPath, { recursive: true });
22262
+ mkdirSync3(sessionPath, { recursive: true });
22263
22263
  const indexPath = join3(sessionPath, "index");
22264
- mkdirSync2(indexPath, { recursive: true });
22264
+ mkdirSync3(indexPath, { recursive: true });
22265
22265
  const index = new LocalIndex(indexPath);
22266
22266
  if (!await index.isIndexCreated()) {
22267
22267
  await index.createIndex({ version: 1 });
@@ -22294,7 +22294,7 @@ function pruneOldSessions(sessionsDir) {
22294
22294
  if (!existsSync3(sessionsDir))
22295
22295
  return;
22296
22296
  const now = Date.now();
22297
- for (const entry of readdirSync(sessionsDir)) {
22297
+ for (const entry of readdirSync2(sessionsDir)) {
22298
22298
  if (!entry.startsWith("run-"))
22299
22299
  continue;
22300
22300
  const entryPath = join3(sessionsDir, entry);
@@ -22696,7 +22696,7 @@ import { existsSync as existsSync6 } from "fs";
22696
22696
  import { resolve as resolve3 } from "path";
22697
22697
 
22698
22698
  // ../baro-orchestrator/src/orchestrate.ts
22699
- import { mkdirSync as mkdirSync5 } from "fs";
22699
+ import { mkdirSync as mkdirSync6 } from "fs";
22700
22700
  import { dirname as dirname3, join as join6 } from "path";
22701
22701
 
22702
22702
  // ../../node_modules/openai/internal/tslib.mjs
@@ -40075,12 +40075,23 @@ function extractStderr(e2) {
40075
40075
 
40076
40076
  // ../baro-orchestrator/src/worktree.ts
40077
40077
  import { execFile as execFile2 } from "child_process";
40078
- import { existsSync, rmSync, symlinkSync } from "fs";
40078
+ import { existsSync, mkdirSync, readdirSync, rmSync, symlinkSync } from "fs";
40079
40079
  import { tmpdir } from "os";
40080
40080
  import { join } from "path";
40081
40081
  import { promisify as promisify3 } from "util";
40082
40082
  var exec2 = promisify3(execFile2);
40083
- var LINKED_DEP_DIRS = ["node_modules", ".venv", "vendor"];
40083
+ var DEP_DIR_BY_MANIFEST = {
40084
+ "package.json": "node_modules",
40085
+ "pnpm-workspace.yaml": "node_modules",
40086
+ "pyproject.toml": ".venv",
40087
+ "requirements.txt": ".venv",
40088
+ "setup.py": ".venv",
40089
+ Pipfile: ".venv",
40090
+ "composer.json": "vendor"
40091
+ };
40092
+ var DEP_DIR_NAMES = /* @__PURE__ */ new Set(["node_modules", ".venv", "vendor"]);
40093
+ var SCAN_SKIP = /* @__PURE__ */ new Set(["node_modules", ".git", ".venv", "vendor", "dist", "build", "target", ".next", "out", "coverage"]);
40094
+ var SCAN_DEPTH = 3;
40084
40095
  var WorktreeManager = class {
40085
40096
  constructor(repoRoot, gate, runId, opts = {}) {
40086
40097
  this.repoRoot = repoRoot;
@@ -40264,15 +40275,56 @@ var WorktreeManager = class {
40264
40275
  }
40265
40276
  }
40266
40277
  // ── internals ────────────────────────────────────────────────────
40278
+ /**
40279
+ * Package roots in the repo (root + nested), each mapped to the dep dir its stack
40280
+ * installs into. Computed once per run and cached. Manifest-driven so it works on
40281
+ * any stack and finds monorepo subpackages (e.g. `frontend` → node_modules).
40282
+ */
40283
+ depLocs;
40284
+ depLocations() {
40285
+ if (this.depLocs) return this.depLocs;
40286
+ const out = [];
40287
+ const seen = /* @__PURE__ */ new Set();
40288
+ const scan = (rel, depth) => {
40289
+ let entries;
40290
+ try {
40291
+ entries = readdirSync(join(this.repoRoot, rel) || this.repoRoot, { withFileTypes: true });
40292
+ } catch {
40293
+ return;
40294
+ }
40295
+ const record = (dir) => {
40296
+ const key = `${rel}|${dir}`;
40297
+ if (!seen.has(key)) {
40298
+ seen.add(key);
40299
+ out.push({ rel, dir });
40300
+ }
40301
+ };
40302
+ for (const e2 of entries) {
40303
+ if (e2.isFile() && DEP_DIR_BY_MANIFEST[e2.name]) record(DEP_DIR_BY_MANIFEST[e2.name]);
40304
+ else if (e2.isDirectory() && DEP_DIR_NAMES.has(e2.name)) record(e2.name);
40305
+ }
40306
+ if (depth <= 0) return;
40307
+ for (const e2 of entries) {
40308
+ if (e2.isDirectory() && !SCAN_SKIP.has(e2.name) && !e2.name.startsWith(".")) {
40309
+ scan(rel ? join(rel, e2.name) : e2.name, depth - 1);
40310
+ }
40311
+ }
40312
+ };
40313
+ scan("", SCAN_DEPTH);
40314
+ this.depLocs = out;
40315
+ return out;
40316
+ }
40267
40317
  symlinkDepDirs(worktreePath) {
40268
- for (const dir of LINKED_DEP_DIRS) {
40269
- const src = join(this.repoRoot, dir);
40270
- const dest = join(worktreePath, dir);
40271
- if (!existsSync(src) || existsSync(dest)) continue;
40318
+ for (const { rel, dir } of this.depLocations()) {
40319
+ const shared = join(this.repoRoot, rel, dir);
40320
+ const dest = join(worktreePath, rel, dir);
40321
+ if (existsSync(dest)) continue;
40272
40322
  try {
40273
- symlinkSync(src, dest, "dir");
40323
+ if (!existsSync(shared)) mkdirSync(shared, { recursive: true });
40324
+ mkdirSync(join(worktreePath, rel), { recursive: true });
40325
+ symlinkSync(shared, dest, "dir");
40274
40326
  } catch (e2) {
40275
- this.log(`could not symlink ${dir} into worktree (${errMsg(e2)})`);
40327
+ this.log(`could not symlink ${join(rel, dir)} into worktree (${errMsg(e2)})`);
40276
40328
  }
40277
40329
  }
40278
40330
  }
@@ -40301,7 +40353,8 @@ var WorktreeManager = class {
40301
40353
  );
40302
40354
  return;
40303
40355
  }
40304
- await execQuiet("git", ["reset", "-q", "--", ...LINKED_DEP_DIRS], worktreePath);
40356
+ const resetSpecs = this.depLocations().map(({ rel, dir }) => join(rel, dir));
40357
+ if (resetSpecs.length) await execQuiet("git", ["reset", "-q", "--", ...resetSpecs], worktreePath);
40305
40358
  let staged = [];
40306
40359
  let diffFailed = false;
40307
40360
  try {
@@ -40315,9 +40368,7 @@ var WorktreeManager = class {
40315
40368
  `WARNING: could not inspect staged changes for story ${storyId} (${errMsg(e2)}); committing whatever is staged`
40316
40369
  );
40317
40370
  }
40318
- const depStaged = staged.filter(
40319
- (p) => LINKED_DEP_DIRS.some((d) => p === d || p.startsWith(`${d}/`))
40320
- );
40371
+ const depStaged = staged.filter((p) => p.split("/").some((seg) => DEP_DIR_NAMES.has(seg)));
40321
40372
  if (depStaged.length > 0) {
40322
40373
  this.log(
40323
40374
  `WARNING: could not keep dep dirs [${depStaged.join(", ")}] out of story ${storyId}'s auto-commit; skipping it to avoid committing symlinks`
@@ -40577,7 +40628,7 @@ function formatRoute(route) {
40577
40628
  }
40578
40629
 
40579
40630
  // ../baro-orchestrator/src/participants/auditor.ts
40580
- import { appendFileSync, mkdirSync } from "fs";
40631
+ import { appendFileSync, mkdirSync as mkdirSync2 } from "fs";
40581
40632
  import { dirname } from "path";
40582
40633
 
40583
40634
  // ../baro-orchestrator/src/semantic-events.ts
@@ -40642,7 +40693,7 @@ var Auditor = class extends BaseObserver {
40642
40693
  this.skipStreamChunks = opts.skipStreamChunks ?? true;
40643
40694
  this.filter = opts.filter;
40644
40695
  try {
40645
- mkdirSync(dirname(this.path), { recursive: true });
40696
+ mkdirSync2(dirname(this.path), { recursive: true });
40646
40697
  } catch (e2) {
40647
40698
  this.disable(`mkdir failed: ${e2?.message ?? String(e2)}`);
40648
40699
  }
@@ -43561,13 +43612,13 @@ function tokenizeHints(prompt) {
43561
43612
  }
43562
43613
 
43563
43614
  // ../baro-orchestrator/src/participants/memory-librarian.ts
43564
- import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync3 } from "fs";
43615
+ import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync4 } from "fs";
43565
43616
  import { join as join4 } from "path";
43566
43617
  var DEBUG = process.env.BARO_DEBUG?.includes("memory") ?? false;
43567
43618
  var LOG_DIR = join4(process.env.HOME || "/tmp", ".baro", "runs");
43568
43619
  var LOG_FILE = join4(LOG_DIR, `memory-${Date.now()}.log`);
43569
43620
  try {
43570
- mkdirSync3(LOG_DIR, { recursive: true });
43621
+ mkdirSync4(LOG_DIR, { recursive: true });
43571
43622
  } catch {
43572
43623
  }
43573
43624
  var stats = {
@@ -48089,7 +48140,7 @@ async function orchestrate(config) {
48089
48140
  );
48090
48141
  }
48091
48142
  if (config.auditLogPath) {
48092
- mkdirSync5(dirname3(config.auditLogPath), { recursive: true });
48143
+ mkdirSync6(dirname3(config.auditLogPath), { recursive: true });
48093
48144
  new Auditor({ path: config.auditLogPath }).join(env);
48094
48145
  }
48095
48146
  if (config.extraParticipants) {