baro-ai 0.62.0 → 0.64.0
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 +86 -26
- package/dist/cli.mjs.map +1 -1
- package/dist/runner.mjs +49 -1
- package/dist/runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -22243,8 +22243,8 @@ 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
|
|
22247
|
-
import { join as
|
|
22246
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync4, existsSync as existsSync3, renameSync, rmSync as rmSync2, readdirSync as readdirSync2, statSync as statSync2, lstatSync } from "fs";
|
|
22247
|
+
import { join as join4 } from "path";
|
|
22248
22248
|
import { tmpdir as tmpdir2, homedir } from "os";
|
|
22249
22249
|
async function createMemoryStore(config) {
|
|
22250
22250
|
const cfg = { ...DEFAULTS, ...config };
|
|
@@ -22257,23 +22257,23 @@ async function createMemoryStore(config) {
|
|
|
22257
22257
|
if (cfg.disabled) {
|
|
22258
22258
|
return new NoOpMemoryStore();
|
|
22259
22259
|
}
|
|
22260
|
-
const sessionPath = cfg.sessionPath ||
|
|
22260
|
+
const sessionPath = cfg.sessionPath || join4(tmpdir2(), `baro-memory-${process.pid}-${Date.now()}`);
|
|
22261
22261
|
validateSessionPath(sessionPath);
|
|
22262
|
-
|
|
22263
|
-
const indexPath =
|
|
22264
|
-
|
|
22262
|
+
mkdirSync4(sessionPath, { recursive: true });
|
|
22263
|
+
const indexPath = join4(sessionPath, "index");
|
|
22264
|
+
mkdirSync4(indexPath, { recursive: true });
|
|
22265
22265
|
const index = new LocalIndex(indexPath);
|
|
22266
22266
|
if (!await index.isIndexCreated()) {
|
|
22267
22267
|
await index.createIndex({ version: 1 });
|
|
22268
22268
|
}
|
|
22269
22269
|
const transformers = await import("@xenova/transformers");
|
|
22270
|
-
transformers.env.cacheDir = process.env.TRANSFORMERS_CACHE ||
|
|
22270
|
+
transformers.env.cacheDir = process.env.TRANSFORMERS_CACHE || join4(homedir(), ".baro", "models");
|
|
22271
22271
|
const { pipeline: pipeline2 } = transformers;
|
|
22272
22272
|
const extractor = await pipeline2("feature-extraction", cfg.embeddingModel);
|
|
22273
22273
|
return new VectraMemoryStore(index, extractor, sessionPath, cfg);
|
|
22274
22274
|
}
|
|
22275
22275
|
function validateSessionPath(sessionPath) {
|
|
22276
|
-
const resolved =
|
|
22276
|
+
const resolved = join4(sessionPath);
|
|
22277
22277
|
if (resolved.includes("..")) {
|
|
22278
22278
|
throw new Error(`Invalid session path (contains ..): ${resolved}`);
|
|
22279
22279
|
}
|
|
@@ -22297,7 +22297,7 @@ function pruneOldSessions(sessionsDir) {
|
|
|
22297
22297
|
for (const entry of readdirSync2(sessionsDir)) {
|
|
22298
22298
|
if (!entry.startsWith("run-"))
|
|
22299
22299
|
continue;
|
|
22300
|
-
const entryPath =
|
|
22300
|
+
const entryPath = join4(sessionsDir, entry);
|
|
22301
22301
|
try {
|
|
22302
22302
|
const stat2 = lstatSync(entryPath);
|
|
22303
22303
|
if (stat2.isSymbolicLink())
|
|
@@ -22354,10 +22354,10 @@ var init_vectra_store = __esm({
|
|
|
22354
22354
|
this.index = index;
|
|
22355
22355
|
this.extractor = extractor;
|
|
22356
22356
|
this.sessionPath = sessionPath;
|
|
22357
|
-
this.indexPath =
|
|
22358
|
-
this.indexFilePath =
|
|
22359
|
-
this.cachePath =
|
|
22360
|
-
this.lockPath =
|
|
22357
|
+
this.indexPath = join4(sessionPath, "index");
|
|
22358
|
+
this.indexFilePath = join4(this.indexPath, "index.json");
|
|
22359
|
+
this.cachePath = join4(sessionPath, "cache.json");
|
|
22360
|
+
this.lockPath = join4(sessionPath, "cache.lock");
|
|
22361
22361
|
this.config = config;
|
|
22362
22362
|
}
|
|
22363
22363
|
/**
|
|
@@ -22622,13 +22622,13 @@ ${result.content}
|
|
|
22622
22622
|
*/
|
|
22623
22623
|
saveCache(cache) {
|
|
22624
22624
|
try {
|
|
22625
|
-
|
|
22625
|
+
writeFileSync3(this.lockPath, String(process.pid), "utf-8");
|
|
22626
22626
|
const tmp = this.cachePath + `.${process.pid}.tmp`;
|
|
22627
|
-
|
|
22627
|
+
writeFileSync3(tmp, JSON.stringify(cache), "utf-8");
|
|
22628
22628
|
renameSync(tmp, this.cachePath);
|
|
22629
22629
|
} catch {
|
|
22630
22630
|
try {
|
|
22631
|
-
|
|
22631
|
+
writeFileSync3(this.cachePath, JSON.stringify(cache), "utf-8");
|
|
22632
22632
|
} catch {
|
|
22633
22633
|
}
|
|
22634
22634
|
} finally {
|
|
@@ -22696,8 +22696,8 @@ 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
|
|
22700
|
-
import { dirname as dirname3, join as
|
|
22699
|
+
import { mkdirSync as mkdirSync7 } from "fs";
|
|
22700
|
+
import { dirname as dirname3, join as join7 } from "path";
|
|
22701
22701
|
|
|
22702
22702
|
// ../../node_modules/openai/internal/tslib.mjs
|
|
22703
22703
|
function __classPrivateFieldSet(receiver, state, value, kind, f3) {
|
|
@@ -42634,6 +42634,8 @@ ${userPrompt}`;
|
|
|
42634
42634
|
|
|
42635
42635
|
// ../baro-orchestrator/src/participants/finalizer.ts
|
|
42636
42636
|
import { execFile as execFile4 } from "child_process";
|
|
42637
|
+
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
42638
|
+
import { join as join3 } from "path";
|
|
42637
42639
|
import { promisify as promisify5 } from "util";
|
|
42638
42640
|
var execFileAsync2 = promisify5(execFile4);
|
|
42639
42641
|
var Finalizer = class extends BaseObserver {
|
|
@@ -42800,6 +42802,7 @@ var Finalizer = class extends BaseObserver {
|
|
|
42800
42802
|
if (rec && !rec.title) rec.title = s2.title;
|
|
42801
42803
|
}
|
|
42802
42804
|
}
|
|
42805
|
+
await this.writeAndCommitAdrs(prd);
|
|
42803
42806
|
const commits = await this.collectCommitsSinceBase();
|
|
42804
42807
|
const orderedStories = this.orderStories();
|
|
42805
42808
|
const { passed, failed } = this.partition(orderedStories);
|
|
@@ -42840,6 +42843,45 @@ var Finalizer = class extends BaseObserver {
|
|
|
42840
42843
|
return null;
|
|
42841
42844
|
}
|
|
42842
42845
|
}
|
|
42846
|
+
// ─── ADRs ───────────────────────────────────────────────────────
|
|
42847
|
+
/**
|
|
42848
|
+
* Split the Architect's decision document into individual ADRs and write
|
|
42849
|
+
* each as adr/NNNN-slug.md, then commit them so they ship in the PR. The
|
|
42850
|
+
* trivial "no cross-cutting decisions needed" placeholder is skipped, and
|
|
42851
|
+
* an unchanged adr/ (re-run) produces no empty commit. Best-effort: any
|
|
42852
|
+
* failure is logged and never aborts finalization.
|
|
42853
|
+
*/
|
|
42854
|
+
async writeAndCommitAdrs(prd) {
|
|
42855
|
+
const doc = prd?.decisionDocument;
|
|
42856
|
+
if (!doc || !doc.trim()) return;
|
|
42857
|
+
const adrs = parseAdrs(doc);
|
|
42858
|
+
if (adrs.length === 0) return;
|
|
42859
|
+
try {
|
|
42860
|
+
const dir = join3(this.opts.cwd, "adr");
|
|
42861
|
+
mkdirSync3(dir, { recursive: true });
|
|
42862
|
+
for (const a of adrs) {
|
|
42863
|
+
const num = a.num.padStart(4, "0");
|
|
42864
|
+
writeFileSync2(join3(dir, `${num}-${slugify(a.title)}.md`), `# ADR-${num}: ${a.title}
|
|
42865
|
+
|
|
42866
|
+
${a.body}
|
|
42867
|
+
`);
|
|
42868
|
+
}
|
|
42869
|
+
await execFileAsync2("git", ["add", "adr"], { cwd: this.opts.cwd });
|
|
42870
|
+
try {
|
|
42871
|
+
await execFileAsync2(
|
|
42872
|
+
"git",
|
|
42873
|
+
["commit", "-m", `docs: architecture decision records (${adrs.length})
|
|
42874
|
+
|
|
42875
|
+
${BARO_COAUTHOR_TRAILER}`],
|
|
42876
|
+
{ cwd: this.opts.cwd }
|
|
42877
|
+
);
|
|
42878
|
+
this.log(`[finalizer] wrote ${adrs.length} ADR(s) to adr/`);
|
|
42879
|
+
} catch {
|
|
42880
|
+
}
|
|
42881
|
+
} catch (e2) {
|
|
42882
|
+
this.log(`[finalizer] could not write ADRs: ${e2.message}`);
|
|
42883
|
+
}
|
|
42884
|
+
}
|
|
42843
42885
|
// ─── Story ordering & partitioning ──────────────────────────────
|
|
42844
42886
|
/**
|
|
42845
42887
|
* Stories returned in DAG order so the table reads top-down the same
|
|
@@ -43084,6 +43126,24 @@ var Finalizer = class extends BaseObserver {
|
|
|
43084
43126
|
}
|
|
43085
43127
|
}
|
|
43086
43128
|
};
|
|
43129
|
+
function parseAdrs(doc) {
|
|
43130
|
+
const adrs = [];
|
|
43131
|
+
let cur = null;
|
|
43132
|
+
for (const ln of doc.replace(/\r/g, "").split("\n")) {
|
|
43133
|
+
const m2 = ln.match(/^##\s+ADR-(\d+):\s*(.*)$/);
|
|
43134
|
+
if (m2) {
|
|
43135
|
+
if (cur) adrs.push(cur);
|
|
43136
|
+
cur = { num: m2[1], title: m2[2].trim(), body: [] };
|
|
43137
|
+
} else if (cur) {
|
|
43138
|
+
cur.body.push(ln);
|
|
43139
|
+
}
|
|
43140
|
+
}
|
|
43141
|
+
if (cur) adrs.push(cur);
|
|
43142
|
+
return adrs.filter((a) => !/no cross-cutting decisions/i.test(a.title)).map((a) => ({ num: a.num, title: a.title, body: a.body.join("\n").trim() }));
|
|
43143
|
+
}
|
|
43144
|
+
function slugify(s2) {
|
|
43145
|
+
return s2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "decision";
|
|
43146
|
+
}
|
|
43087
43147
|
function formatDuration(secs) {
|
|
43088
43148
|
if (secs < 60) return `${Math.round(secs)}s`;
|
|
43089
43149
|
const m2 = Math.floor(secs / 60);
|
|
@@ -43652,13 +43712,13 @@ function tokenizeHints(prompt) {
|
|
|
43652
43712
|
}
|
|
43653
43713
|
|
|
43654
43714
|
// ../baro-orchestrator/src/participants/memory-librarian.ts
|
|
43655
|
-
import { appendFileSync as appendFileSync2, mkdirSync as
|
|
43656
|
-
import { join as
|
|
43715
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync5 } from "fs";
|
|
43716
|
+
import { join as join5 } from "path";
|
|
43657
43717
|
var DEBUG = process.env.BARO_DEBUG?.includes("memory") ?? false;
|
|
43658
|
-
var LOG_DIR =
|
|
43659
|
-
var LOG_FILE =
|
|
43718
|
+
var LOG_DIR = join5(process.env.HOME || "/tmp", ".baro", "runs");
|
|
43719
|
+
var LOG_FILE = join5(LOG_DIR, `memory-${Date.now()}.log`);
|
|
43660
43720
|
try {
|
|
43661
|
-
|
|
43721
|
+
mkdirSync5(LOG_DIR, { recursive: true });
|
|
43662
43722
|
} catch {
|
|
43663
43723
|
}
|
|
43664
43724
|
var stats = {
|
|
@@ -48191,7 +48251,7 @@ async function orchestrate(config) {
|
|
|
48191
48251
|
);
|
|
48192
48252
|
}
|
|
48193
48253
|
if (config.auditLogPath) {
|
|
48194
|
-
|
|
48254
|
+
mkdirSync7(dirname3(config.auditLogPath), { recursive: true });
|
|
48195
48255
|
new Auditor({ path: config.auditLogPath }).join(env);
|
|
48196
48256
|
}
|
|
48197
48257
|
if (config.extraParticipants) {
|
|
@@ -48217,8 +48277,8 @@ async function orchestrate(config) {
|
|
|
48217
48277
|
const useLibrarian = config.withLibrarian ?? true;
|
|
48218
48278
|
const useSentry = config.withSentry ?? true;
|
|
48219
48279
|
const useMemory = config.withMemory ?? true;
|
|
48220
|
-
const sessionsDir =
|
|
48221
|
-
const memorySessionPath = useMemory ?
|
|
48280
|
+
const sessionsDir = join7(process.env.HOME || "/tmp", ".baro", "sessions");
|
|
48281
|
+
const memorySessionPath = useMemory ? join7(sessionsDir, runId, "memory") : void 0;
|
|
48222
48282
|
if (useMemory) {
|
|
48223
48283
|
try {
|
|
48224
48284
|
const { pruneOldSessions: pruneOldSessions2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
|