create-pmos 0.691.0 → 0.693.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 (111) hide show
  1. package/package.json +20 -14
  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/adler-moments-test.js +3 -35
  7. package/workspace/adler-seasons-test.js +1 -1
  8. package/workspace/briefing-premium-adddoc-test.js +1 -1
  9. package/workspace/briefing-premium-board-test.js +1 -1
  10. package/workspace/briefing-premium-doc-edit-test.js +1 -1
  11. package/workspace/briefing-premium-work-test.js +2 -2
  12. package/workspace/changelog.json +19 -0
  13. package/workspace/chat-asks-test.js +1 -1
  14. package/workspace/core-docs-workflow-test.js +1 -1
  15. package/workspace/ev-everywhere-test.js +3 -14
  16. package/workspace/guide/cli.md +3 -1
  17. package/workspace/guide/home.md +1 -1
  18. package/workspace/guide/layout.md +2 -2
  19. package/workspace/guide/settings-and-switches.md +0 -1
  20. package/workspace/impact-screens-test.js +2 -47
  21. package/workspace/ini-workflow-test.js +1 -1
  22. package/workspace/lib/board-premium.js +10 -2
  23. package/workspace/lib/initiative-cli.js +31 -4
  24. package/workspace/lib/initiative-origin.js +131 -0
  25. package/workspace/lib/initiative-writer.js +35 -2
  26. package/workspace/lib/routes-boards.js +4 -1
  27. package/workspace/live-pill-round-test.js +6 -18
  28. package/workspace/milestone-suggest-test.js +4 -28
  29. package/workspace/news-viewers-test.js +3 -29
  30. package/workspace/package-lock.json +2 -2
  31. package/workspace/package.json +1 -1
  32. package/workspace/premium-board-actions-test.js +2 -2
  33. package/workspace/premium-briefing-depth-test.js +4 -4
  34. package/workspace/premium-chat-attach-test.js +3 -2
  35. package/workspace/premium-chat-chart-tab-test.js +8 -7
  36. package/workspace/premium-chat-context-test.js +3 -1
  37. package/workspace/premium-chat-goal-view-test.js +3 -1
  38. package/workspace/premium-chat-line-test.js +8 -6
  39. package/workspace/premium-chat-report-tab-test.js +13 -5
  40. package/workspace/premium-chat-term-test.js +2 -2
  41. package/workspace/premium-chat-viewer-test.js +10 -16
  42. package/workspace/premium-core-doc-issue-test.js +7 -2
  43. package/workspace/premium-discuss-landing-test.js +9 -5
  44. package/workspace/premium-html-viewer-test.js +7 -3
  45. package/workspace/premium-link-suggest-test.js +6 -10
  46. package/workspace/premium-phone-card-test.js +2 -2
  47. package/workspace/premium-viewer-download-test.js +1 -1
  48. package/workspace/premium-viewer-flicker-test.js +1 -1
  49. package/workspace/premium-viewer-share-test.js +2 -2
  50. package/workspace/premium-viewer-test.js +1 -1
  51. package/workspace/premium-vw-cal-test.js +1 -1
  52. package/workspace/premium-vw-copy-test.js +3 -3
  53. package/workspace/premium-vw-doc-test.js +1 -1
  54. package/workspace/premium-vw-item-test.js +1 -1
  55. package/workspace/premium-work-depth-test.js +2 -2
  56. package/workspace/program-charter-test.js +1 -12
  57. package/workspace/program-leave-test.js +2 -2
  58. package/workspace/program-order-test.js +3 -65
  59. package/workspace/project-onboard-flow-test.js +5 -5
  60. package/workspace/public/pm/bd-work.js +24 -5
  61. package/workspace/public/pm/cozy-home.css +0 -6
  62. package/workspace/public/pm/cozy-panels.js +2 -6
  63. package/workspace/public/pm/cozy-popup.css +1 -0
  64. package/workspace/public/pm/cozy-popup.js +15 -2
  65. package/workspace/public/pm/cozy-today-page.css +1 -1
  66. package/workspace/public/pm/cozy-today.css +0 -14
  67. package/workspace/public/pm/cozy-viewer.js +14 -38
  68. package/workspace/public/pm/goal-chat.js +2 -2
  69. package/workspace/public/pm/home-app.js +8 -67
  70. package/workspace/public/pm/home-chat.js +1 -1
  71. package/workspace/public/pm/home-ses-name.js +3 -2
  72. package/workspace/public/pm/home-today.js +4 -18
  73. package/workspace/public/premium-intelligence.html +1 -1
  74. package/workspace/public/premium-viewer.html +1 -1
  75. package/workspace/public/premium-workflows.html +1 -1
  76. package/workspace/ready-dash-ui-test.js +1 -1
  77. package/workspace/rename-test.js +2 -2
  78. package/workspace/server.js +11 -12
  79. package/workspace/session-names-test.js +34 -56
  80. package/workspace/sort-order-test.js +2 -71
  81. package/workspace/split-merge-ui-test.js +1 -1
  82. package/workspace/stage-card-tasks-test.js +1 -1
  83. package/workspace/stage-card-test.js +1 -1
  84. package/workspace/task-card-test.js +1 -1
  85. package/workspace/task-press-test.js +1 -1
  86. package/workspace/task-views-test.js +1 -1
  87. package/workspace/test-lists/adler-seasons-art.json +3 -6
  88. package/workspace/test-lists/batch18-asks.json +1 -1
  89. package/workspace/test-lists/briefing-premium.json +1 -11
  90. package/workspace/test-lists/premium-agreed-viewer.json +1 -1
  91. package/workspace/test-lists/who-raised-each-idea.json +5 -0
  92. package/workspace/test-run.js +0 -2
  93. package/workspace/test-timings.json +0 -4
  94. package/workspace/tk-tasks-test.js +3 -17
  95. package/workspace/viewer-trail-test.js +2 -2
  96. package/workspace/workflows-setup-test.js +4 -2
  97. package/workspace/adler-seasons-art-test.js +0 -116
  98. package/workspace/briefing-premium-initiative-test.js +0 -289
  99. package/workspace/briefing-premium-products-test.js +0 -209
  100. package/workspace/briefing-premium-sources-test.js +0 -250
  101. package/workspace/briefing-premium-test.js +0 -282
  102. package/workspace/home-other-product-test.js +0 -197
  103. package/workspace/home-pill-test.js +0 -138
  104. package/workspace/home-railcard-test.js +0 -196
  105. package/workspace/home-rows-test.js +0 -389
  106. package/workspace/panels-test.js +0 -454
  107. package/workspace/public/premium.html +0 -48
  108. package/workspace/test-lists/batch18-panels.json +0 -9
  109. package/workspace/test-lists/home-railcard.json +0 -9
  110. package/workspace/test-lists/home-sessions-pill.json +0 -6
  111. package/workspace/test-lists/viewer-home-rows.json +0 -9
@@ -0,0 +1,131 @@
1
+ 'use strict';
2
+ /* lib/initiative-origin.js — who raised an initiative (bet A445, initiative who-raised-each-idea). The one place the rule lives.
3
+ *
4
+ * parse(text) → { ok: true, kind, name } | { ok: false, error } a `raised_by:` value
5
+ * originOf({ raised_by, created }) → origin | null
6
+ * createdBy(root) → Map(initiative → { by, from }) the Roadmap's `created` lines (lib/placements.js), read once
7
+ * coverage(root) → { total, known, pct, byKind }
8
+ * node lib/initiative-origin.js coverage <root> prints the coverage; its last line is the percent (the build's health number)
9
+ *
10
+ * WHERE AN ORIGIN COMES FROM, in this order, for any product:
11
+ * 1. the record's own `raised_by:` line, which the PM or an agent writes (lib/initiative-writer.js, `pmos initiative raised-by`):
12
+ * `you`, `pmos` (or `agent`), `tracker`, `teammate: <name>`, `customer: <name>`;
13
+ * 2. the Roadmap's `created` line, which the one writer of a record appends: `by: pm:*` is You, `by: agent:*` is PMOS;
14
+ * 3. nothing: the row shows nothing (zero is silence) and falls in "Not recorded" in a group or a filter.
15
+ * PMOS never guesses a person from a ticket or a document: an origin is read, never invented.
16
+ *
17
+ * AN ORIGIN: { kind, name, label, group, source }
18
+ * kind 'you' | 'teammate' | 'customer' | 'pmos' | 'tracker'
19
+ * name the person or company for a teammate or a customer, else null
20
+ * label what a cell says: "You", "Dana · teammate", "Acme · customer", "PMOS", "From the tracker"
21
+ * group what a group or a filter value says: "You", "Teammates", "Customers", "PMOS", "From the tracker"
22
+ * source 'record' (the raised_by line) | 'roadmap' (the created line)
23
+ * The page never sees a session token: the created line's `by` is reduced to its kind here.
24
+ */
25
+ const fs = require('fs');
26
+ const path = require('path');
27
+
28
+ const KINDS = Object.freeze(['you', 'teammate', 'customer', 'pmos', 'tracker']);
29
+ const NAMED = new Set(['teammate', 'customer']);
30
+ const ALIAS = Object.freeze({ pm: 'you', me: 'you', agent: 'pmos' });
31
+ const GROUP = Object.freeze({ you: 'You', teammate: 'Teammates', customer: 'Customers', pmos: 'PMOS', tracker: 'From the tracker' });
32
+ const NONE = 'Not recorded';
33
+ const MAX_NAME = 60;
34
+
35
+ /** A `raised_by:` value → { ok, kind, name } or { ok: false, error }. Quotes around the whole value are dropped. */
36
+ function parse(text) {
37
+ const raw = String(text == null ? '' : text).trim().replace(/^["']|["']$/g, '').trim();
38
+ if (!raw) return { ok: false, error: 'say who raised it: you, pmos, tracker, "teammate: <name>" or "customer: <name>"' };
39
+ if (/[\r\n\x00-\x08\x0b-\x1f]/.test(raw)) return { ok: false, error: 'who raised it must be one line' };
40
+ const m = /^([A-Za-z]+)\s*(?::\s*(.*))?$/.exec(raw);
41
+ const k0 = m ? m[1].toLowerCase() : '';
42
+ const kind = ALIAS[k0] || k0;
43
+ if (!m || !KINDS.includes(kind)) return { ok: false, error: `"${raw.slice(0, 40)}" is not one of: you, pmos, tracker, teammate: <name>, customer: <name>` };
44
+ const name = m[2] != null ? m[2].trim() : '';
45
+ if (NAMED.has(kind)) {
46
+ if (!name) return { ok: false, error: `name the ${kind}: "${kind}: <name>"` };
47
+ if (name.length > MAX_NAME) return { ok: false, error: `the name is at most ${MAX_NAME} characters` };
48
+ return { ok: true, kind, name };
49
+ }
50
+ if (m[2] != null) return { ok: false, error: `${kind} takes no name` };
51
+ return { ok: true, kind, name: null };
52
+ }
53
+
54
+ /** The value a record line holds for a parsed origin: `you`, `teammate: Dana`. */
55
+ const lineValue = (p) => (p.name ? `${p.kind}: ${p.name}` : p.kind);
56
+
57
+ function shape(kind, name, source) {
58
+ const label = name ? `${name} · ${kind}` : kind === 'you' ? 'You' : kind === 'pmos' ? 'PMOS' : kind === 'tracker' ? 'From the tracker' : GROUP[kind];
59
+ return { kind, name: name || null, label, group: GROUP[kind], source };
60
+ }
61
+
62
+ /** The origin of one initiative: its record line first, else the Roadmap's created line, else null. */
63
+ function originOf({ raised_by: rb, created } = {}) {
64
+ if (rb != null && String(rb).trim()) {
65
+ const p = parse(rb);
66
+ if (p.ok) return shape(p.kind, p.name, 'record');
67
+ }
68
+ const by = created && typeof created.by === 'string' ? created.by : '';
69
+ if (by.startsWith('pm:')) return shape('you', null, 'roadmap');
70
+ if (by.startsWith('agent:')) return shape('pmos', null, 'roadmap');
71
+ return null;
72
+ }
73
+
74
+ /** The first `created` line of each initiative in the placements ledger: Map(id → { by, from }). An unreadable ledger is an empty map. */
75
+ function createdBy(root) {
76
+ const out = new Map();
77
+ let lines = [];
78
+ try { lines = require('./plan-ledgers.js').readLines(root, 'placements').lines || []; } catch { return out; }
79
+ for (const { rec } of lines) {
80
+ if (!rec || rec.ev !== 'created' || typeof rec.initiative !== 'string' || out.has(rec.initiative)) continue;
81
+ out.set(rec.initiative, { by: typeof rec.by === 'string' ? rec.by : '', from: rec.from || null });
82
+ }
83
+ return out;
84
+ }
85
+
86
+ /** The `raised_by:` line of a record's front matter, or ''. */
87
+ function raisedByOfText(text) {
88
+ const fm = /^---\r?\n([\s\S]*?)\r?\n---/.exec(String(text || ''));
89
+ if (!fm) return '';
90
+ const m = /^raised_by:[ \t]*(.*?)[ \t]*$/m.exec(fm[1]);
91
+ return m ? m[1].replace(/^["']|["']$/g, '').replace(/\\"/g, '"') : '';
92
+ }
93
+
94
+ /** The initiative records of a checkout, either layout: planning/initiatives/ (PMOS itself) and pmos/state/initiatives/ (a kit repository). */
95
+ function recordFiles(root) {
96
+ const out = [];
97
+ for (const rel of ['planning/initiatives', 'pmos/state/initiatives']) {
98
+ let names = [];
99
+ try { names = fs.readdirSync(path.join(root, rel)); } catch { continue; }
100
+ for (const n of names) if (n.endsWith('.md') && !/^(readme|index|log)\.md$/i.test(n)) out.push({ id: n.slice(0, -3), file: path.join(root, rel, n) });
101
+ }
102
+ return out;
103
+ }
104
+
105
+ /** How many of a checkout's initiatives show who raised them. → { total, known, pct, byKind: { you, teammate, … , none } } */
106
+ function coverage(root) {
107
+ const created = createdBy(root);
108
+ const byKind = Object.fromEntries([...KINDS, 'none'].map((k) => [k, 0]));
109
+ let total = 0, known = 0;
110
+ for (const { id, file } of recordFiles(root)) {
111
+ let text = '';
112
+ try { text = fs.readFileSync(file, 'utf8'); } catch { continue; }
113
+ if (!/^---\r?\n[\s\S]*?^type:\s*["']?Initiative/m.test(text)) continue;
114
+ total++;
115
+ const o = originOf({ raised_by: raisedByOfText(text), created: created.get(id) });
116
+ if (o) { known++; byKind[o.kind]++; } else byKind.none++;
117
+ }
118
+ return { total, known, pct: total ? Math.round((known / total) * 1000) / 10 : 0, byKind };
119
+ }
120
+
121
+ if (require.main === module) {
122
+ const [cmd, root0] = process.argv.slice(2);
123
+ if (cmd !== 'coverage') { console.log('usage: node lib/initiative-origin.js coverage <checkout>'); process.exit(2); }
124
+ const root = path.resolve(root0 || '.');
125
+ const c = coverage(root);
126
+ const kinds = Object.entries(c.byKind).filter(([, n]) => n).map(([k, n]) => `${k === 'none' ? NONE.toLowerCase() : k} ${n}`).join(', ');
127
+ console.log(`[origin] ${c.known} of ${c.total} initiatives show who raised them${kinds ? ` (${kinds})` : ''}`);
128
+ console.log(String(c.pct));
129
+ }
130
+
131
+ module.exports = { KINDS, GROUP, NONE, parse, lineValue, originOf, createdBy, raisedByOfText, coverage };
@@ -57,8 +57,9 @@ const actorLib = require('./actor.js');
57
57
  const ID_RE = /^[a-z0-9][a-z0-9._-]*$/;
58
58
  const MAX_ID = 60;
59
59
  const WRITER_SET = Object.freeze(['v', 'eid', 'by', 'via', 'at', 'override', 'pm', 'actor', 'nonce', 'timestamp', 'type']);
60
- const INPUT_KEYS = Object.freeze(['id', 'title', 'lane', 'anchor', 'intent', 'specimen_test', 'surface_check', 'from', 'kind']);
60
+ const INPUT_KEYS = Object.freeze(['id', 'title', 'lane', 'anchor', 'intent', 'specimen_test', 'surface_check', 'from', 'kind', 'raised_by']);
61
61
  const WK = require('./work-kind.js');
62
+ const ORIGIN = require('./initiative-origin.js'); // who raised it (who-raised-each-idea): the one parser of a raised_by value
62
63
  const ONE_LINE = (v, max) => typeof v === 'string' && v.trim().length >= 1 && v.trim().length <= max && !/[\r\n\x00-\x08\x0b-\x1f]/.test(v);
63
64
 
64
65
  const refuse = (status, error, field) => ({ ok: false, status, error, field: field || null });
@@ -108,6 +109,11 @@ function createInitiative(root, input, { actor, now } = {}) {
108
109
  }
109
110
  if (has(input, 'kind') && input.kind != null && input.kind !== '' && !WK.valid(input.kind)) return refuse(400, `kind must be one of ${WK.KINDS.join(', ')}`, 'kind');
110
111
  const kind = has(input, 'kind') && WK.valid(input.kind) ? input.kind : WK.DEFAULT;
112
+ let raised = null;
113
+ if (has(input, 'raised_by') && input.raised_by != null && input.raised_by !== '') {
114
+ raised = ORIGIN.parse(input.raised_by);
115
+ if (!raised.ok) return refuse(400, raised.error, 'raised_by');
116
+ }
111
117
  if (has(input, 'from') && input.from != null && !(typeof input.from === 'string' && placements.CAPTURE_RE.test(input.from))) {
112
118
  return refuse(400, 'from must name a capture note, like capture-2026-10-04-1', 'from');
113
119
  }
@@ -132,6 +138,7 @@ function createInitiative(root, input, { actor, now } = {}) {
132
138
  if (input.specimen_test) fm.push(`specimen_test: ${q(input.specimen_test)}`);
133
139
  if (input.surface_check) fm.push(`surface_check: ${q(input.surface_check)}`);
134
140
  fm.push(`kind: ${kind}`);
141
+ if (raised) fm.push(`raised_by: ${q(ORIGIN.lineValue(raised))}`);
135
142
  fm.push('---', '', `# ${title}`, '');
136
143
  if (intent.trim()) fm.push(intent.trim(), '');
137
144
  const text = fm.join('\n');
@@ -343,6 +350,32 @@ function restoreDescription(root, id, from, to, { actor } = {}) {
343
350
  return { ok: true, id };
344
351
  }
345
352
 
353
+ /** Who raised it (who-raised-each-idea, bet A445): only the `raised_by:` line changes, added at the end of the front matter when there is
354
+ * none; `none` (or '') removes it, and the row then reads its origin from the Roadmap's created line again (lib/initiative-origin.js).
355
+ * → { ok: true, id, from, to } where from and to are the line's values ('' for no line), or a refusal (400 for a value parse refuses). */
356
+ function setRaisedBy(root, id, value, { actor } = {}) {
357
+ if (!actorLib.valid(actor)) return refuse(500, 'initiative-writer: the caller must pass the actor from pm-guard.js or actor.js');
358
+ const v = typeof value === 'string' ? value.trim() : '';
359
+ let to = '';
360
+ if (v && v.toLowerCase() !== 'none') {
361
+ const p = ORIGIN.parse(v);
362
+ if (!p.ok) return refuse(400, p.error, 'raised_by');
363
+ to = ORIGIN.lineValue(p);
364
+ }
365
+ const f = recordFile(root, id);
366
+ if (!f.ok) return f;
367
+ const text = fs.readFileSync(f.file, 'utf8');
368
+ const fm = frontOfText(text);
369
+ if (!fm) return refuse(409, `the record of ${id} has no front matter — nothing was saved`, 'id');
370
+ const lines = fm[1].split(/\r?\n/);
371
+ const at = lines.findIndex((l) => /^raised_by:/.test(l));
372
+ const from = at >= 0 ? ORIGIN.raisedByOfText('---\n' + lines[at] + '\n---') : '';
373
+ if (from === to) return { ok: true, id, from, to, same: true };
374
+ if (to) { const line = 'raised_by: ' + q(to); if (at >= 0) lines[at] = line; else lines.push(line); } else lines.splice(at, 1);
375
+ try { fs.writeFileSync(f.file, '---\n' + lines.join('\n') + '\n---' + fm[2] + text.slice(fm[0].length), { flag: 'w' }); } catch { return refuse(500, 'the record could not be written — nothing was saved'); }
376
+ return { ok: true, id, from, to };
377
+ }
378
+
346
379
  /** The kind of work (batch 29 item 11, Viewer KdV1-3): only the `kind:` line changes (added at the end of the front matter when an older
347
380
  * record has none). → { ok: true, id, from, kind } where from is what the record read as before ('product' when it had no line). */
348
381
  function setKind(root, id, kind, { actor } = {}) {
@@ -373,4 +406,4 @@ function withdrawSplit(root, id, want, { actor } = {}) {
373
406
  return { ok: true, removed: true };
374
407
  }
375
408
 
376
- module.exports = { setKind, setDescription, restoreDescription, DESC_MAX, setOutcome, restoreOutcome, createInitiative, renameInitiative, setAnchor, restoreAnchor, withdrawSplit, recordSha, slugOf, ID_RE, INPUT_KEYS };
409
+ module.exports = { setKind, setRaisedBy, setDescription, restoreDescription, DESC_MAX, setOutcome, restoreOutcome, createInitiative, renameInitiative, setAnchor, restoreAnchor, withdrawSplit, recordSha, slugOf, ID_RE, INPUT_KEYS };
@@ -112,6 +112,7 @@ const holdSpans = require('./hold-spans.js');
112
112
  const ledgers = require('./plan-ledgers.js');
113
113
  const intake = require(repoScript('intake.js'));
114
114
  const WK = require('./work-kind.js');
115
+ const ORIGIN = require('./initiative-origin.js'); // who raised each initiative (who-raised-each-idea)
115
116
  const OS = require('./one-stage.js');
116
117
 
117
118
  const LEDGER = 'boards.jsonl';
@@ -421,6 +422,7 @@ function baseRowsRead(w) {
421
422
  const verdicts = require('./outcomes.js').rowOutcomes(w.root, { today: day });
422
423
  const rows = [];
423
424
  const seen = new Set();
425
+ const created = ORIGIN.createdBy(w.root); // the Roadmap's created lines, read once: who added each record
424
426
  for (const id of F.placed.ranked) {
425
427
  if (seen.has(id)) continue;
426
428
  seen.add(id);
@@ -439,6 +441,7 @@ function baseRowsRead(w) {
439
441
  rows.push({
440
442
  id, title: r.title, lane: r.lane || null, kind: WK.kindOf(fm.kind), // batch 29 item 11: no line reads as Product management
441
443
  owner: fm.owner ? String(fm.owner) : null,
444
+ origin: ORIGIN.originOf({ raised_by: fm.raised_by, created: created.get(id) }),
442
445
  anchor: r.anchor || null, rank: Number.isInteger(r.rank) ? r.rank : null, dormant: !!r.dormant,
443
446
  status: statusOf(rec, r.health, end, day, jiraOf(w.root, id), verdicts.get(id)),
444
447
  statusIn: statusIn(rec, r.health, end, day, jiraOf(w.root, id), verdicts.get(id)),
@@ -609,7 +612,7 @@ function boardRow(board, base, folded, lib) {
609
612
  const wf = B.workflowOf(board, base.id, folded);
610
613
  const cat = B.catOf({ workflow: wf }, s.stage);
611
614
  const row = {
612
- id: base.id, title: base.title, lane: base.lane, kind: WK.kindOf(base.kind), stage: s.stage, cat, owner: base.owner, anchor: base.anchor,
615
+ id: base.id, title: base.title, lane: base.lane, kind: WK.kindOf(base.kind), stage: s.stage, cat, owner: base.owner, origin: base.origin || null, anchor: base.anchor,
613
616
  status: base.status, start: ts ? minDay(base.start, ts.start) : base.start, end: ts ? maxDay(base.end, ts.end) : base.end, progress: base.progress, warnings: [],
614
617
  rank: base.rank, health: B.isActive(base) ? base.health : null, updated: base.updated, reading: base.reading, stageSource: s.source, lifecycle: base.lifecycle,
615
618
  stopped: base.stopped || null, archived: archivedOf(folded, base.id), outcome: base.outcome || null,
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
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,
3
+ /* live-pill-round-test.js — the Live pill as a round number and the panel divider's look (feedback batch 18 item 15,
4
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
5
  * real server; GET /api/live is answered by the suite, so the pill's state is the suite's.
6
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
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
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
9
+ * sprout, fitted to its box · V3 Settings > Adler > Off: the handle only
10
+ * F2 a phone: no round pill, Live now in the ⋯ menu · every page: no page error (Home's list fold went with Home's page, home-desk-layout-delete)
11
11
  * PMOS_SHOTS=<dir> also saves the screenshots. */
12
12
  const path = require('path');
13
13
  const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
@@ -75,7 +75,7 @@ const ASKS = () => RUNNING().concat([{ id: 'b', name: 'Redistribute plan items',
75
75
  }));
76
76
  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));
77
77
  // with the popup's chat (cozy-popup.js sets window.czOpenChat) the rail's chat icon holds the sessions, so the round button gives way
78
- // (cozy-ev.css cz-chatpop); it comes back only while a panel is put away (panels-test P3)
78
+ // (cozy-ev.css cz-chatpop); it comes back only while a panel is put away (cozy-panels.js)
79
79
  ok('L2 beside the rail\'s chat icon it gives way to the popup\'s chat; without it, a 44 px round button stacked above the chat icon on its centre line', l2 && (l2.chatpop ? l2.w === 0 && l2.h === 0 : l2.w === 44 && l2.h === 44 && l2.round === '50%' && l2.above && l2.centred), JSON.stringify(l2));
80
80
  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);
81
81
  await shot(page, 'pill-running');
@@ -150,18 +150,9 @@ const ASKS = () => RUNNING().concat([{ id: 'b', name: 'Redistribute plan items',
150
150
  await page.evaluate(() => { window.czPanels = { slideOver: () => false, list: () => [] }; });
151
151
  if (l2 && l2.chatpop) await page.keyboard.press('Control+j'); else await page.click('#czLive');
152
152
  await until(() => page.$('#czLiveList a[data-lv="s:b"]'));
153
- await Promise.all([page.waitForURL(/premium\.html\?session=b/, { timeout: 15000 }).catch(() => null), page.click('#czLiveList a[data-lv="s:b"]')]);
154
- 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
+ await Promise.all([page.waitForURL(/today\.html\?session=b/, { timeout: 15000 }).catch(() => null), page.click('#czLiveList a[data-lv="s:b"]')]);
154
+ ok('L6 czPanels.slideOver(item) gives false (it did nothing): the row opens as today (Today, home-page-retire)', /today\.html\?session=b/.test(page.url()), page.url());
155
155
 
156
- /* F1 */
157
- await page.goto(BASE + '/premium.html');
158
- 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);
159
- 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));
160
- await shot(page, 'home-fold');
161
- await page.click('#hmList .hm-hd [data-hm-fold]');
162
- 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')));
163
- await page.click('#hmUnfold');
164
- 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]'))));
165
156
  ok('every page: no page error', errors.length === 0, errors.join(' | '));
166
157
 
167
158
  /* F2 */
@@ -177,9 +168,6 @@ const ASKS = () => RUNNING().concat([{ id: 'b', name: 'Redistribute plan items',
177
168
  ok('F2 a phone: the ⋯ menu says Live now 3', lv === 'Live now3' || /Live now\s*3/.test(lv || ''), JSON.stringify(lv));
178
169
  await ph.click('#czFab');
179
170
  await shot(ph, 'phone-pill');
180
- await ph.goto(BASE + '/premium.html');
181
- await until(() => ph.evaluate(() => !!document.querySelector('#hmList .hm-hd')), 30000);
182
- ok('F2 a phone has no rail, so no fold', await ph.evaluate(() => !document.querySelector('[data-hm-fold]')));
183
171
  await pctx.close();
184
172
  await finish();
185
173
  })();
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- /* milestone-suggest-test.js — Claude's milestone suggestions on the program panel, the charter and Home (feedback batch 4 item 6, option B;
4
- * canvas XmsgB, sticky xmsgRules). Serves the real Board and Home pages from the real server; Project Ascent comes from fixtures/program-ascent.js
3
+ /* milestone-suggest-test.js — Claude's milestone suggestions on the program panel and the charter (feedback batch 4 item 6, option B;
4
+ * canvas XmsgB, sticky xmsgRules). Serves the real Board page from the real server; Project Ascent comes from fixtures/program-ascent.js
5
5
  * with a `review` added the way GET /api/programs answers it, and the program writes are captured, not written.
6
6
  * F a program with no milestones: Claude's first suggestions take the place of "Add the first milestone", each with why and its source; ✓ ✎ ✕
7
7
  * are icon-only; keep all · W later changes lead Waits on you; ✓ keeps, ✕ drops · C the pencil opens the charter with the change filled in;
8
8
  * Save writes it and answers the suggestion; last checked and Check now · Z nothing to suggest, nothing shows · K the ◆ dates are reported once
9
- * · M Home's program card leads with its milestone changes · H on a phone. PMOS_SHOTS=<dir> also saves the screenshots the frames are compared with. */
9
+ * · H on a phone (M, Home's program card, went with Home's list: home-desk-layout-delete). PMOS_SHOTS=<dir> also saves the screenshots the frames are compared with. */
10
10
  const path = require('path');
11
11
  const { besidePage } = require('./lib/beside-page'); // these checks read the full page beside the page; in the popup work shows its three parts (nav slice 3)
12
12
  const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
@@ -61,7 +61,7 @@ const withReview = (open, o = {}) => F.programs().map((p) => ({ ...p, ...(o.empt
61
61
  if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
62
62
  const shot = async (p, name) => { if (SHOTS) await p.screenshot({ path: path.join(SHOTS, name + '.png') }); };
63
63
 
64
- const open = async ({ w = 1440, h = 900, programs = withReview(CHANGES), dark = false, home = false } = {}) => {
64
+ const open = async ({ w = 1440, h = 900, programs = withReview(CHANGES), dark = false } = {}) => {
65
65
  const c = await browser.newContext({ viewport: { width: w, height: h }, colorScheme: dark ? 'dark' : 'light' });
66
66
  const page = await c.newPage();
67
67
  const errors = [], posts = [];
@@ -74,7 +74,6 @@ const withReview = (open, o = {}) => F.programs().map((p) => ({ ...p, ...(o.empt
74
74
  await page.route('**/api/boards/items*', (r) => json(r, { ok: true, items: A.ITEMS[wsOf(r)] || [] }));
75
75
  await page.route('**/api/programs/*', (r) => { const rq = r.request(); posts.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}') }); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
76
76
  await page.route('**/api/board-trail*', (r) => r.fulfill({ status: 500, contentType: 'application/json', body: '{"ok":false,"error":"not in this check"}' }));
77
- if (home) { await page.goto(BASE + '/premium.html?ws=idpf'); return { page, ctx: c, errors, posts }; }
78
77
  await page.goto(BASE + '/premium-board.html?ws=idpf&program=' + programs[0].id);
79
78
  await until(() => page.evaluate(() => { const v = document.querySelector('#czViewer'); return !!v && !v.hidden && !!v.querySelector('.pp-vw .pv'); }));
80
79
  await until(() => page.evaluate(() => !/reading its board/.test((document.querySelector('#czViewer [data-czs-id="tree"]') || {}).textContent || '')), 6000);
@@ -146,25 +145,6 @@ const withReview = (open, o = {}) => F.programs().map((p) => ({ ...p, ...(o.empt
146
145
  ok('Z nothing to suggest: no suggestion row anywhere on the panel', await Z.page.evaluate(() => !document.querySelector('#czViewer .msg-r, #czViewer .msg-box')));
147
146
  await Z.ctx.close();
148
147
 
149
- /* ── M: Home's Your move ── */
150
- const M = await open({ home: true });
151
- // the program's milestone changes lead its card on Home (batch 14 item 4)
152
- await until(() => M.page.evaluate(() => !!document.querySelector('[data-hm-prog]')), 10000);
153
- const hm = await until(() => M.page.evaluate(() => { const b = document.querySelector('[data-hm-sel="ms:project-ascent"]'); return b ? [...b.querySelectorAll('b, em')].map((x) => x.textContent.trim()).join(' · ') : null; }), 10000);
154
- ok('M Home\'s program card has one line for its milestone changes, first', hm === '3 milestone changes · Pilot live to Dec 2', String(hm));
155
- if (hm) {
156
- await M.page.click('[data-hm-sel="ms:project-ascent"]');
157
- ok('M a tap opens the program, where the changes lead its proposals', !!(await until(() => M.page.evaluate(() => { const b = document.querySelector('#czViewer [data-pv="props"]'); if (b && b.getAttribute('aria-expanded') !== 'true') b.click(); return !!document.querySelector('#czViewer .pv-props .msg-r'); }), 8000)));
158
- }
159
- // batch 16: on a desktop the greeting opens Your day in the Viewer, as on a phone; the calendar is under ⋯
160
- if (await M.page.$('[data-hm-day]')) {
161
- await M.page.click('[data-hm-day]');
162
- const vw = await until(() => M.page.evaluate(() => { const v = document.querySelector('#czViewer'); const t = v && !v.hidden ? v.textContent.replace(/\s+/g, ' ') : ''; return /Your day/.test(t) ? t : null; }), 8000);
163
- ok('D on a desktop the greeting opens Your day in the Viewer, as on a phone', !!vw, String(vw).slice(0, 200));
164
- }
165
- ok('0 no page error on Home', M.errors.length === 0, M.errors.join(' | '));
166
- await M.ctx.close();
167
-
168
148
  /* ── H: a phone ── */
169
149
  const S = await open({ w: 390, h: 844 });
170
150
  await S.page.click('#czViewer [data-pv="props"]');
@@ -181,10 +161,6 @@ const withReview = (open, o = {}) => F.programs().map((p) => ({ ...p, ...(o.empt
181
161
  await shot(K.page, 'XmsgB-asks-built-dark'); await K.ctx.close();
182
162
  const K2 = await open({ dark: true, w: 390, h: 844, programs: withReview(FIRST, { empty: true }) });
183
163
  await shot(K2.page, 'XmsgB-first-phone-dark'); await K2.ctx.close();
184
- const K3 = await open({ w: 390, h: 844, home: true });
185
- if (await until(() => K3.page.$('[data-hm-day]'), 8000)) { await until(() => K3.page.evaluate(() => !!document.querySelector('[data-hm-prog]')), 8000); await K3.page.click('[data-hm-day]'); }
186
- await until(() => K3.page.$('[data-hm-sel="ms:project-ascent"]'), 8000);
187
- await shot(K3.page, 'XmsgB-home-phone'); await K3.ctx.close();
188
164
  }
189
165
  finish();
190
166
  })();
@@ -4,7 +4,8 @@
4
4
  * development OvA5Overlap, OvA6Given, OvA7Drafted). A real server on a scratch repository (c3-scan-fixture.js). The real Home runs at
5
5
  * 390 and 1440 wide; GET /api/news-for-you, /api/boards/initiative and /api/phone-day are answered in the browser, so each Viewer has
6
6
  * one overlap note, one task given to the PM and one finished draft. The POSTs are caught and answered, never sent.
7
- * O the overlap note · G a task given to you · F the Finished Viewer from Your day's Drafted for you · D dark and desk widths
7
+ * O the overlap note · G a task given to you · D dark and desk widths (F, the Finished Viewer from Your day, went with Home's list:
8
+ * home-desk-layout-delete)
8
9
  * Set NEWS_VIEWER_SHOTS=<dir> to save screenshots. */
9
10
  const fs = require('fs');
10
11
  const path = require('path');
@@ -65,7 +66,7 @@ const ROWS = { 'psle-article-paywall-lock': { title: 'PSLE Article Paywall Lock'
65
66
  if (route === '/api/news-for-you/seen' && fin) for (const f of fin) if (b && b.ids && b.ids.includes(f.key)) f.seen = true;
66
67
  return fail[route] ? json(r, { ok: false, error: fail[route] }, 409) : json(r, { ok: true }); });
67
68
  }
68
- await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(ws)}`);
69
+ await p.goto(`${F.BASE}/today.html?ws=${encodeURIComponent(ws)}`);
69
70
  await until(() => p.evaluate(() => !!document.querySelector('#hmList')));
70
71
  return { p, ctx, posts, errs };
71
72
  }
@@ -143,33 +144,6 @@ const ROWS = { 'psle-article-paywall-lock': { title: 'PSLE Article Paywall Lock'
143
144
  ok('G7 no page error', !errs.length, errs.join(' | '));
144
145
  await ctx.close();
145
146
  }
146
- /* F — the Finished Viewer from Your day's Drafted for you */
147
- {
148
- const fin = [{ id: 't-0123456789ab', key: 'fin:today:t-0123456789ab', title: 'Project Ascent status summary', summary: 'Where the tender stands, and what the TC decides.', body: '## Where the tender stands\nTwo of three vendors cleared the security review.\n\n## What the TC decides\nVendor B on cost, or vendor A on support.', at: new Date(new Date().setHours(8, 10, 0, 0)).toISOString(), status: 'done', link: null, seen: false }];
149
- const { p, ctx, posts, errs } = await page({ items: [], fin });
150
- // Home reads the day with the list: Your day opens once that read is in
151
- await until(() => fin.read);
152
- await sleep(800);
153
- await p.click('[data-hm-day]');
154
- await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-yd="fin"]')));
155
- // Good morning says "N drafted for you" once: its line opens the fold (batch 27 item 10)
156
- await p.click('#czViewer [data-yd="gm-fold"][data-fold="drafts"]');
157
- await p.click('#czViewer [data-yd="fin"]');
158
- await until(() => p.evaluate(() => /Project Ascent status summary/.test((document.querySelector('#czVwTitle') || {}).textContent || '')));
159
- const t = await vwText(p);
160
- ok('F1 the finished row opens the draft to read: Finished, nothing sent, the text as a document', /Finished · this morning/.test(t) && /Nothing is sent/.test(t) && await p.evaluate(() => /Two of three vendors/.test((document.querySelector('#czViewer article.hv-doc') || {}).textContent || '')), t.slice(0, 300));
161
- const pri = await p.evaluate(() => [...document.querySelectorAll('#czViewer .czs-pri')].map((b) => b.textContent));
162
- ok('F2 ONE primary, "Done with it"; the chat icon "Change it in chat" is in the header; no bare "Open it"', pri.join('|') === 'Done with it' && await p.evaluate(() => !!document.querySelector('#czViewer [data-cz-vw-p="chat"][aria-label="Change it in chat"]')) && !/Open it$/.test(t), pri);
163
- await shot(p, 'finished-390');
164
- await p.click('#czViewer .czs-pri');
165
- await until(() => posts.some((x) => x.path === '/api/news-for-you/seen'));
166
- const seen = posts.find((x) => x.path === '/api/news-for-you/seen');
167
- const gone = await until(() => p.evaluate(() => { const c = document.querySelector('#czViewer'); return c && /Your day/.test(document.querySelector('#czVwTitle').textContent) && !c.querySelector('[data-yd="fin"]'); }));
168
- if (!gone) console.log(await p.evaluate(() => document.querySelector('#czVwTitle').textContent + ' | ' + !!document.querySelector('#czViewer [data-yd="fin"]')));
169
- ok('F3 Done with it marks the draft seen and it leaves Drafted for you', seen && seen.body.ids[0] === fin[0].key && gone, JSON.stringify(seen));
170
- ok('F4 no page error', !errs.length, errs.join(' | '));
171
- await ctx.close();
172
- }
173
147
  /* D — dark and desk */
174
148
  {
175
149
  const { p, ctx, errs } = await page({ width: 1440, scheme: 'dark' });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.691.0",
3
+ "version": "0.693.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.691.0",
9
+ "version": "0.693.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.691.0",
3
+ "version": "0.693.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",
@@ -206,8 +206,8 @@ const everyPart = async (pg) => { await pg.waitForSelector('#czViewer .pw-ph', {
206
206
  const I = await open('/premium-initiative.html?id=pa-one&ws=' + encodeURIComponent(B.ws) + '&board=' + encodeURIComponent(B.id));
207
207
  const ip = I.page;
208
208
  const viaMore = async (pg, label) => { const it = (l) => `#czViewer .cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("${l}"))`, more = async () => { await pg.click('#czViewer:not([hidden]) [data-cz-vw="more"]'); await until(() => pg.evaluate(() => !!document.querySelector('#czViewer .cz-vw-menu'))); }, view = (v) => until(() => pg.evaluate((x) => !!document.querySelector(`#czViewer:not([hidden]) [data-hi-v="${x}"]`), v)); if ((await pg.$('#czViewer:not([hidden]) [data-hi-v="page"]')) && (await pg.$('#czViewer:not([hidden]) [data-iv-docs]')) && !['Split into a new initiative', 'Merge into', 'Program', 'Open on the Board', 'Copy', 'The record', 'Delete'].includes(label)) { await pg.click('#czViewer:not([hidden]) [data-iv-docs]'); await view('docs'); if (label === 'Documents') return; } await more(); for (let i = 0; i < 20 && !(await pg.$(it(label))) && !(await pg.$(it('Stage'))); i++) { await pg.keyboard.press('Escape'); await pg.waitForTimeout(250); await more(); } if (!(await pg.$(it(label))) && (await pg.$(it('Stage')))) { await pg.click(it('Stage')); await view('stage'); if (label === 'Stage') return; await more(); } await pg.click(it(label)); }; // batch 16 item 5c: the page's ⋯ is short; Documents opens from its fold, and the Documents view's ⋯ holds Stage, whose ⋯ holds Documents, Open the full record and Sprint
209
- const landed = await until(() => ip.evaluate(() => { const q = new URLSearchParams(location.search); return location.pathname === '/premium.html' && q.get('ini') === 'pa-one' && !!q.get('ws') && !!q.get('board') && !!document.querySelector('#czViewer .iv-mc'); }), 60000);
210
- ok('I0 the expand link lands on Home with the initiative selected, ws and board kept', !!landed, await ip.evaluate(() => location.href));
209
+ const landed = await until(() => ip.evaluate(() => { const q = new URLSearchParams(location.search); return location.pathname === '/today.html' && q.get('ini') === 'pa-one' && !!q.get('ws') && !!q.get('board') && !!document.querySelector('#czViewer .iv-mc'); }), 60000);
210
+ ok('I0 the expand link lands on Today with the initiative open, ws and board kept', !!landed, await ip.evaluate(() => location.href));
211
211
  // the page holds the Tasks (batch 11 item 20)
212
212
  await until(() => ip.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) [data-hi-v]')), 60000);
213
213
  /* X the one initiative ⋯ (batch 14 item 5, pm/ini-more.js): Home's page and the Board's panel list the same items in the same order; only
@@ -103,7 +103,7 @@ const GANTT = [
103
103
  await p.evaluate(() => import('/pm/cozy-news.js').then((M) => M.openNews({})));
104
104
  await until(newsUp, 30000);
105
105
  };
106
- await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(ws)}`);
106
+ await p.goto(`${F.BASE}/today.html?ws=${encodeURIComponent(ws)}`);
107
107
  await until(() => p.evaluate(() => document.querySelectorAll('#hmList .hm-g').length > 0), 30000);
108
108
  posts.length = 0; // Home's own writes on load (its chat marks a conversation seen) are not Around you's; R8 counts from the card's opening
109
109
  await openCard();
@@ -347,13 +347,13 @@ const GANTT = [
347
347
  const tm = (id, m, state, before) => ({ id, title: 'Meeting ' + id, start: iso(m), end: iso(m + 30), minutes: 30, people: [], initiative: null, prepared: false, before, state });
348
348
  const TODAY = [tm('a', -90, 'past', []), tm('b', 20, 'next', []), tm('c', 120, 'later', [{ id: 'x1', title: 'Send the deck', due: null }]), tm('d', 200, 'later', [])];
349
349
  await p.route('**/api/brief-page*', async (r) => { const res = await r.fetch(); const b = await res.json(); json(r, { ...b, today: TODAY }); });
350
- await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(ws)}`);
350
+ await p.goto(`${F.BASE}/today.html?ws=${encodeURIComponent(ws)}`);
351
351
  await openCard();
352
352
  ok('PR1 New for you draws no meetings ring, even with meetings left today', await p.evaluate(() => !document.querySelector('#czViewer #prep, #czViewer .ar-prep')));
353
353
  await p.unroute('**/api/brief-page*');
354
354
 
355
355
  /* L: floors */
356
- await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(ws)}`);
356
+ await p.goto(`${F.BASE}/today.html?ws=${encodeURIComponent(ws)}`);
357
357
  await openCard();
358
358
  await p.setViewportSize({ width: 390, height: 844 }); await sleep(300);
359
359
  await shot('card-390-light');
@@ -385,7 +385,7 @@ const GANTT = [
385
385
  prop(P5, tI, 'move', { to: 'Build' }, 'the plan is agreed', Date.now() - 30000);
386
386
  for (const [w, h, dark] of [[1280, 900, true], [390, 844, false], [390, 844, true]]) {
387
387
  await p.emulateMedia({ colorScheme: dark ? 'dark' : 'light' }); await p.setViewportSize({ width: w, height: h });
388
- await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(ws)}`);
388
+ await p.goto(`${F.BASE}/today.html?ws=${encodeURIComponent(ws)}`);
389
389
  await openCard();
390
390
  await open('prop'); await until(() => p.$('#czViewer .cz-vw-body .pc-bar')); await sleep(800);
391
391
  if (w === 390) {
@@ -53,7 +53,8 @@ const filesIn = () => { const d = path.join(T.STATE_DIR, 'chat-files'); const ou
53
53
  await page.route('**/api/sessions/conversation**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'user', messages: st.messages } }));
54
54
  await page.route('**/api/sessions', (r) => r.fulfill({ json: { ok: true, sessions: [{ id: 's-term', name: 'A terminal session', origin: '', shown: 'quiet' }] } }));
55
55
  await page.goto(BASE + url, { waitUntil: 'domcontentloaded' });
56
- await page.waitForFunction(() => !!document.querySelector('#hmIn'), null, { timeout: 15000 });
56
+ // on a desktop the chat the address names opens in the popup (home-page-retire): wait until the box shows, not only exists
57
+ await page.waitForFunction(() => { const i = document.querySelector('#hmIn'); return !!i && i.getClientRects().length > 0; }, null, { timeout: 15000 });
57
58
  return { page, ctx, errors, asks, st };
58
59
  };
59
60
  const chips = (page) => page.$$eval('#hmFiles .hm-att', (xs) => xs.map((x) => ({ name: x.querySelector('b').textContent, meta: (x.querySelector('em') || {}).textContent || '' })));
@@ -117,7 +118,7 @@ const filesIn = () => { const d = path.join(T.STATE_DIR, 'chat-files'); const ou
117
118
  ok('B1-B7 no page errors', errors.length === 0, errors.join(' | '));
118
119
  await ctx.close();
119
120
  /* B8 */
120
- ({ page, ctx, errors } = await open({ url: '/premium.html?session=s-term' }));
121
+ ({ page, ctx, errors } = await open({ url: '/today.html?session=s-term' }));
121
122
  await until(async () => page.evaluate(() => /A terminal session/.test((document.querySelector('#hmChat') || {}).textContent || '')), 6000);
122
123
  ok('B8 a terminal session with no conversation key cannot attach: no Attach a file and no file picker', (await page.$('#hmFoot [data-hm-file]')) === null && (await page.$('#hmFile')) === null);
123
124
  ok('B8 no page errors', errors.length === 0, errors.join(' | '));
@@ -82,9 +82,9 @@ const look = () => {
82
82
  const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
83
83
  await p.route('**/api/briefing-premium/thread?**', (r) => r.fulfill({ json: { ok: true, turns: [], session: 's-ch', goal: null } }));
84
84
  await p.route('**/api/sessions/conversation?**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'pm', messages } }));
85
- // premium-agreed-design: /premium-chat.html opens Home, whose chat is docked on a desktop; on a phone the list is the page (premium-uncovered-features
86
- // HmPhone), so the address names the conversation and it opens as the page (HmPhone2)
87
- await p.goto(BASE + url + (width < 761 && url === '/premium-chat.html' ? '?about=chat:charts' : ''));
85
+ // /premium-chat.html opens Today (home-page-retire): the address names the conversation, which opens in the popup's chat on a desktop
86
+ // and as the page on a phone (HmPhone2)
87
+ await p.goto(BASE + url + (url === '/premium-chat.html' ? '?about=chat:charts' : ''));
88
88
  await until(() => p.evaluate(() => !!document.querySelector('#hmLog [data-report-open]')));
89
89
  await sleep(500);
90
90
  return { p, ctx, errs };
@@ -95,7 +95,8 @@ const look = () => {
95
95
  ok('C1 the chart block is a chip under PMOS\'s words', /Partners activating/.test(s0.chip || '') && /New chart/.test(s0.chip || ''), JSON.stringify(s0));
96
96
  await p.click('#hmLog [data-report-open]');
97
97
  const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane && v.tiles.length ? v : null; }) || await p.evaluate(look);
98
- ok('C1 the Chart view draws the measure from its five readings as bars, as proposed: three stat tiles, the newest bar in ember', s1.tabs.includes('Chart') && /New chart/.test(s1.pane || '') && s1.bars === 5 && s1.form === 'Bars' && s1.kpis === 3 && s1.ember === 1 && !(await p.$('#czViewer .rt, #czViewer .obody, #czViewer .mt1')), JSON.stringify(s1));
98
+ // in the popup (home-page-retire) the Viewer has no kind line, and the chart's look is the popup's: the checks name the chart, not its layout
99
+ ok('C1 the Chart view draws the measure from its five readings, as proposed', /New chart/.test(s1.pane || '') && /Are partners activating\?/.test(s1.pane || '') && /20%24%30%28%33%/.test(s1.pane || '') && !(await p.$('#czViewer .rt, #czViewer .obody, #czViewer .mt1')), JSON.stringify(s1));
99
100
  if (shots) await p.screenshot({ path: `${shots}/chart-1280.png` });
100
101
  await p.click('#czViewer [data-ct="form|line"]');
101
102
  const s2 = await until(async () => { const v = await p.evaluate(look); return v.form === 'Line' ? v : null; }) || await p.evaluate(look);
@@ -114,7 +115,7 @@ const look = () => {
114
115
  { const { p, ctx, errs } = await open(1280, [ASK('a dashboard for the partner review'), { role: 'assistant', text: 'Here it is.\n\n' + block(DASH) }]);
115
116
  await p.click('#hmLog [data-report-open]');
116
117
  const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane && v.tiles.length ? v : null; }) || await p.evaluate(look);
117
- ok('C3 the Dashboard tab draws two charts in order and names the measure with no series', s1.tabs.includes('Dashboard') && s1.tiles.length === 2 && /Partner growth/.test(s1.title) && /Lonely/.test(s1.pane || '') && /fewer than two readings/.test(s1.pane || ''), JSON.stringify(s1));
118
+ ok('C3 the Dashboard tab draws two charts in order and names the measure with no series', s1.tiles.length === 2 && /Partner growth/.test(s1.title) && /Lonely/.test(s1.pane || '') && /fewer than two readings/.test(s1.pane || ''), JSON.stringify(s1));
118
119
  if (shots) await p.screenshot({ path: `${shots}/dashboard-1280.png` });
119
120
  await p.click('#czViewer [data-ct="save"]');
120
121
  await until(async () => { const v = await p.evaluate(look); return v.pane && /Saved\./.test(v.pane) ? v : null; });
@@ -132,10 +133,10 @@ const look = () => {
132
133
  await until(() => p.evaluate(() => /premium\.html\?/.test((document.querySelector('#askWhy') || {}).href || '')));
133
134
  const hasStudio = await p.evaluate(() => !!document.querySelector('.stu, #studio') || [...document.scripts].some((s) => /premium-studio/.test(s.src)));
134
135
  const href = await p.evaluate(() => document.querySelector('#askWhy').href);
135
- await Promise.all([p.waitForURL(/\/premium\.html\?/), p.click('#askWhy')]);
136
+ await Promise.all([p.waitForURL(/\/today\.html\?/), p.click('#askWhy')]);
136
137
  const u1 = new URL(p.url());
137
138
  const s2 = await until(async () => { const v = await p.evaluate(look); return v.say ? v : null; }) || await p.evaluate(look);
138
- ok('I1 Insights has no Studio; Ask why opens Home\'s chat about Insights', !hasStudio && u1.pathname === '/premium.html' && u1.searchParams.get('ask') === 'insights' && /ask=insights/.test(href), JSON.stringify([href, u1.search]));
139
+ ok('I1 Insights has no Studio; Ask why opens Home\'s chat about Insights', !hasStudio && u1.pathname === '/today.html' && u1.searchParams.get('ask') === 'insights' && /ask=insights/.test(href), JSON.stringify([href, u1.search]));
139
140
  ok('I1 the question waits in the box, not sent', /^Why/.test(s2.say) && asked === 0, JSON.stringify([s2.say, asked]));
140
141
  ok('F1 no page error (Insights to Home)', !errs.length, errs.join(' | '));
141
142
  await ctx.close(); }
@@ -65,7 +65,9 @@ const second = (k) => [
65
65
  return { p, ctx, errs, conv };
66
66
  };
67
67
  const look = () => {
68
- const vw = document.querySelector('#czViewer:not([hidden])'), peek = document.querySelector('#hmPeek');
68
+ // on a desktop the chat is the popup's (home-page-retire), whose work side holds the session list until an item opens there
69
+ const vw0 = document.querySelector('#czViewer:not([hidden])'), peek = document.querySelector('#hmPeek');
70
+ const vw = vw0 && /^All sessions$/.test(((vw0.querySelector('#czVwTitle') || {}).textContent || '').trim()) ? null : vw0;
69
71
  const title = vw ? ((vw.querySelector('#czVwTitle') || {}).textContent || '').trim() : '';
70
72
  return { tab: vw ? 'out' : 'chat', shut: !vw, layer: false, out: vw ? Math.round(vw.getBoundingClientRect().width) : 0,
71
73
  tabs: vw && title ? [title] : [],
@@ -83,8 +83,10 @@ const look = () => {
83
83
  await p.click('#hmLog .pl-dv [data-goal-open]');
84
84
  const s1 = await until(async () => { const v = await p.evaluate(look); return !v.shut && v.pane ? v : null; }) || await p.evaluate(look);
85
85
  ok('G1 the chip opens a Goal tab with the goal, its done points and why it stopped', /Goal/.test(s1.on || '') && /Stopped/.test(s1.pane || '') && /0 of 3 done points met/.test(s1.pane || '') && /Totals match GA4/.test(s1.pane || '') && /You stopped it/.test(s1.pane || ''), JSON.stringify(s1));
86
- await p.click('#czViewer [data-cz-vw="close"]'); await until(() => p.evaluate(() => !document.querySelector('#czViewer:not([hidden])')));
87
86
  st.goal = goalOf('started', { met: [DRAFT.done[0]] });
87
+ // in the popup (home-page-retire) ✕ closes the popup with its chat: the chat opens again from its address, as the PM would
88
+ if (await p.$('#czViewer [data-cz-vw="close"]')) { await p.click('#czViewer [data-cz-vw="close"]'); await until(() => p.evaluate(() => !document.querySelector('#czViewer:not([hidden])'))); }
89
+ else { await p.goto(chat + '&about=work:goal-test'); await until(() => p.evaluate(() => !!document.querySelector('#hmLog .hm-a, #hmLog .hm-u'))); await sleep(400); }
88
90
  const s1b = await until(async () => { const v = await p.evaluate(look); return v.line ? v : null; }) || await p.evaluate(look);
89
91
  ok('G2 a goal at work is the line at the top, and opens nothing by itself', /Each drop has a reason label/.test(s1b.line || '') && /1 of 3 done/.test(s1b.line || '') && s1b.shut && !s1b.chip, JSON.stringify(s1b));
90
92
  await p.click('#hmPl [data-pl="toggle"]');