reevesagents 2.2.0 → 2.3.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/CHANGELOG.md +22 -0
- package/README.md +5 -10
- package/dist/{chunk-QWI77WYQ.js → chunk-BHUY46Z3.js} +3 -3
- package/dist/{chunk-3ALQMRN6.js → chunk-ETUW7JDR.js} +2 -2
- package/dist/{chunk-I54VATHO.js → chunk-H7HEBQDW.js} +4 -2
- package/dist/{chunk-KZRUGMML.js → chunk-IKWMNWP4.js} +266 -20
- package/dist/{chunk-3RDILV4F.js → chunk-Q4PR3NOT.js} +2 -2
- package/dist/{chunk-HCLKJS4S.js → chunk-T3KAXZJK.js} +3 -3
- package/dist/{chunk-DQKP7LSP.js → chunk-VNACTZPD.js} +34 -8
- package/dist/{chunk-RBLMXDCV.js → chunk-ZED5YGNK.js} +2 -2
- package/dist/chunk-ZNOYXAJO.js +225 -0
- package/dist/cli.js +10 -10
- package/dist/index.d.ts +7 -0
- package/dist/index.js +2 -2
- package/dist/{router-2KZWMLZR.js → router-GGZMVGO7.js} +11 -7
- package/dist/{server-OXNRGXWX.js → server-4DQ7LMRT.js} +322 -11
- package/dist/{server-6DUIO733.js → server-IMN4GWAU.js} +9 -5
- package/dist/{tui-launch-BYUJ2Z6R.js → tui-launch-EZMMQS7K.js} +2 -2
- package/dist/web/app.css +74 -0
- package/dist/web/app.js +230 -41
- package/dist/web/index.html +3 -1
- package/dist/web/insights-core.js +5 -3
- package/package.json +8 -7
|
@@ -5,16 +5,21 @@ import {
|
|
|
5
5
|
localeCatalog,
|
|
6
6
|
translate,
|
|
7
7
|
translatePhrase
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IKWMNWP4.js";
|
|
9
9
|
import {
|
|
10
10
|
modelValuesForProvider
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ZED5YGNK.js";
|
|
12
|
+
import {
|
|
13
|
+
sweepAttentionThrottled
|
|
14
|
+
} from "./chunk-ZNOYXAJO.js";
|
|
12
15
|
import {
|
|
13
16
|
pauseFlow,
|
|
14
17
|
resumeFlow
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-BHUY46Z3.js";
|
|
16
19
|
import {
|
|
17
20
|
REEVESAGENTS_VERSION,
|
|
21
|
+
SETTLED_DISPATCH_EVENTS,
|
|
22
|
+
flowDispatchNote,
|
|
18
23
|
flowIncidentAgeMs,
|
|
19
24
|
flowStatusPayload,
|
|
20
25
|
listFlowIncidents,
|
|
@@ -26,7 +31,7 @@ import {
|
|
|
26
31
|
sweepAgentsThrottled,
|
|
27
32
|
sweepOrphanSessionsThrottled,
|
|
28
33
|
systemdTimerState
|
|
29
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-H7HEBQDW.js";
|
|
30
35
|
import {
|
|
31
36
|
CONFIG_FIELDS,
|
|
32
37
|
LANGUAGE_OPTIONS,
|
|
@@ -47,6 +52,7 @@ import {
|
|
|
47
52
|
findAgent,
|
|
48
53
|
flowPath,
|
|
49
54
|
hostStatus,
|
|
55
|
+
isCommitId,
|
|
50
56
|
isLanguageCode,
|
|
51
57
|
killAgent,
|
|
52
58
|
listAgents,
|
|
@@ -65,9 +71,11 @@ import {
|
|
|
65
71
|
providerSupportsAuthMode,
|
|
66
72
|
providerSupportsEffort,
|
|
67
73
|
readFlow,
|
|
74
|
+
readNewestNotes,
|
|
68
75
|
readNotifications,
|
|
69
76
|
readPlan,
|
|
70
77
|
readRun,
|
|
78
|
+
redactSecrets,
|
|
71
79
|
runDoctor,
|
|
72
80
|
runHasLiveTmuxTarget,
|
|
73
81
|
savePresetFromRun,
|
|
@@ -80,8 +88,9 @@ import {
|
|
|
80
88
|
targetExists,
|
|
81
89
|
tmuxAvailable,
|
|
82
90
|
tmuxCommand,
|
|
91
|
+
validateNotesText,
|
|
83
92
|
verifyServerLaunch
|
|
84
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-VNACTZPD.js";
|
|
85
94
|
import "./chunk-Q3WWQP2R.js";
|
|
86
95
|
|
|
87
96
|
// src/surfaces/webui/server.ts
|
|
@@ -126,6 +135,286 @@ function isAllowedOrigin(originHeader, port) {
|
|
|
126
135
|
return url.port === String(port);
|
|
127
136
|
}
|
|
128
137
|
|
|
138
|
+
// src/core/work-items.ts
|
|
139
|
+
var DISPATCH_IN_FLIGHT = "dispatch in flight, not confirmed";
|
|
140
|
+
var DISPATCH_REFUSED_RETRY = "attempt refused; handover still unconfirmed";
|
|
141
|
+
var AMBIGUOUS = "ambiguous current work";
|
|
142
|
+
var AWAITING_ANSWER = "awaiting the reviewer's answer";
|
|
143
|
+
var OWNING_STATES = /* @__PURE__ */ new Set(["idle", "reviewing", "fixing"]);
|
|
144
|
+
var GATED_STATES = /* @__PURE__ */ new Set(["paused", "escalated", "orphaned", "done"]);
|
|
145
|
+
var ROUND_EVENTS = /* @__PURE__ */ new Set(["request_review", "dispatch_fix"]);
|
|
146
|
+
var UNSETTLED_EVENTS = /* @__PURE__ */ new Set(["dispatch_unconfirmed", "dispatch_retry_enter"]);
|
|
147
|
+
var EMPTY_NOTES = { answer: () => null };
|
|
148
|
+
var INTERVAL_OPENING_EVENTS = /* @__PURE__ */ new Set(["dispatch_spec", "dispatch_unconfirmed", "dispatch_retry_enter"]);
|
|
149
|
+
function workItems(state, options = {}) {
|
|
150
|
+
const now = options.at ?? Date.now();
|
|
151
|
+
const plan = options.plan ?? null;
|
|
152
|
+
const notes = options.notes ?? EMPTY_NOTES;
|
|
153
|
+
const intervals = dispatchIntervals(state, notes, now);
|
|
154
|
+
const gated = GATED_STATES.has(state.state);
|
|
155
|
+
const owning = owningState(state);
|
|
156
|
+
const claim = state.claim;
|
|
157
|
+
const pendingId = state.pending !== null && state.pending.kind === "dispatch_spec" ? state.pending.spec_id : null;
|
|
158
|
+
const newestInterval = intervals.at(-1) ?? null;
|
|
159
|
+
const unsettled = unsettledIndex(state);
|
|
160
|
+
const attributed = unsettled === null ? null : attributedSpecId(state, unsettled, intervals);
|
|
161
|
+
const refusedRetry = unsettled !== null && hasRefusalAfter(state, unsettled);
|
|
162
|
+
const planIds = /* @__PURE__ */ new Set();
|
|
163
|
+
const items = [];
|
|
164
|
+
for (const item of plan?.items ?? []) {
|
|
165
|
+
planIds.add(item.id);
|
|
166
|
+
items.push(planRow(item, gated, state));
|
|
167
|
+
}
|
|
168
|
+
const specRow = (id, title) => {
|
|
169
|
+
const current2 = intervals.filter((interval) => interval.id === id).at(-1) ?? null;
|
|
170
|
+
const isNewest = newestInterval?.id === id;
|
|
171
|
+
const head = current2?.heads.at(-1) ?? null;
|
|
172
|
+
if (current2?.done === true) return specItem(state, id, title, "done", null, head);
|
|
173
|
+
if (pendingId === id || attributed === id) {
|
|
174
|
+
const note = attributed === id && refusedRetry ? DISPATCH_REFUSED_RETRY : DISPATCH_IN_FLIGHT;
|
|
175
|
+
return specItem(state, id, title, "dispatching", note, head);
|
|
176
|
+
}
|
|
177
|
+
if (owning === "reviewing" && reviewSubject(claim, current2, isNewest)) {
|
|
178
|
+
const answered = head !== null && notes.answer(head) !== null;
|
|
179
|
+
return specItem(state, id, title, "reviewing", answered ? null : AWAITING_ANSWER, head);
|
|
180
|
+
}
|
|
181
|
+
if ((owning === "idle" || owning === "fixing") && settledHandover(state, claim, current2, isNewest)) {
|
|
182
|
+
return specItem(state, id, title, "in_work", null, head);
|
|
183
|
+
}
|
|
184
|
+
if (current2 !== null || state.dispatched_specs.includes(id)) {
|
|
185
|
+
return specItem(state, id, title, "handed_over", null, head);
|
|
186
|
+
}
|
|
187
|
+
return specItem(state, id, title, "queued", null, null);
|
|
188
|
+
};
|
|
189
|
+
for (const spec of state.specs) {
|
|
190
|
+
if (planIds.has(spec.id)) continue;
|
|
191
|
+
items.push(specRow(spec.id, spec.title));
|
|
192
|
+
}
|
|
193
|
+
for (const id of state.dispatched_specs) {
|
|
194
|
+
if (planIds.has(id) || state.specs.some((spec) => spec.id === id)) continue;
|
|
195
|
+
items.push(specRow(id, id));
|
|
196
|
+
}
|
|
197
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
198
|
+
for (const id of [pendingId, claim.spec_id, newestInterval?.id ?? null]) {
|
|
199
|
+
if (!id || closedByEvidence(id, intervals)) continue;
|
|
200
|
+
const row = items.find((item) => item.id === id);
|
|
201
|
+
if (row && (row.status === "done" || row.status === "skipped")) continue;
|
|
202
|
+
candidates.add(id);
|
|
203
|
+
}
|
|
204
|
+
const ambiguous = candidates.size > 1;
|
|
205
|
+
if (ambiguous) {
|
|
206
|
+
for (const item of items) {
|
|
207
|
+
if (!candidates.has(item.id)) continue;
|
|
208
|
+
item.status = "handed_over";
|
|
209
|
+
item.holder = null;
|
|
210
|
+
item.note = AMBIGUOUS;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (gated) {
|
|
214
|
+
for (const item of items) {
|
|
215
|
+
item.holder = null;
|
|
216
|
+
if (isActive(item.status) && item.note !== AMBIGUOUS) {
|
|
217
|
+
item.note = `flow ${state.state}: ownership unknown`;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
const current = gated || ambiguous ? null : pickCurrent(items, owning);
|
|
222
|
+
return {
|
|
223
|
+
total: items.length,
|
|
224
|
+
items,
|
|
225
|
+
current,
|
|
226
|
+
// §2.3: an unsettled dispatch that no row could be charged with is reported at the view level.
|
|
227
|
+
// The absence of a reliable binding is not the same fact as an idle flow, and inventing a status
|
|
228
|
+
// for whichever row looks convenient is the failure the design forbids.
|
|
229
|
+
dispatch_unknown: flowDispatchNote(state) !== null && !items.some((item) => item.status === "dispatching")
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
function specItem(state, id, title, status, note, head) {
|
|
233
|
+
return {
|
|
234
|
+
id,
|
|
235
|
+
// The title is repository- or operator-authored text and this shape travels in a payload (a
|
|
236
|
+
// transcript), so the redactor runs on it the way it runs on the queue summary.
|
|
237
|
+
title: redactSecrets(title),
|
|
238
|
+
origin: "spec",
|
|
239
|
+
status,
|
|
240
|
+
plan_status: null,
|
|
241
|
+
holder: holderFor(status, state),
|
|
242
|
+
head,
|
|
243
|
+
note
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function planRow(item, gated, state) {
|
|
247
|
+
const status = item.status;
|
|
248
|
+
return {
|
|
249
|
+
id: item.id,
|
|
250
|
+
title: redactSecrets(item.title),
|
|
251
|
+
origin: "plan",
|
|
252
|
+
status,
|
|
253
|
+
plan_status: status,
|
|
254
|
+
holder: gated ? null : holderFor(status, state),
|
|
255
|
+
head: item.head,
|
|
256
|
+
note: gated && isActive(status) ? `flow ${state.state}: ownership unknown` : null
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function holderFor(status, state) {
|
|
260
|
+
if (state === null) return null;
|
|
261
|
+
if (status === "in_work") return { role: "dev", agent_id: state.roles.dev };
|
|
262
|
+
if (status === "reviewing") return { role: "reviewer", agent_id: state.roles.review };
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
function isActive(status) {
|
|
266
|
+
return status === "dispatching" || status === "in_work" || status === "reviewing";
|
|
267
|
+
}
|
|
268
|
+
function owningState(state) {
|
|
269
|
+
if (state.state === "paused" && state.paused_from && OWNING_STATES.has(state.paused_from)) {
|
|
270
|
+
return state.paused_from;
|
|
271
|
+
}
|
|
272
|
+
return state.state;
|
|
273
|
+
}
|
|
274
|
+
function pickCurrent(items, owning) {
|
|
275
|
+
const last = (status) => items.filter((item) => item.status === status).at(-1) ?? null;
|
|
276
|
+
const dispatching = last("dispatching");
|
|
277
|
+
if (dispatching) return dispatching;
|
|
278
|
+
if (owning === "reviewing") return last("reviewing") ?? last("in_work");
|
|
279
|
+
return last("in_work") ?? last("reviewing");
|
|
280
|
+
}
|
|
281
|
+
function dispatchIntervals(state, notes, now) {
|
|
282
|
+
const log = state.log;
|
|
283
|
+
const starts = [];
|
|
284
|
+
for (let index = 0; index < log.length; index += 1) {
|
|
285
|
+
const entry = log[index];
|
|
286
|
+
if (!INTERVAL_OPENING_EVENTS.has(entry.event)) continue;
|
|
287
|
+
if (detailSpecId(entry.detail) === null) continue;
|
|
288
|
+
starts.push(index);
|
|
289
|
+
}
|
|
290
|
+
return starts.map((start, position) => {
|
|
291
|
+
const limit = position + 1 < starts.length ? starts[position + 1] : log.length;
|
|
292
|
+
const interval = {
|
|
293
|
+
id: detailSpecId(log[start].detail),
|
|
294
|
+
end: limit,
|
|
295
|
+
heads: [],
|
|
296
|
+
done: false
|
|
297
|
+
};
|
|
298
|
+
for (let index = start + 1; index < limit; index += 1) {
|
|
299
|
+
const entry = log[index];
|
|
300
|
+
if (entry.event === "flow_done") {
|
|
301
|
+
interval.end = index;
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
if (!ROUND_EVENTS.has(entry.event) && !UNSETTLED_EVENTS.has(entry.event)) continue;
|
|
305
|
+
if (stamp(entry.at) > now) continue;
|
|
306
|
+
const head2 = detailHead(entry.detail);
|
|
307
|
+
if (head2) interval.heads.push(head2);
|
|
308
|
+
}
|
|
309
|
+
const head = interval.heads.at(-1);
|
|
310
|
+
interval.done = head !== void 0 && (notes.answer(head) === "ACCEPT" || consumedAccept(state.log[interval.end], head));
|
|
311
|
+
return interval;
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
function consumedAccept(entry, head) {
|
|
315
|
+
if (!entry) return false;
|
|
316
|
+
if (entry.event !== "dispatch_spec" && entry.event !== "flow_done") return false;
|
|
317
|
+
const ref = entry.notes_ref;
|
|
318
|
+
if (!ref) return false;
|
|
319
|
+
return ref.toLowerCase().startsWith(`notes/${head.toLowerCase()}-r`);
|
|
320
|
+
}
|
|
321
|
+
function stamp(iso) {
|
|
322
|
+
const parsed = Date.parse(iso);
|
|
323
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
324
|
+
}
|
|
325
|
+
var DISPATCH_REASONS = /* @__PURE__ */ new Set(["spec_dispatched", "plan_item_dispatched"]);
|
|
326
|
+
function detailSpecId(detail) {
|
|
327
|
+
const tokens = detail.trim().split(/\s+/);
|
|
328
|
+
const reason = tokens.findIndex((token) => DISPATCH_REASONS.has(token));
|
|
329
|
+
return reason === -1 ? null : tokens[reason + 1] ?? null;
|
|
330
|
+
}
|
|
331
|
+
function detailHead(detail) {
|
|
332
|
+
const [, ...rest] = detail.trim().split(/\s+/);
|
|
333
|
+
return rest.find((token) => isCommitId(token)) ?? null;
|
|
334
|
+
}
|
|
335
|
+
function unsettledIndex(state) {
|
|
336
|
+
for (let index = state.log.length - 1; index >= 0; index -= 1) {
|
|
337
|
+
const entry = state.log[index];
|
|
338
|
+
if (UNSETTLED_EVENTS.has(entry.event)) return index;
|
|
339
|
+
if (entry.event === "dispatch_claimed" || entry.event === "dispatch_refused") continue;
|
|
340
|
+
if (SETTLED_DISPATCH_EVENTS.test(entry.event)) return null;
|
|
341
|
+
}
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
function hasRefusalAfter(state, unsettled) {
|
|
345
|
+
for (let index = unsettled + 1; index < state.log.length; index += 1) {
|
|
346
|
+
const entry = state.log[index];
|
|
347
|
+
if (entry.event === "dispatch_refused") return true;
|
|
348
|
+
if (SETTLED_DISPATCH_EVENTS.test(entry.event)) return false;
|
|
349
|
+
}
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
function attributedSpecId(state, unsettled, intervals) {
|
|
353
|
+
for (let index = unsettled - 1; index >= 0; index -= 1) {
|
|
354
|
+
const entry = state.log[index];
|
|
355
|
+
if (entry.event !== "dispatch_claimed" && entry.event !== "dispatch_spec") continue;
|
|
356
|
+
const id = detailSpecId(entry.detail);
|
|
357
|
+
if (id) return id;
|
|
358
|
+
const head = detailHead(entry.detail);
|
|
359
|
+
return head ? specIdForHead(state, head, intervals) : null;
|
|
360
|
+
}
|
|
361
|
+
return null;
|
|
362
|
+
}
|
|
363
|
+
function specIdForHead(state, head, intervals) {
|
|
364
|
+
for (const interval of intervals) {
|
|
365
|
+
if (interval.id && interval.heads.includes(head)) return interval.id;
|
|
366
|
+
}
|
|
367
|
+
const newest = intervals.at(-1);
|
|
368
|
+
if (newest?.id && state.claim.head === head) return newest.id;
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
function reviewSubject(claim, interval, isNewest) {
|
|
372
|
+
if (interval === null) return false;
|
|
373
|
+
if (claim.spec_id !== null && claim.spec_id === interval.id) return true;
|
|
374
|
+
if (!claim.head) return false;
|
|
375
|
+
if (interval.heads.includes(claim.head)) return true;
|
|
376
|
+
return isNewest;
|
|
377
|
+
}
|
|
378
|
+
function settledHandover(state, claim, interval, isNewest) {
|
|
379
|
+
if (interval === null || interval.id === null) return false;
|
|
380
|
+
if (claim.spec_id !== null && claim.spec_id === interval.id) return true;
|
|
381
|
+
return isNewest && state.dispatched_specs.includes(interval.id);
|
|
382
|
+
}
|
|
383
|
+
function closedByEvidence(id, intervals) {
|
|
384
|
+
return intervals.filter((interval) => interval.id === id).at(-1)?.done === true;
|
|
385
|
+
}
|
|
386
|
+
function workNotesFor(runId, root) {
|
|
387
|
+
const cache = /* @__PURE__ */ new Map();
|
|
388
|
+
return {
|
|
389
|
+
answer: (head) => {
|
|
390
|
+
if (!head) return null;
|
|
391
|
+
if (cache.has(head)) return cache.get(head) ?? null;
|
|
392
|
+
let verdict = null;
|
|
393
|
+
try {
|
|
394
|
+
const read = readNewestNotes(runId, head, root === void 0 ? {} : { root });
|
|
395
|
+
if (read.ok && typeof read.text === "string") verdict = validateNotesText(read.text).verdict;
|
|
396
|
+
} catch {
|
|
397
|
+
verdict = null;
|
|
398
|
+
}
|
|
399
|
+
cache.set(head, verdict);
|
|
400
|
+
return verdict;
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
function readWorkView(runId, options = {}) {
|
|
405
|
+
try {
|
|
406
|
+
const state = readFlow(runId, options.root === void 0 ? {} : { root: options.root });
|
|
407
|
+
const plan = planExists(runId, options.root === void 0 ? {} : { root: options.root }) ? readPlan(runId, options.root === void 0 ? {} : { root: options.root }) : null;
|
|
408
|
+
return workItems(state, {
|
|
409
|
+
plan,
|
|
410
|
+
notes: workNotesFor(runId, options.root),
|
|
411
|
+
at: options.at
|
|
412
|
+
});
|
|
413
|
+
} catch {
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
129
418
|
// src/surfaces/webui/state.ts
|
|
130
419
|
function monogram(nickname, provider) {
|
|
131
420
|
const base = (nickname || provider).trim();
|
|
@@ -135,7 +424,7 @@ function monogram(nickname, provider) {
|
|
|
135
424
|
function webFlow(badge, t, options = {}) {
|
|
136
425
|
const pulseMs = options.pulseMs ?? 15 * 60 * 1e3;
|
|
137
426
|
const fresh = pulseMs > 0 && badge.updated_at > 0 && (options.now ?? Date.now()) - badge.updated_at < pulseMs;
|
|
138
|
-
const view = flowBadgeView(t, badge, { fresh });
|
|
427
|
+
const view = flowBadgeView(t, badge, { fresh, work: options.work ?? null });
|
|
139
428
|
const doneKind = badge.status !== "done" ? null : badge.plan_progress !== null && badge.plan_progress.done >= badge.plan_progress.total ? "plan_complete" : badge.close_reason === "stopped by the operator" ? "stopped" : "closed_no_plan";
|
|
140
429
|
return {
|
|
141
430
|
status: badge.status,
|
|
@@ -148,6 +437,8 @@ function webFlow(badge, t, options = {}) {
|
|
|
148
437
|
tone: view.tone,
|
|
149
438
|
pulse: view.pulse,
|
|
150
439
|
plan: badge.plan_progress,
|
|
440
|
+
plan_label: view.plan_label,
|
|
441
|
+
work_total: options.work?.total ?? 0,
|
|
151
442
|
done_kind: doneKind,
|
|
152
443
|
detail: view.detail
|
|
153
444
|
};
|
|
@@ -158,11 +449,17 @@ function buildWebState(options = {}) {
|
|
|
158
449
|
const now = options.now ?? Date.now();
|
|
159
450
|
const agentIndex = /* @__PURE__ */ new Map();
|
|
160
451
|
const runNameById = /* @__PURE__ */ new Map();
|
|
452
|
+
const pendingApprovals = listRunApprovals(void 0, "pending");
|
|
453
|
+
const pendingByAgent = /* @__PURE__ */ new Map();
|
|
454
|
+
for (const approval of pendingApprovals) {
|
|
455
|
+
if (!pendingByAgent.has(approval.agent_id)) pendingByAgent.set(approval.agent_id, approval);
|
|
456
|
+
}
|
|
161
457
|
const runs = listRuns().map((run) => {
|
|
162
458
|
runNameById.set(run.id, run.name);
|
|
163
459
|
const live = options.liveTmuxTarget ? options.liveTmuxTarget(run) : runHasLiveTmuxTarget(run);
|
|
164
460
|
const runStatus = computeRunStatus(run, live);
|
|
165
461
|
const flow = readFlowBadge(run.id, now);
|
|
462
|
+
const work = flow ? readWorkView(run.id, { at: now }) : null;
|
|
166
463
|
const incidents = listFlowIncidents(run.id, { open_only: true, now }).map((row) => ({
|
|
167
464
|
id: row.id,
|
|
168
465
|
spec_id: row.spec_id,
|
|
@@ -179,6 +476,8 @@ function buildWebState(options = {}) {
|
|
|
179
476
|
const terminals = listAgents(run.id).map((agent) => {
|
|
180
477
|
agentIndex.set(agent.id, { nickname: agent.nickname, provider: agent.provider });
|
|
181
478
|
const status = agent.ended_at ? "ended" : agent.task_status;
|
|
479
|
+
const pending = pendingByAgent.get(agent.id);
|
|
480
|
+
const attention = agent.ended_at ? null : agent.attention ? { reason: agent.attention.reason, detail: agent.attention.detail, since: agent.attention.since, source: "agent" } : pending ? { reason: "approval", detail: pending.action, since: pending.requested_at, source: "approval" } : null;
|
|
182
481
|
const hasWindow = !agent.headless && !!agent.tmux_window_id;
|
|
183
482
|
const canAttach = live && hasWindow && status !== "ended";
|
|
184
483
|
const canKill = live && status !== "ended" && hasWindow;
|
|
@@ -191,6 +490,7 @@ function buildWebState(options = {}) {
|
|
|
191
490
|
model: agent.model,
|
|
192
491
|
role: agent.role,
|
|
193
492
|
status,
|
|
493
|
+
attention,
|
|
194
494
|
headless: !!agent.headless,
|
|
195
495
|
hasWindow,
|
|
196
496
|
canAttach,
|
|
@@ -210,7 +510,7 @@ function buildWebState(options = {}) {
|
|
|
210
510
|
canStop: run.status === "running" && !run.ended_at,
|
|
211
511
|
canDelete: run.status === "ended" || run.ended_at !== null,
|
|
212
512
|
terminals,
|
|
213
|
-
flow: flow ? webFlow(flow, t, { now, pulseMs: options.agent_pulse_ms }) : null,
|
|
513
|
+
flow: flow ? webFlow(flow, t, { now, pulseMs: options.agent_pulse_ms, work }) : null,
|
|
214
514
|
incidents
|
|
215
515
|
};
|
|
216
516
|
});
|
|
@@ -226,7 +526,7 @@ function buildWebState(options = {}) {
|
|
|
226
526
|
root_provider: record.root_provider,
|
|
227
527
|
root_provider_label: record.root_provider ? providerDisplayName(record.root_provider) : null
|
|
228
528
|
}));
|
|
229
|
-
const approvals =
|
|
529
|
+
const approvals = pendingApprovals.map((approval) => {
|
|
230
530
|
const info = agentIndex.get(approval.agent_id);
|
|
231
531
|
return {
|
|
232
532
|
id: approval.id,
|
|
@@ -514,6 +814,7 @@ var HOST = "127.0.0.1";
|
|
|
514
814
|
var DEFAULT_PORT = 8080;
|
|
515
815
|
var DEFAULT_RANGE = 10;
|
|
516
816
|
var POLL_MS = 1500;
|
|
817
|
+
var ATTENTION_SWEEP_MS = 2500;
|
|
517
818
|
var MAX_BODY = 64 * 1024;
|
|
518
819
|
var DEFAULT_WEB_ROOT = join(dirname(fileURLToPath(import.meta.url)), "web");
|
|
519
820
|
var STATIC_ROUTES = {
|
|
@@ -953,8 +1254,9 @@ async function handleRequest(req, res, ctx) {
|
|
|
953
1254
|
}
|
|
954
1255
|
try {
|
|
955
1256
|
const resolved = resolveFlowRunId(runId);
|
|
1257
|
+
const work = readWorkView(resolved);
|
|
956
1258
|
if (!planExists(resolved)) {
|
|
957
|
-
sendJson(res, 200, { run_id: resolved, plan: null });
|
|
1259
|
+
sendJson(res, 200, { run_id: resolved, plan: null, work });
|
|
958
1260
|
return;
|
|
959
1261
|
}
|
|
960
1262
|
const plan = readPlan(resolved);
|
|
@@ -966,7 +1268,8 @@ async function handleRequest(req, res, ctx) {
|
|
|
966
1268
|
progress: planProgress(plan),
|
|
967
1269
|
items: plan.items.map(planItemView),
|
|
968
1270
|
conflicts: plan.conflicts
|
|
969
|
-
}
|
|
1271
|
+
},
|
|
1272
|
+
work
|
|
970
1273
|
});
|
|
971
1274
|
} catch (err) {
|
|
972
1275
|
sendJson(res, 404, { error: errMessage(err) });
|
|
@@ -1294,6 +1597,13 @@ async function startWebServer(options = {}) {
|
|
|
1294
1597
|
socket.on("close", () => sockets.delete(socket));
|
|
1295
1598
|
});
|
|
1296
1599
|
const bridge = attachTerminalBridge(server, () => boundPort);
|
|
1600
|
+
const attentionTimer = setInterval(() => {
|
|
1601
|
+
try {
|
|
1602
|
+
sweepAttentionThrottled();
|
|
1603
|
+
} catch {
|
|
1604
|
+
}
|
|
1605
|
+
}, ATTENTION_SWEEP_MS);
|
|
1606
|
+
attentionTimer.unref();
|
|
1297
1607
|
boundPort = await listenWithFallback(server, basePort, range);
|
|
1298
1608
|
const url = `http://${HOST}:${boundPort}`;
|
|
1299
1609
|
if (options.open !== false) {
|
|
@@ -1304,6 +1614,7 @@ async function startWebServer(options = {}) {
|
|
|
1304
1614
|
url,
|
|
1305
1615
|
port: boundPort,
|
|
1306
1616
|
close: async () => {
|
|
1617
|
+
clearInterval(attentionTimer);
|
|
1307
1618
|
sse.close();
|
|
1308
1619
|
await bridge.close();
|
|
1309
1620
|
await new Promise((resolve) => {
|
|
@@ -1318,4 +1629,4 @@ export {
|
|
|
1318
1629
|
flowTickPayload,
|
|
1319
1630
|
startWebServer
|
|
1320
1631
|
};
|
|
1321
|
-
//# sourceMappingURL=server-
|
|
1632
|
+
//# sourceMappingURL=server-4DQ7LMRT.js.map
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
startFlow
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-T3KAXZJK.js";
|
|
5
5
|
import {
|
|
6
6
|
installSkills,
|
|
7
7
|
skillsStatus
|
|
8
8
|
} from "./chunk-QIHT27ZG.js";
|
|
9
|
+
import {
|
|
10
|
+
sweepAttentionThrottled
|
|
11
|
+
} from "./chunk-ZNOYXAJO.js";
|
|
9
12
|
import {
|
|
10
13
|
addFlowSpecs,
|
|
11
14
|
dropFlowSpec,
|
|
@@ -14,7 +17,7 @@ import {
|
|
|
14
17
|
resumeFlow,
|
|
15
18
|
stepFlow,
|
|
16
19
|
stopFlow
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-BHUY46Z3.js";
|
|
18
21
|
import {
|
|
19
22
|
REEVESAGENTS_VERSION,
|
|
20
23
|
ackFlowIncident,
|
|
@@ -33,7 +36,7 @@ import {
|
|
|
33
36
|
sweepAgentsThrottled,
|
|
34
37
|
sweepOrphanSessions,
|
|
35
38
|
sweepOrphanSessionsThrottled
|
|
36
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-H7HEBQDW.js";
|
|
37
40
|
import {
|
|
38
41
|
ALLOWED_KEYS,
|
|
39
42
|
BIN,
|
|
@@ -87,7 +90,7 @@ import {
|
|
|
87
90
|
startRunWithHead,
|
|
88
91
|
stopRun,
|
|
89
92
|
withRunsLock
|
|
90
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-VNACTZPD.js";
|
|
91
94
|
import "./chunk-Q3WWQP2R.js";
|
|
92
95
|
|
|
93
96
|
// src/surfaces/mcp/server.ts
|
|
@@ -413,6 +416,7 @@ var TOOLS = [
|
|
|
413
416
|
handler: () => {
|
|
414
417
|
sweepAgentsThrottled();
|
|
415
418
|
sweepOrphanSessionsThrottled();
|
|
419
|
+
sweepAttentionThrottled();
|
|
416
420
|
return ok(listRuns().map((run) => ({ ...run, agents: listAgents(run.id) })));
|
|
417
421
|
}
|
|
418
422
|
},
|
|
@@ -1101,4 +1105,4 @@ export {
|
|
|
1101
1105
|
sessionRunIsLive,
|
|
1102
1106
|
startAgentMcpServer
|
|
1103
1107
|
};
|
|
1104
|
-
//# sourceMappingURL=server-
|
|
1108
|
+
//# sourceMappingURL=server-IMN4GWAU.js.map
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
closeTuiWebServer,
|
|
4
4
|
startWebFromTui
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Q4PR3NOT.js";
|
|
6
6
|
export {
|
|
7
7
|
closeTuiWebServer,
|
|
8
8
|
startWebFromTui
|
|
9
9
|
};
|
|
10
|
-
//# sourceMappingURL=tui-launch-
|
|
10
|
+
//# sourceMappingURL=tui-launch-EZMMQS7K.js.map
|
package/dist/web/app.css
CHANGED
|
@@ -1268,6 +1268,44 @@ button { letter-spacing: 0; }
|
|
|
1268
1268
|
gap: var(--s-2);
|
|
1269
1269
|
}
|
|
1270
1270
|
|
|
1271
|
+
/* Operator attention: "this agent is blocked on a human". It takes over the status slot
|
|
1272
|
+
on the card (the dot pulses and the label replaces the lifecycle word) because this
|
|
1273
|
+
is the one signal that must reach someone looking at another tab. */
|
|
1274
|
+
.dot[data-status][data-attention="approval"] {
|
|
1275
|
+
background: var(--error);
|
|
1276
|
+
box-shadow: 0 0 0 3px rgba(213, 106, 96, 0.16);
|
|
1277
|
+
animation: attention-pulse 1.1s ease-in-out infinite;
|
|
1278
|
+
}
|
|
1279
|
+
.dot[data-status][data-attention="input"],
|
|
1280
|
+
.dot[data-status][data-attention="question"] {
|
|
1281
|
+
background: var(--warn);
|
|
1282
|
+
box-shadow: 0 0 0 3px rgba(215, 168, 79, 0.16);
|
|
1283
|
+
animation: attention-pulse 1.1s ease-in-out infinite;
|
|
1284
|
+
}
|
|
1285
|
+
.card-status[data-attention] {
|
|
1286
|
+
max-width: none;
|
|
1287
|
+
font-weight: 600;
|
|
1288
|
+
}
|
|
1289
|
+
.card-status[data-attention="approval"] { color: var(--error); }
|
|
1290
|
+
.card-status[data-attention="input"],
|
|
1291
|
+
.card-status[data-attention="question"] { color: var(--warn); }
|
|
1292
|
+
|
|
1293
|
+
@keyframes attention-pulse {
|
|
1294
|
+
0%, 100% { opacity: 1; transform: scale(1); }
|
|
1295
|
+
50% { opacity: 0.35; transform: scale(0.78); }
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
.card[data-attention] {
|
|
1299
|
+
box-shadow: inset 2px 0 0 var(--warn);
|
|
1300
|
+
}
|
|
1301
|
+
.card[data-attention="approval"] {
|
|
1302
|
+
box-shadow: inset 2px 0 0 var(--error);
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1306
|
+
.dot[data-status][data-attention] { animation: none; }
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1271
1309
|
.dot {
|
|
1272
1310
|
width: 8px;
|
|
1273
1311
|
height: 8px;
|
|
@@ -2492,6 +2530,42 @@ button { letter-spacing: 0; }
|
|
|
2492
2530
|
.plan-badge[data-status='blocked_owner'],
|
|
2493
2531
|
.plan-badge[data-status='needs_brief'] { background: rgba(224, 180, 106, 0.2); }
|
|
2494
2532
|
.plan-badge[data-status='skipped'] { background: rgba(160, 160, 160, 0.14); }
|
|
2533
|
+
.plan-badge[data-status='dispatching'] { background: rgba(224, 180, 106, 0.2); }
|
|
2534
|
+
.plan-badge[data-status='handed_over'] { background: rgba(160, 160, 160, 0.14); }
|
|
2535
|
+
|
|
2536
|
+
/* The rows the flow derived from its spec queue beside the plan's own: the origin label is what keeps a reader from
|
|
2537
|
+
mistaking a derived row for a line the document said. */
|
|
2538
|
+
.plan-row--spec { grid-template-columns: 64px 1fr auto auto; }
|
|
2539
|
+
.plan-origin {
|
|
2540
|
+
color: var(--muted, #8b95a7);
|
|
2541
|
+
font-size: 11px;
|
|
2542
|
+
white-space: nowrap;
|
|
2543
|
+
}
|
|
2544
|
+
.plan-current {
|
|
2545
|
+
color: var(--accent, #7eb8f5);
|
|
2546
|
+
font-size: 11px;
|
|
2547
|
+
font-weight: 600;
|
|
2548
|
+
white-space: nowrap;
|
|
2549
|
+
}
|
|
2550
|
+
.plan-row.is-current { box-shadow: inset 2px 0 0 var(--accent, #7eb8f5); }
|
|
2551
|
+
.plan-derived {
|
|
2552
|
+
color: var(--muted, #8b95a7);
|
|
2553
|
+
font-size: 11px;
|
|
2554
|
+
padding: 0 4px 6px;
|
|
2555
|
+
}
|
|
2556
|
+
.plan-dispatch-unknown {
|
|
2557
|
+
color: #e0b46a;
|
|
2558
|
+
font-size: 12px;
|
|
2559
|
+
padding: 4px;
|
|
2560
|
+
border-left: 2px solid #e0b46a;
|
|
2561
|
+
margin-bottom: 6px;
|
|
2562
|
+
}
|
|
2563
|
+
.plan-detail-note {
|
|
2564
|
+
color: #e0b46a;
|
|
2565
|
+
font-size: 12px;
|
|
2566
|
+
margin-top: 6px;
|
|
2567
|
+
}
|
|
2568
|
+
.flow-badge-plan { opacity: 0.75; }
|
|
2495
2569
|
|
|
2496
2570
|
.plan-detail {
|
|
2497
2571
|
border-top: 1px solid rgba(255, 255, 255, 0.12);
|