create-pmos 0.789.0 → 0.791.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 (36) hide show
  1. package/package.json +27 -27
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/design-system/ui/components/bundle.css +1 -1
  4. package/payload/planning/evals/eval-calibration.md +1 -1
  5. package/payload/planning/okrs/health-budgets.md +1 -1
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/changelog.json +26 -0
  8. package/workspace/design-system/ui/components/bundle.css +1 -1
  9. package/workspace/guide/home.md +1 -0
  10. package/workspace/guide/layout.md +3 -3
  11. package/workspace/lib/briefing-premium-agent.js +2 -0
  12. package/workspace/lib/card-rows-route.js +64 -0
  13. package/workspace/lib/routes-slash.js +2 -2
  14. package/workspace/lib/use-log.js +16 -3
  15. package/workspace/package-lock.json +2 -2
  16. package/workspace/package.json +1 -1
  17. package/workspace/premium-viewer-download-test.js +1 -1
  18. package/workspace/public/pm/card-log.js +25 -0
  19. package/workspace/public/pm/chat-cards.js +272 -0
  20. package/workspace/public/pm/cozy-board.css +3 -0
  21. package/workspace/public/pm/cozy-home.css +22 -0
  22. package/workspace/public/pm/home-chat.js +10 -2
  23. package/workspace/public/pm/komorebi.css +1 -1
  24. package/workspace/public/pm/premium-vw-copies.js +17 -10
  25. package/workspace/public/pm/premium-vw-copy.css +7 -0
  26. package/workspace/public/pm/premium-vw-doc.css +13 -1
  27. package/workspace/public/pm/premium-vw-doc.js +1 -1
  28. package/workspace/public/pm/premium-vw-file.js +21 -9
  29. package/workspace/public/pm/premium-vw-guide.css +2 -1
  30. package/workspace/public/pm/premium-vw-guide.js +1 -1
  31. package/workspace/public/pm/premium-vw-notepad.css +1 -1
  32. package/workspace/public/pm/star-draft.js +4 -0
  33. package/workspace/public/pm/use-log.js +3 -0
  34. package/workspace/public/premium-board.html +1 -1
  35. package/workspace/public/premium-library.html +1 -1
  36. package/workspace/test-lists/ask-cards-and-pickers.json +9 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.789.0",
3
+ "version": "0.791.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -33,6 +33,32 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.791.0",
38
+ "at": "2026-11-24T18:45:09.361Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1764,
43
+ "t": "Ask PMOS answers with the real rows and a picker (ask-cards-and-pickers, job #1747)",
44
+ "s": "Ask PMOS answers with the real rows and a picker (ask-cards-and-pickers, job #1747)",
45
+ "k": "new"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "v": "0.790.0",
51
+ "at": "2026-11-24T18:34:00.454Z",
52
+ "f": 4,
53
+ "prs": [
54
+ {
55
+ "n": 1797,
56
+ "t": "Copies, shared links and the notepad read in the Reading layout; Work and Library on pm-layout-open (A334)",
57
+ "s": "Copies, shared links and the notepad read in the Reading layout; Work and Library on pm-layout-open (A334)",
58
+ "k": "new"
59
+ }
60
+ ]
61
+ },
36
62
  {
37
63
  "v": "0.789.0",
38
64
  "at": "2026-11-24T18:21:37.096Z",
@@ -437,32 +463,6 @@
437
463
  "k": "new"
438
464
  }
439
465
  ]
440
- },
441
- {
442
- "v": "0.771.0",
443
- "at": "2026-11-24T09:13:38.789Z",
444
- "f": 4,
445
- "prs": [
446
- {
447
- "n": 1732,
448
- "t": "Connectors that work no longer show as down",
449
- "s": "Connectors that work no longer show as down",
450
- "k": "fix"
451
- }
452
- ]
453
- },
454
- {
455
- "v": "0.770.0",
456
- "at": "2026-11-24T09:01:51.310Z",
457
- "f": 4,
458
- "prs": [
459
- {
460
- "n": 1733,
461
- "t": "Keep try steps when a PR Story has no Title line",
462
- "s": "Keep try steps when a PR Story has no Title line",
463
- "k": "fix"
464
- }
465
- ]
466
466
  }
467
467
  ]
468
468
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@e257f5d8f
1
+ kernel-source: pmos@55bd53f7b
2
2
  assembled: 2026-11-24
3
3
  mode: vendor
@@ -138,7 +138,7 @@ body{margin:0;background:var(--ground);color:var(--ink);font-family:var(--font-s
138
138
  .pm-layout-side,.pm-layout-open,.pm-layout-reading{display:grid;gap:var(--space-16);align-items:start}
139
139
  .pm-layout-side{grid-template-columns:minmax(0,1fr) var(--width-side)}
140
140
  .pm-layout-side>.pm-side,.pm-layout-reading>.pm-contents{position:sticky;top:0}
141
- .pm-layout-open{grid-template-columns:minmax(0,1fr)}
141
+ .pm-layout-open{grid-template-columns:minmax(0,1fr);align-content:start}
142
142
  .pm-layout-open:has(>.pm-item){grid-template-columns:minmax(0,1fr) var(--width-item)}
143
143
  .pm-layout-open>.pm-item,.pm-layout-popup{background:var(--card);border-radius:var(--radius-panel);box-shadow:var(--raise);padding:var(--space-24)}
144
144
  .pm-layout-popup{box-shadow:var(--lift);padding:var(--space-24) var(--space-32)}
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-24T18:21:34Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T18:45:05Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-11-24T18:21:34Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T18:45:05Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-11-24T18:21:34Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T18:45:05Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,30 @@
1
1
  [
2
+ {
3
+ "v": "0.791.0",
4
+ "at": "2026-11-24T18:45:09.361Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1764,
9
+ "t": "Ask PMOS answers with the real rows and a picker (ask-cards-and-pickers, job #1747)",
10
+ "s": "Ask PMOS answers with the real rows and a picker (ask-cards-and-pickers, job #1747)",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "v": "0.790.0",
17
+ "at": "2026-11-24T18:34:00.454Z",
18
+ "f": 4,
19
+ "prs": [
20
+ {
21
+ "n": 1797,
22
+ "t": "Copies, shared links and the notepad read in the Reading layout; Work and Library on pm-layout-open (A334)",
23
+ "s": "Copies, shared links and the notepad read in the Reading layout; Work and Library on pm-layout-open (A334)",
24
+ "k": "new"
25
+ }
26
+ ]
27
+ },
2
28
  {
3
29
  "v": "0.789.0",
4
30
  "at": "2026-11-24T18:21:37.096Z",
@@ -138,7 +138,7 @@ body{margin:0;background:var(--ground);color:var(--ink);font-family:var(--font-s
138
138
  .pm-layout-side,.pm-layout-open,.pm-layout-reading{display:grid;gap:var(--space-16);align-items:start}
139
139
  .pm-layout-side{grid-template-columns:minmax(0,1fr) var(--width-side)}
140
140
  .pm-layout-side>.pm-side,.pm-layout-reading>.pm-contents{position:sticky;top:0}
141
- .pm-layout-open{grid-template-columns:minmax(0,1fr)}
141
+ .pm-layout-open{grid-template-columns:minmax(0,1fr);align-content:start}
142
142
  .pm-layout-open:has(>.pm-item){grid-template-columns:minmax(0,1fr) var(--width-item)}
143
143
  .pm-layout-open>.pm-item,.pm-layout-popup{background:var(--card);border-radius:var(--radius-panel);box-shadow:var(--raise);padding:var(--space-24)}
144
144
  .pm-layout-popup{box-shadow:var(--lift);padding:var(--space-24) var(--space-32)}
@@ -160,6 +160,7 @@ Press the name in the Viewer's header. The name becomes a field.
160
160
 
161
161
  - Type the new name. Press Enter or the check to save it. Press Esc to stop without a change. An empty name is not saved.
162
162
  - The new name shows at once in the list, the chat header, the Viewer, Work and the Timeline. The message **Renamed** has **Undo**.
163
+ - **Rows and pickers in the chat.** When PMOS names tasks or an initiative in its answer, the chat shows them as the rows Work shows, live, with their buttons (for example, ✓ marks a task done, with **Undo**). It shows the first 5 and **All N on Work**. A task that is gone shows "was not found", and PMOS's words above stay. When PMOS needs you to choose a value, such as a new due date or an owner, it shows one picker per value with its recommended choice set (✦). One press makes the change, and **Undo** puts it back. A row shows only the parts that have a value: a task with no owner or no due date shows no empty place for it. PMOS notes which kinds and ids each answer showed, which were not found and which buttons you pressed, and each ✦ draft with its ✓ or ✕, in the local use log on this computer. It notes no titles and none of your words. Nothing is sent anywhere.
163
164
  - **A change from the chat shows at once.** When you ask the chat to add, move, close or delete a task, the row changes on Today, Work and an open task popup within a second, without the page reading its lists again. A change you make in one tab of the workspace shows in its other open tabs as soon as it is saved. A change that is not saved does not show in the other tabs. A published read-only Board does not follow these changes: it shows the board as it was published.
164
165
  - An initiative of another product renames in that product's own repository, the same as on Work.
165
166
  - Only the name changes. The id, the record file, the links and the history stay the same.
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Layout and first run: the places, the navigation, the Viewer, the launcher and Adler"
4
4
  description: "The places, the navigation at the left, the Viewer, the keys and the phone; the first run; when features appear; the PMOS app; and Adler."
5
- timestamp: 2026-11-25
5
+ timestamp: 2026-11-24
6
6
  ---
7
7
 
8
8
  # Layout and first run
@@ -139,10 +139,10 @@ A document opened in the Viewer (a doc, spec, brief, report, weekly update, meet
139
139
  - The title, then one line that says who drafted it (✦ when PMOS did), who checked it, for whom, the version and how long it takes to read. **Properties** opens the document's other fields.
140
140
  - **In short**: the answer and the ask, from the document's In short, Summary or TL;DR section.
141
141
  - One section for each heading. Press a heading to fold it. Each document keeps the sections you folded, the next time you open it.
142
- - **Contents** at the left lists the sections and marks the one you are reading as you scroll. Press one to go to it. Below 1100 px wide, and on a phone, there is no Contents.
142
+ - **Contents** at the left lists the sections and marks the one you are reading as you scroll. Press one to go to it. There is no Contents when the window is narrower than 1100 px, when the Viewer is narrower than 900 px, or on a phone.
143
143
  - Edit, Markdown, Health, Links, Copies, the report's Present, Print and Download, the Edit log and Proposals are where they were. An agent's edit still opens with **Keep** and **Undo all**.
144
144
 
145
- This guide's pages and a Markdown file opened from a chat read the same way; a file keeps **Download** and **Share** at the top. Other kinds move to this view one at a time. Slides, PDFs and prototypes keep the stage, and a task, ticket or event keeps the task detail.
145
+ This guide's pages and a Markdown file opened from a chat read the same way; a file keeps **Download** and **Share** at the top. A Google Doc or Confluence copy reads the same way too, with its status and **Check again**, **Use its version** or **Read again** above the title. A shared link to a Markdown file, and a printed one, read the same way: Contents at the left on a wide screen and sections that fold, with no comments and no chat. Other kinds move to this view one at a time. Slides, PDFs and prototypes keep the stage, and a task, ticket or event keeps the task detail.
146
146
 
147
147
  ### What you type is kept
148
148
 
@@ -191,6 +191,8 @@ function chatSessionOf(runtimeDir, key) {
191
191
  // premium-agreed-design (XcbOptions "Every kind of ask", "Chasing people"): the two asks the page cannot read from the terminal, and a chase,
192
192
  // as blocks the chat draws (public/pm/home-ask.js, public/pm/home-sweep.js)
193
193
  const ASK_RULES = [
194
+ // ask-cards-and-pickers (canvas A2Cards, A2Ask): the page draws the named rows live with the card catalog's buttons, and a picker that runs one catalog command (public/pm/chat-cards.js)
195
+ 'When your answer names tasks or initiatives the PM may act on, add one fenced code block with the language tag pmos-card holding one JSON object: {"kind":"task","ids":["<task id>","<task id>"],"title":"This sprint · ends Sat 6 Dec","total":7} (kind: task, subtask, milestone or initiative; the real ids from pmos task list or the records, the most important first; total: how many the whole list holds). The page draws those rows live with their buttons, so do not repeat each row in your words: say what matters in one or two sentences. When one change would help and the PM must choose a value, add one fenced pmos-pick block instead of asking in words: {"kind":"task","id":"<task id>","action":"Move the date","question":"Move Payment API so the launch holds?","why":"4 days late","fields":[{"flag":"due","options":[{"value":"2026-12-03","label":"Wed 3 Dec"},{"value":"2026-12-05","label":"Fri 5 Dec"}],"recommended":0},{"flag":"owner","options":[{"value":"Dana Lee"},{"value":"Priya Shah"}],"recommended":0}],"after":"The launch moves to Fri 5 Dec"} (action: a button label of the card catalog for that kind; at most 2 fields, each a flag that command takes; 2 to 4 options, the one you recommend in recommended). One press runs it with Undo; nothing else is needed from you.',
194
196
  'When you need the PM to judge a done point you cannot check yourself, or you cannot reach something you need (a sign-in expired, a file), end your message with one fenced code block with the language tag pmos-ask holding one JSON object: {"kind":"judge","point":"the done point","question":"Is the draft ready for Dita?"} or {"kind":"reach","what":"Jira","why":"sign-in expired","need":"signin"} (need: signin, file or both). The page draws it as a card with the PM\'s answers.',
195
197
  'When the PM asks you to chase people for a reply, end each message about it with one fenced pmos-chase block: {"state":"chasing","what":"Sign-off on the PRD","next":"ISO 8601 time of the next nudge","people":[{"name":"Dita","status":"signed off","note":"Fri 16:40, in Slack","replied":true},{"name":"Raj","status":"asked twice","note":"last nudge Fri 10:00, no reply"}]}. Set state to done when everyone replied, and to stopped when the PM says stop.',
196
198
  ];
@@ -0,0 +1,64 @@
1
+ 'use strict';
2
+ /* card-rows-route.js — the rows a chat answer names, as Work holds them now (initiative ask-cards-and-pickers, job #1747). It rides on
3
+ * routes-slash.js beside #1746's routes, so it is not named routes-*.js (d86-seams 7: every routes-*.js is a route-modules entry).
4
+ *
5
+ * GET /api/card-rows?ws=<id>&kind=task|subtask|milestone|initiative&ids=a,b,c
6
+ * → { ok, rows: [{ id, kind, found, title, who, due, start, state, board, initiative, stage }] } at most 5 ids; an id that is not
7
+ * on a board of the workspace comes back { id, found: false }
8
+ *
9
+ * Read only. The chat draws these rows with the card catalog's buttons (public/pm/chat-cards.js); a button writes through the page's own
10
+ * routes (public/pm/action-run.js), never this one. */
11
+ const { repoScript } = require('./repo-script.js');
12
+ const B = require(repoScript('boards.js'));
13
+
14
+ const MAX = 5;
15
+ const ID = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,80}$/;
16
+ const TASKS = new Set(['task', 'subtask', 'milestone']);
17
+ // an owner written by the call path reads as a person: the PM is You, an agent session is PMOS
18
+ const whoOf = (o) => (/^pm:/.test(String(o || '')) ? 'You' : /^agent:/.test(String(o || '')) ? 'PMOS' : String(o || ''));
19
+ const day = (d) => (typeof d === 'string' ? d.slice(0, 10) : '');
20
+
21
+ function taskRows(ctx, w, ids) {
22
+ const boards = require('./routes-boards.js');
23
+ const folded = boards.foldOf(ctx, w);
24
+ return ids.map((id) => {
25
+ const t = B.taskOf(folded, id);
26
+ if (!t) return { id, found: false };
27
+ return { id, kind: t.milestone ? 'milestone' : t.parent ? 'subtask' : 'task', found: true, title: t.title || id, who: whoOf(t.owner), due: day(t.due),
28
+ start: day(t.start), state: t.state || 'To do', board: t.board || null, initiative: t.initiative || null };
29
+ });
30
+ }
31
+
32
+ function initiativeRows(ctx, w, ids) {
33
+ const boards = require('./routes-boards.js');
34
+ return ids.map((id) => {
35
+ let r = boards.initiativeWorkflow(ctx, w, id);
36
+ // the rows are still being derived (a fresh process): derive them now, as `pmos task` does
37
+ if (r && r.pending) { try { require('./initiative-rows.js').deriveNow(w.root); } catch { /* answered below */ } r = boards.initiativeWorkflow(ctx, w, id); }
38
+ if (!r || !r.ok || !r.row) return { id, found: false };
39
+ const row = r.row;
40
+ const stage = row.stageName || (row.wf && row.wf.stage && row.wf.stage.name) || row.stage || '';
41
+ return { id, kind: 'initiative', found: true, title: row.title || id, who: row.owner || '', due: day(row.due || row.target || ''), state: row.state || '',
42
+ stage: typeof stage === 'string' ? stage : '', board: (r.board && r.board.id) || null, initiative: id };
43
+ });
44
+ }
45
+
46
+ module.exports = {
47
+ prefixes: ['/api/card-rows'],
48
+ handle: async (req, res, url, ctx) => {
49
+ if (url.pathname !== '/api/card-rows') return false;
50
+ if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
51
+ const kind = url.searchParams.get('kind') || '';
52
+ const ids = [...new Set(String(url.searchParams.get('ids') || '').split(',').map((s) => s.trim()).filter((s) => ID.test(s)))].slice(0, MAX);
53
+ if (!TASKS.has(kind) && kind !== 'initiative') { ctx.json(res, { ok: false, error: 'kind is one of task, subtask, milestone, initiative' }, 400); return true; }
54
+ if (!ids.length) { ctx.json(res, { ok: false, error: 'ids names at least one id' }, 400); return true; }
55
+ const w = ctx.getWs ? ctx.getWs(url.searchParams.get('ws') || null) : null;
56
+ if (!w) { ctx.json(res, { ok: false, error: 'no such workspace' }, 404); return true; }
57
+ let rows;
58
+ try { rows = kind === 'initiative' ? initiativeRows(ctx, w, ids) : taskRows(ctx, w, ids); } catch (e) { ctx.json(res, { ok: false, error: 'The rows could not be read: ' + String((e && e.message) || e).slice(0, 200) }, 500); return true; }
59
+ ctx.json(res, { ok: true, rows });
60
+ return true;
61
+ },
62
+ taskRows,
63
+ initiativeRows,
64
+ };
@@ -265,10 +265,10 @@ function pmosAsk(q) {
265
265
  // The commands a card's buttons run live beside the chat's commands (star-buttons-act-directly): GET /api/card-catalog
266
266
  // (lib/card-catalog-route.js) and the ✦ drafts' background job, POST/GET /api/star-drafts (lib/star-drafts-route.js). They ride on this
267
267
  // module's entry, so route-modules.js keeps its list.
268
- const BESIDE = [require('./card-catalog-route.js'), require('./star-drafts-route.js')];
268
+ const BESIDE = [require('./card-catalog-route.js'), require('./star-drafts-route.js'), require('./card-rows-route.js')]; // + the rows a chat answer names (ask-cards-and-pickers)
269
269
 
270
270
  module.exports = { pmosAsk,
271
- prefixes: ['/api/slash-commands', '/api/card-catalog', '/api/star-drafts', '/api/features'],
271
+ prefixes: ['/api/slash-commands', '/api/card-catalog', '/api/star-drafts', '/api/card-rows', '/api/features'],
272
272
  list, sayOf, CLAUDE, FEATURES, PMOS,
273
273
  handle: async (req, res, url, ctx) => {
274
274
  for (const m of BESIDE) if (m.prefixes.includes(url.pathname)) return m.handle(req, res, url, ctx);
@@ -9,7 +9,8 @@
9
9
  * and a time. Anything else (a value, visible text, a URL, an address) fails the patterns below and the event is dropped, not cut.
10
10
  *
11
11
  * THE LEDGER. One line per event, { at, kind, page, control?, device }:
12
- * kind 'open' (the page was opened) | 'use' (a control was pressed)
12
+ * kind 'open' (the page was opened) | 'use' (a control was pressed) | 'cards' (a chat answer's card list or a ✦ press:
13
+ * { cards: { kinds, ids, rendered, notFound, pressed } }, kinds, record ids and button labels only; pm/card-log.js)
13
14
  * page the page's file name without .html: today, premium-board (PAGE_RE)
14
15
  * control 'use' only: an element id or a data-attribute name: czFab, data-ev-sub (CONTROL_RE)
15
16
  * device phone | tablet | desk
@@ -32,7 +33,12 @@ const FILE = 'use-log.jsonl';
32
33
  const KEEP_DAYS = 30;
33
34
  const MAX_BATCH = 200;
34
35
  const DAY = 864e5;
35
- const KINDS = ['open', 'use'];
36
+ const KINDS = ['open', 'use', 'cards'];
37
+ // a 'cards' line (pm/card-log.js, card catalog rule 9): an answer's card list or a ✦ press; kinds, record ids and button labels only
38
+ const KIND_RE = /^[a-z][a-z0-9-]{0,39}$/;
39
+ const ID_RE = /^[A-Za-z0-9][A-Za-z0-9:._-]{0,119}$/;
40
+ const LABEL_RE = /^[A-Za-z✦][A-Za-z0-9 ✦'-]{0,39}$/;
41
+ const uniq = (a, re, max) => [...new Set((Array.isArray(a) ? a : []).map(String).filter((x) => re.test(x)))].slice(0, max);
36
42
  const DEVICES = ['phone', 'tablet', 'desk'];
37
43
  const PAGE_RE = /^[a-z0-9][a-z0-9._-]{0,59}$/;
38
44
  const CONTROL_RE = /^[A-Za-z][A-Za-z0-9_-]{0,79}$/;
@@ -56,6 +62,13 @@ function clean(ev, now = Date.now()) {
56
62
  if (!PAGE_RE.test(page)) return null;
57
63
  const t = Number(ev.t), at = new Date(Number.isFinite(t) && t <= now && t > now - DAY ? t : now).toISOString();
58
64
  if (ev.kind === 'open') return { at, kind: 'open', page, device: ev.device };
65
+ if (ev.kind === 'cards') {
66
+ const c = isObj(ev.cards) ? ev.cards : {}, n = Number(c.rendered);
67
+ const cards = { kinds: uniq(c.kinds, KIND_RE, 10), ids: uniq(c.ids, ID_RE, 20), rendered: Number.isInteger(n) && n >= 0 ? Math.min(n, 999) : 0,
68
+ notFound: uniq(c.notFound, ID_RE, 20), pressed: uniq(c.pressed, LABEL_RE, 10) };
69
+ if (!cards.kinds.length && !cards.pressed.length) return null;
70
+ return { at, kind: 'cards', page, device: ev.device, cards };
71
+ }
59
72
  const control = String(ev.control == null ? '' : ev.control);
60
73
  if (!CONTROL_RE.test(control)) return null;
61
74
  return { at, kind: 'use', page, control, device: ev.device };
@@ -105,7 +118,7 @@ function summary(lines, now = Date.now()) {
105
118
  for (const l of L) {
106
119
  days.add(l.at.slice(0, 10));
107
120
  if (l.kind === 'open') { opens++; pages.set(l.page, (pages.get(l.page) || 0) + 1); }
108
- else { uses++; const k = l.page + ' ' + l.control; controls.set(k, (controls.get(k) || 0) + 1); }
121
+ else if (l.kind === 'use') { uses++; const k = l.page + ' ' + l.control; controls.set(k, (controls.get(k) || 0) + 1); }
109
122
  }
110
123
  const top = (m) => [...m].sort((a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : 1)).slice(0, TOP);
111
124
  return { keep: KEEP_DAYS, days: days.size, opens, uses,
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.789.0",
3
+ "version": "0.791.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.789.0",
9
+ "version": "0.791.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.789.0",
3
+ "version": "0.791.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",
@@ -54,7 +54,7 @@ const SHOTS = process.env.PMOS_SHOTS || '';
54
54
  ok('W1 a file still reading, missing or unreadable offers nothing', !M.downloadsOf({ loading: true }).length && !M.downloadsOf({ reason: 'missing' }).length && !M.downloadsOf({ err: 'x' }).length);
55
55
  const h = M.printSrc({ name: 'r.html', kind: 'html', text: '<!doctype html><p>x</p>' }), m = M.printSrc({ name: 'n.md', kind: 'markdown', text: '# Notes\n\nThe **rate** is 38%.' });
56
56
  ok('W2 the print page keeps the CSP first and prints itself on load', h.startsWith('<!doctype html><meta http-equiv="Content-Security-Policy"') && /addEventListener\("load"[\s\S]*print\(\)/.test(h), h.slice(0, 200));
57
- ok('W2 markdown prints as a page of its words', /<h1>Notes<\/h1>/.test(m) && /<strong>rate<\/strong>/.test(m) && m.includes(M.FRAME_CSP), m.slice(0, 300));
57
+ ok('W2 markdown prints as a page of its words', /<h1[^>]*>Notes<\/h1>/.test(m) && /<strong>rate<\/strong>/.test(m) && m.includes(M.FRAME_CSP), m.slice(0, 300));
58
58
  ok('W1 the title row of a read file carries the download icon', /data-fdl/.test(M.fileHtml({ name: 'n.md', kind: 'markdown', text: '# N', rel: 'n.md' })) && !/data-fdl/.test(M.fileHtml({ loading: true })));
59
59
  }
60
60
  const exe = findBrowser();
@@ -0,0 +1,25 @@
1
+ /* pm/card-log.js — every chat answer's card list and every ✦ press go to the local use log (card catalog rule 9, idea A511; the ledger is
2
+ * lib/use-log.js, the page side pm/use-log.js).
3
+ *
4
+ * cardLine({ kinds, ids, rendered, notFound, pressed }) → the same, each part cut to its safe shape PURE
5
+ * tellCards(list) sends window event `pmos:cards` with cardLine(list); pm/use-log.js notes it as one line of kind "cards".
6
+ * Nothing else listens, and with no window (Node) it does nothing.
7
+ *
8
+ * One line says which kinds an answer drew, which ids, how many rows rendered, which ids were not found and which buttons were pressed,
9
+ * so the kinds nobody uses and the ones the chat lacks show up. NOTHING PERSONAL: kinds, record ids and button labels only; never a
10
+ * title, a value or the PM's words. */
11
+ export const MAX_IDS = 20;
12
+ const KIND_RE = /^[a-z][a-z0-9-]{0,39}$/;
13
+ const ID_RE = /^[A-Za-z0-9][A-Za-z0-9:._-]{0,119}$/;
14
+ const LABEL_RE = /^[A-Za-z✦][A-Za-z0-9 ✦'-]{0,39}$/;
15
+ const uniq = (a, re, max) => [...new Set((Array.isArray(a) ? a : []).map(String).filter((x) => re.test(x)))].slice(0, max);
16
+
17
+ export function cardLine(l = {}) {
18
+ const n = Number(l.rendered);
19
+ return { kinds: uniq(l.kinds, KIND_RE, 10), ids: uniq(l.ids, ID_RE, MAX_IDS), rendered: Number.isInteger(n) && n >= 0 ? Math.min(n, 999) : 0,
20
+ notFound: uniq(l.notFound, ID_RE, MAX_IDS), pressed: uniq(l.pressed, LABEL_RE, 10) };
21
+ }
22
+
23
+ export function tellCards(list) {
24
+ try { if (typeof window !== 'undefined' && window.dispatchEvent) window.dispatchEvent(new CustomEvent('pmos:cards', { detail: cardLine(list) })); return true; } catch { return false; }
25
+ }
@@ -0,0 +1,272 @@
1
+ /* pm/chat-cards.js — Ask PMOS answers with the real rows and with a picker, from the card catalog (initiative ask-cards-and-pickers, job
2
+ * #1747; canvas A2Cards and A2Ask, agreed by Wawan 2026-11-24; the catalog is lib/card-catalog.json, GET /api/card-catalog).
3
+ *
4
+ * The model names only a kind and ids, never a layout: the page draws the rows from live data (GET /api/card-rows) with the catalog's own
5
+ * buttons, run by pm/action-run.js with Undo. Two fenced blocks, anywhere in an answer:
6
+ * ```pmos-card {"kind":"task","ids":["task-1a2b","task-3c4d"],"title":"This sprint · ends Sat 6 Dec","total":7}```
7
+ * the rows of those ids, first MAX_ROWS; "total" (optional) says how many the whole list holds, for "3 of 7" and "All 7 on Work"
8
+ * ```pmos-pick {"kind":"task","id":"task-1a2b","action":"Move the date","question":"Move Payment API so the launch holds?",
9
+ * "why":"4 days late in Jira","fields":[{"flag":"due","options":[{"value":"2026-12-03","label":"Wed 3 Dec"},…],"recommended":0},
10
+ * {"flag":"owner","options":[…],"recommended":0}],"after":"Launch moves to Fri 5 Dec"}```
11
+ * one picker per field (at most MAX_FIELDS), the recommended choice already set; one press runs the catalog command
12
+ *
13
+ * split(text) → { text, cards: [spec], picks: [spec] } the words without the blocks, and the blocks that are valid PURE
14
+ * cardSpec(b) · pickSpec(b, catalog) a block read and checked, or null PURE
15
+ * rowsHtml(spec, rows, o) · pickHtml(spec, chosen, o) the looks PURE
16
+ * pickAction(spec, catalog) → the action the picker runs: the catalog's own, or one built from the flags of the same command PURE
17
+ * cardsUi({ pmGet, pmPost, toast, ws, redraw, runAction, tellCards }) → { html(split, key, o), owns(button), press(button) → boolean, onAction(detail) }
18
+ * the chat's part: reads the rows once per block, runs a press, keeps "moved just now" and Undo, follows pmos:action. tellCards
19
+ * (pm/card-log.js) gets one card list per answer once its rows are read, and one more for each press of a row button or a picker
20
+ *
21
+ * NEVER A BLANK PART (card catalog rule 8): a field with no value is left out of the row, a card with no ids is not drawn.
22
+ *
23
+ * A wrong or closed id draws "<id> was not found" under the rows; PMOS's words above stay as they were. */
24
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
25
+ const SVG = (d) => `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${d}"/></svg>`;
26
+ const ICON = { done: 'M5 12.5l4.5 4.5L19 7.5', go: 'M5 12.5l4.5 4.5L19 7.5', undo: 'M4 12a8 8 0 1 0 2.3-5.6M4 4v4.5h4.5' };
27
+
28
+ export const MAX_ROWS = 5;
29
+ export const MAX_FIELDS = 2;
30
+ export const KINDS = ['task', 'subtask', 'milestone', 'initiative'];
31
+ const BLOCK = /```(pmos-card|pmos-pick)[ \t]*\n?([\s\S]*?)```/g;
32
+ const ID = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,80}$/;
33
+ const DAY = /^\d{4}-\d{2}-\d{2}$/;
34
+ const clip = (s, n) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, n);
35
+ const parse = (s) => { try { const o = JSON.parse(String(s || '').trim()); return o && typeof o === 'object' && !Array.isArray(o) ? o : null; } catch { return null; } };
36
+
37
+ export function cardSpec(b) {
38
+ if (!b || !KINDS.includes(b.kind) || !Array.isArray(b.ids)) return null;
39
+ const ids = [...new Set(b.ids.filter((x) => typeof x === 'string' && ID.test(x.trim())).map((x) => x.trim()))];
40
+ if (!ids.length) return null;
41
+ const total = Number.isInteger(b.total) && b.total >= ids.length ? b.total : ids.length;
42
+ return { kind: b.kind, ids, title: clip(b.title, 120), total };
43
+ }
44
+
45
+ const actionsOf = (catalog, kind) => {
46
+ for (const g of (catalog && catalog.groups) || []) for (const k of g.kinds || []) if (k.id === kind) return k.actions || [];
47
+ return [];
48
+ };
49
+ const cmdOf = (run) => { const w = String(run || '').trim().split(/\s+/); return w[0] === 'pmos' && w[1] && w[2] && !w[2].startsWith('<') ? w[1] + ' ' + w[2] : ''; };
50
+ const flagsOf = (run) => [...String(run || '').matchAll(/--([a-z][a-z-]*)(?:\s+(<[^>]*>|"[^"]*"|[^\s-][^\s]*))?/g)].map((m) => ({ flag: m[1], ph: m[2] || '' }));
51
+
52
+ /** The action a picker runs: the catalog action itself when it takes every field, else one built from the flags of the same command that
53
+ * the kind's buttons already use (Move the date + Change owner = pmos task set <id> --due <date> --owner <who>). null when a field is a
54
+ * flag no button of the kind sends. */
55
+ export function pickAction(spec, catalog) {
56
+ const list = actionsOf(catalog, spec && spec.kind);
57
+ const base = list.find((a) => a.label === (spec && spec.action));
58
+ if (!base || !base.run || !spec.fields.length) return null;
59
+ const has = new Set(flagsOf(base.run).map((f) => f.flag));
60
+ if (spec.fields.every((f) => has.has(f.flag))) return base;
61
+ const key = cmdOf(base.run), ph = new Map();
62
+ for (const a of list) if (cmdOf(a.run) === key) for (const f of flagsOf(a.run)) if (!ph.has(f.flag) && f.ph) ph.set(f.flag, f.ph);
63
+ for (const f of flagsOf(base.run)) if (f.ph) ph.set(f.flag, f.ph);
64
+ if (!spec.fields.every((f) => ph.has(f.flag))) return null;
65
+ const extra = spec.fields.filter((f) => !has.has(f.flag)).map((f) => '--' + f.flag + ' ' + ph.get(f.flag)).join(' ');
66
+ return { ...base, run: base.run + ' ' + extra };
67
+ }
68
+
69
+ export function pickSpec(b, catalog) {
70
+ if (!b || !KINDS.includes(b.kind) || typeof b.id !== 'string' || !ID.test(b.id.trim()) || typeof b.action !== 'string' || !Array.isArray(b.fields)) return null;
71
+ const fields = b.fields.slice(0, MAX_FIELDS).map((f) => {
72
+ if (!f || typeof f.flag !== 'string' || !/^[a-z][a-z-]*$/.test(f.flag) || !Array.isArray(f.options)) return null;
73
+ const options = f.options.slice(0, 4).map((o) => (o && typeof o === 'object' ? { value: clip(o.value, 80), label: clip(o.label || o.value, 40) } : { value: clip(o, 80), label: clip(o, 40) })).filter((o) => o.value);
74
+ if (!options.length) return null;
75
+ if (f.flag === 'due' || f.flag === 'start') if (!options.every((o) => DAY.test(o.value))) return null;
76
+ const rec = Number.isInteger(f.recommended) && f.recommended >= 0 && f.recommended < options.length ? f.recommended : 0;
77
+ return { flag: f.flag, name: clip(f.name || NAMES[f.flag] || f.flag, 30), options, recommended: rec };
78
+ });
79
+ if (!fields.length || fields.some((f) => !f)) return null;
80
+ const spec = { kind: b.kind, id: b.id.trim(), action: b.action, question: clip(b.question, 160), why: clip(b.why, 160), after: clip(b.after, 120), fields };
81
+ return !catalog || pickAction(spec, catalog) ? spec : null;
82
+ }
83
+ const NAMES = { due: 'New due', start: 'Start', owner: 'Owner', to: 'Status' };
84
+
85
+ export function split(text, catalog) {
86
+ const cards = [], picks = [];
87
+ const rest = String(text == null ? '' : text).replace(BLOCK, (all, tag, body) => {
88
+ const b = parse(body);
89
+ if (tag === 'pmos-card') { const s = cardSpec(b); if (s) cards.push(s); } else { const s = pickSpec(b, catalog); if (s) picks.push(s); }
90
+ return '';
91
+ });
92
+ return { text: cards.length || picks.length || rest !== text ? rest.replace(/\n{3,}/g, '\n\n').trim() : rest, cards, picks };
93
+ }
94
+
95
+ const DOW = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
96
+ export const dayText = (d) => { if (!DAY.test(String(d || ''))) return ''; const t = new Date(d + 'T00:00:00Z'); return `${DOW[t.getUTCDay()]} ${t.getUTCDate()} ${MON[t.getUTCMonth()]}`; };
97
+ const BADGE = { Done: 'Done', Blocked: 'Blocked', 'Won\'t do': 'Won\'t do', 'To do': '', 'In progress': '' };
98
+
99
+ /** One row: the title, who · due · where, a badge when it says something, then the row's buttons (only those the page can run). */
100
+ function rowHtml(r, key, i, o) {
101
+ if (!r || r.found === false) return '';
102
+ // never a blank part (card catalog rule 8, A511): a field with no value is left out, a row with no buttons has no buttons part
103
+ const bits = [r.who || '', r.due ? 'due ' + dayText(r.due) : '', r.stage || '', r.note || ''].filter(Boolean);
104
+ const badge = r.late ? `<span class="cc-badge late">${esc(r.late)}</span>` : BADGE[r.state] ? `<span class="cc-badge">${esc(BADGE[r.state])}</span>` : '';
105
+ const acts = (o.buttons || []).filter((a) => !(a.label === 'Mark done' && r.state === 'Done')).map((a) => `<button type="button" class="hm-icb" data-cc-act="${esc(key)}|${i}|${esc(a.label)}" aria-label="${esc(a.label + ': ' + r.title)}" title="${esc(a.label)}"${o.live === false ? ' disabled' : ''}>${SVG(ICON[a.icon] || ICON.done)}</button>`).join('');
106
+ const did = o.did && o.did[r.id];
107
+ const doneLine = did ? `<p class="cc-did" role="status">${esc(did.said)}${did.undo ? ` <button type="button" class="hm-undo" data-cc-undo="${esc(key)}|${esc(r.id)}">Undo</button>` : ''}</p>` : '';
108
+ return `<li class="cc-row" data-cc-id="${esc(r.id)}"><div class="cc-t"><b>${esc(r.title || r.id)}</b>${bits.length ? `<span>${esc(bits.join(' · '))}</span>` : ''}${doneLine}</div>${badge}${acts ? `<span class="cc-acts">${acts}</span>` : ''}</li>`;
109
+ }
110
+
111
+ export function rowsHtml(spec, rows, o = {}) {
112
+ if (!spec || !spec.ids || !spec.ids.length) return ''; // a kind with no rows is not drawn
113
+ const head = spec.title || spec.total > MAX_ROWS ? `<p class="cc-h">${esc(spec.title)}${spec.total > 1 ? `<span>${Math.min(spec.ids.length, MAX_ROWS)} of ${spec.total}</span>` : ''}</p>` : '';
114
+ if (rows === null || rows === undefined) return `<div class="cc-card" role="group" aria-label="${esc(spec.title || 'Rows')}" aria-busy="true">${head}<p class="cc-wait">Reading the rows…</p></div>`;
115
+ if (rows === false) return `<div class="cc-card" role="group">${head}<p class="cc-miss">The rows could not be read. PMOS's words stay above.</p></div>`;
116
+ const by = new Map(rows.map((r) => [r.id, r]));
117
+ const shown = spec.ids.slice(0, MAX_ROWS);
118
+ const list = shown.map((id, i) => rowHtml(by.get(id), o.key || '', i, o)).join('');
119
+ const miss = shown.filter((id) => !by.get(id) || by.get(id).found === false);
120
+ const missHtml = miss.map((id) => `<p class="cc-miss">${esc(id)} was not found. It may have been closed. PMOS's words stay above.</p>`).join('');
121
+ const all = spec.total > shown.length ? `<a class="cc-all" href="/premium-board.html">All ${spec.total} on Work</a>` : '';
122
+ return `<div class="cc-card" role="group" aria-label="${esc(spec.title || 'Rows')}">${head}${list ? `<ul class="cc-rows">${list}</ul>` : ''}${missHtml}${all}</div>`;
123
+ }
124
+
125
+ export function pickHtml(spec, chosen = [], o = {}) {
126
+ if (!spec) return '';
127
+ const key = o.key || '';
128
+ if (o.did) return `<div class="cc-pick done" role="status"><p>${esc(o.did.said)}${o.did.undo ? ` <button type="button" class="hm-undo" data-cc-undo="${esc(key)}|${esc(spec.id)}">Undo</button>` : ''}</p></div>`;
129
+ const live = o.live !== false;
130
+ const fields = spec.fields.map((f, fi) => {
131
+ const at = Number.isInteger(chosen[fi]) ? chosen[fi] : f.recommended;
132
+ return `<div class="cc-f"><p class="k">${esc(f.name)}</p><div class="chips2" role="radiogroup" aria-label="${esc(f.name)}">${f.options.map((op, k) => `<button type="button" role="radio" class="chip chip2${k === at ? ' on' : ''}${k === f.recommended ? ' rec' : ''}" aria-checked="${k === at}" data-cc-pick="${esc(key)}|${fi}|${k}"${live ? '' : ' disabled'}>${esc(f.flag === 'due' || f.flag === 'start' ? dayText(op.value) || op.label : op.label)}${k === f.recommended ? ' <span aria-label="recommended">✦</span>' : ''}</button>`).join('')}</div></div>`;
133
+ }).join('');
134
+ const go = `<button type="button" class="hm-icb pri" data-cc-go="${esc(key)}" aria-label="${esc(spec.action)}" title="${esc(spec.action)}"${live ? '' : ' disabled'}>${SVG(ICON.go)}</button>`;
135
+ return `<div class="cc-pick" role="group" aria-label="${esc(spec.question || spec.action)}"><p class="k"><span aria-hidden="true">✦</span> ${esc(spec.question || spec.action)}</p>${spec.why ? `<p class="cc-why">${esc(spec.why)}</p>` : ''}${fields}`
136
+ + `<div class="acts">${spec.after ? `<span class="cc-after">${esc(spec.after)}</span>` : ''}${go}</div></div>`;
137
+ }
138
+
139
+ /** The value a picker sends for each field: { due: '2026-12-03', owner: 'Dana Lee' }. */
140
+ export function pickArgs(spec, chosen = []) {
141
+ const out = {};
142
+ spec.fields.forEach((f, i) => { const k = Number.isInteger(chosen[i]) ? chosen[i] : f.recommended; out[f.flag] = f.options[k].value; });
143
+ return out;
144
+ }
145
+
146
+ /** What a done press says: "Moved Payment API to Wed 3 Dec, owner Dana Lee." */
147
+ export function saidOf(label, title, args) {
148
+ const parts = [];
149
+ if (args.due) parts.push('to ' + dayText(args.due));
150
+ if (args.start) parts.push('start ' + dayText(args.start));
151
+ if (args.owner) parts.push('owner ' + args.owner);
152
+ if (args.to) parts.push(String(args.to));
153
+ const verb = label === 'Mark done' ? 'Done:' : /date/i.test(label) ? 'Moved' : label + ':';
154
+ return `${verb} ${title}${parts.length ? (verb === 'Moved' ? ' ' : ', ') + parts.join(', ') : ''}.`;
155
+ }
156
+
157
+ /** The buttons a row shows: the kind's catalog buttons the page can run with no value to pick (Mark done). Others go to a picker. */
158
+ export function rowButtons(catalog, kind, routeOf) {
159
+ return actionsOf(catalog, kind).filter((a) => a.who === 'you' && !a.field && a.run && routeOf(a.run) && /done/i.test(a.label));
160
+ }
161
+
162
+ /** The chat's part. host: { pmGet, pmPost, toast, ws: () => id, redraw, runAction, routeOf }. */
163
+ export function cardsUi(host) {
164
+ const S = { catalog: null, catP: null, rows: new Map(), picks: new Map(), did: new Map(), lists: new Map() };
165
+ const loadCatalog = () => S.catP || (S.catP = Promise.resolve(host.pmGet('/api/card-catalog')).then((r) => { S.catalog = r && r.ok ? r.catalog : null; if (S.catalog) host.redraw(); }).catch(() => null));
166
+ const rowsKey = (spec) => spec.kind + ':' + spec.ids.slice(0, MAX_ROWS).join(',');
167
+ function load(spec) {
168
+ const k = rowsKey(spec);
169
+ if (S.rows.has(k)) return;
170
+ S.rows.set(k, null);
171
+ const ws = host.ws ? host.ws() : '';
172
+ Promise.resolve(host.pmGet('/api/card-rows?kind=' + encodeURIComponent(spec.kind) + '&ids=' + encodeURIComponent(spec.ids.slice(0, MAX_ROWS).join(',')) + (ws ? '&ws=' + encodeURIComponent(ws) : '')))
173
+ .then((r) => { S.rows.set(k, r && r.ok && Array.isArray(r.rows) ? r.rows : false); host.redraw(); })
174
+ .catch(() => { S.rows.set(k, false); host.redraw(); });
175
+ }
176
+ /* the answer's card list (card catalog rule 9, A511): one use-log line per answer once its rows are read, one per ✦ press */
177
+ const answerOf = (k) => String(k || '').replace(/:[cp]\d+$/, '');
178
+ function listOf(sp) {
179
+ const kinds = [], ids = [], notFound = []; let rendered = 0, wait = false;
180
+ for (const spec of sp.cards) {
181
+ kinds.push(spec.kind); const shown = spec.ids.slice(0, MAX_ROWS); ids.push(...shown);
182
+ const rows = S.rows.get(rowsKey(spec));
183
+ if (rows === null || rows === undefined) wait = true;
184
+ else if (Array.isArray(rows)) for (const id of shown) { const r = rows.find((x) => x.id === id); if (r && r.found !== false) rendered++; else notFound.push(id); }
185
+ }
186
+ for (const spec of sp.picks) { kinds.push(spec.kind); ids.push(spec.id); rendered++; }
187
+ return wait ? null : { kinds, ids, rendered, notFound, pressed: [] };
188
+ }
189
+ const told = (k, extra) => { const l = S.lists.get(answerOf(k)); if (host.tellCards) host.tellCards({ ...(l || {}), ...extra }); };
190
+ const findRow = (id) => { for (const rows of S.rows.values()) if (Array.isArray(rows)) { const r = rows.find((x) => x.id === id); if (r) return r; } return null; };
191
+ const ui = {
192
+ state: S,
193
+ split(text) { loadCatalog(); return split(text, S.catalog); },
194
+ html(sp, key, o = {}) {
195
+ if (!sp || (!sp.cards.length && !sp.picks.length)) return '';
196
+ const cards = sp.cards.map((spec, i) => {
197
+ load(spec);
198
+ const buttons = S.catalog && host.routeOf ? rowButtons(S.catalog, spec.kind, host.routeOf) : [];
199
+ return rowsHtml(spec, S.rows.get(rowsKey(spec)), { key: key + ':c' + i, buttons, live: o.live, did: Object.fromEntries([...S.did].filter(([k]) => k.startsWith(key + ':c' + i + '|')).map(([k, v]) => [k.split('|')[1], v])) });
200
+ }).join('');
201
+ const picks = sp.picks.map((spec, i) => {
202
+ const pk = key + ':p' + i;
203
+ if (!S.picks.has(pk)) S.picks.set(pk, { spec, chosen: [] });
204
+ const p = S.picks.get(pk);
205
+ return pickHtml(spec, p.chosen, { key: pk, live: o.live, did: S.did.get(pk + '|' + spec.id) });
206
+ }).join('');
207
+ if (!S.lists.has(key)) { const l = listOf(sp); if (l) { S.lists.set(key, l); if (host.tellCards) host.tellCards(l); } }
208
+ return cards || picks ? `<div class="cc-wrap">${cards}${picks}</div>` : '';
209
+ },
210
+ /** A press inside a card or a picker; true when it was one. */
211
+ /** True when the button is one of the cards' own: the chat checks this first, so its other buttons stay synchronous. */
212
+ owns: (b) => !!b && !!b.dataset && Object.keys(b.dataset).some((k) => /^cc[A-Z]/.test(k)),
213
+ async press(b) {
214
+ const d = (b && b.dataset) || {};
215
+ if (d.ccPick) {
216
+ const [pk, fi, k] = d.ccPick.split('|'); const p = S.picks.get(pk); if (!p) return true;
217
+ p.chosen[Number(fi)] = Number(k); host.redraw(); return true;
218
+ }
219
+ if (d.ccGo) {
220
+ const p = S.picks.get(d.ccGo); if (!p || !S.catalog) return true;
221
+ const act = pickAction(p.spec, S.catalog); if (!act) return true;
222
+ const args = pickArgs(p.spec, p.chosen), row = findRow(p.spec.id);
223
+ b.disabled = true;
224
+ told(d.ccGo, { pressed: [act.label] });
225
+ const r = await host.runAction({ kind: p.spec.kind, action: act, id: p.spec.id, args, was: row ? row.state : undefined, ws: host.ws && host.ws(), board: row ? row.board : undefined }, { pmPost: host.pmPost, catalog: S.catalog });
226
+ if (r && r.ok) { S.did.set(d.ccGo + '|' + p.spec.id, { said: saidOf(act.label, row ? row.title : p.spec.id, args), undo: r.undo }); }
227
+ else if (host.toast) host.toast((r && (r.error || r.said || r.ask)) || 'Not saved.');
228
+ b.disabled = false; host.redraw(); return true;
229
+ }
230
+ if (d.ccAct) {
231
+ const [ck, i, label] = d.ccAct.split('|');
232
+ const spec = ui.specOf(ck); if (!spec || !S.catalog) return true;
233
+ const rows = S.rows.get(rowsKey(spec)); const id = spec.ids[Number(i)]; const row = Array.isArray(rows) ? rows.find((x) => x.id === id) : null;
234
+ if (!row) return true;
235
+ b.disabled = true;
236
+ told(ck, { pressed: [label] });
237
+ const r = await host.runAction({ kind: spec.kind, action: label, id, args: {}, was: row.state, ws: host.ws && host.ws(), board: row.board }, { pmPost: host.pmPost, catalog: S.catalog });
238
+ if (r && r.ok) S.did.set(ck + '|' + id, { said: saidOf(label, row.title, {}), undo: r.undo });
239
+ else if (host.toast) host.toast((r && (r.error || r.said || r.ask)) || 'Not saved.');
240
+ b.disabled = false; host.redraw(); return true;
241
+ }
242
+ if (d.ccUndo) {
243
+ const at = d.ccUndo.lastIndexOf('|'), k = d.ccUndo.slice(0, at), id = d.ccUndo.slice(at + 1);
244
+ const did = S.did.get(k + '|' + id); if (!did || !did.undo) return true;
245
+ b.disabled = true;
246
+ const u = await did.undo();
247
+ if (u && u.ok !== false) S.did.delete(k + '|' + id); else if (host.toast) host.toast((u && u.error) || 'The undo did not land.');
248
+ host.redraw(); return true;
249
+ }
250
+ return false;
251
+ },
252
+ specs: new Map(),
253
+ specOf(ck) { return ui.specs.get(ck) || null; },
254
+ /** pmos:action (a card button, a press elsewhere, the chat's own write streamed by pm/live-feed.js): the row the chat shows follows it. */
255
+ onAction(det) {
256
+ if (!det || !det.id) return false;
257
+ let hit = false;
258
+ for (const rows of S.rows.values()) if (Array.isArray(rows)) for (const r of rows) if (r.id === det.id) {
259
+ if (det.field === 'state' && det.value) { r.state = String(det.value); hit = true; }
260
+ if (det.field === 'due') { r.due = det.value || ''; r.late = ''; hit = true; }
261
+ if (det.field === 'owner') { r.who = det.value || ''; hit = true; }
262
+ if (det.field === 'removed') { r.found = false; hit = true; }
263
+ }
264
+ if (hit) host.redraw();
265
+ return hit;
266
+ },
267
+ };
268
+ // the row buttons name their card by key: keep each card's spec under it as it is drawn
269
+ const html0 = ui.html;
270
+ ui.html = (sp, key, o) => { if (sp) sp.cards.forEach((spec, i) => ui.specs.set(key + ':c' + i, spec)); return html0(sp, key, o); };
271
+ return ui;
272
+ }
@@ -27,6 +27,8 @@ body.bd-page .dock, body.bd-page .sky, body.bd-page .hero, body.bd-page .rail {
27
27
  /* the panel (AgBoard .panel): no page header; it starts at the top */
28
28
  body.bd-page main.bd-main { position: relative; max-width: none; margin: var(--space-16); padding: 22px 28px 20px; min-height: calc(100vh - 32px); box-sizing: border-box; font-family: var(--cz-sans); font-size: var(--fs-body); color: var(--cz-ink);
29
29
  background: var(--cz-card); border-radius: 28px; box-shadow: 0 30px 70px -36px rgba(42,46,53,.28); display: flex; flex-direction: column; gap: 14px; line-height: var(--lh-body); }
30
+ /* Work sits on the system's pm-layout-open (reading-layouts, A334): its grid and its gap token win over the panel's own column */
31
+ body.bd-page main.bd-main.pm-layout-open { display: grid; gap: var(--space-16); }
30
32
  .bd-page main.bd-main * { box-sizing: border-box; }
31
33
 
32
34
  /* ── the toolbar (AgBoard .hd .tools) ── */
@@ -622,6 +624,7 @@ span.tg-end { left: var(--tl-x); cursor: default; } /* a shared board's milest
622
624
  /* ── phone (AgBoardPhone, AgBoardPhoneSheet, AgBoardTimelinePhone): a one-line top bar, cards, and a bottom sheet ── */
623
625
  @media (max-width: 720px) {
624
626
  body.bd-page main.bd-main { margin: 0; border-radius: 0; min-height: 100vh; padding: var(--space-16) var(--space-16) 110px; box-shadow: none; background: transparent; gap: 10px; }
627
+ body.bd-page main.bd-main.pm-layout-open { gap: var(--space-8); }
625
628
  .bd-hd { gap: 2px; min-height: 44px; }
626
629
  .bd-tools { gap: 0; margin-left: auto; }
627
630
  .bd-hide-s, .bd-views, .bd-spw, .bd-lgdw, #chSprint, .bd-page #pvBell, .bd-page #moreBtn, .bd-page .tools-top { display: none !important; }
@@ -288,6 +288,28 @@ body.cz-home { min-height: 100vh; overflow: hidden; }
288
288
  .hm-askk.sw-l { box-shadow: inset 4px 0 0 var(--cz-dot-q); }
289
289
  }
290
290
  .hm-askk .acts, .hm-fix { display: flex; align-items: center; gap: var(--space-8); margin-top: 6px; }
291
+ /* ask-cards-and-pickers (canvas A2Cards, A2Ask; pm/chat-cards.js): the rows an answer names, live, and a picker that runs one command */
292
+ .cc-wrap { display: flex; flex-direction: column; gap: var(--space-8); margin-top: var(--space-8); }
293
+ .cc-card, .cc-pick { border-radius: var(--radius-card, 16px); background: var(--cz-card); box-shadow: inset 0 0 0 1px var(--cz-hair); padding: 10px var(--space-12); display: flex; flex-direction: column; gap: var(--space-4); font-size: var(--fs-body); line-height: var(--lh-body); }
294
+ .cc-pick { background: linear-gradient(180deg, var(--cz-bluebg) 0%, var(--cz-card) 70%); box-shadow: inset 0 0 0 1.5px var(--cz-blue); }
295
+ .cc-h, .cc-pick .k, .cc-f .k { margin: 0; display: flex; justify-content: space-between; gap: var(--space-8); font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink3); line-height: var(--lh-label); }
296
+ .cc-h span { font-weight: var(--fw-regular); }
297
+ .cc-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
298
+ .cc-row { display: flex; align-items: center; gap: var(--space-8); padding: 6px 0; border-top: 1px solid var(--cz-hair); }
299
+ .cc-row:first-child { border-top: 0; }
300
+ .cc-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
301
+ .cc-t b { font-size: var(--fs-row); font-weight: var(--fw-strong); color: var(--cz-ink); line-height: var(--lh-row); overflow-wrap: anywhere; }
302
+ .cc-t span, .cc-why, .cc-after, .cc-wait { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink2); margin: 0; }
303
+ .cc-did { margin: 2px 0 0; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink); }
304
+ .cc-badge { flex: none; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink2); padding: 2px var(--space-8); border-radius: 999px; background: var(--cz-bluebg); }
305
+ .cc-badge.late { color: var(--cz-ink); }
306
+ .cc-acts { flex: none; display: inline-flex; gap: var(--space-4); }
307
+ .cc-miss { margin: 0; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink2); }
308
+ .cc-all { font-size: var(--fs-meta); color: var(--cz-blueink); width: max-content; }
309
+ .cc-f { display: flex; flex-direction: column; gap: var(--space-4); }
310
+ .cc-pick .acts { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-8); margin-top: 6px; }
311
+ .cc-pick .cc-after { flex: 1; }
312
+ .cc-pick.done p { margin: 0; }
291
313
  .hm-fix { padding-left: 38px; margin-top: 0; }
292
314
  .hm-icb { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
293
315
  .hm-icb.pri { background: var(--cz-solid); color: var(--cz-onsolid); border-color: transparent; }
@@ -42,6 +42,9 @@ import { canDictate, dictate } from './home-dictate.js';
42
42
  import { adler } from './cozy-adler.js';
43
43
  import { snapOf, turnEnded } from './chat-turn-end.js'; // a finished turn re-reads what the Viewer shows (batch 25 item 3)
44
44
  import { nextPromptUi } from './next-prompt-ui.js'; // the suggested next prompt and the Sharper card above the box (batch 26 item 2)
45
+ import { cardsUi } from './chat-cards.js'; // ask-cards-and-pickers: the rows an answer names, live, and a picker (canvas A2Cards, A2Ask)
46
+ import { runAction, routeOf } from './action-run.js';
47
+ import { tellCards } from './card-log.js'; // each answer's card list and each press to the local use log (card catalog rule 9, A511)
45
48
  /* The views a chat opens go in the Viewer: on a page with no dialog the old viewer's views draw in the cozy card (premium-viewer.js). */
46
49
  let REPORT_TAB = false; // a report tab was opened from a chat on this page: only then is premium-report-tab.js read at send
47
50
  const views = {
@@ -85,6 +88,9 @@ export const adlerAvHtml = (mood) => `<span class="hm-av hm-adler" aria-hidden="
85
88
  export function mountChat(el, host) {
86
89
  const esc = host.esc;
87
90
  const C = { t: null, th: null, conv: null, timer: null, show: 12, plOpen: false, plAll: false, open: new Set(), seq: 0, sending: false, files: [], seenAt: null, lastKey: null, picked: {}, pend: [], auto: { key: null, ctx: new Set(), rep: null, goal: null }, slashAt: 0 };
91
+ const CU = cardsUi({ pmGet: (u) => host.pmGet(u), pmPost: (u, b) => host.pmPost(u, b), toast: (t) => host.toast(t), redraw: () => draw(), runAction, routeOf, tellCards,
92
+ ws: () => (C.t && C.t.ws) || new URLSearchParams(location.search).get('ws') || '' });
93
+ window.addEventListener('pmos:action', (e) => CU.onAction(e.detail)); // a row the chat shows follows a press or a chat write elsewhere
88
94
  el.innerHTML = `<button type="button" class="hm-reopen" id="hmReopen" aria-label="Open the Viewer" title="Open the Viewer" hidden>${PANE}</button>`
89
95
  + '<div class="hm-chd" id="hmCh" hidden></div><div class="hm-sug" id="hmSug" hidden></div><div class="hm-plw" id="hmPl" hidden></div><div class="hm-log" id="hmLog" role="log" aria-live="polite"></div><div class="hm-foot" id="hmFoot"></div>';
90
96
  const log = el.querySelector('#hmLog'), foot = el.querySelector('#hmFoot'), reopen = el.querySelector('#hmReopen'), head = el.querySelector('#hmCh'), sug = el.querySelector('#hmSug'), pl = el.querySelector('#hmPl');
@@ -176,14 +182,15 @@ export function mountChat(el, host) {
176
182
  }
177
183
  const last = i === R.lastAgent;
178
184
  const asking = last && R.asking; // the message that asks before a change: no tools while the ask is open, and the name on its own line (AgChatAsk)
179
- const sr = splitSrc(it.text); // chief-of-staff C1: the answer's sources, drawn under it (pm/chat-src.js)
185
+ const cd = CU.split(it.text); // the pmos-card and pmos-pick blocks (pm/chat-cards.js): drawn under the words, live
186
+ const sr = splitSrc(cd.text); // chief-of-staff C1: the answer's sources, drawn under it (pm/chat-src.js)
180
187
  const g = splitGoal(sr.text), rp0 = splitReport(g.text), ak = splitAsk(splitChase(rp0.text).text), rp = { ...rp0, text: ak.text };
181
188
  const goal = C.th && C.th.goal, gl = it.mi === R.lastMsg && R.waiting && !!goal && goal.state === 'grilling';
182
189
  const go = GU.blockOpts(it.mi, g.block, gl); // home-goal.js: the newest plan, the method menu, the editor in place
183
190
  // a run that stopped: the divider sits where it finished, over Claude's last message, and the fix sits under it (canvas XcbOptions, Routine)
184
191
  const stopAt = R.stop && i === R.lastAgent;
185
192
  const av = last && isClaude(R.role) ? adlerAvHtml(asking || ak.block ? 'needs-you' : stopAt ? 'honest' : running() ? 'thinking' : 'handled') : avHtml(R.role);
186
- return (stopAt ? dividerHtml({ tone: R.stop.tone, text: R.stop.text }) : '') + `<div class="hm-a${asking ? ' ask' : ''}${last ? ' last' : ''}">${av}<div class="hm-ab"><p class="hm-who">${esc(R.role.name)} <span>${esc(hm(it.at))}</span></p>${rp.text ? verHtml(rp.text) : ''}${srcHtml(sr.src)}${goalBlockHtml(go.block, go)}${reportChipHtml(rp.block, it.mi)}${R.chips(it.mi)}`
193
+ return (stopAt ? dividerHtml({ tone: R.stop.tone, text: R.stop.text }) : '') + `<div class="hm-a${asking ? ' ask' : ''}${last ? ' last' : ''}">${av}<div class="hm-ab"><p class="hm-who">${esc(R.role.name)} <span>${esc(hm(it.at))}</span></p>${rp.text ? verHtml(rp.text) : ''}${CU.html(cd, 'm' + it.mi, { live: !((C.conv && C.conv.messages) || []).slice(it.mi + 1).some((x) => x.role === 'user') })}${srcHtml(sr.src)}${goalBlockHtml(go.block, go)}${reportChipHtml(rp.block, it.mi)}${R.chips(it.mi)}`
187
194
  + (asking ? '' : `<div class="hm-tools" role="group" aria-label="Message actions"><button type="button" data-hm-copy="${i}">Copy</button>${last && !running() && !(stopAt && R.stop.actions.length) ? `<button type="button" data-hm-retry>Retry</button>` : ''}<button type="button" data-hm-wi="${i}">Make it a task</button></div>`) + '</div></div>'
188
195
  + (stopAt && R.stop.actions.length ? `<div class="hm-fix" role="group" aria-label="What to do next">${R.stop.actions.map((a, k) => iconBtn({ icon: a.icon, label: a.label, attr: a.data, pri: k === 0 })).join('')}</div>` : '')
189
196
  + blockAskHtml(ak.block, it, R);
@@ -614,6 +621,7 @@ export function mountChat(el, host) {
614
621
  if (b.dataset.hmCpt && C.cpt) { if (b.dataset.hmCpt === 'ok') host.compact(sid()); else host.dismissCompact(sid(), C.cpt.pct); C.cpt = null; sug.hidden = true; put(sug, ''); return; }
615
622
  if (b.dataset.hmSug && C.sug) { const g = C.sug; if (b.dataset.hmSug === 'link') host.linkTo(C.t.sid, g.id); else { host.dismissLink(C.t.sid); drawSug(); } return; }
616
623
  const d = b.dataset;
624
+ if (CU.owns(b)) { await CU.press(b); return; } // a row's button, a picker's choice, its ✓ or Undo (pm/chat-cards.js); any other button stays synchronous
617
625
  const ic = b.closest('.hm-icard'), card = C.t && C.t.intro && C.t.intro.card;
618
626
  if (ic && card && card.press) { if (await card.press(b)) draw(); return; }
619
627
  if ('hmMic' in d) { mic(); return; }
@@ -149,7 +149,7 @@
149
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
150
  .pm-ds .pm-layout-side{grid-template-columns:minmax(0,1fr) var(--width-side)}
151
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)}
152
+ .pm-ds .pm-layout-open{grid-template-columns:minmax(0,1fr);align-content:start}
153
153
  .pm-ds .pm-layout-open:has(>.pm-item){grid-template-columns:minmax(0,1fr) var(--width-item)}
154
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
155
  .pm-ds .pm-layout-popup{box-shadow:var(--lift);padding:var(--space-24) var(--space-32)}
@@ -9,8 +9,10 @@
9
9
  * copyModel(link, text) · readModel(answer) the pure models (premium-vw-copy.test.js) */
10
10
  import { vwOpen, vwStyle } from './premium-viewer.js';
11
11
  import { pmGet, pmPost } from './http.js';
12
- import { mdHtml, copyKindOf } from './premium-doc-edit.js';
13
- import * as SB from './state-blocks.js'; // the empty, loading and error states every block has (Komorebi State)
12
+ import { copyKindOf } from './premium-doc-edit.js';
13
+ import * as SB from './state-blocks.js';
14
+ import { readMinutes } from './premium-vw-doc-model.js';
15
+ import { readingPageHtml, wireReading } from './reading-view.js'; // the copy's text reads in the Reading layout (reading-layouts, A334) // the empty, loading and error states every block has (Komorebi State)
14
16
 
15
17
  const TOOL = { google: 'Google Docs', confluence: 'Confluence', 'google-slides': 'Google Slides', 'google-sheets': 'Google Sheets' };
16
18
  const COPY = { google: 'the Google Doc', confluence: 'the Confluence page', 'google-slides': 'the slides', 'google-sheets': 'the sheet' };
@@ -53,12 +55,16 @@ export function readModel(a, now) {
53
55
 
54
56
  const ICON = (k) => `<span class="cpv-lg" aria-hidden="true">${k === 'confluence' ? 'C' : 'G'}</span>`;
55
57
  const ext = (url, tool) => (url ? `<a class="dmcta alt" href="${esc(url)}" target="_blank" rel="noopener noreferrer">Open in ${esc(tool)}</a>` : '');
56
- const page = (text, dim) => { const m = mdHtml(text); return `<div class="cpv-page dsbody${dim ? ' dim' : ''}">${m.html}</div>`; };
58
+ /* The text in the Reading layout (reading-layouts, A334): the status, the why and the buttons sit above the title in the reading column; a
59
+ * dimmed PMOS version dims the text only, never the buttons. */
60
+ const page = (text, dim, o) => `<div class="cpv-page cpv-rd vwdoc rdw pm-reads${dim ? ' dim' : ''}">` + readingPageHtml(text, {
61
+ path: 'copy:' + o.key, title: o.title, above: `<div class="cpv">${o.top}</div>`,
62
+ meta: () => `<p class="rd-meta cfby">${esc(o.tool)} · ${readMinutes(text)} min read</p>` }) + '</div>';
57
63
 
58
64
  /** Open one page in the viewer. With `path`, it is a copy linked to that PMOS file; without, a page PMOS only has the address of. */
59
65
  export function openCopy(o) {
60
66
  if (!o || !o.url) return null;
61
- vwStyle('copy');
67
+ vwStyle('doc'); vwStyle('copy');
62
68
  const kind = o.kind || copyKindOf(o.url) || 'google';
63
69
  const id = 'copy:' + (o.path ? o.path + '|' + kind : o.url);
64
70
  const S = { o: { ...o, kind }, model: null, read: null, err: '', wait: null, poll: null, busy: false };
@@ -66,7 +72,7 @@ export function openCopy(o) {
66
72
  let pane = null;
67
73
  const tok = String(Date.now()) + Math.random();
68
74
  const live = () => !!(pane && pane.isConnected && pane.dataset.cpTok === tok);
69
- const draw = () => { if (live()) pane.innerHTML = html(); };
75
+ const draw = () => { if (live()) { pane.innerHTML = html(); wireReading(pane, pane, 'copy:' + id); } };
70
76
  function html() {
71
77
  const tool = TOOL[kind] || 'the tool', t = esc(o.title || S.model && S.model.title || tool);
72
78
  if (S.err) return `<div class="cpv"><div class="cpv-bar">${ICON(kind)}<div><b>${t}</b><small>${esc(tool)}</small></div></div><p class="note">${esc(S.err)}</p><div class="cpv-acts">${ext(o.url, tool)}</div></div>`;
@@ -74,16 +80,17 @@ export function openCopy(o) {
74
80
  const m = S.model; if (!m) return `<div class="cpv"><p class="note">Reading the copy and the PMOS file.</p></div>`;
75
81
  const acts = S.wait ? `<button type="button" class="dmcta alt" data-cp="undo">Undo</button><span class="note">Using the version in ${esc(TOOL[kind])} in five seconds.</span>`
76
82
  : `${m.use && !m.syncing ? `<button type="button" class="dmcta" data-cp="use">Use the ${esc(TOOL[kind])} version</button>` : ''}<button type="button" class="dmcta alt" data-cp="check"${S.busy ? ' disabled' : ''}>${S.busy ? 'Checking' : 'Check again'}</button>${ext(m.url || o.url, m.tool)}`;
77
- return `<div class="cpv"><div class="cpv-bar ${m.tone}">${ICON(kind)}<div><b>${esc(m.head)}</b><small>${esc(m.meta)}</small></div><span class="chp ${m.tone}"><i></i>${esc(m.syncing ? 'Updating' : m.chip)}</span></div>`
78
- + `<p class="note cpv-why">${esc(m.syncing ? 'A session is writing the copy\'s text into the PMOS file.' : m.why)} File: <code>${esc(o.path)}</code></p><div class="cpv-acts">${acts}</div>`
79
- + (m.text == null ? '<p class="note">The PMOS file could not be read.</p>' : page(m.text, m.dim)) + '</div>';
83
+ const top = `<div class="cpv-bar ${m.tone}">${ICON(kind)}<div><b>${esc(m.head)}</b><small>${esc(m.meta)}</small></div><span class="chp ${m.tone}"><i></i>${esc(m.syncing ? 'Updating' : m.chip)}</span></div>`
84
+ + `<p class="note cpv-why">${esc(m.syncing ? 'A session is writing the copy\'s text into the PMOS file.' : m.why)} File: <code>${esc(o.path)}</code></p><div class="cpv-acts">${acts}</div>`;
85
+ return m.text == null ? `<div class="cpv">${top}<p class="note">The PMOS file could not be read.</p></div>` : page(m.text, m.dim, { key: id, title: o.title || m.title, tool: m.tool, top });
80
86
  }
81
87
  const r = S.read || { state: 'loading' }, where = o.where ? ' · ' + esc(o.where) : '';
82
88
  if (r.state === 'loading') return `<div class="cpv"><p class="note">Reading what PMOS holds for this page.</p></div>`;
83
89
  if (r.state === 'read') {
84
- return `<div class="cpv"><div class="cpv-bar">${ICON(kind)}<div><b>Read ${esc(r.at)} by ${esc(r.by)}</b><small>${esc(tool)}${r.revision ? ' · revision ' + esc(r.revision) : ''} · view only${where}</small></div><span class="chp"><i></i>Read</span></div>`
90
+ const top = `<div class="cpv-bar">${ICON(kind)}<div><b>Read ${esc(r.at)} by ${esc(r.by)}</b><small>${esc(tool)}${r.revision ? ' · revision ' + esc(r.revision) : ''} · view only${where}</small></div><span class="chp"><i></i>Read</span></div>`
85
91
  + `<p class="note cpv-why">This is the text as it was when it was read. Edits made in ${esc(tool)} after that show after you read it again.</p>`
86
- + `<div class="cpv-acts"><button type="button" class="dmcta alt" data-cp="read"${S.busy ? ' disabled' : ''}>Read again</button>${ext(o.url, tool)}</div>${page(r.text, false)}</div>`;
92
+ + `<div class="cpv-acts"><button type="button" class="dmcta alt" data-cp="read"${S.busy ? ' disabled' : ''}>Read again</button>${ext(o.url, tool)}</div>`;
93
+ return page(r.text, false, { key: id, title: r.title || o.title || tool, tool, top });
87
94
  }
88
95
  const head = `<div class="cpv-bar">${ICON(kind)}<div><b>${t}</b><small>${esc(tool)}${where}</small></div><span class="chp"><i></i>${r.state === 'reading' ? 'Reading' : 'Link only'}</span></div>`;
89
96
  if (r.state === 'reading') return `<div class="cpv">${head}<p class="note">A session is reading the page with your ${esc(tool)} connector${r.since ? ' (started ' + esc(r.since) + ')' : ''}. The text shows here when it is done.</p><div class="cpv-acts">${ext(o.url, tool)}</div></div>`;
@@ -16,8 +16,15 @@
16
16
  .cpv-acts .dmcta{border-radius:var(--radius-sm);text-decoration:none}
17
17
  .cpv-page{padding:18px 22px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid)}
18
18
  .cpv-page.dim{opacity:.62}
19
+ /* The text in the Reading layout (reading-layouts, A334): no card of its own; the status and buttons sit in the reading column, and a dimmed
20
+ PMOS version dims the words only. */
21
+ .cpv-page.cpv-rd{padding:0;border:0;background:none}
22
+ .cpv-page.cpv-rd.dim{opacity:1}
23
+ .cpv-page.cpv-rd.dim .rd-hd,.cpv-page.cpv-rd.dim .rd-doc{opacity:.62}
24
+ .cpv-rd .cpv{max-width:none}
19
25
  @media (max-width:700px){
20
26
  .cpv-bar{flex-wrap:wrap}
21
27
  .cpv-acts .dmcta{min-height:44px}
22
28
  .cpv-page{padding:14px}
29
+ .cpv-page.cpv-rd{padding:0}
23
30
  }
@@ -318,8 +318,20 @@ iframe.vwprint{position:fixed;right:0;bottom:0;width:1px;height:1px;border:0;opa
318
318
  .rd-cm p{margin:0}
319
319
  .rd-q{color:var(--muted)}
320
320
  @media (max-width: 720px){ .rd-sb{padding-left:0} .rd-short{padding:var(--space-12) var(--space-16)} }
321
+ /* A reader in a panel follows its own width, not the window's: the host (.pm-reads) is the container. Contents goes under 900 px, the margin
322
+ under 640 px. The window rules of pm-layout-reading (komorebi.css) still hold. */
323
+ .pm-reads{container:reading/inline-size}
324
+ @container reading (max-width: 900px){
325
+ .pm-ds .pm-layout-reading.rd{grid-template:"head head" auto "main margin" 1fr/minmax(0,var(--doc-measure)) var(--width-margin)}
326
+ .pm-ds .pm-layout-reading.rd:not(:has(>.pm-margin)){grid-template:"head" auto "main" 1fr/minmax(0,var(--doc-measure))}
327
+ .pm-ds .pm-layout-reading.rd>.pm-contents{display:none}
328
+ }
329
+ @container reading (max-width: 640px){
330
+ .pm-ds .pm-layout-reading.rd>.pm-margin{display:none}
331
+ .pm-ds .pm-layout-reading.rd,.pm-ds .pm-layout-reading.rd:not(:has(>.pm-margin)){grid-template:"head" auto "main" 1fr/minmax(0,1fr)}
332
+ }
321
333
  /* A page with no Contents (one section or none) gives its column back: the column stays at the reading measure, centred. */
322
- @media (min-width: 1101px){
334
+ @container reading (min-width: 901px){
323
335
  .pm-ds .pm-layout-reading.rd:not(:has(>.pm-contents)){grid-template:"head head" auto "main margin" 1fr/minmax(0,var(--doc-measure)) var(--width-margin)}
324
336
  .pm-ds .pm-layout-reading.rd:not(:has(>.pm-contents)):not(:has(>.pm-margin)){grid-template:"head" auto "main" 1fr/minmax(0,var(--doc-measure))}
325
337
  }
@@ -327,7 +327,7 @@ function makePage(d, ctx) {
327
327
  if (!el || !el.isConnected) return;
328
328
  const keepScroll = el.scrollTop;
329
329
  const reading = P.mode === 'read' && !ctx.host && P.text != null && !P.err && !openProp();
330
- el.innerHTML = `<div class="vwdoc${reading ? ' rdw' : ''}">${pageHtml()}</div>`;
330
+ el.innerHTML = `<div class="vwdoc${reading ? ' rdw pm-reads' : ''}">${pageHtml()}</div>`;
331
331
  el.scrollTop = keepScroll;
332
332
  if (reading) wireReading(el, el, d.path); else if (P.mode === 'read') tocOf();
333
333
  if (P.mode === 'edit') startEdit();
@@ -8,7 +8,7 @@
8
8
  * A share icon beside it opens the share popover (premium-vw-share.js: Send a copy on a phone, a public link with a password and an end date, open links).
9
9
  * openChatFile(path, { session, ws }) -> the tab's pane */
10
10
  import { vwOpen, vwStyle } from './premium-viewer.js';
11
- import { bodyHtml, pageHead, splitDoc, readMinutes } from './premium-vw-doc-model.js';
11
+ import { pageHead, readMinutes } from './premium-vw-doc-model.js';
12
12
  import { needsReader, drawPdf } from './premium-vw-pdf.js';
13
13
  import { readingPageHtml, wireReading } from './reading-view.js'; // a markdown file reads in the Reading layout (reading-layouts)
14
14
 
@@ -61,14 +61,26 @@ export function pageSrc(f, print = false) {
61
61
  if (isHtml(f)) return framedSrc(String(f.text || '') + go);
62
62
  const title = f.kind === 'markdown' ? pageHead(f.text).title || f.name : f.name;
63
63
  let body;
64
- if (f.kind === 'markdown') {
65
- const h = pageHead(f.text), sd = splitDoc(f.text);
66
- body = `<h1>${esc(title)}</h1>` + bodyHtml([sd.pre, ...sd.sections.map((x, n) => (n === 0 && h.h1 ? x.body : x.head + '\n' + x.body))].join('\n')).html;
67
- } else body = `<h1>${esc(title)}</h1><pre>${esc(f.text)}</pre>`;
68
- // a plain document: the browser's own heading sizes and black on white, no app colours (the frame cannot load the app's stylesheets)
69
- const css = ':root{color-scheme:light}body{font:16px/1.6 -apple-system,"Segoe UI",system-ui,sans-serif;max-width:720px;margin:32px auto;padding:0 24px}'
64
+ // A markdown file is drawn in the Reading layout (reading-layouts, A334): the title, In short, a section per heading that folds, and
65
+ // Contents at the left on a wide screen. A shared link and a printed page are the same page: no comments, no chat, nothing that runs.
66
+ if (f.kind === 'markdown') body = readingPageHtml(f.text, { title: pageHead(f.text).title || f.name });
67
+ else body = `<h1>${esc(title)}</h1><pre>${esc(f.text)}</pre>`;
68
+ // a plain document: the browser's own colours, black on white, no app colours (the frame cannot load the app's stylesheets)
69
+ const css = ':root{color-scheme:light}body{font:16px/1.6 -apple-system,"Segoe UI",system-ui,sans-serif;max-width:1000px;margin:32px auto;padding:0 24px}'
70
70
  + 'table{border-collapse:collapse;width:100%}th,td{border:1px solid;padding:5px 9px;text-align:left;vertical-align:top}'
71
- + 'pre,code{font:14px ui-monospace,Menlo,monospace;white-space:pre-wrap}img{max-width:100%}@page{margin:18mm}';
71
+ + 'pre,code{font:14px ui-monospace,Menlo,monospace;white-space:pre-wrap}img{max-width:100%}@page{margin:18mm}'
72
+ + '.pm-layout-reading{display:grid;grid-template-columns:180px minmax(0,640px);gap:24px 40px;justify-content:center;align-items:start}'
73
+ + '.pm-layout-reading:not(:has(>.pm-contents)){grid-template-columns:minmax(0,640px)}'
74
+ + '.pm-contents{position:sticky;top:24px;display:flex;flex-direction:column;gap:6px;line-height:1.4}'
75
+ + '.pm-contents a{color:inherit;opacity:.7;text-decoration:none}.pm-contents a:hover{opacity:1}'
76
+ + '.rd-lab{margin:0 0 4px;letter-spacing:.06em;text-transform:uppercase;opacity:.65}'
77
+ + '.rd-t{margin:0 0 16px;line-height:1.2}.rd-hd{margin:0 0 8px}'
78
+ + '.rd-short{margin:0 0 16px;padding:16px 24px;border-radius:12px;background:rgba(0,0,0,.05)}.rd-short p:last-child{margin-bottom:0}'
79
+ + '.rd-sec{border-bottom:1px solid rgba(0,0,0,.12)}.rd-sec>summary{display:flex;align-items:center;gap:8px;padding:12px 0;cursor:pointer;list-style:none}'
80
+ + '.rd-sec>summary::-webkit-details-marker{display:none}.rd-sec>summary::before{content:"\\203A";width:16px;opacity:.6}'
81
+ + '.rd-sec[open]>summary::before{transform:rotate(90deg)}.rd-sec>summary h2{margin:0}.rd-sb{padding:0 0 16px 24px}'
82
+ + '@media (max-width:900px){.pm-layout-reading{grid-template-columns:minmax(0,1fr)}.pm-contents{display:none}.rd-sb{padding-left:0}}'
83
+ + '@media print{.pm-layout-reading{display:block}.pm-contents{display:none}.rd-sec>summary::before{content:none}.rd-sb{padding-left:0}}';
72
84
  return framedSrc(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${esc(String(title || 'Document').replace(/\.[A-Za-z0-9]+$/, ''))}</title><style>${css}</style></head><body>${body}${go}</body></html>`);
73
85
  }
74
86
  /** The page a PDF is printed from, as the srcdoc of a sandboxed frame. Pure. */
@@ -111,7 +123,7 @@ export function fileHtml(f, view = 'page') {
111
123
  if (f.kind === 'markdown') {
112
124
  // the Reading layout (reading-layouts, A334): a text file reads like every document; Download and Share sit in the head row
113
125
  const h = pageHead(f.text);
114
- return `<div class="vwdoc rdw">` + readingPageHtml(f.text, {
126
+ return `<div class="vwdoc rdw pm-reads">` + readingPageHtml(f.text, {
115
127
  path: 'file:' + (f.abs || f.rel || f.path), title: h.title || f.name, head: `<span class="gap"></span>${actsHtml(f)}`,
116
128
  meta: () => `<p class="rd-meta cfby">Read-only · ${readMinutes(f.text)} min read</p>`,
117
129
  extraHead: h.labels.length ? `<div class="cflb">${h.labels.map((l) => `<span>${esc(l)}</span>`).join('')}</div>` : '',
@@ -39,11 +39,12 @@
39
39
  .gd-railon .gd-rail{display:flex;position:absolute;z-index:3;top:64px;left:0;right:0;width:auto;max-height:70vh;padding:var(--space-12);border:1px solid var(--hair);border-radius:14px;background:var(--card-solid);box-shadow:var(--card-shadow)}
40
40
  }
41
41
  /* The Reading layout (reading-layouts, A334): the page reads like every document; the page rail opens over it from the list icon at every
42
- width, and the section chips stand in for Contents where Contents is hidden (under 1100 px). */
42
+ width, and the section chips stand in for Contents where Contents is hidden (the reader under 900 px, or the window under 1100 px). */
43
43
  .gd-railable{display:block}
44
44
  .gd-railable .gd-tog{display:flex}
45
45
  .gd-railable>.gd-rail{display:none}
46
46
  .gd-railable.gd-railon>.gd-rail{display:flex;position:absolute;z-index:3;top:var(--space-48);left:0;width:var(--width-margin);max-height:70vh;padding:var(--space-12);border:1px solid var(--line);border-radius:var(--radius-card);background:var(--card);box-shadow:var(--lift)}
47
47
  .gd .gd-secs{display:none}
48
48
  @media (max-width: 1100px){ .gd .gd-secs{display:flex} }
49
+ @container reading (max-width: 900px){ .gd .gd-secs{display:flex} }
49
50
  @media (max-width: 720px){ .gd-railable.gd-railon>.gd-rail{right:0;width:auto} }
@@ -67,7 +67,7 @@ export function guideHtml(name, text, groups = TOC, folded = []) {
67
67
  const more = R.contents.length > CHIPS ? `<button type="button" class="gd-chip gd-more" data-gd-more>${R.contents.length - CHIPS} more</button>` : '';
68
68
  const chips = R.contents.length > 1 ? `<div class="gd-secs" role="group" aria-label="On this page">${R.contents.map(chip).join('')}${more}</div>` : '';
69
69
  const home = name === 'index' ? '' : '<span class="gap"></span><a href="#guide:index">Start here</a>';
70
- return `<div class="vwdoc gd rdw"><div class="gd-wrap gd-railable">${railHtml(name, groups || [], folded)}`
70
+ return `<div class="vwdoc gd rdw pm-reads"><div class="gd-wrap gd-railable">${railHtml(name, groups || [], folded)}`
71
71
  + readingPageHtml(t, {
72
72
  path: 'guide:' + name, title: h.title || name, empty: 'This page has no text yet.',
73
73
  head: `<div class="vwacts gd-tog"><button type="button" class="vwib" data-gd-toc aria-label="Guide pages" title="Guide pages" aria-expanded="false">${TOC_ICON}</button></div><span class="gap"></span>`,
@@ -1,7 +1,7 @@
1
1
  /* premium-vw-notepad.css — Notes in the premium viewer (premium-notes.js; initiative premium-chat-attach N1-N7). Loaded once by vwStyle('notepad').
2
2
  * Sizes are the console's six steps only (var(--fs-1..6)), weights 400/500/600, the page's own tokens otherwise. Checked by premium-console-type.test.js. */
3
3
  .p-out>.obody.vw:not([hidden]):has(>.ntpad){flex:1;min-height:0;display:flex!important;flex-direction:column} /* the notepad fills the pane: the note scrolls, its foot stays */
4
- .ntpad{flex:1;min-height:0;width:100%;display:flex;flex-direction:column;max-width:780px;margin:0 auto;position:relative}
4
+ .ntpad{flex:1;min-height:0;width:100%;display:flex;flex-direction:column;max-width:var(--doc-measure,640px);margin:0 auto;position:relative} /* the Reading column (reading-layouts, A334): a note is typed into, so it takes the reading measure but no folds or Contents */
5
5
  .nth{display:flex;align-items:center;gap:var(--space-8);padding:2px 0 10px;border-bottom:1px solid var(--hair)}
6
6
  .nth .gap{flex:1}
7
7
  .ntsw{display:inline-flex;align-items:center;gap:var(--space-4);min-width:0;max-width:60%;min-height:34px;padding:0 6px;margin-left:-6px;border:0;border-radius:var(--radius-sm);background:none;color:var(--ink);font:var(--fw-strong) var(--fs-row)/var(--lh-row) var(--sans);cursor:pointer}
@@ -9,14 +9,17 @@
9
9
  * or the reason with Try again. keep(text) → true | false saves it the row's own way (with its Undo); done() after ✓ or ✕.
10
10
  * pendingHtml(what) · readyHtml(text, what) · failedHtml(why) the three looks PURE
11
11
  *
12
+ * Every ✦ draft and every press of its ✓ or ✕ writes one card-list line to the local use log (pm/card-log.js).
12
13
  * Nothing is kept until ✓: the draft is for the PM to read (the words of every draft ask say so). */
13
14
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
14
15
  const SVG = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
15
16
  const OK = 'M5 12.5l4.5 4.5L19 7.5', NO = 'M6 6l12 12M18 6L6 18', AGAIN = 'M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8M3 3v5h5';
17
+ import { tellCards } from './card-log.js'; // every ✦ draft and its ✓ ✕ to the local use log (card catalog rule 9, A511)
16
18
  const wait = (ms) => new Promise((r) => setTimeout(r, ms));
17
19
 
18
20
  export async function run(ask, { ws, pmPost, pmGet, again = false, every = 2500, upto = 200000 } = {}) {
19
21
  if (!pmPost || !pmGet) return { ok: false, why: 'No way to reach PMOS from here.' };
22
+ tellCards({ kinds: ['draft'], pressed: ['✦ Draft'] });
20
23
  let r = await pmPost('/api/star-drafts', { ws, ask, again }).catch(() => null);
21
24
  if (!r || r.ok === false) return { ok: false, why: (r && r.error) || 'PMOS could not start the draft.' };
22
25
  const t0 = Date.now();
@@ -52,6 +55,7 @@ export function mount(el, o = {}) {
52
55
  if (!b || !el.contains(b)) return;
53
56
  e.preventDefault(); e.stopPropagation();
54
57
  if ('sdAgain' in b.dataset) { go(true); return; }
58
+ tellCards({ kinds: ['draft'], rendered: 1, pressed: ['sdDrop' in b.dataset ? 'Not this one' : 'Keep'] });
55
59
  if ('sdDrop' in b.dataset) { el.innerHTML = ''; if (o.done) o.done(false); return; }
56
60
  b.disabled = true;
57
61
  const ok = o.keep ? await o.keep(text) : false;
@@ -6,6 +6,7 @@
6
6
  * controlOf(el) PURE: the name a pressed element is logged under, or '' to log nothing
7
7
  * deviceOf(width) PURE: phone (≤ 760 px), tablet (≤ 1100 px) or desk
8
8
  * noteUse(control) note one use a page names itself (pm/action-keys.js counts its key presses as key-<action> or key-miss)
9
+ * it also notes window event pmos:cards (pm/card-log.js): a chat answer's card list or a ✦ press, as one line of kind "cards"
9
10
  *
10
11
  * HIDE THE BUTTONS NOBODY PRESSES (idea A454; the rule and the store are lib/unused-controls.js). startUseLog also:
11
12
  * at load hides this page's hidden buttons (GET /api/use-log/hidden, one style rule per id, so a button drawn later is hidden too);
@@ -76,6 +77,8 @@ export function startUseLog(doc = typeof document !== 'undefined' ? document : n
76
77
  const control = controlOf(el);
77
78
  if (control) note({ kind: 'use', control });
78
79
  }, { capture: true, passive: true });
80
+ // a chat answer's card list and every ✦ press (pm/card-log.js, card catalog rule 9): one line of kind "cards", kinds, ids and labels only
81
+ if (doc.defaultView) doc.defaultView.addEventListener('pmos:cards', (e) => { if (e && e.detail) note({ kind: 'cards', cards: e.detail }); });
79
82
  setInterval(() => flush(false), FLUSH_MS);
80
83
  const hide = () => flush(true);
81
84
  try { window.addEventListener('pagehide', hide); doc.addEventListener('visibilitychange', () => { if (doc.visibilityState === 'hidden') hide(); }); } catch { /* no window */ }
@@ -35,7 +35,7 @@
35
35
  <body class="cz bd-page pm-ds">
36
36
  <!-- The Board has no dialog, dock, toast or hero of the old shell: pm/premium-shell.js binds to a detached copy when #dlg is absent. Its panels
37
37
  are the side panel below (initiative premium-agreed-design). -->
38
- <main class="stage cz-panel bd-main" id="stage">
38
+ <main class="stage cz-panel bd-main pm-layout-open" id="stage">
39
39
  <h1 class="vh">Work</h1>
40
40
  <!-- the toolbar: seven controls (UI grill U2, 8 Nov), the same on a phone and a desktop: the product picker, the View chip (the four views; in
41
41
  it the span and the Columns of the timeline, and Shared with me), the pill of what needs a look with its (i) (the legend, the sprints and
@@ -25,7 +25,7 @@
25
25
  (group heads, folds, the meaning passages). The open item: a Detail block (pm-field). The chips and their menus are the shared picker
26
26
  (pm/cozy-pick.css), the same as the product, program and project chip. -->
27
27
  <body class="cz pm-ds lb-page">
28
- <main class="stage cz-panel lb" id="stage">
28
+ <main class="stage cz-panel lb pm-layout-open" id="stage">
29
29
  <h1 class="vh">Library</h1>
30
30
  <div class="lb-bar">
31
31
  <nav class="pm-path" aria-label="Path"><b>Library</b></nav>
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "ask-cards-and-pickers (job #1747, A497): chat answers draw the named rows live with the card catalog's buttons, and a picker that runs one catalog command with Undo. The real task writer and board routes in process, GET /api/card-rows in process, and the pure page modules chat-cards.js and action-run.js. No browser.",
3
+ "modules": [
4
+ "ask-cards.test.js"
5
+ ],
6
+ "seconds": {
7
+ "ask-cards.test.js": 3
8
+ }
9
+ }