baro-ai 0.69.1 → 0.70.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +179 -44
- package/dist/cli.mjs.map +1 -1
- package/dist/runner.mjs +1 -1
- package/dist/runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1958,12 +1958,12 @@ var require_parse_proxy_response = __commonJS({
|
|
|
1958
1958
|
return;
|
|
1959
1959
|
}
|
|
1960
1960
|
const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
|
|
1961
|
-
const
|
|
1962
|
-
if (!
|
|
1961
|
+
const firstLine2 = headerParts.shift();
|
|
1962
|
+
if (!firstLine2) {
|
|
1963
1963
|
socket.destroy();
|
|
1964
1964
|
return reject(new Error("No header received from proxy CONNECT response"));
|
|
1965
1965
|
}
|
|
1966
|
-
const firstLineParts =
|
|
1966
|
+
const firstLineParts = firstLine2.split(" ");
|
|
1967
1967
|
const statusCode = +firstLineParts[1];
|
|
1968
1968
|
const statusText = firstLineParts.slice(2).join(" ");
|
|
1969
1969
|
const headers = {};
|
|
@@ -1986,7 +1986,7 @@ var require_parse_proxy_response = __commonJS({
|
|
|
1986
1986
|
headers[key] = value;
|
|
1987
1987
|
}
|
|
1988
1988
|
}
|
|
1989
|
-
debug("got proxy server response: %o %o",
|
|
1989
|
+
debug("got proxy server response: %o %o", firstLine2, headers);
|
|
1990
1990
|
cleanup();
|
|
1991
1991
|
resolve4({
|
|
1992
1992
|
connect: {
|
|
@@ -22697,6 +22697,7 @@ import { resolve as resolve3 } from "path";
|
|
|
22697
22697
|
|
|
22698
22698
|
// ../baro-orchestrator/src/orchestrate.ts
|
|
22699
22699
|
import { mkdirSync as mkdirSync7 } from "fs";
|
|
22700
|
+
import { hostname } from "os";
|
|
22700
22701
|
import { dirname as dirname3, join as join7 } from "path";
|
|
22701
22702
|
|
|
22702
22703
|
// ../../node_modules/openai/internal/tslib.mjs
|
|
@@ -40039,6 +40040,38 @@ async function getGitFileStats(cwd, baseSha) {
|
|
|
40039
40040
|
return { created: 0, modified: 0 };
|
|
40040
40041
|
}
|
|
40041
40042
|
}
|
|
40043
|
+
var DIFF_LINE_CAP = 180;
|
|
40044
|
+
async function getDiff(cwd, fromSha, toSha = "HEAD") {
|
|
40045
|
+
const files = [];
|
|
40046
|
+
try {
|
|
40047
|
+
const { stdout } = await exec("git", ["diff", "--numstat", fromSha, toSha], { cwd });
|
|
40048
|
+
for (const line of stdout.split("\n")) {
|
|
40049
|
+
if (!line.trim()) continue;
|
|
40050
|
+
const parts = line.split(" ");
|
|
40051
|
+
if (parts.length < 3) continue;
|
|
40052
|
+
const [a, r2] = parts;
|
|
40053
|
+
const path6 = parts.slice(2).join(" ");
|
|
40054
|
+
files.push({
|
|
40055
|
+
path: path6,
|
|
40056
|
+
added: a === "-" ? 0 : parseInt(a, 10) || 0,
|
|
40057
|
+
removed: r2 === "-" ? 0 : parseInt(r2, 10) || 0
|
|
40058
|
+
});
|
|
40059
|
+
}
|
|
40060
|
+
} catch {
|
|
40061
|
+
}
|
|
40062
|
+
let diff = "";
|
|
40063
|
+
try {
|
|
40064
|
+
const { stdout } = await exec("git", ["diff", fromSha, toSha], {
|
|
40065
|
+
cwd,
|
|
40066
|
+
maxBuffer: 16 * 1024 * 1024
|
|
40067
|
+
});
|
|
40068
|
+
const lines = stdout.split("\n");
|
|
40069
|
+
diff = lines.length > DIFF_LINE_CAP ? lines.slice(0, DIFF_LINE_CAP).join("\n") + `
|
|
40070
|
+
\u2026 (${lines.length - DIFF_LINE_CAP} more lines truncated)` : stdout;
|
|
40071
|
+
} catch {
|
|
40072
|
+
}
|
|
40073
|
+
return { files, diff };
|
|
40074
|
+
}
|
|
40042
40075
|
async function hasRemoteOrigin(cwd) {
|
|
40043
40076
|
try {
|
|
40044
40077
|
await exec("git", ["remote", "get-url", "origin"], { cwd });
|
|
@@ -43181,33 +43214,104 @@ function emit(event) {
|
|
|
43181
43214
|
// ../baro-orchestrator/src/participants/forwarders/agent-stream.ts
|
|
43182
43215
|
var AgentStreamForwarder = class extends BaseObserver {
|
|
43183
43216
|
async onExternalModelMessage(source, item) {
|
|
43184
|
-
const agentId = source
|
|
43185
|
-
if (
|
|
43217
|
+
const agentId = agentIdOf(source);
|
|
43218
|
+
if (!agentId) return;
|
|
43186
43219
|
const json = item.toJSON();
|
|
43187
43220
|
const text = json.content?.[0]?.text ?? "";
|
|
43188
|
-
|
|
43189
|
-
|
|
43221
|
+
const line = firstLine(text);
|
|
43222
|
+
if (!line) return;
|
|
43223
|
+
emit({ type: "activity", id: agentId, kind: "agent_msg", text: truncate(line, 160) });
|
|
43190
43224
|
}
|
|
43191
43225
|
async onExternalFunctionCall(source, item) {
|
|
43192
|
-
const agentId = source
|
|
43193
|
-
if (
|
|
43194
|
-
|
|
43226
|
+
const agentId = agentIdOf(source);
|
|
43227
|
+
if (!agentId) return;
|
|
43228
|
+
const args = parseArgs(item.args);
|
|
43229
|
+
const tool = item.name;
|
|
43230
|
+
if (tool === "write_file" || tool === "edit_file" || tool === "edit") {
|
|
43231
|
+
const path6 = strField(args, "path", "file_path", "file") ?? "(file)";
|
|
43232
|
+
const op = tool === "write_file" ? "create" : "modify";
|
|
43233
|
+
emit({ type: "activity", id: agentId, kind: "file_change", tool: "write", op, path: path6, text: path6 });
|
|
43234
|
+
return;
|
|
43235
|
+
}
|
|
43236
|
+
if (tool === "bash" || tool === "shell") {
|
|
43237
|
+
const cmd = firstLine(cmdText(args));
|
|
43238
|
+
emit({ type: "activity", id: agentId, kind: "tool_call", tool: "bash", text: truncate(cmd || tool, 140) });
|
|
43239
|
+
return;
|
|
43240
|
+
}
|
|
43241
|
+
const target = strField(args, "path", "file_path", "pattern", "query", "file") ?? "";
|
|
43242
|
+
const text = target ? `${tool} ${target}` : tool;
|
|
43243
|
+
emit({ type: "activity", id: agentId, kind: "tool_call", tool: "read", text: truncate(text, 140) });
|
|
43195
43244
|
}
|
|
43196
43245
|
async onExternalFunctionCallOutput(source, item) {
|
|
43197
|
-
const agentId = source
|
|
43198
|
-
if (
|
|
43246
|
+
const agentId = agentIdOf(source);
|
|
43247
|
+
if (!agentId) return;
|
|
43199
43248
|
const json = item.toJSON();
|
|
43200
|
-
const
|
|
43201
|
-
|
|
43249
|
+
const out = json.output?.[0]?.text ?? "";
|
|
43250
|
+
if (!out.trim()) return;
|
|
43251
|
+
const verdict = testVerdict(out);
|
|
43252
|
+
if (verdict !== null) {
|
|
43253
|
+
emit({
|
|
43254
|
+
type: "activity",
|
|
43255
|
+
id: agentId,
|
|
43256
|
+
kind: "test",
|
|
43257
|
+
ok: verdict,
|
|
43258
|
+
text: truncate(firstLine(out) || (verdict ? "tests passed" : "tests failed"), 140)
|
|
43259
|
+
});
|
|
43260
|
+
return;
|
|
43261
|
+
}
|
|
43262
|
+
emit({ type: "activity", id: agentId, kind: "tool_result", text: truncate(firstLine(out), 120) });
|
|
43202
43263
|
}
|
|
43203
43264
|
};
|
|
43204
|
-
function
|
|
43205
|
-
|
|
43206
|
-
|
|
43207
|
-
|
|
43208
|
-
|
|
43209
|
-
|
|
43265
|
+
function agentIdOf(source) {
|
|
43266
|
+
const id = source.agentId;
|
|
43267
|
+
return typeof id === "string" ? id : null;
|
|
43268
|
+
}
|
|
43269
|
+
function parseArgs(raw) {
|
|
43270
|
+
if (raw && typeof raw === "object") return raw;
|
|
43271
|
+
if (typeof raw === "string") {
|
|
43272
|
+
try {
|
|
43273
|
+
const v = JSON.parse(raw);
|
|
43274
|
+
return v && typeof v === "object" ? v : {};
|
|
43275
|
+
} catch {
|
|
43276
|
+
return {};
|
|
43277
|
+
}
|
|
43278
|
+
}
|
|
43279
|
+
return {};
|
|
43280
|
+
}
|
|
43281
|
+
function strField(obj, ...keys) {
|
|
43282
|
+
for (const k of keys) {
|
|
43283
|
+
const v = obj[k];
|
|
43284
|
+
if (typeof v === "string" && v.length > 0) return v;
|
|
43285
|
+
}
|
|
43286
|
+
return void 0;
|
|
43287
|
+
}
|
|
43288
|
+
function cmdText(args) {
|
|
43289
|
+
const c = args.command ?? args.cmd ?? args.script;
|
|
43290
|
+
if (Array.isArray(c)) {
|
|
43291
|
+
if (c.length >= 3 && /^(ba)?sh$/.test(String(c[0])) && /^-[lc]+$/.test(String(c[1]))) {
|
|
43292
|
+
return String(c[2]);
|
|
43293
|
+
}
|
|
43294
|
+
return c.map(String).join(" ");
|
|
43295
|
+
}
|
|
43296
|
+
return typeof c === "string" ? c : "";
|
|
43297
|
+
}
|
|
43298
|
+
function firstLine(s2) {
|
|
43299
|
+
for (const l of s2.split("\n")) {
|
|
43300
|
+
const t2 = l.trim();
|
|
43301
|
+
if (t2) return t2;
|
|
43210
43302
|
}
|
|
43303
|
+
return "";
|
|
43304
|
+
}
|
|
43305
|
+
function truncate(s2, max) {
|
|
43306
|
+
return s2.length <= max ? s2 : s2.slice(0, max - 1) + "\u2026";
|
|
43307
|
+
}
|
|
43308
|
+
function testVerdict(out) {
|
|
43309
|
+
const s2 = out.toLowerCase();
|
|
43310
|
+
const failed = /\b\d+\s+fail(ed|ing|ures?)?\b/.test(s2) || /(^|\s)fail\b/.test(s2);
|
|
43311
|
+
const passed = /\b(all\s+)?\d+\s+(tests?\s+)?(pass(ed|ing)?|ok)\b/.test(s2) || /\btests?\s+pass(ed)?\b/.test(s2);
|
|
43312
|
+
if (failed) return false;
|
|
43313
|
+
if (passed) return true;
|
|
43314
|
+
return null;
|
|
43211
43315
|
}
|
|
43212
43316
|
|
|
43213
43317
|
// ../baro-orchestrator/src/participants/forwarders/coordination.ts
|
|
@@ -43431,7 +43535,10 @@ var TokenUsageForwarder = class extends BaseObserver {
|
|
|
43431
43535
|
type: "token_usage",
|
|
43432
43536
|
id: item.agentId,
|
|
43433
43537
|
input_tokens: inputTokens,
|
|
43434
|
-
output_tokens: outputTokens
|
|
43538
|
+
output_tokens: outputTokens,
|
|
43539
|
+
// Claude CLI reports a per-result dollar cost; carry it so the TUI
|
|
43540
|
+
// can sum a per-run cost. Null for non-Claude backends.
|
|
43541
|
+
cost_usd: typeof item.totalCostUsd === "number" ? item.totalCostUsd : void 0
|
|
43435
43542
|
});
|
|
43436
43543
|
}
|
|
43437
43544
|
handleCodexTurnEvent(item) {
|
|
@@ -43680,7 +43787,7 @@ function describeCall(tool, args) {
|
|
|
43680
43787
|
if (pattern) tags.push(pattern);
|
|
43681
43788
|
} else if (tool === "Bash") {
|
|
43682
43789
|
const cmd = stringArg(args, "command");
|
|
43683
|
-
summary = `Bash ${
|
|
43790
|
+
summary = `Bash ${truncate2(cmd ?? "", 80)}`;
|
|
43684
43791
|
if (cmd) tags.push(cmd.split(/\s+/)[0] ?? "");
|
|
43685
43792
|
} else if (tool === "WebFetch") {
|
|
43686
43793
|
const url = stringArg(args, "url");
|
|
@@ -43688,7 +43795,7 @@ function describeCall(tool, args) {
|
|
|
43688
43795
|
if (url) tags.push(url);
|
|
43689
43796
|
} else if (tool === "WebSearch") {
|
|
43690
43797
|
const q = stringArg(args, "query");
|
|
43691
|
-
summary = `WebSearch '${
|
|
43798
|
+
summary = `WebSearch '${truncate2(q ?? "", 60)}'`;
|
|
43692
43799
|
if (q) tags.push(q);
|
|
43693
43800
|
}
|
|
43694
43801
|
return { tags: tags.filter((t2) => t2.length > 0), summary };
|
|
@@ -43697,7 +43804,7 @@ function stringArg(args, key) {
|
|
|
43697
43804
|
const v = args[key];
|
|
43698
43805
|
return typeof v === "string" ? v : void 0;
|
|
43699
43806
|
}
|
|
43700
|
-
function
|
|
43807
|
+
function truncate2(s2, n) {
|
|
43701
43808
|
return s2.length > n ? `${s2.slice(0, n)}\u2026` : s2;
|
|
43702
43809
|
}
|
|
43703
43810
|
function formatEntry(k) {
|
|
@@ -44261,10 +44368,10 @@ var CodexCliParticipant = class _CodexCliParticipant extends BaseObserver {
|
|
|
44261
44368
|
super();
|
|
44262
44369
|
this.agentId = agentId;
|
|
44263
44370
|
this.options = {
|
|
44264
|
-
|
|
44265
|
-
|
|
44266
|
-
|
|
44267
|
-
|
|
44371
|
+
...opts,
|
|
44372
|
+
codexBin: opts.codexBin ?? "codex",
|
|
44373
|
+
bypassSandbox: opts.bypassSandbox ?? false,
|
|
44374
|
+
skipGitRepoCheck: opts.skipGitRepoCheck ?? false
|
|
44268
44375
|
};
|
|
44269
44376
|
this.ready = new Promise((res, rej) => {
|
|
44270
44377
|
this.resolveReady = res;
|
|
@@ -44607,6 +44714,7 @@ var CodexStoryAgent = class extends BaseObserver {
|
|
|
44607
44714
|
cwd: this.spec.cwd,
|
|
44608
44715
|
prompt: this.spec.prompt,
|
|
44609
44716
|
model: this.spec.model,
|
|
44717
|
+
codexBin: this.spec.codexBin,
|
|
44610
44718
|
bypassSandbox: this.spec.bypassSandbox,
|
|
44611
44719
|
skipGitRepoCheck: this.spec.skipGitRepoCheck
|
|
44612
44720
|
});
|
|
@@ -45594,9 +45702,9 @@ var OpenCodeCliParticipant = class _OpenCodeCliParticipant extends BaseObserver
|
|
|
45594
45702
|
super();
|
|
45595
45703
|
this.agentId = agentId;
|
|
45596
45704
|
this.options = {
|
|
45597
|
-
|
|
45598
|
-
|
|
45599
|
-
|
|
45705
|
+
...opts,
|
|
45706
|
+
opencodeBin: opts.opencodeBin ?? "opencode",
|
|
45707
|
+
skipPermissions: opts.skipPermissions ?? true
|
|
45600
45708
|
};
|
|
45601
45709
|
this.ready = new Promise((res, rej) => {
|
|
45602
45710
|
this.resolveReady = res;
|
|
@@ -45964,6 +46072,7 @@ var OpenCodeStoryAgent = class extends BaseObserver {
|
|
|
45964
46072
|
cwd: this.spec.cwd,
|
|
45965
46073
|
prompt: this.spec.prompt,
|
|
45966
46074
|
model: this.spec.model,
|
|
46075
|
+
opencodeBin: this.spec.opencodeBin,
|
|
45967
46076
|
skipPermissions: this.spec.skipPermissions
|
|
45968
46077
|
});
|
|
45969
46078
|
this.currentOpenCode = opencode;
|
|
@@ -46278,8 +46387,8 @@ var PiCliParticipant = class _PiCliParticipant extends BaseObserver {
|
|
|
46278
46387
|
super();
|
|
46279
46388
|
this.agentId = agentId;
|
|
46280
46389
|
this.options = {
|
|
46281
|
-
|
|
46282
|
-
|
|
46390
|
+
...opts,
|
|
46391
|
+
piBin: opts.piBin ?? "pi"
|
|
46283
46392
|
};
|
|
46284
46393
|
this.ready = new Promise((res, rej) => {
|
|
46285
46394
|
this.resolveReady = res;
|
|
@@ -46737,7 +46846,8 @@ var PiStoryAgent = class extends BaseObserver {
|
|
|
46737
46846
|
cwd: this.spec.cwd,
|
|
46738
46847
|
prompt: this.spec.prompt,
|
|
46739
46848
|
provider: this.spec.provider,
|
|
46740
|
-
model: this.spec.model
|
|
46849
|
+
model: this.spec.model,
|
|
46850
|
+
piBin: this.spec.piBin
|
|
46741
46851
|
});
|
|
46742
46852
|
this.currentPi = pi;
|
|
46743
46853
|
pi.join(this.envRef);
|
|
@@ -46938,11 +47048,11 @@ var ClaudeCliParticipant = class _ClaudeCliParticipant extends BaseObserver {
|
|
|
46938
47048
|
super();
|
|
46939
47049
|
this.agentId = agentId;
|
|
46940
47050
|
this.options = {
|
|
46941
|
-
|
|
46942
|
-
|
|
46943
|
-
|
|
46944
|
-
|
|
46945
|
-
|
|
47051
|
+
...opts,
|
|
47052
|
+
includePartialMessages: opts.includePartialMessages ?? false,
|
|
47053
|
+
replayUserMessages: opts.replayUserMessages ?? true,
|
|
47054
|
+
permissionMode: opts.permissionMode ?? "bypassPermissions",
|
|
47055
|
+
claudeBin: opts.claudeBin ?? "claude"
|
|
46946
47056
|
};
|
|
46947
47057
|
this.ready = new Promise((res, rej) => {
|
|
46948
47058
|
this.resolveReady = res;
|
|
@@ -47344,7 +47454,8 @@ var StoryAgent = class extends BaseObserver {
|
|
|
47344
47454
|
const claude = new ClaudeCliParticipant(this.spec.id, {
|
|
47345
47455
|
cwd: this.spec.cwd,
|
|
47346
47456
|
model: this.spec.model,
|
|
47347
|
-
effort: this.spec.effort
|
|
47457
|
+
effort: this.spec.effort,
|
|
47458
|
+
claudeBin: this.spec.claudeBin
|
|
47348
47459
|
});
|
|
47349
47460
|
this.currentClaude = claude;
|
|
47350
47461
|
claude.join(this.envRef);
|
|
@@ -48446,6 +48557,7 @@ async function orchestrate(config) {
|
|
|
48446
48557
|
} : void 0,
|
|
48447
48558
|
onStoryPassed: useGit ? async (storyId) => {
|
|
48448
48559
|
const log2 = (line) => emitTui && emit({ type: "story_log", id: storyId, line });
|
|
48560
|
+
const beforeMerge = emitTui ? await getHeadSha(config.cwd) : null;
|
|
48449
48561
|
if (worktrees) {
|
|
48450
48562
|
let merged = false;
|
|
48451
48563
|
try {
|
|
@@ -48458,6 +48570,17 @@ async function orchestrate(config) {
|
|
|
48458
48570
|
return;
|
|
48459
48571
|
}
|
|
48460
48572
|
if (merged) {
|
|
48573
|
+
if (emitTui && beforeMerge) {
|
|
48574
|
+
const d = await getDiff(config.cwd, beforeMerge, "HEAD");
|
|
48575
|
+
if (d.files.length) {
|
|
48576
|
+
emit({
|
|
48577
|
+
type: "story_diff",
|
|
48578
|
+
id: storyId,
|
|
48579
|
+
files: d.files,
|
|
48580
|
+
diff: d.diff || void 0
|
|
48581
|
+
});
|
|
48582
|
+
}
|
|
48583
|
+
}
|
|
48461
48584
|
await worktrees.cleanup(storyId);
|
|
48462
48585
|
worktreePushNeeded = true;
|
|
48463
48586
|
if (emitTui) {
|
|
@@ -48509,7 +48632,8 @@ async function orchestrate(config) {
|
|
|
48509
48632
|
id: s2.id,
|
|
48510
48633
|
title: s2.title,
|
|
48511
48634
|
depends_on: s2.dependsOn
|
|
48512
|
-
}))
|
|
48635
|
+
})),
|
|
48636
|
+
runner: hostname()
|
|
48513
48637
|
});
|
|
48514
48638
|
const dagLevels = buildDag(prd.userStories).map(
|
|
48515
48639
|
(lvl) => lvl.storyIds.map((id) => ({ id }))
|
|
@@ -48544,6 +48668,17 @@ async function orchestrate(config) {
|
|
|
48544
48668
|
const stats2 = await getGitFileStats(config.cwd, baseSha);
|
|
48545
48669
|
filesCreated = stats2.created;
|
|
48546
48670
|
filesModified = stats2.modified;
|
|
48671
|
+
if (emitTui) {
|
|
48672
|
+
const runDiff = await getDiff(config.cwd, baseSha, "HEAD");
|
|
48673
|
+
if (runDiff.files.length) {
|
|
48674
|
+
emit({
|
|
48675
|
+
type: "story_diff",
|
|
48676
|
+
id: "(run)",
|
|
48677
|
+
files: runDiff.files,
|
|
48678
|
+
diff: runDiff.diff || void 0
|
|
48679
|
+
});
|
|
48680
|
+
}
|
|
48681
|
+
}
|
|
48547
48682
|
}
|
|
48548
48683
|
if (emitTui) {
|
|
48549
48684
|
emit({
|
|
@@ -48579,7 +48714,7 @@ function tokenizeForHints(text) {
|
|
|
48579
48714
|
}
|
|
48580
48715
|
|
|
48581
48716
|
// ../baro-orchestrator/scripts/cli.ts
|
|
48582
|
-
function
|
|
48717
|
+
function parseArgs2(argv) {
|
|
48583
48718
|
const args = {
|
|
48584
48719
|
prd: "prd.json",
|
|
48585
48720
|
cwd: ".",
|
|
@@ -48766,7 +48901,7 @@ function printHelp() {
|
|
|
48766
48901
|
);
|
|
48767
48902
|
}
|
|
48768
48903
|
async function main() {
|
|
48769
|
-
const args =
|
|
48904
|
+
const args = parseArgs2(process.argv.slice(2));
|
|
48770
48905
|
if (args.help) {
|
|
48771
48906
|
printHelp();
|
|
48772
48907
|
return;
|