create-pmos 0.557.0 → 0.559.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 (52) hide show
  1. package/package.json +27 -81
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-adddoc-test.js +8 -6
  7. package/workspace/changelog.json +26 -0
  8. package/workspace/fixtures/board-premium-facts.js +2 -12
  9. package/workspace/guide/initiatives-and-next-steps.md +18 -2
  10. package/workspace/guide/programs.md +2 -2
  11. package/workspace/lib/board-premium.js +5 -23
  12. package/workspace/lib/core-docs-needs.js +12 -16
  13. package/workspace/lib/core-docs.js +27 -214
  14. package/workspace/lib/coredoc-cli.js +6 -6
  15. package/workspace/lib/custom-docs.js +3 -1
  16. package/workspace/lib/initiative-cli.js +4 -4
  17. package/workspace/lib/initiative-premium.js +1 -1
  18. package/workspace/lib/initiative-writer.js +28 -4
  19. package/workspace/lib/job-graph.js +2 -2
  20. package/workspace/lib/refresh.js +2 -2
  21. package/workspace/lib/route-modules.js +0 -1
  22. package/workspace/lib/routes-board-premium.js +5 -11
  23. package/workspace/lib/routes-boards.js +5 -4
  24. package/workspace/lib/routes-core-docs.js +23 -113
  25. package/workspace/lib/routes-custom-docs.js +8 -6
  26. package/workspace/lib/routes-initiatives.js +12 -0
  27. package/workspace/lib/routes-intake.js +6 -2
  28. package/workspace/lib/work-kind.js +48 -0
  29. package/workspace/package-lock.json +2 -2
  30. package/workspace/package.json +1 -1
  31. package/workspace/premium-core-doc-issue-test.js +11 -18
  32. package/workspace/public/pm/bd-acts.js +5 -77
  33. package/workspace/public/pm/bd-asks.js +16 -10
  34. package/workspace/public/pm/bd-ini-panel.js +11 -1
  35. package/workspace/public/pm/bd-next.js +14 -4
  36. package/workspace/public/pm/bd-prog.js +4 -5
  37. package/workspace/public/pm/bd-views.js +7 -58
  38. package/workspace/public/pm/cozy-board.css +12 -24
  39. package/workspace/public/pm/cozy-viewer.js +11 -5
  40. package/workspace/public/pm/home-app.js +2 -3
  41. package/workspace/public/pm/home-ini.js +10 -1
  42. package/workspace/public/pm/ini-agent.js +40 -8
  43. package/workspace/public/pm/ini-view-model.js +1 -1
  44. package/workspace/public/pm/premium-board.js +9 -26
  45. package/workspace/public/pm/premium-shell.js +3 -33
  46. package/workspace/public/pm/prog-page.js +1 -1
  47. package/workspace/public/pm/work-kind.js +82 -0
  48. package/workspace/ready-dash-ui-test.js +1 -1
  49. package/workspace/server.js +3 -12
  50. package/workspace/test-files.json +1 -1
  51. package/workspace/test-lists/uncovered-board.json +1 -1
  52. package/workspace/lib/routes-board-docs.js +0 -46
@@ -36,7 +36,8 @@
36
36
  * sub one quiet line under the title: what the item is when the title is its parent's name (a program's "Charter", canvas MsBCharter)
37
37
  * chip { n, label, on(button) }: the blue ✦ with its count right after the title (what Claude proposes on an initiative, batch 12
38
38
  * items 2, 3 and 4, canvas In development PiA0/TpA1). Hidden at zero. setChip(id, chip) changes it while the item is shown.
39
- * presses [{ act, label, icon, text?, solid?, blue?, pressed? }]: the item's own presses before ⋯ (a program's charter icon, canvas MsB0Entry; the
39
+ * presses [{ act, label, icon, text?, solid?, blue?, pressed?, lead? }]: the item's own presses before ⋯ (lead: before Discuss, the
40
+ * initiative's kind of work, batch 29 item 11) (a program's charter icon, canvas MsB0Entry; the
40
41
  * charter's Save, MsBCharter). text draws the word beside the icon (not on a phone); solid is the one dark primary; blue
41
42
  * makes it the round blue ✓ a form saves with (batch 18 item 2-C, canvas OvA8People, OvA9Docs).
42
43
  * onPress(act, button) runs them. setPresses(id, list) changes them while the item is shown (Save shows only after a change).
@@ -179,9 +180,12 @@ export function headHtml(it) {
179
180
  const inMenu = phone && (o.presses || []).some((x) => x && x.menu && x.act && x.label);
180
181
  const more = inMenu || typeof o.more === 'function' || (Array.isArray(o.more) && o.more.some((m) => m && !m.sep)) || o.url ? ib('more', 'More', P.more, ' aria-haspopup="menu" aria-expanded="false"') : '';
181
182
  const add = o.add && o.add.label && !phone ? ib('add', o.add.label, P.add) : '';
182
- const own = (o.presses || []).filter((x) => x && x.act && x.label && !(phone && x.menu)).map((x) => x.solid
183
+ const pressHtml = (x) => (x.solid
183
184
  ? `<button type="button" class="cz-vw-pri${x.text && !phone ? '' : ' i'}${x.blue ? ' blue' : ''}" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}">${svg(path(x.icon), 15, 2.2)}${x.text && !phone ? `<span>${esc(x.text)}</span>` : ''}</button>`
184
- : `<button type="button" class="cz-vw-ib" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}"${x.pressed != null ? ` aria-pressed="${x.pressed ? 'true' : 'false'}"` : ''}>${svg(path(x.icon), 18)}</button>`).join('');
185
+ : `<button type="button" class="cz-vw-ib" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}"${x.pressed != null ? ` aria-pressed="${x.pressed ? 'true' : 'false'}"` : ''}${x.lead ? ' aria-haspopup="menu"' : ''}>${svg(path(x.icon), 18)}</button>`);
186
+ const shown = (o.presses || []).filter((x) => x && x.act && x.label && !(phone && x.menu));
187
+ // lead: a press that stands before Discuss (the initiative's kind of work, batch 29 item 11, KdV1-3)
188
+ const lead = shown.filter((x) => x.lead).map(pressHtml).join(''), own = shown.filter((x) => !x.lead).map(pressHtml).join('');
185
189
  const sub = o.sub ? `<p class="cz-vw-sub">${esc(o.sub)}</p>` : '';
186
190
  const chip = o.chip && (o.chip.n > 0 || o.chip.looking) ? `<button type="button" class="cz-vw-chip${o.chip.looking ? ' live' : ''}" data-cz-vw="chip" aria-haspopup="dialog" aria-label="${esc(o.chip.label || 'PMOS proposes ' + o.chip.n + '. Open')}" title="${esc(o.chip.label || 'PMOS proposes')}">${svg(ICONS.spark, 13, 2)}${o.chip.n > 0 && !o.chip.quiet ? `<b>${esc(o.chip.n)}</b>` : ''}</button>` : '';
187
191
  return (o.canBack || phone ? ib('back', o.canBack ? (o.backTo ? 'Back to ' + o.backTo : 'Back') : 'Close the viewer', P.back) : '')
@@ -189,7 +193,7 @@ export function headHtml(it) {
189
193
  + (o.check ? `<button type="button" class="cz-vw-tile cz-vw-chk s-${esc(o.check.state || 'todo')}" data-cz-vw="press" data-cz-vw-p="check" aria-label="${esc(o.check.label || 'Mark done')}" title="${esc(o.check.title || o.check.label || 'Mark done')}"${o.check.disabled ? ' disabled' : ''}><span class="bx"></span></button>`
190
194
  : `<span class="cz-vw-tile" aria-hidden="true">${svg(path(o.icon), 17)}</span>`)
191
195
  + (o.renaming ? renHtml(o) : `<div class="cz-vw-t">${kind}<h3 class="cz-vw-title${chip ? ' has-chip' : ''}${o.wrap ? ' wrap' : ''}" id="czVwTitle">${o.rename ? `<button type="button" class="cz-vw-rn" data-cz-vw-rn aria-label="${esc('Rename ' + (o.title || ''))}" title="Rename">${esc(o.title || '')}</button>` : chip ? `<span class="cz-vw-tt">${esc(o.title || '')}</span>` : esc(o.title || '')}${chip}</h3>${sub}</div>`)
192
- + disc + own + add + more
196
+ + lead + disc + own + add + more
193
197
  // ⧉ (batch 18 item 15, TbT7Place): where a page arranges panels, one placement press takes the place of ⤢ (Full screen is in it)
194
198
  + (phone ? '' : o.place ? ib('place', 'Arrange', P.place, ' aria-haspopup="menu" aria-expanded="false"')
195
199
  : ib('wide', o.isWide ? 'Back to the side' : 'Open wide', o.isWide ? P.side : P.wide, ` aria-pressed="${o.isWide ? 'true' : 'false'}"`))
@@ -566,7 +570,9 @@ function setChip0(id, chip) {
566
570
  if (V.cur.args) V.cur.args = { ...V.cur.args, chip: V.cur.chip };
567
571
  if ((was ? was.n || 0 : -1) !== n || (was && chip && (was.label !== chip.label || !!was.looking !== !!chip.looking))) { if (!V.cur.renaming) redraw(); }
568
572
  }
569
- function setPresses0(id, list) { if (V.cur && V.cur.id === String(id)) { V.cur.presses = list || null; if (V.cur.args) V.cur.args = { ...V.cur.args, presses: list || null }; if (!V.cur.renaming) redraw(); } }
573
+ // a list with no lead press keeps the item's lead presses (the kind of work stays when the Dashboard's press changes)
574
+ const withLead = (list) => { const L = list || []; if (L.some((x) => x && x.lead)) return L; const k = ((V.cur && V.cur.presses) || []).filter((x) => x && x.lead); return k.length ? k.concat(L) : list; };
575
+ function setPresses0(id, list) { if (V.cur && V.cur.id === String(id)) { list = withLead(list); V.cur.presses = list || null; if (V.cur.args) V.cur.args = { ...V.cur.args, presses: list || null }; if (!V.cur.renaming) redraw(); } }
570
576
  /** A task's check box changes while it is shown (a status move from the card, canvas XetX1Done). */
571
577
  function setCheck0(id, check) { if (V.cur && V.cur.id === String(id)) { V.cur.check = check || null; if (V.cur.args) V.cur.args = { ...V.cur.args, check: check || null }; if (!V.cur.renaming) redraw(); } }
572
578
  /** The item may be shown in any Viewer, not only the one used last: each one that shows it changes. */
@@ -1191,8 +1191,8 @@ function openProductPage() {
1191
1191
  }
1192
1192
  /** The product page (feedback batch 21 item 2, canvas RdProgL–RdProgP and rdProgAgreed): the SAME one page as a program's (pm/prog-page.js),
1193
1193
  * with no toggle. Top: the ✦ line, the goal card (short titles, KR chips, Forecast's range bar), Programs and Health budgets cards, and the
1194
- * proposals folded to one row. Tabs: Tasks · Initiatives (opens here) · Reports (the ready reports, the weekly update, the metrics review) ·
1195
- * Documents. The model is GET /api/ready-reports/dashboard scope product; until it answers (or when it cannot) the page draws the parts Home
1194
+ * proposals folded to one row. Tabs: Tasks · Initiatives (opens here) · Reports (the ready reports, the weekly update, the metrics review).
1195
+ * There is no Documents tab: board documents are retired (batch 29 item 8), and a last tab kept as Documents opens Initiatives. The model is GET /api/ready-reports/dashboard scope product; until it answers (or when it cannot) the page draws the parts Home
1196
1196
  * already has (its programs, initiatives and tasks) and the goals line of GET /api/goal-status. g: the product's group in Home's list. */
1197
1197
  const PDASH = new Map(); // ws → { d, open }
1198
1198
  const lateDays = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); if (!m) return null; const t = new Date(); t.setHours(0, 0, 0, 0); return Math.round((t - new Date(+m[1], +m[2] - 1, +m[3])) / 864e5); };
@@ -1237,7 +1237,6 @@ function productPageHtml(x, ws, vid, name, g) {
1237
1237
  + `<section class="pv-card" aria-label="Open tasks"><div class="pv-ch"><h4>Open tasks</h4><small>${T.length}</small></div>${T.filter((t) => !late.slice(0, 3).includes(t)).map(tRow).join('')}</section>` : '<p class="pv-none">No open task on its initiatives.</p>') },
1238
1238
  { id: 'initiatives', label: 'Initiatives', n: inis.length, html: () => (inis.length ? iniCards : '<p class="pv-none">Nothing is open. A new initiative shows here.</p>') },
1239
1239
  { id: 'reports', label: 'Reports', n: reps.length, sig: reps.some((r) => r.state === 'drafted') ? 'ready' : '', html: () => `<div class="db" data-level="product">${d ? DB.trustHtml(d) : ''}${R}</div><section class="pv-card" aria-label="More reports">${extra}</section>` },
1240
- { id: 'documents', label: 'Documents', html: () => '<p class="pv-none">Each initiative keeps its PRD, rubric and release notes on its own page. Open one from Initiatives.</p>' },
1241
1240
  ];
1242
1241
  // "The story so far" (board AwE): the product's Narrative under the top line, a source on every line; the top line says it is the weekly update
1243
1242
  const story = x.story ? ST.storyHtml(x.story, { sources: true }) : '';
@@ -26,6 +26,7 @@
26
26
  * batch 11 item 20 they are the page's Tasks section's, the same on the Board (ini-groups.js). In shell A Documents and Stage open from the
27
27
  * page; the phone keeps the Documents | Stage switch. */
28
28
  import * as MD from './home-ini-model.js';
29
+ import * as WK from './work-kind.js'; // the kind of work in the header (batch 29 item 11, KdV1-3)
29
30
  import * as WF from './ini-wf.js';
30
31
  import { openPop, closePop, undoToast, popEl, ensureCss as ensurePopCss } from './hi-pop.js';
31
32
  import { iniMore, iniText, pageHref, stagePick, deleteSaid, DELETE_MS } from './ini-more.js'; // the one initiative ⋯ menu and stage picker, the same on the Board (batch 14 item 5, batch 16 item 5c)
@@ -448,6 +449,8 @@ async function autoPress(id, M, on) {
448
449
  await X.ctx.load(); redrawView();
449
450
  return true;
450
451
  }
452
+ /** The initiative's kind of work: the page's own model, else its Board row; none reads as Product management. */
453
+ const kindNow = (id) => { const M = curM(); return (M && M.kind) || rowOf(id).kind || 'product'; };
451
454
  export function iniPage() {
452
455
  if (!X.ctx) return false;
453
456
  const S = X.ctx.S, id = S.ini;
@@ -459,7 +462,13 @@ export function iniPage() {
459
462
  const dh = dashFor(id);
460
463
  BODY = VW.open({ id: 'ov:' + id, kind: X.ctx.kindOf(id), title: X.ctx.iniTitle(id), icon: 'goal', wrap: true, more: () => pageMore(id), rename,
461
464
  discuss: () => X.ctx.newIn(id), discussHome: true, // the one view (OvViewers): Discuss starts a new session about it, where + New session was
462
- presses: dh ? dh.presses() : null, onPress: (a) => { if (a === 'dash' && dh) dh.toggle(); },
465
+ // the kind of work (batch 29 item 11, KdV1-3): its glyph stands before Discuss; a tap opens the three kinds
466
+ presses: [WK.pressOf(kindNow(id))].concat(dh ? dh.presses() : []), onPress: (a, btn) => {
467
+ if (a === 'dash' && dh) dh.toggle();
468
+ else if (a === 'kind') { const from = kindNow(id); WK.pick(btn, from, (to) => WK.change({ pmPost: X.ctx.pmPost, ws: wsOf(curM()) || rowOf(id).ws, id, from, to, toast: (t, u) => (u ? undoToast(t, u) : X.ctx.toast(t)),
469
+ apply: (k) => { const M = curM(); if (M) M.kind = k; const row = rowOf(id); if (row && row.id) row.kind = k; VW.setPresses('ov:' + id, [WK.pressOf(k)].concat(dh ? dh.presses() : [])); redrawView(); },
470
+ reload: async () => { await X.ctx.load(); redrawView(); } })); }
471
+ },
463
472
  render: (b) => { X.view = 'page'; BODY = b; ADDING = null; draw(b); wire(b, id); wirePage(b, id); if (dh) dh.wire(b); } });
464
473
  // came to read (?view=dashboard: a report, Intelligence, a notification) or to act (a Home task): which view opens first
465
474
  if (dh) dh.read(new URLSearchParams(location.search).get('view') === 'dashboard' ? 'read' : 'act');
@@ -2,7 +2,7 @@
2
2
  * Wawan 2026-11-10; requirements R4, R5, R7, R12, R17, R18 and decision D107). Pure parts first: Node imports them (ini-agent.test.js).
3
3
  *
4
4
  * agentModel(art, auto, id, o) → M | null what the Viewer shows, from GET /api/artefacts?scope=experiment:<id> and GET /api/autonomy
5
- * expHtml(M) · workHtml(M) · comingHtml(rows) · sectionsHtml(M, v) the Experiment section, PMOS's work (with its amber line) and
5
+ * expHtml(M, kind) · workHtml(M) · comingHtml(rows) · sectionsHtml(M, v) the Experiment section (its rows follow v.kind, kindRows), PMOS's work (with its amber line) and
6
6
  * Coming up, each '' when it has nothing to say
7
7
  * comingUp(v, M) → [row] what is ahead for the initiative, dated, oldest first (batch 29 item 7, board CuA)
8
8
  * gateOf(M) → { label, parts } | null D107: the gate to Build reads the done test and the kill condition, not PRD and rubric
@@ -34,7 +34,37 @@ const P = { undo: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3', check: 'M5 12l5 5 9-
34
34
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
35
35
  const dm = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
36
36
  const DAY = 864e5, SHOW = 3;
37
- export const WHO = { factory: 'PMOS builds it (the factory).', team: 'The team builds it. PMOS writes the done test.', 'team-agents': 'The team’s agents build it. PMOS writes the done test.' };
37
+ export const WHO = { factory: 'PMOS builds it and opens pull requests. You merge.', team: 'The team builds it. PMOS writes the done test.', 'team-agents': 'The team’s agents build it. PMOS writes the done test.' };
38
+ /* THE KIND OF WORK (batch 29 item 11, boards KdV1-3): the kind is named once, in the Experiment's header, and the rows follow it. Who builds
39
+ * defaults from the kind until someone writes it (Full SDLC: PMOS, the factory; Product and Project: the team); Project reads "Who does it"
40
+ * and needs no specimens. A kind never changes a line someone wrote. */
41
+ export const KIND = { product: 'Product management', sdlc: 'Full SDLC', project: 'Project management' };
42
+ const kindOf = (k) => (KIND[k] ? k : 'product');
43
+ const DEF_EX = { product: 'team', sdlc: 'factory', project: 'team' };
44
+ const PROJECT_WHO = 'The team does it. PMOS chases, syncs the dates and writes the status line.';
45
+ /** The Experiment's rows for one kind: the model's rows, with Who builds from the kind when nobody wrote it, and Project's wording. */
46
+ export function kindRows(M, kind) {
47
+ if (!M || !M.exp) return [];
48
+ const k = kindOf(kind), rows = M.exp.rows.slice();
49
+ let i = rows.findIndex((r) => r.key === 'executor');
50
+ if (i < 0) {
51
+ const at = rows.findIndex((r) => r.key === 'specimens' || r.key === 'done');
52
+ const ex = DEF_EX[k];
53
+ const r = { key: 'executor', label: 'Who builds', text: WHO[ex], value: ex, by: '', at: '', sub: k === 'sdlc' ? 'Set one experiment to the team in Jira any time.' : '', def: true, edit: { artefact: 'experiment', field: 'executor', pick: Object.keys(WHO) } };
54
+ if (at < 0) rows.push(r); else rows.splice(at, 0, r);
55
+ i = rows.indexOf(r);
56
+ }
57
+ if (k === 'project') {
58
+ const r = rows[i];
59
+ rows[i] = { ...r, label: 'Who does it', text: r.def ? PROJECT_WHO : r.text, sub: '' };
60
+ if (!rows.some((x) => x.key === 'specimens')) {
61
+ const d = rows.findIndex((x) => x.key === 'done');
62
+ const sp = { key: 'specimens', label: 'Specimens', text: 'None needed. The plan is what you look at.', edit: null };
63
+ if (d < 0) rows.push(sp); else rows.splice(d, 0, sp);
64
+ }
65
+ }
66
+ return rows;
67
+ }
38
68
 
39
69
  const art = (A, key) => ((A && A.artefacts) || []).find((a) => a.key === key) || null;
40
70
  const one = (a, f) => { const v = a && a.fields && a.fields[f]; return v && !Array.isArray(v) && v.text ? v : null; };
@@ -124,15 +154,16 @@ export function comingUp(v, M) {
124
154
 
125
155
  const failLine = (F) => `<div class="ia-fl" role="status">${SVG(P.warn, 14, 2)}<span>${esc((F.n === 1 ? 'The ' + dm(F.at) + ' run' : F.n + ' runs') + ' ended with an error.' + (F.why ? ' ' + String(F.why).replace(/\.?$/, '.') : '') + ' PMOS runs ' + (F.n === 1 ? 'it' : 'them') + ' again on the next wake. Nothing ' + (F.n === 1 ? 'it' : 'they') + ' made was kept.')}</span></div>`;
126
156
 
127
- export function expHtml(M) {
157
+ export function expHtml(M, kind) {
128
158
  if (!M || !M.exp) return '';
159
+ const k = kindOf(kind);
129
160
  const rowHtml = (r) => {
130
161
  const val = `<span class="ia-v">${esc(r.text)}${r.sub ? `<small>${esc(r.sub)}</small>` : ''}</span>`;
131
162
  return r.edit ? `<button type="button" class="ia-xr" data-ia-edit="${esc(r.key)}" aria-label="${esc(r.label + ': ' + r.text + '. Edit')}" title="Edit"><b>${esc(r.label)}</b>${val}</button>`
132
163
  : `<div class="ia-xr"><b>${esc(r.label)}</b>${val}</div>`;
133
164
  };
134
- return `<section class="ia-sec" aria-label="Experiment" data-ia-exp><div class="ia-th"><b>Experiment</b><span class="n">${esc('PMOS keeps it' + (M.exp.at ? ' · ' + dm(M.exp.at) : ''))}</span></div>`
135
- + `<div class="iv-folds">${M.exp.rows.map(rowHtml).join('')}<p class="ia-note">Press a line to edit it. PMOS asks before it changes one you edited.</p></div></section>`;
165
+ return `<section class="ia-sec" aria-label="Experiment" data-ia-exp><div class="ia-th"><b>Experiment</b><span class="n"><b>${esc(KIND[k])}</b>${esc(' · PMOS wrote it' + (M.exp.at ? ' · ' + dm(M.exp.at) : ''))}</span></div>`
166
+ + `<div class="iv-folds">${kindRows(M, k).map(rowHtml).join('')}<p class="ia-note">Press a line to edit it. PMOS asks before it changes one you edited.</p></div></section>`;
136
167
  }
137
168
 
138
169
  export function workHtml(M, o = {}) {
@@ -160,7 +191,8 @@ export function comingHtml(rows, o = {}) {
160
191
 
161
192
  /** Both sections in one holder the page can swap when the reads arrive. */
162
193
  export function sectionsHtml(M, v, id, o = {}) {
163
- return `<div class="ia" data-ia="${esc(id)}">${expHtml(M)}${workHtml(M, o)}${comingHtml(comingUp(v, M), { all: !!o.cuAll })}</div>`;
194
+ const k = v && v.kind ? kindOf(v.kind) : '';
195
+ return `<div class="ia" data-ia="${esc(id)}"${k ? ` data-ia-kind="${k}"` : ''}>${expHtml(M, k)}${workHtml(M, o)}${comingHtml(comingUp(v, M), { all: !!o.cuAll })}</div>`;
164
196
  }
165
197
 
166
198
  /* ── the reads and the presses (the page only) ── */
@@ -194,7 +226,7 @@ export function toggleCu(id) { toggleMore('cu|' + id); }
194
226
  /** A press on a field: the line turns into its editor (a text field, or the three builders for Who builds). */
195
227
  export function edit(btn) {
196
228
  const sec = btn.closest('[data-ia]'), id = sec && sec.dataset.ia, M = cached(id);
197
- const r = M && M.exp && M.exp.rows.find((x) => x.key === btn.dataset.iaEdit);
229
+ const r = kindRows(M, sec && sec.dataset.iaKind).find((x) => x.key === btn.dataset.iaEdit);
198
230
  if (!r || !r.edit) return;
199
231
  const field = r.edit.pick ? `<select name="v" aria-label="${esc(r.label)}">${r.edit.pick.map((p) => `<option value="${esc(p)}"${p === r.value ? ' selected' : ''}>${esc(WHO[p])}</option>`).join('')}</select>`
200
232
  : `<textarea name="v" rows="2" aria-label="${esc(r.label)}">${esc(r.text)}</textarea>`;
@@ -206,7 +238,7 @@ export function edit(btn) {
206
238
  }
207
239
  /** Save the PM's edit of one line; then read again and draw. */
208
240
  export async function save(form, ws, redraw, toast) {
209
- const id = form.closest('[data-ia]').dataset.ia, M = cached(id), r = M && M.exp && M.exp.rows.find((x) => x.key === form.dataset.iaKey);
241
+ const sec = form.closest('[data-ia]'), id = sec.dataset.ia, M = cached(id), r = kindRows(M, sec.dataset.iaKind).find((x) => x.key === form.dataset.iaKey);
210
242
  const v = String(form.querySelector('[name="v"]').value || '').trim();
211
243
  if (!r || !v) { redraw(); return; }
212
244
  const res = await pmPost('/api/artefacts/set', { ws: ws || undefined, scope: 'experiment:' + id, artefact: r.edit.artefact, field: r.edit.field, text: v }).catch(() => null);
@@ -331,7 +331,7 @@ export function iniView(r, ctx = {}) {
331
331
  summary.wf = r.wf || { id: PF_ID, name: 'Product feature', icon: 'feature' };
332
332
  summary.program = ctx.program || null;
333
333
  const today2 = (n) => String(n).padStart(2, '0');
334
- return { anchor: r.kr || '', vs: r.__vs || null, links: r.__vs && r.__vs.draft ? null : r.links || null, prd: (r.trail && r.trail.links && r.trail.links.prd) || null, desc: (r.trail && r.trail.desc) || r.desc || null, id: r.id || null, key: r.key, title: r.title, today: today.getFullYear() + '-' + today2(today.getMonth() + 1) + '-' + today2(today.getDate()), summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r), jiraAt: jiraIn ? ctx.jiraAt || '' : '', jiraRead: ctx.jiraReadAt || '',
334
+ return { anchor: r.kr || '', kind: r.kind || 'product', vs: r.__vs || null, links: r.__vs && r.__vs.draft ? null : r.links || null, prd: (r.trail && r.trail.links && r.trail.links.prd) || null, desc: (r.trail && r.trail.desc) || r.desc || null, id: r.id || null, key: r.key, title: r.title, today: today.getFullYear() + '-' + today2(today.getMonth() + 1) + '-' + today2(today.getDate()), summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r), jiraAt: jiraIn ? ctx.jiraAt || '' : '', jiraRead: ctx.jiraReadAt || '',
335
335
  // split or merge (batch 11 item 14): Claude's suggestion for it, and where its work went when it was merged
336
336
  suggest: r.suggest || null, merged: mergedOf(r),
337
337
  // what Claude proposes under the one blue ✦, and what a ✓ kept from elsewhere (batch 12 items 2, 3 and 4; pm/ini-props.js)
@@ -1,15 +1,15 @@
1
1
  /* pm/premium-board.js — the premium Board in the Agreed design (initiative premium-agreed-design: the AgBoard* frames; built on briefing-premium-board).
2
2
  * Reads GET /api/board-premium and draws the model lib/board-premium.js builds from the routes the production Initiatives page reads.
3
3
  * · one toolbar: the product picker, the view toggle, Find, Filter, the shell's bell, New initiative and the shell's ⋯ menu; under it the
4
- * Initiatives and Documents tabs and the chips (Jira read time, sprint and release, new asks, late, at risk, blocked, idle, This sprint).
4
+ * Initiatives and Shared with me tabs and the chips (Jira read time, sprint and release, new asks, late, at risk, blocked, idle, This sprint).
5
5
  * · the stage track (default): each initiative is a row across the six stages and two milestones (◆), with the parts or tickets counted
6
6
  * toward the output that finishes its current step. Monitor and Evaluate rows fold under the table after the first of each.
7
7
  * · List and By stage (pm/bd-views.js; BdList, BdByStage) and the timeline (pm/bd-span.js, scrolled by pm/bd-scroll.js): Sprint, Quarter, Half,
8
8
  * Year, 2 yr and 5 yr, the same rows on every span from Quarter on (feedback batch 7, timeline spans C).
9
9
  * · a row opens the initiative panel and a ticket opens the Jira ticket panel, in the side panel (a bottom sheet on a phone).
10
10
  * · the Board has no chat: "Ask about this" sends the question to Home (/premium.html?ask=<initiative>&q=<question>).
11
- * The uncovered features (initiative premium-uncovered-features: BdList, BdByStage, BdDocs, BdSpans, BdAsks, BdNew, BdGrill, BdActions, BdFilter,
12
- * BdSprint, BdPanel, BdPhone, BdHead) are drawn by pm/bd-views.js (the views and Documents), pm/bd-asks.js (new asks, New initiative and its first
11
+ * The uncovered features (initiative premium-uncovered-features: BdList, BdByStage, BdSpans, BdAsks, BdNew, BdGrill, BdActions, BdFilter,
12
+ * BdSprint, BdPanel, BdPhone, BdHead) are drawn by pm/bd-views.js (the views), pm/bd-asks.js (new asks, New initiative and its first
13
13
  * questions), pm/bd-acts.js (the row actions, Find, Filter, the sprint and release, the trends, the document panel) and pm/bd-pop.js (popovers).
14
14
  * A phone has List, By stage, the stage track and the timeline (BdPhone, TsCPhone), with one span picker beside the product picker.
15
15
  * After the model, GET /api/board-trail (lib/board-trail.js) adds what the model does not carry: days in the step and the usual days, the
@@ -18,6 +18,7 @@
18
18
  * chip row picks one (its own stages become the columns and the track's header) or All (the three categories, each row its own stages).
19
19
  * Where no record holds a value for an initiative, the element says so: nothing is invented. */
20
20
  import './fetch-share.js'; // first: identical GETs in flight are asked once (page-open-speed)
21
+ import * as WK from './work-kind.js'; // the kind of work before each title (batch 29 item 11, KdBd)
21
22
  import { pmPost } from './http.js';
22
23
  import { followDoc } from './doc-follow.js';
23
24
  import { $, $$, esc, store, chatAbout, setPageGaps } from './premium-shell.js';
@@ -92,7 +93,6 @@ let PKP = null, picked = false; // the saved pick (GET /api/briefing-premium/p
92
93
  let grouping = ['program', 'product', 'goal'].includes(store.get(GROUPING_KEY)) ? store.get(GROUPING_KEY) : 'goal';
93
94
  let byProduct = grouping === 'product';
94
95
  let GOALS = null, goalsFor = ''; // GET /api/artefacts/goals for the rows on screen ({ goals, of }), and the rows it was read for
95
- let DM = {}; // the documents' history (GET /api/board-docs): { [path]: { changed, by, log } }
96
96
  let peek = null; // what the Viewer shows for the Board: { kind: 'ini', key } an initiative or its ticket, { kind: 'acts' } an acts panel
97
97
  mountNav('board', document, { scope: () => Acts.findScope() }); // ⌘K and Find open Search scoped to this Board first (UI grill U2)
98
98
  quietPlace('board', document.getElementById('stage'));
@@ -505,7 +505,7 @@ function trackRow(r, cls = '', po = false) {
505
505
  }).join('');
506
506
  const many = TK.mode === 'cats'; // All: each row names its workflow with its icon (WfATrack)
507
507
  return `<div class="bt-r bt-l${cls}${peek && peek.key === r.key && peek.kind !== 'acts' ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}"${po ? ` data-po-id="${esc(r.id)}"` : ''}>${po ? PO.gripHtml(r.title) : ''}`
508
- + `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${many ? WF.wfIcon(WF.wfOf(r), 18) : ''}${SM.nameHtml(r)}</b><span class="cs s-${s.tone}"${s.from ? ` title="${esc(s.from)}"` : ''}><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
508
+ + `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${many ? WF.wfIcon(WF.wfOf(r), 18) : ''}${WK.iconHtml(r.kind)}${SM.nameHtml(r)}</b><span class="cs s-${s.tone}"${s.from ? ` title="${esc(s.from)}"` : ''}><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
509
509
  + `<div class="${cellsCls()}" role="presentation"${cellsStyle()}>${cells}</div>`
510
510
  + `<div class="bt-dl" role="cell">${nextHtml(r, { self: M.board.self, icon: !small() })}</div></div>`; // the Next cell (XocA): what finishes the step next
511
511
  }
@@ -927,7 +927,7 @@ $('#bdFilter').addEventListener('click', (e) => Acts.open.filter(e.currentTarget
927
927
  // and that press opens New initiative at once.
928
928
  $('#newIni').addEventListener('click', (e) => { if (e.isTrusted) Asks.openNewMenu(e.currentTarget); else Acts.open.new(e.currentTarget); });
929
929
 
930
- /* ── tabs: Initiatives and Documents (Documents has no frame yet: a plain list) ──────────────────────────────────────────────────────── */
930
+ /* ── tabs: Initiatives and Shared with me ──────────────────────────────────────────────────────── */
931
931
  let SH_PASTE = ''; // ?shared=<link>: Open in my PMOS on a shared board (batch 27 item 3) lands on Shared with the link in the paste field
932
932
  function setTab(t) {
933
933
  tab = t;
@@ -939,23 +939,6 @@ function setTab(t) {
939
939
  function setSharedCount(n) { SH_N = n; if (menuOpen('bdViewMenu')) drawViewMenu(); }
940
940
  document.addEventListener('bd:links', (e) => { if (!SH_FULL && e.detail) setSharedCount(e.detail.n); });
941
941
 
942
- /** The history of the documents (GET /api/board-docs) for the document panel of pm/bd-acts.js. Batch 24 item 7 took the Documents tab off the Board,
943
- * so nothing on the Board opens that panel now; it is kept for a later way in (see the PR).: when each last changed, by whom, its last commits. Read-only. */
944
- async function loadDocMeta(list) {
945
- if (!M) return;
946
- // each document is read from its own product's workspace (All products lists every product's documents)
947
- const here = M.board.ws || '', want = (list || V.docRows()).map((x) => ({ path: x.path, ws: x.ws || here })).filter((x) => x.path && !DM[x.ws + ':' + x.path]).slice(0, 40);
948
- if (!want.length) return;
949
- const by = new Map(); for (const x of want) { if (!by.has(x.ws)) by.set(x.ws, []); by.get(x.ws).push(x.path); }
950
- let got = false;
951
- for (const [ws, P] of by) {
952
- let r = null; try { r = await (await fetch('/api/board-docs?ws=' + encodeURIComponent(ws) + '&paths=' + P.map(encodeURIComponent).join(','), { credentials: 'same-origin' })).json(); } catch { r = null; }
953
- if (!r || !r.ok) continue;
954
- for (const p of P) DM[ws + ':' + p] = r.docs[p] || { none: true };
955
- got = true;
956
- }
957
- }
958
- const docMeta = (p, ws) => { const d = DM[(ws || (M && M.board.ws) || '') + ':' + p]; return d && !d.none ? d : null; };
959
942
 
960
943
  /* ── the shell's bell sits before New initiative, as the design orders the tools; Escape closes a popover, then the panel ──────── */
961
944
  /* the ⋯ menu (UI grill U2): Publish a read-only copy and Cancelled and archived, nothing else. The shell's Sources, Theme and Settings rows
@@ -1220,18 +1203,18 @@ function openFindings(r, from) {
1220
1203
  }
1221
1204
  FCC.init({ rowOf: (k) => rowOf(k), openFindings });
1222
1205
  const openIniAny = (r) => { if (r && curView() === 'time') TL.reveal(r.key); openIni(r, $('#chNeed') || $('#bdFind'), 'track'); };
1223
- V.init({ M: () => M, wf: wfState, statusOf, usual: usualOf, trail: TI, docMeta, sel: () => (peek && peek.kind !== 'acts' ? peek.key : null), docSel: () => Acts.docSel(),
1206
+ V.init({ M: () => M, wf: wfState, statusOf, usual: usualOf, trail: TI, sel: () => (peek && peek.kind !== 'acts' ? peek.key : null),
1224
1207
  groups: (L) => groups(L), folded: PG.folded, laneHead: (g) => (g.kind === 'goal' ? GL.laneHtml(g, !PG.folded(g.key)) : PG.laneHtml(g, g.kind === 'program' ? progState(g.program) : null)), progGroups: (L) => progGroups(L), subTile: (n) => PG.tileHtml(n, 'bd-ti s'),
1225
1208
  memberIcon: (id) => PG.memberIcon(PGS, id), product: () => (M.board.product || M.board.name || ''), programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), tileHtml: PG.tileHtml, progTile: PG.progTile });
1226
1209
  Asks.init({ M: () => M, load, say, panel: actsPanel, close: closePanel, rowOf, openIni: openIniAny, openDoc: viewDoc, anchors, programs: () => PGS, reloadPrograms: loadPrograms });
1227
1210
  Acts.init({ M: () => M, wf: wfState, load, say, panel: actsPanel, close: closePanel, redraw: () => { drawChips(); drawInit(); }, F, rowOf, statusOf, openIni: openIniAny,
1228
- openTicket: (ini, tk) => openTicket(ini, tk, $('#bdFind')), askHref, pageHref, trail: TI, docMeta, loadDocMeta, viewDoc,
1211
+ openTicket: (ini, tk) => openTicket(ini, tk, $('#bdFind')), askHref, pageHref, trail: TI, viewDoc,
1229
1212
  grouping: () => ({ on: groupingOn(), byProduct, by: grouping === 'goal' && !goalsHere() ? (groupingOn() ? 'program' : 'product') : grouping, goal: goalsHere() }), setGrouping, sprintFilter: sprintFilterOn, timeline: () => curView() === 'time',
1230
1213
  tune: tuneParts, sprintOnly, toggleSprintOnly: () => { if (F.chips.has('sprint')) F.chips.delete('sprint'); else F.chips.add('sprint'); }, sortPick, refreshJira: () => refreshJira() });
1231
1214
  BI.mount({ M: () => M, statusOf, dayTitle, usual: usualOf, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
1232
1215
  send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
1233
1216
  moreAct: (r, k, b) => Acts.open.more(r, k, b), hold: (r, i, b) => Acts.open.hold(r, i, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden,
1234
- programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), openProgram: (id, b) => PG.openProgram(id, b), reload: load, toast: say, rename: renameIni, setTask, setDates, removeTask, addTask, openTask, turnProgram, moveItems, smItems, smPress, openIniId });
1217
+ programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), openProgram: (id, b) => PG.openProgram(id, b), reload: load, redraw: () => { if (M) drawInit(); }, toast: say, rename: renameIni, setTask, setDates, removeTask, addTask, openTask, turnProgram, moveItems, smItems, smPress, openIniId });
1235
1218
  /** Tap the title to rename (canvas RnAIni): the list, the Timeline and the panel show the new name at once; Undo is the same press.
1236
1219
  * The Jira box opens Home's chat about it with the request typed, for the PM to send (PMOS holds no Jira credential, D53). */
1237
1220
  // a name the PM just saved holds over a read that predates it (the board derives off the request path) until a read says it too
@@ -932,35 +932,6 @@ export function wireCrumb(o) {
932
932
  });
933
933
  }
934
934
 
935
- /* ── Add a document: the dialog the Board and the initiative page share (initiative briefing-premium-adddoc) ──────────────────────────────────
936
- * o = { ws, scope: 'board:<id>' | 'initiative:<id>', sub, onAdded }. The one press posts to POST /api/custom-docs/add and nothing else. */
937
- export function openAddDoc(o) {
938
- const ini = String(o.scope).startsWith('initiative:'), phases = ['Discover', 'Plan', 'Build', 'Evaluate'];
939
- const form = `<div class="addf"><p class="note" style="margin:0">Add a document the core set does not cover, for example a research plan, a UAT plan or a contract. It is saved on the ${ini ? 'initiative' : 'board'}'s record with the address of a copy that lives in Confluence or Google Docs. PMOS does not read or sync that page.</p>
940
- <label>Title<input id="adT" maxlength="80" placeholder="For example: UAT plan"></label>
941
- ${ini ? `<label>Phase<select id="adC">${phases.map((k) => `<option>${k}</option>`).join('')}</select></label>` : ''}
942
- <div><span class="label">Who writes it</span><div class="seg" id="adW" role="group" aria-label="Who writes it"><i class="pill"></i><button type="button" data-w="drafts" aria-pressed="true">PMOS drafts it</button><button type="button" data-w="you" aria-pressed="false">I write it</button></div></div>
943
- <div><span class="label">Where it lives</span><div class="two"><label><select id="adK" aria-label="Where it lives"><option value="">In PMOS</option><option>Confluence</option><option>Google Docs</option><option>Google Slides</option></select></label><label><input id="adU" maxlength="300" placeholder="Paste the page address" aria-label="Page address" disabled></label></div></div>
944
- <p class="note" id="adM" role="status" style="margin:0;min-height:1.2em"></p><div class="cact"><button class="cta" id="adGo">Add document</button><button class="cta alt" id="adNo">Cancel</button></div></div>`;
945
- openDlg({ eye: 'New document · real data', title: 'Add a document', sub: o.sub, say: 'Name the document and say who writes it. It is saved on the record.', stream: turnA(ptx('Name the document and say who writes it. I save it on the record and change nothing else. A linked page is kept as an address only.')), noteKey: popKey('new-doc', o.scope), pane: `<article class="paper doc">${form}</article>`, label: 'Document' });
946
- pillOf($('#adW'));
947
- let who = 'drafts';
948
- $('#oMain').onchange = (e) => { if (e.target.id === 'adK') { $('#adU').disabled = !e.target.value; if (e.target.value) $('#adU').focus(); } };
949
- $('#oMain').onclick = async (e) => {
950
- const w = e.target.closest('[data-w]');
951
- if (w) { who = w.dataset.w; $$('#adW button').forEach((x) => x.setAttribute('aria-pressed', x === w)); pillOf($('#adW')); return; }
952
- if (e.target.closest('#adNo')) { closeDlg(); return; }
953
- if (!e.target.closest('#adGo')) return;
954
- const title = $('#adT').value.trim(), m = $('#adM'), kind = $('#adK').value, url = ($('#adU').value || '').trim();
955
- if (!title) { m.textContent = 'Give the document a title.'; $('#adT').focus(); return; }
956
- if (kind && !url) { m.textContent = 'Paste the address of the ' + kind + ' page, or choose In PMOS.'; $('#adU').focus(); return; }
957
- const go = $('#adGo'); go.disabled = true;
958
- const res = await pmPost('/api/custom-docs/add', { ws: o.ws, scope: o.scope, title, writer: who, phase: ini ? document.getElementById('adC').value : undefined, kind: kind || undefined, url: kind ? url : undefined });
959
- if (!res || res.ok !== true) { go.disabled = false; m.textContent = (res && res.error) || 'The document could not be added.'; return; }
960
- toast('Document added. It is saved on the record.'); closeDlg(); if (o.onAdded) await o.onAdded();
961
- };
962
- }
963
-
964
935
  /* ── Search (Ctrl K or "/") and the agent inbox (initiative premium-search-bell). Reads only; a press goes to a page.
965
936
  * The Agreed design draws no bell, so none is drawn: the inbox is still read (its count, its toast and the panel premium.js opens). ── */
966
937
  const SRCH = '<svg class="i" viewBox="0 0 24 24"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>';
@@ -1002,7 +973,7 @@ function pvOpen(kind) {
1002
973
  $$('main.stage').forEach((x) => { x.inert = true; }); document.documentElement.style.overflow = 'hidden';
1003
974
  if (homeDock()) $('#dlg').inert = true;
1004
975
  const o = $('#pvOv'); o.className = 'pv-ov ' + kind; o.setAttribute('aria-label', kind === 'pal' ? 'Search' : 'Needs you'); o.hidden = false; o.inert = false; $('#pvScrim').classList.add('on');
1005
- if (kind === 'pal') { o.innerHTML = '<div class="pv-pin">' + SRCH + '<input id="pvQ" type="text" placeholder="Search places, initiatives, documents and sessions" aria-label="Search" autocomplete="off" role="combobox" aria-expanded="true" aria-controls="pvList"><kbd>Esc</kbd></div><div id="pvList" role="listbox" aria-label="Results"></div><p class="pv-note">Ctrl K or / opens this from any page. Arrow keys move, Enter opens.</p>'; $('#pvQ').focus(); pvPal(); }
976
+ if (kind === 'pal') { o.innerHTML = '<div class="pv-pin">' + SRCH + '<input id="pvQ" type="text" placeholder="Search places, initiatives and sessions" aria-label="Search" autocomplete="off" role="combobox" aria-expanded="true" aria-controls="pvList"><kbd>Esc</kbd></div><div id="pvList" role="listbox" aria-label="Results"></div><p class="pv-note">Ctrl K or / opens this from any page. Arrow keys move, Enter opens.</p>'; $('#pvQ').focus(); pvPal(); }
1006
977
  else { o.innerHTML = '<div class="pv-hd"><h2>Needs you</h2><small id="pvN"></small><button type="button" class="ib-all" id="ibAll" hidden>Mark all seen</button></div><div id="pvList" class="pv-lst"></div>'; pvBellDraw(); pvNeeds(); ibRead(); }
1007
978
  }
1008
979
  /* A session opens in Home's chat: in place on Home, or Home opens on it (?session=<id>, read at the end of this file). Never the console. */
@@ -1010,12 +981,11 @@ const pvGo = (it) => { pvClose(); if (it.sid && pvOnBriefing()) { openSessionAt(
1010
981
  const pvRow = (it, i, sel) => `<button type="button" class="pv-row" role="option" id="pvo${i}" data-i="${i}" aria-selected="${sel}"><span class="gl">${GL[it.gl]}</span><span><b>${esc(it.t)}</b>${it.s ? `<small>${esc(it.s)}</small>` : ''}</span></button>`;
1011
982
  async function pvPal() {
1012
983
  if (!pvOv.pal) {
1013
- const [b, d, s] = await Promise.all([pvGet('/api/boards/backlog?limit=200' + pvQ('&')), pvGet('/api/core-docs?level=board' + pvQ('&')), pvGet('/api/sessions')]);
984
+ const [b, s] = await Promise.all([pvGet('/api/boards/backlog?limit=200' + pvQ('&')), pvGet('/api/sessions')]); // board documents are retired (batch 29 item 8): nothing to search
1014
985
  const miss = [];
1015
986
  const ini = b.j && b.j.ok && Array.isArray(b.j.rows) ? b.j.rows.map((r) => ({ g: 'Initiatives', gl: 'ini', t: r.title || r.id, s: [r.lane, r.stage].filter(Boolean).join(' · '), go: '/premium-initiative.html?id=' + encodeURIComponent(r.id) + (b.j.ws ? '&ws=' + encodeURIComponent(b.j.ws) + '&board=' + encodeURIComponent(b.j.board) : '') })) : (miss.push('initiatives'), []);
1016
- const docs = d.j && d.j.ok && Array.isArray(d.j.docs) ? d.j.docs.map((x) => ({ g: 'Documents', gl: 'doc', t: x.title || x.key, s: d.j.scope && d.j.scope.name ? d.j.scope.name : 'Board', go: '/premium-board.html' + pvQ('?') })) : (miss.push('documents'), []);
1017
987
  const ses = s.j && Array.isArray(s.j.sessions) ? s.j.sessions.filter((x) => !x.automatic).map((x) => ({ g: 'Sessions', gl: 'ses', t: x.name || x.id, s: [x.cwd && x.cwd !== '.' ? x.cwd : '', x.state].filter(Boolean).join(' · '), sid: x.id, go: '/premium.html?' + ['session=' + encodeURIComponent(x.id), PV_WS ? 'ws=' + encodeURIComponent(PV_WS) : ''].filter(Boolean).join('&') })) : (miss.push('sessions'), []);
1018
- pvOv.pal = { items: [...PLACES.map(([t, go]) => ({ g: 'Places', gl: 'place', t, s: 'Place', go })), ...ini, ...docs, ...ses], miss };
988
+ pvOv.pal = { items: [...PLACES.map(([t, go]) => ({ g: 'Places', gl: 'place', t, s: 'Place', go })), ...ini, ...ses], miss };
1019
989
  }
1020
990
  if (pvOv.kind === 'pal') pvPalDraw();
1021
991
  }
@@ -9,7 +9,7 @@
9
9
  * goal html of the goal card: the goal's short title with its KR chip, its range bar, and the milestones inside it
10
10
  * cards html of more cards in the top area (a product: Programs, Health budgets)
11
11
  * props { n, sub, html } the proposals that wait on the owner, folded to one row; never on a shared board (RdProgO)
12
- * tabs [{ id: 'tasks'|'initiatives'|'reports'|'documents', label, n?, sig?: 'late'|'ready', html() }]
12
+ * tabs [{ id: 'tasks'|'initiatives'|'reports'|'documents' (a program only), label, n?, sig?: 'late'|'ready', html() }]
13
13
  * shared true on a teammate's read-only copy
14
14
  * }
15
15
  * tabOf(page) the tab that opens: the viewer's last one on this page, else Initiatives (Wawan 2026-11-01: "initiative as default")
@@ -0,0 +1,82 @@
1
+ /* pm/work-kind.js — the kind of work of an initiative, on the page (batch 29 item 11; main canvas KdA, KdAP, KdV1-3, KdBd; lib/work-kind.js
2
+ * on the server). One kind per initiative: Product management, Full SDLC or Project management. A record with none reads as Product.
3
+ *
4
+ * KINDS · LABEL · SHORT · CAPTION · GLYPH the three kinds, their names, the switch's caption and their 16 px stroke glyphs
5
+ * kindOf(v) → kind 'product' for anything that is not one of the three
6
+ * glyph(kind, w) → <svg> the glyph, aria-hidden
7
+ * iconHtml(kind) → the Board's icon before a title (role img, the full name in its label and tooltip)
8
+ * segHtml(kind, lean) → New initiative's field: the pill switch (role radio), the caption, and the blue ✦ line when PMOS picked it (lean)
9
+ * pressOf(kind) → the Viewer header's press { act: 'kind', … } (cozy-viewer presses, lead: before Discuss)
10
+ * pick(btn, kind, onPick) the small menu of the three kinds under the header's press; onPick(kind) runs on a new one
11
+ *
12
+ * A hint, not a lane (D107): no gate and no stage reads it. Copy says PMOS. */
13
+
14
+ export const KINDS = ['product', 'sdlc', 'project'];
15
+ export const LABEL = { product: 'Product management', sdlc: 'Full SDLC', project: 'Project management' };
16
+ export const SHORT = { product: 'Product', sdlc: 'Full SDLC', project: 'Project' };
17
+ export const CAPTION = {
18
+ product: 'Decide what to build and whether it worked. Engineers build it; PMOS writes the specs.',
19
+ sdlc: 'From idea to shipped. PMOS also builds it, as pull requests you merge.',
20
+ project: 'Get a piece of work delivered on time. Others do the work; PMOS chases, syncs and reports.',
21
+ };
22
+ // compass · code brackets · three offset bars (KdA's G map)
23
+ export const GLYPH = {
24
+ product: '<circle cx="12" cy="12" r="8"/><path d="M15.5 8.5l-2 5-5 2 2-5z"/>',
25
+ sdlc: '<path d="M8 8l-4 4 4 4M16 8l4 4-4 4M13.5 6l-3 12"/>',
26
+ project: '<rect x="3" y="5" width="9" height="3" rx="1.5"/><rect x="8" y="10.5" width="12" height="3" rx="1.5"/><rect x="5" y="16" width="8" height="3" rx="1.5"/>',
27
+ };
28
+ // the same glyphs as one path each, for hosts that take a path (cozy-viewer presses)
29
+ export const PATH = {
30
+ product: 'M12 4a8 8 0 1 0 0 16a8 8 0 1 0 0-16M15.5 8.5l-2 5-5 2 2-5z',
31
+ sdlc: 'M8 8l-4 4 4 4M16 8l4 4-4 4M13.5 6l-3 12',
32
+ project: 'M4.5 5h6a1.5 1.5 0 0 1 0 3h-6a1.5 1.5 0 0 1 0-3zM9.5 10.5h9a1.5 1.5 0 0 1 0 3h-9a1.5 1.5 0 0 1 0-3zM6.5 16h5a1.5 1.5 0 0 1 0 3h-5a1.5 1.5 0 0 1 0-3z',
33
+ };
34
+ import { openPop, closePop } from './hi-pop.js';
35
+
36
+ const SPARK = 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z';
37
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
38
+
39
+ export const kindOf = (v) => (KINDS.includes(v) ? v : 'product');
40
+ export const glyph = (k, w = 16) => `<svg width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${GLYPH[kindOf(k)]}</svg>`;
41
+
42
+ export function iconHtml(k) {
43
+ const n = LABEL[kindOf(k)];
44
+ return `<span class="kd-g" role="img" aria-label="${esc(n)}" title="${esc(n)}">${glyph(k)}</span>`;
45
+ }
46
+
47
+ export function segHtml(k0, lean) {
48
+ const k = kindOf(k0);
49
+ const btn = (x) => `<button type="button" role="radio" aria-checked="${x === k}" aria-pressed="${x === k}" data-kind="${x}">${glyph(x)}${esc(SHORT[x])}</button>`;
50
+ return `<span class="bd-flbl" id="nwKindL">Kind of work</span><div class="bd-seg kd-seg" role="radiogroup" aria-labelledby="nwKindL">${KINDS.map(btn).join('')}</div>`
51
+ + `<p class="kd-cap"><b>${esc(LABEL[k])}.</b> ${esc(CAPTION[k])}</p>`
52
+ + (lean ? `<p class="kd-lean"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${SPARK}"/></svg><span>PMOS picked this from the name. Tap another kind to change it.</span></p>` : '');
53
+ }
54
+
55
+ export function pressOf(k) {
56
+ const n = LABEL[kindOf(k)];
57
+ return { act: 'kind', label: 'Kind of work: ' + n + '. Tap to change.', icon: PATH[kindOf(k)], lead: true };
58
+ }
59
+
60
+ /** The header's menu of the three kinds (the initiative's shared popover, pm/hi-pop.js; a sheet on a phone). onPick(kind) runs on a new one. */
61
+ export function pick(btn, k0, onPick) {
62
+ const k = kindOf(k0);
63
+ const html = KINDS.map((x) => `<button type="button" class="hi-mi${x === k ? ' on' : ''}" role="menuitemradio" aria-checked="${x === k}" data-kind="${x}" title="${esc(CAPTION[x])}">${glyph(x)}<span>${esc(LABEL[x])}</span></button>`).join('');
64
+ openPop(btn, 'kind', html, (b) => { const nk = b.dataset.kind; closePop(); if (nk && nk !== k && onPick) onPick(nk); }, { menu: true, label: 'Kind of work', focus: '.hi-mi.on' });
65
+ }
66
+
67
+ /** The Viewer's change (KdV1-3): POST /api/initiatives/kind, then the toast with Undo and a new read. h: { pmPost, ws, id, from, to, toast(text,
68
+ * undo?), apply(kind) (the page shows the new kind at once: the rows are read again in the background), reload() }. → true when it changed.
69
+ * Only the record's kind line changes; lines someone wrote in the experiment stay as written. */
70
+ export async function change(h) {
71
+ const r = await h.pmPost('/api/initiatives/kind', { ws: h.ws || undefined, id: h.id, kind: h.to }).catch(() => null);
72
+ if (!r || !r.ok) { if (h.toast) h.toast((r && r.error) || 'The kind of work was not changed.'); return false; }
73
+ const back = r.from || kindOf(h.from);
74
+ if (h.apply) h.apply(kindOf(h.to));
75
+ if (h.toast) h.toast('Kind of work: ' + LABEL[kindOf(h.to)] + '.', async () => {
76
+ const u = await h.pmPost('/api/initiatives/kind', { ws: h.ws || undefined, id: h.id, kind: back }).catch(() => null);
77
+ if (u && u.ok && h.apply) h.apply(back);
78
+ if (h.reload) await h.reload();
79
+ });
80
+ if (h.reload) await h.reload();
81
+ return true;
82
+ }
@@ -194,7 +194,7 @@ const SPONSORS = '# Inline login slips to early December unless passkeys move to
194
194
  await pg.goto(BASE + '/premium.html?ini=product');
195
195
  // batch 21 item 2: the product page is the same ONE page as a program's (prog-page.js): no toggle, Initiatives open first
196
196
  const pd = await until(() => pg.evaluate(() => { const v = document.querySelector('#czViewer .pv'); if (!v) return null; return { goal: !!v.querySelector('.pv-gc'), tabs: [...v.querySelectorAll('[data-pv="tab"]')].map((t) => t.dataset.k + (t.getAttribute('aria-selected') === 'true' ? '*' : '')), over: v.scrollWidth > v.clientWidth + 1, toggle: !!document.querySelector('#czViewer [data-cz-vw-p="dash"]') }; }), 15000);
197
- ok('P (' + nm + ') the product page is the one page: the goal card, Tasks, Initiatives (open first), Reports, Documents; no toggle', !!pd && pd.goal && pd.tabs.join() === 'tasks,initiatives*,reports,documents' && !pd.toggle && !pd.over, JSON.stringify(pd));
197
+ ok('P (' + nm + ') the product page is the one page: the goal card, Tasks, Initiatives (open first), Reports (batch 29 item 8 took Documents off); no toggle', !!pd && pd.goal && pd.tabs.join() === 'tasks,initiatives*,reports' && !pd.toggle && !pd.over, JSON.stringify(pd));
198
198
  await pg.click('#czViewer [data-pv="tab"][data-k="reports"]');
199
199
  ok('P (' + nm + ') the Reports tab has no Metrics review row: it is Intelligence › Delivery trends now', await pg.evaluate(() => !document.querySelector('#czViewer [data-hp="metrics"]')));
200
200
  ok('P (' + nm + ') read as a page to read (scope product)', gets.some((g) => g.scope === 'product' && g.from === 'read'), JSON.stringify(gets));
@@ -3208,18 +3208,9 @@ const metricReadTick = () => { try { metricReadRuns.tick({}); } catch (e) { warn
3208
3208
  // Grill that listens for it) needs no page open (lib/forecast-tick.js). PMOS_FORECAST=off stops it.
3209
3209
  const forecastTicker = require('./lib/forecast-tick.js').create({ ctx: { getWs, stateDirFor, workspaceList: () => [...workspaces.values()], runtimeDir: STATE, invalidateNeedsAgg, metricReadHours, proSettings, selfRoot: EMBEDDED_SELF ? SELF_ROOT : null } });
3210
3210
  const forecastTick = () => { forecastTicker.tick().catch((e) => warnWriteFail('forecast tick', e)); };
3211
- // core-documents: every 30 minutes inside the working hours, ONE headless run per due core document of the portfolio and of each board
3212
- // (at most 3 at once, once per document per day, never one the PM writes). The run writes a draft with `pmos coredoc write`; nothing is sent.
3213
- // PMOS_CORE_DOCS_NOW (a local date-time) fixes its clock for the suites.
3214
- const coreDocsTick = () => {
3215
- let m; try { m = require('./lib/routes-core-docs.js'); } catch { return; }
3216
- const t = process.env.PMOS_CORE_DOCS_NOW ? Date.parse(process.env.PMOS_CORE_DOCS_NOW) : NaN;
3217
- try {
3218
- m.tick({ getWs, stateDirFor, workspaceList: () => [...workspaces.values()], runtimeDir: STATE, selfRoot: EMBEDDED_SELF ? SELF_ROOT : null, initiativeIndex,
3219
- spawnSession: orchSpawn.spawn, stopSession: (id) => { const x = sessions.get(String(id || '')); if (x && x.child) stopHeadless(x); }, invalidateNeedsAgg,
3220
- proSettings, inQuiet: (now, quiet) => proactiveLib.inQuietHours(now, quiet), deepOpen: (st, now) => deepOpenNow(now), isLead: (w) => isPlanNeedsTree(w) }, Number.isFinite(t) ? { now: t } : {});
3221
- } catch (e) { warnWriteFail('core documents tick', e); }
3222
- };
3211
+ // core-documents: the tick drafted the due portfolio and board documents. Those are retired (feedback batch 29 item 8), so it drafts
3212
+ // nothing; the step stays so the queue and the Sources row keep their shape. An initiative document is drafted by Draft it or the driver.
3213
+ const coreDocsTick = () => {};
3223
3214
  /** One needs-you item, so it shows in the bell. */
3224
3215
  function tellNeed(ws, runId, label, question) {
3225
3216
  const w = getWs(ws || '') || homeWorkspace(); const nf = w ? needsFileFor(w) : null; if (!nf) return;
@@ -63,7 +63,7 @@
63
63
  "product-list-linked.test.js",
64
64
  "briefing-premium-sources.test.js",
65
65
  "briefing-premium-drafts.test.js",
66
- "agent-inbox.test.js",
66
+ "agent-inbox.test.js", "kind-of-work.test.js",
67
67
  "session-rail.test.js",
68
68
  "briefing-premium-metrics.test.js",
69
69
  "trends-review.test.js",
@@ -1,5 +1,5 @@
1
1
  {
2
- "_comment": "premium-uncovered-features, Board: a new initiative's Why, material and first questions (lib/board-grill.js, POST/GET /api/board-grill) and the Documents tab's edit history (GET /api/board-docs). Node, scratch state folder.",
2
+ "_comment": "premium-uncovered-features, Board: a new initiative's Why, material and first questions (lib/board-grill.js, POST/GET /api/board-grill) (GET /api/board-docs is retired with the board documents, batch 29 item 8). Node, scratch state folder.",
3
3
  "modules": [
4
4
  "board-grill.test.js"
5
5
  ],