baro-ai 0.110.0 → 0.110.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/operator.mjs +77 -6
- package/dist/operator.mjs.map +1 -1
- package/package.json +1 -1
package/dist/operator.mjs
CHANGED
|
@@ -41770,9 +41770,35 @@ var RunTracker = class {
|
|
|
41770
41770
|
prUrl;
|
|
41771
41771
|
done;
|
|
41772
41772
|
milestones = [];
|
|
41773
|
+
stories = /* @__PURE__ */ new Map();
|
|
41774
|
+
activityTail = [];
|
|
41773
41775
|
revision = 0;
|
|
41776
|
+
feed(text, ts) {
|
|
41777
|
+
const clock = typeof ts === "string" ? ts.slice(11, 19) : (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
41778
|
+
this.activityTail.push(`${clock} ${text}`);
|
|
41779
|
+
if (this.activityTail.length > 40) this.activityTail.shift();
|
|
41780
|
+
}
|
|
41781
|
+
story(event, status) {
|
|
41782
|
+
const id = stringField(event, "id", "storyId", "story_id");
|
|
41783
|
+
if (!id) return;
|
|
41784
|
+
const known = this.stories.get(id);
|
|
41785
|
+
const fromEvent = stringField(event, "title");
|
|
41786
|
+
const title = fromEvent && fromEvent !== id ? fromEvent : known?.title ?? "";
|
|
41787
|
+
this.stories.set(id, { id, title, status });
|
|
41788
|
+
this.revision += 1;
|
|
41789
|
+
}
|
|
41790
|
+
rememberStories(list) {
|
|
41791
|
+
if (!Array.isArray(list)) return;
|
|
41792
|
+
for (const entry of list) {
|
|
41793
|
+
if (typeof entry !== "object" || entry === null) continue;
|
|
41794
|
+
const id = stringField(entry, "id");
|
|
41795
|
+
if (!id || this.stories.has(id)) continue;
|
|
41796
|
+
this.stories.set(id, { id, title: stringField(entry, "title") ?? "", status: "pending" });
|
|
41797
|
+
}
|
|
41798
|
+
}
|
|
41774
41799
|
/** Returns the milestone line when the event was one. */
|
|
41775
41800
|
accept(event) {
|
|
41801
|
+
const phaseBefore = this.phase;
|
|
41776
41802
|
switch (event.type) {
|
|
41777
41803
|
case "architect_start":
|
|
41778
41804
|
this.setPhase("architect");
|
|
@@ -41786,6 +41812,7 @@ var RunTracker = class {
|
|
|
41786
41812
|
break;
|
|
41787
41813
|
case "plan_fragment": {
|
|
41788
41814
|
this.setPhase("planning");
|
|
41815
|
+
this.rememberStories(event.stories);
|
|
41789
41816
|
const stories = Array.isArray(event.stories) ? event.stories : [];
|
|
41790
41817
|
this.storiesTotal += stories.length;
|
|
41791
41818
|
const titles = stories.map(
|
|
@@ -41801,19 +41828,19 @@ var RunTracker = class {
|
|
|
41801
41828
|
break;
|
|
41802
41829
|
case "init":
|
|
41803
41830
|
this.project = stringField(event, "project");
|
|
41831
|
+
this.rememberStories(event.stories);
|
|
41804
41832
|
this.storiesTotal = (Array.isArray(event.stories) ? event.stories.length : 0) || this.storiesTotal;
|
|
41805
41833
|
this.setPhase("executing");
|
|
41806
41834
|
break;
|
|
41807
41835
|
case "activity": {
|
|
41808
41836
|
const text = stringField(event, "text");
|
|
41809
41837
|
const id = stringField(event, "id");
|
|
41810
|
-
if (text) this.setActivity(id && id !== "plan" ? `${id}: ${text}` : text);
|
|
41838
|
+
if (text) this.setActivity(id && id !== "plan" ? `${id}: ${text}` : text, event.ts);
|
|
41811
41839
|
break;
|
|
41812
41840
|
}
|
|
41813
41841
|
case "story_log": {
|
|
41814
41842
|
const line2 = stringField(event, "line");
|
|
41815
|
-
|
|
41816
|
-
if (line2) this.setActivity(id && id !== "plan" ? `${id}: ${line2}` : line2);
|
|
41843
|
+
if (line2 && stringField(event, "id") === "plan") this.setActivity(line2, event.ts);
|
|
41817
41844
|
break;
|
|
41818
41845
|
}
|
|
41819
41846
|
case "progress": {
|
|
@@ -41823,6 +41850,22 @@ var RunTracker = class {
|
|
|
41823
41850
|
if (total !== void 0) this.total = total;
|
|
41824
41851
|
break;
|
|
41825
41852
|
}
|
|
41853
|
+
case "story_start":
|
|
41854
|
+
this.story(event, "running");
|
|
41855
|
+
break;
|
|
41856
|
+
case "story_suspended":
|
|
41857
|
+
this.story(event, "suspended");
|
|
41858
|
+
break;
|
|
41859
|
+
case "story_complete":
|
|
41860
|
+
this.story(event, "done");
|
|
41861
|
+
break;
|
|
41862
|
+
case "story_merged":
|
|
41863
|
+
this.story(event, "merged");
|
|
41864
|
+
break;
|
|
41865
|
+
case "merge_failed":
|
|
41866
|
+
case "story_error":
|
|
41867
|
+
this.story(event, "failed");
|
|
41868
|
+
break;
|
|
41826
41869
|
case "finalize_start":
|
|
41827
41870
|
this.setPhase("finalizing");
|
|
41828
41871
|
break;
|
|
@@ -41837,8 +41880,10 @@ var RunTracker = class {
|
|
|
41837
41880
|
this.setPhase("done");
|
|
41838
41881
|
break;
|
|
41839
41882
|
}
|
|
41883
|
+
if (this.phase !== phaseBefore) this.feed(`phase: ${this.phase}`, event.ts);
|
|
41840
41884
|
if (!isMilestone(event)) return null;
|
|
41841
41885
|
const line = describe(event);
|
|
41886
|
+
this.feed(line, event.ts);
|
|
41842
41887
|
this.milestones.push(line);
|
|
41843
41888
|
if (this.milestones.length > this.limit) this.milestones.shift();
|
|
41844
41889
|
this.revision += 1;
|
|
@@ -41849,6 +41894,9 @@ var RunTracker = class {
|
|
|
41849
41894
|
project: this.project,
|
|
41850
41895
|
phase: this.phase,
|
|
41851
41896
|
activity: this.activity,
|
|
41897
|
+
stories: [...this.stories.values()],
|
|
41898
|
+
abortReason: this.done ? stringField(this.done, "abort_reason") : void 0,
|
|
41899
|
+
activityTail: [...this.activityTail],
|
|
41852
41900
|
storiesTotal: this.storiesTotal,
|
|
41853
41901
|
completed: this.completed,
|
|
41854
41902
|
total: this.total,
|
|
@@ -41863,10 +41911,11 @@ var RunTracker = class {
|
|
|
41863
41911
|
this.phase = phase;
|
|
41864
41912
|
this.revision += 1;
|
|
41865
41913
|
}
|
|
41866
|
-
setActivity(text) {
|
|
41914
|
+
setActivity(text, ts) {
|
|
41867
41915
|
const next = text.length > ACTIVITY_LIMIT ? `${text.slice(0, ACTIVITY_LIMIT - 1)}\u2026` : text;
|
|
41868
41916
|
if (this.activity === next) return;
|
|
41869
41917
|
this.activity = next;
|
|
41918
|
+
this.feed(next, ts);
|
|
41870
41919
|
this.revision += 1;
|
|
41871
41920
|
}
|
|
41872
41921
|
};
|
|
@@ -42008,7 +42057,12 @@ var RunRegistry = class {
|
|
|
42008
42057
|
elapsed: elapsed(run),
|
|
42009
42058
|
startedMs: run.startedAt ?? void 0,
|
|
42010
42059
|
finishedMs: run.finishedAt ?? void 0,
|
|
42011
|
-
prUrl: s2.prUrl
|
|
42060
|
+
prUrl: s2.prUrl,
|
|
42061
|
+
activity: s2.activity,
|
|
42062
|
+
stories: s2.stories,
|
|
42063
|
+
milestones: s2.milestones.slice(-20),
|
|
42064
|
+
activityTail: s2.activityTail,
|
|
42065
|
+
error: run.terminal && run.terminal !== "completed" ? s2.abortReason ?? run.stderrTail.at(-1) : void 0
|
|
42012
42066
|
};
|
|
42013
42067
|
});
|
|
42014
42068
|
}
|
|
@@ -42066,8 +42120,10 @@ ${body}${stderr}`;
|
|
|
42066
42120
|
createInterface({ input: child.stdout, crlfDelay: Number.POSITIVE_INFINITY }).on("line", (line) => {
|
|
42067
42121
|
const event = parseLine(line);
|
|
42068
42122
|
if (!event) return;
|
|
42123
|
+
const before = record.tracker.summary().activity;
|
|
42069
42124
|
const milestone = record.tracker.accept(event);
|
|
42070
42125
|
if (milestone) this.options.onMilestone?.(record, milestone);
|
|
42126
|
+
else if (record.tracker.summary().activity !== before) this.options.onActivity?.(record);
|
|
42071
42127
|
});
|
|
42072
42128
|
createInterface({ input: child.stderr, crlfDelay: Number.POSITIVE_INFINITY }).on("line", (line) => {
|
|
42073
42129
|
record.stderrTail.push(line);
|
|
@@ -42116,6 +42172,7 @@ function elapsed(run) {
|
|
|
42116
42172
|
var AGENT_ID = "operator";
|
|
42117
42173
|
var DIRECT_FILE_LIMIT = 10;
|
|
42118
42174
|
async function runOperator(options, ui) {
|
|
42175
|
+
let activitySnapshot = null;
|
|
42119
42176
|
const registry = new RunRegistry({
|
|
42120
42177
|
...options.baroArgs ? { baroArgs: options.baroArgs } : {},
|
|
42121
42178
|
onStarted: (run) => {
|
|
@@ -42129,6 +42186,15 @@ async function runOperator(options, ui) {
|
|
|
42129
42186
|
ui.note(`${run.id} \xB7 ${line}`);
|
|
42130
42187
|
ui.runsChanged(registry.rows());
|
|
42131
42188
|
},
|
|
42189
|
+
// Activity lines arrive many times a second; one snapshot a second is
|
|
42190
|
+
// enough for a strip and a drill-in.
|
|
42191
|
+
onActivity: () => {
|
|
42192
|
+
if (activitySnapshot) return;
|
|
42193
|
+
activitySnapshot = setTimeout(() => {
|
|
42194
|
+
activitySnapshot = null;
|
|
42195
|
+
ui.runsChanged(registry.rows());
|
|
42196
|
+
}, 1e3);
|
|
42197
|
+
},
|
|
42132
42198
|
onFinished: (run, outcome) => {
|
|
42133
42199
|
ui.note(`${run.id} \xB7 finished (${run.terminal})`);
|
|
42134
42200
|
ui.runsChanged(registry.rows());
|
|
@@ -42538,7 +42604,12 @@ var JsonUi = class {
|
|
|
42538
42604
|
elapsed: row.elapsed,
|
|
42539
42605
|
...row.startedMs !== void 0 ? { started_ms: row.startedMs } : {},
|
|
42540
42606
|
...row.finishedMs !== void 0 ? { finished_ms: row.finishedMs } : {},
|
|
42541
|
-
...row.prUrl ? { pr_url: row.prUrl } : {}
|
|
42607
|
+
...row.prUrl ? { pr_url: row.prUrl } : {},
|
|
42608
|
+
...row.activity ? { activity: row.activity } : {},
|
|
42609
|
+
stories: row.stories,
|
|
42610
|
+
milestones: row.milestones,
|
|
42611
|
+
activity_tail: row.activityTail,
|
|
42612
|
+
...row.error ? { error: row.error } : {}
|
|
42542
42613
|
}))
|
|
42543
42614
|
});
|
|
42544
42615
|
}
|