ai-agentmanager 1.28.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 CHANGED
@@ -1,5 +1,13 @@
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
+
3
11
  ## 1.28.0 (2026-11-07)
4
12
 
5
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-agentmanager",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "description": "Run background coding agents (Claude Code, Codex) per intent, and keep track of them from a web UI, your phone or the CLI",
5
5
  "keywords": [
6
6
  "claude",
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
- ['done', 'Done', 'Handled'],
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><div class="action-text">${esc(r.text)}</div>${r.context ? `<div class="issue-synopsis" title="${esc(r.context)}">${esc(r.context)}</div>` : ''}<div class="hint action-meta">${meta}</div></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
@@ -227,6 +227,7 @@ const issuesUi = initIssues({
227
227
  toast: (m, ms, a) => toast(m, ms, a),
228
228
  openAgent: (id) => (showTab('agents'), select(id)),
229
229
  openDoc: (id, kind) => (showTab('agents'), select(id), openDoc(id, kind)),
230
+ openChanges: (id) => (showTab('agents'), select(id), reviewUi.open(id)),
230
231
  });
231
232
  $('#issues-btn').onclick = () => issuesUi.open();
232
233
  // Actions: what's asked of you in Slack and meeting notes.
@@ -265,6 +266,7 @@ const todayUi = initToday({
265
266
  openIssues: () => issuesUi.open(),
266
267
  openReviews: () => reviewsUi.open(),
267
268
  openBugs: () => bugsUi.open({ show: 'open' }),
269
+ openChanges: (id) => (showTab('agents'), select(id), reviewUi.open(id)),
268
270
  });
269
271
  $('#today-btn').onclick = () => todayUi.open();
270
272
  // Designs: every agent's design doc, the ones waiting for your review first.
package/public/bughunt.js CHANGED
@@ -255,6 +255,7 @@ export function initBugHunt({ api, $, esc, ago, toast, openAgent }) {
255
255
  const form = e.target.closest('[data-hunt-form]');
256
256
  if (!form) return;
257
257
  e.preventDefault();
258
+ document.activeElement?.blur?.();
258
259
  const fd = new FormData(form);
259
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')) };
260
261
  try {
package/public/issues.js CHANGED
@@ -15,18 +15,20 @@ const FILTERS = [
15
15
  ['agent', 'Agents on it'],
16
16
  ['done', 'Done'],
17
17
  ['skipped', 'Skipped'],
18
+ ['snoozed', 'Snoozed'],
18
19
  ['all', 'All'],
19
20
  ['removed', 'Removed'],
20
21
  ];
21
22
  const ACTIONS = [
22
23
  ['assign', 'Assign', 'An agent works on it (assigning one not started yet starts its agent)'],
23
24
  ['skip', 'Skip', 'Not now: under Skipped, and not proposed or started again'],
25
+ ['snooze', 'Snooze', 'Until tomorrow 9am: then back on the list'],
24
26
  ['done', 'Done', 'Handled (by you or elsewhere): under Done'],
25
27
  ['remove', 'Remove', 'Off the list (under Removed, to bring back)'],
26
28
  ];
27
29
  const CHECKS = { passed: ['✓', 'Checks pass'], failed: ['✗', 'Checks failing'], running: ['●', 'Checks running'] };
28
30
 
29
- export function initIssues({ api, $, esc, ago, openAgent, openDoc, toast }) {
31
+ export function initIssues({ api, $, esc, ago, openAgent, openDoc, openChanges, toast }) {
30
32
  const dialog = $('#issues-dialog');
31
33
  const ext = (label, url, title = '') => `<a href="${esc(url)}" target="_blank" rel="noopener" title="${esc(title)}">${esc(label)} ↗</a>`;
32
34
  const body = $('#issues-body');
@@ -118,7 +120,7 @@ export function initIssues({ api, $, esc, ago, openAgent, openDoc, toast }) {
118
120
  return `<tr data-row-id="${esc(r.key)}" class="stage-${esc(r.stage)} action-${esc(r.action)}">${box}${actionCell(r)}
119
121
  <td>${issue}${aboutIssue(r)}</td>
120
122
  <td>${status}</td>
121
- <td class="issue-note">${esc(r.note)}</td>
123
+ <td class="issue-note">${esc(r.note)}${r.snoozeUntil ? `<div class="hint">until ${esc(new Date(r.snoozeUntil).toLocaleString([], { weekday: 'short', hour: 'numeric', minute: '2-digit' }))}</div>` : ''}${r.stage === 'review' && !r.pr ? `<div class="issue-ship"><button class="small" data-issue-ship="changes" data-agent="${esc(r.agent.id)}" title="The diff, to look over first">See changes</button> <button class="small primary" data-issue-ship="pr" data-agent="${esc(r.agent.id)}" title="Commit what is left, push and open the pull request">Open PR</button></div>` : ''}</td>
122
124
  <td class="nowrap">${plan}</td>
123
125
  <td class="nowrap">${design}</td>
124
126
  <td>${pr}</td>
@@ -154,7 +156,7 @@ export function initIssues({ api, $, esc, ago, openAgent, openDoc, toast }) {
154
156
  : filter === 'removed'
155
157
  ? 'Nothing removed. Set an issue back to another action here to bring it back.'
156
158
  : 'None here.';
157
- const backAll = ['skipped', 'done', 'removed'].includes(filter) ? setAsideShown().length : 0;
159
+ const backAll = ['skipped', 'snoozed', 'done', 'removed'].includes(filter) ? setAsideShown().length : 0;
158
160
  body.innerHTML = `
159
161
  <div class="issues-head">
160
162
  <h2>Jira</h2>
@@ -189,7 +191,7 @@ export function initIssues({ api, $, esc, ago, openAgent, openDoc, toast }) {
189
191
 
190
192
  /** The issues shown that you skipped, marked done or removed (not those done in Jira). */
191
193
  function setAsideShown() {
192
- const g = { skipped: 'skip', done: 'done', removed: 'remove' }[filter];
194
+ const g = { skipped: 'skip', snoozed: 'snooze', done: 'done', removed: 'remove' }[filter];
193
195
  return (data?.rows ?? []).filter((r) => r.group === filter && r.action === g).map((r) => r.key);
194
196
  }
195
197
  expandable(dialog, draw);
@@ -199,7 +201,7 @@ export function initIssues({ api, $, esc, ago, openAgent, openDoc, toast }) {
199
201
  // What each was before, to take the change back.
200
202
  const before = new Map(keys.map((k) => [k, data?.rows.find((x) => x.key === k)?.action ?? null]));
201
203
  try {
202
- const r = await api('POST', '/issues/action', { keys, action: action || null });
204
+ const r = await api('POST', '/issues/action', { keys, action: action || null, ...(action === 'snooze' ? { until: tomorrow9() } : {}) });
203
205
  for (const k of r.set) ticked.delete(k);
204
206
  const bad = r.failed.map((x) => `${x.key}: ${x.reason}`).join('; ');
205
207
  const label = ACTIONS.find(([v]) => v === action)?.[1] ?? 'Cleared';
@@ -217,6 +219,30 @@ export function initIssues({ api, $, esc, ago, openAgent, openDoc, toast }) {
217
219
  load();
218
220
  }
219
221
 
222
+ /** Tomorrow at 9 in the morning. */
223
+ function tomorrow9() {
224
+ const t = new Date();
225
+ t.setDate(t.getDate() + 1);
226
+ t.setHours(9, 0, 0, 0);
227
+ return t.toISOString();
228
+ }
229
+
230
+ /** Done with no pull request: look at the changes, or open one. */
231
+ async function ship(agentId, what) {
232
+ if (what === 'changes') {
233
+ dialog.close();
234
+ return openChanges?.(agentId);
235
+ }
236
+ try {
237
+ toast?.('Opening its pull request…', 3000);
238
+ const r = await api('POST', `/agents/${agentId}/ship`, {});
239
+ toast?.(r.url ? 'Pull request opened' : 'Pushed', 6000, r.url ? { label: 'Open it', run: () => window.open(r.url, '_blank', 'noopener') } : undefined);
240
+ } catch (e) {
241
+ toast?.(e.message, 8000);
242
+ }
243
+ load();
244
+ }
245
+
220
246
  /** Set each issue back to what it was: [[key, action]]. */
221
247
  async function undoTo(pairs) {
222
248
  for (const action of new Set(pairs.map(([, a]) => a))) {
@@ -232,6 +258,7 @@ export function initIssues({ api, $, esc, ago, openAgent, openDoc, toast }) {
232
258
  s: (r) => setAction([r.dataset.rowId], 'skip'),
233
259
  d: (r) => setAction([r.dataset.rowId], 'done'),
234
260
  x: (r) => setAction([r.dataset.rowId], 'remove'),
261
+ z: (r) => setAction([r.dataset.rowId], 'snooze'),
235
262
  o: (r) => setAction([r.dataset.rowId], null),
236
263
  Enter: (r) => r.querySelector('a.issue-key')?.click(),
237
264
  r: Object.assign(() => load({ fresh: true }), { needsRow: false }),
@@ -277,6 +304,8 @@ export function initIssues({ api, $, esc, ago, openAgent, openDoc, toast }) {
277
304
  }
278
305
 
279
306
  body.addEventListener('click', async (e) => {
307
+ const sh = e.target.closest('[data-issue-ship]');
308
+ if (sh) return ship(sh.dataset.agent, sh.dataset.issueShip);
280
309
  const o = e.target.closest('[data-issue-open]');
281
310
  if (o) {
282
311
  dialog.close();
package/public/keys.js CHANGED
@@ -41,6 +41,8 @@ export const SHORTCUTS = [
41
41
  [['s'], 'Skip', null],
42
42
  [['d'], 'Done', null],
43
43
  [['x'], 'Remove', null],
44
+ [['z'], 'Snooze until tomorrow 9am', null],
45
+ [['1–6'], "Pick one of an agent's answers (Today)", null],
44
46
  [['o'], 'Undecided again (Actions) or clear (Jira)', null],
45
47
  [['c'], 'Discuss it with Claude (Actions)', null],
46
48
  [['Enter'], 'Open the issue or where it was asked', null],
package/public/rowkeys.js CHANGED
@@ -82,7 +82,8 @@ export function holdWhilePicking(body, render) {
82
82
  let waiting = false;
83
83
  const picking = () => {
84
84
  const f = document.activeElement;
85
- return f?.tagName === 'SELECT' && body.contains(f);
85
+ // A menu open, or a box being typed in: drawing again would close it or lose the place.
86
+ return (f?.tagName === 'SELECT' || f?.tagName === 'TEXTAREA' || (f?.tagName === 'INPUT' && !['checkbox', 'radio', 'button', 'submit'].includes(f.type))) && body.contains(f);
86
87
  };
87
88
  body.addEventListener('focusout', () => {
88
89
  if (!waiting) return;
package/public/style.css CHANGED
@@ -1337,3 +1337,16 @@ tr.bug-detail pre { white-space: pre-wrap; max-height: 280px; overflow: auto; pa
1337
1337
  .today-bug .today-label { color: var(--red); }
1338
1338
  #bugs-dialog td.today-acts { white-space: normal; text-align: right; }
1339
1339
  #bugs-dialog td.today-acts > * { margin: 2px 0; }
1340
+
1341
+ /* Answering from the lists */
1342
+ .today-answer { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
1343
+ .today-reply { display: flex; gap: 6px; flex: 1 1 260px; }
1344
+ .today-reply input { flex: 1; min-width: 0; }
1345
+ .today-draft { margin-top: 6px; }
1346
+ .today-draft-text { white-space: pre-wrap; padding: 6px 10px; border-left: 3px solid var(--accent, currentColor); font-size: 13px; }
1347
+ .today-draft-edit { margin-top: 6px; display: grid; gap: 6px; }
1348
+ .today-draft-edit textarea { width: 100%; font: inherit; font-size: 13px; resize: vertical; }
1349
+ .issue-ship { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
1350
+ .today-ask .today-label { color: var(--accent, currentColor); }
1351
+ table.today-table td.today-acts { white-space: normal; text-align: right; width: 34%; }
1352
+ table.today-table td.today-acts > * { margin: 2px 0; }
package/public/today.js CHANGED
@@ -10,7 +10,7 @@ import { expandButton, expandable } from './expand.js';
10
10
  // Up to this score an item is pressing: it counts on the button.
11
11
  const PRESSING = 32;
12
12
 
13
- export function initToday({ api, $, esc, ago, openAgent, showInbox, openActions, openIssues, openReviews, openBugs, toast }) {
13
+ export function initToday({ api, $, esc, ago, openAgent, showInbox, openActions, openIssues, openReviews, openBugs, openChanges, toast }) {
14
14
  const dialog = $('#today-dialog');
15
15
  const body = $('#today-body');
16
16
  let data = null;
@@ -19,6 +19,9 @@ export function initToday({ api, $, esc, ago, openAgent, showInbox, openActions,
19
19
  let loadedAt = 0;
20
20
  let undo = null; // { label, run }: the last change made here, to take back (u)
21
21
  let asideOpen = false;
22
+ let editing = null; // the question whose draft answer is being edited
23
+ let replying = null; // the item a reply or send-back box is open on
24
+ const drafts = new Map(); // typed text per item, kept across redraws
22
25
 
23
26
  async function load({ quiet = false, fresh = false } = {}) {
24
27
  if (loading) return;
@@ -47,10 +50,14 @@ export function initToday({ api, $, esc, ago, openAgent, showInbox, openActions,
47
50
  const link = (url, label) => (url ? `<a href="${esc(url)}" target="_blank" rel="noopener" class="small-link">${esc(label)} ↗</a>` : '');
48
51
  const btn = (act, label, title, primary = false) => `<button class="small ${primary ? 'primary' : ''}" data-today="${act}" title="${esc(title)}">${esc(label)}</button>`;
49
52
 
53
+ const snoozeBtn = btn('snooze', 'Snooze', 'Until tomorrow 9am (z)');
54
+
50
55
  /** The buttons for an item: the decision it asks for, then where to look. */
51
56
  function buttons(it) {
52
- if (it.kind === 'action') return [btn('done', 'Done', 'Handled: off the list (d)'), btn('skip', 'Skip', 'Not now (s)'), btn('discuss', 'Discuss', 'Talk it through with Claude (c)'), link(it.url, 'Source')].join(' ');
53
- if (it.kind === 'issue-new') return [btn('assign', 'Assign', 'Start an agent on it (a)', true), btn('skip', 'Skip', 'Not now (s)'), link(it.url, 'Jira')].join(' ');
57
+ if (it.kind === 'ask') return [it.draft ? btn('copy', 'Copy answer', 'Copy the drafted answer, to paste in the thread', true) : btn('draft', 'Draft answer', 'A session reads the thread, finds the answer and drafts it for you', true), btn('done', 'Answered', 'You answered it: off the list (d)'), snoozeBtn, link(it.url, 'Thread')].join(' ');
58
+ if (it.kind === 'action') return [btn('done', 'Done', 'Handled: off the list (d)'), btn('skip', 'Skip', 'Not now (s)'), snoozeBtn, btn('discuss', 'Discuss', 'Talk it through with Claude (c)'), link(it.url, 'Source')].join(' ');
59
+ if (it.kind === 'issue-new') return [btn('assign', 'Assign', 'Start an agent on it (a)', true), btn('skip', 'Skip', 'Not now (s)'), snoozeBtn, link(it.url, 'Jira')].join(' ');
60
+ if (it.ship) return [btn('changes', 'See changes', 'The diff, to look over first'), btn('ship', 'Open PR', 'Commit what is left, push and open the pull request', true), btn('send-back', 'Send back', 'Tell the agent what is still missing'), btn('open', 'Open', "Open the agent's session (Enter)"), link(it.url, 'Jira')].join(' ');
54
61
  if (it.kind === 'pr-requested') return [btn('review', 'Review it', 'A reviewer agent reads it and finds what blocks approval (a)', true), link(it.url, 'PR')].join(' ');
55
62
  if (it.kind === 'pr-ready') return [btn('open-reviews', 'Open review', 'Pick what to post (Enter)', true), link(it.url, 'PR')].join(' ');
56
63
  if (it.kind === 'rule') return btn('inbox', 'Inbox', 'Decide in the inbox (Enter)', true);
@@ -58,10 +65,27 @@ export function initToday({ api, $, esc, ago, openAgent, showInbox, openActions,
58
65
  return [it.agentId ? btn('open', 'Open', "Open the agent's session (Enter)", it.score < 20) : '', link(it.url, it.issueKey ? 'Jira' : 'Link')].join(' ');
59
66
  }
60
67
 
68
+ /** Under an item: the agent's choices and a reply box, a drafted answer, or a send-back box. */
69
+ function extra(it) {
70
+ const box = (placeholder, send) => `<form class="today-reply" data-today-form="${esc(it.id)}"><input data-today-text="${esc(it.id)}" placeholder="${esc(placeholder)}" value="${esc(drafts.get(it.id) ?? '')}" autocomplete="off" /><button class="small primary">${esc(send)}</button></form>`;
71
+ if (it.answer) {
72
+ const a = it.answer;
73
+ const choices = a.via === 'key' ? a.choices.map((c, i) => `<button class="small ${i === 0 ? 'primary' : ''}" data-today-pick="${i}" title="Press ${esc(c.key)}">${esc(c.key)}. ${esc(c.label)}</button>`) : a.choices.map((c, i) => `<button class="small" data-today-pick="${i}" title="Answer this (${i + 1})">${esc(c)}</button>`);
74
+ return `<div class="today-answer">${choices.join(' ')}${a.default ? ` <span class="hint">Going ahead with “${esc(String(a.default).replace(/[.!\s]+$/, ''))}” until you answer.</span>` : ''}${a.reply ? box('Or type an answer…', 'Send') : ''}</div>`;
75
+ }
76
+ if (it.kind === 'ask') {
77
+ if (editing === it.id) return `<form class="today-draft-edit" data-today-edit="${esc(it.id)}"><textarea rows="4" data-today-edit-text>${esc(it.draft?.text ?? '')}</textarea><div><button class="small primary">Save</button> <button type="button" class="small" data-today="cancel-edit">Cancel</button></div></form>`;
78
+ if (it.draft) return `<div class="today-draft"><div class="today-draft-text">${esc(it.draft.text)}</div><div class="hint">${it.draft.by === 'you' ? 'Your edit' : 'Drafted by the assistant'}${it.draft.sources ? ` · from ${esc(it.draft.sources)}` : ''} · <button class="link" data-today="edit">Edit</button> · <button class="link" data-today="draft">Draft again</button></div></div>`;
79
+ return '';
80
+ }
81
+ if (it.ship && replying === it.id) return box('What is still missing?', 'Send back');
82
+ return '';
83
+ }
84
+
61
85
  function row(it) {
62
86
  return `<tr data-row-id="${esc(it.id)}" class="today-${esc(it.kind)} ${it.score <= PRESSING ? 'pressing' : ''}">
63
87
  <td class="nowrap"><span class="today-label">${esc(it.label)}</span></td>
64
- <td><div class="today-title">${esc(it.title)}</div><div class="hint today-why">${esc(it.why ?? '')}${it.at ? ` · ${esc(ago(it.at))}` : ''}</div></td>
88
+ <td><div class="today-title">${esc(it.title)}</div><div class="hint today-why">${esc(it.why ?? '')}${it.at ? ` · ${esc(ago(it.at))}` : ''}</div>${extra(it)}</td>
65
89
  <td class="nowrap today-acts">${buttons(it)}</td>
66
90
  </tr>`;
67
91
  }
@@ -89,7 +113,7 @@ export function initToday({ api, $, esc, ago, openAgent, showInbox, openActions,
89
113
  ? `<div class="issues-scroll"><table class="issues today-table"><tbody>${items.map(row).join('')}</tbody></table></div>`
90
114
  : '<p class="hint issues-empty">Nothing needs you right now: no agent is waiting on you, nothing is due, and no review is waiting.</p>'}
91
115
  ${asideHtml()}
92
- <p class="hint">Keys: j/k move (or click a row), Enter opens, a assign or review, d done, s skip, c discuss, u undo, r look again, f bigger.${off.length ? ` Not included (off in Settings → What you use): ${esc(off.join(', '))}.` : ''}${data.errors?.length ? ` Couldn't get: ${esc(data.errors.map((e) => `${e.source === 'jira' ? 'Jira' : e.source} (${e.error})`).join('; '))}.` : ''}</p>`;
116
+ <p class="hint">Keys: j/k move (or click a row), Enter opens, 1–6 pick an answer, a assign or review, d done, s skip, z snooze, c discuss, u undo, r look again, f bigger.${off.length ? ` Not included (off in Settings → What you use): ${esc(off.join(', '))}.` : ''}${data.errors?.length ? ` Couldn't get: ${esc(data.errors.map((e) => `${e.source === 'jira' ? 'Jira' : e.source} (${e.error})`).join('; '))}.` : ''}</p>`;
93
117
  keys.redraw();
94
118
  }
95
119
  const render = holdWhilePicking(body, draw);
@@ -99,7 +123,7 @@ export function initToday({ api, $, esc, ago, openAgent, showInbox, openActions,
99
123
  const aside = data?.aside ?? [];
100
124
  if (!aside.length) return '';
101
125
  const rows = aside
102
- .map((a) => `<tr data-aside-id="${esc(a.id)}"><td class="nowrap"><span class="today-label">${esc(a.label)}</span></td><td><div class="today-title">${esc(a.title)}</div>${a.at ? `<div class="hint">${esc(ago(a.at))}</div>` : ''}</td><td class="nowrap today-acts"><button class="small" data-today-back="${esc(a.id)}" title="Back on the list, undecided">Bring back</button></td></tr>`)
126
+ .map((a) => `<tr data-aside-id="${esc(a.id)}"><td class="nowrap"><span class="today-label">${esc(a.label)}</span></td><td><div class="today-title">${esc(a.title)}</div><div class="hint">${a.until ? `until ${esc(new Date(a.until).toLocaleString([], { weekday: 'short', hour: 'numeric', minute: '2-digit' }))}` : a.at ? esc(ago(a.at)) : ''}</div></td><td class="nowrap today-acts"><button class="small" data-today-back="${esc(a.id)}" title="Back on the list, undecided">Bring back</button></td></tr>`)
103
127
  .join('');
104
128
  return `<details class="today-aside" ${asideOpen ? 'open' : ''}><summary>Set aside: skipped, done or removed (${aside.length})</summary>
105
129
  <div class="today-aside-head"><span class="hint">Brought back, an item is undecided again and shows in Today and its own list.</span><button class="small" data-today-back="all" title="Bring every one back">Bring all ${aside.length} back</button></div>
@@ -117,12 +141,38 @@ export function initToday({ api, $, esc, ago, openAgent, showInbox, openActions,
117
141
  const same = list.filter((a) => a.state === state);
118
142
  const keys = same.filter((a) => a.kind === 'issue').map((a) => a.issueKey);
119
143
  const ids = same.filter((a) => a.kind === 'action').map((a) => a.actionId);
120
- if (keys.length) await api('POST', '/issues/action', { keys, action: state });
121
- if (ids.length) await api('POST', '/actions/set', { ids, state });
144
+ // A snooze goes back to its own time, or tomorrow when that has passed.
145
+ const until = state === 'snooze' ? (same.map((a) => a.until).find((u) => Date.parse(u) > Date.now()) ?? tomorrow9()) : undefined;
146
+ if (keys.length) await api('POST', '/issues/action', { keys, action: state, until });
147
+ if (ids.length) await api('POST', '/actions/set', { ids, state, until });
122
148
  }
123
149
  };
124
150
  }
125
151
 
152
+ /** Tomorrow at 9 in the morning. */
153
+ function tomorrow9() {
154
+ const t = new Date();
155
+ t.setDate(t.getDate() + 1);
156
+ t.setHours(9, 0, 0, 0);
157
+ return t.toISOString();
158
+ }
159
+
160
+ /** Answer an agent's question: a choice (by its index) or typed text. */
161
+ async function answer(it, { pick = null, text = null }) {
162
+ const a = it.answer;
163
+ if (a.via === 'key') {
164
+ const c = a.choices[pick];
165
+ if (!c) return;
166
+ await api('POST', `/agents/${it.agentId}/prompt-key`, { key: c.key });
167
+ return `Pressed ${c.key}. ${c.label}`;
168
+ }
169
+ const t = text ?? a.choices[pick];
170
+ if (!t) return;
171
+ if (a.via === 'waiting') await api('POST', `/agents/${it.agentId}/waiting/answer`, { text: t });
172
+ else await api('POST', `/agents/${it.agentId}/answer`, { question: a.qid, text: t });
173
+ return `Answered: ${t.length > 60 ? `${t.slice(0, 59)}…` : t}`;
174
+ }
175
+
126
176
  /** Remember how to take back a change, and offer it on the toast. */
127
177
  function changedWith(msg, label, run) {
128
178
  undo = { label, run };
@@ -178,7 +228,38 @@ export function initToday({ api, $, esc, ago, openAgent, showInbox, openActions,
178
228
  if (it.url) window.open(it.url, '_blank', 'noopener');
179
229
  return;
180
230
  }
181
- if (it.kind === 'action' && ['done', 'skip'].includes(what)) {
231
+ if (what === 'snooze' && ['action', 'ask', 'issue-new'].includes(it.kind)) {
232
+ const until = tomorrow9();
233
+ if (it.kind === 'issue-new') await api('POST', '/issues/action', { keys: [it.issueKey], action: 'snooze', until });
234
+ else await api('POST', '/actions/set', { ids: [it.actionId], state: 'snooze', until });
235
+ changedWith('Snoozed until tomorrow 9am', 'snoozed', () => (it.kind === 'issue-new' ? api('POST', '/issues/action', { keys: [it.issueKey], action: null }) : api('POST', '/actions/set', { ids: [it.actionId], state: 'open' })));
236
+ } else if (it.kind === 'ask' && what === 'copy' && it.draft) {
237
+ const ok = await navigator.clipboard?.writeText(it.draft.text).then(() => true, () => false);
238
+ return toast?.(ok ? `Copied${it.url ? ': paste it in the thread' : ''}` : "Couldn't copy: select the text instead", 3000, it.url ? { label: 'Open thread', run: () => window.open(it.url, '_blank', 'noopener') } : undefined);
239
+ } else if (it.kind === 'ask' && what === 'draft') {
240
+ const r = await api('POST', `/actions/${it.actionId}/draft`, {});
241
+ toast?.(r.existing ? 'A session is drafting it already' : 'Drafting: a session reads the thread and finds the answer', 5000, { label: 'Watch', run: () => (dialog.close(), openAgent(r.agent.id)) });
242
+ } else if (it.kind === 'ask' && what === 'edit') {
243
+ editing = it.id;
244
+ return render();
245
+ } else if (what === 'cancel-edit') {
246
+ editing = null;
247
+ return render();
248
+ } else if (it.kind === 'ask' && what === 'done') {
249
+ await api('POST', '/actions/set', { ids: [it.actionId], state: 'done' });
250
+ changedWith('Answered: off the list', 'answered', () => api('POST', '/actions/set', { ids: [it.actionId], state: 'open' }));
251
+ } else if (it.ship && what === 'changes') {
252
+ dialog.close();
253
+ return openChanges?.(it.agentId);
254
+ } else if (it.ship && what === 'ship') {
255
+ toast?.('Opening its pull request…', 3000);
256
+ const r = await api('POST', `/agents/${it.agentId}/ship`, {});
257
+ toast?.(r.url ? 'Pull request opened' : 'Pushed', 6000, r.url ? { label: 'Open it', run: () => window.open(r.url, '_blank', 'noopener') } : undefined);
258
+ } else if (it.ship && what === 'send-back') {
259
+ replying = replying === it.id ? null : it.id;
260
+ render();
261
+ return body.querySelector(`[data-today-text="${CSS.escape(it.id)}"]`)?.focus();
262
+ } else if (it.kind === 'action' && ['done', 'skip'].includes(what)) {
182
263
  const r = await api('POST', '/actions/set', { ids: [it.actionId], state: what });
183
264
  if (r.failed.length) toast?.(`Not changed: ${r.failed.map((x) => x.reason).join('; ')}`, 6000);
184
265
  else changedWith(what === 'done' ? 'Done' : 'Skipped', `${what === 'done' ? 'done' : 'skipped'} "${it.title}"`, () => api('POST', '/actions/set', { ids: [it.actionId], state: 'open' }));
@@ -220,9 +301,56 @@ export function initToday({ api, $, esc, ago, openAgent, showInbox, openActions,
220
301
  c: (r) => act(itemOf(r.dataset.rowId), 'discuss'),
221
302
  r: Object.assign(() => load({ fresh: true }), { needsRow: false }),
222
303
  u: Object.assign(() => takeBack(), { needsRow: false }),
304
+ z: (r) => act(itemOf(r.dataset.rowId), 'snooze'),
305
+ ...Object.fromEntries([1, 2, 3, 4, 5, 6].map((n) => [String(n), (r) => pickAt(itemOf(r.dataset.rowId), n - 1)])),
223
306
  },
224
307
  });
225
308
 
309
+ /** A choice by its place: keys 1–6 on the selected row. */
310
+ async function pickAt(it, i) {
311
+ if (!it?.answer) return;
312
+ try {
313
+ const done = await answer(it, { pick: it.answer.via === 'key' ? i : i });
314
+ if (done) toast?.(done, 3000);
315
+ } catch (e) {
316
+ toast?.(e.message, 6000);
317
+ }
318
+ load();
319
+ }
320
+
321
+ body.addEventListener('input', (e) => {
322
+ const id = e.target.dataset?.todayText;
323
+ if (id) drafts.set(id, e.target.value);
324
+ });
325
+ body.addEventListener('submit', async (e) => {
326
+ e.preventDefault();
327
+ // Done typing: the list may be drawn again.
328
+ document.activeElement?.blur?.();
329
+ const f = e.target.closest('[data-today-form]');
330
+ const ed = e.target.closest('[data-today-edit]');
331
+ try {
332
+ if (ed) {
333
+ const it = itemOf(ed.dataset.todayEdit);
334
+ await api('PUT', `/actions/${it.actionId}/answer`, { text: ed.querySelector('[data-today-edit-text]').value });
335
+ editing = null;
336
+ toast?.('Draft saved', 2000);
337
+ } else if (f) {
338
+ const it = itemOf(f.dataset.todayForm);
339
+ const text = f.querySelector('input').value.trim();
340
+ if (!it || !text) return;
341
+ if (it.answer) toast?.(await answer(it, { text }), 3000);
342
+ else if (it.ship) {
343
+ await api('POST', `/agents/${it.agentId}/tell`, { text });
344
+ replying = null;
345
+ toast?.('Sent back to the agent', 3000);
346
+ }
347
+ drafts.delete(it.id);
348
+ }
349
+ } catch (err) {
350
+ return toast?.(err.message, 6000);
351
+ }
352
+ load();
353
+ });
226
354
  body.addEventListener('toggle', (e) => {
227
355
  if (e.target.matches?.('.today-aside')) asideOpen = e.target.open;
228
356
  }, true);
@@ -239,6 +367,8 @@ export function initToday({ api, $, esc, ago, openAgent, showInbox, openActions,
239
367
  }
240
368
  return load();
241
369
  }
370
+ const pick = e.target.closest('[data-today-pick]');
371
+ if (pick) return pickAt(itemOf(e.target.closest('tr[data-row-id]')?.dataset.rowId), Number(pick.dataset.todayPick));
242
372
  const b = e.target.closest('[data-today]')?.dataset.today;
243
373
  if (!b) return;
244
374
  if (b === 'close') return dialog.close();
package/src/actions.js CHANGED
@@ -2,13 +2,15 @@
2
2
  // found by the assistant on its checks and kept in one list, so nothing is missed or has to be
3
3
  // remembered. Each one has your decision on it, as for Jira issues: assign (an agent does it),
4
4
  // skip, done or remove, kept in state.json and changeable any time; Discuss opens a conversation
5
- // about it. Nothing is ever sent to Slack or anywhere else from here.
5
+ // about it. Questions put to you (or that you're CC'd on) come with an answer the assistant drafted
6
+ // from your code, Jira and docs, to edit and send yourself; Snooze hides one until a time. Nothing
7
+ // is ever sent to Slack or anywhere else from here.
6
8
 
7
9
  import crypto from 'node:crypto';
8
10
 
9
11
  export const ACTION_SOURCES = { slack: 'Slack', gemini: 'Meeting notes', other: 'Other' };
10
- export const ACTION_STATES = ['open', 'assign', 'skip', 'done', 'remove'];
11
- const GROUP = { open: 'open', assign: 'assigned', skip: 'skipped', done: 'done', remove: 'removed' };
12
+ export const ACTION_STATES = ['open', 'assign', 'skip', 'snooze', 'done', 'remove'];
13
+ const GROUP = { open: 'open', assign: 'assigned', snooze: 'snoozed', skip: 'skipped', done: 'done', remove: 'removed' };
12
14
  const MAX = 500;
13
15
  const err = (status, message) => Object.assign(new Error(message), { status });
14
16
  const clip = (s, n) => {
@@ -30,6 +32,25 @@ export function actionIntent(a) {
30
32
  .trim();
31
33
  }
32
34
 
35
+ /** What "Draft an answer" starts with: research the question, record a draft, never send it. */
36
+ export function draftPrompt(a, bin = 'agentmgr', projects = []) {
37
+ return [
38
+ `Prepare an answer for me to a question I was ${a.cc ? 'copied on' : 'asked'}. Don't send anything: I'll edit and send it myself.`,
39
+ '',
40
+ `The question: ${a.question || a.text}`,
41
+ a.from ? `Asked by: ${a.from}` : '',
42
+ a.link ? `Where: ${ACTION_SOURCES[a.source] ?? a.source}, ${a.link}` : '',
43
+ a.context ? `Context: ${a.context}` : '',
44
+ '',
45
+ 'Read the thread first (your Slack, Gmail or Google Drive tools) for the whole picture. Then find the answer from the sources: ' +
46
+ `${projects.length ? `the code in my projects (${projects.map((p) => `${p.name} at ${p.dir ?? p.repo}`).join('; ')}), ` : ''}Jira, docs and earlier messages. ` +
47
+ 'Check facts against the code or docs rather than guessing, and say how sure you are. When something can only be answered by someone else, say who and what to ask.',
48
+ `Record the draft, in my voice, short and ready to paste: ${bin} actions answer ${a.id} --sources "<links or files you used>" "<the answer>". Then tell me here what you found and anything I should check before sending.`,
49
+ ]
50
+ .filter((l) => l !== '')
51
+ .join('\n');
52
+ }
53
+
33
54
  /** What Discuss starts with: a conversation to decide what to do about the action. */
34
55
  export function discussPrompt(a, bin = 'agentmgr') {
35
56
  return [
@@ -65,7 +86,7 @@ export class MyActions {
65
86
  }
66
87
 
67
88
  /** Add one (the assistant does, on its checks). The same action from the same place is kept once. */
68
- add({ text, source = 'other', link = null, from = null, when = null, due = null, context = null, by = null } = {}) {
89
+ add({ text, source = 'other', link = null, from = null, when = null, due = null, context = null, by = null, question = null, cc = false, answer = null, sources = null } = {}) {
69
90
  const t = clip(text, 400);
70
91
  if (t.length < 3) throw err(400, 'Say what the action is');
71
92
  if (!ACTION_SOURCES[source]) throw err(400, `The source is one of ${Object.keys(ACTION_SOURCES).join(', ')}`);
@@ -84,6 +105,9 @@ export class MyActions {
84
105
  when: when && !Number.isNaN(Date.parse(when)) ? new Date(when).toISOString() : new Date().toISOString(),
85
106
  due: due ? clip(due, 40) : null,
86
107
  context: context ? clip(context, 1000) : null,
108
+ // A question put to you (cc: you're copied or mentioned, not asked): its words, and a draft answer.
109
+ ...(question || cc ? { kind: 'question', question: question ? clip(question, 1000) : t, cc: Boolean(cc) } : {}),
110
+ ...(answer ? { answer: { text: String(answer).trim().slice(0, 4000), sources: sources ? clip(sources, 600) : null, by: by ?? 'you', at: new Date().toISOString() } } : {}),
87
111
  by: by ?? null,
88
112
  status: 'open',
89
113
  at: new Date().toISOString(),
@@ -101,6 +125,7 @@ export class MyActions {
101
125
  /** The list, open ones first, newest first within: rows with their group and agents. */
102
126
  rows() {
103
127
  const order = Object.fromEntries(Object.values(GROUP).map((g, i) => [g, i]));
128
+ this.wake();
104
129
  return this.all
105
130
  .map((a) => {
106
131
  const agent = a.agentId ? this.manager.store?.get?.(a.agentId) ?? null : null;
@@ -117,6 +142,11 @@ export class MyActions {
117
142
  context: a.context,
118
143
  status: a.status,
119
144
  group: GROUP[a.status] ?? 'open',
145
+ kind: a.kind ?? 'task',
146
+ question: a.question ?? null,
147
+ cc: Boolean(a.cc),
148
+ answer: a.answer ?? null,
149
+ snoozeUntil: a.status === 'snooze' ? a.snoozeUntil ?? null : null,
120
150
  agent: agent ? { id: agent.id, name: agent.name } : null,
121
151
  discussion: talk ? { id: talk.id, name: talk.name } : null,
122
152
  updatedAt: a.updatedAt ?? a.at,
@@ -129,8 +159,10 @@ export class MyActions {
129
159
  * Your decision on actions: open (undecided again), assign (starts an agent; `project` picks
130
160
  * where), skip, done or remove. { set: [ids], started: [{ id, agent }], failed: [{ id, reason }] }.
131
161
  */
132
- set(ids = [], state, { project = null } = {}) {
162
+ set(ids = [], state, { project = null, until = null } = {}) {
133
163
  if (!ACTION_STATES.includes(state)) throw err(400, `The decision is one of ${ACTION_STATES.join(', ')}`);
164
+ const wakeAt = state === 'snooze' ? Date.parse(until ?? '') : null;
165
+ if (state === 'snooze' && !(Number.isFinite(wakeAt) && wakeAt > Date.now())) throw err(400, 'Snooze until a time to come');
134
166
  const set = [];
135
167
  const started = [];
136
168
  const failed = [];
@@ -152,6 +184,7 @@ export class MyActions {
152
184
  }
153
185
  }
154
186
  a.status = state;
187
+ a.snoozeUntil = state === 'snooze' ? new Date(wakeAt).toISOString() : null;
155
188
  a.updatedAt = new Date().toISOString();
156
189
  set.push(id);
157
190
  }
@@ -159,6 +192,44 @@ export class MyActions {
159
192
  return { set, started, failed };
160
193
  }
161
194
 
195
+ /** Snoozed ones whose time has come are open again. */
196
+ wake(t = Date.now()) {
197
+ let n = 0;
198
+ for (const a of this.all) {
199
+ if (a.status === 'snooze' && (!a.snoozeUntil || Date.parse(a.snoozeUntil) <= t)) {
200
+ a.status = 'open';
201
+ a.snoozeUntil = null;
202
+ n += 1;
203
+ }
204
+ }
205
+ if (n) this.store.save();
206
+ return n;
207
+ }
208
+
209
+ /** The draft answer to a question (the assistant's, or yours edited); empty text clears it. */
210
+ answer(id, { text, sources = null, by = 'you' } = {}) {
211
+ const a = this.find(id);
212
+ const t = String(text ?? '').trim().slice(0, 4000);
213
+ if (!t) delete a.answer;
214
+ else a.answer = { text: t, sources: sources ? clip(sources, 600) : a.answer?.sources ?? null, by, at: new Date().toISOString() };
215
+ // An answer makes it a question, if it wasn't one.
216
+ if (t && !a.kind) Object.assign(a, { kind: 'question', question: a.text, cc: false });
217
+ a.updatedAt = new Date().toISOString();
218
+ this.store.save();
219
+ return a;
220
+ }
221
+
222
+ /** A session that researches the question and records a draft answer (or the one already started). */
223
+ draft(id, bin, projects = []) {
224
+ const a = this.find(id);
225
+ const prev = a.draftId ? this.manager.store?.get?.(a.draftId) : null;
226
+ if (prev) return { agent: { id: prev.id, name: prev.name }, existing: true };
227
+ const agent = this.manager.createGeneral({ question: draftPrompt(a, bin, projects), name: `Answer: ${clip(a.question || a.text, 40)}` });
228
+ a.draftId = agent.id;
229
+ this.store.save();
230
+ return { agent: { id: agent.id, name: agent.name }, existing: false };
231
+ }
232
+
162
233
  /** A conversation about the action (a general session), or the one already started. */
163
234
  discuss(id, bin) {
164
235
  const a = this.find(id);
package/src/assistant.js CHANGED
@@ -18,7 +18,7 @@ export const SOURCES = {
18
18
  comments: 'new comments and mentions on Jira issues the person owns',
19
19
  slack: 'Slack messages to the person (direct messages and mentions) that ask for work',
20
20
  linear: 'Linear issues newly assigned to the person',
21
- actions: 'things asked of the person in Slack and in meeting notes (Notes by Gemini), for their Actions list',
21
+ actions: 'things asked of the person in Slack and in meeting notes (Notes by Gemini), and questions put to them or that they are copied on, with draft answers, for their Actions list',
22
22
  };
23
23
 
24
24
  /**
@@ -149,6 +149,10 @@ export function assistantPrompt(s, dir, bin = `node ${BIN}`, features = features
149
149
  `Find what is asked of ${who}, or what they agreed to do: in Gemini's notes, the action items and suggested next steps that name them. ` +
150
150
  `For each one, add it to their list: ${am} actions add --source <${[features.slack && 'slack', features.gemini && 'gemini'].filter(Boolean).join('|')}> --link "<the message or doc link>" --from "<who asked>" [--due "<when, if said>"] --context "<one or two sentences of background>" "<the action in one line, starting with a verb>". ` +
151
151
  `Adding the same one twice is harmless. Don't act on them, start agents for them or reply: the person decides under Actions.`,
152
+ `Questions for them: also find questions put to ${who} that are still unanswered: asked of them directly, or in a thread, email or document where they are mentioned, copied (CC) or tagged. ` +
153
+ `Add each one with its exact words: ${am} actions add --source <${[features.slack && 'slack', features.gemini && 'gemini'].filter(Boolean).join('|')}> --link "<link>" --from "<who asked>" --question "<the question, in their words>" [--cc when they are only copied or mentioned] "Answer <who>: <the question in a few words>". ` +
154
+ `Then prepare an answer they can send: read the whole thread, and find the answer in the code of their projects, Jira, docs and earlier messages, checking facts rather than guessing. ` +
155
+ `Record it, short, in their voice and ready to paste: ${am} actions answer <id> --sources "<links or files you used>" "<the answer>". When only someone else can answer, say so in the draft (who, and what to ask). Never send it yourself.`,
152
156
  );
153
157
  }
154
158
  if (s.sources.includes('slack')) {
package/src/cli.js CHANGED
@@ -757,9 +757,13 @@ export async function main(argv) {
757
757
  .option('--from <who>', 'who asked')
758
758
  .option('--due <when>', 'when it is due, if said')
759
759
  .option('--context <text>', 'a sentence or two of background')
760
+ .option('--question <words>', 'a question put to you: its words (the action then is to answer it)')
761
+ .option('--cc', "you're copied or mentioned on it, not asked directly")
762
+ .option('--answer <text>', 'a draft answer, to edit and send yourself')
763
+ .option('--sources <text>', 'with --answer: the links or files it is based on')
760
764
  .action(async (words, opts) => {
761
765
  await daemon();
762
- const a = await api('POST', '/actions', { text: words.join(' '), source: opts.source, link: opts.link, from: opts.from, due: opts.due, context: opts.context });
766
+ const a = await api('POST', '/actions', { text: words.join(' '), source: opts.source, link: opts.link, from: opts.from, due: opts.due, context: opts.context, question: opts.question, cc: Boolean(opts.cc), answer: opts.answer, sources: opts.sources });
763
767
  console.log(a.duplicate ? dim(`Already listed: ${a.id}`) : `${green('+')} ${bold(a.id)} ${a.text}`);
764
768
  });
765
769
  actionsCmd
@@ -775,6 +779,17 @@ export async function main(argv) {
775
779
  if (r.set.length) console.log(`${green('✓')} ${r.set.join(', ')}: ${state}`);
776
780
  for (const x of r.failed) console.log(`${red('!')} ${bold(x.id)}: ${x.reason}`);
777
781
  });
782
+ actionsCmd
783
+ .command('answer')
784
+ .description('Record a draft answer to a question (to edit and send yourself; nothing is sent)')
785
+ .argument('<id>')
786
+ .argument('<text...>', 'the answer')
787
+ .option('--sources <text>', 'the links or files it is based on')
788
+ .action(async (id, words, opts) => {
789
+ await daemon();
790
+ await api('PUT', `/actions/${id}/answer`, { text: words.join(' '), sources: opts.sources });
791
+ console.log(`${green('✓')} ${bold(id)}: draft answer saved`);
792
+ });
778
793
  actionsCmd
779
794
  .command('discuss')
780
795
  .description('Talk an action item through with Claude, in a session of its own')
package/src/issues.js CHANGED
@@ -34,9 +34,11 @@ export const GROUPS = {
34
34
  * the list). Any of them can be changed later; skipped, done and removed issues aren't proposed or
35
35
  * started by the assistant.
36
36
  */
37
- export const ACTIONS = ['assign', 'skip', 'done', 'remove'];
38
- const SET_ASIDE = { skip: 'skipped', done: 'done', remove: 'removed' };
39
- const ACTION_NOTE = { skip: 'Skipped by you', done: 'Marked done by you', remove: 'Removed by you' };
37
+ export const ACTIONS = ['assign', 'skip', 'snooze', 'done', 'remove'];
38
+ const SET_ASIDE = { skip: 'skipped', snooze: 'snoozed', done: 'done', remove: 'removed' };
39
+ const ACTION_NOTE = { skip: 'Skipped by you', snooze: 'Snoozed by you', done: 'Marked done by you', remove: 'Removed by you' };
40
+ // A snooze whose time has come is no decision any more.
41
+ const expired = (e, t = Date.now()) => e?.action === 'snooze' && !(Date.parse(e.until ?? '') > t);
40
42
 
41
43
  /** The issue an agent works on: { key, url }, from the link its request starts with or one in it. */
42
44
  export function issueOf(v) {
@@ -105,6 +107,7 @@ function designOf(v, read) {
105
107
  export function issueRows(views, jira = new Map(), read = () => null, proposed = [], actions = {}, assigned = []) {
106
108
  const rank = Object.fromEntries(Object.keys(GROUPS).map((k, i) => [k, i]));
107
109
  const rows = [];
110
+ actions = Object.fromEntries(Object.entries(actions).filter(([, e]) => !expired(e)));
108
111
  // What the search for issues assigned to you found: their summaries stand in where nothing else has one.
109
112
  const mine = new Map(assigned.map((i) => [i.key, i]));
110
113
  // Issues proposed for agents, not started yet: they wait for you to tick them.
@@ -113,6 +116,7 @@ export function issueRows(views, jira = new Map(), read = () => null, proposed =
113
116
  const action = actions[p.key]?.action ?? (p.status === 'dismissed' ? 'remove' : null);
114
117
  rows.push({
115
118
  actionAt: actions[p.key]?.at ?? null,
119
+ snoozeUntil: actions[p.key]?.action === 'snooze' ? actions[p.key].until : null,
116
120
  key: p.key,
117
121
  url: p.url,
118
122
  title: j?.summary ?? mine.get(p.key)?.summary ?? p.title,
@@ -142,6 +146,7 @@ export function issueRows(views, jira = new Map(), read = () => null, proposed =
142
146
  const design = designOf(v, read);
143
147
  rows.push({
144
148
  actionAt: actions[issue.key]?.at ?? null,
149
+ snoozeUntil: actions[issue.key]?.action === 'snooze' ? actions[issue.key].until : null,
145
150
  key: issue.key,
146
151
  url: issue.url,
147
152
  title: j?.summary ?? mine.get(issue.key)?.summary ?? issue.title,
@@ -167,6 +172,7 @@ export function issueRows(views, jira = new Map(), read = () => null, proposed =
167
172
  const action = actions[i.key]?.action ?? null;
168
173
  rows.push({
169
174
  actionAt: actions[i.key]?.at ?? null,
175
+ snoozeUntil: actions[i.key]?.action === 'snooze' ? actions[i.key].until : null,
170
176
  key: i.key,
171
177
  url: i.url,
172
178
  title: i.summary,
@@ -244,7 +250,9 @@ export class ProposedIssues {
244
250
 
245
251
  /** Your action per issue key: { action, at }. */
246
252
  get actions() {
247
- return (this.store.data.issueActions ??= {});
253
+ const all = (this.store.data.issueActions ??= {});
254
+ for (const [k, e] of Object.entries(all)) if (expired(e)) delete all[k];
255
+ return all;
248
256
  }
249
257
 
250
258
  /** Skip, done or remove when you set one; dismissed before actions existed counts as remove. */
@@ -276,8 +284,10 @@ export class ProposedIssues {
276
284
  * Set your action on issues (null clears it). Assign starts an agent from the proposal when none
277
285
  * works on the issue yet. Returns { set: [keys], started: [{ key, agent }], failed: [{ key, reason }] }.
278
286
  */
279
- setAction(keys = [], action = null) {
287
+ setAction(keys = [], action = null, { until = null } = {}) {
280
288
  if (action !== null && !ACTIONS.includes(action)) throw err(400, `The action is one of ${ACTIONS.join(', ')}, or none to clear it`);
289
+ const wakeAt = action === 'snooze' ? Date.parse(until ?? '') : null;
290
+ if (action === 'snooze' && !(Number.isFinite(wakeAt) && wakeAt > Date.now())) throw err(400, 'Snooze until a time to come');
281
291
  const set = [];
282
292
  const started = [];
283
293
  const failed = [];
@@ -307,7 +317,7 @@ export class ProposedIssues {
307
317
  agent = r.started[0].agent;
308
318
  }
309
319
  // Assign is what an agent on it means anyway; only the others are kept.
310
- if (SET_ASIDE[action]) this.actions[key] = { action, at: new Date().toISOString() };
320
+ if (SET_ASIDE[action]) this.actions[key] = { action, at: new Date().toISOString(), ...(action === 'snooze' ? { until: new Date(wakeAt).toISOString() } : {}) };
311
321
  else delete this.actions[key];
312
322
  if (p?.status === 'dismissed') p.status = 'waiting';
313
323
  set.push(key);
package/src/server.js CHANGED
@@ -52,6 +52,7 @@ import { Value, valueSlack } from './value.js';
52
52
  import { Store } from './store.js';
53
53
  import { about, latestRelease } from './about.js';
54
54
  import { Support } from './support.js';
55
+ import { leadingJiraKey } from './tracker.js';
55
56
  import { BugHunts } from './bughunt.js';
56
57
 
57
58
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -607,6 +608,21 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
607
608
  api.post('/agents/:id/changes/comments', wrap((req) => review.comment(req.params.id, req.body ?? {})));
608
609
  api.post('/agents/:id/changes/commit', wrap((req) => review.commit(req.params.id, req.body ?? {})));
609
610
  api.post('/agents/:id/changes/pr', wrap((req) => review.pr(req.params.id, req.body ?? {})));
611
+ // Done but no pull request: commit what's left, push and open one, titled after the issue or request.
612
+ api.post('/agents/:id/ship', wrap(async (req) => {
613
+ const a = manager.mustGet(req.params.id);
614
+ const key = leadingJiraKey(a.intent);
615
+ const words = a.synopsis?.text ?? a.brief?.title ?? String(a.intent ?? '').replace(/^<?https?:\/\/\S+>?\s*/, '').split('\n')[0];
616
+ const title = String(req.body?.title ?? '').trim() || `${key ? `${key}: ` : ''}${words || a.name}`.slice(0, 100);
617
+ try {
618
+ await review.commit(a.id, { message: title });
619
+ } catch (e) {
620
+ if (e.status !== 409 || !/nothing to commit/i.test(e.message)) throw e;
621
+ }
622
+ const r = await review.pr(a.id, { title });
623
+ await manager.refresh(a.id, { withPrs: true }).catch(() => {});
624
+ return { url: r.url ?? null, title };
625
+ }));
610
626
  api.post('/agents/:id/fork', wrap((req) => manager.fork(req.params.id, req.body ?? {})));
611
627
 
612
628
  api.get('/races', wrap(() => races.list()));
@@ -826,7 +842,11 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
826
842
  // My actions: what's asked of you in Slack and meeting notes (the assistant adds them).
827
843
  api.get('/actions', wrap(() => ({ rows: myActions.rows(), features: featuresOf(config) })));
828
844
  api.post('/actions', wrap((req) => myActions.add({ ...req.body, by: req.headers['x-agentmgr-agent'] ? 'assistant' : 'you' })));
829
- api.post('/actions/set', wrap((req) => myActions.set(Array.isArray(req.body?.ids) ? req.body.ids.map(String) : [], String(req.body?.state ?? ''), { project: req.body?.project ?? null })));
845
+ api.post('/actions/set', wrap((req) => myActions.set(Array.isArray(req.body?.ids) ? req.body.ids.map(String) : [], String(req.body?.state ?? ''), { project: req.body?.project ?? null, until: req.body?.until ?? null })));
846
+ // The draft answer to a question: the assistant's (from its session) or yours, edited.
847
+ api.put('/actions/:id/answer', wrap((req) => myActions.answer(req.params.id, { text: req.body?.text, sources: req.body?.sources ?? null, by: req.headers['x-agentmgr-agent'] ? 'assistant' : 'you' })));
848
+ // A session that researches the question and records a draft answer.
849
+ api.post('/actions/:id/draft', wrap((req) => myActions.draft(req.params.id, `node ${JSON.stringify(path.join(__dirname, '..', 'bin', 'agentmgr.js'))}`, manager.listProjects().map((p) => ({ name: p.name ?? p.shortcut, dir: p.dir ?? null, repo: p.repo ?? null })))));
830
850
  api.post('/actions/:id/discuss', wrap((req) => myActions.discuss(req.params.id, `node ${JSON.stringify(path.join(__dirname, '..', 'bin', 'agentmgr.js'))}`)));
831
851
  // The parts you use: Jira, Slack, meeting notes. Off hides its list and the assistant skips it.
832
852
  api.get('/features', wrap(() => ({ features: featuresOf(config), me: assistant.settings.me })));
@@ -839,7 +859,7 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
839
859
  return { features: featuresOf(config), me: assistant.settings.me };
840
860
  }));
841
861
  // Your action on issues: assign (starts an agent from the proposal), skip, done, remove, or null to clear.
842
- api.post('/issues/action', wrap((req) => proposed.setAction(Array.isArray(req.body?.keys) ? req.body.keys.map(String) : [], req.body?.action ?? null)));
862
+ api.post('/issues/action', wrap((req) => proposed.setAction(Array.isArray(req.body?.keys) ? req.body.keys.map(String) : [], req.body?.action ?? null, { until: req.body?.until ?? null })));
843
863
  // Design docs of all agents; the same ?group= and ?format=markdown.
844
864
  api.get('/designs', wrap((req) => {
845
865
  const v = manager.designs();
package/src/today.js CHANGED
@@ -70,19 +70,28 @@ export function todayItems({ inbox = [], issues = [], actions = [], reviews = []
70
70
  const r = i.agentId ? issueOfAgent.get(i.agentId) : null;
71
71
  if (r && ['prompt', 'waiting', 'question'].includes(i.kind)) asking.add(r.key);
72
72
  const about = !r?.title ? '' : i.agentName === r.key ? ` · ${r.title}` : ` · ${r.key}: ${r.title}`;
73
- items.push({ id: i.key, kind: i.kind, label: k.label, title: String(i.title ?? '').slice(0, 300), why: k.why(i) + about, score: k.score + (i.priority ?? 2) / 10, at: i.at ?? null, agentId: i.agentId ?? null, ...(r ? { url: r.url ?? null, issueKey: r.key } : {}) });
73
+ items.push({ id: i.key, kind: i.kind, label: k.label, title: String(i.title ?? '').slice(0, 300), why: k.why(i) + about, score: k.score + (i.priority ?? 2) / 10, at: i.at ?? null, agentId: i.agentId ?? null, ...(r ? { url: r.url ?? null, issueKey: r.key } : {}), ...answerOf(i) });
74
74
  }
75
75
  for (const r of issues) {
76
76
  if (asking.has(r.key)) continue;
77
77
  const title = r.title ? `${r.key}: ${r.title}` : r.key;
78
78
  if (r.group === 'you') {
79
- items.push({ id: `issue:${r.key}`, kind: 'issue-review', label: 'Jira', title, why: r.note, score: 25, at: r.updatedAt ?? null, agentId: r.agent?.id ?? null, url: r.url ?? null, issueKey: r.key });
79
+ // Done with no pull request yet: shipped from here (commit, push, open one) after a look at the changes.
80
+ const ship = r.stage === 'review' && !r.pr && Boolean(r.agent);
81
+ items.push({ id: `issue:${r.key}`, kind: 'issue-review', label: 'Jira', title, why: ship ? 'Done, no pull request yet: look at the changes, then open one' : r.note, score: 25, at: r.updatedAt ?? null, agentId: r.agent?.id ?? null, url: r.url ?? null, issueKey: r.key, ...(ship ? { ship: true } : {}) });
80
82
  } else if (r.group === 'new') {
81
83
  items.push({ id: `issue:${r.key}`, kind: 'issue-new', label: r.type && !/^(story|task|bug|sub-?task)$/i.test(r.type) ? r.type : 'Jira', title, why: r.stage === 'assigned' ? 'Assigned to you in Jira, not started' : 'Proposed for an agent, not started', score: 50, at: r.updatedAt ?? null, url: r.url ?? null, issueKey: r.key });
82
84
  }
83
85
  }
84
86
  for (const a of actions) {
85
87
  if (a.group !== 'open') continue;
88
+ // A question put to you: asked directly is pressing; copied or mentioned can wait a little.
89
+ if (a.kind === 'question') {
90
+ const at = dueAt(a.due, now);
91
+ const why = [a.cc ? `you're copied${a.from ? `; ${a.from} asked` : ''}` : a.from ? `${a.from} asked you` : 'asked of you', a.sourceLabel && `in ${a.sourceLabel}`, dueWords(at, now), a.answer ? 'answer drafted' : 'no answer drafted yet'].filter(Boolean).join(' · ');
92
+ items.push({ id: `action:${a.id}`, kind: 'ask', label: a.cc ? "CC'd" : 'Asked you', title: a.question || a.text, why, score: a.cc ? 44 : at && at.getTime() < now.getTime() + DAY ? 16 : 22, at: a.when ?? null, url: a.link ?? null, actionId: a.id, draft: a.answer ?? null });
93
+ continue;
94
+ }
86
95
  const at = dueAt(a.due, now);
87
96
  const words = dueWords(at, now);
88
97
  const late = at && at.getTime() < now.getTime();
@@ -118,7 +127,15 @@ export function todaySpeech(items, max = 8) {
118
127
  return parts;
119
128
  }
120
129
 
121
- const ASIDE = { skip: 'Skipped', done: 'Done', remove: 'Removed' };
130
+ const ASIDE = { skip: 'Skipped', snooze: 'Snoozed', done: 'Done', remove: 'Removed' };
131
+
132
+ /** How an agent's question is answered from Today: the choices it offered, and where an answer goes. */
133
+ function answerOf(i) {
134
+ if (i.kind === 'prompt') return { answer: { via: 'key', choices: (i.prompt?.choices ?? []).slice(0, 6).map((c) => ({ key: c.key, label: c.label })) } };
135
+ if (i.kind === 'waiting') return { answer: { via: 'waiting', choices: (i.waiting?.choices ?? []).slice(0, 6), reply: true } };
136
+ if (i.kind === 'question') return { answer: { via: 'question', qid: i.question?.id, choices: (i.question?.options ?? []).slice(0, 6), reply: true, default: i.question?.default ?? null } };
137
+ return {};
138
+ }
122
139
 
123
140
  /**
124
141
  * What you set aside from Today's lists (skipped, done, removed), newest first, so any of it can be
@@ -128,11 +145,11 @@ export function todayAside({ issues = [], actions = [], max = 50 } = {}) {
128
145
  const out = [];
129
146
  for (const r of issues) {
130
147
  if (!ASIDE[r.action]) continue;
131
- out.push({ id: `issue:${r.key}`, kind: 'issue', state: r.action, label: ASIDE[r.action], title: r.title ? `${r.key}: ${r.title}` : r.key, at: r.actionAt ?? r.updatedAt ?? null, issueKey: r.key });
148
+ out.push({ id: `issue:${r.key}`, kind: 'issue', state: r.action, label: ASIDE[r.action], title: r.title ? `${r.key}: ${r.title}` : r.key, at: r.actionAt ?? r.updatedAt ?? null, issueKey: r.key, until: r.snoozeUntil ?? null });
132
149
  }
133
150
  for (const a of actions) {
134
151
  if (!ASIDE[a.status]) continue;
135
- out.push({ id: `action:${a.id}`, kind: 'action', state: a.status, label: ASIDE[a.status], title: a.text, at: a.updatedAt ?? null, actionId: a.id });
152
+ out.push({ id: `action:${a.id}`, kind: 'action', state: a.status, label: ASIDE[a.status], title: a.question || a.text, at: a.updatedAt ?? null, actionId: a.id, until: a.snoozeUntil ?? null });
136
153
  }
137
154
  return out.sort((x, y) => String(y.at ?? '').localeCompare(String(x.at ?? ''))).slice(0, max);
138
155
  }