reevesagents 2.1.0 → 2.2.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/CHANGELOG.md +21 -0
- package/README.md +232 -318
- package/dist/chunk-CJKEBBUI.js +7663 -0
- package/dist/{chunk-UEYJAKAZ.js → chunk-DGLUP7Q7.js} +2 -2
- package/dist/{chunk-PWYG5IM5.js → chunk-HTCENB3Q.js} +2 -2
- package/dist/chunk-PKMTELW4.js +115 -0
- package/dist/chunk-PVYM35RS.js +1697 -0
- package/dist/{chunk-OQJNBACW.js → chunk-QWUBYDUV.js} +2 -2
- package/dist/chunk-XEOWHTRQ.js +1246 -0
- package/dist/{chunk-KROKGL2R.js → chunk-XHP63Y64.js} +879 -2
- package/dist/cli.js +1099 -13
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -2
- package/dist/{router-AYNTF24M.js → router-S7KR2CIE.js} +146 -79
- package/dist/{server-TIFQ5JSM.js → server-4OILK2LL.js} +344 -6
- package/dist/{server-BNBSZZIP.js → server-5U4NNV43.js} +305 -14
- package/dist/{tui-launch-7DBX4JYA.js → tui-launch-7WKLVYEH.js} +2 -2
- package/dist/web/app.css +444 -11
- package/dist/web/app.js +672 -21
- package/dist/web/favicon.png +0 -0
- package/dist/web/index.html +75 -0
- package/dist/web/insights-core.js +92 -0
- package/dist/web/plan-controller.js +91 -0
- package/dist/web/plan-error.js +81 -0
- package/dist/web/tick-line.js +78 -0
- package/package.json +10 -8
- package/dist/chunk-DLWYZPW6.js +0 -3222
- package/dist/chunk-YWS3MILO.js +0 -266
package/dist/web/favicon.png
CHANGED
|
Binary file
|
package/dist/web/index.html
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
<button id="presets-btn" class="btn btn-secondary" type="button">Presets</button>
|
|
28
28
|
<button id="doctor-btn" class="btn btn-secondary" type="button">Doctor</button>
|
|
29
29
|
<button id="about-btn" class="btn btn-secondary" type="button">About</button>
|
|
30
|
+
<button id="logs-btn" class="btn btn-secondary" type="button" aria-haspopup="dialog">Logs</button>
|
|
30
31
|
<button id="new-agent-btn" class="btn btn-agent" type="button">New agent</button>
|
|
31
32
|
<button id="new-run-btn" class="btn btn-accent" type="button">New run</button>
|
|
32
33
|
</div>
|
|
@@ -243,6 +244,76 @@
|
|
|
243
244
|
</div>
|
|
244
245
|
</dialog>
|
|
245
246
|
|
|
247
|
+
<dialog id="plan-dialog" class="dialog mcp-dialog plan-dialog">
|
|
248
|
+
<div class="mcp-panel">
|
|
249
|
+
<div class="dialog-header">
|
|
250
|
+
<div id="plan-dialog-title" class="dialog-title">Plan</div>
|
|
251
|
+
<button id="plan-play-pause" class="btn btn-secondary plan-play-pause" type="button"
|
|
252
|
+
aria-label="Pause the plan" aria-pressed="false">Pause</button>
|
|
253
|
+
</div>
|
|
254
|
+
<div id="plan-panel" class="insights-panel">
|
|
255
|
+
<div id="plan-ticks" class="plan-ticks" hidden></div>
|
|
256
|
+
<div class="plan-progress">
|
|
257
|
+
<div class="plan-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
|
|
258
|
+
<span id="plan-progress-fill" class="plan-progress-fill"></span>
|
|
259
|
+
</div>
|
|
260
|
+
<div id="plan-progress-text" class="plan-progress-text">0/0</div>
|
|
261
|
+
</div>
|
|
262
|
+
<div class="plan-filters" role="group" aria-label="plan filter">
|
|
263
|
+
<button id="plan-filter-all" class="chip is-active" type="button">All</button>
|
|
264
|
+
<button id="plan-filter-open" class="chip" type="button">Open</button>
|
|
265
|
+
<button id="plan-filter-waiting" class="chip" type="button">Waiting for you</button>
|
|
266
|
+
</div>
|
|
267
|
+
<div id="plan-waiting" class="plan-waiting" hidden></div>
|
|
268
|
+
<div id="plan-list" class="plan-list" role="list" aria-label="plan items"></div>
|
|
269
|
+
<div id="plan-detail" class="plan-detail" hidden></div>
|
|
270
|
+
<div id="plan-empty" class="logs-empty" hidden>
|
|
271
|
+
<div class="empty-title">No plan yet</div>
|
|
272
|
+
<div class="empty-body">Import the project document with `reevesagents flow plan import`.</div>
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
<div id="plan-error" class="dialog-error" hidden></div>
|
|
276
|
+
<div class="dialog-actions">
|
|
277
|
+
<button id="plan-close" class="btn" type="button">Close</button>
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
</dialog>
|
|
281
|
+
|
|
282
|
+
<dialog id="insights-dialog" class="dialog mcp-dialog">
|
|
283
|
+
<div class="mcp-panel">
|
|
284
|
+
<div class="dialog-header">
|
|
285
|
+
<div id="insights-title" class="dialog-title">Logs</div>
|
|
286
|
+
<div id="insights-subtitle" class="dialog-subtitle">What your agents reported.</div>
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
<div id="logs-panel" class="insights-panel">
|
|
291
|
+
<div class="logs-filters">
|
|
292
|
+
<label class="logs-filter">
|
|
293
|
+
<span>Run</span>
|
|
294
|
+
<select id="logs-filter-run" aria-label="filter by run"><option value="">All runs</option></select>
|
|
295
|
+
</label>
|
|
296
|
+
<label class="logs-filter logs-toggle">
|
|
297
|
+
<input id="logs-unread" type="checkbox" />
|
|
298
|
+
<span>Unread only</span>
|
|
299
|
+
</label>
|
|
300
|
+
</div>
|
|
301
|
+
<div id="logs-announcer" class="visually-hidden" aria-live="polite"></div>
|
|
302
|
+
<div id="logs-list" class="logs-list" role="list" aria-label="notifications"></div>
|
|
303
|
+
<div id="logs-empty" class="logs-empty" hidden>
|
|
304
|
+
<div class="empty-title">No notifications yet</div>
|
|
305
|
+
<div class="empty-body">Runs, approvals and flow events appear here as they happen.</div>
|
|
306
|
+
</div>
|
|
307
|
+
<div id="logs-error" class="dialog-error" hidden></div>
|
|
308
|
+
</div>
|
|
309
|
+
|
|
310
|
+
<div class="dialog-actions">
|
|
311
|
+
<button type="button" id="logs-mark-read" class="btn btn-agent">Mark all read</button>
|
|
312
|
+
<button type="button" id="insights-close" class="btn">Close</button>
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
</dialog>
|
|
316
|
+
|
|
246
317
|
<dialog id="welcome-dialog" class="dialog mcp-dialog">
|
|
247
318
|
<div class="mcp-panel">
|
|
248
319
|
<div class="dialog-header">
|
|
@@ -303,6 +374,10 @@
|
|
|
303
374
|
|
|
304
375
|
<script src="xterm.js"></script>
|
|
305
376
|
<script src="addon-fit.js"></script>
|
|
377
|
+
<script src="tick-line.js"></script>
|
|
378
|
+
<script src="insights-core.js"></script>
|
|
379
|
+
<script src="plan-controller.js"></script>
|
|
380
|
+
<script src="plan-error.js"></script>
|
|
306
381
|
<script src="app.js"></script>
|
|
307
382
|
</body>
|
|
308
383
|
</html>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Pure helpers for the Insights dialog (Plan + Logs tabs) and the agent-card pulse.
|
|
2
|
+
//
|
|
3
|
+
// A plain script, not a module: `app.js` is an IIFE loaded before this file's consumers and the client has no build
|
|
4
|
+
// step. Everything here is DOM-free on purpose, so `test/web/insights-core.test.ts` can load the real file with a
|
|
5
|
+
// fake `window` and test the arithmetic instead of grepping for it.
|
|
6
|
+
|
|
7
|
+
;(function (global) {
|
|
8
|
+
'use strict'
|
|
9
|
+
|
|
10
|
+
// Where focus goes when the plan dialog closes. The button is looked up, never remembered: `renderSidebar()` rebuilds the
|
|
11
|
+
// cards on every SSE frame, so a held element is detached by the time Esc is pressed. Order: the icon of that run, then the
|
|
12
|
+
// run's card, then the Logs button — a keyboard user must never land on `body`.
|
|
13
|
+
function planFocusTarget(doc, runId) {
|
|
14
|
+
const query = selector => {
|
|
15
|
+
if (!doc || typeof doc.querySelector !== 'function') return null
|
|
16
|
+
const found = doc.querySelector(selector)
|
|
17
|
+
return found && typeof found.focus === 'function' ? found : null
|
|
18
|
+
}
|
|
19
|
+
if (!runId) return query('#logs-btn')
|
|
20
|
+
return query(`[data-plan-run="${runId}"]`)
|
|
21
|
+
|| query(`[data-run-card="${runId}"]`)
|
|
22
|
+
|| query('#logs-btn')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// `aria-expanded` for the plan icon: true only for the run whose dialog is open. Passed the id of the open dialog rather
|
|
26
|
+
// than a flag, so a redrawn card cannot claim `true` for a different run.
|
|
27
|
+
function planExpanded(openRunId, runId) {
|
|
28
|
+
return openRunId !== null && openRunId !== undefined && openRunId === runId ? 'true' : 'false'
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Is there a plan to open for this card? The badge itself is a label and never a control; the plan icon beside it is drawn
|
|
32
|
+
// only when the answer is yes, because a button that cannot do anything is worse than no button (T1.6.6).
|
|
33
|
+
function planIconVisible(flow) {
|
|
34
|
+
return Boolean(flow && flow.plan)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// `12/23` plus the percentage the progress bar needs. A plan with no items is `0/0` and a 0 % bar, not a crash.
|
|
38
|
+
function formatPlanProgress(done, total) {
|
|
39
|
+
const safeTotal = Number.isFinite(total) && total > 0 ? total : 0
|
|
40
|
+
const safeDone = Number.isFinite(done) && done > 0 ? done : 0
|
|
41
|
+
const percent = safeTotal === 0 ? 0 : Math.round((safeDone / safeTotal) * 100)
|
|
42
|
+
return { text: `${safeDone}/${safeTotal}`, percent, done: safeDone, total: safeTotal }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// How long the card's pulse should still run, from the *server* clock of the newest unread event. The client
|
|
46
|
+
// clock is only used to measure elapsed time since the snapshot, so an F5 mid-pulse keeps the remainder instead of
|
|
47
|
+
// restarting it. `pulseMs` 0 disables the pulse entirely.
|
|
48
|
+
// The remainder is measured from the event's server timestamp to *now*, full stop. `seenAtMs` is only a fallback
|
|
49
|
+
// for a client whose clock has not been trusted yet; using it as the anchor made the remainder stand still while
|
|
50
|
+
// the page was open, so the ring never finished.
|
|
51
|
+
function pulseRemaining(latestTs, nowMs, pulseMs, seenAtMs) {
|
|
52
|
+
if (!Number.isFinite(pulseMs) || pulseMs <= 0) return 0
|
|
53
|
+
const stamped = Date.parse(latestTs)
|
|
54
|
+
if (Number.isNaN(stamped)) return 0
|
|
55
|
+
const now = Number.isFinite(nowMs) ? nowMs : seenAtMs
|
|
56
|
+
if (!Number.isFinite(now)) return 0
|
|
57
|
+
return Math.max(0, pulseMs - Math.max(0, now - stamped))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// The filter the Plan tab offers: all, open (not done/skipped), or waiting for a human.
|
|
61
|
+
function filterPlanItems(items, filter) {
|
|
62
|
+
const list = Array.isArray(items) ? items : []
|
|
63
|
+
if (filter === 'open') return list.filter(item => item.status !== 'done' && item.status !== 'skipped')
|
|
64
|
+
if (filter === 'waiting') {
|
|
65
|
+
return list.filter(item => {
|
|
66
|
+
if (item.status === 'done' || item.status === 'skipped') return false
|
|
67
|
+
if (item.missing_since !== null && item.missing_since !== undefined) return false
|
|
68
|
+
return item.status === 'blocked_owner' || item.status === 'needs_brief' || item.spec_path === null
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
return list
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Which items the "waiting for you" block lists, and why. Kept here so the badge and the dialog cannot disagree
|
|
75
|
+
// about what "waiting" means.
|
|
76
|
+
function planWaiting(items) {
|
|
77
|
+
const list = Array.isArray(items) ? items : []
|
|
78
|
+
const needsBrief = []
|
|
79
|
+
const blocked = []
|
|
80
|
+
for (const item of list) {
|
|
81
|
+
if (item.status === 'done' || item.status === 'skipped') continue
|
|
82
|
+
// An item the document dropped is not waiting for a brief: it is waiting for a re-import, and dressing it up
|
|
83
|
+
// as "needs a brief" sends the owner to attach one for a row that may not exist any more.
|
|
84
|
+
if (item.missing_since !== null && item.missing_since !== undefined) continue
|
|
85
|
+
if (item.status === 'blocked_owner') blocked.push(item)
|
|
86
|
+
else if (item.spec_path === null) needsBrief.push(item)
|
|
87
|
+
}
|
|
88
|
+
return { needsBrief, blocked, total: needsBrief.length + blocked.length }
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
global.insightsCore = { formatPlanProgress, pulseRemaining, filterPlanItems, planWaiting, planIconVisible, planFocusTarget, planExpanded }
|
|
92
|
+
})(typeof window === 'undefined' ? globalThis : window)
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// The plan dialog's focus and ARIA rules, kept out of `app.js` so they can be driven against a small DOM in a test.
|
|
2
|
+
//
|
|
3
|
+
// The lesson this file exists for: a run card is rebuilt on every SSE frame, so a remembered button is a detached node by the
|
|
4
|
+
// time the dialog closes. The controller remembers the **run id** and looks the button up again when it needs it, falling back
|
|
5
|
+
// to the run's card and then to the Logs button — a keyboard user must never land on `body`.
|
|
6
|
+
|
|
7
|
+
;(function (global) {
|
|
8
|
+
'use strict'
|
|
9
|
+
|
|
10
|
+
function createPlanDialogController(doc) {
|
|
11
|
+
let openRunId = null
|
|
12
|
+
|
|
13
|
+
const buttonFor = runId => {
|
|
14
|
+
if (!runId || !doc || typeof doc.querySelector !== 'function') return null
|
|
15
|
+
const found = doc.querySelector(`[data-plan-run="${runId}"]`)
|
|
16
|
+
return found && typeof found.focus === 'function' ? found : null
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const allButtons = () => {
|
|
20
|
+
if (!doc || typeof doc.querySelectorAll !== 'function') return []
|
|
21
|
+
return Array.from(doc.querySelectorAll('[data-plan-run]'))
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// `aria-expanded` is recomputed for every card, not only for the one whose dialog opened: a card redrawn while the dialog
|
|
25
|
+
// is open has to say `true`, and every other card has to say `false`.
|
|
26
|
+
function refreshExpanded() {
|
|
27
|
+
for (const button of allButtons()) {
|
|
28
|
+
const runId = typeof button.getAttribute === 'function' ? button.getAttribute('data-plan-run') : null
|
|
29
|
+
if (typeof button.setAttribute === 'function') {
|
|
30
|
+
button.setAttribute('aria-expanded', openRunId !== null && runId === openRunId ? 'true' : 'false')
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
// Wires the dialog's own `close` event — the one Esc and the Close button both produce — to the focus rule below. Kept here
|
|
37
|
+
// rather than in `app.js` so the "Esc comes back to the icon" path can be driven end to end in a test instead of being
|
|
38
|
+
// described in a comment.
|
|
39
|
+
attach(dialog) {
|
|
40
|
+
if (!dialog || typeof dialog.addEventListener !== 'function') return
|
|
41
|
+
dialog.addEventListener('close', () => { this.close() })
|
|
42
|
+
},
|
|
43
|
+
open(runId) {
|
|
44
|
+
openRunId = runId || null
|
|
45
|
+
refreshExpanded()
|
|
46
|
+
},
|
|
47
|
+
// Called from the dialog's `close` event (Esc and the Close button both land here). It returns the element it focused so a
|
|
48
|
+
// test can assert on it without a browser.
|
|
49
|
+
close() {
|
|
50
|
+
const runId = openRunId
|
|
51
|
+
openRunId = null
|
|
52
|
+
refreshExpanded()
|
|
53
|
+
const target = global.planFocusTarget
|
|
54
|
+
? global.planFocusTarget(doc, runId)
|
|
55
|
+
: (buttonFor(runId)
|
|
56
|
+
|| (doc && typeof doc.querySelector === 'function' ? doc.querySelector(`[data-run-card="${runId}"]`) : null)
|
|
57
|
+
|| (doc && typeof doc.querySelector === 'function' ? doc.querySelector('#logs-btn') : null))
|
|
58
|
+
if (target && typeof target.focus === 'function') target.focus()
|
|
59
|
+
return target || null
|
|
60
|
+
},
|
|
61
|
+
// The icon itself: created only when the run has a plan, labelled for a screen reader and stamped with the run id the
|
|
62
|
+
// close path looks it up by. Kept here so "no plan → no button" is a behaviour a test can call, not a line of source it can
|
|
63
|
+
// search for.
|
|
64
|
+
createIcon(flow, labels) {
|
|
65
|
+
const core = global.insightsCore
|
|
66
|
+
if (!core || typeof core.planIconVisible !== 'function' || !core.planIconVisible(flow)) return null
|
|
67
|
+
const runId = flow && flow.run_id ? flow.run_id : ''
|
|
68
|
+
const button = doc.createElement('button')
|
|
69
|
+
button.type = 'button'
|
|
70
|
+
button.id = 'plan-btn'
|
|
71
|
+
button.className = 'flow-plan-btn'
|
|
72
|
+
button.setAttribute('aria-label', labels.ariaLabel)
|
|
73
|
+
button.setAttribute('aria-haspopup', 'dialog')
|
|
74
|
+
button.setAttribute('aria-expanded', openRunId !== null && runId === openRunId ? 'true' : 'false')
|
|
75
|
+
button.title = labels.ariaLabel
|
|
76
|
+
button.setAttribute('data-plan-run', runId)
|
|
77
|
+
button.innerHTML = '<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true" focusable="false">'
|
|
78
|
+
+ '<path d="M2 3.5h2M6 3.5h8M2 8h2M6 8h8M2 12.5h2M6 12.5h8" stroke="currentColor" stroke-width="1.4" '
|
|
79
|
+
+ 'stroke-linecap="round" fill="none"/></svg>'
|
|
80
|
+
return button
|
|
81
|
+
},
|
|
82
|
+
// A card rendered while the dialog is open asks what to put on its button.
|
|
83
|
+
expandedOf(runId) {
|
|
84
|
+
return openRunId !== null && runId === openRunId ? 'true' : 'false'
|
|
85
|
+
},
|
|
86
|
+
get openRunId() { return openRunId },
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
global.planDialogController = { createPlanDialogController }
|
|
91
|
+
})(typeof window === 'undefined' ? globalThis : window)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// The line under the plan dialog's actions: a refusal from `POST /api/flow/pause|resume`, translated, bound to the run it was raised for,
|
|
2
|
+
// and gone after a few seconds. It lives in its own file so the behaviour can be driven in a real DOM with fake timers — the rest of the
|
|
3
|
+
// client is too big to mount, and "the message never disappears" is exactly the kind of bug a hand-written fake hides (block 59).
|
|
4
|
+
//
|
|
5
|
+
// The rule it encodes: a code is not a sentence, and it is not a tooltip either. The identifier lives in `data-code` — not rendered, not
|
|
6
|
+
// on hover — for whoever has to diagnose it; the operator reads the words in their own language, or a generic fallback they can act on.
|
|
7
|
+
;(function (window) {
|
|
8
|
+
'use strict'
|
|
9
|
+
|
|
10
|
+
const TTL_MS = 6000
|
|
11
|
+
const KEYS = {
|
|
12
|
+
not_pausable: 'web.planErrNotPausable',
|
|
13
|
+
already_paused: 'web.planErrAlreadyPaused',
|
|
14
|
+
not_paused: 'web.planErrNotPaused',
|
|
15
|
+
not_found: 'web.planErrNotFound',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function createPlanErrorLine(doc, options) {
|
|
19
|
+
const opts = options || {}
|
|
20
|
+
const t = opts.t || function (key) { return key }
|
|
21
|
+
const ttl = typeof opts.ttlMs === 'number' ? opts.ttlMs : TTL_MS
|
|
22
|
+
const setTimer = opts.setTimeout || function (fn, ms) { return window.setTimeout(fn, ms) }
|
|
23
|
+
const clearTimer = opts.clearTimeout || function (id) { window.clearTimeout(id) }
|
|
24
|
+
|
|
25
|
+
let element = null
|
|
26
|
+
let timer = null
|
|
27
|
+
let runId = null
|
|
28
|
+
let code = null
|
|
29
|
+
|
|
30
|
+
function resolve() {
|
|
31
|
+
if (element && element.isConnected !== false) return element
|
|
32
|
+
element = doc.getElementById('plan-error')
|
|
33
|
+
return element
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function clear() {
|
|
37
|
+
if (timer !== null) {
|
|
38
|
+
clearTimer(timer)
|
|
39
|
+
timer = null
|
|
40
|
+
}
|
|
41
|
+
runId = null
|
|
42
|
+
code = null
|
|
43
|
+
const node = resolve()
|
|
44
|
+
if (!node) return
|
|
45
|
+
node.textContent = ''
|
|
46
|
+
node.hidden = true
|
|
47
|
+
delete node.dataset.code
|
|
48
|
+
node.removeAttribute('title')
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function show(nextCode, ownerRunId) {
|
|
52
|
+
const node = resolve()
|
|
53
|
+
clear()
|
|
54
|
+
if (!node) return
|
|
55
|
+
code = String(nextCode || 'unknown')
|
|
56
|
+
runId = ownerRunId === undefined ? null : ownerRunId
|
|
57
|
+
node.textContent = t(KEYS[code] || 'web.planErrGeneric')
|
|
58
|
+
// Diagnostics only: `data-code` is not rendered anywhere and never appears on hover. A `title` is a tooltip, and a tooltip with
|
|
59
|
+
// `not_pausable` in it is the very thing the operator complained about (block 60). Nothing visible carries the identifier.
|
|
60
|
+
node.dataset.code = code
|
|
61
|
+
node.hidden = false
|
|
62
|
+
timer = setTimer(function () { clear() }, ttl)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// A line raised for one run is never shown over another: the caller says which run is open now, and a mismatch drops it.
|
|
66
|
+
function bind(openRunId) {
|
|
67
|
+
if (runId !== null && runId !== openRunId) clear()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
show: show,
|
|
72
|
+
clear: clear,
|
|
73
|
+
bind: bind,
|
|
74
|
+
get code() { return code },
|
|
75
|
+
get runId() { return runId },
|
|
76
|
+
get visible() { const node = resolve(); return Boolean(node) && node.hidden === false },
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
window.planErrorLine = { createPlanErrorLine: createPlanErrorLine, PLAN_ERROR_TTL_MS: TTL_MS, PLAN_ERROR_KEYS: KEYS }
|
|
81
|
+
})(window)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// The driver line on the plan dialog, and the question "did this frame change anything but the clock?".
|
|
2
|
+
//
|
|
3
|
+
// A plain script, not a module: the client has no build step and `app.js` is an IIFE. Everything here is DOM-free on
|
|
4
|
+
// purpose, so `test/web/tick-line.test.ts` can load the real file with a fake `window` and drive the arithmetic instead
|
|
5
|
+
// of grepping for it.
|
|
6
|
+
//
|
|
7
|
+
// Why the line is computed here and not on the server: the frame used to carry `age_s` and `next_in_s`, two numbers that
|
|
8
|
+
// change by themselves. Every frame therefore differed from the previous one, `payload === last` never matched, and the
|
|
9
|
+
// whole sidebar was rebuilt every 1.5 s (block 71). The stream now carries absolute marks (`at`, `next_at`) and the panel
|
|
10
|
+
// subtracts its own clock, once a second, touching one line of text.
|
|
11
|
+
|
|
12
|
+
;(function (global) {
|
|
13
|
+
'use strict'
|
|
14
|
+
|
|
15
|
+
// Seconds since the last real pass. A missing or unreadable stamp reads as 0 — the line still says who drives, which is
|
|
16
|
+
// the part that matters when the stamp is the broken thing.
|
|
17
|
+
function ageSeconds(tick, now) {
|
|
18
|
+
if (!tick || typeof tick.at !== 'string') return 0
|
|
19
|
+
const at = Date.parse(tick.at)
|
|
20
|
+
if (!Number.isFinite(at)) return 0
|
|
21
|
+
return Math.max(0, Math.round((now - at) / 1000))
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Seconds until the next pass, or null when the machine reports no deadline. A deadline that has already passed is 0,
|
|
25
|
+
// never a negative number: "next -3s" is not a thing an operator can act on, and the line says "waiting for a tick"
|
|
26
|
+
// instead.
|
|
27
|
+
function nextInSeconds(tick, now) {
|
|
28
|
+
if (!tick || typeof tick.next_at !== 'number' || !Number.isFinite(tick.next_at)) return null
|
|
29
|
+
return Math.max(0, Math.round((tick.next_at - now) / 1000))
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// The one line: `ticks: <driver> · last <N>s ago`, plus either the countdown or the overdue sentence.
|
|
33
|
+
function lineText(tick, now, t) {
|
|
34
|
+
if (!tick) return t('web.ticksNone')
|
|
35
|
+
const head = t('web.ticksNow', { driver: tick.driver, age: ageSeconds(tick, now) })
|
|
36
|
+
const next = nextInSeconds(tick, now)
|
|
37
|
+
if (next === null) return head
|
|
38
|
+
if (next === 0) return head + ' · ' + t('web.ticksWaiting')
|
|
39
|
+
return head + ' · ' + t('web.ticksNext', { next: next })
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// The offset between the server's clock and this browser's, from a payload that carries `now`. Every frame the panel
|
|
43
|
+
// receives carries it (added when the frame is written, never part of the comparison), so the correction is refreshed
|
|
44
|
+
// on each one — a tab whose clock drifted mid-session is corrected by the next frame, not only by the next reconnect.
|
|
45
|
+
// Null when the payload has no clock to give.
|
|
46
|
+
function clockOffset(data, localNow) {
|
|
47
|
+
if (!data || typeof data.now !== 'number' || !Number.isFinite(data.now)) return null
|
|
48
|
+
return data.now - localNow
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// The tone the line carries: a paused or failed driver is the reason a flow sits still.
|
|
52
|
+
function tone(tick) {
|
|
53
|
+
if (!tick) return 'attention'
|
|
54
|
+
return tick.active === false ? 'attention' : 'neutral'
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Everything a frame says *except* the driver line. Two frames with the same key differ only in time, which is not an
|
|
58
|
+
// event and must not rebuild the sidebar.
|
|
59
|
+
const STATE_FIELDS = [
|
|
60
|
+
'runs', 'history', 'approvals', 'notifications', 'providers', 'version', 'language', 'web_theme', 'agent_pulse_ms',
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
function frameKey(data) {
|
|
64
|
+
if (!data || typeof data !== 'object') return ''
|
|
65
|
+
const parts = []
|
|
66
|
+
for (const field of STATE_FIELDS) parts.push(field + '=' + JSON.stringify(data[field] === undefined ? null : data[field]))
|
|
67
|
+
return parts.join('\n')
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
global.tickLine = {
|
|
71
|
+
ageSeconds: ageSeconds,
|
|
72
|
+
nextInSeconds: nextInSeconds,
|
|
73
|
+
lineText: lineText,
|
|
74
|
+
tone: tone,
|
|
75
|
+
frameKey: frameKey,
|
|
76
|
+
clockOffset: clockOffset,
|
|
77
|
+
}
|
|
78
|
+
})(typeof window !== 'undefined' ? window : globalThis)
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reevesagents",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Local tmux-first workspace manager for AI CLI agents",
|
|
5
5
|
"mcpName": "io.github.mertkayacs/reevesagents",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"packageManager": "pnpm@10.34.
|
|
7
|
+
"packageManager": "pnpm@10.34.9",
|
|
8
8
|
"bin": {
|
|
9
9
|
"reevesagents": "dist/cli.js"
|
|
10
10
|
},
|
|
@@ -50,13 +50,14 @@
|
|
|
50
50
|
},
|
|
51
51
|
"pnpm": {
|
|
52
52
|
"overrides": {
|
|
53
|
-
"@hono/node-server": "2.1.
|
|
54
|
-
"body-parser": "2.
|
|
53
|
+
"@hono/node-server": "2.1.6",
|
|
54
|
+
"body-parser": "2.4.0",
|
|
55
55
|
"brace-expansion": "5.0.12",
|
|
56
56
|
"esbuild": "0.28.2",
|
|
57
57
|
"fast-uri": "3.1.9",
|
|
58
|
-
"hono": "4.13.
|
|
59
|
-
"ip-address": "10.7.
|
|
58
|
+
"hono": "4.13.17",
|
|
59
|
+
"ip-address": "10.7.6",
|
|
60
|
+
"minimatch": "11.0.5",
|
|
60
61
|
"qs": "6.16.1",
|
|
61
62
|
"source-map-js": "1.2.2"
|
|
62
63
|
}
|
|
@@ -66,14 +67,15 @@
|
|
|
66
67
|
"@types/node": "25.9.9",
|
|
67
68
|
"@types/react": "19.3.0",
|
|
68
69
|
"@types/ws": "8.18.2",
|
|
69
|
-
"@typescript-eslint/parser": "8.72.
|
|
70
|
+
"@typescript-eslint/parser": "8.72.1",
|
|
70
71
|
"@xterm/addon-fit": "0.11.0",
|
|
71
72
|
"@xterm/xterm": "6.0.0",
|
|
72
73
|
"eslint": "10.13.0",
|
|
74
|
+
"happy-dom": "21.0.4",
|
|
73
75
|
"ink-testing-library": "4.0.0",
|
|
74
76
|
"tsup": "8.5.1",
|
|
75
77
|
"typescript": "6.0.3",
|
|
76
|
-
"vite": "8.3.
|
|
78
|
+
"vite": "8.3.7",
|
|
77
79
|
"vitest": "5.0.5"
|
|
78
80
|
},
|
|
79
81
|
"engines": {
|