create-pmos 0.781.0 → 0.782.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 (50) hide show
  1. package/package.json +35 -62
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/design-system/ui/README.md +2 -2
  4. package/payload/design-system/ui/components/MainItem/README.md +4 -2
  5. package/payload/design-system/ui/components/MainItem/preview.html +2 -2
  6. package/payload/design-system/ui/components/MainSide/README.md +4 -2
  7. package/payload/design-system/ui/components/MainSide/preview.html +2 -2
  8. package/payload/design-system/ui/components/Popup/README.md +15 -0
  9. package/payload/design-system/ui/components/Popup/preview.html +8 -0
  10. package/payload/design-system/ui/components/Reading/README.md +19 -0
  11. package/payload/design-system/ui/components/Reading/preview.html +8 -0
  12. package/payload/design-system/ui/components/SingleColumn/README.md +4 -2
  13. package/payload/design-system/ui/components/SingleColumn/preview.html +2 -2
  14. package/payload/design-system/ui/components/bundle.css +29 -0
  15. package/payload/design-system/ui/pages.md +6 -6
  16. package/payload/design-system/ui/tokens.css +1 -1
  17. package/payload/design-system/ui/tokens.json +30 -0
  18. package/payload/planning/evals/eval-calibration.md +1 -1
  19. package/payload/planning/okrs/health-budgets.md +1 -1
  20. package/payload/state/discoveries.md +1 -1
  21. package/workspace/changelog.json +34 -10
  22. package/workspace/design-system/ui/README.md +2 -2
  23. package/workspace/design-system/ui/components/MainItem/README.md +4 -2
  24. package/workspace/design-system/ui/components/MainItem/preview.html +2 -2
  25. package/workspace/design-system/ui/components/MainSide/README.md +4 -2
  26. package/workspace/design-system/ui/components/MainSide/preview.html +2 -2
  27. package/workspace/design-system/ui/components/Popup/README.md +15 -0
  28. package/workspace/design-system/ui/components/Popup/preview.html +8 -0
  29. package/workspace/design-system/ui/components/Reading/README.md +19 -0
  30. package/workspace/design-system/ui/components/Reading/preview.html +8 -0
  31. package/workspace/design-system/ui/components/SingleColumn/README.md +4 -2
  32. package/workspace/design-system/ui/components/SingleColumn/preview.html +2 -2
  33. package/workspace/design-system/ui/components/bundle.css +29 -0
  34. package/workspace/design-system/ui/pages.md +6 -6
  35. package/workspace/design-system/ui/tokens.css +1 -1
  36. package/workspace/design-system/ui/tokens.json +30 -0
  37. package/workspace/guide/cli.md +9 -1
  38. package/workspace/guide/layout.md +14 -0
  39. package/workspace/lib/pmos-verbs.js +3 -0
  40. package/workspace/lib/sprint-cli.js +79 -0
  41. package/workspace/lib/sprint-retro.js +176 -0
  42. package/workspace/lib/task-cli.js +26 -12
  43. package/workspace/package-lock.json +2 -2
  44. package/workspace/package.json +1 -1
  45. package/workspace/public/pm/komorebi.css +29 -1
  46. package/workspace/public/pm/premium-vw-doc.css +31 -0
  47. package/workspace/public/pm/premium-vw-doc.js +49 -3
  48. package/workspace/public/pm/reading-model.js +76 -0
  49. package/workspace/test-lists/reading-layouts.json +9 -0
  50. package/workspace/test-lists/sprint-retro-one-change.json +9 -0
@@ -41,7 +41,8 @@ const USAGE = [
41
41
  ' pmos task set <task> [<task> …] [--stage <stage>|none] [--due YYYY-MM-DD|none] [--start YYYY-MM-DD|none] [--owner <who>] [--notes <text>]',
42
42
  ' [--milestone|--no-milestone] [--pin|--no-pin|--pin-default] [--parent <task>|none]',
43
43
  ' --parent puts the task under another task of the same initiative as a subtask; none takes it back to the top level. Set it only when the PM asks.',
44
- ' The answer prints the Undo: one command per old parent that puts the tasks back where they were.',
44
+ ' --parents <task>=<parent>|none,… gives each task its own parent (the Undo uses it when the tasks came from different parents).',
45
+ ' The answer prints the Undo: one command that puts every task back under the parent it had.',
45
46
  ' Group tasks under a stage of the initiative\'s workflow (key or name; none takes it out), or change dates, owner or notes.',
46
47
  ' --milestone makes a task a milestone: its due date shows as ◇ on Work and the timeline. Set it only when the PM asks.',
47
48
  ' --pin shows a milestone on the Work timeline, --no-pin hides it, --pin-default goes back to the rule (the last milestone',
@@ -70,8 +71,8 @@ const USAGE = [
70
71
  ];
71
72
  const BOOL = new Set(['json', 'help', 'all', 'milestone', 'no-milestone', 'pin', 'no-pin', 'pin-default', 'propose']);
72
73
  const PIN_FLAGS = ['pin', 'no-pin', 'pin-default'];
73
- const VALUE = new Set(['to', 'why', 'root', 'due', 'start', 'owner', 'notes', 'stage', 'type', 'lag', 'parent']);
74
- const ONLY = { add: ['due', 'start', 'owner', 'notes', 'stage', 'parent'], list: ['all'], state: ['to', 'why'], remove: ['why'], set: ['due', 'start', 'owner', 'notes', 'stage', 'parent'], link: ['type', 'lag', 'why'], unlink: [], describe: [], comment: [] };
74
+ const VALUE = new Set(['to', 'why', 'root', 'due', 'start', 'owner', 'notes', 'stage', 'type', 'lag', 'parent', 'parents']);
75
+ const ONLY = { add: ['due', 'start', 'owner', 'notes', 'stage', 'parent'], list: ['all'], state: ['to', 'why'], remove: ['why'], set: ['due', 'start', 'owner', 'notes', 'stage', 'parent', 'parents'], link: ['type', 'lag', 'why'], unlink: [], describe: [], comment: [] };
75
76
  const OPEN = new Set(['To do', 'In progress']);
76
77
  /** The PM's words for a state: any case, with or without the apostrophe or the space. */
77
78
  function stateOf(s) {
@@ -215,7 +216,17 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
215
216
  };
216
217
 
217
218
  if (verb === 'set') {
218
- const keys = ['stage', 'due', 'start', 'owner', 'notes', 'parent'].filter((k) => flags[k] !== undefined).concat(flags.milestone || flags['no-milestone'] ? ['milestone'] : []).concat(PIN_FLAGS.some((k) => flags[k]) ? ['pinned'] : []);
219
+ // --parents a=P,b=none (checker finding on chat-subtasks): each task its own parent, so one command can put several back
220
+ let PM = null;
221
+ if (flags.parents !== undefined) {
222
+ if (flags.parent !== undefined) return fail('give --parent or --parents, not both', 2);
223
+ PM = new Map(String(flags.parents).split(',').map((x) => x.trim()).filter(Boolean).map((x) => { const i = x.indexOf('='); return i > 0 ? [x.slice(0, i).trim(), x.slice(i + 1).trim()] : [x, null]; }));
224
+ const bad = [...PM].find(([, v]) => v == null || v === '');
225
+ if (bad) return fail(`--parents takes <task>=<parent> or <task>=none, comma-separated: "${bad[0]}" has no parent`, 2);
226
+ const miss = pos.filter((u) => !PM.has(u));
227
+ if (miss.length) return fail(`--parents names no parent for ${miss.join(', ')}`, 2);
228
+ }
229
+ const keys = ['stage', 'due', 'start', 'owner', 'notes', 'parent'].filter((k) => (k === 'parent' ? flags.parent !== undefined || PM : flags[k] !== undefined)).concat(flags.milestone || flags['no-milestone'] ? ['milestone'] : []).concat(PIN_FLAGS.some((k) => flags[k]) ? ['pinned'] : []);
219
230
  if (!pos.length || !keys.length) { say('usage: pmos task set <task> [<task> …] [--stage <stage>|none] [--due YYYY-MM-DD|none] [--start YYYY-MM-DD|none] [--owner <who>] [--notes <text>] [--milestone|--no-milestone] [--pin|--no-pin|--pin-default] [--parent <task>|none]'); return 2; }
220
231
  const folded = boards.foldOf(ctx, w);
221
232
  const done = [], refused = [];
@@ -232,7 +243,8 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
232
243
  }
233
244
  for (const k of ['due', 'start']) if (flags[k] !== undefined) body[k] = String(flags[k]).toLowerCase() === 'none' ? '' : flags[k];
234
245
  for (const k of ['owner', 'notes']) if (flags[k] !== undefined) body[k] = flags[k];
235
- if (flags.parent !== undefined) body.parent = String(flags.parent).toLowerCase() === 'none' ? '' : String(flags.parent); // a subtask (initiative work-subtasks)
246
+ const pv = PM ? PM.get(id) : flags.parent;
247
+ if (pv !== undefined) body.parent = String(pv).toLowerCase() === 'none' ? '' : String(pv); // a subtask (initiative work-subtasks)
236
248
  if (flags.milestone || flags['no-milestone']) body.milestone = !!flags.milestone;
237
249
  if (PIN_FLAGS.some((k) => flags[k])) body.pinned = flags.pin ? true : flags['no-pin'] ? false : null;
238
250
  const e = boards.taskEdit(ctx, body, g);
@@ -246,17 +258,19 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
246
258
  const TLR = require('./routes-task-links.js'), F2 = boards.foldOf(ctx, w), seen = new Set();
247
259
  for (const d of done) { const t = findTask(F2, d.task); const k = t ? t.board + '|' + t.initiative : ''; if (!t || seen.has(k)) continue; seen.add(k); kept += TLR.sweepFor(ctx, w, t.board, t.initiative, g).moved || 0; }
248
260
  }
249
- // the Undo of a parent move (initiative chat-subtasks): one command per old parent puts every task back where it was
250
- const back = new Map();
251
- for (const d of done) if (d.was !== undefined && d.was !== d.set.parent) { if (!back.has(d.was)) back.set(d.was, []); back.get(d.was).push(d.task); }
252
- const undo = [...back].map(([was, ids]) => `pmos task set ${ids.join(' ')} --parent ${was || 'none'}`);
253
- if (flags.parent !== undefined && done.length) console.error('[task-parent]', 'set', done.length);
254
- if (json) say(JSON.stringify({ ok: !refused.length, done, refused, ...(kept ? { moved: kept } : {}), ...(flags.parent !== undefined ? { undo } : {}) }));
261
+ // the Undo of a parent move (initiative chat-subtasks): ONE command puts every task back where it was; --parent when they shared one, else --parents
262
+ const back = done.filter((d) => d.was !== undefined && d.was !== d.set.parent);
263
+ const olds = [...new Set(back.map((d) => d.was))];
264
+ const undo = !back.length ? '' : olds.length === 1 ? `pmos task set ${back.map((d) => d.task).join(' ')} --parent ${olds[0] || 'none'}`
265
+ : `pmos task set ${back.map((d) => d.task).join(' ')} --parents ${back.map((d) => d.task + '=' + (d.was || 'none')).join(',')}`;
266
+ const moving = flags.parent !== undefined || !!PM;
267
+ if (moving && done.length) console.error('[task-parent]', 'set', done.length);
268
+ if (json) say(JSON.stringify({ ok: !refused.length, done, refused, ...(kept ? { moved: kept } : {}), ...(moving ? { undo } : {}) }));
255
269
  else {
256
270
  for (const d of done) say(`✓ ${d.task} ${what(d.set)}: ${d.title}`);
257
271
  for (const x of refused) say(`✗ ${x.task}: ${x.error}`);
258
272
  if (kept) say(` Kept the links: ${kept === 1 ? '1 task that waits on it moved' : kept + ' tasks that wait on it moved'}. The page lists them under the grey ✦.`);
259
- for (const u of undo) say(' Undo: ' + u);
273
+ if (undo) say(' Undo: ' + undo);
260
274
  if (done.length) say(' The page shows it. Nothing was sent.');
261
275
  }
262
276
  return refused.length ? 1 : 0;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.781.0",
3
+ "version": "0.782.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.781.0",
9
+ "version": "0.782.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.781.0",
3
+ "version": "0.782.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",
@@ -5,7 +5,7 @@
5
5
  * point at them (--fs-*, --fw-*, --lh-*): those sit at :root, so a change to one Komorebi token reaches every page, with or without the class. */
6
6
  .pm-ds{--raise:0 1px 2px rgba(42,46,53,.08), 0 4px 14px -6px rgba(70,80,50,.14);--lift:0 10px 28px -10px rgba(42,46,53,.28);--glow:0 0 0 2px #5F7A45, 0 0 0 5px rgba(95,122,69,.10)}
7
7
  .pm-ds.dark, html.dark .pm-ds, :root[data-theme="dark"] .pm-ds{--raise:0 1px 2px rgba(0,0,0,.4), 0 4px 14px -6px rgba(169,196,140,.08);--lift:0 10px 28px -10px rgba(0,0,0,.6);--glow:0 0 0 2px #A9C48C, 0 0 0 5px rgba(169,196,140,.12)}
8
- :root{--space-4:4px;--space-8:8px;--space-12:12px;--space-16:16px;--space-24:24px;--space-32:32px;--space-48:48px;--space-64:64px;--radius-sm:6px;--radius-md:10px;--radius-card:16px;--radius-panel:24px;--radius-pill:999px}
8
+ :root{--space-4:4px;--space-8:8px;--space-12:12px;--space-16:16px;--space-24:24px;--space-32:32px;--space-48:48px;--space-64:64px;--doc-measure:640px;--page-measure:960px;--width-side:340px;--width-item:480px;--width-contents:200px;--width-margin:240px;--radius-sm:6px;--radius-md:10px;--radius-card:16px;--radius-panel:24px;--radius-pill:999px}
9
9
  :root{--type-title:26px;--leading-title:32px;--weight-title:600;--type-heading:18px;--leading-heading:24px;--weight-heading:600;--type-body:15px;--leading-body:24px;--weight-body:400;--type-small:13px;--leading-small:20px;--weight-small:400;--type-code:13px;--leading-code:20px;--weight-code:400}
10
10
  .pm-ds .title{font-family:var(--font-sans);font-size:var(--type-title);line-height:var(--leading-title);font-weight:var(--weight-title)}
11
11
  .pm-ds .heading{font-family:var(--font-sans);font-size:var(--type-heading);line-height:var(--leading-heading);font-weight:var(--weight-heading)}
@@ -144,6 +144,34 @@
144
144
  .pm-ds .pm-rail .pm-count{position:absolute;top:3px;right:5px}
145
145
  .pm-ds .pm-path{display:flex;align-items:center;gap:6px;font-size:var(--type-small)}
146
146
  .pm-ds .pm-path a{color:var(--blue)}
147
+ .pm-ds .pm-main, .pm-ds .pm-side, .pm-ds .pm-item, .pm-ds .pm-margin, .pm-ds .pm-contents{display:flex;flex-direction:column;gap:var(--space-16);min-width:0}
148
+ .pm-ds .pm-layout-single, .pm-ds .pm-layout-popup{display:flex;flex-direction:column;gap:var(--space-16);width:100%;max-width:var(--page-measure);margin:0 auto}
149
+ .pm-ds .pm-layout-side, .pm-ds .pm-layout-open, .pm-ds .pm-layout-reading{display:grid;gap:var(--space-16);align-items:start}
150
+ .pm-ds .pm-layout-side{grid-template-columns:minmax(0,1fr) var(--width-side)}
151
+ .pm-ds .pm-layout-side>.pm-side, .pm-ds .pm-layout-reading>.pm-contents{position:sticky;top:0}
152
+ .pm-ds .pm-layout-open{grid-template-columns:minmax(0,1fr)}
153
+ .pm-ds .pm-layout-open:has(>.pm-item){grid-template-columns:minmax(0,1fr) var(--width-item)}
154
+ .pm-ds .pm-layout-open>.pm-item, .pm-ds .pm-layout-popup{background:var(--card);border-radius:var(--radius-panel);box-shadow:var(--raise);padding:var(--space-24)}
155
+ .pm-ds .pm-layout-popup{box-shadow:var(--lift);padding:var(--space-24) var(--space-32)}
156
+ .pm-ds .pm-head{display:flex;align-items:center;gap:var(--space-8);min-width:0}
157
+ .pm-ds .pm-layout-reading{grid-template:"head head head" auto "contents main margin" 1fr/var(--width-contents) minmax(0,var(--doc-measure)) var(--width-margin);gap:var(--space-24) var(--space-32);justify-content:center}
158
+ .pm-ds .pm-layout-reading:not(:has(>.pm-margin)){grid-template:"head head" auto "contents main" 1fr/var(--width-contents) minmax(0,var(--doc-measure))}
159
+ .pm-ds .pm-layout-reading>.pm-head{grid-area:head}
160
+ .pm-ds .pm-layout-reading>.pm-contents{grid-area:contents;gap:var(--space-4);font-size:var(--type-small)}
161
+ .pm-ds .pm-layout-reading>.pm-main{grid-area:main;gap:var(--space-24)}
162
+ .pm-ds .pm-layout-reading>.pm-margin{grid-area:margin}
163
+ @media (max-width: 1100px) {
164
+ .pm-ds .pm-layout-side{grid-template-columns:minmax(0,1fr)}
165
+ .pm-ds .pm-layout-reading{grid-template:"head head" auto "main margin" 1fr/minmax(0,var(--doc-measure)) var(--width-margin)}
166
+ .pm-ds .pm-layout-reading:not(:has(>.pm-margin)){grid-template:"head" auto "main" 1fr/minmax(0,var(--doc-measure))}
167
+ .pm-ds .pm-layout-reading>.pm-contents{display:none}
168
+ }
169
+ @media (max-width: 720px) {
170
+ .pm-ds .pm-layout-open:has(>.pm-item){grid-template-columns:minmax(0,1fr)}
171
+ .pm-ds .pm-layout-open:has(>.pm-item)>.pm-main, .pm-ds .pm-layout-reading>.pm-margin{display:none}
172
+ .pm-ds .pm-layout-popup{padding:var(--space-16);border-radius:0;box-shadow:none}
173
+ .pm-ds .pm-layout-reading, .pm-ds .pm-layout-reading:not(:has(>.pm-margin)){grid-template:"head" auto "main" 1fr/minmax(0,1fr)}
174
+ }
147
175
  .pm-ds .pm-state{margin:0;padding:var(--space-8) 0;font-size:var(--type-small);line-height:var(--leading-small);color:var(--muted)}
148
176
  .pm-ds .pm-state.empty{max-width:62ch}
149
177
  .pm-ds .pm-state.loading{display:flex;flex-direction:column;gap:var(--space-4)}
@@ -287,3 +287,34 @@ iframe.vwprint{position:fixed;right:0;bottom:0;width:1px;height:1px;border:0;opa
287
287
  .vwpdfp canvas{display:block;border-radius:var(--radius-mark);box-shadow:0 0 0 1px var(--hair)}
288
288
  .vwpdfs{margin:0;font-size:var(--fs-meta);color:var(--ink-3);line-height:var(--lh-meta);}
289
289
  .vwpdfs:empty{display:none}
290
+ /* The Reading layout (reading-layouts, A334; board ReadingDS): the grid, widths and gaps are the system's pm-layout-reading (komorebi.css).
291
+ Only the reader's own parts are here, on tokens. Body text keeps the page's 16 px reading size (.cf). */
292
+ .vwdoc.rdw{max-width:none}
293
+ .rd .pm-head{flex-wrap:wrap}
294
+ .rd .pm-contents a{padding:var(--space-4) var(--space-8);border-radius:var(--radius-sm);color:var(--muted);text-decoration:none}
295
+ .rd .pm-contents a:hover,.rd .pm-contents a[aria-current="true"]{background:var(--well);color:var(--ink)}
296
+ .rd .pm-head .vwdt{flex:1;min-width:0;margin:0}
297
+ .rd-lab{margin:0 0 var(--space-4);font-size:var(--fs-meta);line-height:var(--leading-small);font-weight:var(--fw-strong);letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
298
+ .rd-hd{display:flex;flex-direction:column;gap:var(--space-8)}
299
+ .rd-t{margin:0;font-family:var(--font-sans);font-size:var(--fs-display);line-height:var(--leading-title);font-weight:var(--fw-strong);color:var(--ink)}
300
+ .rd-meta{display:flex;align-items:center;flex-wrap:wrap;gap:var(--space-4);margin:0;font-size:var(--fs-meta);line-height:var(--leading-small);color:var(--muted)}
301
+ .rd-ai{display:inline-flex;color:var(--blue)}
302
+ .rd-ai svg{width:var(--space-12);height:var(--space-12)}
303
+ .rd-props>summary{cursor:pointer;font-size:var(--fs-meta);line-height:var(--leading-small);color:var(--muted)}
304
+ .rd-props>summary:focus-visible{outline:none;box-shadow:var(--glow);border-radius:var(--radius-sm)}
305
+ .rd-short{margin:0 0 var(--space-16);padding:var(--space-16) var(--space-24);border-radius:var(--radius-card);background:var(--well);font-size:var(--fs-panel);line-height:1.55;color:var(--ink)}
306
+ .rd-short p:last-child{margin-bottom:0}
307
+ .rd-doc.cf{background:none;border:0;box-shadow:none;padding:0}
308
+ .rd-sec{border-bottom:1px solid var(--line)}
309
+ .rd-sec>summary{display:flex;align-items:center;gap:var(--space-8);padding:var(--space-12) 0;cursor:pointer;list-style:none}
310
+ .rd-sec>summary::-webkit-details-marker{display:none}
311
+ .rd-sec>summary::before{content:"›";flex:none;width:var(--space-16);color:var(--muted);transition:transform var(--duration-quick) var(--ease-out)}
312
+ .rd-sec[open]>summary::before{transform:rotate(90deg)}
313
+ .rd-sec>summary h2{flex:1;margin:0}
314
+ .rd-sec>summary:focus-visible{outline:none;box-shadow:var(--glow);border-radius:var(--radius-sm)}
315
+ .rd-sb{padding:0 0 var(--space-16) var(--space-24)}
316
+ .rd-cn{font-size:var(--fs-meta);color:var(--muted)}
317
+ .rd-cm{padding:var(--space-12) var(--space-16);border-radius:var(--radius-md);background:var(--well);font-size:var(--fs-meta);line-height:var(--leading-small)}
318
+ .rd-cm p{margin:0}
319
+ .rd-q{color:var(--muted)}
320
+ @media (max-width: 720px){ .rd-sb{padding-left:0} .rd-short{padding:var(--space-12) var(--space-16)} }
@@ -13,7 +13,8 @@ import { vwOpen, vwStyle, vwConfirm } from './premium-viewer.js';
13
13
  import { $, $$, esc, toast, AI, CHECK } from './premium-shell.js';
14
14
  import { editBody, acceptBody, rejectBody, askBody, askLine, relationsOf, copyKindOf, copyView, proposalsModel } from './premium-doc-edit.js';
15
15
  import { bodyHtml, pageHead, propHtml, splitDoc, overlay, overlayLine, mergeEdit, readMinutes, dayOf, PANELS, signOffOf } from './premium-vw-doc-model.js';
16
- import { adler } from './cozy-adler.js'; // the sign-off under a page the agent drafted (batch 17 item 4-A, canvas AdH4)
16
+ import { adler } from './cozy-adler.js';
17
+ import { readingOf, foldKey, foldsOf, foldsWith } from './reading-model.js'; // the Reading layout (reading-layouts, A334) // the sign-off under a page the agent drafted (batch 17 item 4-A, canvas AdH4)
17
18
 
18
19
  const I = (d) => `<svg class="i" viewBox="0 0 24 24" aria-hidden="true">${d}</svg>`;
19
20
  const IC = {
@@ -271,11 +272,55 @@ function makePage(d, ctx) {
271
272
  const revs = (P.log && P.log.revisions) || [], so = signOffOf(revs[revs.length - 1], P.text);
272
273
  return so ? `<p class="vwsign" role="note">${adler(so.mood, 40, { label: false })}<span>${esc(so.text)}</span></p>` : '';
273
274
  }
275
+ /* ── the Reading layout (reading-layouts, A334; board ReadingDS): read mode with no agent edit open. Contents at left follows the scroll; the
276
+ * title and meta strip (who drafted ✦, who checked, for whom); In short; one section per heading, each folds and the open state is kept per
277
+ * document; comments in the margin beside their section, and no margin when there are none. Edit, Markdown and an agent's edit keep their page. */
278
+ const store = { get: (k) => { try { return localStorage.getItem(k); } catch { return null; } }, set: (k, val) => { try { localStorage.setItem(k, val); } catch { /* a private window */ } } };
279
+ function metaHtml(R) {
280
+ const revs = (P.log && P.log.revisions) || [], last = revs[revs.length - 1], m = R.meta, bits = [];
281
+ if (m.drafted) bits.push(`${m.drafted.by === 'PMOS' ? `<span class="rd-ai" aria-hidden="true">${AI}</span>PMOS drafted it` : `${esc(m.drafted.by)} wrote it`}${m.drafted.at ? ' ' + esc(dayOf(m.drafted.at)) : ''}`);
282
+ if (m.checked) bits.push(`${esc(m.checked.by)} checked it`);
283
+ else if (!m.drafted && last) bits.push(`Last change by ${esc(whoOf(last))}${last.at ? ' · ' + esc(dayOf(last.at)) : ''}`);
284
+ if (m.for) bits.push(`for ${esc(m.for)}`);
285
+ bits.push(`${v() ? 'v' + v() + ' · ' : ''}${readMinutes(P.text)} min read`);
286
+ return `<p class="rd-meta cfby">${bits.join(' · ')}</p>`;
287
+ }
288
+ function readingHtml(h, p) {
289
+ const R = readingOf(P.text, { title: h.title || String(d.path).split('/').pop(), revisions: (P.log && P.log.revisions) || [], comments: ctx.comments ? ctx.comments() : [] });
290
+ const folds = foldsOf(store.get(foldKey(d.path)));
291
+ const unsaved = P.work != null && P.work !== P.text ? `<p class="vwmut vwline" role="status">You have changes that are not saved yet. Edit shows them again.${P.stale ? ' The chat changed the file since. Cancel there shows the new text.' : ''}</p>` : '';
292
+ let start = 0;
293
+ const md = (src) => { const r = bodyHtml(src, { start }); start += r.heads.length; return r.html; };
294
+ const secs = R.sections.map((sx) => `<details class="rd-sec" id="${esc(sx.id)}" data-rd="${esc(sx.id)}"${folds[sx.id] === false ? '' : ' open'}><summary><h2>${esc(sx.name)}</h2>${sx.comments ? `<span class="rd-cn" title="${sx.comments} comments">${sx.comments}</span>` : ''}</summary><div class="rd-sb">${md(sx.md)}</div></details>`).join('');
295
+ const contents = R.contents.length > 1 ? `<nav class="pm-contents" aria-label="Contents"><p class="rd-lab">Contents</p>${R.contents.map((c, i) => `<a href="#${esc(c.id)}" data-rdto="${esc(c.id)}" aria-current="${i === 0}">${esc(c.name)}</a>`).join('')}</nav>` : '';
296
+ const margin = R.margin.length ? `<aside class="pm-margin" aria-label="Comments">${R.margin.map((c) => `<div class="rd-cm" data-for="${esc(c.id)}">${c.quote ? `<p class="rd-q">on “${esc(c.quote)}”</p>` : ''}<p><b>${esc(c.who || '')}</b>${c.at ? ' · ' + esc(dayOf(c.at) || c.at) : ''}</p><p>${esc(c.text)}</p></div>`).join('')}</aside>` : '';
297
+ return `<div class="pm-layout-reading rd"><div class="pm-head">${toolsHtml(p)}</div>${contents}<div class="pm-main">${moreBar()}${unsaved}`
298
+ + `<header class="rd-hd"><h1 class="rd-t cft">${esc(R.title)}</h1>${metaHtml(R)}`
299
+ + (h.labels.length ? `<div class="cflb">${h.labels.map((l) => `<span>${esc(l)}</span>`).join('')}</div>` : '')
300
+ + (h.props.length ? `<details class="rd-props"><summary>Properties · ${h.props.length}</summary><table class="cfpr" aria-label="Properties">${h.props.map(([k, val]) => `<tr><th scope="row">${esc(k)}</th><td>${propHtml(k, val)}</td></tr>`).join('')}</table></details>` : '') + '</header>'
301
+ + `<article class="cf rd-doc"><div class="cfb">`
302
+ + (R.inShort ? `<section class="rd-short" id="rd-in-short" aria-label="In short"><p class="rd-lab">In short</p>${md(R.inShort)}</section>` : '')
303
+ + `${R.lead ? md(R.lead) : ''}${secs || (R.lead ? '' : '<p class="vwmut">The file has no text yet.</p>')}</div>`
304
+ + `<footer class="cff"><span>${v() ? 'v' + v() : ''}</span><span class="gap"></span><code>${esc(d.path)}</code></footer></article>`
305
+ + signHtml() + sideHtml() + `</div>${margin}</div>`;
306
+ }
307
+ /** Wire the Reading layout: a fold is kept per document; Contents jumps to a section (opening it) and follows the scroll. */
308
+ function wireReading() {
309
+ const box = $('.rd', el); if (!box) return;
310
+ $$('.rd-sec', box).forEach((x) => x.addEventListener('toggle', () => store.set(foldKey(d.path), foldsWith(store.get(foldKey(d.path)), x.dataset.rd, x.open))));
311
+ const nav = $('.pm-contents', box); if (!nav) return;
312
+ const mark = (id) => $$('[data-rdto]', nav).forEach((a) => a.setAttribute('aria-current', String(a.dataset.rdto === id)));
313
+ nav.onclick = (e) => { const a = e.target.closest('[data-rdto]'); if (!a) return; e.preventDefault(); const t = box.querySelector('#' + CSS.escape(a.dataset.rdto)); if (!t) return; if (t.tagName === 'DETAILS') t.open = true; t.scrollIntoView({ block: 'start', behavior: 'smooth' }); mark(a.dataset.rdto); };
314
+ if (typeof IntersectionObserver !== 'function') return;
315
+ const io = new IntersectionObserver((es) => { const top = es.filter((x) => x.isIntersecting).sort((a, b) => a.boundingClientRect.top - b.boundingClientRect.top)[0]; if (top) mark(top.target.id); }, { root: el, rootMargin: '0px 0px -70% 0px' });
316
+ $$('#rd-in-short, .rd-sec', box).forEach((x) => io.observe(x));
317
+ }
274
318
  function pageHtml() {
275
319
  if (P.err) return `<p class="vwempty">${esc(P.err)}</p>`;
276
320
  if (P.text == null) return '<p class="vwempty">Reading the file.</p>';
277
321
  const h = pageHead(P.text), p = openProp();
278
322
  const o = p ? overlay(P.text, p, P.kept) : null;
323
+ if (P.mode === 'read' && !o && !ctx.host) return readingHtml(h, p);
279
324
  if (P.mode === 'md') return toolsHtml(p) + `<textarea id="vwMd" class="vwmd" spellcheck="false" aria-label="The file as Markdown">${esc(P.work != null ? P.work : P.text)}</textarea>` + saveRow();
280
325
  const body = o ? overlayBody(h, o) : readBody(h, P.mode === 'edit' && P.work != null ? P.work : P.text);
281
326
  const unsaved = P.mode === 'read' && P.work != null && P.work !== P.text ? `<p class="vwmut vwline" role="status">You have changes that are not saved yet. Edit shows them again.${P.stale ? ' The chat changed the file since. Cancel there shows the new text.' : ''}</p>` : '';
@@ -301,9 +346,10 @@ function makePage(d, ctx) {
301
346
  function draw() {
302
347
  if (!el || !el.isConnected) return;
303
348
  const keepScroll = el.scrollTop;
304
- el.innerHTML = `<div class="vwdoc">${pageHtml()}</div>`;
349
+ const reading = P.mode === 'read' && !ctx.host && P.text != null && !P.err && !openProp();
350
+ el.innerHTML = `<div class="vwdoc${reading ? ' rdw' : ''}">${pageHtml()}</div>`;
305
351
  el.scrollTop = keepScroll;
306
- if (P.mode === 'read') tocOf();
352
+ if (reading) wireReading(); else if (P.mode === 'read') tocOf();
307
353
  if (P.mode === 'edit') startEdit();
308
354
  }
309
355
 
@@ -0,0 +1,76 @@
1
+ /* pm/reading-model.js — the Reading layout's content, pure (initiative reading-layouts, A334; brief design-system/reading-view/brief.md,
2
+ * board ReadingDS, Wawan agreed 2026-11-23). One calm reader for every document: title and meta strip, In short, then one section per
3
+ * second-level heading, each folding, Contents beside it and comments in the margin. No DOM, no network: premium-vw-doc.js draws it.
4
+ *
5
+ * readingOf(text, o) → { title, meta, inShort, lead, sections:[{ id, name, md, comments }], contents:[{ id, name }], margin }
6
+ * o: { title?, revisions?: [{ by, text_by, at }], comments?: [{ section, quote, who, at, text }] }
7
+ * metaOf(fm, revisions) → { drafted: { by, at } | null, checked: { by, at } | null, for: string } who drafted (✦ when PMOS), who checked, for whom
8
+ * foldKey(path) · foldsOf(raw) · foldsWith(raw, id, open) the open state of each section, kept per document (a JSON string the page stores)
9
+ * phoneCounts(r) → [{ id, n }] on a phone each section shows its comment count (the margin is gone)
10
+ */
11
+ const IN_SHORT = /^(in short|summary|tl;?dr|the short version)$/i;
12
+ const slug = (s) => String(s || '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'section';
13
+
14
+ function front(text) {
15
+ const m = /^---\n([\s\S]*?)\n---\n?/.exec(String(text || ''));
16
+ const fm = {};
17
+ if (m) for (const l of m[1].split('\n')) { const kv = /^([A-Za-z_][\w-]*):\s*(.*)$/.exec(l); if (kv) fm[kv[1].toLowerCase()] = kv[2].replace(/^["']|["']$/g, '').trim(); }
18
+ return { fm, body: m ? String(text).slice(m[0].length) : String(text || '') };
19
+ }
20
+
21
+ /** Who drafted it, who checked it, and for whom. The first revision by the agent is PMOS drafting it; a later one by a person is them checking it. */
22
+ export function metaOf(fm, revisions) {
23
+ const revs = Array.isArray(revisions) ? revisions : [];
24
+ const agent = (r) => r && (r.by === 'agent' || r.text_by === 'agent');
25
+ const person = (r) => r && (r.by === 'pm' || (r.by && !agent(r) && r.by !== 'baseline' && r.via !== 'first' && r.via !== 'outside'));
26
+ const firstAgent = revs.find(agent);
27
+ const afterAgent = firstAgent ? revs.slice(revs.indexOf(firstAgent) + 1).filter(person).pop() : null;
28
+ const f = fm || {};
29
+ return {
30
+ drafted: firstAgent ? { by: 'PMOS', at: firstAgent.at || '' } : f.author ? { by: f.author, at: '' } : null,
31
+ checked: afterAgent ? { by: afterAgent.by === 'pm' ? 'you' : String(afterAgent.by), at: afterAgent.at || '' } : null,
32
+ for: f.for || f.audience || '',
33
+ };
34
+ }
35
+
36
+ /** The document cut for the Reading layout. A section named In short, Summary or TL;DR becomes In short (or the front matter's summary does). */
37
+ export function readingOf(text, o = {}) {
38
+ const { fm, body } = front(text);
39
+ const lines = body.split('\n');
40
+ let title = o.title || fm.title || '', fence = false, cur = null;
41
+ const lead = [], secs = [], seen = {};
42
+ for (const l of lines) {
43
+ if (/^```/.test(l)) fence = !fence;
44
+ const h = !fence && /^(#{1,2})\s+(.*)$/.exec(l);
45
+ // the document's own first heading is its title: it is not drawn again as a section (the front matter's title wins when both are there)
46
+ if (h && h[1] === '#' && !secs.length && !lead.join('').trim()) { if (!title) title = h[2].replace(/[*`]/g, '').trim(); continue; }
47
+ if (h) {
48
+ const name = h[2].replace(/[*`]/g, '').trim(), base = slug(name);
49
+ seen[base] = (seen[base] || 0) + 1;
50
+ cur = { id: 'rd-' + base + (seen[base] > 1 ? '-' + seen[base] : ''), name, lines: [] }; secs.push(cur); continue;
51
+ }
52
+ (cur ? cur.lines : lead).push(l);
53
+ }
54
+ const all = secs.map((s) => ({ id: s.id, name: s.name, md: s.lines.join('\n').trim() }));
55
+ const short = all.find((s) => IN_SHORT.test(s.name));
56
+ const sections = all.filter((s) => s !== short);
57
+ const cm = Array.isArray(o.comments) ? o.comments.filter((c) => c && c.text) : [];
58
+ const where = (c) => { const n = String(c.section || '').toLowerCase(); return (sections.find((s) => s.name.toLowerCase() === n || s.id === c.section) || {}).id || null; };
59
+ for (const s of sections) s.comments = cm.filter((c) => where(c) === s.id).length;
60
+ const inShort = short ? short.md : (fm.summary || fm.description || '');
61
+ return {
62
+ title, meta: metaOf(fm, o.revisions), inShort, lead: lead.join('\n').trim(), sections,
63
+ contents: [...(inShort ? [{ id: 'rd-in-short', name: 'In short' }] : []), ...sections.map((s) => ({ id: s.id, name: s.name }))],
64
+ margin: cm.filter((c) => where(c)).map((c) => ({ ...c, at: c.at || '', id: where(c) })),
65
+ };
66
+ }
67
+
68
+ /** Each section's comment count, for the phone (no margin there). Zero is silence: only sections with a comment. */
69
+ export function phoneCounts(r) { return ((r && r.sections) || []).filter((s) => s.comments > 0).map((s) => ({ id: s.id, n: s.comments })); }
70
+
71
+ /* ── the open state of each section, kept per document ── */
72
+ export const foldKey = (path) => 'pmos.read.folds:' + String(path || '');
73
+ /** The stored state as { id: false } for each folded section (open is the default). A broken value reads as nothing folded. */
74
+ export function foldsOf(raw) { try { const o = JSON.parse(raw || '{}'); return o && typeof o === 'object' && !Array.isArray(o) ? o : {}; } catch { return {}; } }
75
+ /** The stored state after one section is opened or folded: only folded sections are kept, so the value stays small. */
76
+ export function foldsWith(raw, id, open) { const o = foldsOf(raw); if (open) delete o[id]; else o[id] = false; return JSON.stringify(o); }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "reading-layouts (A334; token-first step 3; pure, node): five page layout classes in the UI system and the Reading view model (public/pm/reading-model.js) that the document page draws.",
3
+ "modules": [
4
+ "reading-layouts.test.js"
5
+ ],
6
+ "seconds": {
7
+ "reading-layouts.test.js": 1
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "The retro of a closed sprint from PMOS's own close numbers, with one change tracked into the next sprint and checked at its close (initiative sprint-retro-one-change, bet A76): lib/sprint-retro.js and `pmos sprint retro|change` (lib/sprint-cli.js). Backend only.",
3
+ "modules": [
4
+ "sprint-retro.test.js"
5
+ ],
6
+ "seconds": {
7
+ "sprint-retro.test.js": 1
8
+ }
9
+ }