create-pmos 0.443.0 → 0.444.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 (56) hide show
  1. package/package.json +13 -13
  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-board-test.js +8 -2
  7. package/workspace/briefing-premium-insights-test.js +40 -38
  8. package/workspace/briefing-premium-test.js +2 -1
  9. package/workspace/changelog.json +12 -0
  10. package/workspace/goals-clear-ui-test.js +34 -20
  11. package/workspace/guide/home.md +5 -0
  12. package/workspace/intel-report-ui-test.js +1 -1
  13. package/workspace/lib/board-premium.js +1 -1
  14. package/workspace/lib/engine/boards.js +9 -2
  15. package/workspace/lib/routes-boards.js +40 -1
  16. package/workspace/live-pill-round-test.js +178 -0
  17. package/workspace/okr-goals-ui-test.js +21 -19
  18. package/workspace/package-lock.json +2 -2
  19. package/workspace/package.json +1 -1
  20. package/workspace/panels-test.js +231 -0
  21. package/workspace/premium-rec-tab-test.js +2 -1
  22. package/workspace/premium-vw-item-test.js +10 -2
  23. package/workspace/premium-vw-jira-test.js +3 -0
  24. package/workspace/public/pm/bd-ini-panel.js +3 -2
  25. package/workspace/public/pm/cozy-adler.js +21 -0
  26. package/workspace/public/pm/cozy-divider.css +32 -0
  27. package/workspace/public/pm/cozy-divider.js +45 -0
  28. package/workspace/public/pm/cozy-insights.css +14 -0
  29. package/workspace/public/pm/cozy-live-pill.css +16 -22
  30. package/workspace/public/pm/cozy-live-pill.js +28 -17
  31. package/workspace/public/pm/cozy-panels.css +59 -0
  32. package/workspace/public/pm/cozy-panels.js +524 -0
  33. package/workspace/public/pm/cozy-viewer.js +146 -70
  34. package/workspace/public/pm/goals-clear.js +9 -2
  35. package/workspace/public/pm/home-app.js +22 -11
  36. package/workspace/public/pm/home-ini.js +9 -3
  37. package/workspace/public/pm/home-today.js +4 -2
  38. package/workspace/public/pm/ini-edit.js +401 -0
  39. package/workspace/public/pm/ini-tasks.js +42 -18
  40. package/workspace/public/pm/ini-versions.js +18 -4
  41. package/workspace/public/pm/ini-view-model.js +8 -4
  42. package/workspace/public/pm/ini-view.css +88 -1
  43. package/workspace/public/pm/ini-view.js +42 -11
  44. package/workspace/public/pm/premium-board.js +8 -6
  45. package/workspace/public/pm/premium-insights.js +205 -43
  46. package/workspace/public/pm/task-card.css +2 -0
  47. package/workspace/public/pm/task-card.js +4 -1
  48. package/workspace/stage-card-tasks-test.js +396 -0
  49. package/workspace/stage-card-test.js +1 -1
  50. package/workspace/task-delete-test.js +9 -1
  51. package/workspace/task-milestones-test.js +3 -3
  52. package/workspace/task-press-test.js +12 -4
  53. package/workspace/task-views-test.js +8 -4
  54. package/workspace/test-lists/batch18-live-pill-round.json +10 -0
  55. package/workspace/test-lists/batch18-panels.json +9 -0
  56. package/workspace/test-lists/stage-card-tasks.json +6 -0
@@ -46,6 +46,9 @@
46
46
  * task-pin { task, pinned } the PM's pin on a milestone (feedback batch 13 item 4, XcalmA5Milestones):
47
47
  * true draws it on the Board timeline, false hides it, null goes back to the rule (only the initiative's last milestone).
48
48
  * `task` is a Board task, a breakdown item or a Jira key; the last line wins.
49
+ * task-order { initiative, section, tasks: [id] } the PM's order of the open tasks inside one stage of an
50
+ * initiative's breakdown (feedback batch 18 item 16, a drag in the stage list): the ids top to bottom. A task not named sorts after
51
+ * them. An empty list takes the order out (the urgency again). It never changes a task's status, dates or place; the last line wins.
49
52
  * ticket-dates { ref, start, due } the PM's own start and due days for a Jira ticket (feedback batch 11
50
53
  * item 23): kept in PMOS only, never written to Jira; '' clears one. They win over Jira's dates on the timeline; the last line wins.
51
54
  * ini-delete { id, title, tasks, items } the PM's Delete of an initiative (feedback batch 16 item 5d): it
@@ -171,7 +174,7 @@ function foundOf(f) {
171
174
  const sources = Array.isArray(f.sources) ? f.sources.filter((x) => x && typeof x.ref === 'string').slice(0, 8).map((x) => ({ label: String(x.label || ''), ref: x.ref })) : [];
172
175
  return { why: typeof f.why === 'string' ? f.why : '', sources, match: typeof f.match === 'string' && f.match ? f.match : null, scan: typeof f.scan === 'string' ? f.scan : null, run: typeof f.run === 'string' ? f.run : null };
173
176
  }
174
- const KINDS = new Set(['board', 'workflow', 'move', 'assign', 'ask', 'ask-accept', 'ask-decline', 'ask-more', 'ini-workflow', 'task', 'task-update', 'task-remove', 'task-restore', 'ticket-note', 'ini-epics', 'ini-archive', 'ini-notdup', 'ini-wf', 'ini-end', 'stage-judge', 'ini-auto', 'task-section', 'task-milestone', 'task-pin', 'ticket-dates',
177
+ const KINDS = new Set(['board', 'workflow', 'move', 'assign', 'ask', 'ask-accept', 'ask-decline', 'ask-more', 'ini-workflow', 'task', 'task-update', 'task-remove', 'task-restore', 'ticket-note', 'ini-epics', 'ini-archive', 'ini-notdup', 'ini-wf', 'ini-end', 'stage-judge', 'ini-auto', 'task-section', 'task-milestone', 'task-pin', 'ticket-dates', 'task-order',
175
178
  // split or merge initiatives (feedback batch 11 item 14): a Jira ticket moved to another initiative, the split and merge records with their Undo, Claude's suggestion dismissed
176
179
  'ticket-move', 'ini-split', 'ini-merge', 'ini-sm-undo', 'ini-suggest',
177
180
  // Delete an initiative with its tasks, and its Undo (feedback batch 16 item 5d)
@@ -206,6 +209,7 @@ function fold(events) {
206
209
  const tasks = new Map(); // task id → { id, board, initiative, title, epic, owner, state, start, due, at, by, history }
207
210
  const sections = new Map(); // task id → the stage key its breakdown section is ('' = Not in a stage); the last task-section line wins
208
211
  const milestones = new Map(); // task id (or Jira key) → true | false: the PM's milestone flag; the last task-milestone line wins
212
+ const orders = new Map(); // key(initiative, section) → the task ids in the PM's order inside that stage; the last task-order line wins
209
213
  const pins = new Map(); // task id (or Jira key) → true | false: the PM's pin on a milestone; a null line takes it out (the rule again)
210
214
  const removed = new Map(); // task id → the task a task-remove took out, so a task-restore (Delete's Undo) puts it back
211
215
  const ticketNotes = new Map(); // key(board, Jira key) → the PM's notes on that ticket (the last ticket-note line wins)
@@ -301,6 +305,9 @@ function fold(events) {
301
305
  sections.set(e.task, e.section);
302
306
  } else if (e.kind === 'task-milestone' && typeof e.task === 'string' && e.task && typeof e.milestone === 'boolean') {
303
307
  milestones.set(e.task, e.milestone);
308
+ } else if (e.kind === 'task-order' && typeof e.initiative === 'string' && e.initiative && typeof e.section === 'string' && Array.isArray(e.tasks)) {
309
+ const ids = e.tasks.filter((x) => typeof x === 'string' && x);
310
+ if (ids.length) orders.set(key(e.initiative, e.section), ids); else orders.delete(key(e.initiative, e.section));
304
311
  } else if (e.kind === 'task-pin' && typeof e.task === 'string' && e.task && (typeof e.pinned === 'boolean' || e.pinned === null)) {
305
312
  if (e.pinned === null) pins.delete(e.task); else pins.set(e.task, e.pinned);
306
313
  } else if (e.kind === 'ticket-dates' && b && typeof e.ref === 'string' && JIRA_KEY_RE.test(e.ref)) {
@@ -366,7 +373,7 @@ function fold(events) {
366
373
  suggestNo.set(e.id, { kind: e.of === 'merge' ? 'merge' : 'split', fp: e.fp, at: e.at || null });
367
374
  }
368
375
  }
369
- return { boards, moves, assigns, asks, stages, iniWorkflows, tasks, removed, sections, milestones, pins, ticketNotes, ticketDates, epics, archives, deleted, notDup, iniWf, ends, judged, autoOver, ticketMoves, smOps, smUndone, suggestNo, events: list };
376
+ return { boards, moves, assigns, asks, stages, iniWorkflows, tasks, removed, sections, orders, milestones, pins, ticketNotes, ticketDates, epics, archives, deleted, notDup, iniWf, ends, judged, autoOver, ticketMoves, smOps, smUndone, suggestNo, events: list };
370
377
  }
371
378
 
372
379
  /** The stages an initiative runs on a board: its own workflow when one is recorded, else the board's. */
@@ -24,7 +24,10 @@
24
24
  * POST /api/boards/settings { ws, board, buildDeliver?, jira?, offer?, defTpl? } → { ok, board } jira: one key or a list
25
25
  * POST /api/boards/ini-workflow { ws, board, id, template?, stages, moveTo? } → { ok, row, moved }
26
26
  * POST /api/boards/ini-epics { ws, board, id, epics: [Jira key] } → { ok, row } the Jira epics of an initiative ([] unlinks)
27
- * POST /api/boards/tasks/add { ws, board, initiative, title, type?, epic?, start?, due?, owner?, notes? } → { ok, item } also `pmos task add`
27
+ * POST /api/boards/tasks/add { ws, board, initiative, title, type?, epic?, start?, due?, owner?, notes?, section? } → { ok, item } also `pmos task add`
28
+ * (section: the stage it goes under, as tasks/edit's section: the + on a stage of the Tasks list, batch 18 item 16)
29
+ * POST /api/boards/tasks/order { ws, board, initiative, section, tasks: [id] } → { ok, from } the PM's order inside one stage (a drag in the
30
+ * Tasks list, batch 18 item 16): a task-order line; tasks [] takes the order out; Undo sends `from` back
28
31
  * POST /api/boards/tasks/state { ws, board, task, state } → { ok, item }
29
32
  * POST /api/boards/tasks/reschedule { ws, board, task, days } → { ok, item }
30
33
  * POST /api/boards/tasks/undo-add { ws, board, task } → { ok } takes back a task added in the last 2 minutes, still To do
@@ -549,6 +552,18 @@ function itemsOf(w, fr, board, rows) {
549
552
  // a task's place in the breakdown (one view): the PM's own choice, else the stage whose To finish entry made it
550
553
  const SEC = fr.folded.sections || new Map();
551
554
  for (const x of out) if (x.src === 'pmos' && x.kind !== 'Epic') { if (SEC.has(x.uid)) x.section = SEC.get(x.uid); else if (x.from && x.from.stage) x.section = x.from.stage; }
555
+ // the PM's order inside a stage (batch 18 item 16, task-order lines): rank = the place in its stage's list. A task named in two lists (it
556
+ // moved since) takes the list of the stage it sits in now
557
+ const OR = fr.folded.orders || new Map();
558
+ if (OR.size) {
559
+ const byIni = new Map();
560
+ for (const [k, ids] of OR) { const [ini, sec] = k.split('\u0000'); if (!byIni.has(ini)) byIni.set(ini, []); byIni.get(ini).push({ sec, ids }); }
561
+ for (const x of out) {
562
+ if (x.src !== 'pmos' || x.kind === 'Epic' || !byIni.has(x.ini)) continue;
563
+ const L = byIni.get(x.ini), hit = (typeof x.section === 'string' && L.find((o) => o.sec === x.section && o.ids.includes(x.uid))) || L.find((o) => o.ids.includes(x.uid));
564
+ if (hit) x.rank = hit.ids.indexOf(x.uid);
565
+ }
566
+ }
552
567
  // a task flagged as a milestone (feedback batch 11 item 3): the PM's flag on the board ledger, else a breakdown item's own plan-items flag
553
568
  const MS = fr.folded.milestones || new Map();
554
569
  for (const x of out) if (x.kind !== 'Epic') { const on = MS.has(x.uid) ? MS.get(x.uid) : !!x.milestone; if (on) x.milestone = true; else delete x.milestone; }
@@ -1139,14 +1154,38 @@ const WRITES = {
1139
1154
  if (!base) return;
1140
1155
  const b0 = base.find((r) => r.id === body.initiative);
1141
1156
  if (!b0 || boardIdOf(b0, p.fr.boards, p.fr.folded, p.w) !== p.board.id) return fail(ctx, res, 404, `no initiative ${body.initiative} on this board`);
1157
+ // the + on a stage of the Tasks list (batch 18 item 16): the task goes under that stage
1158
+ if (body.section != null) {
1159
+ if (typeof body.section !== 'string' || body.section.length > 80) return fail(ctx, res, 400, "section is a stage key of the initiative's workflow, or '' for Not in a stage");
1160
+ const st = boardRow(p.board, b0, p.fr.folded).wfStages || [];
1161
+ if (body.section && !st.some((x) => x.key === body.section)) return fail(ctx, res, 400, `"${body.section}" is not a stage of this initiative's workflow: one of ${st.map((x) => x.key).join(', ')}, or ''`);
1162
+ }
1142
1163
  const id = `task-${crypto.randomBytes(5).toString('hex')}`;
1143
1164
  const start = body.start || (body.due && body.due < B.shiftDay(today(), 1) ? body.due : B.shiftDay(today(), 1));
1144
1165
  const due = body.due || B.shiftDay(start, 7);
1145
1166
  append(p.file, g.actor, { kind: 'task', board: p.board.id, task: id, type: body.type || 'Task', initiative: body.initiative, title: body.title.trim(), epic: body.epic ? String(body.epic).trim() : null,
1146
1167
  owner: body.owner ? String(body.owner).trim() : actorLib.pageName(g.actor.by), state: 'To do', start, due, ...(body.notes && body.notes.trim() ? { notes: body.notes.replace(/\s+$/, '') } : {}) });
1168
+ if (typeof body.section === 'string') append(p.file, g.actor, { kind: 'task-section', board: p.board.id, task: id, section: body.section, why: body.section ? 'placed under ' + body.section : 'placed under no stage' });
1147
1169
  const t = B.taskOf(B.fold(readLedger(ctx, p.w)), id);
1148
1170
  ctx.json(res, { ok: true, item: B.rollupItems([B.taskItem(t)])[0] });
1149
1171
  },
1172
+ '/api/boards/tasks/order': (ctx, res, body, g) => {
1173
+ // the PM's order inside one stage (batch 18 item 16): a drag in the Tasks list writes the stage's open tasks top to bottom; [] takes it out
1174
+ const p = postFrame(ctx, res, body);
1175
+ if (!p) return;
1176
+ if (typeof body.initiative !== 'string' || !body.initiative) return fail(ctx, res, 400, 'initiative is required');
1177
+ if (typeof body.section !== 'string' || body.section.length > 80) return fail(ctx, res, 400, "section is a stage key of the initiative's workflow, or '' for Not in a stage");
1178
+ if (!Array.isArray(body.tasks) || body.tasks.length > 500 || body.tasks.some((x) => typeof x !== 'string' || !x || x.length > 120)) return fail(ctx, res, 400, 'tasks is a list of at most 500 task ids, top to bottom');
1179
+ if (!p.file) return fail(ctx, res, 409, NO_STATE);
1180
+ const base = needRows(ctx, res, p.w);
1181
+ if (!base) return;
1182
+ const b0 = base.find((r) => r.id === body.initiative);
1183
+ if (!b0 || boardIdOf(b0, p.fr.boards, p.fr.folded, p.w) !== p.board.id) return fail(ctx, res, 404, `no initiative ${body.initiative} on this board`);
1184
+ const O0 = p.fr.folded.orders || new Map(), from = O0.get(body.initiative + '\u0000' + body.section) || [];
1185
+ const tasks = [...new Set(body.tasks)];
1186
+ append(p.file, g.actor, { kind: 'task-order', board: p.board.id, initiative: body.initiative, section: body.section, tasks, why: tasks.length ? 'reordered under ' + (body.section || 'no stage') : 'order taken out' });
1187
+ ctx.json(res, { ok: true, from });
1188
+ },
1150
1189
  '/api/boards/tasks/state': (ctx, res, body, g) => {
1151
1190
  const p = postFrame(ctx, res, body);
1152
1191
  if (!p) return;
@@ -0,0 +1,178 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* live-pill-round-test.js — the Live pill as a round number, the panel divider's look and the list head's fold (feedback batch 18 item 15,
4
+ * slice 15-B; canvas TbT1Split, TbT4Off, TbT9Divider; brief next18/briefs/15-arrange-panels-build.md rules 9 to 11). The real pages from the
5
+ * real server; GET /api/live is answered by the suite, so the pill's state is the suite's.
6
+ * L1 nothing live: no pill · L2 the pill is a 44 px round button stacked above the menu button, with the number of live items and no marks
7
+ * L3 Claude asks: blue with a glow · L4 with the panels engine a press goes to czPanels.slideOver(item) · L6 false from it: today's open
8
+ * L5 the open menu hides the pill · V1 the first divider wears the sprout, the others only the handle · V2 the day's charm replaces the
9
+ * sprout, fitted to its box · V3 Settings > Adler > Off: the handle only · F1 Home's list head folds the list, and the button brings it back
10
+ * F2 a phone: no fold · every page: no page error
11
+ * PMOS_SHOTS=<dir> also saves the screenshots. */
12
+ const path = require('path');
13
+ const fs = require('fs');
14
+ const { spawn } = require('child_process');
15
+ const { findBrowser } = require('./lib/find-browser');
16
+ const T = require('./test-run').configure({ name: 'live-pill-round' });
17
+
18
+ const BASE = T.BASE;
19
+ const SHOTS = process.env.PMOS_SHOTS || '';
20
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
21
+ const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
22
+ const results = [];
23
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
24
+ let srv = null; let browser = null;
25
+ const finish = async (code) => {
26
+ if (browser) await browser.close().catch(() => {});
27
+ if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
28
+ T.killTmux();
29
+ const bad = results.filter((x) => !x.cond).length;
30
+ console.log(`\n${results.length - bad}/${results.length} live-pill-round assertions passed`);
31
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
32
+ };
33
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
34
+
35
+ const min = (n) => new Date(Date.now() - n * 60000).toISOString();
36
+ const RUNNING = () => [
37
+ { id: 'a', name: 'chat: Draft CIAM tender workflow', shown: 'working', created: min(90), touched_at: min(4), origin: 'chat:init:tender' },
38
+ { id: 'd', name: 'List migration tasks', shown: 'working', created: min(200), touched_at: min(25) },
39
+ ];
40
+ const ASKS = () => RUNNING().concat([{ id: 'b', name: 'Redistribute plan items', shown: 'needs', created: min(80), touched_at: min(1), initiative: 'tender' }]);
41
+
42
+ (async () => {
43
+ const exe = process.env.PMOS_CHROME || findBrowser();
44
+ if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the live-pill-round suite cannot run'); return finish(1); }
45
+ let chromium;
46
+ try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
47
+ srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
48
+ await T.waitForServer(BASE);
49
+ browser = await chromium.launch({ executablePath: exe });
50
+ if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
51
+ const shot = async (page, name) => { if (SHOTS) { await sleep(300); await page.screenshot({ path: path.join(SHOTS, name + '.png') }); } };
52
+
53
+ const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
54
+ let live = [];
55
+ await ctx.route('**/api/live', (r) => r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ ok: true, sessions: live, titles: { tender: 'Tender new CIAM' } }) }));
56
+ const page = await ctx.newPage();
57
+ const errors = [];
58
+ page.on('pageerror', (e) => errors.push(String(e)));
59
+ const kick = () => page.evaluate(() => document.dispatchEvent(new Event('cz:live')));
60
+
61
+ /* L1 */
62
+ await page.goto(BASE + '/premium-board.html');
63
+ await until(() => page.evaluate(() => !!document.getElementById('czLive')), 30000);
64
+ await sleep(500);
65
+ ok('L1 nothing live: no pill (zero is silence)', await page.evaluate(() => document.getElementById('czLive').hidden));
66
+
67
+ /* L2 */
68
+ live = RUNNING(); await kick();
69
+ const l2 = await until(() => page.evaluate(() => {
70
+ const l = document.getElementById('czLive'), f = document.getElementById('czFab'); if (!l || l.hidden) return null;
71
+ const a = l.getBoundingClientRect(), b = f.getBoundingClientRect();
72
+ return { text: l.textContent.trim(), w: Math.round(a.width), h: Math.round(a.height), round: getComputedStyle(l).borderRadius, marks: l.querySelectorAll('.lv-m').length,
73
+ above: a.bottom <= b.top, centred: Math.abs((a.left + a.width / 2) - (b.left + b.width / 2)) <= 1, label: l.getAttribute('aria-label'), asks: l.classList.contains('asks') };
74
+ }));
75
+ ok('L2 the pill shows the number of live items and no marks', l2 && l2.text === '2' && l2.marks === 0 && !l2.asks, JSON.stringify(l2));
76
+ ok('L2 it is a 44 px round button, stacked above the menu button on its centre line', l2 && l2.w === 44 && l2.h === 44 && l2.round === '50%' && l2.above && l2.centred, JSON.stringify(l2));
77
+ ok('L2 its name still says what it holds and its key', l2 && /^What you work on now: 2 running\. Open \(Ctrl J\)$/.test(l2.label), l2 && l2.label);
78
+ await shot(page, 'pill-running');
79
+
80
+ /* L3 */
81
+ live = ASKS(); await kick();
82
+ const l3 = await until(() => page.evaluate(() => { const l = document.getElementById('czLive'); return l && l.classList.contains('asks') ? { text: l.textContent.trim(), bg: getComputedStyle(l).backgroundColor, card: getComputedStyle(document.body).getPropertyValue('--cz-card') } : null; }));
83
+ ok('L3 Claude asks: the pill turns blue, with the count', l3 && l3.text === '3' && !/255, 255, 255/.test(l3.bg), JSON.stringify(l3));
84
+ await shot(page, 'pill-asks');
85
+
86
+ /* L4 */
87
+ await page.click('#czLive');
88
+ const rows = await until(() => page.evaluate(() => { const r = [...document.querySelectorAll('#czLiveList a[data-lv]')]; return r.length ? r.length : null; }));
89
+ ok('L4 the list opens with its rows (the panels engine drags a[data-lv] to an edge)', rows === 3, String(rows));
90
+ await shot(page, 'pill-list');
91
+ await page.evaluate(() => { window.__slid = []; window.czPanels = { slideOver: (x) => window.__slid.push(x), list: () => [] }; });
92
+ const before = page.url();
93
+ await page.click('#czLiveList a[data-lv="s:b"]');
94
+ const l4 = await until(() => page.evaluate(() => (window.__slid && window.__slid.length ? { id: window.__slid[0].id, sid: window.__slid[0].sid, open: !document.getElementById('czLiveList').hidden } : null)));
95
+ ok('L4 with the panels engine, a row goes to czPanels.slideOver(item) and the list closes; the page stays', l4 && l4.id === 's:b' && l4.sid === 'b' && !l4.open && page.url() === before, JSON.stringify(l4));
96
+ await page.evaluate(() => { delete window.czPanels; });
97
+
98
+ /* L5 */
99
+ await page.click('#czFab');
100
+ ok('L5 the open menu takes the place above the menu button: the pill hides', await until(() => page.evaluate(() => getComputedStyle(document.getElementById('czLive')).visibility === 'hidden')));
101
+ await page.keyboard.press('Escape');
102
+ await page.evaluate(() => { const m = document.getElementById('czMenu'); if (m && !m.hidden) document.getElementById('czFab').click(); });
103
+
104
+ /* V1–V3: the divider, mounted the way the engine mounts it */
105
+ const v1 = await page.evaluate(async () => {
106
+ const D = await import('/pm/cozy-divider.js'), A = await import('/pm/cozy-adler.js');
107
+ A.setPrefs({ 'adler.amount': 'full' }); A.setDress(null);
108
+ const box = document.createElement('div'); box.id = 'dvTest'; box.style.cssText = 'position:fixed;left:200px;top:100px;width:600px;height:400px;display:flex;gap:12px;z-index:99';
109
+ // as cozy-panels.js mounts it: a 0-wide separator, and the look inside a wrapper centred on it
110
+ const div = (first) => `<div class="cz-pn-div" role="separator" tabindex="0" style="position:relative;width:0;margin:0 -6px"><span class="cz-pn-in" style="position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)">${D.dividerHtml({ first })}</span></div>`;
111
+ box.innerHTML = `<div style="flex:1;background:var(--cz-card)"></div>${div(true)}<div style="flex:1;background:var(--cz-card)"></div>${div(false)}<div style="flex:1;background:var(--cz-card)"></div>`;
112
+ document.body.appendChild(box);
113
+ await new Promise((r) => setTimeout(r, 300));
114
+ const [a, b] = box.querySelectorAll('.cz-pn-div'), hd = a.querySelector('.cz-dv-hd').getBoundingClientRect(), dv = a.getBoundingClientRect();
115
+ const sp = a.querySelector('.cz-dv-top .cz-dv-sp'), spr = sp && sp.getBoundingClientRect();
116
+ return { dots: a.querySelectorAll('.cz-dv-hd b').length, sprout: !!sp, second: !b.querySelector('.cz-dv-top'), hidden: a.querySelector('.cz-dv-top').getAttribute('aria-hidden'),
117
+ centred: Math.abs((hd.left + hd.width / 2) - (dv.left + dv.width / 2)) <= 1 && Math.abs((hd.top + hd.height / 2) - (dv.top + dv.height / 2)) <= 1,
118
+ onTop: !!spr && spr.bottom <= hd.top + 1 && Math.abs((spr.left + spr.width / 2) - (hd.left + hd.width / 2)) <= 2, face: !!a.querySelector('.ad-face') };
119
+ });
120
+ ok('V1 the first divider: a handle with 3 dots in its middle, and Adler\'s sprout on top (never his face)', v1.dots === 3 && v1.sprout && v1.centred && v1.onTop && !v1.face && v1.hidden === 'true', JSON.stringify(v1));
121
+ ok('V1 any other divider: the handle only', v1.second, JSON.stringify(v1));
122
+ const hov = await page.evaluate(async () => { const a = document.querySelector('#dvTest .cz-pn-div'), hd = a.querySelector('.cz-dv-hd'); const rest = getComputedStyle(hd).backgroundColor; a.classList.add('hov'); await new Promise((r) => setTimeout(r, 250)); const on = getComputedStyle(hd).backgroundColor; const lf = getComputedStyle(a.querySelector('.cz-dv-lf.l1')).transform; a.classList.remove('hov'); a.classList.add('drag'); await new Promise((r) => setTimeout(r, 300)); const lean = getComputedStyle(a.querySelector('.cz-dv-sp')).transform; a.classList.remove('drag'); return { rest, on, lf, lean }; });
123
+ ok('V1 hover turns the handle blue and opens the leaves; a drag leans the sprout (the engine draws the line)', hov.rest !== hov.on && hov.lf !== 'none' && hov.lean !== 'none', JSON.stringify(hov));
124
+ await page.evaluate(() => document.querySelector('#dvTest .cz-pn-div').classList.add('hov'));
125
+ await shot(page, 'divider-sprout-hover');
126
+ await page.evaluate(() => document.querySelector('#dvTest .cz-pn-div').classList.remove('hov'));
127
+ const v2 = await page.evaluate(async () => {
128
+ const A = await import('/pm/cozy-adler.js');
129
+ A.setDress({ key: 'deepavali', name: 'Deepavali' });
130
+ await new Promise((r) => setTimeout(r, 300));
131
+ const t = document.querySelector('#dvTest .cz-dv-top'), s = t.querySelector('.cz-dv-ch svg');
132
+ return { charm: t.querySelector('.cz-dv-ch') && t.querySelector('.cz-dv-ch').dataset.charm, sprout: !!t.querySelector('.cz-dv-sp'), fitted: !!s && !s.hasAttribute('data-ad-fit'), box: s && s.getAttribute('viewBox'), w: s && Math.round(s.getBoundingClientRect().width), second: !document.querySelectorAll('#dvTest .cz-pn-div')[1].querySelector('.cz-dv-top') };
133
+ });
134
+ ok('V2 the day\'s charm (Deepavali) sits there instead of the sprout, fitted to its 26 px box, first divider only', v2.charm === 'deepavali' && !v2.sprout && v2.fitted && v2.w === 26 && v2.second, JSON.stringify(v2));
135
+ await shot(page, 'divider-charm');
136
+ const v3 = await page.evaluate(async () => {
137
+ const A = await import('/pm/cozy-adler.js');
138
+ A.setPrefs({ 'adler.amount': 'face' }); await new Promise((r) => setTimeout(r, 100));
139
+ const face = { sprout: !!document.querySelector('#dvTest .cz-dv-sp'), charm: !!document.querySelector('#dvTest .cz-dv-ch') };
140
+ A.setPrefs({ 'adler.amount': 'off' }); await new Promise((r) => setTimeout(r, 100));
141
+ const off = document.querySelector('#dvTest .cz-dv-top').innerHTML === '' && document.querySelectorAll('#dvTest .cz-dv-hd').length === 2;
142
+ A.setPrefs({ 'adler.amount': 'full' }); A.setDress(null); document.getElementById('dvTest').remove();
143
+ return { face, off };
144
+ });
145
+ ok('V3 Settings > Adler > Face only: the sprout, no charm; Off: the handle only', v3.face.sprout && !v3.face.charm && v3.off, JSON.stringify(v3));
146
+
147
+ /* L6 */
148
+ await page.evaluate(() => { window.czPanels = { slideOver: () => false, list: () => [] }; });
149
+ await page.click('#czLive');
150
+ await until(() => page.$('#czLiveList a[data-lv="s:b"]'));
151
+ await Promise.all([page.waitForURL(/premium\.html\?session=b/, { timeout: 15000 }).catch(() => null), page.click('#czLiveList a[data-lv="s:b"]')]);
152
+ ok('L6 czPanels.slideOver(item) gives false (it did nothing): the row opens as today', /premium\.html\?session=b/.test(page.url()), page.url());
153
+
154
+ /* F1 */
155
+ await page.goto(BASE + '/premium.html');
156
+ const f1 = await until(() => page.evaluate(() => { const b = document.querySelector('#hmList .hm-hd [data-hm-fold]'); return b ? { label: b.getAttribute('aria-label'), title: b.title, text: b.textContent.trim(), svg: !!b.querySelector('svg') } : null; }), 30000);
157
+ ok('F1 the list head has an icon-only fold, named and with a tooltip', f1 && f1.label === 'Fold the list to the rail' && f1.title === f1.label && !f1.text && f1.svg, JSON.stringify(f1));
158
+ await shot(page, 'home-fold');
159
+ await page.click('#hmList .hm-hd [data-hm-fold]');
160
+ ok('F1 with no Viewer open, the press folds the list away', await until(() => page.evaluate(() => document.body.classList.contains('hm-folded') && getComputedStyle(document.querySelector('#hmList')).display === 'none')));
161
+ await page.click('#hmUnfold');
162
+ ok('F1 the button at the top left brings it back', await until(() => page.evaluate(() => !document.body.classList.contains('hm-folded') && !!document.querySelector('#hmList .hm-hd [data-hm-fold]'))));
163
+ ok('every page: no page error', errors.length === 0, errors.join(' | '));
164
+
165
+ /* F2 */
166
+ const pctx = await browser.newContext({ viewport: { width: 390, height: 844 }, hasTouch: true, isMobile: true });
167
+ await pctx.route('**/api/live', (r) => r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ ok: true, sessions: ASKS(), titles: {} }) }));
168
+ const ph = await pctx.newPage();
169
+ await ph.goto(BASE + '/premium-board.html');
170
+ const f2 = await until(() => ph.evaluate(() => { const l = document.getElementById('czLive'), f = document.getElementById('czFab'); if (!l || l.hidden) return null; const a = l.getBoundingClientRect(), b = f.getBoundingClientRect(); return { above: a.bottom <= b.top, right: Math.abs((a.left + a.width / 2) - (b.left + b.width / 2)) <= 1, w: Math.round(a.width), text: l.textContent.trim() }; }), 30000);
171
+ ok('F2 a phone: the round pill stacks above the menu button at the bottom right', f2 && f2.above && f2.right && f2.w === 44 && f2.text === '3', JSON.stringify(f2));
172
+ await shot(ph, 'phone-pill');
173
+ await ph.goto(BASE + '/premium.html');
174
+ await until(() => ph.evaluate(() => !!document.querySelector('#hmList .hm-hd')), 30000);
175
+ ok('F2 a phone has no rail, so no fold', await ph.evaluate(() => !document.querySelector('[data-hm-fold]')));
176
+ await pctx.close();
177
+ await finish();
178
+ })();
@@ -4,14 +4,14 @@
4
4
  * GsMetrics, GsMetricsTree, GsNotify). Serves the real page from the real server; GET /api/insights-premium answers the model lib/insights-premium.js
5
5
  * builds from its fixture, with the fields lib/goal-status.js adds (reading, recipe, who, notify, was, history, defn, okr) set on some goals, and
6
6
  * GET /api/metric-drafts answers drafts that sit under their goal. The write routes are stubbed here so each press can be read back.
7
- * L the list: the ✦ line, the North Star, Key results, Health budgets, in that order; a row is a dot, the outcome, its reading and age, and the
8
- * owner, with no sparkline and no initiative status; a goal with no reading has a hollow dot
7
+ * L the dashboard (re-pointed, batch 18 item 11 gap: Iq8Overview with GcJ2FirstMonday): the ✦ line, the North Star card, Key results, Health
8
+ * budgets, in that order; a row is the outcome, Now of target, So far, By its date and Moved by; a goal with no reading shows a dash
9
9
  * D a draft sits under the row it repairs with ✕ / ✎ / ✓; ✓✓ in the ✦ line keeps them all; ✓ posts the row; the ✦ line never says "no insight"
10
- * R a broken limit turns the ✦ line red (the one time) and pulses that row's dot
10
+ * R a broken limit turns the ✦ line red (the one time) and pulses the North Star's dot
11
11
  * V the goal Viewer: the reading against its line, the chart, why, and the folds How I read it, What it counts, History
12
12
  * N the Viewer's ⋯: Notify me, Only in Intelligence (✦ my pick, on), Quiet; a press posts /api/goals/notify
13
13
  * M ⋯ › Metrics: one list, goals first then "watch"; one switch shows the tree
14
- * P on a phone: no sideways scroll, the same list. PMOS_SHOTS=<dir> also saves screenshots. */
14
+ * P on a phone: no sideways scroll, each key result a card with its drafts. PMOS_SHOTS=<dir> also saves screenshots. */
15
15
  const path = require('path');
16
16
  const fs = require('fs');
17
17
  const { spawn } = require('child_process');
@@ -85,28 +85,29 @@ const ROWS = [
85
85
  for (const k of ['keep', 'keep-all', 'drop', 'edit', 'undo', 'start']) await page.route('**/api/metric-drafts/' + k, (r) => { posts.push({ path: '/api/metric-drafts/' + k, body: JSON.parse(r.request().postData() || '{}') }); r.fulfill({ contentType: 'application/json', body: JSON.stringify(k === 'keep' ? { ok: true, rid: 'r1' } : { ok: true, kept: 3 }) }); });
86
86
  await page.route('**/api/goals/notify', (r) => { posts.push({ path: '/api/goals/notify', body: JSON.parse(r.request().postData() || '{}') }); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
87
87
  await page.goto(BASE + '/premium-intelligence.html?theme=' + theme);
88
- await until(() => page.evaluate(() => document.querySelectorAll('#goalTbl .okr-row').length > 0), 20000);
88
+ await until(() => page.evaluate(() => document.querySelectorAll('#goalTbl .ins-row').length > 0), 20000);
89
89
  await until(() => page.evaluate(() => !!document.querySelector('#goalTbl .okr-dr')), 6000);
90
90
  return { ctx, page, errors, posts };
91
91
  };
92
92
  const txt = (p, s) => p.evaluate((x) => { const e = document.querySelector(x); return e ? e.textContent.replace(/\s+/g, ' ').trim() : ''; }, s);
93
93
 
94
- /* L · the list */
94
+ /* L · the dashboard (re-pointed, batch 18 item 11 gap: the agreed goals dashboard is Iq8Overview again, GcJ2FirstMonday and GcJ4Full: the
95
+ * North Star card with its line and its inputs, then one table of key results and health budgets; the owner is on the work in Moved by) */
95
96
  const R = await open(), p = R.page;
96
- const order = await p.evaluate(() => [...document.querySelectorAll('#insHero, #nsRow .okr-h, #goalTbl .okr-h')].filter((e) => e.offsetParent !== null).map((e) => e.id === 'insHero' ? '✦' : e.textContent));
97
+ const order = await p.evaluate(() => [...document.querySelectorAll('#insHero, #nsRow .ins-nsc .ins-lbl2, #goalTbl .ins-th [role="columnheader"]:first-child, #goalTbl .ins-grp [role="cell"]')].filter((e) => e.offsetParent !== null).map((e) => e.id === 'insHero' ? '✦' : e.childNodes[0].textContent.trim()).filter((x) => !/^Objective/.test(x)));
97
98
  ok('L1 top to bottom: the ✦ line, North Star, Key results, Health budgets', order.join('|') === '✦|North Star|Key results|Health budgets', order.join('|'));
98
- const rows = await p.evaluate(() => [...document.querySelectorAll('#goalTbl [data-goal]')].map((r) => ({ id: r.dataset.goal, dot: (r.querySelector('.okr-main .cz-dot') || {}).className || '', meta: r.querySelector('.okr-main .note').textContent, av: !!r.querySelector('.okr-main .okr-av'), svg: !!r.querySelector('.okr-main svg'), pill: !!r.querySelector('.okr-main .cz-pill') })));
99
+ const rows = await p.evaluate(() => [...document.querySelectorAll('#goalTbl .ins-row[data-goal]')].map((r) => ({ id: r.dataset.goal, now: r.querySelector('.val').textContent.replace(/\s+/g, ' ').trim(), sofar: !!r.querySelector('.sofar svg, .sofar .ins-one, .sofar .note'), pace: r.querySelector('.pace').textContent.replace(/\s+/g, ' ').trim(), mv: !!r.querySelector('.mv') })));
99
100
  const act = rows.find((r) => r.id === 'krm-act') || {}, churn = rows.find((r) => r.id === 'krm-churn') || {};
100
- ok('L2 a row is the dot, the outcome, its reading and the owner: no chart and no initiative status', rows.length >= 4 && rows.every((r) => r.av && !r.svg && !r.pill), JSON.stringify(rows));
101
- ok('L3 the reading the status function sent is the row\'s line, behind is amber', act.meta === '+8 of +30 points · its line says +18' && /risk/.test(act.dot), JSON.stringify(act));
102
- ok('L4 a goal with no reading has a hollow dot and says so', /hollow/.test(churn.dot) && /No reading yet/.test(churn.meta), JSON.stringify(churn));
103
- ok('L5 the owner avatar shows the initials; no owner is the dashed circle', await p.evaluate(() => document.querySelector('[data-goal="krm-act"] .okr-av').textContent === 'RP' && !!document.querySelector('[data-goal="krm-churn"] .okr-av.none')));
104
- ok('L6 the North Star is a row in its own card, read and dated', /99\.6% · up 0\.4 since 1 Sep/.test(await txt(p, '#nsRow [data-goal="krm-up"]')));
101
+ ok('L2 a row is the outcome, Now of target, So far, By its date and Moved by', rows.length >= 4 && rows.every((r) => r.sofar && r.mv && r.pace), JSON.stringify(rows));
102
+ ok('L3 a key result says its reading of its target and its pace by its date', /of \+?30|of 50%/.test(act.now) && /by Dec 31/.test(act.pace), JSON.stringify(act));
103
+ ok('L4 a goal with no reading shows a dash and says so', /—/.test(churn.now) && /No reading yet/i.test(JSON.stringify(churn)) , JSON.stringify(churn));
104
+ const ns = await txt(p, '#nsRow .ins-nsc');
105
+ ok('L6 the North Star is its own card with its number, its change and its line', /North Star Partner uptime/.test(ns) && /99\.6%/.test(ns) && !!(await p.$('#nsRow .ins-nsch')), ns);
105
106
  await shot(p, 'okr-desktop-light');
106
107
 
107
108
  /* D · drafts */
108
- const under = await p.evaluate(() => ({ chase: !!document.querySelector('[data-goal="krm-act"] [data-draft="d-chase"]'), out: !!document.querySelector('[data-goal="krm-ttfc"] [data-draft="d-out"]'), kr: !!document.querySelector('#draftBox [data-gc-row="d-kr"]') && !document.querySelector('#goalTbl [data-draft-row="d-kr"]'),
109
- acts: [...document.querySelectorAll('[data-draft="d-chase"] .acts button')].map((b) => b.getAttribute('aria-label').split(':')[0]), old: (document.querySelector('[data-draft="d-out"] .okr-old') || {}).textContent || '' }));
109
+ const under = await p.evaluate(() => ({ chase: !!document.querySelector('[data-drafts-for="krm-act"] [data-draft="d-chase"]'), out: !!document.querySelector('[data-drafts-for="krm-ttfc"] [data-draft="d-out"]'), kr: !!document.querySelector('#draftBox [data-gc-row="d-kr"]') && !document.querySelector('#goalTbl [data-draft-row="d-kr"]'),
110
+ acts: [...document.querySelectorAll('#goalTbl [data-draft="d-chase"] .acts button')].map((b) => b.getAttribute('aria-label').split(':')[0]), old: (document.querySelector('[data-draft="d-out"] .okr-old') || {}).textContent || '' }));
110
111
  // batch 18 item 11 (GcJ1aTable): a drafted key result is a row of the drafts table, no longer a hollow row in the list
111
112
  ok('D1 each draft sits under the row it repairs; a drafted key result is a row of the drafts table', under.chase && under.out && under.kr, JSON.stringify(under));
112
113
  ok('D2 a draft has ✕ / ✎ / ✓, and ✓ says its act (Send)', under.acts.join('|') === 'Not now|Edit|Send', under.acts.join('|'));
@@ -125,7 +126,7 @@ const ROWS = [
125
126
  ok('D8 ✓ on the edit posts what was typed (a fix row posts its text, lib/metric-drafts.js editOf)', await until(() => R.posts.some((x) => x.path === '/api/metric-drafts/edit' && x.body.row === 'd-out' && x.body.text === 'New partners call us within 3 days' && x.body.name === undefined)));
126
127
 
127
128
  /* V · the goal Viewer */
128
- await p.click('#goalTbl [data-goal="krm-act"] .okr-main');
129
+ await p.click('#goalTbl [data-goal="krm-act"] .nm');
129
130
  const v = await until(() => p.evaluate(() => { const V = document.querySelector('#czViewer'); if (!V || V.hidden) return null; return { title: (V.querySelector('.cz-vw-title') || {}).textContent || '', head: (V.querySelector('.okr-vh') || {}).textContent || '', chart: !!V.querySelector('.ins-gbig svg'), why: (V.querySelector('.okr-why') || {}).textContent || '', folds: [...V.querySelectorAll('.czs-row b')].map((b) => b.textContent) }; }), 5000);
130
131
  ok('V1 the Viewer opens on the goal with its reading against its line and the owner', v && /Partner activation/.test(v.title) && /\+8 of \+30 points/.test(v.head) && /its line says \+18/.test(v.head) && /RP/.test(v.head), JSON.stringify(v));
131
132
  ok('V2 then the chart and why it moved', v && v.chart && /catches up about 3 weeks/.test(v.why), JSON.stringify(v));
@@ -160,7 +161,7 @@ const ROWS = [
160
161
 
161
162
  /* R · a broken limit */
162
163
  const C = await open({ m: model({ crit: true }), rows: [] });
163
- const cr = await C.page.evaluate(() => ({ crit: document.querySelector('#insHero').classList.contains('crit'), t: document.querySelector('#brief').textContent, pulse: !!document.querySelector('#nsRow [data-goal="krm-up"] .cz-dot.m-crit') }));
164
+ const cr = await C.page.evaluate(() => ({ crit: document.querySelector('#insHero').classList.contains('crit'), t: document.querySelector('#brief').textContent, pulse: !!document.querySelector('#nsRow .ins-nsc .cz-dot.m-crit') }));
164
165
  ok('R1 a broken limit is the one time the ✦ line turns red, and its dot pulses', cr.crit && /fell under its floor/.test(cr.t) && cr.pulse, JSON.stringify(cr));
165
166
  await shot(C.page, 'okr-crit', '#stage');
166
167
  await C.ctx.close();
@@ -168,8 +169,9 @@ const ROWS = [
168
169
  /* P · a phone */
169
170
  for (const theme of ['light', 'dark']) {
170
171
  const Q = await open({ w: 390, h: 844, theme });
171
- const ph = await Q.page.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1, rows: document.querySelectorAll('#goalTbl .okr-row').length, shown: getComputedStyle(document.querySelector('#goalTbl')).display !== 'none' }));
172
- ok('P1 on a phone (' + theme + ') the same list shows with no sideways scroll', !ph.over && ph.rows >= 4 && ph.shown, JSON.stringify(ph));
172
+ const ph = await Q.page.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1, cards: document.querySelectorAll('#goalCards .ins-card').length, drafts: document.querySelectorAll('#goalCards > .okr-dr').length }));
173
+ // re-pointed (batch 18 item 11 gap, Iq8Phone): on a phone each key result is a card, its drafts under it
174
+ ok('P1 on a phone (' + theme + ') the key results are cards with their drafts, with no sideways scroll', !ph.over && ph.cards >= 4 && ph.drafts >= 2, JSON.stringify(ph));
173
175
  await shot(Q.page, 'okr-phone-' + theme);
174
176
  await Q.ctx.close();
175
177
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.443.0",
3
+ "version": "0.444.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.443.0",
9
+ "version": "0.444.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.443.0",
3
+ "version": "0.444.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",