ai-agentmanager 1.27.0 → 1.29.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 +12 -0
- package/package.json +1 -1
- package/public/actions.js +63 -6
- package/public/app.js +9 -0
- package/public/bughunt.js +317 -0
- package/public/index.html +4 -0
- package/public/issues.js +34 -5
- package/public/keys.js +5 -2
- package/public/rowkeys.js +2 -1
- package/public/style.css +29 -0
- package/public/today.js +153 -9
- package/src/actions.js +76 -5
- package/src/assistant.js +5 -1
- package/src/bughunt.js +475 -0
- package/src/cli.js +16 -1
- package/src/issues.js +16 -6
- package/src/manager.js +20 -6
- package/src/server.js +42 -3
- package/src/today.js +28 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.29.0 (2026-11-07)
|
|
4
|
+
|
|
5
|
+
- **Questions for you, with answers ready.** The assistant now also finds questions put to you in Slack (and email and meeting notes, with those on), including ones you're only copied or mentioned on, and prepares an answer for each: it reads the thread and checks the code of your projects, Jira and docs. They show in Today (*Asked you* is pressing, *CC'd* can wait) and under Actions → Questions, with the draft to *Copy*, *Edit*, or *Draft again*, and *Thread* to open where it was asked. A question without a draft has *Draft an answer*, which starts a session that researches it. Nothing is ever sent for you. (`agentmgr actions add --question … [--cc]`, `agentmgr actions answer <id> "<text>"`.)
|
|
6
|
+
- **Answer agents right in Today.** An agent's question shows the choices it offered as buttons (or press 1–6) and a box to type an answer; a permission prompt shows its options. No need to open the session.
|
|
7
|
+
- **Finish work with no pull request.** When an agent is done but opened no pull request, Today and the Jira list offer *See changes* (the diff), *Open PR* (commits what's left, pushes and opens one, titled after the issue) and, in Today, *Send back* with a note.
|
|
8
|
+
- **Snooze everywhere.** Actions, Jira issues and questions can be snoozed until tomorrow 9am (*Snooze*, or `z`); they come back by themselves. Snoozed ones are under the new *Snoozed* filters and in Today's *Set aside*, with *Bring back*.
|
|
9
|
+
- Typing in a box in Today, the Jira, Actions or Bugs list is no longer interrupted when the list refreshes.
|
|
10
|
+
|
|
11
|
+
## 1.28.0 (2026-11-07)
|
|
12
|
+
|
|
13
|
+
- **Bug hunts.** *Bugs* (or `b`) runs agents that look for bugs in the background, in a project or one folder of it: in what changed since the last run, or the whole module a part at a time, for any bug or the kinds you pick (races, error handling, leaks, security, data). A hunt runs by hand (*Hunt now*) or every night, one at a time, and stops at its cost limit. The hunter reads the code and runs the tests on its own copy and never commits or pushes. Each bug must come with evidence (a failing test, or the path through the code), and the AI judge checks each one against the code: only those that hold up are listed, worst first, and nothing is reported twice. On each: *Fix* starts an agent with the finding and its test, *File it* opens a filled-in GitHub issue (or copies it as Markdown), *Not a bug* keeps it from coming back, *Snooze* hides it until tomorrow or Monday. Critical and high ones show in Today.
|
|
14
|
+
|
|
3
15
|
## 1.27.0 (2026-11-07)
|
|
4
16
|
|
|
5
17
|
- **Jira on your company's own address.** With your site saved in Settings → Jira, every issue's summary and status are asked of that site, whatever address its link has (links often use the company's own domain, like `jira.company.com`, while the API answers on `company.atlassian.net`). A site that sends the API on to its Atlassian address is followed there (and only there). When Jira says it can't find an issue, the Jira list says so: usually the email in Settings isn't the one you sign in to Jira with.
|
package/package.json
CHANGED
package/public/actions.js
CHANGED
|
@@ -11,7 +11,9 @@ const PROJECT = 'agentmgr.actionsProject';
|
|
|
11
11
|
const FILTERS = [
|
|
12
12
|
['open', 'Open'],
|
|
13
13
|
['assigned', 'Assigned'],
|
|
14
|
+
['questions', 'Questions'],
|
|
14
15
|
['skipped', 'Skipped'],
|
|
16
|
+
['snoozed', 'Snoozed'],
|
|
15
17
|
['done', 'Done'],
|
|
16
18
|
['all', 'All'],
|
|
17
19
|
['removed', 'Removed'],
|
|
@@ -20,12 +22,14 @@ const STATES = [
|
|
|
20
22
|
['open', '—', 'Not decided yet'],
|
|
21
23
|
['assign', 'Assign', 'An agent does it (in the project picked above)'],
|
|
22
24
|
['skip', 'Skip', 'Not now'],
|
|
23
|
-
['
|
|
25
|
+
['snooze', 'Snooze', 'Until tomorrow 9am: then open again'],
|
|
26
|
+
['done', 'Done', 'Handled (or answered)'],
|
|
24
27
|
['remove', 'Remove', 'Not mine, or not needed: off the list (under Removed)'],
|
|
25
28
|
];
|
|
26
29
|
const ICON = { slack: '💬', gemini: '📝', other: '•' };
|
|
27
30
|
|
|
28
31
|
export function initActions({ api, $, esc, ago, toast, openAgent, projects = () => [] }) {
|
|
32
|
+
let editing = null; // the question whose answer is being edited
|
|
29
33
|
const dialog = $('#actions-dialog');
|
|
30
34
|
const body = $('#actions-body');
|
|
31
35
|
let data = null;
|
|
@@ -59,6 +63,13 @@ export function initActions({ api, $, esc, ago, toast, openAgent, projects = ()
|
|
|
59
63
|
if (btn && f) btn.hidden = !f.slack && !f.gemini;
|
|
60
64
|
}
|
|
61
65
|
|
|
66
|
+
/** A question's drafted answer: shown, copied, edited, or asked for. */
|
|
67
|
+
function answerHtml(r) {
|
|
68
|
+
if (editing === r.id) return `<form class="today-draft-edit" data-act-edit="${esc(r.id)}"><textarea rows="4">${esc(r.answer?.text ?? '')}</textarea><div><button class="small primary">Save</button> <button type="button" class="small" data-act-answer="cancel">Cancel</button></div></form>`;
|
|
69
|
+
if (!r.answer) return `<div class="today-draft"><button class="small" data-act-answer="draft" title="A session reads the thread, finds the answer in your code, Jira and docs, and drafts it">Draft an answer</button> <button class="link" data-act-answer="edit">Write one</button></div>`;
|
|
70
|
+
return `<div class="today-draft"><div class="today-draft-text">${esc(r.answer.text)}</div><div class="hint">${r.answer.by === 'you' ? 'Your edit' : 'Drafted by the assistant'}${r.answer.sources ? ` · from ${esc(r.answer.sources)}` : ''} · <button class="link" data-act-answer="copy">Copy</button> · <button class="link" data-act-answer="edit">Edit</button> · <button class="link" data-act-answer="draft">Draft again</button></div></div>`;
|
|
71
|
+
}
|
|
72
|
+
|
|
62
73
|
function row(r) {
|
|
63
74
|
const opts = STATES.map(([v, label, title]) => `<option value="${v}" title="${esc(title)}" ${r.status === v ? 'selected' : ''}>${label}</option>`).join('');
|
|
64
75
|
const where = r.link ? `<a href="${esc(r.link)}" target="_blank" rel="noopener" title="Open where it was asked">${esc(r.sourceLabel)} ↗</a>` : esc(r.sourceLabel);
|
|
@@ -69,7 +80,7 @@ export function initActions({ api, $, esc, ago, toast, openAgent, projects = ()
|
|
|
69
80
|
: `<button class="small" data-act-discuss="${esc(r.id)}" title="Talk it through with Claude: what it asks, and what to do (c)">💬 Discuss</button>`;
|
|
70
81
|
return `<tr data-row-id="${esc(r.id)}" class="action-${esc(r.status)}">
|
|
71
82
|
<td class="issue-action"><select data-act-state="${esc(r.id)}" class="act-${esc(r.status === 'assign' ? 'none' : r.status)}" aria-label="Your decision">${opts}</select></td>
|
|
72
|
-
<td
|
|
83
|
+
<td>${r.kind === 'question' ? `<span class="tag">${r.cc ? "CC'd" : 'Asked you'}</span> ` : ''}<div class="action-text">${esc(r.kind === 'question' ? r.question : r.text)}</div>${r.context ? `<div class="issue-synopsis" title="${esc(r.context)}">${esc(r.context)}</div>` : ''}<div class="hint action-meta">${meta}${r.snoozeUntil ? ` · until ${esc(new Date(r.snoozeUntil).toLocaleString([], { weekday: 'short', hour: 'numeric', minute: '2-digit' }))}` : ''}</div>${r.kind === 'question' ? answerHtml(r) : ''}</td>
|
|
73
84
|
<td class="nowrap">${talk}${agent ? `<div class="hint">Agent: ${agent}</div>` : ''}</td>
|
|
74
85
|
</tr>`;
|
|
75
86
|
}
|
|
@@ -80,7 +91,7 @@ export function initActions({ api, $, esc, ago, toast, openAgent, projects = ()
|
|
|
80
91
|
body.innerHTML = '<p class="hint">Loading…</p>';
|
|
81
92
|
return;
|
|
82
93
|
}
|
|
83
|
-
const inGroup = (r, g) => (g === 'all' ? r.group !== 'removed' : r.group === g);
|
|
94
|
+
const inGroup = (r, g) => (g === 'all' ? r.group !== 'removed' : g === 'questions' ? r.kind === 'question' && r.group === 'open' : r.group === g);
|
|
84
95
|
const count = (g) => data.rows.filter((r) => inGroup(r, g)).length;
|
|
85
96
|
const rows = data.rows.filter((r) => inGroup(r, filter));
|
|
86
97
|
const f = data.features ?? {};
|
|
@@ -95,12 +106,12 @@ export function initActions({ api, $, esc, ago, toast, openAgent, projects = ()
|
|
|
95
106
|
<option value="">pick a project</option>
|
|
96
107
|
${list.map((p) => `<option value="${esc(p.key)}" ${p.key === project ? 'selected' : ''}>${esc(p.name ?? p.key)}</option>`).join('')}
|
|
97
108
|
</select></label>
|
|
98
|
-
${['skipped', 'done', 'removed'].includes(filter) && rows.length ? `<button class="small" data-act="back-all" title="Every one here back to open, undecided">Bring all ${rows.length} back</button>` : ''}
|
|
109
|
+
${['skipped', 'snoozed', 'done', 'removed'].includes(filter) && rows.length ? `<button class="small" data-act="back-all" title="Every one here back to open, undecided">Bring all ${rows.length} back</button>` : ''}
|
|
99
110
|
<button class="small" data-act="refresh" title="Look again (r)">↻</button>
|
|
100
111
|
${expandButton(dialog)}
|
|
101
112
|
<button class="small" data-act="close" title="Close (Esc)">Close</button>
|
|
102
113
|
</div>
|
|
103
|
-
<p class="hint">What's asked of you in ${esc(from || 'Slack and meeting notes')}, found by the assistant on its checks. Decide on the left; <b>Discuss</b> talks one through with Claude. Keys: j/k move, a assign, s skip, d done, x remove, o open again, c discuss, Enter opens the source, f bigger.</p>
|
|
114
|
+
<p class="hint">What's asked of you in ${esc(from || 'Slack and meeting notes')}, found by the assistant on its checks. Decide on the left; <b>Discuss</b> talks one through with Claude. Questions put to you come with a drafted answer to edit, copy and send yourself. Keys: j/k move, a assign, s skip, z snooze, d done, x remove, o open again, c discuss, Enter opens the source, f bigger.</p>
|
|
104
115
|
${rows.length
|
|
105
116
|
? `<div class="issues-scroll"><table class="issues actions-table">
|
|
106
117
|
<thead><tr><th class="issue-action">Decision</th><th>Action</th><th></th></tr></thead>
|
|
@@ -124,7 +135,7 @@ export function initActions({ api, $, esc, ago, toast, openAgent, projects = ()
|
|
|
124
135
|
// What each was before, to take the change back.
|
|
125
136
|
const before = new Map(ids.map((id) => [id, data?.rows.find((x) => x.id === id)?.status ?? 'open']));
|
|
126
137
|
try {
|
|
127
|
-
const r = await api('POST', '/actions/set', { ids, state, project: project || null });
|
|
138
|
+
const r = await api('POST', '/actions/set', { ids, state, project: project || null, ...(state === 'snooze' ? { until: tomorrow9() } : {}) });
|
|
128
139
|
const bad = r.failed.map((x) => x.reason).join('; ');
|
|
129
140
|
const label = STATES.find(([v]) => v === state)?.[1] ?? state;
|
|
130
141
|
const msg = r.started.length ? `Agent ${r.started.map((x) => x.agent.name).join(', ')} started` : bad ? `Not changed: ${bad}` : state === 'open' ? (ids.length > 1 ? `${r.set.length} open again` : 'Open again') : label;
|
|
@@ -139,6 +150,34 @@ export function initActions({ api, $, esc, ago, toast, openAgent, projects = ()
|
|
|
139
150
|
load();
|
|
140
151
|
}
|
|
141
152
|
|
|
153
|
+
/** Tomorrow at 9 in the morning. */
|
|
154
|
+
function tomorrow9() {
|
|
155
|
+
const t = new Date();
|
|
156
|
+
t.setDate(t.getDate() + 1);
|
|
157
|
+
t.setHours(9, 0, 0, 0);
|
|
158
|
+
return t.toISOString();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async function answerAct(id, what) {
|
|
162
|
+
const r = data?.rows.find((x) => x.id === id);
|
|
163
|
+
if (!r) return;
|
|
164
|
+
try {
|
|
165
|
+
if (what === 'edit') return (editing = id), render();
|
|
166
|
+
if (what === 'cancel') return (editing = null), render();
|
|
167
|
+
if (what === 'copy') {
|
|
168
|
+
const ok = await navigator.clipboard?.writeText(r.answer?.text ?? '').then(() => true, () => false);
|
|
169
|
+
return toast?.(ok ? 'Copied: paste it in the thread' : "Couldn't copy: select the text instead", 3000, r.link ? { label: 'Open thread', run: () => window.open(r.link, '_blank', 'noopener') } : undefined);
|
|
170
|
+
}
|
|
171
|
+
if (what === 'draft') {
|
|
172
|
+
const x = await api('POST', `/actions/${id}/draft`, {});
|
|
173
|
+
toast?.(x.existing ? 'A session is drafting it already' : 'Drafting: a session reads the thread and finds the answer', 5000, { label: 'Watch', run: () => (dialog.close(), openAgent(x.agent.id)) });
|
|
174
|
+
}
|
|
175
|
+
} catch (e) {
|
|
176
|
+
toast?.(e.message, 6000);
|
|
177
|
+
}
|
|
178
|
+
load();
|
|
179
|
+
}
|
|
180
|
+
|
|
142
181
|
/** Set each action back to what it was: [[id, status]]. */
|
|
143
182
|
async function undoTo(pairs) {
|
|
144
183
|
for (const state of new Set(pairs.map(([, st]) => st))) {
|
|
@@ -164,6 +203,7 @@ export function initActions({ api, $, esc, ago, toast, openAgent, projects = ()
|
|
|
164
203
|
s: (r) => set([r.dataset.rowId], 'skip'),
|
|
165
204
|
d: (r) => set([r.dataset.rowId], 'done'),
|
|
166
205
|
x: (r) => set([r.dataset.rowId], 'remove'),
|
|
206
|
+
z: (r) => set([r.dataset.rowId], 'snooze'),
|
|
167
207
|
o: (r) => set([r.dataset.rowId], 'open'),
|
|
168
208
|
c: (r) => discuss(r.dataset.rowId),
|
|
169
209
|
Enter: (r) => r.querySelector('.action-meta a')?.click(),
|
|
@@ -185,7 +225,24 @@ export function initActions({ api, $, esc, ago, toast, openAgent, projects = ()
|
|
|
185
225
|
}
|
|
186
226
|
});
|
|
187
227
|
|
|
228
|
+
body.addEventListener('submit', async (e) => {
|
|
229
|
+
const f = e.target.closest('[data-act-edit]');
|
|
230
|
+
if (!f) return;
|
|
231
|
+
e.preventDefault();
|
|
232
|
+
document.activeElement?.blur?.();
|
|
233
|
+
try {
|
|
234
|
+
await api('PUT', `/actions/${f.dataset.actEdit}/answer`, { text: f.querySelector('textarea').value });
|
|
235
|
+
editing = null;
|
|
236
|
+
toast?.('Answer saved', 2000);
|
|
237
|
+
} catch (err) {
|
|
238
|
+
return toast?.(err.message, 6000);
|
|
239
|
+
}
|
|
240
|
+
load();
|
|
241
|
+
});
|
|
242
|
+
|
|
188
243
|
body.addEventListener('click', (e) => {
|
|
244
|
+
const an = e.target.closest('[data-act-answer]');
|
|
245
|
+
if (an) return answerAct(e.target.closest('tr[data-row-id]')?.dataset.rowId, an.dataset.actAnswer);
|
|
189
246
|
const o = e.target.closest('[data-act-open]');
|
|
190
247
|
if (o) {
|
|
191
248
|
dialog.close();
|
package/public/app.js
CHANGED
|
@@ -32,6 +32,7 @@ import { initToday } from '/today.js';
|
|
|
32
32
|
import { reviewSpeech } from '/prvoice.js';
|
|
33
33
|
import { initDesigns } from '/designs.js';
|
|
34
34
|
import { initReviews } from '/reviews.js';
|
|
35
|
+
import { initBugHunt } from '/bughunt.js';
|
|
35
36
|
import { drawDiagram } from '/diagram.js';
|
|
36
37
|
import { initValue } from '/value.js';
|
|
37
38
|
import { initCodeMap } from '/codemap.js';
|
|
@@ -226,6 +227,7 @@ const issuesUi = initIssues({
|
|
|
226
227
|
toast: (m, ms, a) => toast(m, ms, a),
|
|
227
228
|
openAgent: (id) => (showTab('agents'), select(id)),
|
|
228
229
|
openDoc: (id, kind) => (showTab('agents'), select(id), openDoc(id, kind)),
|
|
230
|
+
openChanges: (id) => (showTab('agents'), select(id), reviewUi.open(id)),
|
|
229
231
|
});
|
|
230
232
|
$('#issues-btn').onclick = () => issuesUi.open();
|
|
231
233
|
// Actions: what's asked of you in Slack and meeting notes.
|
|
@@ -263,6 +265,8 @@ const todayUi = initToday({
|
|
|
263
265
|
openActions: () => actionsUi.open(),
|
|
264
266
|
openIssues: () => issuesUi.open(),
|
|
265
267
|
openReviews: () => reviewsUi.open(),
|
|
268
|
+
openBugs: () => bugsUi.open({ show: 'open' }),
|
|
269
|
+
openChanges: (id) => (showTab('agents'), select(id), reviewUi.open(id)),
|
|
266
270
|
});
|
|
267
271
|
$('#today-btn').onclick = () => todayUi.open();
|
|
268
272
|
// Designs: every agent's design doc, the ones waiting for your review first.
|
|
@@ -279,6 +283,9 @@ $('#designs-btn').onclick = () => designsUi.open();
|
|
|
279
283
|
// Reviews: other people's pull requests, reviewed by agents for you.
|
|
280
284
|
const reviewsUi = initReviews({ api, $, esc, ago, toast: (m, ms) => toast(m, ms), openAgent: (id) => (showTab('agents'), select(id)) });
|
|
281
285
|
$('#reviews-btn').onclick = () => reviewsUi.open();
|
|
286
|
+
// Bugs: background bug hunts and what they found.
|
|
287
|
+
const bugsUi = initBugHunt({ api, $, esc, ago, toast: (m, ms, a) => toast(m, ms, a), openAgent: (id) => (showTab('agents'), select(id)) });
|
|
288
|
+
$('#bugs-btn').onclick = () => bugsUi.open();
|
|
282
289
|
// Value: what the delivered work is worth, for you and for management.
|
|
283
290
|
const valueUi = initValue({ api, $, esc, toast: (m, ms) => toast(m, ms), openAgent: (id) => (showTab('agents'), select(id)) });
|
|
284
291
|
$('#value-btn').onclick = () => valueUi.open();
|
|
@@ -330,6 +337,7 @@ function shortcut(act) {
|
|
|
330
337
|
if (act === 'results') return $('#spend-btn').click();
|
|
331
338
|
if (act === 'designs') return designsUi.open();
|
|
332
339
|
if (act === 'reviews') return reviewsUi.open();
|
|
340
|
+
if (act === 'bugs') return bugsUi.open();
|
|
333
341
|
if (act === 'value') return valueUi.open();
|
|
334
342
|
if (act === 'today') return todayUi.open();
|
|
335
343
|
if (act.startsWith('tab:')) return showTab(act.slice(4));
|
|
@@ -4239,6 +4247,7 @@ function handleEvent(msg) {
|
|
|
4239
4247
|
todayUi.changed();
|
|
4240
4248
|
designsUi.changed();
|
|
4241
4249
|
if (msg.agent.reviewing) reviewsUi.changed();
|
|
4250
|
+
if (msg.agent.hunting) bugsUi.changed();
|
|
4242
4251
|
// The detail, terminal and document views show one agent; another agent's update leaves them be.
|
|
4243
4252
|
return invalidate([
|
|
4244
4253
|
'list', 'backlog', 'land', 'inbox', 'race', 'team',
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
// Bugs: what background bug hunts found, checked, worst first; and the hunts themselves (a project
|
|
2
|
+
// or a folder of it, recent changes or the whole module, by hand or every night, with a cost
|
|
3
|
+
// limit per run). Each finding opens to its evidence; Fix starts an agent on it, File it opens a
|
|
4
|
+
// filled-in issue, Not a bug keeps it from coming back, Snooze hides it until later.
|
|
5
|
+
|
|
6
|
+
import { holdWhilePicking, rowKeys } from './rowkeys.js';
|
|
7
|
+
import { expandButton, expandable } from './expand.js';
|
|
8
|
+
|
|
9
|
+
const SAVED = 'agentmgr.bugsFilter';
|
|
10
|
+
const FILTERS = [
|
|
11
|
+
['open', 'Open'],
|
|
12
|
+
['fixing', 'Fixing'],
|
|
13
|
+
['snoozed', 'Snoozed'],
|
|
14
|
+
['filed', 'Filed'],
|
|
15
|
+
['notbug', 'Not a bug'],
|
|
16
|
+
['dropped', 'Not kept'],
|
|
17
|
+
['hunts', 'Hunts'],
|
|
18
|
+
];
|
|
19
|
+
const SEV = { critical: 'Critical', high: 'High', medium: 'Medium', low: 'Low' };
|
|
20
|
+
|
|
21
|
+
/** Tomorrow at 9, or next Monday at 9. */
|
|
22
|
+
function later(which) {
|
|
23
|
+
const d = new Date();
|
|
24
|
+
d.setHours(9, 0, 0, 0);
|
|
25
|
+
d.setDate(d.getDate() + (which === 'week' ? ((8 - d.getDay()) % 7 || 7) : 1));
|
|
26
|
+
return d.toISOString();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function initBugHunt({ api, $, esc, ago, toast, openAgent }) {
|
|
30
|
+
const dialog = $('#bugs-dialog');
|
|
31
|
+
const body = $('#bugs-body');
|
|
32
|
+
let data = null;
|
|
33
|
+
let filter = 'open';
|
|
34
|
+
let opened = null; // the finding shown in full
|
|
35
|
+
let editing = null; // a hunt being added ('new') or edited (its id)
|
|
36
|
+
let sure = null; // a hunt whose Delete was pressed once
|
|
37
|
+
try {
|
|
38
|
+
filter = localStorage.getItem(SAVED) || 'open';
|
|
39
|
+
} catch {}
|
|
40
|
+
let projects = [];
|
|
41
|
+
|
|
42
|
+
async function load() {
|
|
43
|
+
try {
|
|
44
|
+
data = await api('GET', '/hunts');
|
|
45
|
+
} catch (e) {
|
|
46
|
+
toast?.(e.message, 5000);
|
|
47
|
+
}
|
|
48
|
+
badge();
|
|
49
|
+
render();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function badge() {
|
|
53
|
+
const n = data ? data.findings.filter((f) => f.status === 'open').length : 0;
|
|
54
|
+
const el = $('#bugs-count');
|
|
55
|
+
if (el) {
|
|
56
|
+
el.textContent = n ? String(n) : '';
|
|
57
|
+
el.title = n ? `${n} open bug${n === 1 ? '' : 's'} found by hunts` : '';
|
|
58
|
+
}
|
|
59
|
+
const b = $('#bugs-btn');
|
|
60
|
+
if (b) b.classList.toggle('hunting', Boolean(data?.running));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const count = (k) => (k === 'hunts' ? data.hunts.length : data.findings.filter((f) => f.status === k).length);
|
|
64
|
+
const where = (f) => (f.file ? `${f.file}${f.line ? `:${f.line}` : ''}` : '');
|
|
65
|
+
|
|
66
|
+
function findingRow(f) {
|
|
67
|
+
const acts =
|
|
68
|
+
f.status === 'open'
|
|
69
|
+
? `<button class="small primary" data-bug="fix" title="Start an agent on it, with the failing test (a)">Fix</button>
|
|
70
|
+
<button class="small" data-bug="file" title="A filled-in issue to submit (i)">File it</button>
|
|
71
|
+
<button class="small" data-bug="notbug" title="Not a bug: it won't be reported again (x)">Not a bug</button>
|
|
72
|
+
<select class="small" data-bug-snooze title="Hide it until then (s: tomorrow)"><option value="">Snooze…</option><option value="day">Until tomorrow 9am</option><option value="week">Until Monday 9am</option></select>`
|
|
73
|
+
: f.status === 'fixing' && f.fixAgentId
|
|
74
|
+
? `<button class="small" data-bug="open-fix" title="Open the agent fixing it">Open fix</button> <button class="small" data-bug="back" title="Back to open (o)">Bring back</button>`
|
|
75
|
+
: `<button class="small" data-bug="back" title="Back to open (o)">Bring back</button>`;
|
|
76
|
+
const full =
|
|
77
|
+
opened === f.id
|
|
78
|
+
? `<tr class="bug-detail"><td colspan="3">
|
|
79
|
+
<p><b>How it fails.</b> ${esc(f.why)}</p>
|
|
80
|
+
<p><b>Evidence: ${f.evidence.type === 'test' ? 'a failing test' : 'the path through the code'}.</b></p><pre>${esc(f.evidence.detail)}</pre>
|
|
81
|
+
${f.evidence.test ? `<p><b>Test.</b></p><pre>${esc(f.evidence.test)}</pre>` : ''}
|
|
82
|
+
${f.fix ? `<p><b>Suggested fix.</b> ${esc(f.fix)}</p>` : ''}
|
|
83
|
+
<p class="hint">${f.check ? `Second check: ${f.check.real ? 'holds up' : 'does not hold up'} (${Math.round(f.check.confidence * 100)}%). ${esc(f.check.reason ?? '')}` : 'Second check: not asked (the AI judge is off); kept because a test fails.'} Found ${esc(ago(f.at))} by the ${esc(f.hunt ?? '')} hunt${f.foundBy ? ` · <button class="link" data-bug-agent="${esc(f.foundBy)}">its session</button>` : ''}.</p>
|
|
84
|
+
</td></tr>`
|
|
85
|
+
: '';
|
|
86
|
+
return `<tr data-row-id="${esc(f.id)}" class="bug-${esc(f.severity)}">
|
|
87
|
+
<td class="nowrap"><span class="bug-sev ${esc(f.severity)}">${esc(SEV[f.severity] ?? f.severity)}</span></td>
|
|
88
|
+
<td><div class="today-title">${esc(f.title)}</div><div class="hint">${esc(where(f))}${f.evidence?.type === 'test' ? ' · a test fails' : ''}${f.snoozeUntil ? ` · until ${esc(new Date(f.snoozeUntil).toLocaleString())}` : ''}</div></td>
|
|
89
|
+
<td class="nowrap today-acts">${acts}</td>
|
|
90
|
+
</tr>${full}`;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function huntForm(h) {
|
|
94
|
+
const p = h ?? { focus: 'changes', schedule: 'manual', maxUsd: 5, kinds: [], path: '', project: projects[0]?.shortcut ?? '' };
|
|
95
|
+
return `<form class="hunt-form alerts-body" data-hunt-form="${esc(h?.id ?? 'new')}">
|
|
96
|
+
<h3>${h ? `Edit ${esc(h.name)}` : 'New hunt'}</h3>
|
|
97
|
+
<div class="row three">
|
|
98
|
+
<label>Project <select name="project" required>${projects.map((x) => `<option value="${esc(x.shortcut)}" ${x.shortcut === p.project ? 'selected' : ''}>${esc(x.name ?? x.shortcut)}</option>`).join('')}</select></label>
|
|
99
|
+
<label>Folder <span class="hint">(empty: all of it)</span><input name="path" value="${esc(p.path)}" placeholder="pkg/providers" autocomplete="off" /></label>
|
|
100
|
+
<label>Name <span class="hint">(optional)</span><input name="name" value="${esc(h?.name ?? '')}" autocomplete="off" /></label>
|
|
101
|
+
</div>
|
|
102
|
+
<fieldset><legend>Look at</legend>${Object.entries(data.focus).map(([k, label]) => `<label class="check"><input type="radio" name="focus" value="${k}" ${p.focus === k ? 'checked' : ''} /> ${esc(label)}</label>`).join('')}</fieldset>
|
|
103
|
+
<fieldset><legend>For <span class="hint">(none ticked: any kind of bug)</span></legend><div class="hunt-kinds">${Object.entries(data.kinds).map(([k, label]) => `<label class="check"><input type="checkbox" name="kind" value="${k}" ${p.kinds.includes(k) ? 'checked' : ''} /> ${esc(label)}</label>`).join('')}</div></fieldset>
|
|
104
|
+
<div class="row three">
|
|
105
|
+
<label>When <select name="schedule">${Object.entries(data.schedules).map(([k, label]) => `<option value="${k}" ${p.schedule === k ? 'selected' : ''}>${esc(label)}</option>`).join('')}</select></label>
|
|
106
|
+
<label>Cost limit per run ($) <input name="maxUsd" type="number" min="0.5" max="500" step="0.5" value="${esc(p.maxUsd)}" /></label>
|
|
107
|
+
</div>
|
|
108
|
+
<p class="hint">The hunter reads the code and runs the tests on its own copy; it never commits or pushes. One hunt runs at a time, and it stops at the cost limit.</p>
|
|
109
|
+
<div class="dialog-actions"><button type="button" class="ghost" data-bug="cancel-hunt">Cancel</button><button type="submit" class="primary">${h ? 'Save' : 'Add hunt'}</button></div>
|
|
110
|
+
</form>`;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function huntsHtml() {
|
|
114
|
+
if (editing) return huntForm(editing === 'new' ? null : data.hunts.find((h) => h.id === editing));
|
|
115
|
+
const rows = data.hunts
|
|
116
|
+
.map((h) => {
|
|
117
|
+
const last = h.last ? `${h.last.status === 'running' ? 'running now' : `${h.last.kept ?? 0} kept of ${h.last.found ?? 0} new`} · ${ago(h.last.at)}` : 'not run yet';
|
|
118
|
+
return `<tr data-hunt="${esc(h.id)}">
|
|
119
|
+
<td><div class="today-title">${esc(h.name)}</div><div class="hint">${esc(h.focus === 'changes' ? 'recent changes' : `whole module${h.coveredCount ? ` (${h.coveredCount} parts covered)` : ''}`)}${h.kinds.length ? ` · ${esc(h.kinds.join(', '))}` : ''} · ${esc(h.schedule === 'nightly' ? 'nightly' : 'by hand')} · up to $${esc(h.maxUsd)}</div></td>
|
|
120
|
+
<td class="hint">${esc(last)}${h.open ? ` · ${h.open} open` : ''}</td>
|
|
121
|
+
<td class="nowrap today-acts"><button class="small primary" data-bug="run" ${data.running ? 'disabled title="A hunt is running; one at a time"' : 'title="Start a run now"'}>Hunt now</button> <button class="small" data-bug="edit">Edit</button> <button class="small ${sure === h.id ? 'danger' : ''}" data-bug="delete">${sure === h.id ? 'Delete it?' : 'Delete'}</button></td>
|
|
122
|
+
</tr>`;
|
|
123
|
+
})
|
|
124
|
+
.join('');
|
|
125
|
+
return `${rows ? `<div class="issues-scroll"><table class="issues today-table"><tbody>${rows}</tbody></table></div>` : '<p class="hint issues-empty">No hunts yet. A hunt looks for bugs in a project, or one folder of it, in the background: in what changed since its last run, or the whole module a part at a time. Each bug comes with evidence, and a second check keeps only those that hold up.</p>'}
|
|
126
|
+
<p><button class="small primary" data-bug="new-hunt" ${projects.length ? '' : 'disabled title="Add a project first"'}>+ New hunt</button></p>`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function draw() {
|
|
130
|
+
if (!dialog.open) return;
|
|
131
|
+
if (!data) {
|
|
132
|
+
body.innerHTML = '<p class="hint">Loading…</p>';
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const rows = data.findings.filter((f) => f.status === filter);
|
|
136
|
+
const empty = {
|
|
137
|
+
open: data.hunts.length ? 'No open bugs. Hunts add what they find here, worst first.' : 'No bugs yet: set up a hunt under Hunts.',
|
|
138
|
+
dropped: "Findings the second check didn't confirm. They aren't reported again.",
|
|
139
|
+
};
|
|
140
|
+
body.innerHTML = `
|
|
141
|
+
<div class="issues-head">
|
|
142
|
+
<h2>Bugs</h2>
|
|
143
|
+
<div class="chips" role="tablist">${FILTERS.map(([k, label]) => `<button class="chip ${k === filter ? 'active' : ''}" role="tab" aria-selected="${k === filter}" data-bugs-filter="${k}">${label} <span class="count">${count(k)}</span></button>`).join('')}</div>
|
|
144
|
+
<span class="spacer"></span>
|
|
145
|
+
<button class="small" data-bug="refresh" title="Look again (r)">↻</button>
|
|
146
|
+
${expandButton(dialog)}
|
|
147
|
+
<button class="small" data-bug="close" title="Close (Esc)">Close</button>
|
|
148
|
+
</div>
|
|
149
|
+
${data.running ? `<p class="hunt-running">Hunting now: <button class="link" data-bug-agent="${esc(data.running.id)}">${esc(data.running.name)}</button>. Its findings come in when it's done.</p>` : ''}
|
|
150
|
+
${filter === 'hunts'
|
|
151
|
+
? huntsHtml()
|
|
152
|
+
: rows.length
|
|
153
|
+
? `<div class="issues-scroll"><table class="issues today-table"><tbody>${rows.map(findingRow).join('')}</tbody></table></div>`
|
|
154
|
+
: `<p class="hint issues-empty">${esc(empty[filter] ?? 'None here.')}</p>`}
|
|
155
|
+
${filter === 'hunts' ? '' : '<p class="hint">Keys: j/k move (or click a row), Enter shows the evidence, a fix, i file it, x not a bug, s snooze until tomorrow, o bring back, r look again, [ ] filters, f bigger.</p>'}`;
|
|
156
|
+
keys.redraw();
|
|
157
|
+
}
|
|
158
|
+
const render = holdWhilePicking(body, draw);
|
|
159
|
+
expandable(dialog, draw);
|
|
160
|
+
|
|
161
|
+
const finding = (id) => data?.findings.find((f) => f.id === id) ?? null;
|
|
162
|
+
|
|
163
|
+
/** Set findings to a decision; Undo puts each back. */
|
|
164
|
+
async function decide(ids, status, until = null, { undoing = false } = {}) {
|
|
165
|
+
const before = ids.map((id) => [id, finding(id)?.status, finding(id)?.snoozeUntil]);
|
|
166
|
+
try {
|
|
167
|
+
await api('POST', '/findings/set', { ids, status, until });
|
|
168
|
+
const label = { open: 'Back on the list', notbug: 'Not a bug: it won\'t be reported again', snoozed: 'Snoozed', filed: 'Marked filed' }[status];
|
|
169
|
+
const undo = undoing ? null : { label: 'Undo', run: async () => {
|
|
170
|
+
for (const [id, st, u] of before) if (st && st !== 'fixing') await decide([id], st, st === 'snoozed' ? u : null, { undoing: true });
|
|
171
|
+
} };
|
|
172
|
+
toast?.(label, undo ? 6000 : 2500, undo);
|
|
173
|
+
} catch (e) {
|
|
174
|
+
toast?.(e.message, 6000);
|
|
175
|
+
}
|
|
176
|
+
load();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async function act(id, what, extra) {
|
|
180
|
+
const f = finding(id);
|
|
181
|
+
if (!f) return;
|
|
182
|
+
if (what === 'fix') {
|
|
183
|
+
try {
|
|
184
|
+
const r = await api('POST', `/findings/${id}/fix`, {});
|
|
185
|
+
toast?.(r.existing ? `${r.agent.name} is on it already` : `Agent ${r.agent.name} started on it`, 4000, { label: 'Open', run: () => (dialog.close(), openAgent(r.agent.id)) });
|
|
186
|
+
} catch (e) {
|
|
187
|
+
toast?.(e.message, 6000);
|
|
188
|
+
}
|
|
189
|
+
return load();
|
|
190
|
+
}
|
|
191
|
+
if (what === 'file') {
|
|
192
|
+
try {
|
|
193
|
+
const r = await api('GET', `/findings/${id}/issue`);
|
|
194
|
+
if (r.url) window.open(r.url, '_blank', 'noopener');
|
|
195
|
+
else await navigator.clipboard?.writeText(`# ${r.title}\n\n${r.markdown}`).catch(() => {});
|
|
196
|
+
return decide([id], 'filed', null).then(() => toast?.(r.url ? 'GitHub opened with the issue filled in: submit it there' : 'Copied as Markdown, to paste into your tracker', 5000));
|
|
197
|
+
} catch (e) {
|
|
198
|
+
return toast?.(e.message, 6000);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (what === 'notbug') return decide([id], 'notbug');
|
|
202
|
+
if (what === 'snooze') return decide([id], 'snoozed', later(extra || 'day'));
|
|
203
|
+
if (what === 'back') return decide([id], 'open');
|
|
204
|
+
if (what === 'open-fix' && f.fixAgentId) return dialog.close(), openAgent(f.fixAgentId);
|
|
205
|
+
if (what === 'enter') {
|
|
206
|
+
opened = opened === id ? null : id;
|
|
207
|
+
return render();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const keys = rowKeys(dialog, {
|
|
212
|
+
rows: () => [...body.querySelectorAll('tbody tr[data-row-id]')],
|
|
213
|
+
filters: () => [...body.querySelectorAll('[data-bugs-filter]')],
|
|
214
|
+
keys: {
|
|
215
|
+
Enter: (r) => act(r.dataset.rowId, 'enter'),
|
|
216
|
+
a: (r) => act(r.dataset.rowId, 'fix'),
|
|
217
|
+
i: (r) => act(r.dataset.rowId, 'file'),
|
|
218
|
+
x: (r) => act(r.dataset.rowId, 'notbug'),
|
|
219
|
+
s: (r) => act(r.dataset.rowId, 'snooze', 'day'),
|
|
220
|
+
o: (r) => act(r.dataset.rowId, 'back'),
|
|
221
|
+
r: Object.assign(() => load(), { needsRow: false }),
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
async function hunt(id, what) {
|
|
226
|
+
try {
|
|
227
|
+
if (what === 'run') {
|
|
228
|
+
const r = await api('POST', `/hunts/${id}/run`, {});
|
|
229
|
+
toast?.(`${r.agent.name} is hunting. Its findings come in when it's done.`, 5000);
|
|
230
|
+
} else if (what === 'edit') {
|
|
231
|
+
editing = id;
|
|
232
|
+
sure = null;
|
|
233
|
+
return render();
|
|
234
|
+
} else if (what === 'delete') {
|
|
235
|
+
if (sure !== id) {
|
|
236
|
+
sure = id;
|
|
237
|
+
return render();
|
|
238
|
+
}
|
|
239
|
+
sure = null;
|
|
240
|
+
await api('DELETE', `/hunts/${id}`);
|
|
241
|
+
toast?.('Hunt deleted; its findings stay', 3000);
|
|
242
|
+
}
|
|
243
|
+
} catch (e) {
|
|
244
|
+
toast?.(e.message, 6000);
|
|
245
|
+
}
|
|
246
|
+
load();
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
body.addEventListener('change', (e) => {
|
|
250
|
+
const s = e.target.closest('[data-bug-snooze]');
|
|
251
|
+
if (s && s.value) act(e.target.closest('tr[data-row-id]')?.dataset.rowId, 'snooze', s.value);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
body.addEventListener('submit', async (e) => {
|
|
255
|
+
const form = e.target.closest('[data-hunt-form]');
|
|
256
|
+
if (!form) return;
|
|
257
|
+
e.preventDefault();
|
|
258
|
+
document.activeElement?.blur?.();
|
|
259
|
+
const fd = new FormData(form);
|
|
260
|
+
const input = { project: fd.get('project'), path: fd.get('path'), name: fd.get('name'), focus: fd.get('focus'), kinds: fd.getAll('kind'), schedule: fd.get('schedule'), maxUsd: Number(fd.get('maxUsd')) };
|
|
261
|
+
try {
|
|
262
|
+
const id = form.dataset.huntForm;
|
|
263
|
+
await api(id === 'new' ? 'POST' : 'PUT', id === 'new' ? '/hunts' : `/hunts/${id}`, input);
|
|
264
|
+
editing = null;
|
|
265
|
+
toast?.(id === 'new' ? 'Hunt added: press Hunt now to start it' : 'Saved', 3000);
|
|
266
|
+
} catch (err) {
|
|
267
|
+
return toast?.(err.message, 6000);
|
|
268
|
+
}
|
|
269
|
+
load();
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
body.addEventListener('click', (e) => {
|
|
273
|
+
const ag = e.target.closest('[data-bug-agent]');
|
|
274
|
+
if (ag) return dialog.close(), openAgent(ag.dataset.bugAgent);
|
|
275
|
+
const f = e.target.closest('[data-bugs-filter]');
|
|
276
|
+
if (f) {
|
|
277
|
+
filter = f.dataset.bugsFilter;
|
|
278
|
+
editing = null;
|
|
279
|
+
try {
|
|
280
|
+
localStorage.setItem(SAVED, filter);
|
|
281
|
+
} catch {}
|
|
282
|
+
return render();
|
|
283
|
+
}
|
|
284
|
+
const b = e.target.closest('[data-bug]')?.dataset.bug;
|
|
285
|
+
if (!b) {
|
|
286
|
+
// A click on a finding's title shows its evidence.
|
|
287
|
+
const row = e.target.closest('tr[data-row-id]');
|
|
288
|
+
if (row && e.target.closest('.today-title')) act(row.dataset.rowId, 'enter');
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (b === 'close') return dialog.close();
|
|
292
|
+
if (b === 'refresh') return load();
|
|
293
|
+
if (b === 'new-hunt') return (editing = 'new'), render();
|
|
294
|
+
if (b === 'cancel-hunt') return (editing = null), render();
|
|
295
|
+
const huntRow = e.target.closest('tr[data-hunt]');
|
|
296
|
+
if (huntRow) return hunt(huntRow.dataset.hunt, b);
|
|
297
|
+
act(e.target.closest('tr[data-row-id]')?.dataset.rowId, b);
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
async function open({ show } = {}) {
|
|
301
|
+
if (dialog.open && !show) return dialog.close();
|
|
302
|
+
if (show) filter = show;
|
|
303
|
+
if (!dialog.open) dialog.showModal();
|
|
304
|
+
render();
|
|
305
|
+
projects = await api('GET', '/projects').catch(() => []);
|
|
306
|
+
load();
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
let again = null;
|
|
310
|
+
function changed() {
|
|
311
|
+
clearTimeout(again);
|
|
312
|
+
again = setTimeout(load, dialog.open ? 1500 : 20_000);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
load();
|
|
316
|
+
return { open, changed, load, decide, fix: (id) => act(id, 'fix') };
|
|
317
|
+
}
|
package/public/index.html
CHANGED
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
<button id="actions-btn" title="Actions: what's asked of you in Slack and in meeting notes, found by the assistant; decide on each one">Actions <span id="actions-count" class="badge ready"></span></button>
|
|
37
37
|
<button id="issues-btn" title="Jira: every issue an agent works on, with its Jira status, pull request and agent, the ones waiting for your review first">Jira <span id="issues-count" class="badge ready"></span></button>
|
|
38
38
|
<button id="designs-btn" title="Designs: every agent's design doc with its summary and links, the ones waiting for your review first">Designs <span id="designs-count" class="badge ready"></span></button>
|
|
39
|
+
<button id="bugs-btn" title="Bugs: background hunts in a project or folder, and what they found, checked and worst first">Bugs <span id="bugs-count" class="badge"></span></button>
|
|
39
40
|
<button id="reviews-btn" title="Reviews: pull requests you review. Reviewer agents ask the critical questions and find what blocks approval; you post what you pick">Reviews <span id="reviews-count" class="badge ready"></span></button>
|
|
40
41
|
<button id="value-btn" title="Value: what the delivered work is worth, by day, week, month and quarter, against the AI cost and your time; reports for management">Value</button>
|
|
41
42
|
<button id="map-btn" title="The codebase map: where each agent is changing and reading code, and who is about to collide">Map</button>
|
|
@@ -395,6 +396,9 @@
|
|
|
395
396
|
<dialog id="designs-dialog" class="issues-dialog" aria-label="Design docs">
|
|
396
397
|
<div id="designs-body"></div>
|
|
397
398
|
</dialog>
|
|
399
|
+
<dialog id="bugs-dialog" class="issues-dialog" aria-label="Bugs">
|
|
400
|
+
<div id="bugs-body"></div>
|
|
401
|
+
</dialog>
|
|
398
402
|
<dialog id="reviews-dialog" class="issues-dialog" aria-label="Reviews">
|
|
399
403
|
<div id="reviews-body"></div>
|
|
400
404
|
</dialog>
|