baro-ai 0.131.0 → 0.132.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 +401 -290
- package/dist/cli.mjs.map +1 -1
- package/dist/runner.mjs +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -30070,8 +30070,8 @@ var require_cross_spawn = __commonJS({
|
|
|
30070
30070
|
|
|
30071
30071
|
// ../baro-memory/dist/vectra-store.js
|
|
30072
30072
|
import { LocalIndex } from "vectra";
|
|
30073
|
-
import { readFileSync as readFileSync17, writeFileSync as writeFileSync8, mkdirSync as mkdirSync11, existsSync as
|
|
30074
|
-
import { join as
|
|
30073
|
+
import { readFileSync as readFileSync17, writeFileSync as writeFileSync8, mkdirSync as mkdirSync11, existsSync as existsSync17, renameSync as renameSync5, rmSync as rmSync4, readdirSync as readdirSync9, statSync as statSync8, lstatSync as lstatSync5 } from "fs";
|
|
30074
|
+
import { join as join26 } from "path";
|
|
30075
30075
|
import { tmpdir as tmpdir8, homedir as homedir7 } from "os";
|
|
30076
30076
|
async function createMemoryStore(config2) {
|
|
30077
30077
|
const cfg = { ...DEFAULTS, ...config2 };
|
|
@@ -30084,23 +30084,23 @@ async function createMemoryStore(config2) {
|
|
|
30084
30084
|
if (cfg.disabled) {
|
|
30085
30085
|
return new NoOpMemoryStore();
|
|
30086
30086
|
}
|
|
30087
|
-
const sessionPath = cfg.sessionPath ||
|
|
30087
|
+
const sessionPath = cfg.sessionPath || join26(tmpdir8(), `baro-memory-${process.pid}-${Date.now()}`);
|
|
30088
30088
|
validateSessionPath(sessionPath);
|
|
30089
30089
|
mkdirSync11(sessionPath, { recursive: true });
|
|
30090
|
-
const indexPath =
|
|
30090
|
+
const indexPath = join26(sessionPath, "index");
|
|
30091
30091
|
mkdirSync11(indexPath, { recursive: true });
|
|
30092
30092
|
const index = new LocalIndex(indexPath);
|
|
30093
30093
|
if (!await index.isIndexCreated()) {
|
|
30094
30094
|
await index.createIndex({ version: 1 });
|
|
30095
30095
|
}
|
|
30096
30096
|
const transformers = await import("@xenova/transformers");
|
|
30097
|
-
transformers.env.cacheDir = process.env.TRANSFORMERS_CACHE ||
|
|
30097
|
+
transformers.env.cacheDir = process.env.TRANSFORMERS_CACHE || join26(homedir7(), ".baro", "models");
|
|
30098
30098
|
const { pipeline: pipeline2 } = transformers;
|
|
30099
30099
|
const extractor = await pipeline2("feature-extraction", cfg.embeddingModel);
|
|
30100
30100
|
return new VectraMemoryStore(index, extractor, sessionPath, cfg);
|
|
30101
30101
|
}
|
|
30102
30102
|
function validateSessionPath(sessionPath) {
|
|
30103
|
-
const resolved =
|
|
30103
|
+
const resolved = join26(sessionPath);
|
|
30104
30104
|
if (resolved.includes("..")) {
|
|
30105
30105
|
throw new Error(`Invalid session path (contains ..): ${resolved}`);
|
|
30106
30106
|
}
|
|
@@ -30118,13 +30118,13 @@ function validateSessionPath(sessionPath) {
|
|
|
30118
30118
|
}
|
|
30119
30119
|
function pruneOldSessions(sessionsDir) {
|
|
30120
30120
|
try {
|
|
30121
|
-
if (!
|
|
30121
|
+
if (!existsSync17(sessionsDir))
|
|
30122
30122
|
return;
|
|
30123
30123
|
const now = Date.now();
|
|
30124
30124
|
for (const entry of readdirSync9(sessionsDir)) {
|
|
30125
30125
|
if (!entry.startsWith("run-"))
|
|
30126
30126
|
continue;
|
|
30127
|
-
const entryPath =
|
|
30127
|
+
const entryPath = join26(sessionsDir, entry);
|
|
30128
30128
|
try {
|
|
30129
30129
|
const stat3 = lstatSync5(entryPath);
|
|
30130
30130
|
if (stat3.isSymbolicLink())
|
|
@@ -30181,10 +30181,10 @@ var init_vectra_store = __esm({
|
|
|
30181
30181
|
this.index = index;
|
|
30182
30182
|
this.extractor = extractor;
|
|
30183
30183
|
this.sessionPath = sessionPath;
|
|
30184
|
-
this.indexPath =
|
|
30185
|
-
this.indexFilePath =
|
|
30186
|
-
this.cachePath =
|
|
30187
|
-
this.lockPath =
|
|
30184
|
+
this.indexPath = join26(sessionPath, "index");
|
|
30185
|
+
this.indexFilePath = join26(this.indexPath, "index.json");
|
|
30186
|
+
this.cachePath = join26(sessionPath, "cache.json");
|
|
30187
|
+
this.lockPath = join26(sessionPath, "cache.lock");
|
|
30188
30188
|
this.config = config2;
|
|
30189
30189
|
}
|
|
30190
30190
|
/**
|
|
@@ -30196,7 +30196,7 @@ var init_vectra_store = __esm({
|
|
|
30196
30196
|
*/
|
|
30197
30197
|
refreshIndexIfChanged() {
|
|
30198
30198
|
try {
|
|
30199
|
-
if (!
|
|
30199
|
+
if (!existsSync17(this.indexFilePath))
|
|
30200
30200
|
return;
|
|
30201
30201
|
const mtimeMs = statSync8(this.indexFilePath).mtimeMs;
|
|
30202
30202
|
if (mtimeMs === this.lastIndexMtimeMs)
|
|
@@ -30410,7 +30410,7 @@ ${result.content}
|
|
|
30410
30410
|
*/
|
|
30411
30411
|
loadCache() {
|
|
30412
30412
|
try {
|
|
30413
|
-
if (
|
|
30413
|
+
if (existsSync17(this.cachePath)) {
|
|
30414
30414
|
const raw = readFileSync17(this.cachePath, "utf-8");
|
|
30415
30415
|
if (raw.trim()) {
|
|
30416
30416
|
return JSON.parse(raw);
|
|
@@ -30437,7 +30437,7 @@ ${result.content}
|
|
|
30437
30437
|
}
|
|
30438
30438
|
} finally {
|
|
30439
30439
|
try {
|
|
30440
|
-
if (
|
|
30440
|
+
if (existsSync17(this.lockPath))
|
|
30441
30441
|
rmSync4(this.lockPath);
|
|
30442
30442
|
} catch {
|
|
30443
30443
|
}
|
|
@@ -30496,13 +30496,13 @@ var init_dist2 = __esm({
|
|
|
30496
30496
|
});
|
|
30497
30497
|
|
|
30498
30498
|
// ../baro-orchestrator/scripts/cli.ts
|
|
30499
|
-
import { existsSync as
|
|
30499
|
+
import { existsSync as existsSync23, readFileSync as readFileSync23 } from "fs";
|
|
30500
30500
|
import { resolve as resolve19 } from "path";
|
|
30501
30501
|
|
|
30502
30502
|
// ../baro-orchestrator/src/orchestrate.ts
|
|
30503
|
-
import { existsSync as
|
|
30503
|
+
import { existsSync as existsSync22, mkdirSync as mkdirSync16, mkdtempSync as mkdtempSync5, rmSync as rmSync8 } from "fs";
|
|
30504
30504
|
import { homedir as homedir10, hostname as hostname2, tmpdir as tmpdir14 } from "os";
|
|
30505
|
-
import { dirname as dirname14, join as
|
|
30505
|
+
import { dirname as dirname14, join as join34 } from "path";
|
|
30506
30506
|
import { fileURLToPath } from "url";
|
|
30507
30507
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
30508
30508
|
|
|
@@ -65384,7 +65384,7 @@ var EventProcessor = class {
|
|
|
65384
65384
|
}
|
|
65385
65385
|
};
|
|
65386
65386
|
function createJoin(resolveRuntime) {
|
|
65387
|
-
return function
|
|
65387
|
+
return function join35(participant) {
|
|
65388
65388
|
resolveRuntime().join(participant);
|
|
65389
65389
|
};
|
|
65390
65390
|
}
|
|
@@ -67175,7 +67175,7 @@ function defineRuntime() {
|
|
|
67175
67175
|
}
|
|
67176
67176
|
return participant;
|
|
67177
67177
|
}
|
|
67178
|
-
const
|
|
67178
|
+
const join35 = createJoin(resolveRuntime);
|
|
67179
67179
|
const leave = createLeave(resolveRuntime);
|
|
67180
67180
|
const sendMessage = createSendMessage(resolveRuntime);
|
|
67181
67181
|
const sendEvent = createSendEvent(resolveRuntime);
|
|
@@ -67184,7 +67184,7 @@ function defineRuntime() {
|
|
|
67184
67184
|
initializeRuntime,
|
|
67185
67185
|
resolveRuntime,
|
|
67186
67186
|
resolveParticipant,
|
|
67187
|
-
join:
|
|
67187
|
+
join: join35,
|
|
67188
67188
|
leave,
|
|
67189
67189
|
sendMessage,
|
|
67190
67190
|
sendEvent,
|
|
@@ -71308,13 +71308,13 @@ function extractStderr(e2) {
|
|
|
71308
71308
|
|
|
71309
71309
|
// ../baro-orchestrator/src/integration/dependency-materializer.ts
|
|
71310
71310
|
import { createHash as createHash7 } from "crypto";
|
|
71311
|
-
import { existsSync as
|
|
71311
|
+
import { existsSync as existsSync11, readdirSync as readdirSync4, readFileSync as readFileSync11, symlinkSync } from "fs";
|
|
71312
71312
|
import { homedir as homedir4 } from "os";
|
|
71313
|
-
import { join as
|
|
71313
|
+
import { join as join15, relative as relative6, resolve as resolve9 } from "path";
|
|
71314
71314
|
|
|
71315
71315
|
// ../baro-orchestrator/src/verification/verify.ts
|
|
71316
|
-
import { existsSync as
|
|
71317
|
-
import { isAbsolute as isAbsolute4, join as
|
|
71316
|
+
import { existsSync as existsSync10, lstatSync as lstatSync2, readdirSync as readdirSync3, readFileSync as readFileSync10, realpathSync as realpathSync6, statSync as statSync5 } from "fs";
|
|
71317
|
+
import { isAbsolute as isAbsolute4, join as join14, relative as relative5, resolve as resolve8, sep as sep3 } from "path";
|
|
71318
71318
|
|
|
71319
71319
|
// ../baro-orchestrator/src/harness/liveness.ts
|
|
71320
71320
|
function envSecs(name, fallbackSecs) {
|
|
@@ -71647,7 +71647,7 @@ function javascriptPackageDirs(root) {
|
|
|
71647
71647
|
}
|
|
71648
71648
|
}
|
|
71649
71649
|
function changedPathsSince(cwd, base) {
|
|
71650
|
-
const
|
|
71650
|
+
const git3 = (args) => execFileSync2("git", args, {
|
|
71651
71651
|
cwd,
|
|
71652
71652
|
encoding: "utf8",
|
|
71653
71653
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -71656,10 +71656,10 @@ function changedPathsSince(cwd, base) {
|
|
|
71656
71656
|
});
|
|
71657
71657
|
try {
|
|
71658
71658
|
const paths = /* @__PURE__ */ new Set();
|
|
71659
|
-
for (const line of
|
|
71659
|
+
for (const line of git3(["diff", "--name-only", "-z", base]).split("\0")) {
|
|
71660
71660
|
if (line) paths.add(line);
|
|
71661
71661
|
}
|
|
71662
|
-
for (const line of
|
|
71662
|
+
for (const line of git3(["ls-files", "--others", "--exclude-standard", "-z"]).split("\0")) {
|
|
71663
71663
|
if (line) paths.add(line);
|
|
71664
71664
|
}
|
|
71665
71665
|
return [...paths];
|
|
@@ -71686,17 +71686,52 @@ function scopeCommandsToChange(commands, paths, root, env = process.env) {
|
|
|
71686
71686
|
return { run: run2, notAffected };
|
|
71687
71687
|
}
|
|
71688
71688
|
|
|
71689
|
+
// ../baro-orchestrator/src/verification/lockfile-guard.ts
|
|
71690
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
71691
|
+
import { existsSync as existsSync4 } from "fs";
|
|
71692
|
+
import { join as join6 } from "path";
|
|
71693
|
+
var LOCKFILES = ["package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "yarn.lock"];
|
|
71694
|
+
function git(cwd, args) {
|
|
71695
|
+
try {
|
|
71696
|
+
return execFileSync3("git", args, {
|
|
71697
|
+
cwd,
|
|
71698
|
+
encoding: "utf8",
|
|
71699
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
71700
|
+
timeout: 15e3
|
|
71701
|
+
});
|
|
71702
|
+
} catch {
|
|
71703
|
+
return null;
|
|
71704
|
+
}
|
|
71705
|
+
}
|
|
71706
|
+
function pristineLockfiles(cwd) {
|
|
71707
|
+
const changed = git(cwd, ["status", "--porcelain", "-z", "--untracked-files=all"]);
|
|
71708
|
+
if (changed === null) return [];
|
|
71709
|
+
const paths = changed.split("\0").filter(Boolean).map((entry) => entry.slice(3));
|
|
71710
|
+
if (paths.some((path7) => path7 === "package.json" || path7.endsWith("/package.json"))) return [];
|
|
71711
|
+
return LOCKFILES.filter(
|
|
71712
|
+
(file) => existsSync4(join6(cwd, file)) && !paths.includes(file) && git(cwd, ["ls-files", "--error-unmatch", "--", file]) !== null
|
|
71713
|
+
);
|
|
71714
|
+
}
|
|
71715
|
+
function restoreLockfiles(cwd, pristine) {
|
|
71716
|
+
const restored = [];
|
|
71717
|
+
for (const file of pristine) {
|
|
71718
|
+
if (git(cwd, ["diff", "--quiet", "HEAD", "--", file]) !== null) continue;
|
|
71719
|
+
if (git(cwd, ["checkout", "HEAD", "--", file]) !== null) restored.push(file);
|
|
71720
|
+
}
|
|
71721
|
+
return restored;
|
|
71722
|
+
}
|
|
71723
|
+
|
|
71689
71724
|
// ../baro-orchestrator/src/verification/command-cwd.ts
|
|
71690
|
-
import { existsSync as
|
|
71691
|
-
import { dirname as dirname5, isAbsolute as isAbsolute2, join as
|
|
71725
|
+
import { existsSync as existsSync6 } from "fs";
|
|
71726
|
+
import { dirname as dirname5, isAbsolute as isAbsolute2, join as join8, relative as relative2, resolve as resolve5, sep } from "path";
|
|
71692
71727
|
|
|
71693
71728
|
// ../baro-orchestrator/src/integration/integration-worktree.ts
|
|
71694
|
-
import { existsSync as
|
|
71729
|
+
import { existsSync as existsSync5, readdirSync as readdirSync2, realpathSync as realpathSync3, rmSync, rmdirSync } from "fs";
|
|
71695
71730
|
import { tmpdir as tmpdir2 } from "os";
|
|
71696
|
-
import { basename as basename6, dirname as dirname4, join as
|
|
71731
|
+
import { basename as basename6, dirname as dirname4, join as join7, resolve as resolve4 } from "path";
|
|
71697
71732
|
var INTEGRATION_WORKTREE_DIRNAME = "__run";
|
|
71698
71733
|
function integrationWorktreePath(runId, repoRoot) {
|
|
71699
|
-
return
|
|
71734
|
+
return join7(
|
|
71700
71735
|
tmpdir2(),
|
|
71701
71736
|
"baro-worktrees",
|
|
71702
71737
|
runId,
|
|
@@ -71738,28 +71773,28 @@ var IntegrationWorktree = class {
|
|
|
71738
71773
|
const { goalBranch } = this.opts;
|
|
71739
71774
|
const release = await this.opts.gitGate.acquire();
|
|
71740
71775
|
try {
|
|
71741
|
-
await
|
|
71742
|
-
const hostBranchAtStart = await
|
|
71743
|
-
const hostHeadAtStart = await
|
|
71744
|
-
const startPoint = this.opts.baseRef ? await
|
|
71776
|
+
await git2(["worktree", "prune"], repoRoot);
|
|
71777
|
+
const hostBranchAtStart = await git2(["branch", "--show-current"], repoRoot) || null;
|
|
71778
|
+
const hostHeadAtStart = await git2(["rev-parse", "HEAD"], repoRoot);
|
|
71779
|
+
const startPoint = this.opts.baseRef ? await git2(["rev-parse", "--verify", `${this.opts.baseRef}^{commit}`], repoRoot) : hostHeadAtStart;
|
|
71745
71780
|
const registered = await this.isRegistered();
|
|
71746
71781
|
let reused = false;
|
|
71747
|
-
if (registered &&
|
|
71748
|
-
const branch = await
|
|
71782
|
+
if (registered && existsSync5(integrationRoot)) {
|
|
71783
|
+
const branch = await git2(["branch", "--show-current"], integrationRoot).catch((error) => {
|
|
71749
71784
|
if (isRepositoryCommandTimeout(error)) throw error;
|
|
71750
71785
|
return null;
|
|
71751
71786
|
});
|
|
71752
71787
|
reused = branch === goalBranch;
|
|
71753
71788
|
}
|
|
71754
71789
|
if (!reused) {
|
|
71755
|
-
if (registered ||
|
|
71790
|
+
if (registered || existsSync5(integrationRoot)) {
|
|
71756
71791
|
await gitQuiet(["worktree", "remove", "--force", integrationRoot], repoRoot);
|
|
71757
|
-
if (
|
|
71792
|
+
if (existsSync5(integrationRoot)) {
|
|
71758
71793
|
rmSync(integrationRoot, { recursive: true, force: true });
|
|
71759
71794
|
}
|
|
71760
|
-
await
|
|
71795
|
+
await git2(["worktree", "prune"], repoRoot);
|
|
71761
71796
|
}
|
|
71762
|
-
const branchExists = await
|
|
71797
|
+
const branchExists = await git2(
|
|
71763
71798
|
["show-ref", "--verify", "--quiet", `refs/heads/${goalBranch}`],
|
|
71764
71799
|
repoRoot
|
|
71765
71800
|
).then(
|
|
@@ -71770,7 +71805,7 @@ var IntegrationWorktree = class {
|
|
|
71770
71805
|
}
|
|
71771
71806
|
);
|
|
71772
71807
|
if (branchExists) await this.releaseStaleHolders(goalBranch);
|
|
71773
|
-
await
|
|
71808
|
+
await git2(
|
|
71774
71809
|
branchExists ? ["worktree", "add", integrationRoot, goalBranch] : ["worktree", "add", "-b", goalBranch, integrationRoot, startPoint],
|
|
71775
71810
|
repoRoot
|
|
71776
71811
|
);
|
|
@@ -71783,7 +71818,7 @@ var IntegrationWorktree = class {
|
|
|
71783
71818
|
} else {
|
|
71784
71819
|
this.log(`[git] local-only; not pushing ${goalBranch}`);
|
|
71785
71820
|
}
|
|
71786
|
-
const baseSha = await
|
|
71821
|
+
const baseSha = await git2(["rev-parse", "HEAD"], integrationRoot);
|
|
71787
71822
|
this.prepared = {
|
|
71788
71823
|
integrationRoot,
|
|
71789
71824
|
baseSha,
|
|
@@ -71810,12 +71845,12 @@ var IntegrationWorktree = class {
|
|
|
71810
71845
|
try {
|
|
71811
71846
|
release = await this.opts.gitGate.acquire();
|
|
71812
71847
|
await gitQuiet(["worktree", "remove", "--force", integrationRoot], repoRoot);
|
|
71813
|
-
if (
|
|
71848
|
+
if (existsSync5(integrationRoot)) {
|
|
71814
71849
|
rmSync(integrationRoot, { recursive: true, force: true });
|
|
71815
71850
|
}
|
|
71816
71851
|
await gitQuiet(["worktree", "prune"], repoRoot);
|
|
71817
71852
|
for (const dir of [dirname4(integrationRoot), dirname4(dirname4(integrationRoot))]) {
|
|
71818
|
-
if (
|
|
71853
|
+
if (existsSync5(dir) && readdirSync2(dir).length === 0) rmdirSync(dir);
|
|
71819
71854
|
}
|
|
71820
71855
|
} catch (error) {
|
|
71821
71856
|
this.log(
|
|
@@ -71849,7 +71884,7 @@ var IntegrationWorktree = class {
|
|
|
71849
71884
|
let release = null;
|
|
71850
71885
|
try {
|
|
71851
71886
|
release = await this.opts.gitGate.acquire();
|
|
71852
|
-
const current = await
|
|
71887
|
+
const current = await git2(["branch", "--show-current"], repoRoot);
|
|
71853
71888
|
if (!prepared.hostBranchAtStart || current !== prepared.hostBranchAtStart) {
|
|
71854
71889
|
return untouched(
|
|
71855
71890
|
"not_on_base_branch",
|
|
@@ -71868,13 +71903,13 @@ var IntegrationWorktree = class {
|
|
|
71868
71903
|
`uncommitted changes on [${paths.join(", ")}]; merge ${goalBranch} manually`
|
|
71869
71904
|
);
|
|
71870
71905
|
}
|
|
71871
|
-
const head = await
|
|
71872
|
-
const goalSha = await
|
|
71906
|
+
const head = await git2(["rev-parse", "HEAD"], repoRoot);
|
|
71907
|
+
const goalSha = await git2(["rev-parse", `refs/heads/${goalBranch}`], repoRoot);
|
|
71873
71908
|
if (head === goalSha) {
|
|
71874
71909
|
return untouched("up_to_date", `${current} already at ${goalBranch}`);
|
|
71875
71910
|
}
|
|
71876
71911
|
try {
|
|
71877
|
-
await
|
|
71912
|
+
await git2(["merge-base", "--is-ancestor", head, goalSha], repoRoot);
|
|
71878
71913
|
} catch (error) {
|
|
71879
71914
|
if (!(error instanceof RepositoryCommandError) || error.code !== 1) throw error;
|
|
71880
71915
|
return untouched(
|
|
@@ -71882,7 +71917,7 @@ var IntegrationWorktree = class {
|
|
|
71882
71917
|
`${current} has diverged from ${goalBranch}`
|
|
71883
71918
|
);
|
|
71884
71919
|
}
|
|
71885
|
-
await
|
|
71920
|
+
await git2(["merge", "--ff-only", goalSha], repoRoot);
|
|
71886
71921
|
return { kind: "fast_forwarded", from: head, to: goalSha };
|
|
71887
71922
|
} catch (error) {
|
|
71888
71923
|
return untouched("error", errMsg(error));
|
|
@@ -71898,7 +71933,7 @@ var IntegrationWorktree = class {
|
|
|
71898
71933
|
* the user's and stays, with git's own error.
|
|
71899
71934
|
*/
|
|
71900
71935
|
async releaseStaleHolders(goalBranch) {
|
|
71901
|
-
const listing = await
|
|
71936
|
+
const listing = await git2(["worktree", "list", "--porcelain"], this.repoRoot);
|
|
71902
71937
|
const own = canonicalPath(this.integrationRoot);
|
|
71903
71938
|
for (const entry of listing.split(/\n\s*\n/u)) {
|
|
71904
71939
|
const lines = entry.split("\n");
|
|
@@ -71908,17 +71943,17 @@ var IntegrationWorktree = class {
|
|
|
71908
71943
|
if (canonicalPath(path7) === own || !isIntegrationWorktreeRoot(path7)) continue;
|
|
71909
71944
|
this.log(`[integration] releasing ${goalBranch} from a stopped run's worktree ${path7}`);
|
|
71910
71945
|
await gitQuiet(["worktree", "remove", "--force", path7], this.repoRoot);
|
|
71911
|
-
if (
|
|
71946
|
+
if (existsSync5(path7)) rmSync(path7, { recursive: true, force: true });
|
|
71912
71947
|
}
|
|
71913
|
-
await
|
|
71948
|
+
await git2(["worktree", "prune"], this.repoRoot);
|
|
71914
71949
|
}
|
|
71915
71950
|
async isRegistered() {
|
|
71916
|
-
const listing = await
|
|
71951
|
+
const listing = await git2(["worktree", "list", "--porcelain"], this.repoRoot);
|
|
71917
71952
|
const target = canonicalPath(this.integrationRoot);
|
|
71918
71953
|
return listing.split("\n").filter((line) => line.startsWith("worktree ")).some((line) => canonicalPath(line.slice("worktree ".length)) === target);
|
|
71919
71954
|
}
|
|
71920
71955
|
};
|
|
71921
|
-
async function
|
|
71956
|
+
async function git2(args, cwd) {
|
|
71922
71957
|
const { stdout } = await runRepositoryCommand("git", args, { cwd });
|
|
71923
71958
|
return stdout.trim();
|
|
71924
71959
|
}
|
|
@@ -71935,7 +71970,7 @@ function canonicalPath(path7) {
|
|
|
71935
71970
|
return realpathSync3(absolute);
|
|
71936
71971
|
} catch {
|
|
71937
71972
|
const parent = dirname4(absolute);
|
|
71938
|
-
return parent === absolute ? absolute :
|
|
71973
|
+
return parent === absolute ? absolute : join7(canonicalPath(parent), basename6(absolute));
|
|
71939
71974
|
}
|
|
71940
71975
|
}
|
|
71941
71976
|
function untouched(reason, detail) {
|
|
@@ -71975,10 +72010,10 @@ function remappableWorktreeRoot(runCwd, candidate) {
|
|
|
71975
72010
|
const at = parts.lastIndexOf("baro-worktrees");
|
|
71976
72011
|
if (at < 0 || parts.length < at + 4) return null;
|
|
71977
72012
|
const root = parts.slice(0, at + 4).join(sep);
|
|
71978
|
-
return sameDirectory(dirname5(dirname5(root)), dirname5(dirname5(runCwd))) || !
|
|
72013
|
+
return sameDirectory(dirname5(dirname5(root)), dirname5(dirname5(runCwd))) || !existsSync6(root) ? root : null;
|
|
71979
72014
|
}
|
|
71980
72015
|
function integrationCwdResolver(integrationRoot, repoRoot) {
|
|
71981
|
-
return () =>
|
|
72016
|
+
return () => existsSync6(integrationRoot) ? integrationRoot : repoRoot;
|
|
71982
72017
|
}
|
|
71983
72018
|
function spawnRunCwd(cwd, hostRepoRoot, resolveRunCwd) {
|
|
71984
72019
|
if (resolveRunCwd) return resolveRunCwd();
|
|
@@ -71998,8 +72033,8 @@ function resolveCommandCwd(runCwd, commandCwd) {
|
|
|
71998
72033
|
}
|
|
71999
72034
|
const worktreeRoot = remappableWorktreeRoot(runCanonical, canonical);
|
|
72000
72035
|
if (worktreeRoot) {
|
|
72001
|
-
const remapped =
|
|
72002
|
-
if (
|
|
72036
|
+
const remapped = join8(runCwd, relative2(worktreeRoot, canonical));
|
|
72037
|
+
if (existsSync6(remapped)) return remapped;
|
|
72003
72038
|
}
|
|
72004
72039
|
return runCwd;
|
|
72005
72040
|
}
|
|
@@ -72007,14 +72042,14 @@ function resolveCommandCwd(runCwd, commandCwd) {
|
|
|
72007
72042
|
// ../baro-orchestrator/src/verification/command-timing.ts
|
|
72008
72043
|
import { createHash as createHash5, randomUUID as randomUUID3 } from "crypto";
|
|
72009
72044
|
import { mkdirSync as mkdirSync4, readFileSync as readFileSync6, realpathSync as realpathSync4, renameSync as renameSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
72010
|
-
import { dirname as dirname6, join as
|
|
72045
|
+
import { dirname as dirname6, join as join10, relative as relative3, resolve as resolve6 } from "path";
|
|
72011
72046
|
|
|
72012
72047
|
// ../baro-orchestrator/src/runtime/baro-home.ts
|
|
72013
72048
|
import { homedir as homedir3 } from "os";
|
|
72014
|
-
import { join as
|
|
72049
|
+
import { join as join9 } from "path";
|
|
72015
72050
|
function baroHome() {
|
|
72016
72051
|
const override = process.env.BARO_HOME;
|
|
72017
|
-
return override ? override :
|
|
72052
|
+
return override ? override : join9(homedir3(), ".baro");
|
|
72018
72053
|
}
|
|
72019
72054
|
|
|
72020
72055
|
// ../baro-orchestrator/src/verification/command-timing.ts
|
|
@@ -72024,7 +72059,7 @@ function commandKey(cmd, root) {
|
|
|
72024
72059
|
return `${rel || "."}::${[cmd.tool, ...cmd.args].join(" ")}`;
|
|
72025
72060
|
}
|
|
72026
72061
|
function timingsFile() {
|
|
72027
|
-
return
|
|
72062
|
+
return join10(baroHome(), "verification-timings.json");
|
|
72028
72063
|
}
|
|
72029
72064
|
function repoId(repoRoot) {
|
|
72030
72065
|
let canonical = resolve6(repoRoot);
|
|
@@ -72058,7 +72093,7 @@ function recordTiming(repoRoot, key, ms) {
|
|
|
72058
72093
|
}
|
|
72059
72094
|
function declaredTimeoutsSecs(root) {
|
|
72060
72095
|
try {
|
|
72061
|
-
const pkg = JSON.parse(readFileSync6(
|
|
72096
|
+
const pkg = JSON.parse(readFileSync6(join10(root, "package.json"), "utf8"));
|
|
72062
72097
|
const raw = pkg.baro?.verification?.commandTimeoutsSecs;
|
|
72063
72098
|
if (!raw || typeof raw !== "object") return {};
|
|
72064
72099
|
const out = {};
|
|
@@ -72097,25 +72132,25 @@ function createCeilingResolver(root, repoRoot, floorMs) {
|
|
|
72097
72132
|
|
|
72098
72133
|
// ../baro-orchestrator/src/verification/jvm-commands.ts
|
|
72099
72134
|
import { spawnSync } from "child_process";
|
|
72100
|
-
import { accessSync, constants, existsSync as
|
|
72101
|
-
import { delimiter, join as
|
|
72135
|
+
import { accessSync, constants, existsSync as existsSync7, statSync as statSync2 } from "fs";
|
|
72136
|
+
import { delimiter, join as join11 } from "path";
|
|
72102
72137
|
function detectJvmCommands(cwd, probe2 = {}) {
|
|
72103
72138
|
const platform = probe2.platform ?? process.platform;
|
|
72104
72139
|
const env = probe2.env ?? process.env;
|
|
72105
72140
|
const windows = platform === "win32";
|
|
72106
72141
|
const hasBuildFile = [...MAVEN_FILES, ...GRADLE_FILES].some(
|
|
72107
|
-
(name) =>
|
|
72142
|
+
(name) => existsSync7(join11(cwd, name))
|
|
72108
72143
|
);
|
|
72109
72144
|
if (!hasBuildFile) return [];
|
|
72110
72145
|
if (!(probe2.javaRuns ?? javaRuns)(env)) return [];
|
|
72111
72146
|
const commands = [];
|
|
72112
|
-
if (MAVEN_FILES.some((name) =>
|
|
72147
|
+
if (MAVEN_FILES.some((name) => existsSync7(join11(cwd, name)))) {
|
|
72113
72148
|
const tool = wrapperOrTool(cwd, windows ? "mvnw.cmd" : "mvnw", "mvn", env, windows);
|
|
72114
72149
|
if (tool) {
|
|
72115
72150
|
commands.push({ label: "mvn test", tool, args: ["-B", "test"] });
|
|
72116
72151
|
}
|
|
72117
72152
|
}
|
|
72118
|
-
if (GRADLE_FILES.some((name) =>
|
|
72153
|
+
if (GRADLE_FILES.some((name) => existsSync7(join11(cwd, name)))) {
|
|
72119
72154
|
const tool = wrapperOrTool(cwd, windows ? "gradlew.bat" : "gradlew", "gradle", env, windows);
|
|
72120
72155
|
if (tool) {
|
|
72121
72156
|
commands.push({
|
|
@@ -72135,7 +72170,7 @@ var GRADLE_FILES = [
|
|
|
72135
72170
|
"settings.gradle.kts"
|
|
72136
72171
|
];
|
|
72137
72172
|
function javaRuns(env) {
|
|
72138
|
-
const java = env.JAVA_HOME ?
|
|
72173
|
+
const java = env.JAVA_HOME ? join11(env.JAVA_HOME, "bin", "java") : "java";
|
|
72139
72174
|
try {
|
|
72140
72175
|
return spawnSync(java, ["-version"], {
|
|
72141
72176
|
env,
|
|
@@ -72183,20 +72218,20 @@ var JVM_BUILDS = [
|
|
|
72183
72218
|
}
|
|
72184
72219
|
];
|
|
72185
72220
|
function isMavenRepository(cwd) {
|
|
72186
|
-
return MAVEN_FILES.some((name) =>
|
|
72221
|
+
return MAVEN_FILES.some((name) => existsSync7(join11(cwd, name)));
|
|
72187
72222
|
}
|
|
72188
72223
|
function isGradleRepository(cwd) {
|
|
72189
|
-
return GRADLE_FILES.some((name) =>
|
|
72224
|
+
return GRADLE_FILES.some((name) => existsSync7(join11(cwd, name)));
|
|
72190
72225
|
}
|
|
72191
72226
|
function wrapperOrTool(cwd, wrapper, tool, env, windows) {
|
|
72192
|
-
if (isFile(
|
|
72227
|
+
if (isFile(join11(cwd, wrapper))) return windows ? `.\\${wrapper}` : `./${wrapper}`;
|
|
72193
72228
|
return onPath(tool, env, windows) ? tool : null;
|
|
72194
72229
|
}
|
|
72195
72230
|
function onPath(tool, env, windows) {
|
|
72196
72231
|
const dirs = (env.PATH ?? env.Path ?? "").split(windows ? ";" : delimiter);
|
|
72197
72232
|
const names = windows ? [`${tool}.cmd`, `${tool}.bat`, `${tool}.exe`] : [tool];
|
|
72198
72233
|
return dirs.some(
|
|
72199
|
-
(dir) => dir.length > 0 && names.some((name) => isExecutable(
|
|
72234
|
+
(dir) => dir.length > 0 && names.some((name) => isExecutable(join11(dir, name), windows))
|
|
72200
72235
|
);
|
|
72201
72236
|
}
|
|
72202
72237
|
function isFile(path7) {
|
|
@@ -72374,13 +72409,13 @@ function formatDeclaredBudgetEvidence(evidence) {
|
|
|
72374
72409
|
|
|
72375
72410
|
// ../baro-orchestrator/src/verification/declared-verification.ts
|
|
72376
72411
|
import {
|
|
72377
|
-
existsSync as
|
|
72412
|
+
existsSync as existsSync8,
|
|
72378
72413
|
readFileSync as readFileSync7,
|
|
72379
72414
|
realpathSync as realpathSync5,
|
|
72380
72415
|
statSync as statSync3
|
|
72381
72416
|
} from "fs";
|
|
72382
72417
|
import { createHash as createHash6 } from "crypto";
|
|
72383
|
-
import { dirname as dirname7, isAbsolute as isAbsolute3, join as
|
|
72418
|
+
import { dirname as dirname7, isAbsolute as isAbsolute3, join as join12, relative as relative4, resolve as resolve7, sep as sep2 } from "path";
|
|
72384
72419
|
var MAX_COMMAND_LENGTH = 1e3;
|
|
72385
72420
|
var SAFE_SCRIPT_NAME = /^[A-Za-z0-9_.:-]+$/;
|
|
72386
72421
|
var TRUSTED_PACKAGE_SCRIPTS = /* @__PURE__ */ new Set(["build", "typecheck", "test", "lint"]);
|
|
@@ -72664,8 +72699,8 @@ function translateNpxRstest(cwd, requirement, parsed, managers) {
|
|
|
72664
72699
|
"npx rstest focus paths contain an unsafe, non-path, or escaping value"
|
|
72665
72700
|
);
|
|
72666
72701
|
}
|
|
72667
|
-
const manifestPath =
|
|
72668
|
-
const manifest =
|
|
72702
|
+
const manifestPath = join12(cwd, "package.json");
|
|
72703
|
+
const manifest = existsSync8(manifestPath) ? readManifest(manifestPath) : null;
|
|
72669
72704
|
if (!manifest || !exactRstestScript(manifest.scripts?.test)) {
|
|
72670
72705
|
return incomplete(
|
|
72671
72706
|
requirement,
|
|
@@ -72688,8 +72723,8 @@ function translateNpxRstest(cwd, requirement, parsed, managers) {
|
|
|
72688
72723
|
};
|
|
72689
72724
|
}
|
|
72690
72725
|
function trustedScriptAlias(cwd, tokens2) {
|
|
72691
|
-
const manifestPath =
|
|
72692
|
-
if (!
|
|
72726
|
+
const manifestPath = join12(cwd, "package.json");
|
|
72727
|
+
if (!existsSync8(manifestPath)) return null;
|
|
72693
72728
|
const manifest = readManifest(manifestPath);
|
|
72694
72729
|
if (!manifest?.scripts) return null;
|
|
72695
72730
|
const normalized = tokens2.join(" ");
|
|
@@ -72751,7 +72786,7 @@ function extractWorkspaceSelector(rest) {
|
|
|
72751
72786
|
}
|
|
72752
72787
|
function resolveWorkspaceAuthority(cwd, name, managers) {
|
|
72753
72788
|
const declaredWorkspaces = readManifest(
|
|
72754
|
-
|
|
72789
|
+
join12(cwd, "package.json")
|
|
72755
72790
|
)?.workspaces;
|
|
72756
72791
|
const packages = declaredWorkspaces?.packages;
|
|
72757
72792
|
if (!Array.isArray(declaredWorkspaces) && !Array.isArray(packages)) {
|
|
@@ -72767,7 +72802,7 @@ function resolveWorkspaceAuthority(cwd, name, managers) {
|
|
|
72767
72802
|
);
|
|
72768
72803
|
if (byPath) return { authority: byPath };
|
|
72769
72804
|
const byName = candidates.find(
|
|
72770
|
-
(manager) => readManifest(
|
|
72805
|
+
(manager) => readManifest(join12(manager.cwd, "package.json"))?.name === name
|
|
72771
72806
|
);
|
|
72772
72807
|
if (byName) return { authority: byName };
|
|
72773
72808
|
const known = [...new Set(candidates.map(repoRelative))].sort();
|
|
@@ -72782,7 +72817,7 @@ function resolveScriptWorkspace(cwd, script, managers, changedFiles) {
|
|
|
72782
72817
|
})).sort((a, b) => a.rel < b.rel ? -1 : a.rel > b.rel ? 1 : 0);
|
|
72783
72818
|
if (candidates.length === 0) return null;
|
|
72784
72819
|
const declaring = candidates.filter(
|
|
72785
|
-
(candidate) => typeof readManifest(
|
|
72820
|
+
(candidate) => typeof readManifest(join12(candidate.authority.cwd, "package.json"))?.scripts?.[script] === "string"
|
|
72786
72821
|
);
|
|
72787
72822
|
if (declaring.length === 1) return declaring[0];
|
|
72788
72823
|
if (declaring.length === 0) {
|
|
@@ -72862,8 +72897,8 @@ function translatePackage(cwd, requirement, parsed, managers) {
|
|
|
72862
72897
|
}
|
|
72863
72898
|
workspace = resolved.authority;
|
|
72864
72899
|
}
|
|
72865
|
-
const manifestPath =
|
|
72866
|
-
const manifest =
|
|
72900
|
+
const manifestPath = join12(workspace?.cwd ?? cwd, "package.json");
|
|
72901
|
+
const manifest = existsSync8(manifestPath) ? readManifest(manifestPath) : null;
|
|
72867
72902
|
if (!manifest) {
|
|
72868
72903
|
return incomplete(
|
|
72869
72904
|
requirement,
|
|
@@ -72936,7 +72971,7 @@ function escapesRoot(cwd, candidate) {
|
|
|
72936
72971
|
if (fromRoot === ".." || fromRoot.startsWith(`..${sep2}`) || isAbsolute3(fromRoot)) return true;
|
|
72937
72972
|
try {
|
|
72938
72973
|
let existingAncestor = absolute;
|
|
72939
|
-
while (!
|
|
72974
|
+
while (!existsSync8(existingAncestor)) {
|
|
72940
72975
|
const parent = dirname7(existingAncestor);
|
|
72941
72976
|
if (parent === existingAncestor) return true;
|
|
72942
72977
|
existingAncestor = parent;
|
|
@@ -72966,7 +73001,7 @@ function safeFocusedArg(cwd, value) {
|
|
|
72966
73001
|
)) return false;
|
|
72967
73002
|
const possiblePath = value.includes("=") ? value.slice(value.indexOf("=") + 1) : value;
|
|
72968
73003
|
if (URI_SCHEME.test(value) || URI_SCHEME.test(possiblePath) || isAbsolute3(possiblePath) || /^[A-Za-z]:\//.test(possiblePath) || possiblePath.startsWith("@") || possiblePath.includes("://") || hasParentTraversal(possiblePath)) return false;
|
|
72969
|
-
const pathLike = possiblePath.includes("/") || possiblePath.startsWith(".") ||
|
|
73004
|
+
const pathLike = possiblePath.includes("/") || possiblePath.startsWith(".") || existsSync8(resolve7(cwd, possiblePath));
|
|
72970
73005
|
return !(pathLike && escapesRoot(cwd, possiblePath));
|
|
72971
73006
|
}
|
|
72972
73007
|
function safeRstestFocusPath(cwd, value) {
|
|
@@ -73077,7 +73112,7 @@ function canonicalCargoArgs(tokens2) {
|
|
|
73077
73112
|
return canonical;
|
|
73078
73113
|
}
|
|
73079
73114
|
function translateCargo(cwd, requirement, parsed) {
|
|
73080
|
-
if (!
|
|
73115
|
+
if (!existsSync8(join12(cwd, "Cargo.toml"))) {
|
|
73081
73116
|
return incomplete(
|
|
73082
73117
|
requirement,
|
|
73083
73118
|
"declared cargo test requires Cargo.toml at the repository root"
|
|
@@ -73212,7 +73247,7 @@ function containedPath(cwd, candidate, requireFile) {
|
|
|
73212
73247
|
if (escapesRoot(cwd, candidate)) {
|
|
73213
73248
|
return { reason: `declared node path resolves outside repository: '${candidate}'` };
|
|
73214
73249
|
}
|
|
73215
|
-
if (!
|
|
73250
|
+
if (!existsSync8(absolute)) {
|
|
73216
73251
|
return { reason: `declared node path does not exist: '${candidate}'` };
|
|
73217
73252
|
}
|
|
73218
73253
|
try {
|
|
@@ -73257,7 +73292,7 @@ function translateNode(cwd, requirement, parsed, manifestRoot = cwd) {
|
|
|
73257
73292
|
flagArgs.push(flag, inlineValue);
|
|
73258
73293
|
if (!token.includes("=")) index += 1;
|
|
73259
73294
|
}
|
|
73260
|
-
if (mode === void 0 && candidates.length === 1 && !
|
|
73295
|
+
if (mode === void 0 && candidates.length === 1 && !existsSync8(join12(cwd, "package.json")) && !existsSync8(join12(manifestRoot, "package.json"))) {
|
|
73261
73296
|
const contained = containedPath(cwd, candidates[0], true);
|
|
73262
73297
|
if (!contained.path) {
|
|
73263
73298
|
return incomplete(
|
|
@@ -73326,7 +73361,7 @@ function translateComposer(cwd, requirement, parsed) {
|
|
|
73326
73361
|
if (!SAFE_SCRIPT_NAME.test(script)) {
|
|
73327
73362
|
return incomplete(requirement, `unsafe composer script name '${script}'`);
|
|
73328
73363
|
}
|
|
73329
|
-
const manifest = readJsonObject(
|
|
73364
|
+
const manifest = readJsonObject(join12(cwd, "composer.json"));
|
|
73330
73365
|
if (!manifest) {
|
|
73331
73366
|
return incomplete(
|
|
73332
73367
|
requirement,
|
|
@@ -73386,7 +73421,7 @@ function translatePytest(cwd, requirement, parsed) {
|
|
|
73386
73421
|
return incomplete(requirement, contained.reason ?? `unsafe pytest path '${token}'`);
|
|
73387
73422
|
}
|
|
73388
73423
|
args.push([contained.path, ...nodeParts].join("::"));
|
|
73389
|
-
containedPaths.push({ path:
|
|
73424
|
+
containedPaths.push({ path: join12(cwd, contained.path), requireFile: false });
|
|
73390
73425
|
}
|
|
73391
73426
|
return {
|
|
73392
73427
|
label: parsed.normalized,
|
|
@@ -73407,7 +73442,7 @@ function translatePhpunit(cwd, requirement, parsed) {
|
|
|
73407
73442
|
const rest = parsed.tokens.slice(1);
|
|
73408
73443
|
const args = [];
|
|
73409
73444
|
const containedPaths = [
|
|
73410
|
-
{ path:
|
|
73445
|
+
{ path: join12(cwd, binary.path), requireFile: true }
|
|
73411
73446
|
];
|
|
73412
73447
|
for (let index = 0; index < rest.length; index += 1) {
|
|
73413
73448
|
const token = rest[index];
|
|
@@ -73440,7 +73475,7 @@ function translatePhpunit(cwd, requirement, parsed) {
|
|
|
73440
73475
|
}
|
|
73441
73476
|
args.push(token, contained.path);
|
|
73442
73477
|
containedPaths.push({
|
|
73443
|
-
path:
|
|
73478
|
+
path: join12(cwd, contained.path),
|
|
73444
73479
|
requireFile: true
|
|
73445
73480
|
});
|
|
73446
73481
|
index += 1;
|
|
@@ -73456,7 +73491,7 @@ function translatePhpunit(cwd, requirement, parsed) {
|
|
|
73456
73491
|
}
|
|
73457
73492
|
args.push(contained.path);
|
|
73458
73493
|
containedPaths.push({
|
|
73459
|
-
path:
|
|
73494
|
+
path: join12(cwd, contained.path),
|
|
73460
73495
|
requireFile: false
|
|
73461
73496
|
});
|
|
73462
73497
|
continue;
|
|
@@ -73468,7 +73503,7 @@ function translatePhpunit(cwd, requirement, parsed) {
|
|
|
73468
73503
|
}
|
|
73469
73504
|
return {
|
|
73470
73505
|
label: ["vendor/bin/phpunit", ...rest].join(" "),
|
|
73471
|
-
tool:
|
|
73506
|
+
tool: join12(cwd, binary.path),
|
|
73472
73507
|
args,
|
|
73473
73508
|
containedPaths
|
|
73474
73509
|
};
|
|
@@ -73486,7 +73521,7 @@ function translateDdev(cwd, requirement, parsed, packageManagers, insideDdev) {
|
|
|
73486
73521
|
if (parsed.tokens.length < 3) {
|
|
73487
73522
|
return incomplete(requirement, "ddev exec requires a command to run");
|
|
73488
73523
|
}
|
|
73489
|
-
if (!
|
|
73524
|
+
if (!existsSync8(join12(cwd, ".ddev", "config.yaml"))) {
|
|
73490
73525
|
return incomplete(
|
|
73491
73526
|
requirement,
|
|
73492
73527
|
"declared ddev test requires .ddev/config.yaml in the repository root"
|
|
@@ -73532,12 +73567,12 @@ function message(error) {
|
|
|
73532
73567
|
}
|
|
73533
73568
|
|
|
73534
73569
|
// ../baro-orchestrator/src/verification/node-test-script.ts
|
|
73535
|
-
import { existsSync as
|
|
73536
|
-
import { join as
|
|
73570
|
+
import { existsSync as existsSync9, readFileSync as readFileSync8 } from "fs";
|
|
73571
|
+
import { join as join13 } from "path";
|
|
73537
73572
|
function defaultReadPackageJson(cwd) {
|
|
73538
73573
|
if (cwd === void 0) return null;
|
|
73539
|
-
const path7 =
|
|
73540
|
-
if (!
|
|
73574
|
+
const path7 = join13(cwd, "package.json");
|
|
73575
|
+
if (!existsSync9(path7)) return null;
|
|
73541
73576
|
try {
|
|
73542
73577
|
return JSON.parse(readFileSync8(path7, "utf8"));
|
|
73543
73578
|
} catch {
|
|
@@ -74032,9 +74067,9 @@ function malformedDeclaredPackageManager(value) {
|
|
|
74032
74067
|
function detectPackageManager(cwd, manifest, hasPnpmWorkspace) {
|
|
74033
74068
|
const declared = declaredPackageManager(manifest?.packageManager);
|
|
74034
74069
|
if (declared) return declared.manager;
|
|
74035
|
-
if (
|
|
74036
|
-
if (
|
|
74037
|
-
if (
|
|
74070
|
+
if (existsSync10(join14(cwd, "pnpm-lock.yaml")) || hasPnpmWorkspace) return "pnpm";
|
|
74071
|
+
if (existsSync10(join14(cwd, "package-lock.json"))) return "npm";
|
|
74072
|
+
if (existsSync10(join14(cwd, "yarn.lock"))) return "yarn";
|
|
74038
74073
|
return "npm";
|
|
74039
74074
|
}
|
|
74040
74075
|
function packageManagerCommand(pm, declared, script, trailingArgs = []) {
|
|
@@ -74066,8 +74101,8 @@ function workspacePatterns(workspaces) {
|
|
|
74066
74101
|
return [];
|
|
74067
74102
|
}
|
|
74068
74103
|
function pnpmWorkspacePatterns(cwd) {
|
|
74069
|
-
const path7 =
|
|
74070
|
-
if (!
|
|
74104
|
+
const path7 = join14(cwd, "pnpm-workspace.yaml");
|
|
74105
|
+
if (!existsSync10(path7)) return [];
|
|
74071
74106
|
const patterns = [];
|
|
74072
74107
|
let inPackages = false;
|
|
74073
74108
|
for (const line of readFileSync10(path7, "utf8").split(/\r?\n/)) {
|
|
@@ -74090,20 +74125,20 @@ function workspacePackageDirs(cwd, workspaces) {
|
|
|
74090
74125
|
const addIfPackage = (candidate) => {
|
|
74091
74126
|
const absolute = resolve8(candidate);
|
|
74092
74127
|
const fromRoot = relative5(root, absolute);
|
|
74093
|
-
if (fromRoot === "" || fromRoot === ".." || fromRoot.startsWith(`..${sep3}`) || isAbsolute4(fromRoot) || !
|
|
74128
|
+
if (fromRoot === "" || fromRoot === ".." || fromRoot.startsWith(`..${sep3}`) || isAbsolute4(fromRoot) || !existsSync10(join14(absolute, "package.json"))) return;
|
|
74094
74129
|
dirs.add(absolute);
|
|
74095
74130
|
};
|
|
74096
74131
|
for (const rawPattern of workspacePatterns(workspaces)) {
|
|
74097
74132
|
const pattern = rawPattern.replace(/\\/g, "/").replace(/\/$/, "");
|
|
74098
74133
|
if (!pattern.includes("*")) {
|
|
74099
|
-
addIfPackage(
|
|
74134
|
+
addIfPackage(join14(root, pattern));
|
|
74100
74135
|
continue;
|
|
74101
74136
|
}
|
|
74102
74137
|
if (!pattern.endsWith("/*") || pattern.slice(0, -2).includes("*")) continue;
|
|
74103
|
-
const parent =
|
|
74104
|
-
if (!
|
|
74138
|
+
const parent = join14(root, pattern.slice(0, -2));
|
|
74139
|
+
if (!existsSync10(parent)) continue;
|
|
74105
74140
|
for (const entry of readdirSync3(parent, { withFileTypes: true })) {
|
|
74106
|
-
if (entry.isDirectory()) addIfPackage(
|
|
74141
|
+
if (entry.isDirectory()) addIfPackage(join14(parent, entry.name));
|
|
74107
74142
|
}
|
|
74108
74143
|
}
|
|
74109
74144
|
return [...dirs].sort();
|
|
@@ -74115,9 +74150,9 @@ function supportedWorkspacePattern(pattern) {
|
|
|
74115
74150
|
function detectCommands(cwd) {
|
|
74116
74151
|
const cmds = [];
|
|
74117
74152
|
const javascriptPackageManagers = [];
|
|
74118
|
-
const pkgPath =
|
|
74119
|
-
const hasPackageManifest =
|
|
74120
|
-
const hasPnpmWorkspace =
|
|
74153
|
+
const pkgPath = join14(cwd, "package.json");
|
|
74154
|
+
const hasPackageManifest = existsSync10(pkgPath);
|
|
74155
|
+
const hasPnpmWorkspace = existsSync10(join14(cwd, "pnpm-workspace.yaml"));
|
|
74121
74156
|
if (hasPackageManifest || hasPnpmWorkspace) {
|
|
74122
74157
|
const manifest = hasPackageManifest ? readPackageManifest(pkgPath) : null;
|
|
74123
74158
|
if (hasPackageManifest && !manifest) {
|
|
@@ -74175,7 +74210,7 @@ function detectCommands(cwd) {
|
|
|
74175
74210
|
);
|
|
74176
74211
|
const workspaces = workspaceDirs2.map((workspaceCwd) => ({
|
|
74177
74212
|
cwd: workspaceCwd,
|
|
74178
|
-
manifest: readPackageManifest(
|
|
74213
|
+
manifest: readPackageManifest(join14(workspaceCwd, "package.json"))
|
|
74179
74214
|
}));
|
|
74180
74215
|
if (!managerResolutionFailed) {
|
|
74181
74216
|
const managerSnapshot = {
|
|
@@ -74221,11 +74256,11 @@ function detectCommands(cwd) {
|
|
|
74221
74256
|
}
|
|
74222
74257
|
}
|
|
74223
74258
|
}
|
|
74224
|
-
if (
|
|
74259
|
+
if (existsSync10(join14(cwd, "Cargo.toml"))) {
|
|
74225
74260
|
cmds.push({ label: "cargo build", tool: "cargo", args: ["build"] });
|
|
74226
74261
|
cmds.push({ label: "cargo test", tool: "cargo", args: ["test"] });
|
|
74227
74262
|
}
|
|
74228
|
-
if (
|
|
74263
|
+
if (existsSync10(join14(cwd, "go.mod"))) {
|
|
74229
74264
|
cmds.push({ label: "go build ./...", tool: "go", args: ["build", "./..."] });
|
|
74230
74265
|
cmds.push({ label: "go test ./...", tool: "go", args: ["test", "./..."] });
|
|
74231
74266
|
}
|
|
@@ -74233,18 +74268,18 @@ function detectCommands(cwd) {
|
|
|
74233
74268
|
return { commands: cmds, javascriptPackageManagers };
|
|
74234
74269
|
}
|
|
74235
74270
|
function staleDependencyReasons(cwd) {
|
|
74236
|
-
const pkgPath =
|
|
74237
|
-
if (!
|
|
74271
|
+
const pkgPath = join14(cwd, "package.json");
|
|
74272
|
+
if (!existsSync10(pkgPath)) return [];
|
|
74238
74273
|
const manifest = readPackageManifest(pkgPath);
|
|
74239
74274
|
if (!manifest) return [];
|
|
74240
74275
|
const reasons = [];
|
|
74241
|
-
const nodeModules =
|
|
74276
|
+
const nodeModules = join14(cwd, "node_modules");
|
|
74242
74277
|
const declaresDependencies = hasEntries(manifest.dependencies) || hasEntries(manifest.devDependencies);
|
|
74243
74278
|
const workspaceDirs2 = workspacePackageDirs(cwd, [
|
|
74244
74279
|
...workspacePatterns(manifest.workspaces),
|
|
74245
74280
|
...pnpmWorkspacePatterns(cwd)
|
|
74246
74281
|
]);
|
|
74247
|
-
if (!
|
|
74282
|
+
if (!existsSync10(nodeModules)) {
|
|
74248
74283
|
if (declaresDependencies || workspaceDirs2.length > 0) {
|
|
74249
74284
|
reasons.push("node_modules is missing");
|
|
74250
74285
|
}
|
|
@@ -74252,9 +74287,9 @@ function staleDependencyReasons(cwd) {
|
|
|
74252
74287
|
}
|
|
74253
74288
|
if (linkedOutOfTree(nodeModules, cwd)) return [];
|
|
74254
74289
|
for (const dir of workspaceDirs2) {
|
|
74255
|
-
const name = readPackageManifest(
|
|
74290
|
+
const name = readPackageManifest(join14(dir, "package.json"))?.name;
|
|
74256
74291
|
if (typeof name !== "string" || !name) continue;
|
|
74257
|
-
if (!
|
|
74292
|
+
if (!existsSync10(join14(nodeModules, name))) {
|
|
74258
74293
|
reasons.push(`workspace ${name} is not linked in node_modules`);
|
|
74259
74294
|
}
|
|
74260
74295
|
}
|
|
@@ -74262,12 +74297,12 @@ function staleDependencyReasons(cwd) {
|
|
|
74262
74297
|
"node_modules/.package-lock.json",
|
|
74263
74298
|
"node_modules/.modules.yaml",
|
|
74264
74299
|
"node_modules/.yarn-integrity"
|
|
74265
|
-
].map((relativePath) =>
|
|
74300
|
+
].map((relativePath) => join14(cwd, relativePath)).find((path7) => existsSync10(path7));
|
|
74266
74301
|
if (marker) {
|
|
74267
74302
|
const installedAt = statSync5(marker).mtimeMs;
|
|
74268
74303
|
for (const file of ["package.json", "package-lock.json", "pnpm-lock.yaml", "yarn.lock"]) {
|
|
74269
|
-
const path7 =
|
|
74270
|
-
if (
|
|
74304
|
+
const path7 = join14(cwd, file);
|
|
74305
|
+
if (existsSync10(path7) && statSync5(path7).mtimeMs > installedAt + 1e3) {
|
|
74271
74306
|
reasons.push(`${file} changed after the last install`);
|
|
74272
74307
|
}
|
|
74273
74308
|
}
|
|
@@ -74287,9 +74322,9 @@ function hasEntries(value) {
|
|
|
74287
74322
|
return typeof value === "object" && value !== null && Object.keys(value).length > 0;
|
|
74288
74323
|
}
|
|
74289
74324
|
function dependencyRefreshCommand(cwd, reasons) {
|
|
74290
|
-
const manifest = readPackageManifest(
|
|
74325
|
+
const manifest = readPackageManifest(join14(cwd, "package.json"));
|
|
74291
74326
|
const declared = declaredPackageManager(manifest?.packageManager);
|
|
74292
|
-
const pm = detectPackageManager(cwd, manifest,
|
|
74327
|
+
const pm = detectPackageManager(cwd, manifest, existsSync10(join14(cwd, "pnpm-workspace.yaml")));
|
|
74293
74328
|
const yarnMajor = declared?.manager === "yarn" ? Number.parseInt(declared.version.match(/^\d+/)?.[0] ?? "", 10) : Number.NaN;
|
|
74294
74329
|
const command = pm === "yarn" && yarnMajor >= 2 ? { tool: "corepack", args: ["yarn", "install"] } : pm === "npm" ? { tool: "npm", args: ["install", "--no-audit", "--no-fund"] } : { tool: pm, args: ["install"] };
|
|
74295
74330
|
return {
|
|
@@ -74461,7 +74496,7 @@ function createVerifyPlan(cwd, options = {}) {
|
|
|
74461
74496
|
origin: "declared"
|
|
74462
74497
|
}))
|
|
74463
74498
|
],
|
|
74464
|
-
(commandCwd) => readPackageManifest(
|
|
74499
|
+
(commandCwd) => readPackageManifest(join14(commandCwd ?? cwd, "package.json"))
|
|
74465
74500
|
);
|
|
74466
74501
|
return freezeVerifyPlan(
|
|
74467
74502
|
boundedDeclaredCommands(
|
|
@@ -74703,7 +74738,7 @@ async function runCmd(cwd, c, hostRepoRoot, ceiling, signal, resolveRunCwd) {
|
|
|
74703
74738
|
};
|
|
74704
74739
|
}
|
|
74705
74740
|
const commandCwd = resolveCommandCwd(spawnRunCwd(cwd, hostRepoRoot, resolveRunCwd), c.cwd);
|
|
74706
|
-
if (!
|
|
74741
|
+
if (!existsSync10(commandCwd)) {
|
|
74707
74742
|
return {
|
|
74708
74743
|
status: "failed",
|
|
74709
74744
|
durationMs: 0,
|
|
@@ -74813,7 +74848,7 @@ async function applyRemedy(remedy, ctx) {
|
|
|
74813
74848
|
spawnRunCwd(ctx.cwd, ctx.hostRepoRoot, ctx.options.resolveRunCwd),
|
|
74814
74849
|
void 0
|
|
74815
74850
|
) : ctx.cwd;
|
|
74816
|
-
if (!
|
|
74851
|
+
if (!existsSync10(join14(cwd, "package.json"))) return;
|
|
74817
74852
|
const install2 = dependencyRefreshCommand(cwd, [`retry remedy: ${ctx.reason}`]);
|
|
74818
74853
|
await runCmd(
|
|
74819
74854
|
cwd,
|
|
@@ -74849,6 +74884,7 @@ async function verifyBuild(cwd, options = {}) {
|
|
|
74849
74884
|
if (stale.length > 0) {
|
|
74850
74885
|
throwIfAborted(options.signal);
|
|
74851
74886
|
const install2 = dependencyRefreshCommand(cwd, stale);
|
|
74887
|
+
const pristine = pristineLockfiles(cwd);
|
|
74852
74888
|
emitActivity({
|
|
74853
74889
|
type: "activity",
|
|
74854
74890
|
id: "_verify",
|
|
@@ -74874,6 +74910,15 @@ async function verifyBuild(cwd, options = {}) {
|
|
|
74874
74910
|
ran = true;
|
|
74875
74911
|
failures.push({ cmd: install2.label, tail: outcome.tail });
|
|
74876
74912
|
}
|
|
74913
|
+
const restored = restoreLockfiles(cwd, pristine);
|
|
74914
|
+
if (restored.length > 0) {
|
|
74915
|
+
emitActivity({
|
|
74916
|
+
type: "activity",
|
|
74917
|
+
id: "_verify",
|
|
74918
|
+
kind: "warn",
|
|
74919
|
+
text: `restored ${restored.join(", ")}: the dependency refresh rewrote it, and the change touched no package.json`
|
|
74920
|
+
});
|
|
74921
|
+
}
|
|
74877
74922
|
}
|
|
74878
74923
|
for (const c of scoped.run) {
|
|
74879
74924
|
throwIfAborted(options.signal);
|
|
@@ -74981,7 +75026,7 @@ function creditSkippedDeclaredRequirements(specs, results) {
|
|
|
74981
75026
|
// ../baro-orchestrator/src/integration/dependency-materializer.ts
|
|
74982
75027
|
var LOCKFILE_NAMES = ["package-lock.json", "npm-shrinkwrap.json"];
|
|
74983
75028
|
function npmCachePath(env = process.env) {
|
|
74984
|
-
return env.npm_config_cache ?? env.NPM_CONFIG_CACHE ??
|
|
75029
|
+
return env.npm_config_cache ?? env.NPM_CONFIG_CACHE ?? join15(homedir4(), ".npm");
|
|
74985
75030
|
}
|
|
74986
75031
|
async function materializeDependencies(options) {
|
|
74987
75032
|
const { hostRoot, integrationRoot } = options;
|
|
@@ -75001,7 +75046,7 @@ async function materializeDependencies(options) {
|
|
|
75001
75046
|
const workspaces = [];
|
|
75002
75047
|
let rootMatch = false;
|
|
75003
75048
|
for (const dir of [root, ...workspaceDirs(root)]) {
|
|
75004
|
-
const hostDir =
|
|
75049
|
+
const hostDir = join15(hostRoot, relative6(root, dir));
|
|
75005
75050
|
const match = lockfileMatch(dir, hostDir);
|
|
75006
75051
|
if (dir === root) rootMatch = match === true;
|
|
75007
75052
|
workspaces.push(await materializeWorkspace(dir, hostDir, match ?? rootMatch, runInstall));
|
|
@@ -75009,18 +75054,18 @@ async function materializeDependencies(options) {
|
|
|
75009
75054
|
return { workspaces };
|
|
75010
75055
|
}
|
|
75011
75056
|
async function materializeWorkspace(dir, hostDir, match, runInstall) {
|
|
75012
|
-
if (!
|
|
75057
|
+
if (!existsSync11(join15(dir, "package.json"))) {
|
|
75013
75058
|
return { dir, action: "skipped", reason: "no package.json" };
|
|
75014
75059
|
}
|
|
75015
|
-
const nodeModules =
|
|
75016
|
-
const hostNodeModules =
|
|
75017
|
-
if (match &&
|
|
75060
|
+
const nodeModules = join15(dir, "node_modules");
|
|
75061
|
+
const hostNodeModules = join15(hostDir, "node_modules");
|
|
75062
|
+
if (match && existsSync11(hostNodeModules) && !existsSync11(nodeModules)) {
|
|
75018
75063
|
const linked = linkNodeModules(hostNodeModules, nodeModules);
|
|
75019
75064
|
if (linked === "linked") return { dir, action: "linked", reason: "lockfile matches host" };
|
|
75020
75065
|
if (linked === "exists") return alreadyPresent(dir);
|
|
75021
75066
|
return install(dir, runInstall, "symlink unsupported");
|
|
75022
75067
|
}
|
|
75023
|
-
if (
|
|
75068
|
+
if (existsSync11(nodeModules)) return alreadyPresent(dir);
|
|
75024
75069
|
return install(dir, runInstall, match ? "host has no node_modules" : "lockfile differs from host");
|
|
75025
75070
|
}
|
|
75026
75071
|
function alreadyPresent(dir) {
|
|
@@ -75080,8 +75125,8 @@ function nestedLockedPackages(root, depth = 3) {
|
|
|
75080
75125
|
}
|
|
75081
75126
|
for (const entry of entries) {
|
|
75082
75127
|
if (!entry.isDirectory() || NESTED_SCAN_SKIP.has(entry.name) || entry.name.startsWith(".")) continue;
|
|
75083
|
-
const child =
|
|
75084
|
-
if (
|
|
75128
|
+
const child = join15(dir, entry.name);
|
|
75129
|
+
if (existsSync11(join15(child, "package.json")) && LOCKFILE_NAMES.some((name) => existsSync11(join15(child, name)))) {
|
|
75085
75130
|
found.push(child);
|
|
75086
75131
|
}
|
|
75087
75132
|
scan(child, left - 1);
|
|
@@ -75092,17 +75137,17 @@ function nestedLockedPackages(root, depth = 3) {
|
|
|
75092
75137
|
}
|
|
75093
75138
|
function readWorkspacesField(dir) {
|
|
75094
75139
|
try {
|
|
75095
|
-
const manifest = JSON.parse(readFileSync11(
|
|
75140
|
+
const manifest = JSON.parse(readFileSync11(join15(dir, "package.json"), "utf8"));
|
|
75096
75141
|
return manifest.workspaces;
|
|
75097
75142
|
} catch {
|
|
75098
75143
|
return void 0;
|
|
75099
75144
|
}
|
|
75100
75145
|
}
|
|
75101
75146
|
function lockfileMatch(dir, hostDir) {
|
|
75102
|
-
const name = LOCKFILE_NAMES.find((candidate) =>
|
|
75147
|
+
const name = LOCKFILE_NAMES.find((candidate) => existsSync11(join15(dir, candidate)));
|
|
75103
75148
|
if (!name) return null;
|
|
75104
|
-
const local = sha256(
|
|
75105
|
-
return local !== null && local === sha256(
|
|
75149
|
+
const local = sha256(join15(dir, name));
|
|
75150
|
+
return local !== null && local === sha256(join15(hostDir, name));
|
|
75106
75151
|
}
|
|
75107
75152
|
function sha256(path7) {
|
|
75108
75153
|
try {
|
|
@@ -75147,7 +75192,7 @@ function capRunDiff(diff) {
|
|
|
75147
75192
|
import { createHash as createHash8 } from "crypto";
|
|
75148
75193
|
import {
|
|
75149
75194
|
appendFileSync,
|
|
75150
|
-
existsSync as
|
|
75195
|
+
existsSync as existsSync12,
|
|
75151
75196
|
mkdirSync as mkdirSync5,
|
|
75152
75197
|
readFileSync as readFileSync12,
|
|
75153
75198
|
readdirSync as readdirSync5,
|
|
@@ -75156,7 +75201,7 @@ import {
|
|
|
75156
75201
|
symlinkSync as symlinkSync2
|
|
75157
75202
|
} from "fs";
|
|
75158
75203
|
import { tmpdir as tmpdir3 } from "os";
|
|
75159
|
-
import { dirname as dirname8, join as
|
|
75204
|
+
import { dirname as dirname8, join as join16, resolve as resolve10 } from "path";
|
|
75160
75205
|
|
|
75161
75206
|
// ../baro-orchestrator/src/execution/gate-registry.ts
|
|
75162
75207
|
var EVIDENCE_CAPTURE = {
|
|
@@ -75344,7 +75389,7 @@ var WorktreeManager = class {
|
|
|
75344
75389
|
this.repoRoot = repoRoot;
|
|
75345
75390
|
this.gate = gate;
|
|
75346
75391
|
this.runId = runId;
|
|
75347
|
-
this.baseDir =
|
|
75392
|
+
this.baseDir = join16(tmpdir3(), "baro-worktrees", runId);
|
|
75348
75393
|
this.linkDepDirs = opts.linkDepDirs ?? true;
|
|
75349
75394
|
this.integrationRoot = opts.integrationRoot ?? repoRoot;
|
|
75350
75395
|
this.log = opts.onLog ?? ((line) => process.stderr.write(`[worktree] ${line}
|
|
@@ -75479,7 +75524,7 @@ var WorktreeManager = class {
|
|
|
75479
75524
|
if (name === INTEGRATION_WORKTREE_DIRNAME) {
|
|
75480
75525
|
throw new Error("story id collides with the integration worktree directory");
|
|
75481
75526
|
}
|
|
75482
|
-
return
|
|
75527
|
+
return join16(this.baseDir, name, worktreeLeafName(this.repoRoot));
|
|
75483
75528
|
}
|
|
75484
75529
|
/** Seal the manager before factories drain. An already-running create
|
|
75485
75530
|
* remains serialized by GitGate; queued/future creates stop at the gate. */
|
|
@@ -75794,7 +75839,7 @@ var WorktreeManager = class {
|
|
|
75794
75839
|
try {
|
|
75795
75840
|
const path7 = this.paths.get(storyId);
|
|
75796
75841
|
const branch = this.branchOf(storyId);
|
|
75797
|
-
if (!path7 || !
|
|
75842
|
+
if (!path7 || !existsSync12(path7) || !this.preserved.has(storyId)) {
|
|
75798
75843
|
const recorded = await this.resolvedRecoveryRef(storyId);
|
|
75799
75844
|
if (recorded) {
|
|
75800
75845
|
this.log(
|
|
@@ -75817,7 +75862,7 @@ var WorktreeManager = class {
|
|
|
75817
75862
|
const backup = await this.createRecoveryBranch(storyId, branch);
|
|
75818
75863
|
this.recordRecoveryRef(storyId, backup);
|
|
75819
75864
|
await this.removeWorktreeQuiet(path7, "releasePreserved");
|
|
75820
|
-
if (
|
|
75865
|
+
if (existsSync12(path7)) {
|
|
75821
75866
|
throw new Error(`could not release preserved worktree for story ${storyId}`);
|
|
75822
75867
|
}
|
|
75823
75868
|
this.paths.delete(storyId);
|
|
@@ -75864,7 +75909,7 @@ var WorktreeManager = class {
|
|
|
75864
75909
|
try {
|
|
75865
75910
|
const path7 = this.paths.get(storyId);
|
|
75866
75911
|
const branch = this.branchOf(storyId);
|
|
75867
|
-
if (!path7 || !
|
|
75912
|
+
if (!path7 || !existsSync12(path7)) {
|
|
75868
75913
|
if (preserveForRecovery) {
|
|
75869
75914
|
let branchHead;
|
|
75870
75915
|
try {
|
|
@@ -76139,7 +76184,7 @@ var WorktreeManager = class {
|
|
|
76139
76184
|
);
|
|
76140
76185
|
continue;
|
|
76141
76186
|
}
|
|
76142
|
-
if (this.preserved.has(storyId) &&
|
|
76187
|
+
if (this.preserved.has(storyId) && existsSync12(path7)) {
|
|
76143
76188
|
let status = "";
|
|
76144
76189
|
try {
|
|
76145
76190
|
;
|
|
@@ -76284,7 +76329,7 @@ var WorktreeManager = class {
|
|
|
76284
76329
|
const scan = (rel, depth) => {
|
|
76285
76330
|
let entries;
|
|
76286
76331
|
try {
|
|
76287
|
-
entries = readdirSync5(
|
|
76332
|
+
entries = readdirSync5(join16(root, rel) || root, { withFileTypes: true });
|
|
76288
76333
|
} catch {
|
|
76289
76334
|
return;
|
|
76290
76335
|
}
|
|
@@ -76302,7 +76347,7 @@ var WorktreeManager = class {
|
|
|
76302
76347
|
if (depth <= 0) return;
|
|
76303
76348
|
for (const e2 of entries) {
|
|
76304
76349
|
if (e2.isDirectory() && !SCAN_SKIP.has(e2.name) && !e2.name.startsWith(".")) {
|
|
76305
|
-
scan(rel ?
|
|
76350
|
+
scan(rel ? join16(rel, e2.name) : e2.name, depth - 1);
|
|
76306
76351
|
}
|
|
76307
76352
|
}
|
|
76308
76353
|
};
|
|
@@ -76354,15 +76399,15 @@ ${missing.join("\n")}
|
|
|
76354
76399
|
}
|
|
76355
76400
|
symlinkDepDirs(worktreePath) {
|
|
76356
76401
|
for (const { rel, dir } of this.depLocations()) {
|
|
76357
|
-
const shared =
|
|
76358
|
-
const dest =
|
|
76359
|
-
if (
|
|
76402
|
+
const shared = join16(this.repoRoot, rel, dir);
|
|
76403
|
+
const dest = join16(worktreePath, rel, dir);
|
|
76404
|
+
if (existsSync12(dest)) continue;
|
|
76360
76405
|
try {
|
|
76361
|
-
if (!
|
|
76362
|
-
mkdirSync5(
|
|
76406
|
+
if (!existsSync12(shared)) mkdirSync5(shared, { recursive: true });
|
|
76407
|
+
mkdirSync5(join16(worktreePath, rel), { recursive: true });
|
|
76363
76408
|
symlinkSync2(shared, dest, "junction");
|
|
76364
76409
|
} catch (e2) {
|
|
76365
|
-
this.log(`could not symlink ${
|
|
76410
|
+
this.log(`could not symlink ${join16(rel, dir)} into worktree (${errMsg3(e2)})`);
|
|
76366
76411
|
}
|
|
76367
76412
|
}
|
|
76368
76413
|
}
|
|
@@ -76393,7 +76438,7 @@ ${missing.join("\n")}
|
|
|
76393
76438
|
);
|
|
76394
76439
|
return;
|
|
76395
76440
|
}
|
|
76396
|
-
const resetSpecs = this.depLocations().map(({ rel, dir }) =>
|
|
76441
|
+
const resetSpecs = this.depLocations().map(({ rel, dir }) => join16(rel, dir));
|
|
76397
76442
|
if (resetSpecs.length) await execQuiet("git", ["reset", "-q", "--", ...resetSpecs], worktreePath);
|
|
76398
76443
|
let staged = [];
|
|
76399
76444
|
let diffFailed = false;
|
|
@@ -76439,7 +76484,7 @@ ${missing.join("\n")}
|
|
|
76439
76484
|
async commitFailedWork(storyId, worktreePath) {
|
|
76440
76485
|
try {
|
|
76441
76486
|
await runRepositoryCommand("git", ["add", "-A"], { cwd: worktreePath });
|
|
76442
|
-
const resetSpecs = this.depLocations().map(({ rel, dir }) =>
|
|
76487
|
+
const resetSpecs = this.depLocations().map(({ rel, dir }) => join16(rel, dir));
|
|
76443
76488
|
if (resetSpecs.length > 0) {
|
|
76444
76489
|
await execQuiet(
|
|
76445
76490
|
"git",
|
|
@@ -76521,7 +76566,7 @@ ${missing.join("\n")}
|
|
|
76521
76566
|
async releaseLogicalStory(storyId, path7, branch) {
|
|
76522
76567
|
await this.secureRecoveryMaterial(storyId, "release_logical_story");
|
|
76523
76568
|
await this.removeWorktreeQuiet(path7, "releaseLogicalStory");
|
|
76524
|
-
if (
|
|
76569
|
+
if (existsSync12(path7)) {
|
|
76525
76570
|
throw new Error(`could not release worktree for story ${storyId}`);
|
|
76526
76571
|
}
|
|
76527
76572
|
this.paths.delete(storyId);
|
|
@@ -76570,7 +76615,7 @@ ${missing.join("\n")}
|
|
|
76570
76615
|
}
|
|
76571
76616
|
async removeWorktreeQuiet(path7, reason) {
|
|
76572
76617
|
await execQuiet("git", ["worktree", "remove", "--force", path7], this.repoRoot);
|
|
76573
|
-
if (
|
|
76618
|
+
if (existsSync12(path7)) {
|
|
76574
76619
|
this.log(`force-removed worktree ${path7} after git refused (${reason})`);
|
|
76575
76620
|
rmSyncQuiet(path7);
|
|
76576
76621
|
} else {
|
|
@@ -76622,9 +76667,9 @@ ${missing.join("\n")}
|
|
|
76622
76667
|
["branch", "--list", branch, "--format=%(refname:short)"],
|
|
76623
76668
|
{ cwd: this.repoRoot }
|
|
76624
76669
|
);
|
|
76625
|
-
if (
|
|
76670
|
+
if (existsSync12(path7) || remainingBranch.trim()) {
|
|
76626
76671
|
throw new Error(
|
|
76627
|
-
`residual setup state remains` + (
|
|
76672
|
+
`residual setup state remains` + (existsSync12(path7) ? ` at ${path7}` : "") + (remainingBranch.trim() ? ` on branch ${branch}` : "")
|
|
76628
76673
|
);
|
|
76629
76674
|
}
|
|
76630
76675
|
}
|
|
@@ -78375,7 +78420,7 @@ function formatRoute(route) {
|
|
|
78375
78420
|
|
|
78376
78421
|
// ../baro-orchestrator/src/execution/auditor.ts
|
|
78377
78422
|
import { createHmac, randomBytes as randomBytes2 } from "crypto";
|
|
78378
|
-
import { appendFileSync as appendFileSync2, chmodSync as chmodSync2, existsSync as
|
|
78423
|
+
import { appendFileSync as appendFileSync2, chmodSync as chmodSync2, existsSync as existsSync13, mkdirSync as mkdirSync6 } from "fs";
|
|
78379
78424
|
import { dirname as dirname9 } from "path";
|
|
78380
78425
|
|
|
78381
78426
|
// ../baro-orchestrator/src/events/define.ts
|
|
@@ -78638,7 +78683,7 @@ var Auditor = class extends BusMember {
|
|
|
78638
78683
|
this.filter = opts.filter;
|
|
78639
78684
|
try {
|
|
78640
78685
|
mkdirSync6(dirname9(this.path), { recursive: true });
|
|
78641
|
-
if (
|
|
78686
|
+
if (existsSync13(this.path)) chmodSync2(this.path, 384);
|
|
78642
78687
|
} catch (e2) {
|
|
78643
78688
|
this.disable(`mkdir failed: ${e2?.message ?? String(e2)}`);
|
|
78644
78689
|
}
|
|
@@ -79609,7 +79654,7 @@ function correlationKey(correlation) {
|
|
|
79609
79654
|
// ../baro-orchestrator/src/execution/collaboration-bridge.ts
|
|
79610
79655
|
import {
|
|
79611
79656
|
appendFileSync as appendFileSync3,
|
|
79612
|
-
existsSync as
|
|
79657
|
+
existsSync as existsSync14,
|
|
79613
79658
|
mkdirSync as mkdirSync7,
|
|
79614
79659
|
lstatSync as lstatSync3,
|
|
79615
79660
|
readFileSync as readFileSync14,
|
|
@@ -79622,7 +79667,7 @@ import { randomBytes as randomBytes3, randomUUID as randomUUID5 } from "crypto";
|
|
|
79622
79667
|
import {
|
|
79623
79668
|
createServer
|
|
79624
79669
|
} from "http";
|
|
79625
|
-
import { basename as basename8, join as
|
|
79670
|
+
import { basename as basename8, join as join17 } from "path";
|
|
79626
79671
|
|
|
79627
79672
|
// ../baro-orchestrator/scripts/collaboration-inbox-path.mjs
|
|
79628
79673
|
var INBOX_NAME_PREFIX = "agent-";
|
|
@@ -81546,14 +81591,14 @@ var CollaborationBridge = class extends SerializedObserver {
|
|
|
81546
81591
|
constructor(opts) {
|
|
81547
81592
|
super();
|
|
81548
81593
|
this.opts = opts;
|
|
81549
|
-
this.outboxDir =
|
|
81550
|
-
this.challengeInflightDir = opts.challengeInflightDir ??
|
|
81594
|
+
this.outboxDir = join17(opts.sessionDir, "outbox");
|
|
81595
|
+
this.challengeInflightDir = opts.challengeInflightDir ?? join17(opts.sessionDir, "challenge-inflight");
|
|
81551
81596
|
if (opts.goalInvariantIds && (opts.goalInvariantIds.some((id) => !validGoalInvariantId(id)) || new Set(opts.goalInvariantIds).size !== opts.goalInvariantIds.length)) {
|
|
81552
81597
|
throw new Error("collaboration bridge goal invariant ids are invalid");
|
|
81553
81598
|
}
|
|
81554
81599
|
this.allowedGoalInvariantIds = opts.goalInvariantIds ? new Set(opts.goalInvariantIds) : null;
|
|
81555
|
-
this.inboxDir =
|
|
81556
|
-
this.decisionsDir =
|
|
81600
|
+
this.inboxDir = join17(opts.sessionDir, "inbox");
|
|
81601
|
+
this.decisionsDir = join17(opts.sessionDir, "decisions");
|
|
81557
81602
|
mkdirSync7(this.challengeInflightDir, { recursive: true });
|
|
81558
81603
|
if (opts.unsafeAllowFilesystemTransport === true) {
|
|
81559
81604
|
mkdirSync7(this.outboxDir, { recursive: true });
|
|
@@ -81898,7 +81943,7 @@ var CollaborationBridge = class extends SerializedObserver {
|
|
|
81898
81943
|
}
|
|
81899
81944
|
this.publishAvailableInflightChallenges();
|
|
81900
81945
|
if (this.opts.unsafeAllowFilesystemTransport === true) {
|
|
81901
|
-
if (!
|
|
81946
|
+
if (!existsSync14(this.outboxDir)) {
|
|
81902
81947
|
this.stopPolling();
|
|
81903
81948
|
return;
|
|
81904
81949
|
}
|
|
@@ -81910,9 +81955,9 @@ var CollaborationBridge = class extends SerializedObserver {
|
|
|
81910
81955
|
});
|
|
81911
81956
|
}
|
|
81912
81957
|
consumeAvailableOutbox() {
|
|
81913
|
-
if (!
|
|
81958
|
+
if (!existsSync14(this.outboxDir)) return;
|
|
81914
81959
|
const files = readdirSync6(this.outboxDir).filter((name) => name.endsWith(".json")).sort();
|
|
81915
|
-
for (const name of files) this.consume(
|
|
81960
|
+
for (const name of files) this.consume(join17(this.outboxDir, name));
|
|
81916
81961
|
}
|
|
81917
81962
|
consume(path7) {
|
|
81918
81963
|
let removeOutboxRecord = true;
|
|
@@ -82021,7 +82066,7 @@ var CollaborationBridge = class extends SerializedObserver {
|
|
|
82021
82066
|
);
|
|
82022
82067
|
return { deliveryGaps };
|
|
82023
82068
|
}
|
|
82024
|
-
const inflightPath =
|
|
82069
|
+
const inflightPath = join17(
|
|
82025
82070
|
this.challengeInflightDir,
|
|
82026
82071
|
`${randomUUID5()}.json`
|
|
82027
82072
|
);
|
|
@@ -82067,12 +82112,12 @@ var CollaborationBridge = class extends SerializedObserver {
|
|
|
82067
82112
|
if (persisted) {
|
|
82068
82113
|
return sameChallenge2(candidate, persisted) ? "duplicate" : `challenge id ${candidate.challengeId} conflicts with persisted evidence`;
|
|
82069
82114
|
}
|
|
82070
|
-
if (
|
|
82115
|
+
if (existsSync14(this.challengeInflightDir)) {
|
|
82071
82116
|
for (const name of readdirSync6(this.challengeInflightDir)) {
|
|
82072
82117
|
if (!name.endsWith(".json")) continue;
|
|
82073
82118
|
try {
|
|
82074
82119
|
const retained = this.readInflightChallenge(
|
|
82075
|
-
|
|
82120
|
+
join17(this.challengeInflightDir, name)
|
|
82076
82121
|
);
|
|
82077
82122
|
if (retained.challengeId !== candidate.challengeId) continue;
|
|
82078
82123
|
return sameChallenge2(candidate, retained) ? "duplicate" : `challenge id ${candidate.challengeId} conflicts with retained evidence`;
|
|
@@ -82107,12 +82152,12 @@ var CollaborationBridge = class extends SerializedObserver {
|
|
|
82107
82152
|
}
|
|
82108
82153
|
}
|
|
82109
82154
|
publishAvailableInflightChallenges() {
|
|
82110
|
-
if (!
|
|
82155
|
+
if (!existsSync14(this.challengeInflightDir)) return;
|
|
82111
82156
|
const files = readdirSync6(this.challengeInflightDir).filter((name) => name.endsWith(".json")).sort();
|
|
82112
82157
|
for (const name of files) {
|
|
82113
82158
|
try {
|
|
82114
82159
|
this.publishInflightChallenge(
|
|
82115
|
-
|
|
82160
|
+
join17(this.challengeInflightDir, name),
|
|
82116
82161
|
false
|
|
82117
82162
|
);
|
|
82118
82163
|
} catch (error) {
|
|
@@ -82163,10 +82208,10 @@ var CollaborationBridge = class extends SerializedObserver {
|
|
|
82163
82208
|
...challenge.storyId ? { storyId: challenge.storyId } : {}
|
|
82164
82209
|
});
|
|
82165
82210
|
}
|
|
82166
|
-
if (!
|
|
82211
|
+
if (!existsSync14(this.challengeInflightDir)) return;
|
|
82167
82212
|
const files = readdirSync6(this.challengeInflightDir).filter((name) => name.endsWith(".json")).sort();
|
|
82168
82213
|
for (const name of files) {
|
|
82169
|
-
const path7 =
|
|
82214
|
+
const path7 = join17(this.challengeInflightDir, name);
|
|
82170
82215
|
try {
|
|
82171
82216
|
const retained = this.readInflightChallenge(path7);
|
|
82172
82217
|
const persisted = receipt.projection.challenges.some(
|
|
@@ -82489,13 +82534,13 @@ var CollaborationBridge = class extends SerializedObserver {
|
|
|
82489
82534
|
resetInbox(agentId) {
|
|
82490
82535
|
if (this.opts.unsafeAllowFilesystemTransport !== true) return;
|
|
82491
82536
|
try {
|
|
82492
|
-
unlinkSync3(
|
|
82537
|
+
unlinkSync3(join17(this.inboxDir, inboxFilenameForAgentId(agentId)));
|
|
82493
82538
|
} catch {
|
|
82494
82539
|
}
|
|
82495
82540
|
}
|
|
82496
82541
|
writeUnsafeInbox(agentId, value) {
|
|
82497
82542
|
appendFileSync3(
|
|
82498
|
-
|
|
82543
|
+
join17(this.inboxDir, inboxFilenameForAgentId(agentId)),
|
|
82499
82544
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...asRecord(value) }) + "\n"
|
|
82500
82545
|
);
|
|
82501
82546
|
}
|
|
@@ -82630,9 +82675,9 @@ var CollaborationBridge = class extends SerializedObserver {
|
|
|
82630
82675
|
writeDecision(proposalId, decision) {
|
|
82631
82676
|
if (this.opts.unsafeAllowFilesystemTransport !== true) return;
|
|
82632
82677
|
const name = safeName(proposalId);
|
|
82633
|
-
const path7 =
|
|
82634
|
-
if (
|
|
82635
|
-
const pending =
|
|
82678
|
+
const path7 = join17(this.decisionsDir, `${name}.json`);
|
|
82679
|
+
if (existsSync14(path7)) return;
|
|
82680
|
+
const pending = join17(
|
|
82636
82681
|
this.decisionsDir,
|
|
82637
82682
|
`.${name}.${randomUUID5()}.tmp`
|
|
82638
82683
|
);
|
|
@@ -90666,9 +90711,9 @@ var ClaudeStreamResultCollector = class {
|
|
|
90666
90711
|
// ../baro-orchestrator/src/harness/critic-cli-isolation.ts
|
|
90667
90712
|
import { mkdtemp, rm } from "fs/promises";
|
|
90668
90713
|
import { tmpdir as tmpdir4 } from "os";
|
|
90669
|
-
import { join as
|
|
90714
|
+
import { join as join18 } from "path";
|
|
90670
90715
|
async function withIsolatedCriticCwd(run2) {
|
|
90671
|
-
const cwd = await mkdtemp(
|
|
90716
|
+
const cwd = await mkdtemp(join18(tmpdir4(), "baro-critic-"));
|
|
90672
90717
|
try {
|
|
90673
90718
|
return await run2(cwd);
|
|
90674
90719
|
} finally {
|
|
@@ -91710,7 +91755,7 @@ function hashField(hash, label, value) {
|
|
|
91710
91755
|
function errorCode(error) {
|
|
91711
91756
|
return typeof error === "object" && error !== null && typeof error.code === "string" ? error.code : null;
|
|
91712
91757
|
}
|
|
91713
|
-
async function prepareCriticEvaluation(criteria, resultText, agentId, source) {
|
|
91758
|
+
async function prepareCriticEvaluation(criteria, resultText, agentId, source, establishedFor) {
|
|
91714
91759
|
const beforeFingerprint = await repositoryFingerprintFor(agentId, source);
|
|
91715
91760
|
const [commandEvidence, repositoryEvidence, decisionDocument, publishedNotes, altitude, writeSurface] = await Promise.all([
|
|
91716
91761
|
commandEvidenceFor(agentId, source),
|
|
@@ -91732,6 +91777,7 @@ async function prepareCriticEvaluation(criteria, resultText, agentId, source) {
|
|
|
91732
91777
|
(issue2) => /repository (?:evidence|target)/i.test(issue2)
|
|
91733
91778
|
) ? [fingerprintIssue] : []
|
|
91734
91779
|
];
|
|
91780
|
+
const established = issues.length === 0 && afterFingerprint.value && establishedFor ? establishedFor(afterFingerprint.value).filter((criterion) => criteria.includes(criterion)) : [];
|
|
91735
91781
|
const segments = splitAcceptanceContract(criteria);
|
|
91736
91782
|
let offset = 0;
|
|
91737
91783
|
const prompts = segments.map((segmentCriteria, index) => {
|
|
@@ -91745,7 +91791,8 @@ async function prepareCriticEvaluation(criteria, resultText, agentId, source) {
|
|
|
91745
91791
|
publishedNotes,
|
|
91746
91792
|
source?.hostRunsWholeTreeVerification === true,
|
|
91747
91793
|
altitude.section,
|
|
91748
|
-
writeSurface
|
|
91794
|
+
writeSurface,
|
|
91795
|
+
established.filter((criterion) => segmentCriteria.includes(criterion))
|
|
91749
91796
|
);
|
|
91750
91797
|
offset += segmentCriteria.length;
|
|
91751
91798
|
return prompt;
|
|
@@ -91764,7 +91811,8 @@ async function prepareCriticEvaluation(criteria, resultText, agentId, source) {
|
|
|
91764
91811
|
status: issues.length > 0 ? "inconclusive" : "ready",
|
|
91765
91812
|
issues,
|
|
91766
91813
|
staleCommands: staleCommandsToRerun(commandEvidence, issues),
|
|
91767
|
-
repositoryFingerprint: issues.length === 0 ? afterFingerprint.value : null
|
|
91814
|
+
repositoryFingerprint: issues.length === 0 ? afterFingerprint.value : null,
|
|
91815
|
+
established
|
|
91768
91816
|
};
|
|
91769
91817
|
}
|
|
91770
91818
|
function mergeSegmentVerdicts(verdicts) {
|
|
@@ -91806,7 +91854,7 @@ function inconclusiveEvidenceVerdict(issues) {
|
|
|
91806
91854
|
violatedCriteria: ["[acceptance evidence unavailable]"]
|
|
91807
91855
|
};
|
|
91808
91856
|
}
|
|
91809
|
-
function buildEvalPrompt(criteria, resultText, commandEvidence = null, repositoryEvidence = null, decisionDocument = null, segment, publishedNotes = [], hostRunsWholeTreeVerification = false, altitudeSection = null, writeSurface = null) {
|
|
91857
|
+
function buildEvalPrompt(criteria, resultText, commandEvidence = null, repositoryEvidence = null, decisionDocument = null, segment, publishedNotes = [], hostRunsWholeTreeVerification = false, altitudeSection = null, writeSurface = null, established = []) {
|
|
91810
91858
|
const criteriaList = renderCompleteAcceptanceContract(
|
|
91811
91859
|
criteria,
|
|
91812
91860
|
segment?.offset ?? 0
|
|
@@ -91857,6 +91905,7 @@ function buildEvalPrompt(criteria, resultText, commandEvidence = null, repositor
|
|
|
91857
91905
|
] : [],
|
|
91858
91906
|
criteriaList,
|
|
91859
91907
|
"",
|
|
91908
|
+
...establishedSection(criteria, established, segment?.offset ?? 0),
|
|
91860
91909
|
"## Baro-captured command/test evidence",
|
|
91861
91910
|
commandEvidence ? boundText(
|
|
91862
91911
|
redactSensitiveText(commandEvidence),
|
|
@@ -91891,6 +91940,15 @@ function buildEvalPrompt(criteria, resultText, commandEvidence = null, repositor
|
|
|
91891
91940
|
}
|
|
91892
91941
|
return prompt;
|
|
91893
91942
|
}
|
|
91943
|
+
function establishedSection(criteria, established, offset) {
|
|
91944
|
+
const numbers = criteria.map((criterion, index) => established.includes(criterion) ? offset + index + 1 : null).filter((number3) => number3 !== null);
|
|
91945
|
+
if (numbers.length === 0) return [];
|
|
91946
|
+
return [
|
|
91947
|
+
"## Already established",
|
|
91948
|
+
`An earlier review of this exact workspace content (identical changed-file bytes) found criteria ${numbers.join(", ")} satisfied. They stand: do not re-judge them or list them as violated, even when the evidence that proved them no longer appears below. Judge the other criteria as usual.`,
|
|
91949
|
+
""
|
|
91950
|
+
];
|
|
91951
|
+
}
|
|
91894
91952
|
var MAX_WRITE_SURFACE_PATHS = 60;
|
|
91895
91953
|
async function writeSurfaceFor(agentId, source) {
|
|
91896
91954
|
if (!source?.writeSurface) return null;
|
|
@@ -92545,6 +92603,43 @@ function errorMessage(error) {
|
|
|
92545
92603
|
return error?.message ?? String(error);
|
|
92546
92604
|
}
|
|
92547
92605
|
|
|
92606
|
+
// ../baro-orchestrator/src/acceptance/criterion-ledger.ts
|
|
92607
|
+
var CriterionLedger = class {
|
|
92608
|
+
entries = /* @__PURE__ */ new Map();
|
|
92609
|
+
established(agentId, fingerprint) {
|
|
92610
|
+
const entry = this.entries.get(agentId);
|
|
92611
|
+
return fingerprint && entry?.fingerprint === fingerprint ? [...entry.passed] : [];
|
|
92612
|
+
}
|
|
92613
|
+
record(agentId, fingerprint, criteria, evaluation) {
|
|
92614
|
+
if (!fingerprint || (evaluation.status ?? "evaluated") !== "evaluated") return;
|
|
92615
|
+
if (evaluation.verdict === "fail" && evaluation.violatedCriteria.length === 0) return;
|
|
92616
|
+
const failed = /* @__PURE__ */ new Set([
|
|
92617
|
+
...evaluation.violatedCriteria,
|
|
92618
|
+
...(evaluation.contractConflicts ?? []).map(({ criterion }) => criterion)
|
|
92619
|
+
]);
|
|
92620
|
+
const entry = this.entries.get(agentId);
|
|
92621
|
+
const passed = entry?.fingerprint === fingerprint ? entry.passed : /* @__PURE__ */ new Set();
|
|
92622
|
+
for (const criterion of criteria) {
|
|
92623
|
+
if (!failed.has(criterion)) passed.add(criterion);
|
|
92624
|
+
}
|
|
92625
|
+
this.entries.set(agentId, { fingerprint, passed });
|
|
92626
|
+
}
|
|
92627
|
+
};
|
|
92628
|
+
function honorEstablished(evaluation, established) {
|
|
92629
|
+
if (established.length === 0 || evaluation.verdict !== "fail") return evaluation;
|
|
92630
|
+
if ((evaluation.status ?? "evaluated") !== "evaluated") return evaluation;
|
|
92631
|
+
const settled = new Set(established);
|
|
92632
|
+
const violated = evaluation.violatedCriteria.filter((criterion) => !settled.has(criterion));
|
|
92633
|
+
if (violated.length === evaluation.violatedCriteria.length) return evaluation;
|
|
92634
|
+
const note = `(Baro: ${evaluation.violatedCriteria.length - violated.length} listed violation(s) were criteria an earlier review of this exact content already found satisfied; they stand.)`;
|
|
92635
|
+
return {
|
|
92636
|
+
...evaluation,
|
|
92637
|
+
verdict: violated.length === 0 ? "pass" : "fail",
|
|
92638
|
+
violatedCriteria: violated,
|
|
92639
|
+
reasoning: `${evaluation.reasoning} ${note}`.trim()
|
|
92640
|
+
};
|
|
92641
|
+
}
|
|
92642
|
+
|
|
92548
92643
|
// ../baro-orchestrator/src/acceptance/critic-pending.ts
|
|
92549
92644
|
async function drainCriticPending(pending) {
|
|
92550
92645
|
while (pending.size > 0) {
|
|
@@ -92570,6 +92665,7 @@ var OneShotCritic = class extends BusMember {
|
|
|
92570
92665
|
}
|
|
92571
92666
|
terminalAuthorities;
|
|
92572
92667
|
maxEmissionsPerAgent;
|
|
92668
|
+
ledger = new CriterionLedger();
|
|
92573
92669
|
targets;
|
|
92574
92670
|
runId;
|
|
92575
92671
|
evidence;
|
|
@@ -92627,21 +92723,28 @@ var OneShotCritic = class extends BusMember {
|
|
|
92627
92723
|
criteria,
|
|
92628
92724
|
resultText,
|
|
92629
92725
|
agentId,
|
|
92630
|
-
this.evidence
|
|
92726
|
+
this.evidence,
|
|
92727
|
+
(fingerprint) => this.ledger.established(agentId, fingerprint)
|
|
92631
92728
|
);
|
|
92632
92729
|
repositoryFingerprint2 = preparation.repositoryFingerprint;
|
|
92633
92730
|
staleCommands = preparation.staleCommands;
|
|
92634
92731
|
preparationReady = preparation.status === "ready";
|
|
92635
|
-
evaluation = preparationReady ?
|
|
92636
|
-
|
|
92637
|
-
|
|
92638
|
-
|
|
92639
|
-
|
|
92732
|
+
evaluation = preparationReady ? honorEstablished(
|
|
92733
|
+
applyContractConflicts(
|
|
92734
|
+
mergeSegmentVerdicts(
|
|
92735
|
+
await Promise.all(
|
|
92736
|
+
preparation.prompts.map(
|
|
92737
|
+
(prompt) => this.evaluate(prompt, agentId, turn)
|
|
92738
|
+
)
|
|
92640
92739
|
)
|
|
92641
|
-
)
|
|
92740
|
+
),
|
|
92741
|
+
criteria
|
|
92642
92742
|
),
|
|
92643
|
-
|
|
92743
|
+
preparation.established
|
|
92644
92744
|
) : inconclusiveEvidenceVerdict(preparation.issues);
|
|
92745
|
+
if (preparationReady) {
|
|
92746
|
+
this.ledger.record(agentId, repositoryFingerprint2, criteria, evaluation);
|
|
92747
|
+
}
|
|
92645
92748
|
} catch (error) {
|
|
92646
92749
|
evaluation = {
|
|
92647
92750
|
status: "inconclusive",
|
|
@@ -93166,13 +93269,13 @@ var CriticTargetRegistry = class extends BusMember {
|
|
|
93166
93269
|
};
|
|
93167
93270
|
|
|
93168
93271
|
// ../baro-orchestrator/src/harness/os-sandbox.ts
|
|
93169
|
-
import { accessSync as accessSync3, constants as constants4, existsSync as
|
|
93272
|
+
import { accessSync as accessSync3, constants as constants4, existsSync as existsSync16, mkdtempSync, realpathSync as realpathSync9 } from "fs";
|
|
93170
93273
|
import { homedir as homedir6, tmpdir as tmpdir5 } from "os";
|
|
93171
|
-
import { delimiter as delimiter2, join as
|
|
93274
|
+
import { delimiter as delimiter2, join as join21, resolve as resolve14 } from "path";
|
|
93172
93275
|
import { spawn as spawn3 } from "child_process";
|
|
93173
93276
|
|
|
93174
93277
|
// ../baro-orchestrator/src/execution/shell-containment.ts
|
|
93175
|
-
import { execFileSync as
|
|
93278
|
+
import { execFileSync as execFileSync4 } from "child_process";
|
|
93176
93279
|
import * as fs4 from "fs";
|
|
93177
93280
|
import * as path4 from "path";
|
|
93178
93281
|
function gitDiscoveryBounds() {
|
|
@@ -93186,12 +93289,12 @@ function shellContainmentRefusal(cwd, command, access) {
|
|
|
93186
93289
|
return reason === null ? null : `${shellContainmentGateToken()} ${reason}`;
|
|
93187
93290
|
}
|
|
93188
93291
|
function shellAccessContext(cwd, options) {
|
|
93189
|
-
const
|
|
93292
|
+
const git3 = gitSandboxPaths(cwd);
|
|
93190
93293
|
return {
|
|
93191
|
-
git:
|
|
93294
|
+
git: git3,
|
|
93192
93295
|
dependencyTargets: dependencySymlinkTargets(
|
|
93193
93296
|
cwd,
|
|
93194
|
-
|
|
93297
|
+
git3.commonWorktreeRoot
|
|
93195
93298
|
),
|
|
93196
93299
|
collaboration: resolveCollaborationShellAccess(options.collaboration),
|
|
93197
93300
|
writeSandbox: hasMacosWriteSandbox()
|
|
@@ -93217,7 +93320,7 @@ function gitSandboxPaths(cwd) {
|
|
|
93217
93320
|
const { timeout, maxBuffer } = gitDiscoveryBounds();
|
|
93218
93321
|
try {
|
|
93219
93322
|
const gitDir = fs4.realpathSync.native(
|
|
93220
|
-
|
|
93323
|
+
execFileSync4("git", ["rev-parse", "--absolute-git-dir"], {
|
|
93221
93324
|
cwd,
|
|
93222
93325
|
encoding: "utf8",
|
|
93223
93326
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -93225,7 +93328,7 @@ function gitSandboxPaths(cwd) {
|
|
|
93225
93328
|
maxBuffer
|
|
93226
93329
|
}).trim()
|
|
93227
93330
|
);
|
|
93228
|
-
const commonRaw =
|
|
93331
|
+
const commonRaw = execFileSync4(
|
|
93229
93332
|
"git",
|
|
93230
93333
|
["rev-parse", "--path-format=absolute", "--git-common-dir"],
|
|
93231
93334
|
{
|
|
@@ -93240,7 +93343,7 @@ function gitSandboxPaths(cwd) {
|
|
|
93240
93343
|
const paths = [gitDir, path4.join(commonDir, "objects")];
|
|
93241
93344
|
let branch = "";
|
|
93242
93345
|
try {
|
|
93243
|
-
branch =
|
|
93346
|
+
branch = execFileSync4("git", ["symbolic-ref", "--quiet", "HEAD"], {
|
|
93244
93347
|
cwd,
|
|
93245
93348
|
encoding: "utf8",
|
|
93246
93349
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -93924,7 +94027,7 @@ function importAliases() {
|
|
|
93924
94027
|
const imports = [
|
|
93925
94028
|
[spelled(() => fs4), "fs"],
|
|
93926
94029
|
[spelled(() => path4), "path"],
|
|
93927
|
-
[spelled(() =>
|
|
94030
|
+
[spelled(() => execFileSync4), "execFileSync"]
|
|
93928
94031
|
];
|
|
93929
94032
|
return imports.filter(([alias, name]) => alias !== void 0 && alias !== name).map(([alias, name]) => `const ${alias} = ${name}`);
|
|
93930
94033
|
}
|
|
@@ -93932,13 +94035,13 @@ function importAliases() {
|
|
|
93932
94035
|
// ../baro-orchestrator/src/harness/package-cache.ts
|
|
93933
94036
|
import { mkdirSync as mkdirSync8, readdirSync as readdirSync8, realpathSync as realpathSync8 } from "fs";
|
|
93934
94037
|
import { homedir as homedir5 } from "os";
|
|
93935
|
-
import { join as
|
|
94038
|
+
import { join as join20 } from "path";
|
|
93936
94039
|
function storyPackageCache(env = process.env, worktreeRoot = null) {
|
|
93937
94040
|
const configured = env.BARO_PACKAGE_CACHE?.trim();
|
|
93938
|
-
const requested = configured ? configured :
|
|
94041
|
+
const requested = configured ? configured : join20(homedir5(), ".baro", "cache", "packages");
|
|
93939
94042
|
mkdirSync8(requested, { recursive: true });
|
|
93940
94043
|
const root = realpathSync8(requested);
|
|
93941
|
-
const at = (name) =>
|
|
94044
|
+
const at = (name) => join20(root, name);
|
|
93942
94045
|
return {
|
|
93943
94046
|
root,
|
|
93944
94047
|
env: {
|
|
@@ -93957,7 +94060,7 @@ function storyPackageCache(env = process.env, worktreeRoot = null) {
|
|
|
93957
94060
|
}
|
|
93958
94061
|
function storyCargoTargetDir(cacheRoot, worktreeRoot) {
|
|
93959
94062
|
const repository = gitSandboxPaths(worktreeRoot).commonWorktreeRoot ?? worktreeRoot;
|
|
93960
|
-
const dir =
|
|
94063
|
+
const dir = join20(cacheRoot, "cargo-target", repositoryCacheKey(repository));
|
|
93961
94064
|
mkdirSync8(dir, { recursive: true });
|
|
93962
94065
|
return dir;
|
|
93963
94066
|
}
|
|
@@ -93973,7 +94076,7 @@ function sharedDependencyTargets(worktreeRoot, depth = 4) {
|
|
|
93973
94076
|
return;
|
|
93974
94077
|
}
|
|
93975
94078
|
for (const entry of entries) {
|
|
93976
|
-
const full =
|
|
94079
|
+
const full = join20(dir, entry.name);
|
|
93977
94080
|
if (SHARED_DEPENDENCY_DIRS.has(entry.name)) {
|
|
93978
94081
|
if (entry.isSymbolicLink()) {
|
|
93979
94082
|
try {
|
|
@@ -94017,14 +94120,14 @@ function confinedSpawn(lane, binary, args, worktreeRoot, env = process.env) {
|
|
|
94017
94120
|
if (env.BARO_UNSAFE_NO_SANDBOX === "1" || !resolvesToExecutable(binary, env.PATH)) {
|
|
94018
94121
|
return { binary, args: [...args], env: credentialEnv };
|
|
94019
94122
|
}
|
|
94020
|
-
if (process.platform !== "darwin" || !
|
|
94123
|
+
if (process.platform !== "darwin" || !existsSync16("/usr/bin/sandbox-exec")) {
|
|
94021
94124
|
return {
|
|
94022
94125
|
refusal: `the ${lane} lane needs an OS sandbox, and baro has none for it on ${process.platform} yet; use the Claude lane (sandboxed by Claude Code), or set BARO_UNSAFE_NO_SANDBOX=1 to run it unconfined`
|
|
94023
94126
|
};
|
|
94024
94127
|
}
|
|
94025
94128
|
const home = homedir6();
|
|
94026
94129
|
const cache = storyPackageCache(env, worktreeRoot);
|
|
94027
|
-
const scratch = realpathSync9(mkdtempSync(
|
|
94130
|
+
const scratch = realpathSync9(mkdtempSync(join21(tmpdir5(), `baro-${lane}-tmp-`)));
|
|
94028
94131
|
const writable = [
|
|
94029
94132
|
...worktreeRoot === null ? [] : [
|
|
94030
94133
|
realpathSync9(resolve14(worktreeRoot)),
|
|
@@ -94034,13 +94137,13 @@ function confinedSpawn(lane, binary, args, worktreeRoot, env = process.env) {
|
|
|
94034
94137
|
scratch,
|
|
94035
94138
|
"/dev/null",
|
|
94036
94139
|
cache.root,
|
|
94037
|
-
...(LANE_STATE[lane] ?? []).map((dir) =>
|
|
94140
|
+
...(LANE_STATE[lane] ?? []).map((dir) => join21(home, dir))
|
|
94038
94141
|
];
|
|
94039
94142
|
return {
|
|
94040
94143
|
binary: "/usr/bin/sandbox-exec",
|
|
94041
94144
|
args: [
|
|
94042
94145
|
"-p",
|
|
94043
|
-
seatbeltProfile(writable, CREDENTIAL_READ_DENY.map((dir) =>
|
|
94146
|
+
seatbeltProfile(writable, CREDENTIAL_READ_DENY.map((dir) => join21(home, dir))),
|
|
94044
94147
|
binary,
|
|
94045
94148
|
...args
|
|
94046
94149
|
],
|
|
@@ -94048,7 +94151,7 @@ function confinedSpawn(lane, binary, args, worktreeRoot, env = process.env) {
|
|
|
94048
94151
|
};
|
|
94049
94152
|
}
|
|
94050
94153
|
function resolvesToExecutable(binary, pathValue) {
|
|
94051
|
-
const candidates = binary.includes("/") ? [binary] : (pathValue ?? "").split(delimiter2).filter(Boolean).map((dir) =>
|
|
94154
|
+
const candidates = binary.includes("/") ? [binary] : (pathValue ?? "").split(delimiter2).filter(Boolean).map((dir) => join21(dir, binary));
|
|
94052
94155
|
return candidates.some((candidate) => {
|
|
94053
94156
|
try {
|
|
94054
94157
|
accessSync3(candidate, constants4.X_OK);
|
|
@@ -95702,6 +95805,7 @@ var CriticOpenAI = class extends BusMember {
|
|
|
95702
95805
|
terminalAuthorities;
|
|
95703
95806
|
model;
|
|
95704
95807
|
billingCoordinator;
|
|
95808
|
+
ledger = new CriterionLedger();
|
|
95705
95809
|
emissions = /* @__PURE__ */ new Map();
|
|
95706
95810
|
turnCount = /* @__PURE__ */ new Map();
|
|
95707
95811
|
seenTerminalIds = /* @__PURE__ */ new Set();
|
|
@@ -95755,18 +95859,25 @@ var CriticOpenAI = class extends BusMember {
|
|
|
95755
95859
|
criteria,
|
|
95756
95860
|
resultText,
|
|
95757
95861
|
agentId,
|
|
95758
|
-
this.opts.evidence
|
|
95862
|
+
this.opts.evidence,
|
|
95863
|
+
(fingerprint) => this.ledger.established(agentId, fingerprint)
|
|
95759
95864
|
);
|
|
95760
|
-
const evaluation = preparation.status === "ready" ?
|
|
95761
|
-
|
|
95762
|
-
|
|
95763
|
-
|
|
95764
|
-
|
|
95865
|
+
const evaluation = preparation.status === "ready" ? honorEstablished(
|
|
95866
|
+
applyContractConflicts(
|
|
95867
|
+
mergeSegmentVerdicts(
|
|
95868
|
+
await Promise.all(
|
|
95869
|
+
preparation.prompts.map(
|
|
95870
|
+
(prompt) => this.evaluate(prompt, agentId, turn, correlation)
|
|
95871
|
+
)
|
|
95765
95872
|
)
|
|
95766
|
-
)
|
|
95873
|
+
),
|
|
95874
|
+
criteria
|
|
95767
95875
|
),
|
|
95768
|
-
|
|
95876
|
+
preparation.established
|
|
95769
95877
|
) : inconclusiveEvidenceVerdict(preparation.issues);
|
|
95878
|
+
if (preparation.status === "ready") {
|
|
95879
|
+
this.ledger.record(agentId, preparation.repositoryFingerprint, criteria, evaluation);
|
|
95880
|
+
}
|
|
95770
95881
|
const { verdict, reasoning, violatedCriteria } = evaluation;
|
|
95771
95882
|
const status = evaluation.status ?? "evaluated";
|
|
95772
95883
|
if (preparation.status === "ready" && !this.billingCoordinator) {
|
|
@@ -96025,7 +96136,7 @@ function withTimeout(promise, ms, message3) {
|
|
|
96025
96136
|
|
|
96026
96137
|
// ../baro-orchestrator/src/harness/opencode/one-shot.ts
|
|
96027
96138
|
import { writeFile as writeFile2 } from "fs/promises";
|
|
96028
|
-
import { join as
|
|
96139
|
+
import { join as join22 } from "path";
|
|
96029
96140
|
|
|
96030
96141
|
// ../baro-orchestrator/src/harness/opencode/cli-version.ts
|
|
96031
96142
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
@@ -96474,7 +96585,7 @@ async function installSafeEvaluatorAgent(cwd, systemPrompt) {
|
|
|
96474
96585
|
}
|
|
96475
96586
|
}
|
|
96476
96587
|
};
|
|
96477
|
-
const path7 =
|
|
96588
|
+
const path7 = join22(cwd, "opencode.json");
|
|
96478
96589
|
const content = `${JSON.stringify(config2)}
|
|
96479
96590
|
`;
|
|
96480
96591
|
await writeFile2(
|
|
@@ -97135,7 +97246,7 @@ var CriticPi = class extends OneShotCritic {
|
|
|
97135
97246
|
// ../baro-orchestrator/src/harness/devin/one-shot.ts
|
|
97136
97247
|
import { mkdtempSync as mkdtempSync2, mkdirSync as mkdirSync9, rmSync as rmSync3, writeFileSync as writeFileSync6 } from "fs";
|
|
97137
97248
|
import { tmpdir as tmpdir6 } from "os";
|
|
97138
|
-
import { join as
|
|
97249
|
+
import { join as join23 } from "path";
|
|
97139
97250
|
|
|
97140
97251
|
// ../baro-orchestrator/src/harness/cli-participant.ts
|
|
97141
97252
|
var import_cross_spawn3 = __toESM(require_cross_spawn(), 1);
|
|
@@ -98074,9 +98185,9 @@ You have no tools and no files: answer from the text below alone.
|
|
|
98074
98185
|
${prompt}`;
|
|
98075
98186
|
}
|
|
98076
98187
|
function isolatedEvaluatorDir() {
|
|
98077
|
-
const dir = mkdtempSync2(
|
|
98078
|
-
mkdirSync9(
|
|
98079
|
-
writeFileSync6(
|
|
98188
|
+
const dir = mkdtempSync2(join23(tmpdir6(), "baro-devin-eval-"));
|
|
98189
|
+
mkdirSync9(join23(dir, ".devin"));
|
|
98190
|
+
writeFileSync6(join23(dir, ".devin", "config.json"), JSON.stringify(DENY_ALL_TOOLS));
|
|
98080
98191
|
return dir;
|
|
98081
98192
|
}
|
|
98082
98193
|
function describeExit(summary) {
|
|
@@ -98985,7 +99096,7 @@ import { spawn as spawnProcess } from "child_process";
|
|
|
98985
99096
|
import { createInterface as createInterface2 } from "readline";
|
|
98986
99097
|
import { mkdtemp as mkdtemp2, rm as rm2 } from "fs/promises";
|
|
98987
99098
|
import { tmpdir as tmpdir7 } from "os";
|
|
98988
|
-
import { join as
|
|
99099
|
+
import { join as join24 } from "path";
|
|
98989
99100
|
|
|
98990
99101
|
// ../baro-orchestrator/src/telemetry/claude-model-usage.ts
|
|
98991
99102
|
function primaryClaudeModel(modelUsage) {
|
|
@@ -99916,7 +100027,7 @@ function execClaude(binary, args, opts) {
|
|
|
99916
100027
|
}).then(({ stdout }) => stdout);
|
|
99917
100028
|
}
|
|
99918
100029
|
async function withIsolatedHarnessCwd(prefix, run2) {
|
|
99919
|
-
const cwd = await mkdtemp2(
|
|
100030
|
+
const cwd = await mkdtemp2(join24(tmpdir7(), prefix));
|
|
99920
100031
|
try {
|
|
99921
100032
|
return await run2(cwd);
|
|
99922
100033
|
} finally {
|
|
@@ -99949,7 +100060,7 @@ function providerCallSignal(callerSignal, timeoutMs) {
|
|
|
99949
100060
|
|
|
99950
100061
|
// ../baro-orchestrator/src/integration/finalizer.ts
|
|
99951
100062
|
import { mkdirSync as mkdirSync10, writeFileSync as writeFileSync7 } from "fs";
|
|
99952
|
-
import { join as
|
|
100063
|
+
import { join as join25 } from "path";
|
|
99953
100064
|
|
|
99954
100065
|
// ../baro-orchestrator/src/verification/prd-declared-tests.ts
|
|
99955
100066
|
import { readFileSync as readFileSync16 } from "fs";
|
|
@@ -100535,14 +100646,14 @@ var Finalizer = class extends BusMember {
|
|
|
100535
100646
|
const runtimeAmendments = renderRuntimeAmendments(prd);
|
|
100536
100647
|
if (adrs.length === 0 && !runtimeAmendments) return;
|
|
100537
100648
|
try {
|
|
100538
|
-
const dir =
|
|
100649
|
+
const dir = join25(this.opts.integrationRoot, "adr");
|
|
100539
100650
|
mkdirSync10(dir, { recursive: true });
|
|
100540
100651
|
const generatedPaths = [];
|
|
100541
100652
|
for (const a of adrs) {
|
|
100542
100653
|
const num = a.num.padStart(4, "0");
|
|
100543
100654
|
const fileName = `${num}-${slugify(a.title)}.md`;
|
|
100544
100655
|
writeFileSync7(
|
|
100545
|
-
|
|
100656
|
+
join25(dir, fileName),
|
|
100546
100657
|
`# ADR-${num}: ${a.title}
|
|
100547
100658
|
|
|
100548
100659
|
${a.body}
|
|
@@ -100552,7 +100663,7 @@ ${a.body}
|
|
|
100552
100663
|
}
|
|
100553
100664
|
if (runtimeAmendments) {
|
|
100554
100665
|
writeFileSync7(
|
|
100555
|
-
|
|
100666
|
+
join25(dir, "runtime-amendments.md"),
|
|
100556
100667
|
runtimeAmendments
|
|
100557
100668
|
);
|
|
100558
100669
|
generatedPaths.push("adr/runtime-amendments.md");
|
|
@@ -105843,10 +105954,10 @@ var LocalRepositoryAgent = class extends BusMember {
|
|
|
105843
105954
|
// ../baro-orchestrator/src/execution/memory-librarian.ts
|
|
105844
105955
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync12 } from "fs";
|
|
105845
105956
|
import { homedir as homedir8 } from "os";
|
|
105846
|
-
import { join as
|
|
105957
|
+
import { join as join27 } from "path";
|
|
105847
105958
|
var DEBUG = process.env.BARO_DEBUG?.includes("memory") ?? false;
|
|
105848
|
-
var LOG_DIR =
|
|
105849
|
-
var LOG_FILE =
|
|
105959
|
+
var LOG_DIR = join27(homedir8(), ".baro", "runs");
|
|
105960
|
+
var LOG_FILE = join27(LOG_DIR, `memory-${Date.now()}.log`);
|
|
105850
105961
|
try {
|
|
105851
105962
|
mkdirSync12(LOG_DIR, { recursive: true });
|
|
105852
105963
|
} catch {
|
|
@@ -106728,7 +106839,7 @@ var PlanningFeed = class extends BusMember {
|
|
|
106728
106839
|
};
|
|
106729
106840
|
|
|
106730
106841
|
// ../baro-orchestrator/src/execution/prd-status-writer.ts
|
|
106731
|
-
import { existsSync as
|
|
106842
|
+
import { existsSync as existsSync18 } from "fs";
|
|
106732
106843
|
function createPrdStatusWriter({
|
|
106733
106844
|
prdPath,
|
|
106734
106845
|
load = loadPrd,
|
|
@@ -106738,7 +106849,7 @@ function createPrdStatusWriter({
|
|
|
106738
106849
|
const warnedUnknown = /* @__PURE__ */ new Set();
|
|
106739
106850
|
const warnedWriteFailure = /* @__PURE__ */ new Set();
|
|
106740
106851
|
const apply = (storyId, mutate) => {
|
|
106741
|
-
if (!
|
|
106852
|
+
if (!existsSync18(prdPath)) return;
|
|
106742
106853
|
try {
|
|
106743
106854
|
const prd = load(prdPath);
|
|
106744
106855
|
if (!prd.userStories.some((story) => story.id === storyId)) {
|
|
@@ -107234,7 +107345,7 @@ var ClaudeLaneAdapter = class {
|
|
|
107234
107345
|
};
|
|
107235
107346
|
|
|
107236
107347
|
// ../baro-orchestrator/src/planning/adapters/codebase-tools.ts
|
|
107237
|
-
import { execFileSync as
|
|
107348
|
+
import { execFileSync as execFileSync5 } from "child_process";
|
|
107238
107349
|
import * as fs5 from "fs";
|
|
107239
107350
|
import * as os from "os";
|
|
107240
107351
|
import * as path5 from "path";
|
|
@@ -107248,7 +107359,7 @@ import {
|
|
|
107248
107359
|
rmSync as rmSync5,
|
|
107249
107360
|
writeFileSync as writeFileSync9
|
|
107250
107361
|
} from "fs";
|
|
107251
|
-
import { delimiter as delimiter3, join as
|
|
107362
|
+
import { delimiter as delimiter3, join as join28, resolve as resolve16 } from "path";
|
|
107252
107363
|
function publishCommandRefusal(command) {
|
|
107253
107364
|
const segments = String(command).split(/&&|\|\||[;|\n]/u).map((segment) => segment.trim()).filter((segment) => segment.length > 0);
|
|
107254
107365
|
for (const segment of segments) {
|
|
@@ -107311,7 +107422,7 @@ function shQuote(value) {
|
|
|
107311
107422
|
function findExecutable(name, pathValue, exclude) {
|
|
107312
107423
|
for (const dir of pathValue.split(delimiter3)) {
|
|
107313
107424
|
if (!dir || resolve16(dir) === resolve16(exclude)) continue;
|
|
107314
|
-
const candidate =
|
|
107425
|
+
const candidate = join28(dir, name);
|
|
107315
107426
|
try {
|
|
107316
107427
|
accessSync4(candidate, constants6.X_OK);
|
|
107317
107428
|
return candidate;
|
|
@@ -107323,7 +107434,7 @@ function findExecutable(name, pathValue, exclude) {
|
|
|
107323
107434
|
function materializePublishGuardBin(dir, pathValue = process.env.PATH ?? "") {
|
|
107324
107435
|
mkdirSync13(dir, { recursive: true });
|
|
107325
107436
|
const realGit = findExecutable("git", pathValue, dir) ?? "/usr/bin/git";
|
|
107326
|
-
const refusalsPath = shQuote(
|
|
107437
|
+
const refusalsPath = shQuote(join28(dir, GUARD_REFUSALS_FILE));
|
|
107327
107438
|
const refuse = [
|
|
107328
107439
|
`esc=$(printf '%s' "$cmd" | sed 's/\\\\/\\\\\\\\/g; s/"/\\\\"/g' | tr '\\n\\t\\r' ' ')`,
|
|
107329
107440
|
`printf '{"command":"%s"}\\n' "$esc" >> ${refusalsPath}`,
|
|
@@ -107331,7 +107442,7 @@ function materializePublishGuardBin(dir, pathValue = process.env.PATH ?? "") {
|
|
|
107331
107442
|
`exit 1`
|
|
107332
107443
|
].join("\n");
|
|
107333
107444
|
writeFileSync9(
|
|
107334
|
-
|
|
107445
|
+
join28(dir, "gh"),
|
|
107335
107446
|
`#!/bin/sh
|
|
107336
107447
|
cmd="gh $*"
|
|
107337
107448
|
${refuse}
|
|
@@ -107339,7 +107450,7 @@ ${refuse}
|
|
|
107339
107450
|
{ mode: 493 }
|
|
107340
107451
|
);
|
|
107341
107452
|
writeFileSync9(
|
|
107342
|
-
|
|
107453
|
+
join28(dir, "git"),
|
|
107343
107454
|
[
|
|
107344
107455
|
"#!/usr/bin/env node",
|
|
107345
107456
|
'const { spawnSync } = require("node:child_process")',
|
|
@@ -107350,7 +107461,7 @@ ${refuse}
|
|
|
107350
107461
|
'const command = ["git", ...args].join(" ")',
|
|
107351
107462
|
"const refusal = publishCommandRefusal(command)",
|
|
107352
107463
|
"if (refusal) {",
|
|
107353
|
-
` try { appendFileSync(${JSON.stringify(
|
|
107464
|
+
` try { appendFileSync(${JSON.stringify(join28(dir, GUARD_REFUSALS_FILE))}, JSON.stringify({ command, reason: refusal }) + "\\n") } catch {}`,
|
|
107354
107465
|
' process.stderr.write(refusal + "\\n")',
|
|
107355
107466
|
" process.exit(1)",
|
|
107356
107467
|
"}",
|
|
@@ -107362,7 +107473,7 @@ ${refuse}
|
|
|
107362
107473
|
);
|
|
107363
107474
|
}
|
|
107364
107475
|
function drainGuardRefusals(dir) {
|
|
107365
|
-
const file =
|
|
107476
|
+
const file = join28(dir, GUARD_REFUSALS_FILE);
|
|
107366
107477
|
let text3;
|
|
107367
107478
|
try {
|
|
107368
107479
|
text3 = readFileSync18(file, "utf8");
|
|
@@ -107992,13 +108103,13 @@ function trespassNotice(cwd, surface) {
|
|
|
107992
108103
|
if (!surface || Object.keys(surface.ownedElsewhere).length === 0) return "";
|
|
107993
108104
|
let changed;
|
|
107994
108105
|
try {
|
|
107995
|
-
const tracked =
|
|
108106
|
+
const tracked = execFileSync5("git", ["diff", "--name-only", "HEAD"], {
|
|
107996
108107
|
cwd,
|
|
107997
108108
|
encoding: "utf8",
|
|
107998
108109
|
timeout: GIT_DISCOVERY_TIMEOUT_MS,
|
|
107999
108110
|
maxBuffer: GIT_DISCOVERY_MAX_BUFFER
|
|
108000
108111
|
});
|
|
108001
|
-
const untracked =
|
|
108112
|
+
const untracked = execFileSync5(
|
|
108002
108113
|
"git",
|
|
108003
108114
|
["ls-files", "--others", "--exclude-standard"],
|
|
108004
108115
|
{
|
|
@@ -108017,7 +108128,7 @@ function trespassNotice(cwd, surface) {
|
|
|
108017
108128
|
const undone = /* @__PURE__ */ new Set();
|
|
108018
108129
|
for (const target of trespasses) {
|
|
108019
108130
|
try {
|
|
108020
|
-
|
|
108131
|
+
execFileSync5("git", ["checkout", "--", target], {
|
|
108021
108132
|
cwd,
|
|
108022
108133
|
timeout: GIT_DISCOVERY_TIMEOUT_MS
|
|
108023
108134
|
});
|
|
@@ -111479,7 +111590,7 @@ var CodexCliParticipant = class _CodexCliParticipant extends CliParticipant {
|
|
|
111479
111590
|
|
|
111480
111591
|
// ../baro-orchestrator/src/harness/one-shot/story-agent.ts
|
|
111481
111592
|
import { tmpdir as tmpdir10 } from "os";
|
|
111482
|
-
import { join as
|
|
111593
|
+
import { join as join30 } from "path";
|
|
111483
111594
|
import { setTimeout as setTimeoutPromise } from "timers/promises";
|
|
111484
111595
|
|
|
111485
111596
|
// ../baro-orchestrator/src/harness/activity-monitor.ts
|
|
@@ -112502,7 +112613,7 @@ var OneShotStoryAgent = class extends BusMember {
|
|
|
112502
112613
|
}
|
|
112503
112614
|
const originalPath = process.env.PATH;
|
|
112504
112615
|
if (!this.publishGuardDir) {
|
|
112505
|
-
const dir =
|
|
112616
|
+
const dir = join30(
|
|
112506
112617
|
tmpdir10(),
|
|
112507
112618
|
`baro-publish-guard-${this.spec.id}-${process.pid}`
|
|
112508
112619
|
);
|
|
@@ -114754,14 +114865,14 @@ var DevinStoryAgent = class extends OneShotStoryAgent {
|
|
|
114754
114865
|
|
|
114755
114866
|
// ../baro-orchestrator/src/harness/claude/story-agent.ts
|
|
114756
114867
|
import { tmpdir as tmpdir12 } from "os";
|
|
114757
|
-
import { dirname as dirname13, join as
|
|
114868
|
+
import { dirname as dirname13, join as join32 } from "path";
|
|
114758
114869
|
import { setTimeout as setTimeoutPromise2 } from "timers/promises";
|
|
114759
114870
|
|
|
114760
114871
|
// ../baro-orchestrator/src/harness/claude/hook-bridge.ts
|
|
114761
|
-
import { execFileSync as
|
|
114872
|
+
import { execFileSync as execFileSync6 } from "child_process";
|
|
114762
114873
|
import {
|
|
114763
114874
|
copyFileSync,
|
|
114764
|
-
existsSync as
|
|
114875
|
+
existsSync as existsSync21,
|
|
114765
114876
|
mkdirSync as mkdirSync15,
|
|
114766
114877
|
mkdtempSync as mkdtempSync4,
|
|
114767
114878
|
readFileSync as readFileSync21,
|
|
@@ -114770,7 +114881,7 @@ import {
|
|
|
114770
114881
|
writeFileSync as writeFileSync11
|
|
114771
114882
|
} from "fs";
|
|
114772
114883
|
import { tmpdir as tmpdir11 } from "os";
|
|
114773
|
-
import { dirname as dirname12, join as
|
|
114884
|
+
import { dirname as dirname12, join as join31 } from "path";
|
|
114774
114885
|
var HOOK_SCRIPT = `#!/usr/bin/env node
|
|
114775
114886
|
// Materialized by baro (hook-bridge.ts). The advisory post-bash hook never
|
|
114776
114887
|
// breaks the agent; the guarding pre-bash and pre-write hooks fail closed:
|
|
@@ -114985,11 +115096,11 @@ function materializeStoryHooks(dir, surface, collab, worktreeRoot) {
|
|
|
114985
115096
|
});
|
|
114986
115097
|
}
|
|
114987
115098
|
function refreshStoryHookSurface(dir, surface, collab) {
|
|
114988
|
-
if (!
|
|
115099
|
+
if (!existsSync21(join31(dir, "surface.json"))) return;
|
|
114989
115100
|
writeSurfaceFile(dir, surface, collab);
|
|
114990
115101
|
}
|
|
114991
115102
|
function writeSurfaceFile(dir, surface, collab) {
|
|
114992
|
-
const file =
|
|
115103
|
+
const file = join31(dir, "surface.json");
|
|
114993
115104
|
const staged = `${file}.${process.pid}.tmp`;
|
|
114994
115105
|
writeFileSync11(
|
|
114995
115106
|
staged,
|
|
@@ -115006,8 +115117,8 @@ function writeSurfaceFile(dir, surface, collab) {
|
|
|
115006
115117
|
renameSync6(staged, file);
|
|
115007
115118
|
}
|
|
115008
115119
|
function assertHookContainsShell(hookPath) {
|
|
115009
|
-
const probe2 = mkdtempSync4(
|
|
115010
|
-
const run2 = (command) =>
|
|
115120
|
+
const probe2 = mkdtempSync4(join31(tmpdir11(), "baro-hook-probe-"));
|
|
115121
|
+
const run2 = (command) => execFileSync6(process.execPath, [join31(probe2, "hook.mjs"), "pre-bash"], {
|
|
115011
115122
|
input: JSON.stringify({ tool_input: { command }, cwd: probe2 }),
|
|
115012
115123
|
encoding: "utf8",
|
|
115013
115124
|
timeout: 1e4
|
|
@@ -115017,12 +115128,12 @@ function assertHookContainsShell(hookPath) {
|
|
|
115017
115128
|
let publishing = "";
|
|
115018
115129
|
try {
|
|
115019
115130
|
const dir = dirname12(hookPath);
|
|
115020
|
-
copyFileSync(hookPath,
|
|
115021
|
-
const settings = JSON.parse(readFileSync21(
|
|
115022
|
-
writeFileSync11(
|
|
115131
|
+
copyFileSync(hookPath, join31(probe2, "hook.mjs"));
|
|
115132
|
+
const settings = JSON.parse(readFileSync21(join31(dir, "containment.json"), "utf8"));
|
|
115133
|
+
writeFileSync11(join31(probe2, "containment.json"), JSON.stringify({ ...settings, osSandbox: false }));
|
|
115023
115134
|
escaping = run2("cd .. && ls");
|
|
115024
115135
|
inside = run2("ls");
|
|
115025
|
-
writeFileSync11(
|
|
115136
|
+
writeFileSync11(join31(probe2, "containment.json"), JSON.stringify(settings));
|
|
115026
115137
|
publishing = run2("git push origin HEAD");
|
|
115027
115138
|
} finally {
|
|
115028
115139
|
rmSync7(probe2, { recursive: true, force: true });
|
|
@@ -115128,11 +115239,11 @@ function loopbackHostPort(endpoint) {
|
|
|
115128
115239
|
}
|
|
115129
115240
|
}
|
|
115130
115241
|
function writeHookSettings(dir, containment) {
|
|
115131
|
-
const hookPath =
|
|
115242
|
+
const hookPath = join31(dir, "hook.mjs");
|
|
115132
115243
|
writeFileSync11(hookPath, HOOK_SCRIPT, { mode: 493 });
|
|
115133
115244
|
const sandbox = containment.worktreeRoot ? claudeStorySandbox(containment.worktreeRoot, containment.brokerEndpoint) : null;
|
|
115134
115245
|
writeFileSync11(
|
|
115135
|
-
|
|
115246
|
+
join31(dir, "containment.json"),
|
|
115136
115247
|
JSON.stringify(
|
|
115137
115248
|
{
|
|
115138
115249
|
worktreeRoot: containment.worktreeRoot ?? null,
|
|
@@ -115146,7 +115257,7 @@ function writeHookSettings(dir, containment) {
|
|
|
115146
115257
|
)
|
|
115147
115258
|
);
|
|
115148
115259
|
assertHookContainsShell(hookPath);
|
|
115149
|
-
const settingsPath =
|
|
115260
|
+
const settingsPath = join31(dir, "settings.json");
|
|
115150
115261
|
const hook = (mode) => ({
|
|
115151
115262
|
hooks: [
|
|
115152
115263
|
{
|
|
@@ -115464,7 +115575,7 @@ var StoryAgent = class extends BusMember {
|
|
|
115464
115575
|
this.transition("running", `attempt ${attempt}`);
|
|
115465
115576
|
this.currentProviderCapacitySignal = void 0;
|
|
115466
115577
|
this.settingsPath ??= this.spec.cliSettingsPath ?? materializePublishGuardHooks(
|
|
115467
|
-
|
|
115578
|
+
join32(tmpdir12(), `baro-hooks-${this.spec.id}-${process.pid}`),
|
|
115468
115579
|
this.spec.cwd
|
|
115469
115580
|
);
|
|
115470
115581
|
const claude = new ClaudeCliParticipant(this.spec.id, {
|
|
@@ -115738,7 +115849,7 @@ function failureSummary2(failure) {
|
|
|
115738
115849
|
|
|
115739
115850
|
// ../baro-orchestrator/src/execution/story-executor.ts
|
|
115740
115851
|
import { tmpdir as tmpdir13 } from "os";
|
|
115741
|
-
import { join as
|
|
115852
|
+
import { join as join33 } from "path";
|
|
115742
115853
|
var LocalStoryExecutor = class {
|
|
115743
115854
|
supportsCooperativeSuspend(route) {
|
|
115744
115855
|
return laneQuiescenceWitness(route.backend) === "self" ? true : PROCESS_TREE_CAPABILITIES.cooperativeQuiescenceObservation;
|
|
@@ -115754,7 +115865,7 @@ var LocalStoryExecutor = class {
|
|
|
115754
115865
|
leaseId: req.leaseId,
|
|
115755
115866
|
generation: req.generation
|
|
115756
115867
|
};
|
|
115757
|
-
const hookDir =
|
|
115868
|
+
const hookDir = join33(tmpdir13(), `baro-hooks-${req.storyId}-${process.pid}`);
|
|
115758
115869
|
const hookCollab = {
|
|
115759
115870
|
command: opts.collaboration?.commandPath ?? "agent-collab",
|
|
115760
115871
|
capability: "note",
|
|
@@ -120241,7 +120352,7 @@ async function orchestrate(config2) {
|
|
|
120241
120352
|
const useLibrarian = config2.withLibrarian ?? true;
|
|
120242
120353
|
const useSentry = config2.withSentry ?? true;
|
|
120243
120354
|
const useMemory = config2.withMemory ?? true;
|
|
120244
|
-
const sessionsDir =
|
|
120355
|
+
const sessionsDir = join34(homedir10(), ".baro", "sessions");
|
|
120245
120356
|
if (useMemory) {
|
|
120246
120357
|
try {
|
|
120247
120358
|
const { pruneOldSessions: pruneOldSessions2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
|
|
@@ -120265,15 +120376,15 @@ async function orchestrate(config2) {
|
|
|
120265
120376
|
new URL("../scripts/agent-collab.mjs", import.meta.url)
|
|
120266
120377
|
);
|
|
120267
120378
|
const collaborationEpoch = randomUUID10();
|
|
120268
|
-
const collectiveSessionRoot =
|
|
120379
|
+
const collectiveSessionRoot = join34(sessionsDir, runId, "collective");
|
|
120269
120380
|
const collaborationGoalInvariantIds = deriveGoalContract(loadPrd(config2.prdPath).goalEnvelope)?.invariants.map((invariant) => invariant.id) ?? [];
|
|
120270
120381
|
const collaborationConfig = {
|
|
120271
|
-
commandPath:
|
|
120272
|
-
sessionDir:
|
|
120382
|
+
commandPath: existsSync22(bundledCollaborationCommand) ? bundledCollaborationCommand : developmentCollaborationCommand,
|
|
120383
|
+
sessionDir: join34(
|
|
120273
120384
|
collectiveSessionRoot,
|
|
120274
120385
|
collaborationEpoch
|
|
120275
120386
|
),
|
|
120276
|
-
challengeInflightDir:
|
|
120387
|
+
challengeInflightDir: join34(
|
|
120277
120388
|
collectiveSessionRoot,
|
|
120278
120389
|
"challenge-inflight"
|
|
120279
120390
|
)
|
|
@@ -120699,7 +120810,7 @@ async function orchestrate(config2) {
|
|
|
120699
120810
|
let responder = config2.goalReviewResponder;
|
|
120700
120811
|
if (!responder) {
|
|
120701
120812
|
goalReviewRuntimeCwd = mkdtempSync5(
|
|
120702
|
-
|
|
120813
|
+
join34(tmpdir14(), "baro-goal-review-runtime-")
|
|
120703
120814
|
);
|
|
120704
120815
|
responder = createDialogueResponder({
|
|
120705
120816
|
backend: criticLlm,
|
|
@@ -120889,7 +121000,7 @@ async function orchestrate(config2) {
|
|
|
120889
121000
|
const dialogueBackend = resolveDialogueBackend(config2.dialogueLlm, llm);
|
|
120890
121001
|
let responder = config2.dialogueResponder;
|
|
120891
121002
|
if (!responder) {
|
|
120892
|
-
dialogueRuntimeCwd = mkdtempSync5(
|
|
121003
|
+
dialogueRuntimeCwd = mkdtempSync5(join34(tmpdir14(), "baro-dialogue-runtime-"));
|
|
120893
121004
|
responder = createDialogueResponder({
|
|
120894
121005
|
backend: dialogueBackend,
|
|
120895
121006
|
cwd: dialogueRuntimeCwd,
|
|
@@ -121856,7 +121967,7 @@ async function main() {
|
|
|
121856
121967
|
}
|
|
121857
121968
|
const cwd = resolve19(args.cwd);
|
|
121858
121969
|
const prdPath = resolve19(cwd, args.prd);
|
|
121859
|
-
if (!
|
|
121970
|
+
if (!existsSync23(prdPath)) {
|
|
121860
121971
|
process.stderr.write(`[cli] PRD not found: ${prdPath}
|
|
121861
121972
|
`);
|
|
121862
121973
|
process.exit(2);
|