baro-ai 0.74.2 → 0.74.4
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 +7 -6
- package/dist/cli.mjs.map +1 -1
- package/dist/run-planner.mjs.map +1 -1
- package/dist/runner.mjs +86 -9
- package/dist/runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/runner.mjs
CHANGED
|
@@ -3755,7 +3755,7 @@ var url = process.env.CONTROL_URL ?? "wss://api.baro.jigjoy.ai";
|
|
|
3755
3755
|
var token = process.env.RUNNER_TOKEN;
|
|
3756
3756
|
var httpBase = url.replace(/^ws/, "http").replace(/\/+$/, "");
|
|
3757
3757
|
var credsPath = join(homedir(), ".baro", "credentials.json");
|
|
3758
|
-
var VERSION = "0.74.
|
|
3758
|
+
var VERSION = "0.74.4";
|
|
3759
3759
|
var updateCachePath = join(homedir(), ".baro", "update-check.json");
|
|
3760
3760
|
async function getLatest(force = false) {
|
|
3761
3761
|
if (!force) {
|
|
@@ -3859,20 +3859,81 @@ ${patterns.join("\n")}
|
|
|
3859
3859
|
} catch {
|
|
3860
3860
|
}
|
|
3861
3861
|
}
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3862
|
+
var depCacheRoot = join(tmpdir(), "baro-dep-cache");
|
|
3863
|
+
function setupSharedCaches() {
|
|
3864
|
+
const goRoot = join(depCacheRoot, "go");
|
|
3865
|
+
const pnpmStore = join(depCacheRoot, "pnpm");
|
|
3866
|
+
const caches = {
|
|
3867
|
+
CARGO_HOME: join(depCacheRoot, "cargo"),
|
|
3868
|
+
GOPATH: goRoot,
|
|
3869
|
+
GOMODCACHE: join(goRoot, "pkg", "mod"),
|
|
3870
|
+
PIP_CACHE_DIR: join(depCacheRoot, "pip"),
|
|
3871
|
+
PNPM_STORE_DIR: pnpmStore,
|
|
3872
|
+
npm_config_store_dir: pnpmStore,
|
|
3873
|
+
YARN_CACHE_FOLDER: join(depCacheRoot, "yarn")
|
|
3874
|
+
};
|
|
3875
|
+
for (const [key, dir] of Object.entries(caches)) {
|
|
3876
|
+
try {
|
|
3877
|
+
mkdirSync(dir, { recursive: true });
|
|
3878
|
+
process.env[key] = dir;
|
|
3879
|
+
} catch {
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3883
|
+
function pyprojectIsPoetry(dir) {
|
|
3884
|
+
try {
|
|
3885
|
+
return /\[tool\.poetry\]/.test(readFileSync(join(dir, "pyproject.toml"), "utf8"));
|
|
3886
|
+
} catch {
|
|
3887
|
+
return false;
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
function ecoCommands(dir) {
|
|
3891
|
+
const out = [];
|
|
3892
|
+
if (existsSync(join(dir, "package.json"))) {
|
|
3893
|
+
if (existsSync(join(dir, "pnpm-lock.yaml"))) out.push({ eco: "pnpm", tool: "pnpm", attempts: [["install", "--frozen-lockfile"], ["install"]] });
|
|
3894
|
+
else if (existsSync(join(dir, "yarn.lock"))) out.push({ eco: "yarn", tool: "yarn", attempts: [["install", "--frozen-lockfile"], ["install"]] });
|
|
3895
|
+
else if (existsSync(join(dir, "package-lock.json"))) out.push({ eco: "npm", tool: "npm", attempts: [["ci"], ["install"]] });
|
|
3896
|
+
}
|
|
3897
|
+
if (existsSync(join(dir, "Cargo.toml"))) out.push({ eco: "cargo", tool: "cargo", attempts: [["fetch"]] });
|
|
3898
|
+
if (existsSync(join(dir, "go.mod"))) out.push({ eco: "go", tool: "go", attempts: [["mod", "download"]] });
|
|
3899
|
+
if (existsSync(join(dir, "uv.lock"))) out.push({ eco: "uv", tool: "uv", attempts: [["sync"]] });
|
|
3900
|
+
else if (existsSync(join(dir, "poetry.lock")) || pyprojectIsPoetry(dir)) out.push({ eco: "poetry", tool: "poetry", attempts: [["install"]] });
|
|
3901
|
+
else if (existsSync(join(dir, "requirements.txt")))
|
|
3902
|
+
out.push({ eco: "pip", tool: "python3", attempts: [["-m", "pip", "install", "--user", "-r", "requirements.txt"], ["-m", "pip", "install", "-r", "requirements.txt"]] });
|
|
3903
|
+
return out;
|
|
3904
|
+
}
|
|
3905
|
+
function isJsWorkspaceRoot(root) {
|
|
3906
|
+
if (existsSync(join(root, "pnpm-workspace.yaml"))) return true;
|
|
3907
|
+
try {
|
|
3908
|
+
return JSON.parse(readFileSync(join(root, "package.json"), "utf8")).workspaces !== void 0;
|
|
3909
|
+
} catch {
|
|
3910
|
+
return false;
|
|
3911
|
+
}
|
|
3912
|
+
}
|
|
3913
|
+
function isCargoWorkspaceRoot(root) {
|
|
3914
|
+
try {
|
|
3915
|
+
return /^\s*\[workspace\]/m.test(readFileSync(join(root, "Cargo.toml"), "utf8"));
|
|
3916
|
+
} catch {
|
|
3917
|
+
return false;
|
|
3918
|
+
}
|
|
3919
|
+
}
|
|
3920
|
+
function makeSetupTarget(dir) {
|
|
3921
|
+
try {
|
|
3922
|
+
const mk = readFileSync(join(dir, "Makefile"), "utf8");
|
|
3923
|
+
for (const target of ["setup", "bootstrap", "install"]) if (new RegExp(`^${target}\\s*:`, "m").test(mk)) return target;
|
|
3924
|
+
} catch {
|
|
3925
|
+
}
|
|
3866
3926
|
return void 0;
|
|
3867
3927
|
}
|
|
3868
3928
|
function installOne(dir, cmd, log) {
|
|
3929
|
+
log(`installing dependencies (${cmd.eco})\u2026`);
|
|
3869
3930
|
for (let i = 0; i < cmd.attempts.length; i++) {
|
|
3870
3931
|
try {
|
|
3871
3932
|
execFileSync(cmd.tool, cmd.attempts[i], { cwd: dir, stdio: "ignore", timeout: 4 * 6e4, shell: process.platform === "win32" });
|
|
3872
3933
|
return;
|
|
3873
3934
|
} catch (e) {
|
|
3874
3935
|
if (e.code === "ENOENT") {
|
|
3875
|
-
log(`${cmd.tool} not
|
|
3936
|
+
log(`${cmd.tool} not available, skipping`);
|
|
3876
3937
|
return;
|
|
3877
3938
|
}
|
|
3878
3939
|
if (i === cmd.attempts.length - 1) log(`dependency install failed in ${dir} (${cmd.tool}) \u2014 agents will retry`);
|
|
@@ -3882,17 +3943,32 @@ function installOne(dir, cmd, log) {
|
|
|
3882
3943
|
function preinstallDeps(root, emit) {
|
|
3883
3944
|
const log = (line) => emit({ type: "story_log", agentId: "_deps", data: { type: "story_log", id: "_deps", line } });
|
|
3884
3945
|
try {
|
|
3946
|
+
setupSharedCaches();
|
|
3885
3947
|
const dirs = /* @__PURE__ */ new Set([root]);
|
|
3886
3948
|
for (const sub of ["backend", "frontend"]) dirs.add(join(root, sub));
|
|
3887
|
-
for (const group of ["packages", "apps"]) {
|
|
3949
|
+
for (const group of ["packages", "apps", "services"]) {
|
|
3888
3950
|
try {
|
|
3889
3951
|
for (const name of readdirSync(join(root, group))) dirs.add(join(root, group, name));
|
|
3890
3952
|
} catch {
|
|
3891
3953
|
}
|
|
3892
3954
|
}
|
|
3893
|
-
const
|
|
3955
|
+
const jsWorkspace = isJsWorkspaceRoot(root);
|
|
3956
|
+
const cargoWorkspace = isCargoWorkspaceRoot(root);
|
|
3957
|
+
const jsEcos = /* @__PURE__ */ new Set(["npm", "pnpm", "yarn"]);
|
|
3958
|
+
const targets = [];
|
|
3959
|
+
for (const dir of dirs) {
|
|
3960
|
+
if (dir !== root && !existsSync(dir)) continue;
|
|
3961
|
+
for (const cmd of ecoCommands(dir)) {
|
|
3962
|
+
if (dir !== root && jsWorkspace && jsEcos.has(cmd.eco)) continue;
|
|
3963
|
+
if (dir !== root && cargoWorkspace && cmd.eco === "cargo") continue;
|
|
3964
|
+
targets.push({ dir, cmd });
|
|
3965
|
+
}
|
|
3966
|
+
}
|
|
3967
|
+
if (targets.length === 0) {
|
|
3968
|
+
const target = makeSetupTarget(root);
|
|
3969
|
+
if (target) targets.push({ dir: root, cmd: { eco: "make", tool: "make", attempts: [[target]] } });
|
|
3970
|
+
}
|
|
3894
3971
|
if (targets.length === 0) return;
|
|
3895
|
-
log("installing dependencies\u2026");
|
|
3896
3972
|
for (const t of targets) installOne(t.dir, t.cmd, log);
|
|
3897
3973
|
log("dependencies ready");
|
|
3898
3974
|
} catch (e) {
|
|
@@ -3909,6 +3985,7 @@ function captureDiff(cwd, base) {
|
|
|
3909
3985
|
}
|
|
3910
3986
|
}
|
|
3911
3987
|
async function runGoal(d, emit, signal) {
|
|
3988
|
+
setupSharedCaches();
|
|
3912
3989
|
const env = { ...process.env };
|
|
3913
3990
|
delete env.ANTHROPIC_API_KEY;
|
|
3914
3991
|
if (d.mode) env.BARO_MODE = d.mode;
|