create-pmos 0.396.0 → 0.397.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 (98) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/scripts/nine-stages.js +49 -20
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +20 -40
  8. package/workspace/briefing-premium-board-test.js +145 -107
  9. package/workspace/briefing-premium-calendar-2-test.js +5 -2
  10. package/workspace/briefing-premium-calendar-3-test.js +13 -8
  11. package/workspace/briefing-premium-calendar-test.js +16 -5
  12. package/workspace/briefing-premium-initiative-test.js +50 -41
  13. package/workspace/briefing-premium-insights-test.js +104 -85
  14. package/workspace/briefing-premium-metrics-test.js +11 -32
  15. package/workspace/briefing-premium-sources-test.js +42 -21
  16. package/workspace/briefing-premium-test.js +112 -98
  17. package/workspace/briefing-premium-work-test.js +78 -64
  18. package/workspace/changelog.json +12 -0
  19. package/workspace/fixtures/board-premium-facts.js +2 -1
  20. package/workspace/fixtures/board-premium-jira.js +28 -0
  21. package/workspace/fixtures/initiative-premium-facts.js +2 -1
  22. package/workspace/fixtures/initiatives-api/list.json +30 -42
  23. package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
  24. package/workspace/fixtures/initiatives-api/sheet.json +10 -14
  25. package/workspace/fixtures/insights-premium-facts.js +11 -2
  26. package/workspace/guide/index.md +1 -0
  27. package/workspace/guide/lifecycle.md +51 -0
  28. package/workspace/home-shot.js +38 -0
  29. package/workspace/lib/board-premium.js +92 -1
  30. package/workspace/lib/engine/boards.js +15 -14
  31. package/workspace/lib/engine/nine-stages.js +49 -20
  32. package/workspace/lib/engine/signals/detectors.js +13 -11
  33. package/workspace/lib/insights-premium.js +78 -1
  34. package/workspace/lib/routes-board-premium.js +3 -2
  35. package/workspace/lib/routes-initiatives.js +1 -1
  36. package/workspace/lib/routes-insights-premium.js +8 -1
  37. package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
  38. package/workspace/package-lock.json +2 -2
  39. package/workspace/package.json +1 -1
  40. package/workspace/premium-agreed-viewer-shots.js +76 -0
  41. package/workspace/premium-board-actions-test.js +2 -0
  42. package/workspace/premium-chat-chart-tab-test.js +6 -5
  43. package/workspace/premium-chat-context-test.js +8 -6
  44. package/workspace/premium-chat-goal-view-test.js +9 -7
  45. package/workspace/premium-chat-notes-test.js +3 -2
  46. package/workspace/premium-chat-report-tab-test.js +8 -2
  47. package/workspace/premium-chat-term-test.js +3 -1
  48. package/workspace/premium-chat-viewer-test.js +23 -17
  49. package/workspace/premium-core-doc-issue-test.js +2 -0
  50. package/workspace/premium-html-viewer-test.js +4 -2
  51. package/workspace/premium-phone-card-test.js +1 -0
  52. package/workspace/premium-phone-room-test.js +16 -11
  53. package/workspace/premium-report-read-test.js +1 -1
  54. package/workspace/premium-vw-backlog-test.js +2 -0
  55. package/workspace/premium-vw-cal-test.js +9 -4
  56. package/workspace/premium-vw-doc-test.js +1 -1
  57. package/workspace/premium-vw-item-test.js +1 -0
  58. package/workspace/premium-vw-jira-test.js +4 -1
  59. package/workspace/premium-vw-notes-test.js +2 -1
  60. package/workspace/premium-vw-rec-test.js +3 -2
  61. package/workspace/premium-vw-slides-test.js +2 -2
  62. package/workspace/premium-work-depth-test.js +7 -3
  63. package/workspace/public/pm/bd-span.js +120 -0
  64. package/workspace/public/pm/bd-stages.js +33 -0
  65. package/workspace/public/pm/cozy-board.css +373 -0
  66. package/workspace/public/pm/cozy-home.css +152 -0
  67. package/workspace/public/pm/cozy-home.js +170 -0
  68. package/workspace/public/pm/cozy-initiative.css +138 -0
  69. package/workspace/public/pm/cozy-insights.css +292 -0
  70. package/workspace/public/pm/cozy-nav.js +54 -0
  71. package/workspace/public/pm/cozy-viewer.css +143 -0
  72. package/workspace/public/pm/cozy.css +172 -0
  73. package/workspace/public/pm/lifecycle-lens-model.js +45 -27
  74. package/workspace/public/pm/lifecycle-lens.js +22 -11
  75. package/workspace/public/pm/premium-board.js +329 -67
  76. package/workspace/public/pm/premium-brief.js +1 -1
  77. package/workspace/public/pm/premium-chat.js +17 -10
  78. package/workspace/public/pm/premium-initiative-head.js +138 -0
  79. package/workspace/public/pm/premium-initiative.js +28 -4
  80. package/workspace/public/pm/premium-insights.js +530 -244
  81. package/workspace/public/pm/premium-shell.js +40 -10
  82. package/workspace/public/pm/premium-viewer.js +5 -0
  83. package/workspace/public/pm/premium-vw-jira-model.js +22 -5
  84. package/workspace/public/pm/premium-vw-jira.css +11 -0
  85. package/workspace/public/pm/premium-vw-jira.js +11 -4
  86. package/workspace/public/pm/premium-vw-rec.js +5 -2
  87. package/workspace/public/pm/premium-work.js +18 -8
  88. package/workspace/public/pm/premium.js +19 -6
  89. package/workspace/public/premium-board.html +82 -47
  90. package/workspace/public/premium-chat.html +7 -33
  91. package/workspace/public/premium-initiative.html +15 -8
  92. package/workspace/public/premium-insights.html +82 -43
  93. package/workspace/public/premium-work.html +6 -72
  94. package/workspace/public/premium.html +61 -15
  95. package/workspace/public/vendor/nunito-var.woff2 +0 -0
  96. package/workspace/server.js +7 -0
  97. package/workspace/test-lists/premium-agreed-viewer.json +9 -0
  98. package/workspace/third-party/README.md +1 -0
@@ -59,7 +59,7 @@ export function needsRowOf(x, ws) {
59
59
  const when = r.kind === 'overdue' ? lateWord(Math.max(1, Number(r.days_late) || 1)) : r.kind === 'due-today' ? 'Due today' : r.offline ? 'Outside PMOS' : '';
60
60
  return { key: 'own:' + r.key, src: 'own', title: r.headline || '', subject: ['Yours', when, r.person ? 'with ' + r.person : ''].filter(Boolean).join(' · '),
61
61
  prepared: r.evidence && r.evidence.text ? 'Looks done: ' + r.evidence.text + '. Confirm it in My work.' : 'Open it in My work to mark it done, put it off or drop it.',
62
- go: r.id ? '/premium-work.html?' + [q('item', r.id), ws ? q('ws', ws) : ''].filter(Boolean).join('&') : null };
62
+ go: r.id ? '/premium.html?' + [q('item', r.id), ws ? q('ws', ws) : ''].filter(Boolean).join('&') : null };
63
63
  }
64
64
  if (x.src === 'agent') {
65
65
  const blocked = r.kind === 'driver-blocked', docs = r.kind === 'core-doc-drafts', ini = r.initiative_id || '';
@@ -1,15 +1,22 @@
1
- /* pm/premium-chat.js — the Chat page (initiative premium-chat-page). The rail's middle place: the session list, the conversation and the viewer
2
- * as a page of their own. ?about=<key>&label=<name> is the page the PM came from (the rail's Chat carries it); without it, the PM's own chat.
1
+ /* pm/premium-chat.js — the chat of Home (initiative premium-agreed-design, H2 and H3). It was the Chat page (initiative premium-chat-page);
2
+ * /premium-chat.html now opens Home with the same query, and this file opens the chat there.
3
+ * On a desktop the chat is docked beside Home's list, so it always opens: ?about=<key>&label=<name> is the conversation the PM came from, and
4
+ * without it, the PM's own chat (chat:main). On a phone the list is the page and the chat is a popup: it opens only when the address asks for it.
3
5
  * premium-reports-from-chat (slice C): ?open=report:<id> | chart:<id> | dashboard:<id> opens that one in its tab beside the chat, and ?say=<words>
4
- * puts a first message in the box for the PM to send. Insights links here for New, Edit and Shape it, now that the Insight Studio is removed. */
5
- import { wireRail, openChatPage, openBlockTab, growAsk } from './premium-shell.js';
6
+ * puts a first message in the box for the PM to send. Insights links here for New, Edit and Shape it. */
7
+ import { openChatPage, openBlockTab, growAsk, homeDock } from './premium-shell.js';
6
8
 
7
- wireRail('chat');
8
9
  const q = new URLSearchParams(location.search);
9
10
  // a conversation key as the ask route takes it (lib/briefing-premium-agent.js KEY_RE); anything else is the PM's own chat
10
- const about = /^(decision|blocked|waited|src|ev|work|board|init|doc|ins):[A-Za-z0-9][A-Za-z0-9._:-]{0,100}$/.test(q.get('about') || '') ? q.get('about') : null;
11
- openChatPage(about || 'chat:main', about ? (q.get('label') || '').slice(0, 80) : '');
11
+ // Board's and Insights' "Ask about this" / "Ask why" land here as ?ask=<initiative id> | board:<key> | insights | verdict, with the question in q
12
+ const ask = q.get('ask') || '';
13
+ const asked = !ask ? '' : /^board:/.test(ask) ? ask : /^(insights|verdict)$/.test(ask) ? 'ins:' + ask : 'init:' + ask;
14
+ const KEY = /^(decision|blocked|waited|src|ev|work|board|init|doc|ins):[A-Za-z0-9][A-Za-z0-9._:-]{0,100}$/;
15
+ const about = KEY.test(q.get('about') || '') ? q.get('about') : KEY.test(asked) ? asked : null;
12
16
  const open = /^(report|chart|dashboard):([A-Za-z0-9][A-Za-z0-9._:-]{0,119})$/.exec(q.get('open') || '');
13
- if (open) openBlockTab({ kind: open[1], id: open[2] });
14
- const say = (q.get('say') || '').slice(0, 500);
15
- if (say) { const inp = document.querySelector('#askIn'); if (inp) { inp.value = say; growAsk(); inp.focus(); inp.setSelectionRange(say.length, say.length); } }
17
+ const say = (q.get('say') || q.get('q') || '').slice(0, 500);
18
+ if (homeDock() || about || open || say) {
19
+ openChatPage(about || 'chat:main', about ? (q.get('label') || '').slice(0, 80) : '');
20
+ if (open) openBlockTab({ kind: open[1], id: open[2] });
21
+ if (say) { const inp = document.querySelector('#askIn'); if (inp) { inp.value = say; growAsk(); inp.focus(); inp.setSelectionRange(say.length, say.length); } }
22
+ }
@@ -0,0 +1,138 @@
1
+ /* pm/premium-initiative-head.js — the header card of the premium initiative page, after the Agreed design's "Inside one initiative" frames
2
+ * (initiative premium-agreed-design, requirement I1). Pure: headModel(M) reads the model GET /api/initiative-premium answers
3
+ * (lib/initiative-premium.js) and returns what the card draws; headHtml(h, o) returns its markup. A node test imports both.
4
+ *
5
+ * The card: who it waits on (Your turn, Agents working, Engineers on it, Stalled), the step "N of 8 · Stage", the ladder of the eight
6
+ * lifecycle steps with Deliver and Evaluate as milestones (◆), the previous step, the current one and the one it reaches next, what
7
+ * finishes the current step (done, you, agent, Jira, a person), the payoff line ("Then: ..."), the time in the stage, and one CTA.
8
+ *
9
+ * THE RULE (as lib/initiative-premium.js): every item comes from a field of a record. The workflow engine's checks give the done and
10
+ * waiting items; the board's Jira tickets give the build item ("N of M tickets Done in Jira"); the engineers build in Jira, so the card
11
+ * never names a PMOS builder agent, a pull request or CI as the build story. A time in the stage shows only when a record holds one;
12
+ * otherwise the line gives the planned finish, or says the time is not recorded. */
13
+
14
+ /** The lifecycle (PM, 2026-10-22). Deliver and Evaluate are milestones. */
15
+ export const STEPS = [
16
+ { key: 'triage', label: 'Triage', out: 'BRD' },
17
+ { key: 'discover', label: 'Discover', out: 'PRD' },
18
+ { key: 'plan', label: 'Plan', out: 'scope, timeline and WBS' },
19
+ { key: 'prioritize', label: 'Prioritize', out: 'a rank on the roadmap' },
20
+ { key: 'build', label: 'Build', out: 'features delivered in Jira' },
21
+ { key: 'deliver', label: 'Deliver', out: 'the release shipped', ms: true },
22
+ { key: 'monitor', label: 'Monitor', out: 'the outcome report' },
23
+ { key: 'evaluate', label: 'Evaluate', out: 'keep, iterate or stop', ms: true },
24
+ ];
25
+ /** The old keys map onto the eight: ideate counts for Discover, strategize for Prioritize (another builder migrates the model). */
26
+ const ALIAS = { ideate: 'discover', strategize: 'prioritize', strategise: 'prioritize', prioritise: 'prioritize', intake: 'triage', delivery: 'deliver', evaluation: 'evaluate' };
27
+ /** What reaching the next step gives, said once per step. */
28
+ const PAYOFF = {
29
+ triage: 'The BRD is agreed, and Discover writes the PRD.',
30
+ discover: 'The PRD is agreed, and Plan sets the scope, the timeline and the WBS.',
31
+ plan: 'Your Commit pushes the tickets to Jira, and the work is ranked on the roadmap.',
32
+ prioritize: 'Ranked on the roadmap, the engineers pick the tickets up in Jira.',
33
+ build: 'The features are delivered in Jira, and the release ships at Deliver.',
34
+ deliver: 'The release ships with your sign-off, and Monitor reads the outcome.',
35
+ monitor: 'The outcome report is written, and you decide at Evaluate.',
36
+ evaluate: 'You decide to keep it, iterate on it or stop it.',
37
+ };
38
+ const YOU_STEPS = /^(contract|review|accept|commit|signoff|sign-off)$/;
39
+ const STEP_SAY = { spec: 'PRD and rubric written', contract: 'Your go on the done criteria', review: 'Review of the findings', accept: 'Your sign-off', route: 'Lane chosen', commit: 'Your Commit' };
40
+ const CTA_SAY = { contract: 'Review the done criteria', review: 'Review the findings', accept: 'Give your sign-off', spec: 'Ask about the PRD', commit: 'Review the Commit' };
41
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
42
+ const cap1 = (s) => (s ? String(s).charAt(0).toUpperCase() + String(s).slice(1) : '');
43
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
44
+
45
+ /** A stage name of any board ("Build", "Ideate", "strategize") → one of the eight keys, or null. */
46
+ export function stageKey(name) {
47
+ const k = String(name || '').trim().toLowerCase().replace(/^◆\s*/, '');
48
+ if (STEPS.some((s) => s.key === k)) return k;
49
+ return ALIAS[k] || null;
50
+ }
51
+ const dayOf = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
52
+ const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
53
+
54
+ /** The card's model. M: the page model; now: ms. */
55
+ export function headModel(M, now = Date.now()) {
56
+ const m = M || {}, head = m.head || {}, acts = m.acts || {}, ov = m.overview || {};
57
+ const key = stageKey(head.stage || acts.stage), at = key ? STEPS.findIndex((s) => s.key === key) : -1;
58
+ const cur = at >= 0 ? STEPS[at] : null, next = at >= 0 ? STEPS[at + 1] || null : null, prev = at > 0 ? STEPS[at - 1] : null;
59
+ const items = [];
60
+ // the workflow engine's checks: done and waiting; Build and Quality are the engineers' (Jira below), so they are not listed as PMOS work
61
+ for (const c of m.checks || []) {
62
+ if (c.k === 'build' || c.k === 'quality') continue;
63
+ const say = STEP_SAY[c.k] || cap1(c.label);
64
+ if (c.state === 'done') items.push({ kind: 'done', label: say });
65
+ else if (c.state === 'blocked') items.push({ kind: 'risk', label: say + ' is blocked', note: c.owed || '' });
66
+ else if (c.state === 'pending' || c.state === 'current') items.push({ kind: YOU_STEPS.test(c.k) ? 'you' : 'agent', label: say, note: c.owed || '' });
67
+ }
68
+ // the build story is Jira's: the board's tickets for this initiative
69
+ const jira = ((m.tasks && m.tasks.rows) || []).filter((t) => /^Jira/.test(t.src || ''));
70
+ if (jira.length) {
71
+ const d = jira.filter((t) => t.state === 'Done').length;
72
+ items.push({ kind: d === jira.length ? 'done' : 'jira', label: d + ' of ' + plural(jira.length, 'ticket', 'tickets') + ' Done in Jira' });
73
+ }
74
+ // the waiting record says who; a step that waits on the PM and is not in the list yet is added
75
+ const youWait = ov.who === 'Waits on you';
76
+ const step = String(ov.h || '').replace(/^Next: /, '');
77
+ if (youWait && step && !items.some((x) => x.kind === 'you')) items.push({ kind: 'you', label: STEP_SAY[step] || cap1(step) });
78
+ const done = items.filter((x) => x.kind === 'done'), rest = items.filter((x) => x.kind !== 'done');
79
+ const life = acts.life || null;
80
+ const turn = rest.some((x) => x.kind === 'you') ? 'you' : life === 'hold' || life === 'cancelled' || rest.some((x) => x.kind === 'risk') ? 'stalled'
81
+ : rest.some((x) => x.kind === 'jira') || key === 'build' || key === 'deliver' ? 'jira' : 'agents';
82
+ const TURN = { you: 'Your turn', agents: 'Agents working', jira: 'Engineers on it', stalled: life === 'hold' ? 'On hold' : life === 'cancelled' ? 'Cancelled' : 'Stalled' };
83
+ // time in the stage: a record that holds it (stageSince, usualDays) first, then the planned finish, then say it is not recorded
84
+ let time = '', over = false;
85
+ const since = dayOf(m.stageSince || head.stageSince), usual = Number.isFinite(m.usualDays) ? m.usualDays : Number.isFinite(head.usualDays) ? head.usualDays : null;
86
+ const end = dayOf(m.end || head.end || (m.dock && m.dock.end));
87
+ const finish = (head.meta || []).find((x) => /^planned finish /.test(x));
88
+ if (since && cur) {
89
+ const n = Math.max(0, Math.round((now - since) / 864e5));
90
+ time = 'In ' + cur.label + ' for ' + plural(n, 'day', 'days') + (usual != null ? ' · usually ' + usual : ''); over = usual != null && n > usual;
91
+ } else if (finish && cur) {
92
+ time = 'In ' + cur.label + ' · ' + finish; over = !!end && end < new Date(new Date(now).getFullYear(), new Date(now).getMonth(), new Date(now).getDate()) && life !== 'done';
93
+ } else if (cur) time = 'In ' + cur.label + ' · time in this stage is not recorded';
94
+ // one CTA: your step when it waits on you, else a question for the read-only agent
95
+ const cta = turn === 'you' ? (CTA_SAY[step] || ('Open ' + (step || 'the next step'))) : turn === 'stalled' ? 'Ask what is stuck' : turn === 'jira' ? 'Ask about the tickets' : 'Ask what is next';
96
+ const ask = turn === 'you' ? 'What do I need to do for the ' + (step || 'next') + ' step of this initiative? Read the evidence in this repository, say what you could not find, and change nothing.'
97
+ : turn === 'stalled' ? 'What is stuck in this initiative, and what would move it? Read this repository, say what you could not find, and change nothing.'
98
+ : turn === 'jira' ? 'Where do this initiative\'s Jira tickets stand, from the last Jira read? Name the assignee of each where the read holds one, and change nothing.'
99
+ : 'What happens next in this initiative, and who does it? Read this repository and change nothing.';
100
+ const anchor = m.anchor ? ' Moves ' + m.anchor + '.' : '';
101
+ return {
102
+ key, at, total: STEPS.length, turn, turnLabel: TURN[turn],
103
+ stage: cur ? (at + 1) + ' of ' + STEPS.length + ' · ' + cur.label : head.stage ? head.stage + ' · not on the lifecycle' : 'No stage on record',
104
+ prev: prev ? prev.label : '', cur: cur ? cur.label : head.stage || '', toReach: next ? next.label : cur ? 'Done' : '',
105
+ ladderAria: cur ? 'Stage ' + (at + 1) + ' of ' + STEPS.length + ': ' + cur.label + '.' + (next ? ' Next stage: ' + next.label + '.' : '') : 'No stage on the lifecycle.',
106
+ steps: STEPS.map((s, i) => ({ label: s.label, ms: !!s.ms, cls: at < 0 ? '' : i < at ? 'done' : i === at ? 'now' : '' })),
107
+ checkTitle: next ? 'To reach ' + next.label : cur ? 'To finish ' + cur.label : 'What is next',
108
+ done, rest, doneOf: done.length + ' of ' + items.length + ' done',
109
+ foldSum: done.length + ' of ' + items.length + ' done · ' + ([rest.filter((x) => x.kind === 'you').length ? rest.filter((x) => x.kind === 'you').length + ' for you' : '', rest.filter((x) => x.kind === 'risk').length ? rest.filter((x) => x.kind === 'risk').length + ' blocked' : '', rest.filter((x) => x.kind === 'jira').length ? 'in Jira' : ''].filter(Boolean).join(', ') || (turn === 'agents' ? 'agents on it' : 'nothing waiting')),
110
+ payoff: cur ? PAYOFF[cur.key] + anchor : '', time, over, cta, ask, primary: turn !== 'agents',
111
+ };
112
+ }
113
+
114
+ const CHEV = '<svg aria-hidden="true" viewBox="0 0 24 24"><path d="M9 6l6 6-6 6"/></svg>';
115
+ const DOWN = '<svg aria-hidden="true" viewBox="0 0 24 24"><path d="M7 10l5 5 5-5"/></svg>';
116
+ const CLOCK = '<svg aria-hidden="true" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg>';
117
+ const TAG = { you: 'You', agent: 'Working', jira: 'Jira', risk: 'Blocked', wait: 'Next' };
118
+ function itemHtml(x) {
119
+ const mark = x.kind === 'done' ? '<span class="czi-mk done" aria-hidden="true"><svg class="cz-ck" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12l4.5 4.5L19 7"/></svg></span>' : x.kind === 'risk' ? '<span class="czi-mk risk" aria-hidden="true">!</span>'
120
+ : x.kind === 'jira' ? '<span class="czi-mk jira" aria-hidden="true">J</span>' : `<span class="czi-mk ${x.kind}" aria-hidden="true"></span>`;
121
+ return `<div class="czi-it ${x.kind}"${x.note ? ` title="${esc(x.note)}"` : ''}>${mark}<span class="czi-itl">${esc(x.label)}</span>${x.kind === 'done' ? '' : `<span class="czi-tag ${x.kind}">${TAG[x.kind] || ''}</span>`}</div>`;
122
+ }
123
+
124
+ /** The card's box under the top row. o: { folded, doneOpen, title } */
125
+ export function headHtml(h, o = {}) {
126
+ const dot = { you: 'you m-info', agents: 'ok', jira: 'ok', stalled: 'late m-warn' }[h.turn] || 'q';
127
+ const ladder = `<div class="czi-lad" aria-label="${esc(h.ladderAria)}" role="img">${h.prev ? `<span class="czi-prev"><svg class="cz-ck" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12l4.5 4.5L19 7"/></svg> ${esc(h.prev)}</span>${CHEV}` : ''}<b>${esc(h.cur)}</b>${h.toReach ? CHEV + `<span class="czi-next">${esc(h.toReach)}</span>` : ''}</div>`
128
+ + `<div class="cz-ladder czi-bars" aria-hidden="true">${h.steps.map((s) => `<i class="${[s.cls, s.ms ? 'ms' : ''].filter(Boolean).join(' ')}" title="${esc(s.label)}"></i>`).join('')}</div>`;
129
+ const folded = `<button type="button" class="czi-fold" data-czfold aria-expanded="false"><b>${esc(h.checkTitle)}</b><span>${esc(h.foldSum)}</span>${DOWN}</button>`;
130
+ const doneRow = h.done.length ? `<button type="button" class="czi-it czi-donerow" data-czdone aria-expanded="${!!o.doneOpen}"><span class="czi-mk done" aria-hidden="true"><svg class="cz-ck" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12l4.5 4.5L19 7"/></svg></span><span class="czi-itl">${esc(h.done.length + ' done' + (o.doneOpen ? '' : ': ' + h.done.map((x) => x.label).join(' · ')))}</span>${DOWN}</button>` : '';
131
+ const list = `<div class="czi-items"><div class="czi-ckh"><button type="button" class="czi-ckt" data-czfold aria-expanded="true"><b>${esc(h.checkTitle)}</b>${DOWN}</button><span>${esc(h.doneOf)}</span></div>${doneRow}${(o.doneOpen ? h.done : []).map(itemHtml).join('')}${h.rest.map(itemHtml).join('') || '<p class="czi-none">Nothing is waiting on a person or an agent.</p>'}</div>`
132
+ + (h.payoff ? `<p class="czi-pay"><b>Then:</b> ${esc(h.payoff)}</p>` : '')
133
+ + (h.time ? `<p class="czi-time${h.over ? ' over' : ''}">${CLOCK}${esc(h.time)}</p>` : '');
134
+ const t = o.title || 'this initiative';
135
+ return `<div class="czi-box ${esc(h.turn)}"><div class="czi-row"><span class="czi-turn ${esc(h.turn)}"><i class="cz-dot ${dot}" aria-hidden="true"></i>${esc(h.turnLabel)}</span><span class="czi-sp"></span><span class="czi-stage">${esc(h.stage)}</span></div>`
136
+ + ladder + (o.folded ? folded : list)
137
+ + `<div class="czi-acts"><button type="button" class="czi-cta${h.primary ? '' : ' alt'}" data-czcta>${esc(h.cta)}</button><button type="button" class="czi-ov" data-czov aria-label="Overview of ${esc(t)} with Claude" title="Overview of ${esc(t)} with Claude"><span aria-hidden="true">C</span></button></div></div>`;
138
+ }
@@ -3,13 +3,18 @@
3
3
  * the board's tracker items) and the Core documents card. A document row with a file opens the document sheet (Read, Edit, Proposals, Edit log, Health) in the
4
4
  * standard dialog beside the read-only agent. The presses are Draft it (POST /api/core-docs/draft), the sheet's Save, Ask the agent, Accept and Reject (the
5
5
  * existing /api/doc-sheet routes, initiative briefing-premium-doc-edit), Add a task and a task's status, and the bar under the stages (initiative
6
- * premium-board-actions, pm/premium-acts.js): move to the next stage or back, hold, cancel, archive, resume, reopen and restore, each with Undo. Nothing here issues a document. */
6
+ * premium-board-actions, pm/premium-acts.js): move to the next stage or back, hold, cancel, archive, resume, reopen and restore, each with Undo. Nothing here issues a document.
7
+ * The Agreed design (initiative premium-agreed-design, I1): no page header; the header card (pm/premium-initiative-head.js) holds the switcher, the
8
+ * eight-step ladder, what finishes the step, the payoff, the time in the stage and one CTA, and folds. The floating place menu (pm/cozy-nav.js)
9
+ * replaces the rail; this page belongs to Home. */
7
10
  import { pmPost } from './http.js';
8
11
  import { mountDocSheet } from './premium-doc-sheet.js';
9
12
  import { $, $$, esc, openDlg, popKey, closeDlg, setMode, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, kv, H2, CHECK, CHEV, crumbHtml, wireCrumb, chatAbout, AI, openAddDoc, setPageGaps } from './premium-shell.js';
10
13
  import { barHtml, onBar, closeMenu } from './premium-acts.js';
11
14
  import { openWorkItem, recordPress } from './premium-vw-item.js';
12
15
  import { openTicket } from './premium-vw-jira.js';
16
+ import { mountNav } from './cozy-nav.js';
17
+ import { headModel, headHtml as cardHtml } from './premium-initiative-head.js';
13
18
 
14
19
  let M = null; // the model
15
20
  let taskView = 'list', taskPage = 0;
@@ -20,6 +25,10 @@ let docFilter = 'all', docQuery = '';
20
25
  let readTimer = null;
21
26
  const docSheet = mountDocSheet({ ws: () => M.board.ws, scope: () => M.docs.scope, rows: () => M.docs.rows, reload: () => load(), noteKey: (d) => 'doc:' + M.id + ':' + d.key, sub: () => M.title, again: false });
22
27
  wireRail('init');
28
+ mountNav('home');
29
+ /* the header card's own state: folded or open, and the done items shown or summed (kept for the viewer only, in this browser) */
30
+ const czStore = { get: (k) => { try { return localStorage.getItem(k); } catch { return null; } }, set: (k, v) => { try { localStorage.setItem(k, v); } catch { /* private window */ } } };
31
+ let czFold = czStore.get('pmos.czi.fold') === '1', czDone = false;
23
32
  const ICO = (p) => `<svg class="i" viewBox="0 0 24 24">${p}</svg>`;
24
33
  const DOCI = '<path d="M6 3h9l4 4v14H6z"/><path d="M14 3v5h5M9 13h6M9 17h4"/>';
25
34
  const SPARK = '<path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/>';
@@ -35,9 +44,22 @@ const when = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso ||
35
44
  /* ── overview, header, checks ────────────────────────────────────────────────────────────────────────────── */
36
45
  function headHtml() {
37
46
  const h = M.head;
38
- const strip = h.strip.names.length ? `<div class="wst iws"><span class="sg2" aria-hidden="true">${h.strip.seg.map((c) => `<i class="${c}"></i>`).join('')}</span><em>${h.strip.names.map((n, j) => (j === h.strip.cur ? `<b>${esc(n)}</b>` : esc(n))).join(' › ')}</em></div>` : '';
39
- return `<div class="ihead">${h.statusLabel ? `<span class="chp ${h.tone}"><i></i>${esc(h.statusLabel)}</span>` : ''}<span class="ihm">${esc(h.meta.join(' · '))}${h.stageNote ? ` · stage ${esc(h.stageNote)}` : ''}</span></div>${strip}`;
47
+ return `<div class="ihead">${h.statusLabel ? `<span class="chp ${h.tone}"><i></i>${esc(h.statusLabel)}</span>` : ''}<span class="ihm">${esc(h.meta.join(' · '))}${h.stageNote ? ` · stage ${esc(h.stageNote)}` : ''}</span></div>`;
40
48
  }
49
+ /** The header card's box (I1): drawn from the model, redrawn on a fold or a load. */
50
+ function drawCard() { $('#czBox').innerHTML = cardHtml(headModel(M, M.asOf ? Date.parse(M.asOf) || Date.now() : Date.now()), { folded: czFold, doneOpen: czDone, title: M.crumbTitle || M.title }); }
51
+ $('#czHead').addEventListener('click', (e) => {
52
+ if (!M) return;
53
+ if (e.target.closest('[data-czfold]')) { czFold = !czFold; czStore.set('pmos.czi.fold', czFold ? '1' : '0'); drawCard(); const f = $('#czBox [data-czfold]'); if (f) f.focus(); return; }
54
+ if (e.target.closest('[data-czdone]')) { czDone = !czDone; drawCard(); const f = $('#czBox [data-czdone]'); if (f) f.focus(); return; }
55
+ if (e.target.closest('[data-czcta]')) {
56
+ const h = headModel(M);
57
+ // Your turn on a document the agent can draft: the CTA is that draft, as PMOS can help offers it; otherwise the question goes to the read-only agent
58
+ const d = h.turn === 'you' && M.help.find((x) => x.kind === 'ask');
59
+ openAsk(d ? d.q : h.ask); return;
60
+ }
61
+ if (e.target.closest('[data-czov]')) openAsk();
62
+ });
41
63
  function overviewHtml() {
42
64
  const o = M.overview;
43
65
  let todo;
@@ -270,7 +292,9 @@ function draw() {
270
292
  $('#snap').title = 'Every figure on this page comes from a record. A date, owner or progress shows only when one was set.';
271
293
  const keepQ = $('#dmQ') && document.activeElement === $('#dmQ');
272
294
  closeMenu();
273
- $('#iMain').innerHTML = headHtml() + (M.acts ? `<div id="iBar">${barHtml(actCtx(), actRow())}</div>` : '') + `${overviewHtml()}` + tasksHtml() + docsHtml();
295
+ $('#czKind').innerHTML = headHtml();
296
+ drawCard();
297
+ $('#iMain').innerHTML = (M.acts ? `<div id="iBar">${barHtml(actCtx(), actRow())}</div>` : '') + `${overviewHtml()}` + tasksHtml() + docsHtml();
274
298
  if ($('#dmList')) drawDocList();
275
299
  if (keepQ) { const q = $('#dmQ'); q.focus(); q.setSelectionRange(q.value.length, q.value.length); }
276
300
  pillOf($('#tkTabs'));