create-pmos 0.609.0 → 0.611.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 (145) hide show
  1. package/package.json +69 -27
  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/board-columns-test.js +2 -1
  7. package/workspace/board-deliveries-test.js +2 -1
  8. package/workspace/board-programs-test.js +9 -5
  9. package/workspace/board-publish-ui-test.js +2 -1
  10. package/workspace/board-shared-ui-test.js +2 -1
  11. package/workspace/board-workflows-test.js +2 -1
  12. package/workspace/briefing-premium-adddoc-test.js +2 -1
  13. package/workspace/briefing-premium-board-test.js +10 -9
  14. package/workspace/briefing-premium-doc-edit-test.js +2 -1
  15. package/workspace/briefing-premium-initiative-test.js +7 -6
  16. package/workspace/briefing-premium-insights-test.js +12 -11
  17. package/workspace/briefing-premium-products-test.js +4 -2
  18. package/workspace/briefing-premium-sources-test.js +1 -1
  19. package/workspace/briefing-premium-test.js +6 -5
  20. package/workspace/briefing-premium-work-test.js +1 -1
  21. package/workspace/calm-timeline-test.js +2 -1
  22. package/workspace/changelog.json +68 -0
  23. package/workspace/core-docs-workflow-test.js +2 -1
  24. package/workspace/ev-everywhere-test.js +11 -10
  25. package/workspace/guide/home.md +2 -2
  26. package/workspace/guide/index.md +4 -0
  27. package/workspace/guide/layout.md +92 -11
  28. package/workspace/guide/programs.md +16 -2
  29. package/workspace/guide/routine.md +50 -0
  30. package/workspace/guide/scheduled-tasks-and-cli.md +1 -1
  31. package/workspace/guide/settings-and-switches.md +1 -1
  32. package/workspace/home-other-product-test.js +2 -1
  33. package/workspace/home-railcard-test.js +2 -1
  34. package/workspace/impact-screens-test.js +3 -1
  35. package/workspace/ini-workflow-test.js +2 -1
  36. package/workspace/lib/beside-page.js +15 -0
  37. package/workspace/lib/classic-board.js +15 -0
  38. package/workspace/lib/events-place.js +216 -0
  39. package/workspace/lib/library-items.js +78 -0
  40. package/workspace/lib/notes.js +6 -1
  41. package/workspace/lib/route-modules.js +4 -0
  42. package/workspace/lib/routes-events-place.js +166 -0
  43. package/workspace/lib/routes-library.js +89 -0
  44. package/workspace/lib/routes-pop-work.js +39 -0
  45. package/workspace/lib/routes-report-setups.js +20 -0
  46. package/workspace/lib/routes-today-log.js +48 -0
  47. package/workspace/lib/routine-reports.js +52 -0
  48. package/workspace/lib/today-log.js +131 -0
  49. package/workspace/live-pill-round-test.js +11 -9
  50. package/workspace/metric-drafts-ui-test.js +3 -1
  51. package/workspace/milestone-pins-test.js +2 -1
  52. package/workspace/milestone-suggest-test.js +3 -1
  53. package/workspace/package-lock.json +2 -2
  54. package/workspace/package.json +1 -1
  55. package/workspace/panels-test.js +6 -4
  56. package/workspace/premium-board-actions-test.js +3 -1
  57. package/workspace/premium-chat-context-test.js +6 -6
  58. package/workspace/premium-chat-line-test.js +1 -1
  59. package/workspace/premium-chat-notes-test.js +1 -1
  60. package/workspace/premium-core-doc-issue-test.js +2 -1
  61. package/workspace/premium-rec-tab-test.js +2 -1
  62. package/workspace/premium-vw-backlog-test.js +3 -1
  63. package/workspace/premium-vw-cal-test.js +1 -1
  64. package/workspace/premium-vw-doc-test.js +2 -1
  65. package/workspace/premium-vw-item-test.js +3 -1
  66. package/workspace/premium-vw-jira-test.js +3 -1
  67. package/workspace/product-lane-test.js +2 -1
  68. package/workspace/program-charter-test.js +3 -1
  69. package/workspace/program-leave-test.js +3 -1
  70. package/workspace/program-order-test.js +2 -1
  71. package/workspace/program-panel-test.js +5 -3
  72. package/workspace/public/pm/bd-ini-panel.js +75 -8
  73. package/workspace/public/pm/bd-prog-panel.js +55 -8
  74. package/workspace/public/pm/bd-scroll.js +4 -2
  75. package/workspace/public/pm/bd-work.css +130 -0
  76. package/workspace/public/pm/bd-work.js +356 -0
  77. package/workspace/public/pm/cozy-board.css +3 -0
  78. package/workspace/public/pm/cozy-ev.css +52 -0
  79. package/workspace/public/pm/cozy-events-view.js +142 -0
  80. package/workspace/public/pm/cozy-events.css +107 -0
  81. package/workspace/public/pm/cozy-events.js +210 -0
  82. package/workspace/public/pm/cozy-evmodel.js +1 -1
  83. package/workspace/public/pm/cozy-library.css +36 -0
  84. package/workspace/public/pm/cozy-live-pill.js +3 -1
  85. package/workspace/public/pm/cozy-nav.js +70 -7
  86. package/workspace/public/pm/cozy-panels.js +1 -1
  87. package/workspace/public/pm/cozy-pick.css +3 -0
  88. package/workspace/public/pm/cozy-pick.js +6 -2
  89. package/workspace/public/pm/cozy-pop-work.css +165 -0
  90. package/workspace/public/pm/cozy-pop-work.js +427 -0
  91. package/workspace/public/pm/cozy-popup.css +113 -0
  92. package/workspace/public/pm/cozy-popup.js +408 -0
  93. package/workspace/public/pm/cozy-routine-model.js +111 -0
  94. package/workspace/public/pm/cozy-routine-pop.js +196 -0
  95. package/workspace/public/pm/cozy-routine.css +102 -0
  96. package/workspace/public/pm/cozy-routine.js +156 -0
  97. package/workspace/public/pm/cozy-schedwork.js +6 -5
  98. package/workspace/public/pm/cozy-settings.js +10 -1
  99. package/workspace/public/pm/cozy-today-app.js +236 -0
  100. package/workspace/public/pm/cozy-today-model.js +176 -0
  101. package/workspace/public/pm/cozy-today-page.css +100 -0
  102. package/workspace/public/pm/cozy-today-view.js +76 -0
  103. package/workspace/public/pm/cozy-viewer.js +66 -18
  104. package/workspace/public/pm/home-app.js +29 -6
  105. package/workspace/public/pm/home-ini.js +39 -7
  106. package/workspace/public/pm/library-model.js +69 -0
  107. package/workspace/public/pm/library-open.js +34 -0
  108. package/workspace/public/pm/page-chat.js +16 -4
  109. package/workspace/public/pm/pop-sessions.js +65 -0
  110. package/workspace/public/pm/pop-work-model.js +335 -0
  111. package/workspace/public/pm/premium-board.js +137 -11
  112. package/workspace/public/pm/premium-insights.js +14 -2
  113. package/workspace/public/pm/premium-library.js +122 -0
  114. package/workspace/public/pm/premium-shell.js +1 -1
  115. package/workspace/public/premium-board.html +1 -0
  116. package/workspace/public/premium-events.html +42 -0
  117. package/workspace/public/premium-library.html +31 -0
  118. package/workspace/public/premium-routine.html +31 -0
  119. package/workspace/public/today.html +50 -0
  120. package/workspace/ready-dash-ui-test.js +3 -1
  121. package/workspace/rename-test.js +2 -1
  122. package/workspace/run-tests.js +4 -1
  123. package/workspace/server.js +3 -2
  124. package/workspace/sort-order-test.js +2 -1
  125. package/workspace/split-merge-ui-test.js +3 -1
  126. package/workspace/stage-card-tasks-test.js +5 -3
  127. package/workspace/stage-card-test.js +2 -1
  128. package/workspace/task-card-test.js +2 -1
  129. package/workspace/task-delete-test.js +3 -1
  130. package/workspace/task-links-test.js +4 -2
  131. package/workspace/task-milestones-test.js +4 -2
  132. package/workspace/task-plans-test.js +3 -1
  133. package/workspace/task-press-test.js +3 -1
  134. package/workspace/task-views-test.js +10 -8
  135. package/workspace/test-lists/events-place.json +11 -0
  136. package/workspace/test-lists/library-place.json +9 -0
  137. package/workspace/test-lists/one-popup.json +9 -0
  138. package/workspace/test-lists/pop-work.json +9 -0
  139. package/workspace/test-lists/routine-place.json +9 -0
  140. package/workspace/test-lists/today-log.json +9 -0
  141. package/workspace/test-lists/work-view.json +9 -0
  142. package/workspace/timeline-holds-test.js +3 -1
  143. package/workspace/tk-tasks-test.js +3 -1
  144. package/workspace/viewer-trail-test.js +1 -1
  145. package/workspace/workflows-setup-test.js +1 -1
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+ /* routes-pop-work.js — the summary of an initiative changed or confirmed in place, in the popup (initiative popup-work-contents, slice 3 of
3
+ * the six-place navigation; board 3: "You change a value where you see it: the summary … It saves when you leave, with Undo for a moment").
4
+ *
5
+ * POST /api/initiative/describe { ws, id, text } → { ok, id, from, text, same? } the record's description line
6
+ * POST /api/initiative/describe-undo { ws, id, from, to } → { ok, kept? } back to `from` while the line still says `to`
7
+ *
8
+ * The writer is lib/initiative-writer.js setDescription and restoreDescription, the same as `pmos initiative describe` and the ✓ on PMOS's
9
+ * description ✦ (lib/routes-proposals.js). Both POSTs pass pm-guard requirePagePress: the launch nonce and the page's origin, so an agent
10
+ * session cannot write here. A record the PM edited since the Undo was offered keeps its edit (→ { ok: true, kept: true }). */
11
+ const guard = require('./pm-guard.js');
12
+ const W = require('./initiative-writer.js');
13
+
14
+ const text = (v) => (typeof v === 'string' ? v : '');
15
+ const bad = (status, error) => ({ status, body: { ok: false, error } });
16
+
17
+ async function handle(req, res, url, ctx) {
18
+ const send = (r) => { ctx.json(res, r.body, r.status); return true; };
19
+ const sub = url.pathname.replace(/^\/api\/initiative\/?/, '');
20
+ if (sub !== 'describe' && sub !== 'describe-undo') return send(bad(404, 'no such route'));
21
+ if (req.method !== 'POST') return send(bad(405, 'POST only'));
22
+ const read = await ctx.readJson(req);
23
+ if (!read.ok || !read.body || typeof read.body !== 'object') return send(bad(400, 'the body must be a JSON object'));
24
+ const body = read.body;
25
+ const g = guard.requirePagePress(req, body);
26
+ if (!g.ok) return send(bad(g.status, g.error));
27
+ const id = text(body.id);
28
+ if (!id || !W.ID_RE.test(id)) return send(bad(400, 'id must name an initiative'));
29
+ const w = ctx.getWs(text(body.ws) || null);
30
+ if (!w || (body.ws && w.id !== body.ws)) return send(bad(404, 'no such workspace'));
31
+ const r = sub === 'describe'
32
+ ? W.setDescription(w.root, id, text(body.text), { actor: g.actor })
33
+ : W.restoreDescription(w.root, id, text(body.from), text(body.to), { actor: g.actor });
34
+ if (!r.ok) return send(bad(r.status || 400, r.error || 'nothing was saved'));
35
+ try { if (ctx.invalidateNeedsAgg) ctx.invalidateNeedsAgg(w.id); } catch { /* the next read catches up */ }
36
+ return send({ status: 200, body: sub === 'describe' ? { ok: true, id, from: r.from || '', text: r.text, ...(r.same ? { same: true } : {}) } : { ok: true, ...(r.kept ? { kept: true } : {}) } });
37
+ }
38
+
39
+ module.exports = { prefixes: ['/api/initiative/describe', '/api/initiative/describe-undo'], handle };
@@ -30,6 +30,8 @@
30
30
  * report from Intelligence and drafts issue 1 from the live model (source intelligence:<scope>)
31
31
  * POST /api/report-setups/strip-dismiss { ws, id } → { ok } Not now on a report the ✦ strip proposed
32
32
  * GET /api/report-documents?ws → { docs: [{ path, id, setup, name, slot, state: draft|issued, source, output, made_by: schedule|you|agent, v, copy }] }
33
+ * GET /api/report-setups/routine?ws → { ok, ws, name, reports: [row] } every report of the workspace as one row of Routine (lib/routine-reports.js;
34
+ * slice 8 of the six-place navigation). Read-only: it settles nothing and migrates nothing.
33
35
  * POST /api/report-documents/discard { ws, path } → { ok, doc } delete an UNISSUED draft; an issued report is 409 and untouched (L3)
34
36
  * POST /api/report-documents/archive { ws, path, archived } → { ok, doc, archived } hide (or bring back) an ISSUED report; a draft is 409 (L4)
35
37
  * GET /api/report-export?ws&path&fmt=pptx|xlsx|docx|csv → the file, Content-Disposition: attachment. PDF is printed by the browser: there is no route.
@@ -335,6 +337,24 @@ async function handle(req, res, url, ctx) {
335
337
  const preview = IR.documentOf(m, { id: 'preview', name: S.name, audience: defaults.audience, output: defaults.output, source: IR.sourceOf(scope), storyline: story }, { slot: m.today, issue: 1 });
336
338
  return send({ status: 200, body: { ok: true, storyline: S, defaults, checks: IR.storyChecks(preview), proposals: IR.proposalsOf(m, { findings, dismissed: [...st.stripDismissed], weekly: weeklyOpen(ctx, w.id), covered: [...st.setups.values()].map((x) => IR.scopeOf(x.source)).filter(Boolean) }), as_of: m.today } });
337
339
  }
340
+ if (sub === 'routine') {
341
+ // Routine (slice 8 of the six-place navigation, lib/routine-reports.js): every report of the workspace as one row, with its one ✓. Read-only.
342
+ if (req.method !== 'GET') return send(bad(405, 'GET only'));
343
+ const w = wsOf(ctx, url.searchParams.get('ws'));
344
+ if (!w) return send(bad(404, 'no such workspace'));
345
+ const now = new Date();
346
+ let defs = [];
347
+ try { defs = RS.definitionsOf(w.root); } catch { defs = []; }
348
+ const boards = typeof ctx.workspaceList === 'function' ? ctx.workspaceList().map((x) => ({ ws: x.id, name: x.name })) : [];
349
+ // the setups as the ledger holds them, read only (listAnswer would settle a stale ask: a write); next is the same nextDraftAt it uses
350
+ const setups = [...RS.fold(RS.readLines(RS.ledgerFile(w.root))).setups.values()].map((s) => {
351
+ let next = null;
352
+ if (s.status === 'active' && s.schedule) { try { const n = RS.nextDraftAt(s.schedule, s.last_run, now); next = n ? n.toISOString() : null; } catch { next = null; } }
353
+ return { id: s.id, name: s.name, purpose: s.purpose, audience: s.audience, source: s.source, output: s.output, schedule: s.schedule, label: RS.scheduleLabel(s.schedule), next_draft: next, status: s.status };
354
+ });
355
+ const reports = require('./routine-reports.js').routineReports({ setups, docs: documentsOf(ctx, w).docs, defs, boards, here: w.id });
356
+ return send({ status: 200, body: { ok: true, ws: w.id, name: w.name || w.id, reports } });
357
+ }
338
358
  if (!docPost && (isDocs || isExport || (sub === '' && req.method === 'GET'))) {
339
359
  if (req.method !== 'GET') return send(bad(405, 'GET only'));
340
360
  if ((isDocs && p !== '/api/report-documents') || (isExport && p !== '/api/report-export')) return send(bad(404, 'no such report route'));
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+ /* routes-today-log.js — Today's log (slice 5 of the six-place navigation; lib/today-log.js is the store).
3
+ *
4
+ * GET /api/today-log?day=YYYY-MM-DD → { ok, day, entries, marks } the PM's own entries and the marks on the rows of that day
5
+ * POST /api/today-log/add { text, day, bullet?, first? } → { ok, entry } a task, an event or a note typed in the first line
6
+ * POST /api/today-log/mark { key, act, day, until?, snap? } → { ok } done, undone, later (until a later day), now (back to today), drop, undrop, keep
7
+ *
8
+ * The day is the PM's local day, sent by the page. Every POST passes pm-guard requirePagePress: the page only. A mark changes only the
9
+ * log: done on a task or an item of the PM is sent to that record's own route by the page, and the mark is the log's line beside it.
10
+ * STATE: <runtime>/today-log/log.jsonl, append-only, one writer (lib/today-log.js appendLine). */
11
+ const path = require('path');
12
+ const crypto = require('crypto');
13
+ const guard = require('./pm-guard.js');
14
+ const TL = require('./today-log.js');
15
+
16
+ const fileOf = (ctx) => path.join(ctx.runtimeDir, 'today-log', 'log.jsonl');
17
+ const localDay = (now = new Date()) => new Date(now.getTime() - now.getTimezoneOffset() * 60000).toISOString().slice(0, 10);
18
+
19
+ module.exports = {
20
+ prefixes: ['/api/today-log'],
21
+ fileOf,
22
+ handle: async (req, res, url, ctx) => {
23
+ const p = url.pathname;
24
+ if (!ctx.runtimeDir) { ctx.json(res, { ok: false, error: 'PMOS has no state folder here, so Today cannot keep a log' }, 503); return true; }
25
+ if (p === '/api/today-log' && req.method === 'GET') {
26
+ const day = url.searchParams.get('day') || localDay();
27
+ if (!TL.DAY_RE.test(day)) { ctx.json(res, { ok: false, error: 'day is YYYY-MM-DD' }, 400); return true; }
28
+ const f = TL.fold(TL.readLines(fileOf(ctx)), day);
29
+ ctx.json(res, { ok: true, day, entries: f.entries, marks: f.marks });
30
+ return true;
31
+ }
32
+ if (req.method !== 'POST' || (p !== '/api/today-log/add' && p !== '/api/today-log/mark')) return false;
33
+ const got = await ctx.readJson(req);
34
+ if (!got.ok) { ctx.json(res, { ok: false, error: 'invalid JSON body' }, 400); return true; }
35
+ const body = got.body || {};
36
+ const g = guard.requirePagePress(req, body);
37
+ if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
38
+ const day = String(body.day || '');
39
+ const r = p === '/api/today-log/add' ? TL.addEvent(body, day, 'tl-' + crypto.randomBytes(6).toString('hex')) : TL.markEvent(body, day);
40
+ if (r.error) { ctx.json(res, { ok: false, error: r.error }, 400); return true; }
41
+ TL.appendLine(fileOf(ctx), r.event);
42
+ if (p === '/api/today-log/add') {
43
+ const e = r.event;
44
+ ctx.json(res, { ok: true, entry: { id: e.id, key: 'own:' + e.id, bullet: e.bullet, text: e.text, first: e.first, time: e.time, day: e.day, done: false } });
45
+ } else ctx.json(res, { ok: true });
46
+ return true;
47
+ },
48
+ };
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+ /* routine-reports.js — every report of a workspace as one row of Routine (initiative routine-place, slice 8 of the six-place navigation;
3
+ * board 11 on Exploring 2; done test planning/done-tests/routine-place.md T1).
4
+ *
5
+ * routineReports({ setups, docs, defs, boards, here }) → [row] PURE
6
+ * setups GET /api/report-setups setups (lib/routes-report-setups.js listAnswer): { id, name, purpose, audience, source, output, schedule,
7
+ * label, next_draft, status: active | paused }
8
+ * docs the report documents (routes-report-setups.js documentsOf docs): { path, setup, name, slot, state: draft | issued, archived, source, output }
9
+ * defs the definitions (lib/report-setups.js definitionsOf): { id, title, audience, status, source, output }
10
+ * boards [{ ws, name }] and here: the workspace the reports sit in (for the ✦ Move of lib/report-acts.js)
11
+ * row: { id, name, audience, purpose, when, schedule, next, status: 'active' | 'paused' | null, output, source, act, issues, latest }
12
+ * when the setup's schedule in words; '' when no setup says it (a definition drafted by a skill has no schedule here)
13
+ * next the setup's next draft (ISO) while it is active, else null
14
+ * act the report's one ✓ (lib/report-acts.js reportActOf): move | confirm | issue | resume, or null
15
+ * issues its files, newest first: { path, slot, state, archived }; latest is the newest one not archived, or null
16
+ *
17
+ * A report is a row when it has a setup or at least one issue. A definition with neither is not drawn (zero is silence). Nothing is filled with a
18
+ * guess: a field the records leave silent is '' or null. Read-only: nothing here writes.
19
+ */
20
+ const RA = require('./report-acts.js');
21
+
22
+ const str = (v) => (typeof v === 'string' ? v : '');
23
+
24
+ function routineReports(f = {}) {
25
+ const setups = (f.setups || []).filter((s) => s && s.id);
26
+ const docs = (f.docs || []).filter((d) => d && d.path);
27
+ const defs = new Map((f.defs || []).filter((d) => d && d.id).map((d) => [d.id, d]));
28
+ const cadenceOf = (d) => d.setup || str(d.cadence) || String(d.path).split('/').slice(-2, -1)[0] || '';
29
+ const ids = [...new Set(setups.map((s) => s.id).concat(docs.map(cadenceOf)).filter(Boolean))];
30
+ const out = [];
31
+ for (const id of ids) {
32
+ const s = setups.find((x) => x.id === id) || null, def = defs.get(id) || null;
33
+ const issues = docs.filter((d) => cadenceOf(d) === id).map((d) => ({ path: d.path, slot: str(d.slot), state: d.state === 'issued' ? 'issued' : 'draft', archived: !!d.archived }))
34
+ .sort((a, b) => (a.slot < b.slot ? 1 : a.slot > b.slot ? -1 : 0));
35
+ const setup = s ? { ...s, paused: s.status === 'paused' } : null;
36
+ const about = setup ? RA.reportAboutOf([s.name, s.purpose].join(' · '), f.boards, f.here) : null;
37
+ const act = RA.reportActOf({ id, setup, rows: issues, def, about });
38
+ const named = docs.find((d) => cadenceOf(d) === id && d.name && d.name !== id);
39
+ out.push({
40
+ id, name: (s && s.name) || RA.defTitleOf(def) || (named && named.name) || id,
41
+ audience: str(s && s.audience) || str(def && def.audience), purpose: str(s && s.purpose),
42
+ when: s ? str(s.label) : '', schedule: s && s.schedule ? s.schedule : null, next: s && s.status === 'active' ? s.next_draft || null : null,
43
+ status: s ? (s.status === 'paused' ? 'paused' : 'active') : null,
44
+ output: str(s && s.output) || str(def && def.output) || str(named && named.output), source: str(s && s.source) || str(def && def.source) || str(named && named.source),
45
+ act, issues, latest: issues.find((x) => !x.archived) || null,
46
+ });
47
+ }
48
+ // a set-up report first, then by name: the table's order inside its group
49
+ return out.sort((a, b) => (a.status ? 0 : 1) - (b.status ? 0 : 1) || a.name.localeCompare(b.name));
50
+ }
51
+
52
+ module.exports = { routineReports };
@@ -0,0 +1,131 @@
1
+ 'use strict';
2
+ /* today-log.js — Today's log, the store (slice 5 of the six-place navigation, board 1 on Exploring 2; build plan
3
+ * /mnt/project-files/nav-structure/build-plan.md, initiative today-log-page).
4
+ *
5
+ * Today's log is a table kept the Bullet Journal way. Most rows come from what PMOS already reads (the ranked asks, the PM's tasks,
6
+ * the next steps, the PM's own items); this file keeps only what Today adds:
7
+ * - the PM's own entries typed in the first line: a task (•), an event (○, with a time when the words name one) or a note (–),
8
+ * "!" in front marks what comes first;
9
+ * - the PM's marks on any row of the log: done today, moved to a later day (and back), dropped from the log, kept after PMOS suggested
10
+ * to drop it.
11
+ * A mark never changes the record a row comes from. Done on a task or an item goes through that record's own route; the mark is the
12
+ * log's own line, so the row keeps its × for the rest of the day.
13
+ *
14
+ * parseEntry(text) → { bullet: 'task' | 'event' | 'note', text, first, time } | null PURE
15
+ * fold(lines, day) → { entries, marks } PURE. entries: open own entries of `day` and of the days before it
16
+ * (carried), and the ones done on `day`; marks: { [key]: { done?, until?, dropped?, kept? } }
17
+ * addEvent(body, day, id) → { event } | { error } PURE: the line POST /api/today-log/add appends
18
+ * markEvent(body, day) → { event } | { error } PURE: the line POST /api/today-log/mark appends
19
+ * readLines(file) · appendLine(file, line, now) the one file, append-only, <runtime>/today-log/log.jsonl
20
+ *
21
+ * SINGLE WRITER: appendLine() is the only function that writes the file. `at` is set there. The day is the PM's local day, sent by
22
+ * the page (the server may run on a host in another time zone), and checked to be YYYY-MM-DD.
23
+ */
24
+ const fs = require('fs');
25
+ const path = require('path');
26
+
27
+ const DAY_RE = /^\d{4}-\d{2}-\d{2}$/;
28
+ const KEY_RE = /^[A-Za-z0-9][A-Za-z0-9._:@/+-]{0,199}$/;
29
+ const ID_RE = /^tl-[0-9a-z]{6,20}$/;
30
+ const BULLETS = ['task', 'event', 'note'];
31
+ const ACTS = ['done', 'undone', 'later', 'now', 'drop', 'undrop', 'keep'];
32
+ const MAX_TEXT = 240;
33
+ const SNAP = ['title', 'work', 'job'];
34
+
35
+ /** One line the PM typed. A leading "!" marks it first; "o " or "○ " makes it an event, "- " or "– " a note, "• " or nothing a task.
36
+ * An event's time ("10:30", "9.15", "14:00") is read from its words and kept apart. */
37
+ function parseEntry(text) {
38
+ let t = String(text == null ? '' : text).replace(/\s+/g, ' ').trim();
39
+ let first = false, bullet = 'task';
40
+ for (let i = 0; i < 2; i++) {
41
+ if (/^!\s*/.test(t)) { first = true; t = t.replace(/^!\s*/, ''); continue; }
42
+ const b = /^([o○•\-–—])\s+/.exec(t);
43
+ if (b) { bullet = /[o○]/.test(b[1]) ? 'event' : /[-–—]/.test(b[1]) ? 'note' : 'task'; t = t.slice(b[0].length); continue; }
44
+ }
45
+ let time = null;
46
+ if (bullet === 'event') {
47
+ const m = /(?:^|\s)(?:at\s+)?([01]?\d|2[0-3])[:.]([0-5]\d)(?=\s|$)/i.exec(t);
48
+ if (m) { time = String(m[1]).padStart(2, '0') + ':' + m[2]; t = (t.slice(0, m.index) + ' ' + t.slice(m.index + m[0].length)).replace(/\s+/g, ' ').trim(); }
49
+ }
50
+ t = t.slice(0, MAX_TEXT).trim();
51
+ if (!t) return null;
52
+ return { bullet, text: t, first, time };
53
+ }
54
+
55
+ /** The line POST /api/today-log/add appends. body: { text, day, bullet? (overrides the typed bullet), first? }. */
56
+ function addEvent(body, day, id) {
57
+ if (!DAY_RE.test(String(day || ''))) return { error: 'day is YYYY-MM-DD' };
58
+ if (!ID_RE.test(String(id || ''))) return { error: 'bad id' };
59
+ const e = parseEntry(body && body.text);
60
+ if (!e) return { error: 'write the task, the event or the note first' };
61
+ if (body.bullet != null && !BULLETS.includes(body.bullet)) return { error: 'bullet is task, event or note' };
62
+ const bullet = body.bullet || e.bullet;
63
+ return { event: { event: 'added', id, day, bullet, text: e.text, first: !!(body.first || e.first), time: bullet === 'event' ? e.time : null } };
64
+ }
65
+
66
+ /** The line POST /api/today-log/mark appends. body: { key, act, day, until? (later), snap? { title, work, job } (done: what the row
67
+ * said, so its × still reads after the source has let it go) }. */
68
+ function markEvent(body, day) {
69
+ const b = body || {};
70
+ if (!DAY_RE.test(String(day || ''))) return { error: 'day is YYYY-MM-DD' };
71
+ if (!KEY_RE.test(String(b.key || ''))) return { error: 'key names the row' };
72
+ if (!ACTS.includes(b.act)) return { error: 'act is ' + ACTS.join(', ') };
73
+ const ev = { event: 'mark', key: String(b.key), act: b.act, day };
74
+ if (b.act === 'later') {
75
+ if (!DAY_RE.test(String(b.until || '')) || b.until <= day) return { error: 'until is a later day, YYYY-MM-DD' };
76
+ ev.until = b.until;
77
+ }
78
+ if (b.act === 'done' && b.snap && typeof b.snap === 'object') {
79
+ const s = {};
80
+ for (const k of SNAP) if (typeof b.snap[k] === 'string' && b.snap[k].trim()) s[k] = b.snap[k].replace(/\s+/g, ' ').trim().slice(0, MAX_TEXT);
81
+ if (Object.keys(s).length) ev.snap = s;
82
+ }
83
+ return { event: ev };
84
+ }
85
+
86
+ /** Fold the lines for one day. An own entry shows on its day and every day after until it is done or dropped (carried); a done
87
+ * entry shows only on the day it was done. A mark holds by key: the last done/undone wins, a later day hides the row until then,
88
+ * a drop hides it until an undrop, a keep is remembered with its day (PMOS suggests a drop again only a while after it). */
89
+ function fold(lines, day) {
90
+ const d = DAY_RE.test(String(day || '')) ? day : '9999-12-31';
91
+ const own = new Map(), marks = {};
92
+ const M = (k) => (marks[k] = marks[k] || {});
93
+ for (const ev of lines || []) {
94
+ if (!ev || typeof ev !== 'object' || !DAY_RE.test(String(ev.day || '')) || ev.day > d) continue;
95
+ if (ev.event === 'added' && ID_RE.test(String(ev.id || '')) && BULLETS.includes(ev.bullet)) {
96
+ own.set(ev.id, { id: ev.id, key: 'own:' + ev.id, bullet: ev.bullet, text: String(ev.text || ''), first: !!ev.first, time: ev.time || null, day: ev.day, at: ev.at || null });
97
+ continue;
98
+ }
99
+ if (ev.event !== 'mark' || !KEY_RE.test(String(ev.key || '')) || !ACTS.includes(ev.act)) continue;
100
+ const m = M(ev.key);
101
+ if (ev.act === 'done') { m.done = ev.day; if (ev.snap) m.snap = ev.snap; }
102
+ else if (ev.act === 'undone') { delete m.done; delete m.snap; }
103
+ else if (ev.act === 'later') { if (ev.until > d) m.until = ev.until; else delete m.until; }
104
+ else if (ev.act === 'now') delete m.until;
105
+ else if (ev.act === 'drop') m.dropped = ev.day;
106
+ else if (ev.act === 'undrop') delete m.dropped;
107
+ else if (ev.act === 'keep') m.kept = ev.day;
108
+ }
109
+ // a done mark of an earlier day is history: the row is gone from today's log (an own entry), or it is back as its source says
110
+ for (const k of Object.keys(marks)) { const m = marks[k]; if (m.done && m.done !== d) { m.doneBefore = m.done; delete m.done; delete m.snap; } if (!Object.keys(m).length) delete marks[k]; }
111
+ const entries = [];
112
+ for (const e of own.values()) {
113
+ const m = marks[e.key] || {};
114
+ if (m.dropped) continue;
115
+ if (m.doneBefore && !m.done) continue;
116
+ entries.push({ ...e, done: !!m.done });
117
+ }
118
+ return { entries, marks };
119
+ }
120
+
121
+ function readLines(file) {
122
+ let raw = '';
123
+ try { raw = fs.readFileSync(file, 'utf8'); } catch { return []; }
124
+ return raw.split('\n').filter(Boolean).map((l) => { try { return JSON.parse(l); } catch { return null; } }).filter(Boolean);
125
+ }
126
+ function appendLine(file, line, now = new Date()) {
127
+ fs.mkdirSync(path.dirname(file), { recursive: true });
128
+ fs.appendFileSync(file, JSON.stringify({ ...line, at: now.toISOString() }) + '\n');
129
+ }
130
+
131
+ module.exports = { DAY_RE, KEY_RE, BULLETS, ACTS, parseEntry, addEvent, markEvent, fold, readLines, appendLine };
@@ -10,6 +10,7 @@
10
10
  * F2 a phone: no fold · every page: no page error
11
11
  * PMOS_SHOTS=<dir> also saves the screenshots. */
12
12
  const path = require('path');
13
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
13
14
  const fs = require('fs');
14
15
  const { spawn } = require('child_process');
15
16
  const { findBrowser } = require('./lib/find-browser');
@@ -46,7 +47,7 @@ const ASKS = () => RUNNING().concat([{ id: 'b', name: 'Redistribute plan items',
46
47
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
47
48
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
48
49
  await T.waitForServer(BASE);
49
- browser = await chromium.launch({ executablePath: exe });
50
+ browser = classicBoard(await chromium.launch({ executablePath: exe }));
50
51
  if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
51
52
  const shot = async (page, name) => { if (SHOTS) { await sleep(300); await page.screenshot({ path: path.join(SHOTS, name + '.png') }); } };
52
53
 
@@ -67,13 +68,15 @@ const ASKS = () => RUNNING().concat([{ id: 'b', name: 'Redistribute plan items',
67
68
  /* L2 */
68
69
  live = RUNNING(); await kick();
69
70
  const l2 = await until(() => page.evaluate(() => {
70
- const l = document.getElementById('czLive'), f = document.getElementById('czFab'); if (!l || l.hidden) return null;
71
+ const l = document.getElementById('czLive'), f = document.querySelector('#czMenu.ev-rail [data-cz-chat]') || document.getElementById('czFab'); if (!l || l.hidden) return null; // a desktop: the rail's chat icon (slice 1)
71
72
  const a = l.getBoundingClientRect(), b = f.getBoundingClientRect();
72
73
  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
+ 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'), chatpop: document.body.classList.contains('cz-chatpop') };
74
75
  }));
75
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));
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
+ // 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)
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));
77
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);
78
81
  await shot(page, 'pill-running');
79
82
 
@@ -83,8 +86,8 @@ const ASKS = () => RUNNING().concat([{ id: 'b', name: 'Redistribute plan items',
83
86
  ok('L3 PMOS asks: the pill turns blue, with the count', l3 && l3.text === '3' && !/255, 255, 255/.test(l3.bg), JSON.stringify(l3));
84
87
  await shot(page, 'pill-asks');
85
88
 
86
- /* L4 */
87
- await page.click('#czLive');
89
+ /* L4 (beside the popup's chat icon the round button gives way, L2: Ctrl J still opens the list) */
90
+ if (l2 && l2.chatpop) await page.keyboard.press('Control+j'); else await page.click('#czLive');
88
91
  const rows = await until(() => page.evaluate(() => { const r = [...document.querySelectorAll('#czLiveList a[data-lv]')]; return r.length ? r.length : null; }));
89
92
  ok('L4 the list opens with its rows (the panels engine drags a[data-lv] to an edge)', rows === 3, String(rows));
90
93
  await shot(page, 'pill-list');
@@ -96,8 +99,7 @@ const ASKS = () => RUNNING().concat([{ id: 'b', name: 'Redistribute plan items',
96
99
  await page.evaluate(() => { delete window.czPanels; });
97
100
 
98
101
  /* 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')));
102
+ ok('L5 a desktop has no menu to open (the rail is the menu, slice 1): the pill stays at the rail\'s foot, or gives way to the popup\'s chat icon', await page.evaluate(() => { const l = document.getElementById('czLive'), cs = getComputedStyle(l); return !l.hidden && getComputedStyle(document.getElementById('czFab')).display === 'none' && (document.body.classList.contains('cz-chatpop') ? cs.display === 'none' : cs.visibility === 'visible'); }));
101
103
  await page.keyboard.press('Escape');
102
104
  await page.evaluate(() => { const m = document.getElementById('czMenu'); if (m && !m.hidden) document.getElementById('czFab').click(); });
103
105
 
@@ -146,7 +148,7 @@ const ASKS = () => RUNNING().concat([{ id: 'b', name: 'Redistribute plan items',
146
148
 
147
149
  /* L6 */
148
150
  await page.evaluate(() => { window.czPanels = { slideOver: () => false, list: () => [] }; });
149
- await page.click('#czLive');
151
+ if (l2 && l2.chatpop) await page.keyboard.press('Control+j'); else await page.click('#czLive');
150
152
  await until(() => page.$('#czLiveList a[data-lv="s:b"]'));
151
153
  await Promise.all([page.waitForURL(/premium\.html\?session=b/, { timeout: 15000 }).catch(() => null), page.click('#czLiveList a[data-lv="s:b"]')]);
152
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());
@@ -9,6 +9,8 @@
9
9
  * the stage card, Proves it worked, Early signal and Guardrail as Now → Target; ✓ keeps all; the folded "Success measure · Set before the
10
10
  * build · 3" with Undo · S the type scale only · H on a phone. PMOS_SHOTS=<dir> also saves the screenshots. */
11
11
  const path = require('path');
12
+ 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)
13
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
12
14
  const fs = require('fs');
13
15
  const { spawn } = require('child_process');
14
16
  const { findBrowser } = require('./lib/find-browser');
@@ -64,7 +66,7 @@ const INITIATIVE = () => ({
64
66
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
65
67
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
66
68
  await T.waitForServer(BASE);
67
- browser = await chromium.launch({ executablePath: exe });
69
+ browser = besidePage(classicBoard(await chromium.launch({ executablePath: exe })));
68
70
  if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
69
71
  const shot = async (p, name) => { if (SHOTS) { await sleep(450); await p.screenshot({ path: path.join(SHOTS, name + '.png') }); } };
70
72
 
@@ -11,6 +11,7 @@
11
11
  * P the phone: the card is a bottom sheet
12
12
  * SHOTS_4B=<dir>: the card and the Filter, desktop and phone, into <dir>. */
13
13
  const path = require('path');
14
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
14
15
  const { spawn } = require('child_process');
15
16
  const { findBrowser } = require('./lib/find-browser');
16
17
  const T = require('./test-run').configure({ name: 'milestone-pins' });
@@ -54,7 +55,7 @@ const ITEMS = [
54
55
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
55
56
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
56
57
  await T.waitForServer(BASE);
57
- browser = await chromium.launch({ executablePath: exe });
58
+ browser = classicBoard(await chromium.launch({ executablePath: exe }));
58
59
 
59
60
  /** The Board on the timeline. o: { w, h, phone, refuse, view } */
60
61
  const open = async (o = {}) => {
@@ -8,6 +8,8 @@
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
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. */
10
10
  const path = require('path');
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
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
11
13
  const fs = require('fs');
12
14
  const { spawn } = require('child_process');
13
15
  const { findBrowser } = require('./lib/find-browser');
@@ -55,7 +57,7 @@ const withReview = (open, o = {}) => F.programs().map((p) => ({ ...p, ...(o.empt
55
57
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
56
58
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
57
59
  await T.waitForServer(BASE);
58
- browser = await chromium.launch({ executablePath: exe });
60
+ browser = besidePage(classicBoard(await chromium.launch({ executablePath: exe })));
59
61
  if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
60
62
  const shot = async (p, name) => { if (SHOTS) await p.screenshot({ path: path.join(SHOTS, name + '.png') }); };
61
63
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.609.0",
3
+ "version": "0.611.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.609.0",
9
+ "version": "0.611.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.609.0",
3
+ "version": "0.611.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",
@@ -25,9 +25,11 @@
25
25
  * P13 the Live pill's list docks on the right by its grab bar, and a press moves it back (batch 26 item 4)
26
26
  * Screenshots go to PMOS_SHOTS when it is set. Every wait polls the page. */
27
27
  const fs = require('fs');
28
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
28
29
  const path = require('path');
29
30
  const { spawn } = require('child_process');
30
31
  const { findBrowser } = require('./lib/find-browser');
32
+ const { besidePage } = require('./lib/beside-page'); // these checks are about work beside the page, not the popup
31
33
  const T = require('./test-run').configure({ name: 'panels' });
32
34
  const B = require('./lib/briefing-premium.js');
33
35
  const F = require('./fixtures/briefing-premium-facts.js');
@@ -60,7 +62,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
60
62
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed — the panels suite cannot run'); return finish(1); }
61
63
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
62
64
  await T.waitForServer(BASE);
63
- browser = await chromium.launch({ executablePath: exe });
65
+ browser = classicBoard(besidePage(await chromium.launch({ executablePath: exe })));
64
66
 
65
67
  const open = async ({ w = 1440, h = 900, dark = false, ctx = null, q = '', at = '/premium.html', ready = () => { document.querySelectorAll('#hmList .hv-fold[aria-expanded="false"]').forEach((b) => b.click()); return !!window.czPanels && document.querySelectorAll('#hmList .hv-r.ini .hm-rm').length > 2; } } = {}) => {
66
68
  // Home shows only the rows with a call (home-nav-rows-with-a-call): the default ready opens every folded group, so the rows this suite drags are there
@@ -277,12 +279,12 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
277
279
  await Bd.page.click(nm(K[0]));
278
280
  const b1 = await until(() => pl(Bd.page).then((l) => (P(l, 'v0') && P(l, 'v0').box.shown && l.divs.length === 1 ? l : null)));
279
281
  ok('P1 a row opens a split: the page, one divider with the sprout, the Viewer; nothing floats over the page', !!b1 && !b1.float && P(b1, 'page').box.r <= b1.divs[0].l + 12 && b1.divs[0].r <= P(b1, 'v0').box.l + 12 && b1.divs[0].sprout, JSON.stringify(b1));
280
- ok('P1 the Viewer opens no wider than leaves the page its view whole (fit 880 at 1440: the Viewer 506 px, under 560); the page is not narrow', !!b1 && P(b1, 'page').box.w >= 878 && Math.abs(P(b1, 'v0').box.w - 506) <= 4 && !b1.narrow, JSON.stringify(b1 && [P(b1, 'page').box, P(b1, 'v0').box]));
282
+ ok('P1 the Viewer opens no wider than leaves the page its view whole (fit 880 at 1440 beside the 80 px rail of places, slice 1: the Viewer 426 px, under 560); the page is not narrow', !!b1 && P(b1, 'page').box.w >= 878 && Math.abs(P(b1, 'v0').box.w - 426) <= 4 && !b1.narrow, JSON.stringify(b1 && [P(b1, 'page').box, P(b1, 'v0').box]));
281
283
  const bh = await Bd.page.evaluate(() => [...document.querySelectorAll('#czViewer .cz-vw-hd [data-cz-vw]')].map((b) => b.dataset.czVw));
282
284
  ok('P1 ⧉ before × on the Viewer\'s header, in place of ⤢', bh.slice(-2).join() === 'place,close' && !bh.includes('wide'), JSON.stringify(bh));
283
285
  await shot(Bd.page, 'p1-board-split-1440');
284
286
  // the divider near the middle snaps at ½: the page goes to its narrow form; only the share is kept
285
- { const d = await divAt(Bd.page); await drag(Bd.page, d, (16 + 1424) / 2 + 8, d.y); }
287
+ { const d = await divAt(Bd.page); await drag(Bd.page, d, (96 + 1424) / 2 + 8, d.y); } // slice 1: the page starts after the rail, at 96
286
288
  const b2 = await until(() => pl(Bd.page).then((l) => (Math.abs(P(l, 'page').box.w - P(l, 'v0').box.w) <= 4 ? l : null)), 3000);
287
289
  const keptB = await Bd.page.evaluate(() => { try { return JSON.parse(localStorage.getItem('cz-pn:board')); } catch { return null; } });
288
290
  ok('P2 a drag near the middle snaps the divider at ½; the page panel is narrower than fit() and gets cz-pn-narrow', !!b2 && b2.narrow, JSON.stringify(b2 && [P(b2, 'page').box, P(b2, 'v0').box, b2.narrow]));
@@ -373,7 +375,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
373
375
  await drag(Dd.page, '#czViewer .cz-vw-tile', 200, 400, { hold: async () => { z11 = await Dd.page.evaluate(() => { const z = document.querySelector('.cz-pn-drop:not([hidden])'); if (!z) return null; const r = z.getBoundingClientRect(); return { side: z.dataset.side, l: Math.round(r.left), w: Math.round(r.width) }; }); await shot(Dd.page, 'p11-dock-drag-1440'); } });
374
376
  const d11 = await until(() => pl(Dd.page).then((l) => (P(l, 'v0').box.r < P(l, 'page').box.l ? l : null)), 3000);
375
377
  const side11 = await Dd.page.evaluate(() => { try { return JSON.parse(localStorage.getItem('cz-pn-side')); } catch { return null; } });
376
- ok('P11 a drag of the Viewer\'s header over the left half turns that half blue', !!z11 && z11.side === 'left' && z11.l <= 20 && z11.w > 600, JSON.stringify(z11));
378
+ ok('P11 a drag of the Viewer\'s header over the left half turns that half blue', !!z11 && z11.side === 'left' && z11.l <= 100 && z11.w > 600, JSON.stringify(z11));
377
379
  ok('P11 the drop docks it on the left: the Viewer, the divider, then the page; the title is not renamed', !!d11 && d11.divs.length === 1 && P(d11, 'v0').box.r <= d11.divs[0].l + 12 && d11.divs[0].r <= P(d11, 'page').box.l + 12 && !(await Dd.page.$('#czViewer [data-cz-vw-ren]')), JSON.stringify(d11 || await pl(Dd.page)));
378
380
  ok('P11 the side is kept for its kind (cz-pn-side)', !!side11 && Object.values(side11).includes('left'), JSON.stringify(side11));
379
381
  await shot(Dd.page, 'p11-docked-left-1440');
@@ -7,6 +7,8 @@
7
7
  * T triage (accept, decline) · N New initiative · M move and Undo · L hold, resume, cancel, reopen, archive, restore · I the initiative page's bar
8
8
  * S the PMOS-self board (a model answer, since only the embedded checkout is self) · P the POST allow-list and the refusals · F floors */
9
9
  const fs = require('fs');
10
+ 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)
11
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
10
12
  const path = require('path');
11
13
  const { spawn } = require('child_process');
12
14
  const { findBrowser } = require('./lib/find-browser');
@@ -72,7 +74,7 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
72
74
  const a2 = await post('/api/boards/asks/add', { line: 'Can the portal get a dark mode', source: 'Support inbox' });
73
75
  ok('setup two asks are on the board', a1.status === 200 && a2.status === 200, JSON.stringify([a1, a2]));
74
76
 
75
- browser = await chromium.launch({ executablePath: exe });
77
+ browser = besidePage(classicBoard(await chromium.launch({ executablePath: exe })));
76
78
  const open = async (url, { w = 1280, h = 900 } = {}) => {
77
79
  const ctx = await openMission(await browser.newContext({ viewport: { width: w, height: h } }));
78
80
  await ctx.addInitScript(() => { try { localStorage.setItem('pmos.premium.openAs', 'popup'); } catch { /* none */ } });
@@ -11,7 +11,7 @@
11
11
  * (since premium-agreed-design /premium-chat.html opens Home with the chat ?about names; the Viewer is the cozy card #czViewer, and on a
12
12
  * phone the chat is the page and the Viewer covers it in place of the old Detail tab)
13
13
  * C6 every chip is at least 44 px; no sideways scroll; no page error
14
- * Set CHAT_CONTEXT_SHOTS=<dir> to save the page at 1280 and 390, light and dark. */
14
+ * Set CHAT_CONTEXT_SHOTS=<dir> to save the page at 1360 and 390, light and dark. */
15
15
  const { findBrowser } = require('./lib/find-browser');
16
16
  require('./test-run').configure({ name: 'premium-chat-context' });
17
17
  const Fx = require('./c3-scan-fixture.js');
@@ -74,7 +74,7 @@ const second = (k) => [
74
74
  };
75
75
  const answer = async (p, conv, k, working) => { conv.messages = [...first(), ...second(k)]; conv.turn = working ? 'agent' : 'user'; };
76
76
 
77
- { const { p, ctx, errs, conv } = await open(1280);
77
+ { const { p, ctx, errs, conv } = await open(1360);
78
78
  await sleep(2500); // a read after the first: an answer already there opens nothing
79
79
  const s0 = await p.evaluate(look);
80
80
  ok('C1 the answer that was there has its chips, the file PMOS wrote first and the file it read after', JSON.stringify(s0.chips) === JSON.stringify([['file:signup-drop.md*', 'file:signup-fix.md']]), JSON.stringify(s0.chips));
@@ -99,12 +99,12 @@ const second = (k) => [
99
99
  const sl = await until(() => p.evaluate(() => { const e = document.querySelector('#czViewer .obody.vw[data-vw^="slack:"]'); const a = e && e.querySelector('a'); return a ? a.href : null; }));
100
100
  ok('C4 a Slack chip opens a tab with Open in Slack', sl === 'slack://channel?id=C0123ABCD', String(sl));
101
101
  const s3 = await p.evaluate(look);
102
- ok('C6 at 1280 every chip is at least 44 px and nothing scrolls sideways', s3.minH >= 44 && !s3.wide, JSON.stringify(s3));
103
- if (shots) await p.screenshot({ path: `${shots}/chat-context-1280-light.png` });
104
- ok('C6 no page error at 1280', errs.length === 0, errs.join(' | '));
102
+ ok('C6 at 1360 every chip is at least 44 px and nothing scrolls sideways', s3.minH >= 44 && !s3.wide, JSON.stringify(s3));
103
+ if (shots) await p.screenshot({ path: `${shots}/chat-context-1360-light.png` });
104
+ ok('C6 no page error at 1360', errs.length === 0, errs.join(' | '));
105
105
  await ctx.close(); }
106
106
 
107
- { const { p, ctx, errs, conv } = await open(1280); // C7: what Claude only read folds into "+N read" (batch 17 item 5)
107
+ { const { p, ctx, errs, conv } = await open(1360); // C7: what Claude only read folds into "+N read" (batch 17 item 5)
108
108
  await sleep(1500);
109
109
  const reads = ['notes/a.md', 'notes/b.md', 'notes/c.md'];
110
110
  conv.messages = [...first(), { role: 'user', text: 'Sum up the notes', at: '2026-10-21T08:02:00Z' },
@@ -169,7 +169,7 @@ const look = () => {
169
169
 
170
170
  /* P9: a desktop */
171
171
  { const st = { goal: goal('started'), conv: { turn: 'tool', messages: BASE } };
172
- const { p, ctx, errs } = await open(1280, st);
172
+ const { p, ctx, errs } = await open(1360, st); // slice 1: the rail of places takes 80 px; at 1280 the Viewer floats over the chat line instead of sitting beside it
173
173
  const s0 = await until(async () => { const v = await p.evaluate(look); return v.line ? v : null; }) || await p.evaluate(look);
174
174
  ok('P9 a desktop: the same line over the chat column, opening nothing by itself', /1 of 4 done/.test(s0.line || '') && !s0.vw, JSON.stringify(s0));
175
175
  await p.click('#hmPl [data-pl="toggle"]');
@@ -43,7 +43,7 @@ const notes = (key = KEY) => lib.listNotes({ runtimeDir: T.STATE_DIR, key }).not
43
43
  await T.waitForServer(BASE);
44
44
  browser = await chromium.launch({ executablePath: exe });
45
45
 
46
- const open = async ({ w = 1280, h = 900, scheme = 'light' } = {}) => {
46
+ const open = async ({ w = 1360, h = 900, scheme = 'light' } = {}) => { // 1360: the rail of places takes 80 px, and at 1280 Home's narrow rule lays the Viewer over the chat
47
47
  const ctx = await browser.newContext({ viewport: { width: w, height: h }, colorScheme: scheme, hasTouch: w < 1000 });
48
48
  const page = await ctx.newPage();
49
49
  const errors = [], asks = [], st = { session: null, messages: [] };
@@ -9,6 +9,7 @@ const fs = require('fs');
9
9
  const path = require('path');
10
10
  const { spawn } = require('child_process');
11
11
  const { findBrowser } = require('./lib/find-browser');
12
+ const { besidePage } = require('./lib/beside-page'); // these checks are about work beside the page, not the popup
12
13
  const T = require('./test-run').configure({ name: 'premium-core-doc-issue' });
13
14
  const { makeRepos, codeRepo, write, git } = require('./plan-test-repos');
14
15
  const CD = require('./lib/core-docs.js');
@@ -68,7 +69,7 @@ const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers
68
69
  const ir = ini2.model.docs.rows.find((d) => d.key === ikey);
69
70
  ok('R2 the initiative model carries the draft\'s slot and path', ir.st === 'draft' && ir.slot === d2.slot && ir.path === d2.path, JSON.stringify(ir));
70
71
 
71
- browser = await chromium.launch({ executablePath: exe });
72
+ browser = besidePage(await chromium.launch({ executablePath: exe }));
72
73
  const open = async (url, { w = 1280, h = 900, theme = 'light' } = {}) => {
73
74
  const ctx = await browser.newContext({ viewport: { width: w, height: h } });
74
75
  await ctx.addInitScript(() => { try { localStorage.setItem('pmos.premium.openAs', 'popup'); } catch { /* none */ } });