@floless/app 0.157.0 → 0.158.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,323 @@
1
+ // The browser tab says how a run is going (tab signal). People start a long run and switch to Tekla or
2
+ // Revit; the tab is all they can see of FloLess then. While a run works, the favicon carries a progress
3
+ // ring and the title leads with the percent (or the elapsed clock when the run reports no total). When
4
+ // it ends, the favicon and title say how: done, failed, stopped, didn't run. A run that ended while the
5
+ // person was away keeps saying so until they are back, and, if they allowed it, a desktop notice says it
6
+ // too. FloLess never asks for that permission on its own: the first time a run ends while they were
7
+ // away, a toast offers it, once; the ≡ menu's "Run finished notices" switch turns it on or off any time.
8
+ //
9
+ // It never decides anything: aware.js tells it when a run begins, how it progresses and how it ended,
10
+ // and it owns no title of its own — aware.js stays the one writer of document.title and asks prefix().
11
+ // A plain script (no import/export); its one global is `flolessTabSignal`.
12
+
13
+ (function () {
14
+ const TICK_MS = 1000; // the elapsed clock in the title: at most one title change a second
15
+ const SPIN_MS = 250; // the indeterminate ring while the tab is on screen (4 fps, CPU-light)
16
+ const CLEAR_SEEN_MS = 4000; // a success the person watched happen
17
+ const CLEAR_BACK_MS = 3000; // an ending they come back to: long enough to be noticed
18
+ const NOTIFY_MIN_MS = 10_000; // a run shorter than this is noise as a desktop notice
19
+ const ICON_PX = 64;
20
+ const OFFER_KEY = 'floless.tabSignal.notifyOffered';
21
+ const PREF_KEY = 'floless.tabSignal.notify'; // '0' when the person switched notices off in the ≡ menu
22
+ const END_TEXT = { ok: '✓ Done', failed: '✕ Failed', stopped: '■ Stopped', 'not-run': "○ Didn't run" };
23
+ const NOTICE_TITLE = { ok: 'Run finished', failed: 'Run failed', stopped: 'Run stopped', 'not-run': "Run didn't start" };
24
+ // A run that did not start has no duration worth stating, and FloLess keeps no reason for it (the run strip says
25
+ // the same: run it again to see why). A failure's details stay in the Execution tab.
26
+ const noticeBody = (outcome, ms) => ({
27
+ ok: `Took ${duration(ms)}.`,
28
+ failed: `Failed after ${duration(ms)}. Open FloLess to see why.`,
29
+ stopped: `Stopped after ${duration(ms)}.`,
30
+ 'not-run': "FloLess didn't start it. Run it again to see why.",
31
+ }[outcome]);
32
+
33
+ let run = null; // { name, startedAt, fraction, runId }
34
+ let ended = null; // { outcome, name, whileAway, clearTimer }
35
+ let onChange = () => {};
36
+ let shownPrefix = '';
37
+ let tickTimer = null;
38
+ let spinAngle = 0;
39
+ let baseIcon = null; // the favicon as an <img>, once loaded
40
+ let iconLinks = null; // [{ link, href }]: the originals, restored when the signal clears
41
+ let offerPending = false; // a run ended while away and permission is undecided: offer when they are back
42
+ let prefMemory = null; // the ≡ menu choice when the browser will not store it: it still holds for this page
43
+
44
+ const reducedMotion = () => !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);
45
+ const hidden = () => document.visibilityState === 'hidden';
46
+ // Visible but not focused (FloLess on a second monitor beside Tekla) counts as away too.
47
+ const away = () => hidden() || (typeof document.hasFocus === 'function' && !document.hasFocus());
48
+ const clock = (ms) => (typeof rpClock === 'function' ? rpClock(ms) : `${Math.floor(ms / 60000)}:${String(Math.floor(ms / 1000) % 60).padStart(2, '0')}`);
49
+
50
+ function duration(ms) {
51
+ const s = Math.max(0, Math.round(ms / 1000));
52
+ if (s < 60) return `${s}s`;
53
+ const m = Math.floor(s / 60);
54
+ if (m < 60) return `${m}m ${s % 60}s`;
55
+ return `${Math.floor(m / 60)}h ${m % 60}m`;
56
+ }
57
+
58
+ /** What the title leads with, or '' when nothing is going on. */
59
+ function prefix() {
60
+ if (run) return `${run.fraction != null ? `${Math.floor(run.fraction * 100)}%` : clock(Date.now() - run.startedAt)} · `;
61
+ if (ended) return `${END_TEXT[ended.outcome]} · `;
62
+ return '';
63
+ }
64
+
65
+ // ── favicon ──────────────────────────────────────────────────────────────────────────────────────
66
+ function themeColor(name, fallback) {
67
+ const v = getComputedStyle(document.documentElement).getPropertyValue(name).trim();
68
+ return v || fallback;
69
+ }
70
+
71
+ function links() {
72
+ if (!iconLinks) iconLinks = [...document.querySelectorAll('link[rel~="icon"]')].map((link) => ({ link, href: link.getAttribute('href') }));
73
+ return iconLinks;
74
+ }
75
+
76
+ function loadBaseIcon() {
77
+ if (baseIcon || typeof Image !== 'function') return;
78
+ const svg = links().find(({ href }) => /\.svg(\?|$)/.test(href || '')) || links()[0];
79
+ if (!svg) return;
80
+ const img = new Image();
81
+ img.onload = () => { baseIcon = img; paint(); };
82
+ img.src = svg.href;
83
+ }
84
+
85
+ function restoreIcon() {
86
+ if (!iconLinks) return;
87
+ for (const { link, href } of iconLinks) link.setAttribute('href', href);
88
+ }
89
+
90
+ function paint() {
91
+ if (!run && !ended) { restoreIcon(); return; }
92
+ const canvas = document.createElement('canvas');
93
+ const g = canvas.getContext && canvas.getContext('2d');
94
+ if (!g || !baseIcon) return; // no canvas (or the logo not loaded yet): the title still carries it
95
+ canvas.width = canvas.height = ICON_PX;
96
+ g.drawImage(baseIcon, 0, 0, ICON_PX, ICON_PX);
97
+ const cx = ICON_PX * 0.72, cy = ICON_PX * 0.72, r = ICON_PX * 0.25;
98
+ // A dark disc under the badge so it reads on a light or a dark tab strip alike.
99
+ g.beginPath(); g.arc(cx, cy, r + 5, 0, Math.PI * 2); g.fillStyle = '#0f172a'; g.fill();
100
+ g.lineCap = 'round'; g.lineJoin = 'round';
101
+ if (run) {
102
+ g.lineWidth = 7;
103
+ g.beginPath(); g.arc(cx, cy, r - 2, 0, Math.PI * 2); g.strokeStyle = 'rgba(148,163,184,0.35)'; g.stroke();
104
+ const still = run.fraction == null && reducedMotion();
105
+ const start = run.fraction != null || still ? -Math.PI / 2 : spinAngle;
106
+ const sweep = run.fraction != null ? Math.max(0.04, run.fraction) * Math.PI * 2 : Math.PI / 2;
107
+ g.beginPath(); g.arc(cx, cy, r - 2, start, start + sweep); g.strokeStyle = themeColor('--accent', '#4a9eff'); g.stroke();
108
+ } else {
109
+ // Each ending has its own shape, so it reads without its color: done a disc with a tick, failed a
110
+ // triangle with a bar, stopped a square, didn't run a hollow ring.
111
+ const o = ended.outcome;
112
+ const color = o === 'ok' ? themeColor('--ok', '#4ade80') : o === 'failed' ? themeColor('--err', '#f87171') : '#94a3b8';
113
+ g.fillStyle = color; g.strokeStyle = color; g.lineWidth = 6;
114
+ g.beginPath();
115
+ if (o === 'ok') {
116
+ g.arc(cx, cy, r, 0, Math.PI * 2); g.fill();
117
+ const u = r * 0.45;
118
+ g.beginPath(); g.moveTo(cx - u, cy); g.lineTo(cx - u * 0.2, cy + u * 0.8); g.lineTo(cx + u, cy - u * 0.7);
119
+ g.strokeStyle = '#0f172a'; g.stroke();
120
+ } else if (o === 'failed') {
121
+ g.moveTo(cx, cy - r * 1.05); g.lineTo(cx + r * 1.05, cy + r * 0.8); g.lineTo(cx - r * 1.05, cy + r * 0.8); g.closePath(); g.fill();
122
+ g.beginPath(); g.moveTo(cx, cy - r * 0.3); g.lineTo(cx, cy + r * 0.25);
123
+ g.strokeStyle = '#0f172a'; g.stroke();
124
+ } else if (o === 'stopped') {
125
+ g.rect(cx - r * 0.8, cy - r * 0.8, r * 1.6, r * 1.6); g.fill();
126
+ } else {
127
+ g.arc(cx, cy, r - 3, 0, Math.PI * 2); g.stroke();
128
+ }
129
+ }
130
+ const url = canvas.toDataURL('image/png');
131
+ for (const { link } of links()) link.setAttribute('href', url);
132
+ }
133
+
134
+ // ── lifecycle ────────────────────────────────────────────────────────────────────────────────────
135
+ function changed() {
136
+ paint();
137
+ const next = prefix();
138
+ if (next === shownPrefix) return; // the spinner repaints the icon; the title moves only when its words do
139
+ shownPrefix = next;
140
+ try { onChange(); } catch { /* the title is a courtesy; a failing writer must not break a run */ }
141
+ }
142
+
143
+ function stopTicking() { if (tickTimer) { clearInterval(tickTimer); tickTimer = null; } }
144
+
145
+ function startTicking() {
146
+ stopTicking();
147
+ if (!run) return;
148
+ const spin = !hidden() && !reducedMotion() && run.fraction == null;
149
+ tickTimer = setInterval(() => {
150
+ if (!run) { stopTicking(); return; }
151
+ spinAngle = (spinAngle + Math.PI / 3) % (Math.PI * 2);
152
+ changed();
153
+ }, spin ? SPIN_MS : TICK_MS);
154
+ }
155
+
156
+ function clearEnd() {
157
+ if (!ended) return;
158
+ if (ended.clearTimer) clearTimeout(ended.clearTimer);
159
+ ended = null;
160
+ changed();
161
+ }
162
+
163
+ function begin(name, startedAt) {
164
+ if (ended && ended.clearTimer) clearTimeout(ended.clearTimer);
165
+ ended = null;
166
+ run = { name: name || 'Workflow', startedAt: typeof startedAt === 'number' ? startedAt : Date.now(), fraction: null, runId: null };
167
+ loadBaseIcon();
168
+ startTicking();
169
+ changed();
170
+ }
171
+
172
+ /** A `node-progress` record: a fraction exists only when the producer reported a total. */
173
+ function progress(rec) {
174
+ if (!run || !rec) return;
175
+ if (rec.runId) run.runId = rec.runId;
176
+ const f = typeof rec.total === 'number' && rec.total > 0 && typeof rec.done === 'number'
177
+ ? Math.max(0, Math.min(1, rec.done / rec.total)) : null;
178
+ const modeChanged = (run.fraction == null) !== (f == null);
179
+ run.fraction = f;
180
+ if (modeChanged) startTicking();
181
+ changed();
182
+ }
183
+
184
+ /** The run went away without an ending this tab can state (replaced, or no longer followed). */
185
+ function cancel() {
186
+ if (!run) return;
187
+ run = null;
188
+ stopTicking();
189
+ changed();
190
+ }
191
+
192
+ /** outcome: 'ok' | 'failed' | 'stopped' | 'not-run'. Any other (FloLess no longer knows how it ended) claims nothing. */
193
+ function finish(outcome, endedRunId) {
194
+ if (!run) return;
195
+ if (endedRunId) run.runId = endedRunId;
196
+ if (!Object.prototype.hasOwnProperty.call(END_TEXT, outcome)) { cancel(); return; }
197
+ const { name, startedAt, runId } = run;
198
+ run = null;
199
+ stopTicking();
200
+ const whileAway = away();
201
+ ended = { outcome, name, whileAway, clearTimer: null };
202
+ // A success they watched fades on its own; anything else stays until they are back and act.
203
+ if (!whileAway && ended.outcome === 'ok') ended.clearTimer = setTimeout(clearEnd, CLEAR_SEEN_MS);
204
+ changed();
205
+ const ms = Date.now() - startedAt;
206
+ if (whileAway && ms >= NOTIFY_MIN_MS) notify(ended.outcome, name, ms, runId);
207
+ }
208
+
209
+ // ── desktop notice ───────────────────────────────────────────────────────────────────────────────
210
+ function notify(outcome, name, ms, runId) {
211
+ const N = typeof Notification === 'function' ? Notification : null;
212
+ if (!N || switchedOff()) return;
213
+ if (N.permission === 'granted') {
214
+ try {
215
+ // One notice per run: two tabs following it, or a reconnect, share the tag and replace each other.
216
+ const n = new N(`${NOTICE_TITLE[outcome]} — ${name}`, { body: noticeBody(outcome, ms), tag: `floless-run:${runId || name}`, icon: '/favicon.svg?v=2', silent: true });
217
+ n.onclick = () => { try { window.focus(); } catch { /* best effort */ } n.close(); };
218
+ } catch { /* a browser that will not show one from a page: the tab still says it */ }
219
+ return;
220
+ }
221
+ if (N.permission === 'default' && !offeredBefore()) offerPending = true; // 'denied' is their answer: never ask
222
+ }
223
+
224
+ function offeredBefore() {
225
+ try { return localStorage.getItem(OFFER_KEY) === '1'; } catch { return true; } // no storage: never nag
226
+ }
227
+ function switchedOff() {
228
+ if (prefMemory != null) return prefMemory === '0'; // set only while the browser will not store the choice
229
+ try { return localStorage.getItem(PREF_KEY) === '0'; } catch { return false; }
230
+ }
231
+ function remember(key, value) {
232
+ try { localStorage.setItem(key, value); if (key === PREF_KEY) prefMemory = null; }
233
+ catch { if (key === PREF_KEY) prefMemory = value; /* held in memory for this page instead */ }
234
+ }
235
+
236
+ /** Ask the browser; once it answers, the ≡ menu switch says where things stand. */
237
+ function askPermission() {
238
+ remember(OFFER_KEY, '1');
239
+ remember(PREF_KEY, '1');
240
+ const ask = Notification.requestPermission();
241
+ const settle = (p) => {
242
+ syncMenu();
243
+ if (p === 'granted') showToast('Run finished notices are on. Switch them off in the ≡ menu.', 'ok');
244
+ };
245
+ if (ask && typeof ask.then === 'function') ask.then(settle, () => syncMenu());
246
+ }
247
+
248
+ function offer() {
249
+ offerPending = false;
250
+ // Read again now: while they were away, another FloLess tab may have answered (switched notices off, offered
251
+ // already) or the browser may have been told.
252
+ if (switchedOff() || offeredBefore() || typeof Notification !== 'function' || Notification.permission !== 'default') return;
253
+ try { localStorage.setItem(OFFER_KEY, '1'); } catch { return; }
254
+ if (typeof showToast !== 'function') return;
255
+ showToast('That run ended while you were away. Get a desktop notice next time?', 'info', {
256
+ action: {
257
+ label: 'Turn on',
258
+ commandId: 'shell.run-notify-enable',
259
+ onClick: askPermission,
260
+ },
261
+ });
262
+ }
263
+
264
+ // ── the ≡ menu switch ───────────────────────────────────────────────────────────────────────────
265
+ // On means: the browser allows notices and the person has not switched them off here. A browser that
266
+ // blocks them keeps the switch off and the hint says where to change that; FloLess cannot.
267
+ const HINT_ON = 'A desktop notice when a run ends while you are in another window.';
268
+ const HINT_BLOCKED = 'Your browser blocks notices from FloLess. Allow them in the site settings (the icon left of the address), then switch this on.';
269
+ function syncMenu() {
270
+ const row = document.getElementById('menu-run-notify');
271
+ const toggle = document.getElementById('menu-run-notify-toggle');
272
+ const hint = document.getElementById('menu-run-notify-hint');
273
+ if (!row || !toggle) return;
274
+ if (typeof Notification !== 'function') { row.hidden = true; return; }
275
+ row.hidden = false;
276
+ toggle.checked = Notification.permission === 'granted' && !switchedOff();
277
+ if (hint) hint.textContent = Notification.permission === 'denied' ? HINT_BLOCKED : HINT_ON;
278
+ }
279
+ function bindMenu() {
280
+ const toggle = document.getElementById('menu-run-notify-toggle');
281
+ if (!toggle) return;
282
+ toggle.addEventListener('change', () => {
283
+ if (!toggle.checked) { remember(PREF_KEY, '0'); remember(OFFER_KEY, '1'); syncMenu(); return; }
284
+ if (Notification.permission === 'granted') { remember(PREF_KEY, '1'); syncMenu(); return; }
285
+ if (Notification.permission === 'denied') { syncMenu(); return; } // the hint says why it stays off
286
+ toggle.checked = false; // on only once the browser says yes
287
+ askPermission();
288
+ });
289
+ syncMenu();
290
+ }
291
+ bindMenu();
292
+
293
+ // Back on the tab: an ending they missed is held a moment so it is seen, then cleared. One they watched
294
+ // happen (a failure, a stop) clears at their next click or key, since they have seen it by then.
295
+ function back() {
296
+ if (run) startTicking();
297
+ if (away()) return;
298
+ syncMenu(); // they may have changed the browser's permission in the meantime
299
+ if (ended && ended.whileAway && !ended.clearTimer) ended.clearTimer = setTimeout(clearEnd, CLEAR_BACK_MS);
300
+ if (offerPending) offer();
301
+ }
302
+ function acted() { if (ended && !ended.whileAway && !ended.clearTimer && !away()) clearEnd(); }
303
+ // Gone again before it cleared: the ending is held until they are back for good.
304
+ function left() {
305
+ if (!ended || !away() || !ended.clearTimer) return;
306
+ clearTimeout(ended.clearTimer);
307
+ ended.clearTimer = null;
308
+ ended.whileAway = true;
309
+ }
310
+ document.addEventListener('visibilitychange', () => { if (away()) { if (run) startTicking(); left(); } else back(); });
311
+ window.addEventListener('focus', back);
312
+ window.addEventListener('blur', () => { if (run) startTicking(); left(); });
313
+ // Another FloLess tab switched notices on or off: this one's switch says the same.
314
+ window.addEventListener('storage', (e) => { if (!e || e.key === PREF_KEY) syncMenu(); });
315
+ document.addEventListener('pointerdown', acted, true);
316
+ document.addEventListener('keydown', acted, true);
317
+
318
+ window.flolessTabSignal = {
319
+ begin, progress, finish, cancel, prefix,
320
+ /** aware.js hands its title writer here, so a tick re-renders the one title it owns. */
321
+ onChange(fn) { onChange = typeof fn === 'function' ? fn : () => {}; },
322
+ };
323
+ })();
@@ -26,6 +26,15 @@
26
26
  'models.retry-revit-setup': 'Try setup again', 'models.retry-tekla-setup': 'Try setup again',
27
27
  'workspace-root.review-retirement': 'Open the review', 'workspace-root.confirm-retirement': 'Record it' };
28
28
  const EYEBROWS = { write: 'Needs your OK', destructive: 'Needs your OK', 'human-only': 'Your decision' };
29
+ // #2427: the step went as far as FloLess may and left the last click to the person: theirs to finish, not a failure.
30
+ const handedOver = (p) => p?.state === 'done' && p.result?.code === 'step-handed-over';
31
+ /** Several requests that ended: the ones waiting on the person are said apart from the ones that finished. */
32
+ function endedWords(ended) {
33
+ const handed = ended.filter(handedOver).length;
34
+ if (!handed) return `${ended.length} requests from your terminal have finished.`;
35
+ if (handed === ended.length) return `${handed} requests from your terminal are waiting for you.`;
36
+ return `From your terminal: ${handed} waiting for you · ${ended.length - handed} finished.`;
37
+ }
29
38
  const FINAL = new Set(['done', 'failed', 'cancelled', 'declined', 'expired', 'superseded', 'unknown']);
30
39
 
31
40
  /** Requests shown in the dialog, by id, in the order they arrived. */
@@ -244,7 +253,7 @@
244
253
  strong.textContent = String(p.title || 'A FloLess action');
245
254
  named.append(eyebrow, strong);
246
255
  head.append(named);
247
- const badge = { executing: 'Running', done: 'Done', failed: 'Not done', unknown: 'Unknown' }[p.state];
256
+ const badge = handedOver(p) ? 'Your turn' : { executing: 'Running', done: 'Done', failed: 'Not done', unknown: 'Unknown' }[p.state];
248
257
  if (badge) {
249
258
  const b = document.createElement('span');
250
259
  b.className = 'ai-chat-filter-state';
@@ -270,11 +279,31 @@
270
279
  sum.className = 'ai-chat-action-summary';
271
280
  sum.textContent = summary;
272
281
  node.append(sum);
282
+ // #2521 row 3a: what confirming agrees to (a Quick model read), whole and on its own line, as on a chat card: a
283
+ // terminal's request is consented to here, so its terms are shown here.
284
+ if (p.terms) {
285
+ const terms = document.createElement('p');
286
+ terms.className = 'ai-chat-action-summary ai-chat-action-terms';
287
+ const label = document.createElement('strong');
288
+ label.className = 'ai-chat-action-terms-label';
289
+ label.textContent = 'What you agree to';
290
+ terms.append(label, document.createTextNode(String(p.terms)));
291
+ node.append(terms);
292
+ }
273
293
 
294
+ if (handedOver(p)) {
295
+ node.classList.add('is-handed-over');
296
+ status.textContent = entry.error || String(p.result?.message || 'It is ready for you. Press it to finish.');
297
+ node.append(status);
298
+ return node;
299
+ }
274
300
  if (p.state === 'done') {
275
301
  node.classList.add('is-done');
276
302
  // A step this window was handed but could not take is said here, never left reading as done.
277
- status.textContent = entry.error || (p.next ? 'Done. Its result is ready to view.' : String(p.doneNote || 'Done.'));
303
+ // #2521 row 3a: the route's own answer, when it changed what happened (a Quick read queued Precise), comes first.
304
+ const resultNote = typeof p.result?.note === 'string' && p.result.note ? p.result.note : '';
305
+ if (resultNote) node.classList.add('is-fallback');
306
+ status.textContent = entry.error || resultNote || (p.next ? 'Done. Its result is ready to view.' : String(p.doneNote || 'Done.'));
278
307
  if (p.next) {
279
308
  const actions = document.createElement('div');
280
309
  actions.className = 'ai-chat-filter-actions';
@@ -401,15 +430,24 @@
401
430
  // A step only this window may take (a model source, the setup review, Stop FloLess) is taken here once confirmed,
402
431
  // exactly as a chat card does: the request stays running until this window says how the step went.
403
432
  if (verb === 'confirm' && entry.p.browserStep) {
404
- entry.error = typeof window.flolessRunBrowserStep === 'function'
433
+ const outcome = typeof window.flolessRunBrowserStep === 'function'
405
434
  ? await window.flolessRunBrowserStep(entry.p.browserStep)
406
435
  : 'FloLess could not take this step from here. Open the project or screen it names and do it there.';
436
+ // #2427: a step that left the last click to the person is not an error; the request says it waits for them.
437
+ entry.error = typeof outcome === 'string' ? outcome : '';
407
438
  // A Stop FloLess that went ahead is settled by the server when it accepts the stop; this window can no longer report.
408
439
  const stopped = entry.p.browserStep.flow === 'stop-app' && !entry.error;
409
- const settled = !stopped && typeof window.flolessReportBrowserStep === 'function' ? await window.flolessReportBrowserStep(entry.p.id, entry.error) : null;
440
+ const settled = !stopped && typeof window.flolessReportBrowserStep === 'function' ? await window.flolessReportBrowserStep(entry.p.id, outcome) : null;
410
441
  if (settled) entry.p = settled;
411
442
  // The step opened something in this window (a project, a review). This dialog sits over it, so step aside.
412
- if (!entry.error) closeDialog();
443
+ // A step that left the last click to the person focused that control: closing must not pull focus back to
444
+ // whatever opened this dialog, or the person loses the very control the card told them to press (#2427).
445
+ if (!entry.error) {
446
+ if (outcome && typeof outcome === 'object') returnFocus = null;
447
+ closeDialog();
448
+ // The dialog sat over that control while it was open, so it gets focus now, once nothing covers it.
449
+ if (outcome?.focus?.isConnected) outcome.focus.focus();
450
+ }
413
451
  }
414
452
  } else if (body.fresh) {
415
453
  // It changed or expired: the old card says so, and the fresh one is listed first to answer instead.
@@ -467,6 +505,7 @@
467
505
  if (dialogOpen()) {
468
506
  paint();
469
507
  if (!known) announce('1 more request from your terminal.');
508
+ else if (handedOver(got.p)) announce(`${got.p.title}: waiting for you.`);
470
509
  else if (got.p.state === 'done') announce(`${got.p.title}: done.`);
471
510
  // A notice the person set aside with × stays set aside; one that is showing is redrawn (or removed once nothing waits).
472
511
  } else if (!known || notice || known.p.state !== before) showNotice();
@@ -533,7 +572,9 @@
533
572
  const parts = [];
534
573
  if (going.length) parts.push(`${going.length} running`);
535
574
  if (open.length) parts.push(`${open.length} ${open.length === 1 ? 'needs' : 'need'} you`);
536
- if (ended.length) parts.push(`${ended.length} finished`);
575
+ const handed = ended.filter(handedOver).length;
576
+ if (handed) parts.push(`${handed} waiting for you`);
577
+ if (ended.length - handed) parts.push(`${ended.length - handed} finished`);
537
578
  text.textContent = `From your terminal: ${parts.join(' · ')}.`;
538
579
  } else if (open.length) {
539
580
  const head = one ? `Your terminal ${verbFor(one)} ${whatFor(one)}.` : `${open.length} requests from your terminal.`;
@@ -543,7 +584,7 @@
543
584
  text.textContent = going.length === 1 ? `Running what your terminal asked: ${String(going[0].summary || going[0].title || 'a request')}.` : `${going.length} requests from your terminal are running.`;
544
585
  target = going.length === 1 ? going[0] : null;
545
586
  } else {
546
- text.textContent = ended.length === 1 ? `${ended[0].state === 'done' ? 'Done' : 'Not done'}: ${String(ended[0].summary || ended[0].title || 'a request')}.` : `${ended.length} requests from your terminal have finished.`;
587
+ text.textContent = ended.length === 1 ? `${handedOver(ended[0]) ? 'Waiting for you' : ended[0].state === 'done' ? 'Done' : 'Not done'}: ${String(ended[0].summary || ended[0].title || 'a request')}.` : endedWords(ended);
547
588
  target = ended.length === 1 ? ended[0] : null;
548
589
  }
549
590
  const review = button('Review', 'shell.terminal-request-review', '', '', 'toast-action');