create-pmos 0.314.0 → 0.316.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.
Files changed (41) hide show
  1. package/package.json +1 -1
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-adddoc-test.js +3 -1
  7. package/workspace/briefing-premium-board-test.js +3 -1
  8. package/workspace/briefing-premium-calendar-2-test.js +3 -1
  9. package/workspace/briefing-premium-calendar-3-test.js +3 -1
  10. package/workspace/briefing-premium-calendar-test.js +3 -1
  11. package/workspace/briefing-premium-doc-edit-test.js +2 -2
  12. package/workspace/briefing-premium-initiative-test.js +3 -1
  13. package/workspace/briefing-premium-insights-test.js +3 -1
  14. package/workspace/briefing-premium-metrics-test.js +3 -1
  15. package/workspace/briefing-premium-sources-test.js +3 -1
  16. package/workspace/briefing-premium-test.js +3 -1
  17. package/workspace/briefing-premium-work-test.js +50 -36
  18. package/workspace/guide/briefing-premium.md +10 -8
  19. package/workspace/lib/briefing-premium-drafts.js +21 -1
  20. package/workspace/lib/headless.js +4 -2
  21. package/workspace/lib/my-work-premium.js +37 -23
  22. package/workspace/lib/orchestrator-checker.js +116 -0
  23. package/workspace/lib/orchestrator-health.js +5 -3
  24. package/workspace/lib/orchestrator-keeprate.js +104 -0
  25. package/workspace/lib/premium-console-type.js +71 -0
  26. package/workspace/lib/routes-orchestrator.js +7 -1
  27. package/workspace/package-lock.json +2 -2
  28. package/workspace/package.json +1 -1
  29. package/workspace/premium-welcome-test.js +4 -2
  30. package/workspace/premium-work-depth-test.js +21 -18
  31. package/workspace/public/pm/premium-insights.css +32 -31
  32. package/workspace/public/pm/premium-work.js +48 -49
  33. package/workspace/public/pm/premium.css +412 -394
  34. package/workspace/public/premium-work.html +16 -26
  35. package/workspace/server.js +43 -2
  36. package/workspace/skills/calendar-sync.skill +1 -0
  37. package/workspace/skills/jira-sync.skill +1 -0
  38. package/workspace/skills/morning-brief.skill +1 -0
  39. package/workspace/skills/my-work-read.skill +1 -0
  40. package/workspace/test-lists/agent-orchestrator-c.json +13 -0
  41. package/workspace/test-lists/premium-console-type.json +9 -0
@@ -2,12 +2,13 @@
2
2
  /* routes-orchestrator.js — the orchestrator's status and stop switch (initiative agent-orchestrator, PRD "Gates that stay yours").
3
3
  *
4
4
  * GET /api/orchestrator → { ok, stopped, mode, cap, allowed, reason, running, startedToday, settings, settingsProblem, backupDir, health: [{ id, level, text }] }
5
+ * GET /api/orchestrator/keep-rate → { ok, weeks: [{ week, decided, kept, returned, dropped, runs, keepRate, correctionRate }], types, pause }
5
6
  * POST /api/orchestrator/stop → { ok, stopped: true }
6
7
  * POST /api/orchestrator/resume → { ok, stopped: false }
7
8
  *
8
9
  * The GET changes nothing. Both POSTs pass pm-guard requirePagePress, and a request that carries an agent session header is refused
9
10
  * first: an agent cannot start the orchestrator again after the PM stopped it, and cannot stop it either. The stop switch is a file
10
- * (lib/orchestrator-ledger.js); the tick reads it before every start. `ctx.orchestrator` is { gate, running(), health() } from server.js. */
11
+ * (lib/orchestrator-ledger.js); the tick reads it before every start. `ctx.orchestrator` is { gate, running(), health(), keepRate() } from server.js. */
11
12
  const guard = require('./pm-guard.js');
12
13
  const actorLib = require('./actor.js');
13
14
 
@@ -23,6 +24,11 @@ async function handle(req, res, url, ctx) {
23
24
  if (req.method !== 'GET') return send(bad(405, 'GET only'));
24
25
  return send({ status: 200, body: { ok: true, ...o.gate.status({ running: o.running() }), health: o.health() } });
25
26
  }
27
+ if (sub === 'keep-rate') {
28
+ if (req.method !== 'GET') return send(bad(405, 'GET only'));
29
+ if (typeof o.keepRate !== 'function') return send(bad(503, 'the keep-rate report is not available here'));
30
+ return send({ status: 200, body: { ok: true, ...o.keepRate() } });
31
+ }
26
32
  if (sub !== 'stop' && sub !== 'resume') return send(bad(404, 'no such orchestrator route'));
27
33
  if (req.method !== 'POST') return send(bad(405, 'POST only'));
28
34
  const read = await ctx.readJson(req);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.314.0",
3
+ "version": "0.316.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.314.0",
9
+ "version": "0.316.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.314.0",
3
+ "version": "0.316.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -10,6 +10,8 @@ const os = require('os');
10
10
  const path = require('path');
11
11
  const { spawn, spawnSync } = require('child_process');
12
12
  const { findBrowser } = require('./lib/find-browser');
13
+ const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
14
+ const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
13
15
  const T = require('./test-run').configure({ name: 'premium-welcome' });
14
16
  const B = require('./lib/briefing-premium.js');
15
17
  const F = require('./fixtures/briefing-premium-facts.js');
@@ -187,7 +189,7 @@ const BRIEFING = { ok: true, items: [{ title: 'Refund reason codes needs an anch
187
189
  for (const [w, th] of [[1280, 'light'], [1280, 'dark'], [390, 'light'], [390, 'dark']]) {
188
190
  const A = await open({ w, h: w === 390 ? 800 : 900, theme: th, touch: w === 390 });
189
191
  await heading(A.page, /Welcome to PMOS/);
190
- await mp.close(); mp = await (await mkOf(w, th)).newPage(); await mp.goto('file://' + mockupFile); await mp.evaluate((t) => { document.documentElement.dataset.theme = t; }, th); await mp.waitForTimeout(500);
192
+ await mp.close(); mp = await (await mkOf(w, th)).newPage(); await mp.goto('file://' + mockupFile); await CT.applyToPage(mp, CT_VENDOR); await mp.evaluate((t) => { document.documentElement.dataset.theme = t; }, th); await mp.waitForTimeout(500);
191
193
  const diffs = [];
192
194
  for (const [name, sel, props] of CMP) { const a = await css(A.page, sel, props), m = await css(mp, sel, props); if (a !== m) diffs.push(`${name}: ${a} vs ${m}`); }
193
195
  ok(`R11 fidelity at ${w} px (${th}): About you keeps the mockup's type, radii, colours and sizes`, diffs.length === 0, diffs.join(' ; '));
@@ -199,7 +201,7 @@ const BRIEFING = { ok: true, items: [{ title: 'Refund reason codes needs an anch
199
201
  ok(`R11 at ${w} px (${th}) the three steps have no sideways scroll${w === 390 ? ' and every press is at least 44 px' : ''}`, scrolls.every((s) => s.scroll) && (w !== 390 || scrolls.every((s) => s.btn.length && s.btn.every((n) => n >= 43.5))), JSON.stringify(scrolls));
200
202
  if (w === 390) ok('R11 at 390 px the footer buttons stay at the bottom of the screen on the found step', foot[0] >= foot[1] - 2 && foot[0] <= foot[1] + 2, foot.join('/'));
201
203
  if (th === 'light' && w === 1280) {
202
- await mp.goto('file://' + mockupFile + '#found'); await mp.reload(); await mp.waitForTimeout(500);
204
+ await mp.goto('file://' + mockupFile + '#found'); await mp.reload(); await CT.applyToPage(mp, CT_VENDOR); await mp.waitForTimeout(500);
203
205
  const FCMP = [['a row', '.wl-ed .wl-row', ['display', 'gap', 'paddingLeft']], ['a row button', '.wl-ed .wgo', ['height', 'borderRadius', 'fontSize', 'fontWeight']], ['a section label', '.wl-sec', ['fontSize', 'letterSpacing', 'textTransform', 'color']], ['the defaults box', '.wl-def', ['borderRadius', 'borderTopStyle', 'paddingLeft']]];
204
206
  const d2 = [];
205
207
  for (const [name, sel, props] of FCMP) { const a = await css(A.page, sel, props), m = await css(mp, sel, props); if (a !== m) d2.push(`${name}: ${a} vs ${m}`); }
@@ -60,12 +60,15 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
60
60
  await page.route('**/api/pm-items/**', rec); await page.route('**/api/pm-jobs/**', rec); await page.route('**/api/my-work/**', rec);
61
61
  await page.route('**/api/briefing-premium/**', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, turns: [], working: false }) }));
62
62
  await page.goto(BASE + '/premium-work.html?theme=' + theme);
63
- const up = await until(() => page.evaluate(() => document.querySelectorAll('#plateBody .wrow').length > 0), 20000);
63
+ const up = await until(() => page.evaluate(() => document.querySelectorAll('#qBody .wrow').length > 0), 20000);
64
64
  return { ctx, page, errors, posts, up, replies, setModel: (m) => { current = m; }, refuse: (f) => { fail = f; }, last: () => posts[posts.length - 1] };
65
65
  };
66
66
  const dlgOn = (p) => until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
67
67
  const dlgOff = (p) => until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
68
- const openKey = async (p, key) => { await p.locator(`.wrow[data-key="${key}"] .wrh`).first().click(); await dlgOn(p); await sleep(700); };
68
+ /* the Work queue shows one tab at a time: bring up the tab that holds a row before pressing it (each press redraws the tab row, so the button is found again) */
69
+ const showKey = (p, key) => p.evaluate((key) => { const has = () => document.querySelector(`#qBody .wrow[data-key="${key}"], #waitBody .wrow[data-key="${key}"]`); if (has()) return true; for (const k of [...document.querySelectorAll('#qTabs .qtb')].map((b) => b.dataset.tab)) { document.querySelector(`#qTabs [data-tab="${k}"]`).click(); if (has()) return true; } return false; }, key);
70
+ const qTab = (p, k) => p.click(`#qTabs [data-tab="${k}"]`);
71
+ const openKey = async (p, key) => { await showKey(p, key); await p.locator(`.wrow[data-key="${key}"] .wrh`).first().click(); await dlgOn(p); await sleep(700); };
69
72
  const undoOf = async (p, direct) => { await until(() => p.evaluate(() => /Undo/.test(document.querySelector('#toast').textContent))); if (direct) { /* the Undo window is 8 s; on a loaded runner the real-server steps before this can outlast it, so press the button itself rather than race the toast's fade */ await p.evaluate(() => document.querySelector('#toast .undo').click()); } else await p.locator('#toast .undo').click(); await sleep(250); };
70
73
 
71
74
  const A = await open();
@@ -232,7 +235,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
232
235
  await R.ctx.close(); }
233
236
 
234
237
  /* W8 keys */
235
- await p.locator('#plateBody .wrow[data-key="work:item-bbbbbbbbbbb2"] .wrh').focus();
238
+ await showKey(p, 'work:item-bbbbbbbbbbb2'); await p.locator('#qBody .wrow[data-key="work:item-bbbbbbbbbbb2"] .wrh').focus();
236
239
  const desc = await p.evaluate(() => document.activeElement.getAttribute('aria-description'));
237
240
  ok('W8 a row names what the arrows do and that J and K move', /Right arrow: Done\. Left arrow: Tomorrow\. J and K move between rows\./.test(desc || ''), desc);
238
241
  await p.keyboard.press('j');
@@ -240,32 +243,32 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
240
243
  await p.keyboard.press('ArrowRight');
241
244
  ok('W8 Right arrow on a Today row posts done, with Undo', await wait(() => A.last().path === '/api/pm-items/done' && A.last().body.id === 'item-bbbbbbbbbbb2') && await until(() => p.evaluate(() => /Undo/.test(document.querySelector('#toast').textContent))), JSON.stringify(A.last()));
242
245
  await sleep(300);
243
- await p.locator('#plateBody .wrow[data-key="work:item-bbbbbbbbbbb2"] .wrh').focus(); await p.keyboard.press('ArrowLeft');
246
+ await showKey(p, 'work:item-bbbbbbbbbbb2'); await p.locator('#qBody .wrow[data-key="work:item-bbbbbbbbbbb2"] .wrh').focus(); await p.keyboard.press('ArrowLeft');
244
247
  ok('W8 Left arrow on a Today row puts it off to tomorrow (defer to the next day)', await wait(() => A.last().path === '/api/pm-items/defer' && A.last().body.id === 'item-bbbbbbbbbbb2' && A.last().body.until === '2026-10-17'), JSON.stringify(A.last()));
245
248
  await sleep(300);
246
- await p.locator('#plateBody .wrow[data-key="work:item-aaaaaaaaaaa1"] .wrh').focus(); await p.keyboard.press('ArrowRight');
249
+ await showKey(p, 'work:item-aaaaaaaaaaa1'); await p.locator('#qBody .wrow[data-key="work:item-aaaaaaaaaaa1"] .wrh').focus(); await p.keyboard.press('ArrowRight');
247
250
  ok('W8 Right arrow on an Inbox row moves it to Today (flag)', await wait(() => A.last().path === '/api/pm-items/flag' && A.last().body.id === 'item-aaaaaaaaaaa1' && A.last().body.flagged === true), JSON.stringify(A.last()));
248
251
  await sleep(300);
249
- await p.locator('#plateBody .wrow[data-key="work:item-aaaaaaaaaaa2"] .wrh').focus(); await p.keyboard.press('ArrowLeft');
252
+ await showKey(p, 'work:item-aaaaaaaaaaa2'); await p.locator('#qBody .wrow[data-key="work:item-aaaaaaaaaaa2"] .wrh').focus(); await p.keyboard.press('ArrowLeft');
250
253
  ok('W8 Left arrow on an Inbox row sends it to Someday', await wait(() => A.last().path === '/api/pm-items/someday' && A.last().body.id === 'item-aaaaaaaaaaa2'), JSON.stringify(A.last()));
251
254
  await sleep(300);
252
- const n2 = pc(); await p.locator('#plateBody .wrow[data-key="work:item-eeeeeeeeeee1"] .wrh').focus(); await p.keyboard.press('ArrowLeft'); await sleep(250);
255
+ const n2 = pc(); await showKey(p, 'work:item-eeeeeeeeeee1'); await p.locator('#qBody .wrow[data-key="work:item-eeeeeeeeeee1"] .wrh').focus(); await p.keyboard.press('ArrowLeft'); await sleep(250);
253
256
  ok('W8 a Someday row has no left action, and posts nothing', pc() === n2);
254
257
  await p.locator('#waitBody .wrh').first().focus(); await p.keyboard.press('ArrowRight'); await sleep(250);
255
258
  ok('W8 a Waiting row has no arrow actions, and posts nothing', pc() === n2);
256
- await p.locator('#plateBody .wrow[data-key="work:wbs:alpha:4.2"] .wrh').focus();
259
+ await showKey(p, 'work:wbs:alpha:4.2'); await p.locator('#qBody .wrow[data-key="work:wbs:alpha:4.2"] .wrh').focus();
257
260
  ok('W8 a Today row whose draft is ready offers Review on the right, not Done', /Right arrow: Review/.test(await p.evaluate(() => document.activeElement.getAttribute('aria-description'))));
258
261
  await p.keyboard.press('ArrowRight'); await dlgOn(p);
259
262
  ok('W8 …and Review opens the dialog without posting', pc() === n2 + 0 || A.last().path !== '/api/pm-items/done');
260
263
  await p.keyboard.press('Escape'); await dlgOff(p);
261
264
  { const r = await open(); const t = r.page;
262
- await t.locator('#trayBody .wrh').first().focus(); await t.keyboard.press('ArrowRight');
263
- ok('W8 the keys work on a tray row too (flag)', await until(() => r.last() && r.last().path === '/api/pm-items/flag' && r.last().body.id === 'item-aaaaaaaaaaa4'), JSON.stringify(r.last()));
265
+ await showKey(t, 'work:item-aaaaaaaaaaa4'); await t.locator('#qBody .wrow[data-key="work:item-aaaaaaaaaaa4"] .wrh').focus(); await t.keyboard.press('ArrowRight');
266
+ ok('W8 the keys work on a row you added too (flag)', await until(() => r.last() && r.last().path === '/api/pm-items/flag' && r.last().body.id === 'item-aaaaaaaaaaa4'), JSON.stringify(r.last()));
264
267
  await r.ctx.close(); }
265
268
 
266
269
  /* W8 swipe */
267
270
  const drag = async (pg, key, dx, hold = false) => {
268
- const loc = pg.locator(`#plateBody .wrow[data-key="${key}"] .wrh`); await loc.scrollIntoViewIfNeeded(); await sleep(150);
271
+ await showKey(pg, key); const loc = pg.locator(`#qBody .wrow[data-key="${key}"] .wrh`); await loc.evaluate((e) => e.scrollIntoView({ block: 'center' })); await sleep(150); // centred, so the Undo toast at the foot of the screen does not cover the row
269
272
  const b = await loc.boundingBox(); const y = b.y + b.height / 2, x = b.x + b.width / 2;
270
273
  await pg.mouse.move(x, y); await pg.mouse.down(); await pg.mouse.move(x + dx / 3, y, { steps: 4 }); await pg.mouse.move(x + dx, y, { steps: 6 });
271
274
  const seen = await pg.evaluate(() => { const rv = document.querySelector('.xrv'); return rv ? { text: rv.textContent.trim(), op: +getComputedStyle(rv).opacity, tr: getComputedStyle(rv.parentElement.querySelector('.wrow')).transform } : null; });
@@ -279,7 +282,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
279
282
  ok('W8 a drag of 50 px snaps back and posts nothing', r.posts.length === n3 && s2 && s2.op < 0.7, JSON.stringify([s2, r.posts.length - n3]));
280
283
  const s3 = await drag(t, 'work:item-bbbbbbbbbbb3', -130); await sleep(300);
281
284
  ok('W8 dragging left shows "Tomorrow" and posts defer to the next day', s3 && s3.text === 'Tomorrow' && await until(() => r.last().path === '/api/pm-items/defer' && r.last().body.until === '2026-10-17'), JSON.stringify([s3, r.last()]));
282
- const n4 = r.posts.length; await t.locator('#plateBody .wrow[data-key="work:item-aaaaaaaaaaa3"] .wrh').click(); await dlgOn(t);
285
+ const n4 = r.posts.length; await showKey(t, 'work:item-aaaaaaaaaaa3'); await t.locator('#qBody .wrow[data-key="work:item-aaaaaaaaaaa3"] .wrh').click(); await dlgOn(t);
283
286
  ok('W8 an ordinary click still opens the row and posts nothing', r.posts.length === n4);
284
287
  await r.ctx.close(); }
285
288
  { const r = await open({ rm: true }); const t = r.page;
@@ -310,7 +313,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
310
313
  }
311
314
  ok(`W12 at 390 px (${theme}) the edit, steps and Not before panels have no sideways scroll and every control is 44 px`, ['edit', 'steps', 'defer'].every((k) => !g[k].over && g[k].small.length === 0), JSON.stringify(g));
312
315
  await q2.keyboard.press('Escape'); await dlgOff(q2);
313
- await R.page.locator('#plateBody .wrow[data-key="work:wbs:alpha:4.2"] .wrh').click(); await dlgOn(q2); await sleep(500); await q2.click('#dTabs [data-t="chat"]'); await sleep(900);
316
+ await showKey(R.page, 'work:wbs:alpha:4.2'); await R.page.locator('#qBody .wrow[data-key="work:wbs:alpha:4.2"] .wrh').click(); await dlgOn(q2); await sleep(500); await q2.click('#dTabs [data-t="chat"]'); await sleep(900);
314
317
  const ag = await q2.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1 || document.querySelector('#dlg').scrollWidth > document.querySelector('#dlg').clientWidth + 1, small: [...document.querySelectorAll('.agblk button')].filter((b) => b.getBoundingClientRect().height < 43.5).map((b) => b.textContent.trim()) }));
315
318
  ok(`W12 at 390 px (${theme}) the agent block has no sideways scroll and its buttons are 44 px`, !ag.over && ag.small.length === 0, JSON.stringify(ag));
316
319
  await R.ctx.close();
@@ -335,7 +338,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
335
338
  await undoOf(pg, true); await sleep(300);
336
339
  it = (await get('/api/pm-items')).items.find((i) => i.id === it.id);
337
340
  ok('E3 Undo writes the old values back (the title the parser made, no day, P1)', it.title === 'Reply to Rina about SSO !' && !it.due && it.priority === 'P1', JSON.stringify(it));
338
- await pg.locator('#trayBody .wrh').first().click(); await dlgOn(pg); await sleep(700);
341
+ await pg.locator('#qBody .wrh').first().click(); await dlgOn(pg); await sleep(700);
339
342
  await more(pg); await pg.click('[data-p="xt"][data-k="steps"]');
340
343
  await pg.fill('#xsIn', 'Send the SSO plan to Rina'); await pg.click('[data-p="xsadd"]');
341
344
  ok('E4 a step is added through the real route', await until(async () => ((await get('/api/pm-items')).items.find((i) => i.id === it.id) || {}).steps && (await get('/api/pm-items')).items.find((i) => i.id === it.id).steps.length === 1, 8000));
@@ -349,16 +352,16 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
349
352
  await undoOf(pg, true); await sleep(300);
350
353
  it = (await get('/api/pm-items')).items.find((i) => i.id === it.id);
351
354
  ok('E7 Undo clears it', !it.defer, JSON.stringify(it));
352
- await pg.locator('.wrow, #trayBody .wrh').first().click({ trial: true }).catch(() => {});
353
- await pg.locator('#trayBody .wrh').first().click(); await dlgOn(pg); await sleep(700);
355
+ await pg.locator('.wrow, #qBody .wrh').first().click({ trial: true }).catch(() => {});
356
+ await pg.locator('#qBody .wrh').first().click(); await dlgOn(pg); await sleep(700);
354
357
  await more(pg); await pg.click('[data-p="xt"][data-k="someday"]'); await dlgOff(pg);
355
358
  ok('E8 Someday parks the real record', (await get('/api/pm-items')).work.someday.some((i) => i.id === it.id));
356
359
  await undoOf(pg, true); await sleep(300);
357
360
  ok('E9 Undo brings it back (unpark)', !(await get('/api/pm-items')).work.someday.some((i) => i.id === it.id));
358
- await pg.locator('#trayBody .wrh').first().click(); await dlgOn(pg); await sleep(700); await pg.click('[data-p="flag"]'); await dlgOff(pg);
361
+ await pg.locator('#qBody .wrh').first().click(); await dlgOn(pg); await sleep(700); await pg.click('[data-p="flag"]'); await dlgOff(pg);
359
362
  ok('E10 once the item is in Today, Focus suggests it and the bar says why', await until(() => pg.evaluate(() => /Suggested · /.test(document.querySelector('#xFocus').textContent)), 8000));
360
363
  await pg.click('#xFocus [data-xf="acc"]');
361
- ok('E11 Accept writes the group to today\'s Focus, and the Today row carries the Focus tag', await until(async () => (await get('/api/pm-items')).focus.accepted.length === 1, 8000) && await until(() => pg.evaluate(() => !!document.querySelector('#plateBody .xfc')), 8000));
364
+ ok('E11 Accept writes the group to today\'s Focus, and the Today row carries the Focus tag', await until(async () => (await get('/api/pm-items')).focus.accepted.length === 1, 8000) && (await qTab(pg, 'today'), await until(() => pg.evaluate(() => !!document.querySelector('#qBody .xfc')), 8000)));
362
365
  await pg.click('#xFocus [data-xf="more"]'); await dlgOn(pg); await sleep(500);
363
366
  await pg.fill('#xjIn', 'when a launch slips, I want the owner named, so the date holds'); await pg.click('[data-fx="jadd"]');
364
367
  ok('E12 Add a job writes it, and the dialog lists it with its open count', await until(async () => (await get('/api/pm-items')).jobs.length === 1, 8000) && await until(() => pg.evaluate(() => /the owner named/.test(document.querySelector('#oMain').textContent) && /0 open items/.test(document.querySelector('#oMain').textContent)), 8000));
@@ -1,3 +1,4 @@
1
+ :root{--fs-1:11px;--fs-2:12px;--fs-3:14px;--fs-4:16px;--fs-5:20px;--fs-6:28px}
1
2
  .ch.stuck{padding-block:12px;box-shadow:0 10px 24px -16px rgba(20,24,60,.3),inset 0 -1px 0 var(--hair)}
2
3
  .ch.stuck .ic{transform:scale(.8)}
3
4
  .ch.stuck small{opacity:0}
@@ -8,13 +9,13 @@
8
9
  }
9
10
  .cx{display:grid;gap:24px;align-content:start}
10
11
  .cx .label,.p-work .label{display:block;margin-bottom:8px}
11
- .lk{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;color:var(--ink-2);padding:6px 10px 6px 4px;border-radius:999px}
12
+ .lk{display:inline-flex;align-items:center;gap:6px;font-size:var(--fs-2);font-weight:600;color:var(--ink-2);padding:6px 10px 6px 4px;border-radius:999px}
12
13
  .lk:hover{color:var(--ink);background:var(--well)}
13
14
  .lk svg{width:15px;height:15px;transform:rotate(90deg)}
14
15
  .mt1{background:var(--well);border-radius:18px;padding:14px 16px 12px;display:grid;gap:2px;align-content:start;outline:0}
15
- .mt1 span{font-size:12.5px;color:var(--ink-3)}
16
- .mt1 b{font-size:28px;letter-spacing:-.03em;line-height:1.15}
17
- .mt1 em{font-style:normal;font-size:12.5px;color:var(--ink-3)}
16
+ .mt1 span{font-size:var(--fs-2);color:var(--ink-3)}
17
+ .mt1 b{font-size:var(--fs-5);letter-spacing:-.03em;line-height:1.15}
18
+ .mt1 em{font-style:normal;font-size:var(--fs-2);color:var(--ink-3)}
18
19
  .mt1.warn em{color:var(--ember-ink)}
19
20
  .mt1.bad em{color:var(--bad)}
20
21
  .mt1.ok em{color:var(--ok)}
@@ -43,46 +44,46 @@
43
44
  .spk.ok circle{fill:var(--ok)}
44
45
  .spk.warn circle{fill:var(--ember)}
45
46
  .spk.bad circle{fill:var(--bad)}
46
- .mhint{margin:2px 0 14px;color:var(--ink-2);font-size:12.5px;line-height:1.55;max-width:78ch}
47
+ .mhint{margin:2px 0 14px;color:var(--ink-2);font-size:var(--fs-2);line-height:1.55;max-width:78ch}
47
48
  .mhint b{color:var(--ink)}
48
49
  .mlab{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
49
- .mchip{font-style:normal;font-size:12.5px;font-weight:650;padding:2px 9px;border-radius:999px;background:var(--well);color:var(--ink-2)}
50
+ .mchip{font-style:normal;font-size:var(--fs-2);font-weight:600;padding:2px 9px;border-radius:999px;background:var(--well);color:var(--ink-2)}
50
51
  .mchip.ok{background:color-mix(in oklab,var(--ok) 14%,transparent);color:var(--ok)}
51
52
  .mchip.warn{background:color-mix(in oklab,var(--ember) 18%,transparent);color:var(--ember-ink)}
52
53
  .mt1.off{box-shadow:inset 0 0 0 1.5px color-mix(in oklab,var(--ember) 55%,transparent)}
53
- .mchg{font-size:12.5px;color:var(--ink-3);margin-top:2px}
54
+ .mchg{font-size:var(--fs-2);color:var(--ink-3);margin-top:2px}
54
55
  .mchg.bad{color:var(--ember-ink)}
55
- .mfoot{display:flex;justify-content:space-between;gap:8px;font:600 12.5px var(--mono);letter-spacing:.04em;text-transform:uppercase;color:var(--ink-3);margin-top:4px}
56
+ .mfoot{display:flex;justify-content:space-between;gap:8px;font:600 var(--fs-2) var(--mono);letter-spacing:.04em;text-transform:uppercase;color:var(--ink-3);margin-top:4px}
56
57
  .mfoot i{font-style:normal}
57
- .mfoot .tgl{text-transform:none;font-family:var(--sans);font-weight:550;letter-spacing:0;color:var(--ink-3)}
58
+ .mfoot .tgl{text-transform:none;font-family:var(--sans);font-weight:500;letter-spacing:0;color:var(--ink-3)}
58
59
  .mt1[data-op]{cursor:pointer;transition:transform .25s,box-shadow .25s}
59
60
  .mt1[data-op]:hover{transform:translateY(-2px)}
60
61
  #cIni .mprog{margin:0 0 10px}
61
62
  .ndh{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;flex-wrap:wrap}
62
- .ndh h2{margin:0;font-size:20px;font-weight:700;letter-spacing:-.01em}
63
- .ndh p{margin:4px 0 0;color:var(--ink-2);font-size:12.5px}
63
+ .ndh h2{margin:0;font-size:var(--fs-4);font-weight:600;letter-spacing:-.01em}
64
+ .ndh p{margin:4px 0 0;color:var(--ink-2);font-size:var(--fs-2)}
64
65
  .nact{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
65
66
  .nrow{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:14px 0 4px}
66
67
  .nrow .seg{margin:0}
67
68
  .ngrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:6px}
68
69
  .ntw{display:grid;gap:6px;align-content:start}
69
70
  .ntw .mt1{margin:0}
70
- .nbn{margin:0 0 -2px 4px;font-size:12.5px;font-weight:600;color:var(--ink-3)}
71
+ .nbn{margin:0 0 -2px 4px;font-size:var(--fs-2);font-weight:600;color:var(--ink-3)}
71
72
  .ntf{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-height:30px;padding-left:2px}
72
- .ntf .lk{font-size:12.5px}
73
+ .ntf .lk{font-size:var(--fs-2)}
73
74
  .nempty{display:grid;gap:10px;justify-items:start;padding:22px;border-radius:18px;background:var(--well)}
74
75
  .nempty p{margin:0;color:var(--ink-2)}
75
76
  .ngrp{margin-top:18px}
76
77
  .ngrp>.label{margin:0 0 6px 4px}
77
78
  .ncr .spk{width:104px;height:auto;display:block}
78
79
  .nsrc{display:inline-flex;align-items:center;gap:5px}
79
- .nsch{margin:14px 0 0;color:var(--ink-3);font-size:12.5px}
80
+ .nsch{margin:14px 0 0;color:var(--ink-3);font-size:var(--fs-2)}
80
81
  .dplist{display:grid;gap:6px}
81
82
  .dplist button{display:flex;align-items:center;justify-content:space-between;gap:12px;text-align:left;padding:12px 14px;border-radius:14px;background:var(--well)}
82
- .dplist button b{font-size:15px;font-weight:600}
83
- .dplist button small{color:var(--ink-3);display:block;font-weight:400;font-size:12.5px}
83
+ .dplist button b{font-size:var(--fs-3);font-weight:600}
84
+ .dplist button small{color:var(--ink-3);display:block;font-weight:400;font-size:var(--fs-2)}
84
85
  .dplist button[aria-pressed="true"]{box-shadow:inset 0 0 0 1.5px var(--ink)}
85
- .dplist button i{font-style:normal;font-size:12.5px;font-weight:650;color:var(--ink-2)}
86
+ .dplist button i{font-style:normal;font-size:var(--fs-2);font-weight:600;color:var(--ink-2)}
86
87
  @media (max-width:700px){
87
88
  .ngrid{grid-template-columns:minmax(0,1fr)}
88
89
  .ncr .spk{width:120px}
@@ -96,23 +97,23 @@
96
97
  .nfdot{width:9px;height:9px;border-radius:50%;margin-top:7px;background:var(--ink-3)}
97
98
  .nfd li.worse .nfdot,.nfd li.stuck .nfdot,.nfd li.off .nfdot{background:var(--ember)}
98
99
  .nfd li.closing .nfdot,.nfd li.reached .nfdot{background:var(--ok)}
99
- .nft{font-size:15px;line-height:1.5;color:var(--ink)}
100
+ .nft{font-size:var(--fs-3);line-height:1.5;color:var(--ink)}
100
101
  @media (max-width:700px){
101
102
  .nfd li{grid-template-columns:14px minmax(0,1fr)}
102
103
  }
103
104
  .nl{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:18px;align-items:start}
104
105
  .nlc,.nlr{min-width:0}
105
106
  .nhb{display:flex;align-items:center;gap:8px;margin-left:12px;flex-wrap:nowrap}
106
- .nhb .lk{font-size:12.5px;white-space:nowrap}
107
+ .nhb .lk{font-size:var(--fs-2);white-space:nowrap}
107
108
  .nrep .nhb{margin-left:auto}
108
- .ndt{margin:0;font-size:20px;font-weight:700;letter-spacing:-.01em;display:flex;align-items:center;gap:10px;flex-wrap:wrap}
109
+ .ndt{margin:0;font-size:var(--fs-4);font-weight:600;letter-spacing:-.01em;display:flex;align-items:center;gap:10px;flex-wrap:wrap}
109
110
  .ngl{margin:24px 0 8px 4px}
110
111
  .ndg{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
111
112
  .ndc{display:grid;gap:8px;align-content:start;text-align:left;padding:16px 18px;border-radius:18px;background:var(--well);transition:background .25s,transform .3s var(--spring)}
112
113
  .ndc:hover{background:color-mix(in oklab,var(--ink) 8%,var(--well));transform:translateY(-2px)}
113
- .ndc b{font-size:15px;display:flex;align-items:center;gap:8px}
114
+ .ndc b{font-size:var(--fs-3);display:flex;align-items:center;gap:8px}
114
115
  .ndm{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
115
- .ndm small{color:var(--ink-3);font-size:12.5px}
116
+ .ndm small{color:var(--ink-3);font-size:var(--fs-2)}
116
117
  .nrep .mhint{margin-bottom:10px}
117
118
  @media (max-width:999px){
118
119
  .nl{grid-template-columns:minmax(0,1fr)}
@@ -123,20 +124,20 @@
123
124
  .nrep .nhb{margin-left:0}
124
125
  }
125
126
  .ndh{margin-top:16px}
126
- .mnote{margin:6px 0 0 4px;font-size:12.5px;color:var(--ink-2)}
127
+ .mnote{margin:6px 0 0 4px;font-size:var(--fs-2);color:var(--ink-2)}
127
128
  .ntf .lk,.nfa .lk,.nhb .lk,.stx .lk,.stlh .lk,.stdone{min-height:44px;padding:0 10px}
128
129
  .nfd li{display:block;padding:0}
129
130
  .nfd li+li{border-top:1px solid var(--hair)}
130
131
  .nfr{display:grid;grid-template-columns:14px minmax(0,1fr) 18px;gap:10px;align-items:start;width:100%;text-align:left;padding:10px 6px;margin:0 -6px;border-radius:14px;min-height:44px;transition:background .2s}
131
132
  button.nfr:hover,button.nfr:focus-visible{background:color-mix(in oklab,var(--ink) 6%,transparent)}
132
133
  .ndc{gap:10px}
133
- .ndc b{display:flex;align-items:center;gap:8px;font-size:15px}
134
- .ndu{color:var(--ink-2);font-size:12.5px;line-height:1.4}
134
+ .ndc b{display:flex;align-items:center;gap:8px;font-size:var(--fs-3)}
135
+ .ndu{color:var(--ink-2);font-size:var(--fs-2);line-height:1.4}
135
136
  .ndsp{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
136
137
  .nsp{display:grid;gap:4px;min-width:0}
137
138
  .nsp svg{width:100%;height:30px;color:var(--ink-2)}
138
139
  .nsp.warn svg{color:var(--ember)}
139
- .nsp em{font-style:normal;font-size:12.5px;color:var(--ink-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
140
+ .nsp em{font-style:normal;font-size:var(--fs-2);color:var(--ink-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
140
141
  .ndm{display:flex;align-items:center;justify-content:space-between;gap:8px}
141
142
  .ndm small{color:var(--ink-3)}
142
143
  .ntf .lk,.nsch .lk{min-height:44px;display:inline-flex;align-items:center}
@@ -150,17 +151,17 @@ button.nfr:hover,button.nfr:focus-visible{background:color-mix(in oklab,var(--in
150
151
  .pdlist{display:grid;gap:6px}
151
152
  .pdrow{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 8px 8px 14px;border-radius:14px;background:var(--well)}
152
153
  .pdrow>span:first-child{min-width:0;display:grid;gap:2px}
153
- .pdrow b{font-size:15px;font-weight:600;overflow-wrap:anywhere}
154
- .pdrow small{color:var(--ink-3);font-size:12.5px}
154
+ .pdrow b{font-size:var(--fs-3);font-weight:600;overflow-wrap:anywhere}
155
+ .pdrow small{color:var(--ink-3);font-size:var(--fs-2)}
155
156
  .pdmv{display:flex;gap:4px;flex:none}
156
157
  .pdmv .round{width:44px;height:44px;color:var(--ink-2)}
157
158
  .pdmv .round:disabled{opacity:.35}
158
- .addf label.pdchk{display:flex;align-items:center;gap:10px;min-height:44px;font-size:15px;font-weight:550;color:var(--ink)}
159
+ .addf label.pdchk{display:flex;align-items:center;gap:10px;min-height:44px;font-size:var(--fs-3);font-weight:500;color:var(--ink)}
159
160
  .addf .pdchk input{width:22px;height:22px;flex:none;accent-color:var(--ember)}
160
161
  .nask{display:flex;gap:8px;margin:4px 0 0}
161
- .nask input{flex:1;min-width:0;height:44px;border-radius:14px;border:1px solid var(--hair);background:var(--card-solid);padding:0 12px;font:inherit;font-size:15px;color:var(--ink)}
162
+ .nask input{flex:1;min-width:0;height:44px;border-radius:14px;border:1px solid var(--hair);background:var(--card-solid);padding:0 12px;font:inherit;font-size:var(--fs-3);color:var(--ink)}
162
163
  .nask input:focus-visible{outline:2px solid var(--ember);outline-offset:1px}
163
- .nask-n{margin:6px 0 0 4px;font-size:12.5px}
164
+ .nask-n{margin:6px 0 0 4px;font-size:var(--fs-2)}
164
165
  .pdev{margin:0 0 12px;padding-left:18px;display:grid;gap:4px}
165
166
  .pdev small{color:var(--ink-3)}
166
167
  .dplist button[role="switch"]{min-height:44px;width:100%}
@@ -1,5 +1,5 @@
1
1
  /* pm/premium-work.js — the premium My work page (initiative briefing-premium-work, slice 4). Reads GET /api/my-work-premium and draws the model
2
- * lib/my-work-premium.js builds from the list the Work page reads: the hero, "On your plate", With agents, Waiting on others, the dock and the standard dialog.
2
+ * lib/my-work-premium.js builds from the list the Work page reads: the hero, the Work queue, Waiting on others, the dock and the standard dialog.
3
3
  * Every press goes to the Work page's own route under /api/pm-items, /api/pm-jobs or /api/my-work; this file adds no writer. A control with nothing honest to write stays off and says why.
4
4
  * My work depth (initiative premium-work-depth): the dialog's tool row (Edit, Who does each step, Not before, Someday), the Focus bar and its jobs, the agent on an item
5
5
  * (draft, stop, edit, post after a confirm, send back, try again), and keys and swipe on the rows. */
@@ -39,9 +39,9 @@ function drawHero() {
39
39
  }
40
40
  function drawDock() { $('#dN').textContent = M.dock.needs; $('#dLab').textContent = M.dock.needs === 0 ? 'to clear' : M.dock.label; $('#dNext').innerHTML = M.dock.next ? `<i></i>Next <b>${esc(M.dock.next)}</b>` : 'Nothing more on your list'; }
41
41
 
42
- /* ── the plate ─────────────────────────────────────────────────────────────────────────────────────────── */
42
+ /* ── the Work queue ─────────────────────────────────────────────────────────────────────────────────────── */
43
43
  function rowHtml(r, o = {}) {
44
- const inbox = r.list === 'inbox' || r.list === 'tray', sm = o.sm;
44
+ const inbox = r.list === 'inbox' || r.list === 'tray' || r.list === 'done', sm = o.sm;
45
45
  const sd = sm ? null : sideOf(r);
46
46
  const desc = sd ? ` aria-description="${esc((sd.r ? 'Right arrow: ' + sd.r.label + '. ' : '') + (sd.l ? 'Left arrow: ' + sd.l.label + '. ' : '') + 'J and K move between rows.')}"` : '';
47
47
  let lead;
@@ -55,49 +55,50 @@ function rowHtml(r, o = {}) {
55
55
  const sug = !sm && r.sug ? `<span class="wsg">${ICO('<path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/>')}<span><b>${esc(r.sug.b)}</b> ${esc(r.sug.t)}</span></span>` : '';
56
56
  return `<div class="wrw"><div class="wrow${sm ? ' sm' : ''}${inbox ? ' inb' : ''}${o.first ? ' first' : ''}" data-key="${esc(r.key)}">${lead}<button class="wrh" aria-haspopup="dialog"${desc}><span class="wtx"><span class="wtit">${esc(r.title)}${o.first ? '<em class="tgf">Do this first</em>' : ''}${r.focus ? '<em class="xfc">Focus</em>' : ''}</span><span class="ws">${esc(r.sub)}${esc(state)}</span>${sug}</span>${meta}</button></div></div>`;
57
57
  }
58
- function drawPlate() {
59
- const P = M.plate;
60
- $('#plateCap').innerHTML = `<b>${P.n}</b> to clear`;
61
- $('#plateNote').textContent = P.note;
62
- let h = '';
63
- for (const s of P.sections) {
64
- if (!s.n) {
65
- h += `<div class="wsec" data-lane="${s.key}"><span class="label">${esc(s.label)}</span><em>empty</em></div>` + (s.key === 'inbox' ? `<p class="empty3">${CHECK}Nothing waits to be sorted.</p>` : '<p class="empty3 plain">Nothing here.</p>');
66
- continue;
67
- }
68
- h += `<div class="wsec" data-lane="${s.key}"><span class="label">${esc(s.label)}</span><em>${s.n} open</em></div>`;
69
- const first = s.key === 'today' ? s.rows.find((r) => r.overdue) || null : null;
70
- h += s.rows.map((r) => rowHtml(r, { first: first && r.key === first.key })).join('');
71
- if (s.more) h += `<p class="note">${s.more} more ${s.more === 1 ? 'item is' : 'items are'} not shown here.</p>`;
72
- }
73
- $('#plateBody').innerHTML = h;
74
- }
75
- let shelfTab = null;
76
- function drawTray() {
77
- const T = M.tray, Sh = M.shelf;
78
- $('#trayCap').textContent = T.cap;
79
- const tabs = Sh.tabs;
80
- if (!shelfTab || !tabs.some((t) => t.key === shelfTab)) shelfTab = (tabs.find((t) => t.n) || tabs[0]).key;
81
- const cur = tabs.find((t) => t.key === shelfTab);
82
- $('#trayTabs').innerHTML = tabs.map((t) => `<button type="button" role="tab" class="stb" data-tab="${t.key}" aria-selected="${t.key === shelfTab}">${esc(t.label)} <b>${t.n}</b></button>`).join('');
83
- $('#trayBody').innerHTML = cur.rows.length ? cur.rows.map((r) => rowHtml(r)).join('') + (cur.more ? `<p class="note">${cur.more} more not shown here.</p>` : '') : `<p class="empty3 plain">${cur.key === 'place' ? 'Nothing in your tray. Add a line above and it lands here first.' : 'Nothing here.'}</p>`;
84
- $('#trayNote').textContent = T.note + ' ' + Sh.note;
85
- }
86
- $('#trayTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-tab]'); if (!b) return; shelfTab = b.dataset.tab; drawTray(); const n = $(`#trayTabs [data-tab="${shelfTab}"]`); if (n) n.focus(); });
87
- /* the three counts filter the list under them: a press shows one state, a second press on the same tile shows all again */
58
+ /* One card, one tab for each place a thing waits. A tab draws its groups in two columns; the Agents tab keeps the three counts, which filter its list. */
59
+ let qTab = null;
88
60
  const AG_TILES = [['running', 'Running'], ['failed', 'Failed'], ['ready', 'To review']];
89
61
  const AG_EMPTY = { running: 'No agent is running right now.', failed: 'No agent run has failed.', ready: 'No draft waits for your review.' };
62
+ const Q_EMPTY = { today: 'Nothing is placed for today.', inbox: 'Nothing waits to be sorted. Add a line above and it lands here first.', agents: 'No agent is working on your items.', upcoming: 'Nothing has a later date.', someday: 'Nothing is parked.', kept: 'Nothing kept yet.', done: 'Nothing done this week.' };
90
63
  let agTile = null;
91
- function drawAgents() {
92
- const A = M.agents, c = A.counts;
93
- $('#agCap').textContent = A.cap;
94
- if (agTile && !(A.by && A.by[agTile])) agTile = null;
95
- $('#pipe').innerHTML = AG_TILES.map(([k, label]) => `<button type="button" class="pst${agTile === k ? ' hot' : ''}" data-ag="${k}" aria-pressed="${agTile === k}" aria-controls="agl" title="${agTile === k ? 'Show every item again' : 'Show only the items that are ' + label.toLowerCase()}"><b>${c[k]}</b><span>${label}</span></button>`).join('');
96
- const g = agTile ? A.by[agTile] : null, rows = g ? g.rows : A.rows;
97
- $('#agl').innerHTML = rows.length ? rows.map((r) => rowHtml(r, { sm: 'ag' })).join('') + (g && g.more ? `<p class="note">${g.more} more not shown here.</p>` : '')
98
- : `<p class="empty3 plain">${g ? AG_EMPTY[agTile] : 'No agent is working on your items.'}</p>`;
99
- $('#agHold').textContent = A.hold;
64
+ function groupHtml(g, tab) {
65
+ const ag = tab === 'agents', first = tab === 'today' ? g.rows.find((r) => r.overdue) || null : null;
66
+ return g.rows.map((r) => rowHtml(r, { sm: ag ? 'ag' : undefined, first: first && r.key === first.key })).join('') + (g.more ? `<p class="note">${g.more} more ${g.more === 1 ? 'item is' : 'items are'} not shown here.</p>` : '');
67
+ }
68
+ function drawQueue() {
69
+ const Q = M.queue, tabs = Q.tabs;
70
+ if (!qTab || !tabs.some((t) => t.key === qTab)) qTab = Q.start;
71
+ const cur = tabs.find((t) => t.key === qTab);
72
+ $('#qCap').innerHTML = `<b>${Q.n}</b> to clear` + Q.cap.map((c) => ' · ' + esc(c)).join('');
73
+ $('#qTabs').innerHTML = tabs.map((t) => `<button type="button" role="tab" class="qtb" id="qt-${t.key}" data-tab="${t.key}" aria-selected="${t.key === qTab}" aria-controls="qBody" tabindex="${t.key === qTab ? 0 : -1}">${esc(t.label)}<em>${t.n}</em></button>`).join('');
74
+ $('#qBody').setAttribute('aria-labelledby', 'qt-' + qTab);
75
+ const pipe = $('#qPipe');
76
+ pipe.hidden = qTab !== 'agents';
77
+ let h = '';
78
+ if (qTab === 'agents') {
79
+ const c = cur.counts;
80
+ if (agTile && !(cur.by && cur.by[agTile])) agTile = null;
81
+ pipe.innerHTML = AG_TILES.map(([k, label]) => `<button type="button" class="pst${agTile === k ? ' hot' : ''}" data-ag="${k}" aria-pressed="${agTile === k}" aria-controls="qBody" title="${agTile === k ? 'Show every item again' : 'Show only the items that are ' + label.toLowerCase()}"><b>${c[k]}</b><span>${label}</span></button>`).join('');
82
+ const g = agTile ? cur.by[agTile] : cur.groups[0];
83
+ h = g.rows.length ? groupHtml(g, 'agents') : `<p class="empty3 plain">${agTile ? AG_EMPTY[agTile] : Q_EMPTY.agents}</p>`;
84
+ } else if (!cur.n) h = `<p class="empty3${qTab === 'inbox' ? '' : ' plain'}">${qTab === 'inbox' ? CHECK : ''}${Q_EMPTY[qTab]}</p>`;
85
+ else for (const g of cur.groups) {
86
+ if (cur.groups.length > 1) h += `<div class="wsec" data-lane="${g.key}"><span class="label">${esc(g.label)}</span><em>${g.n ? g.n + ' · ' + esc(g.hint) : 'empty'}</em></div>`;
87
+ h += groupHtml(g, qTab);
88
+ }
89
+ $('#qBody').innerHTML = h;
90
+ $('#qBody').dataset.tab = qTab;
91
+ $('#qNote').textContent = cur.note;
100
92
  }
93
+ $('#qTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-tab]'); if (!b) return; qTab = b.dataset.tab; drawQueue(); const n = $(`#qTabs [data-tab="${qTab}"]`); if (n) n.focus(); });
94
+ $('#qTabs').addEventListener('keydown', (e) => {
95
+ if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft' && e.key !== 'Home' && e.key !== 'End') return;
96
+ e.preventDefault();
97
+ const ks = M.queue.tabs.map((t) => t.key), i = ks.indexOf(qTab);
98
+ qTab = ks[e.key === 'Home' ? 0 : e.key === 'End' ? ks.length - 1 : (i + (e.key === 'ArrowRight' ? 1 : -1) + ks.length) % ks.length];
99
+ drawQueue(); $(`#qTabs [data-tab="${qTab}"]`).focus();
100
+ });
101
+ $('#qPipe').addEventListener('click', (e) => { const b = e.target.closest('[data-ag]'); if (!b) return; agTile = agTile === b.dataset.ag ? null : b.dataset.ag; drawQueue(); const n = $(`#qPipe [data-ag="${b.dataset.ag}"]`); if (n) n.focus(); });
101
102
  function drawWaiting() {
102
103
  const W = M.waiting;
103
104
  $('#waitCap').textContent = W.cap;
@@ -143,7 +144,7 @@ function drawWeek() {
143
144
  + (x && x.rows.length ? x.rows.map((r) => `<div class="ev src-meeting${r.past || (x.today && Date.parse(r.end || r.at) < Date.now()) ? ' wkpast' : ''}" role="listitem"><time>${esc(r.time)}</time><span class="gl-t"><svg class="i" viewBox="0 0 24 24"><rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/></svg></span><span><b>${esc(r.title)}</b><span class="d">${esc([r.sub, r.about].filter(Boolean).join(' · ') || 'No other people listed')}</span></span></div>`).join('') : '<div class="empty">No meetings.</div>');
144
145
  }
145
146
  $('#weekBody').addEventListener('click', (e) => { const b = e.target.closest('[data-day]'); if (!b || !M) return; wkPick = b.dataset.day; drawWeek(); });
146
- function draw() { drawHero(); drawWeek(); drawFriday(); drawFocus(); drawPlate(); drawTray(); drawAgents(); drawWaiting(); drawReview(); drawDock(); onScroll(); backFocus(); }
147
+ function draw() { drawHero(); drawWeek(); drawFriday(); drawFocus(); drawQueue(); drawWaiting(); drawReview(); drawDock(); onScroll(); backFocus(); }
147
148
  const rowOf = (key) => (M && M.rows || []).find((r) => r.key === key) || null;
148
149
 
149
150
  /* ── the dialog: detail first, the presses of the Work page, the tool row, the agent, the read-only agent beside it ─────────────────── */
@@ -529,11 +530,8 @@ document.addEventListener('click', async (e) => {
529
530
  });
530
531
 
531
532
  /* ── the list: a check marks done, a row opens its dialog, keys and swipe act on a row ───────────────────────────────────── */
532
- $('#plateBody').addEventListener('click', async (e) => { await listClick(e); });
533
- $('#agl').addEventListener('click', (e) => { listClick(e); });
534
- $('#pipe').addEventListener('click', (e) => { const b = e.target.closest('[data-ag]'); if (!b) return; agTile = agTile === b.dataset.ag ? null : b.dataset.ag; drawAgents(); const n = $(`#pipe [data-ag="${b.dataset.ag}"]`); if (n) n.focus(); });
533
+ $('#qBody').addEventListener('click', async (e) => { await listClick(e); });
535
534
  $('#waitBody').addEventListener('click', (e) => { listClick(e); });
536
- $('#trayBody').addEventListener('click', (e) => { listClick(e); });
537
535
  async function listClick(e) {
538
536
  const ck = e.target.closest('.wck');
539
537
  if (ck && ck.dataset.open) { openRow(rowOf(ck.dataset.open)); return; }
@@ -572,7 +570,7 @@ function backFocus() {
572
570
  const L = rowsIn(f.box), el = $(`${f.box} .wrow[data-key="${f.key}"] .wrh`) || L[Math.min(f.i, L.length - 1)];
573
571
  if (el) el.focus();
574
572
  }
575
- for (const box of ['#plateBody', '#trayBody']) {
573
+ for (const box of ['#qBody']) {
576
574
  const root = $(box);
577
575
  root.addEventListener('keydown', (e) => {
578
576
  const h = e.target.closest && e.target.closest('.wrh');
@@ -629,8 +627,9 @@ $('#cap').addEventListener('submit', async (e) => {
629
627
  if (!res || res.ok !== true) { $('#capHint').textContent = (res && res.error) || 'It was not added.'; return; }
630
628
  inp.value = '';
631
629
  const it = res.item || {};
630
+ if (!it.due) qTab = 'inbox'; // a line with no date waits in the inbox, so the queue opens there
632
631
  const bits = [it.due ? 'due ' + it.due : null, it.priority].filter(Boolean);
633
- $('#capHint').textContent = 'Added: ' + (it.title || line) + (bits.length ? ' (' + bits.join(', ') + ')' : '') + '. It is in your tray until you place it.';
632
+ $('#capHint').textContent = 'Added: ' + (it.title || line) + (bits.length ? ' (' + bits.join(', ') + ')' : '') + '. It is in your inbox until you place it.';
634
633
  await load();
635
634
  const fresh = it.id ? rowOf('work:' + it.id) : null; // a new item opens at once, so it can be placed
636
635
  if (fresh) openRow(fresh);