ai-agentmanager 1.21.0 → 1.23.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/README.md +84 -2
- package/package.json +1 -1
- package/public/app.js +64 -2
- package/public/designs.js +172 -0
- package/public/index.html +18 -0
- package/public/issues.js +255 -0
- package/public/keys.js +6 -2
- package/public/land.js +2 -0
- package/public/prvoice.js +103 -0
- package/public/reviews.js +318 -0
- package/public/speak.js +7 -2
- package/public/style.css +144 -0
- package/public/value.js +299 -0
- package/src/assistant.js +20 -5
- package/src/cli.js +252 -1
- package/src/designs.js +72 -0
- package/src/issues.js +272 -0
- package/src/jira.js +15 -4
- package/src/manager.js +78 -8
- package/src/notify.js +1 -0
- package/src/reviews.js +359 -0
- package/src/server.js +89 -0
- package/src/value.js +609 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
// Reviews: pull requests you review. Reviewer agents read someone else's change, ask the critical
|
|
2
|
+
// questions and find what blocks approval; you pick what to send and post it as a pending review
|
|
3
|
+
// under your name (or copy it). PRs where your review is requested and no reviewer has started
|
|
4
|
+
// come first, with a box to tick.
|
|
5
|
+
|
|
6
|
+
import { listenHtml, speakable } from './speak.js';
|
|
7
|
+
|
|
8
|
+
const VERDICT = { approve: ['Approve', 'ok'], approve_with_nits: ['Approve with nits', 'ok'], blocked: ['Blocked', 'bad'] };
|
|
9
|
+
const CHECKS = { passed: ['✓', 'Checks pass'], failed: ['✗', 'Checks failing'], running: ['●', 'Checks running'] };
|
|
10
|
+
const CATEGORY = { correctness: 'Correctness', security: 'Security', data: 'Data', breaking: 'Breaking change', tests: 'Tests', performance: 'Performance', design: 'Design', other: 'Other' };
|
|
11
|
+
|
|
12
|
+
/** The verdict, blockers and questions as parts to read aloud. */
|
|
13
|
+
export function reviewerSpeech(row) {
|
|
14
|
+
const r = row?.review;
|
|
15
|
+
if (!r) return [];
|
|
16
|
+
const said = (s) => speakable(String(s ?? '')).replace(/\s+/g, ' ').trim();
|
|
17
|
+
const open = r.blockers.filter((b) => b.status === 'open');
|
|
18
|
+
const parts = [said(`Review of pull request ${row.pr.number}${row.pr.title ? `, ${row.pr.title}` : ''}. Verdict: ${VERDICT[r.verdict]?.[0] ?? 'none yet'}. ${r.why}`)];
|
|
19
|
+
if (r.summary) parts.push(said(`What it does: ${r.summary}`));
|
|
20
|
+
if (open.length) parts.push(said(`${open.length} blocker${open.length === 1 ? '' : 's'}.`), ...open.slice(0, 5).map((b, i) => said(`${i + 1}: ${b.title}. ${b.why}`)));
|
|
21
|
+
const resolved = r.blockers.length - open.length;
|
|
22
|
+
if (resolved) parts.push(`${resolved} earlier blocker${resolved === 1 ? ' is' : 's are'} resolved.`);
|
|
23
|
+
if (r.questions.length) parts.push(said(`Questions for the author: ${r.questions.slice(0, 4).map((q) => q.question).join(' ')}`));
|
|
24
|
+
if (row.stale) parts.push('The author pushed since this review; the reviewer is checking again.');
|
|
25
|
+
return parts.filter(Boolean);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function initReviews({ api, $, esc, ago, openAgent, toast }) {
|
|
29
|
+
const dialog = $('#reviews-dialog');
|
|
30
|
+
const body = $('#reviews-body');
|
|
31
|
+
const ext = (label, url, title = '') => `<a href="${esc(url)}" target="_blank" rel="noopener" title="${esc(title)}">${esc(label)} ↗</a>`;
|
|
32
|
+
let rows = null;
|
|
33
|
+
let loading = false;
|
|
34
|
+
let loadedAt = 0;
|
|
35
|
+
let again = null;
|
|
36
|
+
let openId = null;
|
|
37
|
+
// The open review's items picked to send, by agent id.
|
|
38
|
+
const picks = new Map();
|
|
39
|
+
// Requested PRs ticked to start a reviewer, by URL.
|
|
40
|
+
const ticked = new Set();
|
|
41
|
+
let busy = false;
|
|
42
|
+
|
|
43
|
+
async function load({ quiet = false, fresh = false } = {}) {
|
|
44
|
+
if (loading) return;
|
|
45
|
+
loading = true;
|
|
46
|
+
try {
|
|
47
|
+
rows = (await api('GET', `/reviews${fresh ? '?fresh=1' : ''}`)).rows;
|
|
48
|
+
loadedAt = Date.now();
|
|
49
|
+
} catch (e) {
|
|
50
|
+
if (!quiet) toast?.(e.message, 5000);
|
|
51
|
+
} finally {
|
|
52
|
+
loading = false;
|
|
53
|
+
}
|
|
54
|
+
badge();
|
|
55
|
+
render();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** The button's count: requests with no reviewer, blocked reviews, and ones the author pushed to. */
|
|
59
|
+
function badge() {
|
|
60
|
+
const n = rows ? rows.filter((r) => !r.agent || r.stale || r.review?.verdict).filter((r) => !r.posted || r.stale).length : 0;
|
|
61
|
+
const el = $('#reviews-count');
|
|
62
|
+
if (el) {
|
|
63
|
+
el.textContent = n ? String(n) : '';
|
|
64
|
+
el.title = n ? `${n} pull request${n === 1 ? '' : 's'} to look at` : '';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const prLabel = (r) => `${r.pr.repo ? `${esc(r.pr.repo)}` : ''}#${esc(r.pr.number)}`;
|
|
69
|
+
|
|
70
|
+
function verdictHtml(r) {
|
|
71
|
+
if (!r.agent) return '<span class="verdict new">Requested</span>';
|
|
72
|
+
const v = r.review?.verdict;
|
|
73
|
+
if (!v) return `<span class="verdict wait">${r.agent.busy || r.status === 'reviewing' ? 'Reviewing…' : 'No review yet'}</span>`;
|
|
74
|
+
const n = r.review.openBlockers;
|
|
75
|
+
return `<span class="verdict ${VERDICT[v][1]}">${VERDICT[v][0]}${n ? `: ${n} blocker${n === 1 ? '' : 's'}` : ''}</span>`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function defaults(r) {
|
|
79
|
+
if (!picks.has(r.agent.id)) picks.set(r.agent.id, new Set([...r.review.blockers.filter((b) => b.status === 'open').map((b) => b.id), ...r.review.questions.map((q) => q.id)]));
|
|
80
|
+
return picks.get(r.agent.id);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const where = (x) => (x.file ? `<code class="rv-where">${esc(x.file)}${x.line ? `:${esc(x.line)}` : ''}</code>` : '');
|
|
84
|
+
const box = (id, picked, label) => `<input type="checkbox" data-rv-pick="${esc(id)}" ${picked.has(id) ? 'checked' : ''} aria-label="Send: ${esc(label)}" />`;
|
|
85
|
+
|
|
86
|
+
function detail(r) {
|
|
87
|
+
const rv = r.review;
|
|
88
|
+
if (!rv) return `<p class="hint">The reviewer is reading the change. Its blockers and questions show here when it has written them.</p>`;
|
|
89
|
+
const picked = defaults(r);
|
|
90
|
+
const blockers = rv.blockers.map(
|
|
91
|
+
(b) => `<li class="rv-item ${b.status}">
|
|
92
|
+
${b.status === 'open' ? box(b.id, picked, b.title) : '<span class="rv-done" title="Resolved">✓</span>'}
|
|
93
|
+
<div><strong>${esc(b.title)}</strong> <span class="rv-cat">${esc(CATEGORY[b.category] ?? b.category)}</span> ${where(b)}${b.status === 'resolved' ? ' <span class="hint">resolved</span>' : ''}
|
|
94
|
+
<p>${esc(b.why)}</p>${b.unblock ? `<p class="hint">To resolve: ${esc(b.unblock)}</p>` : ''}</div></li>`,
|
|
95
|
+
);
|
|
96
|
+
const questions = rv.questions.map((q) => `<li class="rv-item">${box(q.id, picked, q.question)}<div>${esc(q.question)} ${where(q)}${q.why ? `<p class="hint">${esc(q.why)}</p>` : ''}</div></li>`);
|
|
97
|
+
const nits = rv.nits.map((n) => `<li class="rv-item">${box(n.id, picked, n.text)}<div>${esc(n.text)} ${where(n)}</div></li>`);
|
|
98
|
+
const plain = (title, xs) => (xs.length ? `<h4>${title}</h4><ul class="rv-plain">${xs.map((x) => `<li>${esc(x)}</li>`).join('')}</ul>` : '');
|
|
99
|
+
const posted = r.posted ? `<p class="hint">Posted ${esc(ago(r.posted.at))} as a pending review: ${ext('finish it on GitHub', r.posted.url)}${r.posted.moved ? ` (${r.posted.moved} line comment(s) went in the body)` : ''}</p>` : '';
|
|
100
|
+
return `
|
|
101
|
+
<p class="rv-why"><strong>${esc(VERDICT[rv.verdict]?.[0] ?? 'No verdict yet')}.</strong> ${esc(rv.why)}</p>
|
|
102
|
+
${rv.summary ? `<p>${esc(rv.summary)}</p>` : ''}
|
|
103
|
+
${r.stale ? '<p class="rv-stale">The author pushed since this review. The reviewer has been told to check again.</p>' : ''}
|
|
104
|
+
${blockers.length ? `<h4>Blockers</h4><ul class="rv-list">${blockers.join('')}</ul>` : '<h4>Blockers</h4><p class="hint">None found.</p>'}
|
|
105
|
+
${questions.length ? `<h4>Questions for the author</h4><ul class="rv-list">${questions.join('')}</ul>` : ''}
|
|
106
|
+
${plain('Risks', rv.risks)}
|
|
107
|
+
${plain('Test gaps', rv.testGaps)}
|
|
108
|
+
${nits.length ? `<h4>Nits</h4><ul class="rv-list">${nits.join('')}</ul>` : ''}
|
|
109
|
+
${rv.tests ? `<h4>Tests</h4><p>${esc(rv.tests)}</p>` : ''}
|
|
110
|
+
${posted}
|
|
111
|
+
<div class="rv-actions">
|
|
112
|
+
<button class="primary small" data-rv="post" ${picked.size && !busy ? '' : 'disabled'} title="Create a pending review on GitHub, under your name, with the ticked items. Nothing is visible to the author until you submit it there.">Post ${picked.size} as pending review</button>
|
|
113
|
+
<button class="small" data-rv="copy" title="Copy the ticked items as Markdown">Copy</button>
|
|
114
|
+
${listenHtml(`reviewer:${r.agent.id}`, { title: 'Read the verdict, blockers and questions aloud', label: 'Explain' })}
|
|
115
|
+
</div>`;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function card(r) {
|
|
119
|
+
const check = r.pr.checks?.state && CHECKS[r.pr.checks.state] ? ` <span class="checks ${esc(r.pr.checks.state)}" title="${CHECKS[r.pr.checks.state][1]}">${CHECKS[r.pr.checks.state][0]}</span>` : '';
|
|
120
|
+
const state = r.pr.state && r.pr.state !== 'OPEN' ? ` <span class="hint">${esc(r.pr.state.toLowerCase())}</span>` : r.pr.isDraft ? ' <span class="hint">draft</span>' : '';
|
|
121
|
+
if (!r.agent) {
|
|
122
|
+
return `<article class="rv-card requested ${ticked.has(r.pr.url) ? 'ticked' : ''}">
|
|
123
|
+
<header>
|
|
124
|
+
<input type="checkbox" data-rv-start="${esc(r.pr.url)}" ${ticked.has(r.pr.url) ? 'checked' : ''} aria-label="Start a reviewer for ${esc(r.pr.title ?? r.pr.url)}" />
|
|
125
|
+
<h3>${ext(`${r.pr.repo ?? ''}#${r.pr.number}`, r.pr.url)} ${esc(r.pr.title ?? '')}</h3>
|
|
126
|
+
${verdictHtml(r)}
|
|
127
|
+
</header>
|
|
128
|
+
<div class="design-meta"><span class="hint">${r.pr.author ? `by ${esc(r.pr.author)} · ` : ''}your review is requested · ${esc(ago(r.updatedAt))}</span></div>
|
|
129
|
+
</article>`;
|
|
130
|
+
}
|
|
131
|
+
const isOpen = openId === r.agent.id;
|
|
132
|
+
const dot = r.agent.busy ? '<span class="dot busy" title="Working"></span>' : r.agent.running ? '<span class="dot idle" title="Session open"></span>' : '';
|
|
133
|
+
return `<article class="rv-card ${esc(r.review?.verdict ?? 'pending')} ${r.stale ? 'stale' : ''}">
|
|
134
|
+
<header data-rv-toggle="${esc(r.agent.id)}" role="button" tabindex="0" aria-expanded="${isOpen}">
|
|
135
|
+
<span class="rv-caret">${isOpen ? '▾' : '▸'}</span>
|
|
136
|
+
<h3>${prLabel(r)} ${esc(r.pr.title ?? '')}${check}${state}</h3>
|
|
137
|
+
${r.stale ? '<span class="verdict wait" title="The author pushed since this review">New commits</span>' : ''}
|
|
138
|
+
${r.posted ? '<span class="hint">posted</span>' : ''}
|
|
139
|
+
${verdictHtml(r)}
|
|
140
|
+
</header>
|
|
141
|
+
<div class="design-meta">
|
|
142
|
+
${ext('Pull request', r.pr.url)}
|
|
143
|
+
<button class="link" data-rv-open="${esc(r.agent.id)}" title="Open the reviewer's session: ask it about the change">${dot}${esc(r.agent.name)}</button>
|
|
144
|
+
${r.review ? `<span class="hint">${r.review.questions.length} question${r.review.questions.length === 1 ? '' : 's'} · ${esc(ago(r.updatedAt))}</span>` : ''}
|
|
145
|
+
</div>
|
|
146
|
+
${isOpen ? `<div class="rv-detail">${detail(r)}</div>` : ''}
|
|
147
|
+
</article>`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function render() {
|
|
151
|
+
if (!dialog.open) return;
|
|
152
|
+
if (!rows) {
|
|
153
|
+
body.innerHTML = '<p class="hint">Loading…</p>';
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const requested = rows.filter((r) => !r.agent);
|
|
157
|
+
const mine = rows.filter((r) => r.agent);
|
|
158
|
+
const focused = document.activeElement?.dataset?.rv === 'url' ? document.activeElement.value : null;
|
|
159
|
+
body.innerHTML = `
|
|
160
|
+
<div class="issues-head">
|
|
161
|
+
<h2>Reviews</h2>
|
|
162
|
+
<form class="rv-new" data-rv-form>
|
|
163
|
+
<input type="url" data-rv="url" placeholder="Pull request link to review" aria-label="Pull request link" required />
|
|
164
|
+
<button class="small primary" type="submit" title="Start a reviewer agent: it reads the change and finds what blocks approval; nothing is posted">Review</button>
|
|
165
|
+
</form>
|
|
166
|
+
<span class="spacer"></span>
|
|
167
|
+
<button class="small" data-rv="refresh" title="Look again now, including GitHub">↻</button>
|
|
168
|
+
<button class="small" data-rv="close" title="Close (Esc)">Close</button>
|
|
169
|
+
</div>
|
|
170
|
+
${requested.length ? `<div class="issues-pickbar"><span>${requested.length} pull request${requested.length === 1 ? '' : 's'} where your review is requested.</span>
|
|
171
|
+
<button class="small primary" data-rv="start" ${ticked.size && !busy ? '' : 'disabled'}>Review ${ticked.size || ''} with agents</button>
|
|
172
|
+
<button class="small" data-rv="dismiss" ${ticked.size && !busy ? '' : 'disabled'} title="Take the ticked ones off this list">Dismiss</button></div>` : ''}
|
|
173
|
+
${rows.length ? `<div class="designs-list">${[...requested, ...mine].map(card).join('')}</div>` : '<p class="hint issues-empty">No reviews yet. Paste a pull request link above, or turn on "GitHub reviews" in Assistant to find the ones where your review is requested.</p>'}`;
|
|
174
|
+
if (focused !== null) {
|
|
175
|
+
const u = body.querySelector('[data-rv="url"]');
|
|
176
|
+
u.value = focused;
|
|
177
|
+
u.focus();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const rowOf = (id) => rows?.find((r) => r.agent?.id === id) ?? null;
|
|
182
|
+
|
|
183
|
+
async function copy(r) {
|
|
184
|
+
const picked = picks.get(r.agent.id) ?? new Set();
|
|
185
|
+
const rv = r.review;
|
|
186
|
+
const lines = [`Review of ${r.pr.url}`, `${VERDICT[rv.verdict]?.[0] ?? ''}: ${rv.why}`];
|
|
187
|
+
for (const b of rv.blockers.filter((x) => picked.has(x.id))) lines.push(`- **Blocker: ${b.title}**${b.file ? ` (\`${b.file}${b.line ? `:${b.line}` : ''}\`)` : ''}: ${b.why}${b.unblock ? ` To resolve: ${b.unblock}` : ''}`);
|
|
188
|
+
for (const q of rv.questions.filter((x) => picked.has(x.id))) lines.push(`- **Question:** ${q.question}${q.file ? ` (\`${q.file}${q.line ? `:${q.line}` : ''}\`)` : ''}`);
|
|
189
|
+
for (const n of rv.nits.filter((x) => picked.has(x.id))) lines.push(`- Nit: ${n.text}${n.file ? ` (\`${n.file}${n.line ? `:${n.line}` : ''}\`)` : ''}`);
|
|
190
|
+
try {
|
|
191
|
+
await navigator.clipboard.writeText(lines.join('\n'));
|
|
192
|
+
toast?.('Copied as Markdown');
|
|
193
|
+
} catch (e) {
|
|
194
|
+
toast?.(`Couldn't copy: ${e.message}`, 5000);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
body.addEventListener('submit', async (e) => {
|
|
199
|
+
if (!e.target.matches('[data-rv-form]')) return;
|
|
200
|
+
e.preventDefault();
|
|
201
|
+
const url = body.querySelector('[data-rv="url"]').value.trim();
|
|
202
|
+
try {
|
|
203
|
+
const a = await api('POST', '/reviews', { url });
|
|
204
|
+
toast?.(`Reviewer ${a.name} started`);
|
|
205
|
+
openId = a.id;
|
|
206
|
+
await load();
|
|
207
|
+
} catch (err) {
|
|
208
|
+
toast?.(err.message, 6000);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
body.addEventListener('change', (e) => {
|
|
213
|
+
const s = e.target.closest('[data-rv-start]');
|
|
214
|
+
if (s) {
|
|
215
|
+
if (s.checked) ticked.add(s.dataset.rvStart);
|
|
216
|
+
else ticked.delete(s.dataset.rvStart);
|
|
217
|
+
return render();
|
|
218
|
+
}
|
|
219
|
+
const p = e.target.closest('[data-rv-pick]');
|
|
220
|
+
if (p && openId) {
|
|
221
|
+
const set = picks.get(openId) ?? new Set();
|
|
222
|
+
if (p.checked) set.add(p.dataset.rvPick);
|
|
223
|
+
else set.delete(p.dataset.rvPick);
|
|
224
|
+
picks.set(openId, set);
|
|
225
|
+
render();
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
const toggle = (id) => {
|
|
230
|
+
openId = openId === id ? null : id;
|
|
231
|
+
render();
|
|
232
|
+
};
|
|
233
|
+
body.addEventListener('keydown', (e) => {
|
|
234
|
+
const t = e.target.closest('[data-rv-toggle]');
|
|
235
|
+
if (t && (e.key === 'Enter' || e.key === ' ')) {
|
|
236
|
+
e.preventDefault();
|
|
237
|
+
toggle(t.dataset.rvToggle);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
body.addEventListener('click', async (e) => {
|
|
242
|
+
const o = e.target.closest('[data-rv-open]');
|
|
243
|
+
if (o) {
|
|
244
|
+
dialog.close();
|
|
245
|
+
return openAgent(o.dataset.rvOpen);
|
|
246
|
+
}
|
|
247
|
+
// Links, boxes and Listen do their own thing.
|
|
248
|
+
if (e.target.closest('a, input, [data-say]')) return;
|
|
249
|
+
const t = e.target.closest('[data-rv-toggle]');
|
|
250
|
+
if (t) return toggle(t.dataset.rvToggle);
|
|
251
|
+
const b = e.target.closest('[data-rv]')?.dataset.rv;
|
|
252
|
+
if (b === 'close') return dialog.close();
|
|
253
|
+
if (b === 'refresh') return load({ fresh: true });
|
|
254
|
+
if (b === 'start' || b === 'dismiss') {
|
|
255
|
+
busy = true;
|
|
256
|
+
render();
|
|
257
|
+
const urls = [...ticked];
|
|
258
|
+
try {
|
|
259
|
+
if (b === 'dismiss') {
|
|
260
|
+
await api('POST', '/reviews/dismiss', { urls });
|
|
261
|
+
} else {
|
|
262
|
+
const failed = [];
|
|
263
|
+
for (const url of urls) {
|
|
264
|
+
try {
|
|
265
|
+
await api('POST', '/reviews', { url });
|
|
266
|
+
} catch (err) {
|
|
267
|
+
failed.push(err.message);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
toast?.(failed.length ? `Started ${urls.length - failed.length}; ${failed.join('; ')}` : `Started ${urls.length} reviewer${urls.length === 1 ? '' : 's'}`, failed.length ? 7000 : 3000);
|
|
271
|
+
}
|
|
272
|
+
ticked.clear();
|
|
273
|
+
} finally {
|
|
274
|
+
busy = false;
|
|
275
|
+
await load();
|
|
276
|
+
}
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
const r = rowOf(openId);
|
|
280
|
+
if (!r?.review) return;
|
|
281
|
+
if (b === 'copy') return copy(r);
|
|
282
|
+
if (b === 'post') {
|
|
283
|
+
busy = true;
|
|
284
|
+
render();
|
|
285
|
+
try {
|
|
286
|
+
const res = await api('POST', `/reviews/${r.agent.id}/post`, { ids: [...(picks.get(r.agent.id) ?? [])] });
|
|
287
|
+
toast?.(`Pending review created with ${res.ids.length} item${res.ids.length === 1 ? '' : 's'}: submit it on GitHub`, 6000);
|
|
288
|
+
window.open(res.url, '_blank', 'noopener');
|
|
289
|
+
} catch (err) {
|
|
290
|
+
toast?.(err.message, 7000);
|
|
291
|
+
} finally {
|
|
292
|
+
busy = false;
|
|
293
|
+
await load();
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
function open() {
|
|
299
|
+
if (dialog.open) return dialog.close();
|
|
300
|
+
dialog.showModal();
|
|
301
|
+
render();
|
|
302
|
+
load();
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** An agent changed: look again shortly while open, and now and then for the count. */
|
|
306
|
+
function changed() {
|
|
307
|
+
if (!dialog.open && again) return;
|
|
308
|
+
clearTimeout(again);
|
|
309
|
+
const wait = dialog.open ? 1500 : Math.max(5000, 60_000 - (Date.now() - loadedAt));
|
|
310
|
+
again = setTimeout(() => {
|
|
311
|
+
again = null;
|
|
312
|
+
load({ quiet: true });
|
|
313
|
+
}, wait);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
load({ quiet: true });
|
|
317
|
+
return { open, changed, isOpen: () => dialog.open, speech: (id) => reviewerSpeech(rowOf(id)), show: (id) => ((openId = id), dialog.open ? render() : open()) };
|
|
318
|
+
}
|
package/public/speak.js
CHANGED
|
@@ -146,10 +146,15 @@ const notify = () => listeners.forEach((fn) => fn(now()));
|
|
|
146
146
|
* A Listen control for `id`: 🔊 Listen, or ⏸ / ▶ with ■ and the speed while that id plays.
|
|
147
147
|
* Clicks are handled by `bindListen`; `data-say` names what to read.
|
|
148
148
|
*/
|
|
149
|
-
|
|
149
|
+
const labels = new Map();
|
|
150
|
+
|
|
151
|
+
export function listenHtml(id, { title = 'Read it aloud', label = null } = {}) {
|
|
150
152
|
if (!canSpeak()) return '';
|
|
153
|
+
// Remembered, so a control redrawn as playback changes keeps its words.
|
|
154
|
+
if (label) labels.set(id, { title, label });
|
|
155
|
+
const saved = labels.get(id);
|
|
151
156
|
const cur = now();
|
|
152
|
-
if (cur?.id !== id) return `<span class="say" data-say="${id}"><button type="button" class="small ghost" data-say-act="play" title="${title}">🔊 Listen</button></span>`;
|
|
157
|
+
if (cur?.id !== id) return `<span class="say" data-say="${id}"><button type="button" class="small ghost" data-say-act="play" title="${saved?.title ?? title}">🔊 ${saved?.label ?? 'Listen'}</button></span>`;
|
|
153
158
|
return `<span class="say on" data-say="${id}"><button type="button" class="small" data-say-act="${cur.paused ? 'resume' : 'pause'}" title="${cur.paused ? 'Resume' : 'Pause'}">${cur.paused ? '▶' : '⏸'}</button><button type="button" class="small ghost" data-say-act="stop" title="Stop">■</button><button type="button" class="small ghost" data-say-act="rate" title="Speed">${rateLabel()}</button></span>`;
|
|
154
159
|
}
|
|
155
160
|
|
package/public/style.css
CHANGED
|
@@ -1124,3 +1124,147 @@ body.mapping .layout, body.mapping .watch-view { display: none; }
|
|
|
1124
1124
|
.map-agents { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; }
|
|
1125
1125
|
.map-agent { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; padding: 2px 0; cursor: pointer; font-size: 13px; color: inherit; }
|
|
1126
1126
|
#map-btn.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
|
|
1127
|
+
|
|
1128
|
+
/* ---------- Jira: issues agents work on */
|
|
1129
|
+
.issues-dialog { width: min(1100px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 16px; }
|
|
1130
|
+
/* Only while open: a display on the dialog itself would keep a closed one on screen. */
|
|
1131
|
+
.issues-dialog[open] { display: flex; flex-direction: column; }
|
|
1132
|
+
#issues-body { display: flex; flex-direction: column; min-height: 0; }
|
|
1133
|
+
.issues-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
|
|
1134
|
+
.issues-head h2 { margin: 0 6px 0 0; font-size: 18px; }
|
|
1135
|
+
.issues-head .spacer { flex: 1; }
|
|
1136
|
+
.issues-head .chips { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
1137
|
+
.issues-head .chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; }
|
|
1138
|
+
.issues-head .chip.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
|
|
1139
|
+
.issues-head .chip .count { opacity: 0.75; margin-left: 2px; }
|
|
1140
|
+
.issues-scroll { overflow: auto; min-height: 0; border: 1px solid var(--border); border-radius: var(--radius); }
|
|
1141
|
+
table.issues { width: 100%; border-collapse: collapse; font-size: 13px; }
|
|
1142
|
+
table.issues th { position: sticky; top: 0; background: var(--panel-2); text-align: left; font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
|
|
1143
|
+
table.issues td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
|
|
1144
|
+
table.issues tr:last-child td { border-bottom: 0; }
|
|
1145
|
+
table.issues .issue-key { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
|
|
1146
|
+
table.issues .issue-title { max-width: 360px; color: var(--text); }
|
|
1147
|
+
table.issues tr td:first-child { border-left: 3px solid transparent; }
|
|
1148
|
+
table.issues tr.stage-review td:first-child, table.issues tr.stage-approved td:first-child { border-left-color: var(--green); }
|
|
1149
|
+
table.issues tr.stage-needs td:first-child, table.issues tr.stage-blocked td:first-child { border-left-color: var(--red); }
|
|
1150
|
+
table.issues tr.stage-fixing td:first-child, table.issues tr.stage-working td:first-child { border-left-color: var(--yellow); }
|
|
1151
|
+
table.issues tr.stage-needs .issue-note, table.issues tr.stage-blocked .issue-note { color: var(--red); }
|
|
1152
|
+
table.issues tr.stage-review .issue-note, table.issues tr.stage-approved .issue-note { color: var(--green); font-weight: 600; }
|
|
1153
|
+
.jira-status { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; padding: 2px 6px; border-radius: 4px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
|
|
1154
|
+
.jira-status.indeterminate { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
|
|
1155
|
+
.jira-status.done { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
|
|
1156
|
+
table.issues .checks.passed { color: var(--green); }
|
|
1157
|
+
table.issues .checks.failed { color: var(--red); }
|
|
1158
|
+
table.issues .checks.running { color: var(--yellow); }
|
|
1159
|
+
table.issues .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
|
|
1160
|
+
table.issues .dot.busy { background: var(--green); }
|
|
1161
|
+
table.issues .dot.idle { background: var(--muted); }
|
|
1162
|
+
.issues-empty { padding: 24px 4px; }
|
|
1163
|
+
@media (max-width: 640px) {
|
|
1164
|
+
.issues-dialog { width: calc(100% - 32px); padding: 12px; }
|
|
1165
|
+
table.issues .col-active { display: none; }
|
|
1166
|
+
table.issues .issue-title { max-width: 200px; }
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/* ---------- Designs: agents' design docs */
|
|
1170
|
+
.designs-search { width: 180px; }
|
|
1171
|
+
.designs-list { overflow: auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
|
|
1172
|
+
.design-card { border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: var(--radius); padding: 10px 14px; background: var(--panel); }
|
|
1173
|
+
.design-card.stage-review, .design-card.stage-approved { border-left-color: var(--green); }
|
|
1174
|
+
.design-card.stage-needs, .design-card.stage-blocked { border-left-color: var(--red); }
|
|
1175
|
+
.design-card.stage-fixing, .design-card.stage-working { border-left-color: var(--yellow); }
|
|
1176
|
+
.design-card header { display: flex; align-items: baseline; gap: 10px; }
|
|
1177
|
+
.design-card h3 { margin: 0; font-size: 15px; flex: 1; }
|
|
1178
|
+
.design-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; font-size: 13px; }
|
|
1179
|
+
.design-meta .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
|
|
1180
|
+
.design-meta .dot.busy { background: var(--green); }
|
|
1181
|
+
.design-meta .dot.idle { background: var(--muted); }
|
|
1182
|
+
.design-card.stage-review .design-note, .design-card.stage-approved .design-note { color: var(--green); font-weight: 600; }
|
|
1183
|
+
.design-card.stage-needs .design-note, .design-card.stage-blocked .design-note { color: var(--red); }
|
|
1184
|
+
.design-summary { margin: 8px 0 6px; font-size: 14px; line-height: 1.45; }
|
|
1185
|
+
.design-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; }
|
|
1186
|
+
.design-links .sep { color: var(--muted); }
|
|
1187
|
+
@media (max-width: 640px) {
|
|
1188
|
+
.designs-search { width: 100%; order: 10; }
|
|
1189
|
+
}
|
|
1190
|
+
table.issues td.nowrap { white-space: nowrap; }
|
|
1191
|
+
table.issues .steps { font-variant-numeric: tabular-nums; color: var(--muted); }
|
|
1192
|
+
table.issues .plan-review { color: var(--red); }
|
|
1193
|
+
table.issues .plan-approved { color: var(--green); }
|
|
1194
|
+
.issues-pickbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
|
|
1195
|
+
table.issues th.pick, table.issues td.pick { width: 28px; padding-right: 0; }
|
|
1196
|
+
table.issues tr.stage-proposed td:first-child { border-left-color: var(--accent); }
|
|
1197
|
+
table.issues tr.stage-proposed.ticked { background: color-mix(in srgb, var(--accent) 8%, transparent); }
|
|
1198
|
+
table.issues tr.stage-proposed .issue-note { color: var(--accent); }
|
|
1199
|
+
|
|
1200
|
+
/* ---------- Value */
|
|
1201
|
+
.value-dialog { width: min(1180px, calc(100% - 32px)); }
|
|
1202
|
+
.value-dialog[open] { overflow: auto; }
|
|
1203
|
+
.value-period { margin: 0 0 8px; }
|
|
1204
|
+
.value-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
|
|
1205
|
+
.value-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--panel); }
|
|
1206
|
+
.value-big { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0; }
|
|
1207
|
+
.value-delta { font-size: 12px; margin-top: 2px; }
|
|
1208
|
+
.value-delta.up { color: var(--green); }
|
|
1209
|
+
.value-delta.down { color: var(--red); }
|
|
1210
|
+
.value-bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 6px 2px 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
|
|
1211
|
+
.value-bar { flex: 1 0 28px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; color: var(--muted); }
|
|
1212
|
+
.value-bar .stack { display: flex; flex-direction: column-reverse; justify-content: flex-start; width: 70%; height: calc(100% - 18px); }
|
|
1213
|
+
.value-bar .val { background: var(--accent); border-radius: 3px 3px 0 0; min-height: 1px; }
|
|
1214
|
+
.value-bar .rev { background: color-mix(in srgb, var(--green) 70%, transparent); }
|
|
1215
|
+
.value-bar .lbl { font-size: 11px; height: 18px; line-height: 18px; white-space: nowrap; }
|
|
1216
|
+
.value-bar.on .lbl { color: var(--text); font-weight: 700; }
|
|
1217
|
+
.value-bar.on .stack { outline: 2px solid var(--text); outline-offset: 1px; }
|
|
1218
|
+
.value-legend { margin: 6px 0 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
|
|
1219
|
+
.value-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
|
|
1220
|
+
.value-legend .sw.val { background: var(--accent); }
|
|
1221
|
+
.value-legend .sw.rev { background: color-mix(in srgb, var(--green) 70%, transparent); }
|
|
1222
|
+
table.value-items td.mine { color: var(--accent); font-weight: 600; }
|
|
1223
|
+
table.value-items tr.excluded td { opacity: 0.5; text-decoration: line-through; }
|
|
1224
|
+
table.value-items tr.excluded td:last-child { text-decoration: none; opacity: 1; }
|
|
1225
|
+
table.value-items tr.value-edit td { background: var(--panel-2); }
|
|
1226
|
+
.value-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
|
|
1227
|
+
.value-fields input::placeholder { color: var(--muted); opacity: 0.8; }
|
|
1228
|
+
.value-settings { margin-top: 14px; }
|
|
1229
|
+
.value-settings summary { cursor: pointer; font-weight: 600; }
|
|
1230
|
+
.value-report-kinds { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
|
|
1231
|
+
.value-report-kinds input[type="time"] { width: auto; }
|
|
1232
|
+
input.inline { width: 64px; display: inline-block; padding: 2px 4px; }
|
|
1233
|
+
|
|
1234
|
+
/* ---------- Reviews: other people's pull requests, reviewed by agents */
|
|
1235
|
+
.rv-new { display: flex; gap: 6px; flex: 1; min-width: 220px; max-width: 460px; }
|
|
1236
|
+
.rv-new input { flex: 1; min-width: 0; }
|
|
1237
|
+
.rv-card { border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: var(--radius); padding: 10px 14px; background: var(--panel); }
|
|
1238
|
+
.rv-card.blocked { border-left-color: var(--red); }
|
|
1239
|
+
.rv-card.approve, .rv-card.approve_with_nits { border-left-color: var(--green); }
|
|
1240
|
+
.rv-card.requested, .rv-card.stale { border-left-color: var(--yellow); }
|
|
1241
|
+
.rv-card.ticked { background: color-mix(in srgb, var(--yellow) 8%, var(--panel)); }
|
|
1242
|
+
.rv-card header { display: flex; align-items: baseline; gap: 10px; }
|
|
1243
|
+
.rv-card header[data-rv-toggle] { cursor: pointer; }
|
|
1244
|
+
.rv-card h3 { margin: 0; font-size: 15px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
1245
|
+
.rv-caret { color: var(--muted); width: 10px; }
|
|
1246
|
+
.verdict { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; white-space: nowrap; border: 1px solid currentColor; }
|
|
1247
|
+
.verdict.ok { color: var(--green); }
|
|
1248
|
+
.verdict.bad { color: var(--red); }
|
|
1249
|
+
.verdict.wait, .verdict.new { color: var(--yellow); }
|
|
1250
|
+
.rv-detail { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; font-size: 14px; line-height: 1.45; }
|
|
1251
|
+
.rv-detail h4 { margin: 12px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
|
|
1252
|
+
.rv-detail p { margin: 4px 0; }
|
|
1253
|
+
.rv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
|
|
1254
|
+
.rv-item { display: flex; gap: 8px; align-items: flex-start; }
|
|
1255
|
+
.rv-item input { margin-top: 4px; }
|
|
1256
|
+
.rv-item.resolved { opacity: .65; }
|
|
1257
|
+
.rv-item.resolved strong { text-decoration: line-through; }
|
|
1258
|
+
.rv-done { color: var(--green); width: 13px; }
|
|
1259
|
+
.rv-cat { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 8px; padding: 0 6px; }
|
|
1260
|
+
.rv-where { font-size: 12px; }
|
|
1261
|
+
.rv-plain { margin: 0; padding-left: 20px; }
|
|
1262
|
+
.rv-stale { color: var(--yellow); font-weight: 600; }
|
|
1263
|
+
.rv-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
|
|
1264
|
+
@media (max-width: 640px) {
|
|
1265
|
+
.rv-new { max-width: none; order: 10; flex-basis: 100%; }
|
|
1266
|
+
.rv-card header { flex-wrap: wrap; }
|
|
1267
|
+
.rv-card.requested header { flex-wrap: nowrap; }
|
|
1268
|
+
}
|
|
1269
|
+
.rv-card input[type="checkbox"] { width: auto; flex: none; margin: 0; }
|
|
1270
|
+
.rv-item input[type="checkbox"] { margin-top: 4px; }
|