ai-agentmanager 1.21.0 → 1.22.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.
@@ -0,0 +1,255 @@
1
+ // Jira: every issue an agent works on in one table, the ones waiting for your review first: the
2
+ // issue and its Jira status, where the work stands, its plan, design doc and pull request, and a
3
+ // link to the agent. Issues proposed for agents (when you pick) come first, with a box to tick:
4
+ // agents start only for the ticked ones.
5
+
6
+ import { listenHtml } from './speak.js';
7
+
8
+ const SAVED = 'agentmgr.issuesFilter';
9
+ const FILTERS = [
10
+ ['new', 'Not started'],
11
+ ['you', 'Waiting for you'],
12
+ ['agent', 'Agents on it'],
13
+ ['done', 'Done'],
14
+ ['all', 'All'],
15
+ ];
16
+ const CHECKS = { passed: ['✓', 'Checks pass'], failed: ['✗', 'Checks failing'], running: ['●', 'Checks running'] };
17
+
18
+ export function initIssues({ api, $, esc, ago, openAgent, openDoc, toast }) {
19
+ const dialog = $('#issues-dialog');
20
+ const ext = (label, url, title = '') => `<a href="${esc(url)}" target="_blank" rel="noopener" title="${esc(title)}">${esc(label)} ↗</a>`;
21
+ const body = $('#issues-body');
22
+ let data = null;
23
+ let loading = false;
24
+ let again = null;
25
+ let filter = 'you';
26
+ // Proposed issues ticked to start, by key.
27
+ const ticked = new Set();
28
+ let starting = false;
29
+ try {
30
+ filter = localStorage.getItem(SAVED) || 'you';
31
+ } catch {}
32
+
33
+ let loadedAt = 0;
34
+
35
+ async function load({ quiet = false } = {}) {
36
+ if (loading) return;
37
+ loading = true;
38
+ try {
39
+ data = await api('GET', '/issues');
40
+ loadedAt = Date.now();
41
+ } catch (e) {
42
+ if (!quiet) toast?.(e.message, 5000);
43
+ } finally {
44
+ loading = false;
45
+ }
46
+ badge();
47
+ render();
48
+ }
49
+
50
+ /** The button's count: issues to start or waiting for your review. */
51
+ function badge() {
52
+ const fresh = data ? data.rows.filter((r) => r.group === 'new').length : 0;
53
+ const n = (data ? data.rows.filter((r) => r.group === 'you').length : 0) + fresh;
54
+ const el = $('#issues-count');
55
+ if (el) {
56
+ el.textContent = n ? String(n) : '';
57
+ el.title = [fresh && `${fresh} not started`, n - fresh && `${n - fresh} waiting for your review`].filter(Boolean).join(', ');
58
+ }
59
+ }
60
+
61
+ function row(r, boxes) {
62
+ const box = !boxes ? '' : r.group === 'new' ? `<td class="pick"><input type="checkbox" data-issue-pick="${esc(r.key)}" ${ticked.has(r.key) ? 'checked' : ''} aria-label="Start an agent for ${esc(r.key)}" /></td>` : '<td></td>';
63
+ const issue = r.url ? `<a href="${esc(r.url)}" target="_blank" rel="noopener" class="issue-key">${esc(r.key)}</a>` : `<span class="issue-key">${esc(r.key)}</span>`;
64
+ const status = r.jira?.status ? `<span class="jira-status ${esc(r.jira.category ?? '')}">${esc(r.jira.status)}</span>` : '<span class="hint">—</span>';
65
+ const check = r.pr?.checks && CHECKS[r.pr.checks] ? ` <span class="checks ${esc(r.pr.checks)}" title="${CHECKS[r.pr.checks][1]}">${CHECKS[r.pr.checks][0]}</span>` : '';
66
+ const pr = r.pr?.url
67
+ ? `<a href="${esc(r.pr.url)}" target="_blank" rel="noopener" title="${esc(r.pr.title ?? '')}">#${esc(r.pr.number ?? '?')}</a>${check}${r.aiReview ? `<div class="hint" title="AI review">AI: ${esc(r.aiReview)}</div>` : ''}<div>${listenHtml(`prvoice:${r.agent.id}`, { title: 'Explain the review aloud: the PR, its checks, the AI review, the riskiest changes and what is left', label: 'Explain' })}</div>`
68
+ : '<span class="hint">—</span>';
69
+ if (!r.agent) {
70
+ const by = r.proposal?.by === 'assistant' ? 'proposed by the assistant' : 'proposed';
71
+ return `<tr class="stage-proposed ${ticked.has(r.key) ? 'ticked' : ''}">${box}
72
+ <td>${issue}${r.title ? `<div class="issue-title">${esc(r.title)}</div>` : ''}</td>
73
+ <td>${status}</td>
74
+ <td class="issue-note">${esc(r.note)}</td>
75
+ <td class="hint">—</td>
76
+ <td class="hint">—</td>
77
+ <td class="hint">—</td>
78
+ <td><span class="hint">${esc(by)}</span>${r.proposal?.project ? `<div class="hint">@${esc(r.proposal.project)}</div>` : ''}</td>
79
+ <td class="hint col-active">${esc(ago(r.updatedAt))}</td>
80
+ </tr>`;
81
+ }
82
+ const dot = r.agent.busy ? '<span class="dot busy" title="Working"></span>' : r.agent.running ? '<span class="dot idle" title="Session open"></span>' : '';
83
+ const agent = `<button class="link" data-issue-open="${esc(r.agent.id)}" title="Open the agent's session">${dot}${esc(r.agent.name)}</button>${r.agent.project ? `<div class="hint">${esc(r.agent.project)}${r.agent.from ? ` · by ${esc(r.agent.from)}` : ''}</div>` : ''}`;
84
+ const read = (kind, label, title) => `<button class="link" data-issue-doc="${esc(kind)}" data-agent="${esc(r.agent.id)}" title="${esc(title)}">${label}</button>`;
85
+ const REVIEW = { writing: 'being written', review: 'waiting for your approval', approved: 'approved', changes: 'changes asked' };
86
+ const p = r.plan;
87
+ const plan = p
88
+ ? `${p.written ? read('plan', 'Read', 'Read the plan here') : '<span class="hint">not yet</span>'}${p.total ? ` <span class="steps" title="Steps done">${p.done}/${p.total}</span>` : ''}${p.review ? `<div class="hint plan-${esc(p.review)}">${esc(REVIEW[p.review] ?? p.review)}</div>` : ''}`
89
+ : '<span class="hint">—</span>';
90
+ const d = r.design;
91
+ const design = d
92
+ ? [d.written ? read('designdoc', 'Read', 'Read the design doc here') : '<span class="hint">not yet</span>', d.page && ext('Page', d.page, 'The design page the agent published'), d.google && ext('Doc', d.google, 'Google Doc')].filter(Boolean).join(' · ')
93
+ : '<span class="hint">—</span>';
94
+ return `<tr class="stage-${esc(r.stage)}">${box}
95
+ <td>${issue}${r.title ? `<div class="issue-title">${esc(r.title)}</div>` : ''}</td>
96
+ <td>${status}</td>
97
+ <td class="issue-note">${esc(r.note)}</td>
98
+ <td class="nowrap">${plan}</td>
99
+ <td class="nowrap">${design}</td>
100
+ <td>${pr}</td>
101
+ <td>${agent}</td>
102
+ <td class="hint col-active">${esc(ago(r.updatedAt))}</td>
103
+ </tr>`;
104
+ }
105
+
106
+ function render() {
107
+ if (!dialog.open) return;
108
+ if (!data) {
109
+ body.innerHTML = '<p class="hint">Loading…</p>';
110
+ return;
111
+ }
112
+ const count = (g) => (g === 'all' ? data.rows.length : data.rows.filter((r) => r.group === g).length);
113
+ const rows = filter === 'all' ? data.rows : data.rows.filter((r) => r.group === filter);
114
+ // Ticks only for issues still on the list.
115
+ const fresh = new Set(data.rows.filter((r) => r.group === 'new').map((r) => r.key));
116
+ for (const k of ticked) if (!fresh.has(k)) ticked.delete(k);
117
+ const shownNew = rows.filter((r) => r.group === 'new');
118
+ const boxes = shownNew.length > 0;
119
+ const allTicked = boxes && shownNew.every((r) => ticked.has(r.key));
120
+ const n = ticked.size;
121
+ const empty = !data.rows.length
122
+ ? 'No agent works on a Jira or Linear issue yet. Start one with the issue link first ("https://…/browse/OPS-7 fix the timeout"), or let the assistant start them for issues assigned to you.'
123
+ : filter === 'you'
124
+ ? 'Nothing is waiting for your review.'
125
+ : filter === 'new'
126
+ ? 'No issues waiting to be started. With "Let me pick" on in Assistant, new Jira and Linear issues assigned to you come here instead of getting agents right away (or: agentmgr issues propose).'
127
+ : 'None here.';
128
+ body.innerHTML = `
129
+ <div class="issues-head">
130
+ <h2>Jira</h2>
131
+ <div class="chips" role="tablist">${FILTERS.map(([k, label]) => `<button class="chip ${k === filter ? 'active' : ''}" role="tab" aria-selected="${k === filter}" data-issues-filter="${k}">${label} <span class="count">${count(k)}</span></button>`).join('')}</div>
132
+ <span class="spacer"></span>
133
+ <button class="small" data-issues="copy" title="Copy this list as a Markdown table, to paste into Slack, Jira or a doc" ${rows.length ? '' : 'disabled'}>Copy</button>
134
+ <button class="small" data-issues="refresh" title="Look again now">↻</button>
135
+ <button class="small" data-issues="close" title="Close (Esc)">Close</button>
136
+ </div>
137
+ ${boxes
138
+ ? `<div class="issues-pickbar">
139
+ <button class="primary small" data-issues="start" ${n && !starting ? '' : 'disabled'} title="Start an agent for each ticked issue">${starting ? 'Starting…' : `Start ${n || ''} agent${n === 1 ? '' : 's'}`.replace(' ', ' ')}</button>
140
+ <button class="small" data-issues="dismiss" ${n && !starting ? '' : 'disabled'} title="Take the ticked issues off the list; they won't be proposed again">Dismiss</button>
141
+ <span class="hint">Tick the issues to start agents for; the rest stay here.</span>
142
+ </div>`
143
+ : ''}
144
+ ${rows.length
145
+ ? `<div class="issues-scroll"><table class="issues">
146
+ <thead><tr>${boxes ? `<th class="pick"><input type="checkbox" data-issue-pick-all ${allTicked ? 'checked' : ''} aria-label="Tick all" title="Tick all" /></th>` : ''}<th>Issue</th><th>Jira status</th><th>Where it stands</th><th>Plan</th><th>Design</th><th>Pull request</th><th>Agent</th><th class="col-active">Active</th></tr></thead>
147
+ <tbody>${rows.map((r) => row(r, boxes)).join('')}</tbody>
148
+ </table></div>`
149
+ : `<p class="hint issues-empty">${esc(empty)}</p>`}
150
+ ${data.jira.signedIn || !data.rows.length ? '' : '<p class="hint">Jira status shows for public issues only until you add your Jira site, email and API token in Settings → Jira.</p>'}`;
151
+ }
152
+
153
+ body.addEventListener('change', (e) => {
154
+ const one = e.target.dataset.issuePick;
155
+ if (one) {
156
+ if (e.target.checked) ticked.add(one);
157
+ else ticked.delete(one);
158
+ return render();
159
+ }
160
+ if (e.target.dataset.issuePickAll !== undefined) {
161
+ const shown = data.rows.filter((r) => r.group === 'new' && (filter === 'all' || filter === 'new'));
162
+ for (const r of shown) e.target.checked ? ticked.add(r.key) : ticked.delete(r.key);
163
+ render();
164
+ }
165
+ });
166
+
167
+ async function startTicked() {
168
+ const keys = [...ticked];
169
+ starting = true;
170
+ render();
171
+ try {
172
+ const r = await api('POST', '/issues/start', { keys });
173
+ for (const x of r.started) ticked.delete(x.key);
174
+ const bad = r.failed.map((x) => `${x.key}: ${x.reason}`).join('; ');
175
+ toast?.(`${r.started.length ? `Started ${r.started.length} agent${r.started.length === 1 ? '' : 's'}: ${r.started.map((x) => x.key).join(', ')}` : 'No agents started'}${bad ? `. Not started: ${bad}` : ''}`, bad ? 8000 : 4000);
176
+ } catch (err) {
177
+ toast?.(err.message, 6000);
178
+ } finally {
179
+ starting = false;
180
+ }
181
+ load();
182
+ }
183
+
184
+ body.addEventListener('click', async (e) => {
185
+ const o = e.target.closest('[data-issue-open]');
186
+ if (o) {
187
+ dialog.close();
188
+ return openAgent(o.dataset.issueOpen);
189
+ }
190
+ const doc = e.target.closest('[data-issue-doc]');
191
+ if (doc) {
192
+ dialog.close();
193
+ return openDoc(doc.dataset.agent, doc.dataset.issueDoc);
194
+ }
195
+ const f = e.target.closest('[data-issues-filter]');
196
+ if (f) {
197
+ filter = f.dataset.issuesFilter;
198
+ try {
199
+ localStorage.setItem(SAVED, filter);
200
+ } catch {}
201
+ return render();
202
+ }
203
+ const b = e.target.closest('[data-issues]')?.dataset.issues;
204
+ if (b === 'close') return dialog.close();
205
+ if (b === 'refresh') return load();
206
+ if (b === 'start') return startTicked();
207
+ if (b === 'dismiss') {
208
+ try {
209
+ const r = await api('POST', '/issues/dismiss', { keys: [...ticked] });
210
+ ticked.clear();
211
+ toast?.(`${r.dismissed} dismissed`);
212
+ } catch (err) {
213
+ toast?.(err.message, 6000);
214
+ }
215
+ return load();
216
+ }
217
+ if (b === 'copy') {
218
+ try {
219
+ const { markdown } = await api('GET', `/issues?group=${encodeURIComponent(filter)}&format=markdown`);
220
+ await navigator.clipboard.writeText(markdown);
221
+ toast?.('Copied as a Markdown table');
222
+ } catch (err) {
223
+ toast?.(`Couldn't copy: ${err.message}`, 5000);
224
+ }
225
+ }
226
+ });
227
+
228
+ function open() {
229
+ if (dialog.open) return dialog.close();
230
+ dialog.showModal();
231
+ render();
232
+ load();
233
+ }
234
+
235
+ /** An agent changed: look again shortly while open, and now and then for the count. */
236
+ function changed() {
237
+ // Closed: one look at most every half minute, however busy the agents are.
238
+ if (!dialog.open && again) return;
239
+ clearTimeout(again);
240
+ const wait = dialog.open ? 1500 : Math.max(5000, 30_000 - (Date.now() - loadedAt));
241
+ again = setTimeout(() => {
242
+ again = null;
243
+ load({ quiet: true });
244
+ }, wait);
245
+ }
246
+
247
+ load({ quiet: true });
248
+ /** What the table knows about an agent's issue: its key and design doc summary. */
249
+ const about = (agentId) => {
250
+ const r = data?.rows.find((x) => x.agent?.id === agentId);
251
+ return r ? { issueKey: r.key, designSummary: r.design?.summary ?? null } : {};
252
+ };
253
+
254
+ return { open, changed, about, isOpen: () => dialog.open };
255
+ }
package/public/keys.js CHANGED
@@ -18,6 +18,9 @@ export const SHORTCUTS = [
18
18
  [['w'], 'Watch: agents side by side', 'watch'],
19
19
  [['p'], 'Play the standup', 'standup'],
20
20
  [['m'], 'Map: where agents are in the code', 'map'],
21
+ [['i'], 'Jira: issues waiting for your review', 'issues'],
22
+ [['d'], 'Designs: agents\' design docs', 'designs'],
23
+ [['v'], 'Value: what the work is worth', 'value'],
21
24
  [['1'], 'Agents tab', 'tab:agents'],
22
25
  [['2'], 'Inbox: what needs you', 'tab:inbox'],
23
26
  [['3'], 'Backlog', 'tab:backlog'],
@@ -36,11 +39,11 @@ export const SHORTCUTS = [
36
39
  // A single key, as an event names it, to its action.
37
40
  export const SINGLE = {
38
41
  j: 'next', k: 'prev', Enter: 'terminal', t: 'terminal',
39
- r: 'changes', s: 'start', X: 'stop', e: 'edit', n: 'new', a: 'ask', '/': 'filter', w: 'watch', p: 'standup', m: 'map', '?': 'help',
42
+ r: 'changes', s: 'start', X: 'stop', e: 'edit', n: 'new', a: 'ask', '/': 'filter', w: 'watch', p: 'standup', m: 'map', i: 'issues', d: 'designs', v: 'value', '?': 'help',
40
43
  1: 'tab:agents', 2: 'tab:inbox', 3: 'tab:backlog', 4: 'tab:land', 5: 'tab:built',
41
44
  };
42
45
  // While Watch is open: only what makes sense there.
43
- const ON_WATCH = new Set(['new', 'ask', 'watch', 'standup', 'map', 'help']);
46
+ const ON_WATCH = new Set(['new', 'ask', 'watch', 'standup', 'map', 'issues', 'designs', 'value', 'help']);
44
47
 
45
48
  /** Typing somewhere: a field, an editor or a terminal (xterm types through a textarea). */
46
49
  const typing = (el) => Boolean(el?.closest?.('input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm, .cm-editor'));
package/public/land.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // Land tab: every agent's open pull request, grouped by what it needs to get merged, with
2
2
  // Review, Update, Ask to fix and Merge. Settings for sending failures back to agents at the bottom.
3
3
 
4
+ import { listenHtml } from './speak.js';
4
5
  const SHORT = { ready: 'ready', fix: 'to fix', behind: 'behind', waiting: 'waiting', draft: 'draft' };
5
6
  const GROUPS = [
6
7
  ['ready', 'Ready to merge'],
@@ -55,6 +56,7 @@ export function initLand({ api, esc, toast, agents, $, scoreBadge = () => '', se
55
56
  <div class="land-chips">${scoreBadge(a.docs?.scorecard, esc)} ${prChips(pr, esc)}</div>
56
57
  <div class="bl-actions">
57
58
  <button class="small" data-land="review" title="Its diff, line comments for the agent, commit and push">Review</button>
59
+ ${listenHtml(`prvoice:${a.id}`, { title: 'Explain the review aloud: the PR, its checks, the AI review, the riskiest changes and what is left', label: 'Explain' })}
58
60
  ${land === 'behind' || pr.mergeable === 'CONFLICTING' ? '<button class="small" data-land="update" title="Merge the base branch in here (when the agent is idle and its work is committed) and push; otherwise, or on conflicts, ask the agent">Update</button>' : ''}
59
61
  ${canFix ? '<button class="small" data-land="fix" title="Send the failures, requested changes or conflicts to the agent">Ask to fix</button>' : ''}
60
62
  ${land === 'ready' ? '<button class="small primary" data-land="merge">Merge</button>' : ''}
@@ -0,0 +1,103 @@
1
+ // Explain the review, by voice: a short spoken briefing on an agent's pull request for the person
2
+ // about to review it. What the work is, the PR and its checks, what the AI review found, the
3
+ // riskiest changes, and what's left before it can merge. Built from what the page already has,
4
+ // so it starts at once; the change-by-change walkthrough in Review goes deeper.
5
+
6
+ import { speakable } from './speak.js';
7
+
8
+ const VERDICT = { complete: 'complete', partial: 'partly done', not_done: 'not done' };
9
+ const list = (xs, n = 3) => {
10
+ const items = xs.filter(Boolean).slice(0, n);
11
+ if (items.length <= 1) return items.join('');
12
+ if (items.length === 2) return items.join(' and ');
13
+ return `${items.slice(0, -1).join('; ')}; and ${items.at(-1)}`;
14
+ };
15
+ /** "a, b and c": for short items inside a sentence. */
16
+ const and = (xs) => (xs.length <= 1 ? xs.join('') : `${xs.slice(0, -1).join(', ')} and ${xs.at(-1)}`);
17
+ const said = (s) => speakable(String(s ?? '')).replace(/\s+/g, ' ').trim();
18
+ // One stop at the end, and none after a question mark.
19
+ const sentence = (s) => {
20
+ const t = said(s);
21
+ return !t ? '' : /[.?!]$/.test(t) ? t : `${t}.`;
22
+ };
23
+
24
+ /** The pull request a review is about: the agent's newest open one, else its newest. */
25
+ export function reviewedPr(a) {
26
+ const prs = (a.prs ?? []).filter((p) => p.source !== 'mentioned' && p.state);
27
+ return prs.filter((p) => p.state === 'OPEN').at(-1) ?? prs.at(-1) ?? null;
28
+ }
29
+
30
+ /** The PR's state in words: "is open, checks pass, no review yet". */
31
+ function prState(p) {
32
+ if (p.state === 'MERGED') return 'is merged';
33
+ if (p.state === 'CLOSED') return 'was closed without merging';
34
+ const out = [p.isDraft ? 'is a draft' : 'is open'];
35
+ const checks = p.checks?.state;
36
+ if (checks === 'passed') out.push('checks pass');
37
+ else if (checks === 'failed') out.push(`checks fail${p.checks.failed?.length ? ` (${and(p.checks.failed.slice(0, 3).map((c) => c.name ?? c))})` : ''}`);
38
+ else if (checks === 'running') out.push('checks are still running');
39
+ if (p.mergeable === 'CONFLICTING' || p.mergeState === 'DIRTY') out.push('it has merge conflicts');
40
+ else if (p.mergeState === 'BEHIND') out.push("it's behind its base branch");
41
+ if (p.review === 'APPROVED') out.push("it's approved");
42
+ else if (p.review === 'CHANGES_REQUESTED') out.push('changes were requested');
43
+ else out.push('no review yet');
44
+ return out.length <= 1 ? out.join('') : `${out.slice(0, -1).join(', ')}, and ${out.at(-1)}`;
45
+ }
46
+
47
+ /** What's left before it can merge, as one sentence. */
48
+ function nextStep(a, p) {
49
+ if (!p) return a.results?.outcome === 'done' ? 'There is no pull request: the agent says it is done, so review its changes in the session.' : 'There is no pull request yet.';
50
+ if (p.state === 'MERGED') return 'Nothing left: it is merged.';
51
+ if (p.state === 'CLOSED') return 'Nothing left on this pull request.';
52
+ if (p.isDraft) return 'It is still a draft: the agent is working on it.';
53
+ if (p.checks?.state === 'failed') return 'Next: the failing checks need fixing; ask the agent to fix them from Land.';
54
+ if (p.mergeable === 'CONFLICTING' || p.mergeState === 'DIRTY') return 'Next: the merge conflicts need resolving; Update in Land, or ask the agent.';
55
+ if (p.review === 'CHANGES_REQUESTED') return a.runtime?.busy ? 'The agent is working on the requested changes.' : 'Changes were requested and the agent is idle: send them to it.';
56
+ if (p.review === 'APPROVED') return 'Next: merge it when you are ready.';
57
+ return 'Next: your review. Open Review to go through each change, then approve or ask for changes.';
58
+ }
59
+
60
+ /**
61
+ * The briefing as parts to speak. `designSummary` is the summary from the agent's design doc, when
62
+ * the page has it; `issueKey` names the issue.
63
+ */
64
+ export function reviewSpeech(a, { designSummary = null, issueKey = null } = {}) {
65
+ if (!a) return [];
66
+ const p = reviewedPr(a);
67
+ const key = issueKey ?? a.synopsis?.key ?? null;
68
+ const what = a.synopsis?.text ?? String(a.intent ?? '').split('\n')[0].replace(/^<?https?:\/\/\S+>?\s*/, '');
69
+ const parts = [];
70
+ parts.push(sentence(`Review of ${key ? `${key}, ` : ''}${what || a.name}`));
71
+ if (p) parts.push(sentence(`Pull request ${p.number ?? ''}${p.title ? `, ${p.title},` : ''} ${prState(p)}`));
72
+ // What it does: the design doc's summary, else the walkthrough's, else the agent's own words.
73
+ const walk = a.docs?.walkthrough?.data;
74
+ // (Only what the agent wrote: the tracked PR is said above.)
75
+ const does = designSummary || walk?.summary || (a.results?.delivered ?? []).filter((d) => d.source === 'agent').slice(0, 2).map((d) => d.text).join('. ');
76
+ if (does) parts.push(sentence(`What it does: ${does}`));
77
+ const r = a.aiReview;
78
+ if (r?.verdict) {
79
+ parts.push(sentence(`The AI review says it is ${VERDICT[r.verdict] ?? r.verdict}. ${r.summary ?? ''}`));
80
+ if (r.met?.length) parts.push(sentence(`Met: ${list(r.met)}`));
81
+ if (r.missing?.length) parts.push(sentence(`Missing: ${list(r.missing)}`));
82
+ if (r.risks?.length) parts.push(sentence(`Risks: ${list(r.risks)}`));
83
+ } else {
84
+ parts.push('There is no AI review yet; Review with AI checks the work against the request.');
85
+ }
86
+ if (walk?.changes?.length) {
87
+ const high = walk.changes.filter((c) => c.risk === 'high');
88
+ const n = walk.changes.length;
89
+ parts.push(
90
+ sentence(
91
+ high.length
92
+ ? `The walkthrough has ${n} change${n === 1 ? '' : 's'}; ${high.length} ${high.length === 1 ? 'is' : 'are'} high risk: ${list(high.map((c) => `${c.title}, in ${String(c.file).split('/').pop()}`))}`
93
+ : `The walkthrough has ${n} change${n === 1 ? '' : 's'}, none high risk`,
94
+ ),
95
+ );
96
+ }
97
+ const blockers = (a.results?.blockers ?? []).filter((b) => b.source === 'agent').map((b) => b.text);
98
+ if (blockers.length) parts.push(sentence(`The agent is blocked: ${list(blockers, 2)}`));
99
+ const open = (a.questions ?? []).filter((q) => !q.answer).map((q) => q.question);
100
+ if (open.length) parts.push(sentence(`It asks you: ${list(open, 2)}`));
101
+ parts.push(nextStep(a, p));
102
+ return parts.filter(Boolean);
103
+ }
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
- export function listenHtml(id, { title = 'Read it aloud' } = {}) {
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,109 @@ 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; }