baro-ai 0.74.0 → 0.74.2
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 +6 -4
- package/dist/cli.mjs.map +1 -1
- package/dist/runner.mjs +43 -2
- package/dist/runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/runner.mjs
CHANGED
|
@@ -3714,7 +3714,7 @@ var require_websocket_server = __commonJS({
|
|
|
3714
3714
|
|
|
3715
3715
|
// ../baro-orchestrator/scripts/runner.ts
|
|
3716
3716
|
import { execFileSync, spawn } from "child_process";
|
|
3717
|
-
import { appendFileSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
3717
|
+
import { appendFileSync, existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
3718
3718
|
import { hostname, homedir, tmpdir } from "os";
|
|
3719
3719
|
import { join } from "path";
|
|
3720
3720
|
import { createInterface } from "readline/promises";
|
|
@@ -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.2";
|
|
3759
3759
|
var updateCachePath = join(homedir(), ".baro", "update-check.json");
|
|
3760
3760
|
async function getLatest(force = false) {
|
|
3761
3761
|
if (!force) {
|
|
@@ -3859,6 +3859,46 @@ ${patterns.join("\n")}
|
|
|
3859
3859
|
} catch {
|
|
3860
3860
|
}
|
|
3861
3861
|
}
|
|
3862
|
+
function depCommand(dir) {
|
|
3863
|
+
if (existsSync(join(dir, "pnpm-lock.yaml"))) return { tool: "pnpm", attempts: [["install", "--frozen-lockfile"], ["install"]] };
|
|
3864
|
+
if (existsSync(join(dir, "yarn.lock"))) return { tool: "yarn", attempts: [["install", "--frozen-lockfile"], ["install"]] };
|
|
3865
|
+
if (existsSync(join(dir, "package-lock.json"))) return { tool: "npm", attempts: [["ci"], ["install"]] };
|
|
3866
|
+
return void 0;
|
|
3867
|
+
}
|
|
3868
|
+
function installOne(dir, cmd, log) {
|
|
3869
|
+
for (let i = 0; i < cmd.attempts.length; i++) {
|
|
3870
|
+
try {
|
|
3871
|
+
execFileSync(cmd.tool, cmd.attempts[i], { cwd: dir, stdio: "ignore", timeout: 4 * 6e4, shell: process.platform === "win32" });
|
|
3872
|
+
return;
|
|
3873
|
+
} catch (e) {
|
|
3874
|
+
if (e.code === "ENOENT") {
|
|
3875
|
+
log(`${cmd.tool} not found \u2014 skipping ${dir}`);
|
|
3876
|
+
return;
|
|
3877
|
+
}
|
|
3878
|
+
if (i === cmd.attempts.length - 1) log(`dependency install failed in ${dir} (${cmd.tool}) \u2014 agents will retry`);
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
function preinstallDeps(root, emit) {
|
|
3883
|
+
const log = (line) => emit({ type: "story_log", agentId: "_deps", data: { type: "story_log", id: "_deps", line } });
|
|
3884
|
+
try {
|
|
3885
|
+
const dirs = /* @__PURE__ */ new Set([root]);
|
|
3886
|
+
for (const sub of ["backend", "frontend"]) dirs.add(join(root, sub));
|
|
3887
|
+
for (const group of ["packages", "apps"]) {
|
|
3888
|
+
try {
|
|
3889
|
+
for (const name of readdirSync(join(root, group))) dirs.add(join(root, group, name));
|
|
3890
|
+
} catch {
|
|
3891
|
+
}
|
|
3892
|
+
}
|
|
3893
|
+
const targets = [...dirs].filter((d) => existsSync(join(d, "package.json"))).map((d) => ({ dir: d, cmd: depCommand(d) })).filter((t) => t.cmd !== void 0);
|
|
3894
|
+
if (targets.length === 0) return;
|
|
3895
|
+
log("installing dependencies\u2026");
|
|
3896
|
+
for (const t of targets) installOne(t.dir, t.cmd, log);
|
|
3897
|
+
log("dependencies ready");
|
|
3898
|
+
} catch (e) {
|
|
3899
|
+
log(`dependency pre-install skipped: ${e.message}`);
|
|
3900
|
+
}
|
|
3901
|
+
}
|
|
3862
3902
|
function captureDiff(cwd, base) {
|
|
3863
3903
|
try {
|
|
3864
3904
|
execFileSync("git", ["add", "-A"], { cwd });
|
|
@@ -3884,6 +3924,7 @@ async function runGoal(d, emit, signal) {
|
|
|
3884
3924
|
return { success: false, durationSecs: 1, error: `clone failed: ${e.message}` };
|
|
3885
3925
|
}
|
|
3886
3926
|
excludeDepDirs(cwd);
|
|
3927
|
+
preinstallDeps(cwd, emit);
|
|
3887
3928
|
if (d.diffOnly) {
|
|
3888
3929
|
try {
|
|
3889
3930
|
diffBase = execFileSync("git", ["rev-parse", "HEAD"], { cwd }).toString().trim();
|