create-pmos 0.730.0 → 0.732.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 (72) hide show
  1. package/package.json +45 -45
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/design-system/brand/icons.json +59 -0
  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 +44 -0
  8. package/workspace/design-system/brand/icons.json +59 -0
  9. package/workspace/guide/agent-capabilities.md +1 -0
  10. package/workspace/guide/cli.md +10 -0
  11. package/workspace/guide/index.md +1 -0
  12. package/workspace/guide/initiatives-and-next-steps.md +23 -1
  13. package/workspace/guide/layout.md +3 -1
  14. package/workspace/guide/positioning.md +33 -0
  15. package/workspace/lib/board-premium.js +10 -0
  16. package/workspace/lib/customer-signals.js +207 -0
  17. package/workspace/lib/headless.js +1 -0
  18. package/workspace/lib/icon-check.js +280 -0
  19. package/workspace/lib/job-graph.js +1 -0
  20. package/workspace/lib/pmos-verbs.js +3 -0
  21. package/workspace/lib/positioning-draft.js +225 -0
  22. package/workspace/lib/principles-cli.js +109 -0
  23. package/workspace/lib/principles.js +165 -0
  24. package/workspace/lib/route-modules.js +1 -0
  25. package/workspace/lib/routes-boards.js +5 -1
  26. package/workspace/lib/routes-principles.js +109 -0
  27. package/workspace/lib/routes-strategy-card.js +33 -2
  28. package/workspace/package-lock.json +2 -2
  29. package/workspace/package.json +1 -1
  30. package/workspace/public/pm/agenda-live.js +1 -1
  31. package/workspace/public/pm/bd-positioning.js +91 -0
  32. package/workspace/public/pm/bd-principles.js +64 -0
  33. package/workspace/public/pm/bd-span.js +1 -1
  34. package/workspace/public/pm/bd-sprint-ds.js +1 -1
  35. package/workspace/public/pm/bd-sprint.js +1 -1
  36. package/workspace/public/pm/bd-strategy.js +10 -3
  37. package/workspace/public/pm/bd-views.js +36 -3
  38. package/workspace/public/pm/bd-work.js +1 -1
  39. package/workspace/public/pm/cozy-board.css +14 -0
  40. package/workspace/public/pm/cozy-day-pick.js +1 -1
  41. package/workspace/public/pm/cozy-events-view.js +1 -1
  42. package/workspace/public/pm/cozy-popup.js +8 -22
  43. package/workspace/public/pm/cozy-rec-present.js +1 -1
  44. package/workspace/public/pm/cozy-viewer.js +4 -3
  45. package/workspace/public/pm/goal-chat.js +1 -1
  46. package/workspace/public/pm/home-chat.js +1 -1
  47. package/workspace/public/pm/home-rec-row.js +1 -1
  48. package/workspace/public/pm/home-today.js +3 -3
  49. package/workspace/public/pm/ini-agent.js +1 -1
  50. package/workspace/public/pm/ini-edit.js +2 -2
  51. package/workspace/public/pm/ini-groups.js +1 -1
  52. package/workspace/public/pm/ini-versions.js +1 -1
  53. package/workspace/public/pm/ini-view.js +2 -2
  54. package/workspace/public/pm/intent.js +2 -2
  55. package/workspace/public/pm/okr-list.js +2 -2
  56. package/workspace/public/pm/pinned-views.js +1 -1
  57. package/workspace/public/pm/premium-board.js +2 -0
  58. package/workspace/public/pm/premium-insights.js +3 -3
  59. package/workspace/public/pm/premium-mtg-present.js +2 -2
  60. package/workspace/public/pm/premium-mtg-replay.js +1 -1
  61. package/workspace/public/pm/premium-shell.js +1 -1
  62. package/workspace/public/pm/premium-vw-mtg.js +1 -1
  63. package/workspace/public/pm/premium-vw-slides.js +3 -3
  64. package/workspace/public/pm/task-card.js +1 -1
  65. package/workspace/public/pm/wf-page.js +1 -1
  66. package/workspace/public/premium-board.html +2 -0
  67. package/workspace/public/premium-events.html +2 -2
  68. package/workspace/skills/principles-draft.skill +23 -0
  69. package/workspace/test-lists/icon-check.json +9 -0
  70. package/workspace/test-lists/positioning-draft.json +9 -0
  71. package/workspace/test-lists/principles.json +9 -0
  72. package/workspace/test-lists/roadmap-signal-count.json +9 -0
@@ -0,0 +1,109 @@
1
+ 'use strict';
2
+ /* routes-principles.js — a product's principles over HTTP, and the run that drafts them by itself (bet A352, initiative product-principles-draft).
3
+ * The store is lib/principles.js (principles.jsonl in the product's records folder, lib/records-dir.js); the verb is `pmos principles`.
4
+ *
5
+ * GET /api/principles?ws=<id> → { ok, items, decisions, drafting } items: kept, then open drafts; decisions: how many it may cite
6
+ * POST /api/principles { ws, act, id } → { ok, item } | 400 act ∈ keep · drop · undo
7
+ *
8
+ * THE DRAFTING RUN. When a GET finds a product with MIN_DECISIONS or more decisions and no principle line at all, it starts ONE lean background
9
+ * run of the built-in `principles-draft` skill (headless kind `skill`, `claude -p` under the PM's own login), whose only write is
10
+ * `pmos principles draft`. At most one start per product per day (kept in <state folder>/principles-seed.json, so a restart does not start
11
+ * it again) and one run at a time. Off with `pmos ai off principles-draft`, PMOS_HEADLESS=off, or on a scratch server (PMOS_STATE_DIR set).
12
+ *
13
+ * WHO WRITES. A page press: pm-guard requirePagePress checks the page's Origin and launch nonce. The chat writes with `pmos principles`.
14
+ * Nothing here is sent anywhere. */
15
+ const fs = require('fs');
16
+ const path = require('path');
17
+ const guard = require('./pm-guard.js');
18
+ const P = require('./principles.js');
19
+ const { recordsDirFor } = require('./records-dir.js');
20
+
21
+ const JOB = 'principles-draft';
22
+ const SEED_FILE = 'principles-seed.json';
23
+ const RETRY_MS = 24 * 3600000;
24
+ const SKILL = path.join(__dirname, '..', 'skills', 'principles-draft.skill');
25
+ const CHECKOUT = path.join(__dirname, '..', '..');
26
+
27
+ function wsOf(ctx, ws) { try { return ctx && typeof ctx.getWs === 'function' ? ctx.getWs(ws || null) : null; } catch { return null; } }
28
+ /** The product checkout whose decisions are read. */
29
+ const rootFor = (ctx, w) => (ctx && ctx.repoRoot) || (w && w.root) || CHECKOUT;
30
+
31
+ /** The seed: deps { env, headlessOff() → bool, aiOff() → reason | null, stateDirFor(w) → dir | null, start(w, { onDone }) → { ok, session?, error? } }. */
32
+ function createSeed(deps) {
33
+ const running = new Set();
34
+ const fileOf = (w) => { const d = deps.stateDirFor ? deps.stateDirFor(w) : null; return d ? path.join(d, SEED_FILE) : null; };
35
+ const readAll = (f) => { try { const o = JSON.parse(fs.readFileSync(f, 'utf8')); return o && typeof o === 'object' ? o : {}; } catch { return {}; } };
36
+ function seed(w, { now = Date.now() } = {}) {
37
+ if (!w || !w.id) return { started: false, why: 'no product' };
38
+ const env = deps.env || {};
39
+ if (String(env.PMOS_STATE_DIR || '').trim()) return { started: false, why: 'scratch server' };
40
+ if (deps.headlessOff && deps.headlessOff()) return { started: false, why: 'background runs are off' };
41
+ let ai = null; try { ai = deps.aiOff ? deps.aiOff() : null; } catch { ai = null; }
42
+ if (ai) return { started: false, why: ai };
43
+ if (running.has(w.id)) return { started: false, why: 'running' };
44
+ const f = fileOf(w);
45
+ if (!f) return { started: false, why: 'no state folder' };
46
+ const all = readAll(f);
47
+ const last = Date.parse(all[w.id] || '');
48
+ if (Number.isFinite(last) && now - last < RETRY_MS) return { started: false, why: 'tried in the last day' };
49
+ try { all[w.id] = new Date(now).toISOString(); fs.mkdirSync(path.dirname(f), { recursive: true }); fs.writeFileSync(f, JSON.stringify(all) + '\n'); } catch { return { started: false, why: 'could not record the start' }; }
50
+ let r = null;
51
+ try { r = deps.start(w, { onDone: () => running.delete(w.id) }); } catch { r = null; }
52
+ if (!r || !r.ok) return { started: false, why: (r && r.error) || 'the run could not start' };
53
+ running.add(w.id);
54
+ return { started: true, session: r.session || null };
55
+ }
56
+ return { seed, running: (id) => running.has(id) };
57
+ }
58
+
59
+ let shared = null;
60
+ function seedFor(ctx) {
61
+ if (ctx && ctx.principlesSeed) return ctx.principlesSeed;
62
+ if (shared) return shared;
63
+ if (!ctx || typeof ctx.spawnSession !== 'function' || typeof ctx.stateDirFor !== 'function') return null;
64
+ shared = createSeed({
65
+ env: process.env,
66
+ headlessOff: () => require('./headless.js').switchedOff(process.env),
67
+ aiOff: () => require('./ai-guard.js').off(JOB, { settingsDir: ctx.runtimeDir || null }),
68
+ stateDirFor: (w) => ctx.stateDirFor(w, { create: true }),
69
+ start: (w, { onDone } = {}) => {
70
+ let prompt = '';
71
+ try { prompt = require('./skill-store.js').parseSkill(fs.readFileSync(SKILL, 'utf8')).body || ''; } catch { prompt = ''; }
72
+ if (!prompt) return { ok: false, error: 'the principles-draft skill is not installed' };
73
+ const s = ctx.spawnSession({ name: 'Drafting the principles', agent: 'claude', ws: w.id, origin: JOB + ':' + w.id, initialInput: prompt + '\r', autoDelete: undefined, onDone,
74
+ modelAsk: { scheduleTier: null, skillTier: null, skill: JOB } });
75
+ if (!s || s.state === 'exited') return { ok: false, error: (s && s.note) || 'the run could not start' };
76
+ return { ok: true, session: s.id };
77
+ },
78
+ });
79
+ return shared;
80
+ }
81
+
82
+ const pub = (x) => ({ id: x.id, state: x.state, own: !!x.own, text: x.text, why: x.why || '', sources: x.sources });
83
+
84
+ async function handle(req, res, url, ctx) {
85
+ if (url.pathname !== '/api/principles') return false;
86
+ const send = (status, body) => { ctx.json(res, body, status); return true; };
87
+ if (req.method === 'GET') {
88
+ const wsId = url.searchParams.get('ws') || null;
89
+ const w = wsOf(ctx, wsId);
90
+ const dir = recordsDirFor(ctx, wsId);
91
+ const lines = P.readLines(dir);
92
+ const decisions = P.decisionsOf(rootFor(ctx, w)).length;
93
+ const seeder = seedFor(ctx);
94
+ if (!lines.length && decisions >= P.MIN_DECISIONS && seeder && w) seeder.seed(w);
95
+ const items = P.fold(lines).filter((x) => x.state !== 'dropped');
96
+ items.sort((a, b) => (a.state === b.state ? 0 : a.state === 'kept' ? -1 : 1));
97
+ return send(200, { ok: true, items: items.map(pub), decisions, drafting: !!(seeder && w && seeder.running && seeder.running(w.id)) });
98
+ }
99
+ if (req.method !== 'POST') return send(405, { ok: false, error: 'GET or POST' });
100
+ const rd = await ctx.readJson(req);
101
+ if (!rd.ok) return send(400, { ok: false, error: 'the body is not JSON' });
102
+ const body = rd.body || {};
103
+ const g = guard.requirePagePress(req, body);
104
+ if (!g.ok) return send(g.status, { ok: false, error: g.error });
105
+ const r = P.act(recordsDirFor(ctx, body.ws || null), String(body.act || ''), body.id, { by: (g.actor && g.actor.by) || 'pm' });
106
+ return r.ok ? send(200, { ok: true, item: pub(r.item) }) : send(400, { ok: false, error: r.error });
107
+ }
108
+
109
+ module.exports = { prefixes: ['/api/principles'], handle, createSeed, seedFor, JOB, SEED_FILE, RETRY_MS };
@@ -5,10 +5,16 @@
5
5
  * GET /api/strategy-card?ws=<id>[&board=<id>] → { ok, card, labels, complete, notes } notes: null while the Board is still being read
6
6
  * POST /api/strategy-card { ws, fields } → { ok, card, complete } | 400 when no known line is named
7
7
  *
8
+ * GET /api/positioning?ws=<id> → { ok, complete, missing, kept, draft } draft: the kept draft for this strategy, pending, or null
9
+ * POST /api/positioning { ws, again } → { ok, draft } starts a draft (lib/positioning-draft.js; idea A328): pending, then ready
10
+ * POST /api/positioning/keep { ws, line } → { ok, line, kept } line: { kind, text, cites, from } (from: the drafted text)
11
+ * POST /api/positioning/drop { ws, id } → { ok, kept }
12
+ *
8
13
  * The notes come from the Board's own backlog route (GET /api/boards/backlog, every view, the new-work stages), so they read the rows the Board draws.
9
14
  * WHO WRITES. A page press: pm-guard requirePagePress checks the page's Origin and launch nonce. Nothing here is sent anywhere. */
10
15
  const guard = require('./pm-guard.js');
11
16
  const SC = require('./strategy-card.js');
17
+ const PD = require('./positioning-draft.js');
12
18
  const { recordsDirFor } = require('./records-dir.js');
13
19
 
14
20
  /** GET a route module's own handler, as routes-board-premium.js does, and return { status, body }. */
@@ -29,9 +35,34 @@ async function rowsOf(req, ctx, ws, board) {
29
35
  } catch { return null; }
30
36
  }
31
37
 
38
+ /** The positioning part (idea A328): drafts from the five lines, and the lines the PM keeps. */
39
+ async function positioning(req, res, url, ctx, send) {
40
+ const sub = url.pathname.slice('/api/positioning'.length);
41
+ if (!['', '/keep', '/drop'].includes(sub)) return false;
42
+ if (req.method === 'GET' && !sub) {
43
+ const dir = recordsDirFor(ctx, url.searchParams.get('ws') || null), card = SC.read(dir);
44
+ return send(200, { ok: true, complete: SC.complete(card), missing: PD.missingOf(card), kept: PD.read(dir, card), draft: PD.peek(ctx, card) });
45
+ }
46
+ if (req.method !== 'POST') return send(405, { ok: false, error: sub ? 'POST' : 'GET or POST' });
47
+ const rd = await ctx.readJson(req);
48
+ if (!rd.ok) return send(400, { ok: false, error: 'the body is not JSON' });
49
+ const body = rd.body || {};
50
+ const g = guard.requirePagePress(req, body);
51
+ if (!g.ok) return send(g.status, { ok: false, error: g.error });
52
+ const dir = recordsDirFor(ctx, body.ws || null), card = SC.read(dir);
53
+ if (!sub) {
54
+ const d = PD.draft(ctx, card, { again: !!body.again });
55
+ if (d.state === 'missing') return send(400, { ok: false, error: 'Write all five strategy lines first. Missing: ' + d.missing.map((k) => SC.LABELS[k]).join(', ') + '.', missing: d.missing });
56
+ return send(200, { ok: true, draft: d });
57
+ }
58
+ const r = sub === '/keep' ? PD.keep(dir, body.line || {}, card) : PD.drop(dir, String(body.id || ''));
59
+ return r.ok ? send(200, { ok: true, line: r.line, kept: PD.read(dir, card) }) : send(400, { ok: false, error: r.error });
60
+ }
61
+
32
62
  async function handle(req, res, url, ctx) {
33
- if (url.pathname !== '/api/strategy-card') return false;
34
63
  const send = (status, body) => { ctx.json(res, body, status); return true; };
64
+ if (url.pathname.startsWith('/api/positioning')) return positioning(req, res, url, ctx, send);
65
+ if (url.pathname !== '/api/strategy-card') return false;
35
66
  if (req.method === 'GET') {
36
67
  const ws = url.searchParams.get('ws') || null;
37
68
  const card = SC.read(recordsDirFor(ctx, ws));
@@ -50,4 +81,4 @@ async function handle(req, res, url, ctx) {
50
81
  return r.ok ? send(200, { ok: true, card: r.card, complete: SC.complete(r.card) }) : send(400, { ok: false, error: r.error });
51
82
  }
52
83
 
53
- module.exports = { prefixes: ['/api/strategy-card'], handle };
84
+ module.exports = { prefixes: ['/api/strategy-card', '/api/positioning'], handle }; // /api/positioning: its own first segment, so a change to it does not reach every page that reads the strategy card
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.730.0",
3
+ "version": "0.732.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.730.0",
9
+ "version": "0.732.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.730.0",
3
+ "version": "0.732.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",
@@ -15,7 +15,7 @@ const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&':
15
15
  const pad = (n) => String(n).padStart(2, '0');
16
16
  const hm = (ms) => { const d = new Date(ms); return Number.isFinite(d.getTime()) ? pad(d.getHours()) + ':' + pad(d.getMinutes()) : ''; };
17
17
  const svg = (d, n = 16, w = 1.9) => `<svg width="${n}" height="${n}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${w}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${d}"/></svg>`;
18
- const P = { check: 'M5 12.5l4.5 4.5L19 7.5', undo: 'M9 14L4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11',
18
+ const P = { check: 'M5 12.5l4.5 4.5L19 7.5', undo: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3',
19
19
  spark: 'M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z' };
20
20
 
21
21
  export function ensureCss() {
@@ -0,0 +1,91 @@
1
+ /* pm/bd-positioning.js — the product's positioning statement and key messages, drafted from its five-line strategy (idea A328,
2
+ * initiative positioning-draft). It lives inside the strategy card (pm/bd-strategy.js) once all five lines are written.
3
+ *
4
+ * mount(host, { ws, say }) → draws the part into `host`
5
+ *
6
+ * Built only from Komorebi parts: pm-btn (icon only), pm-input to edit a drafted line, pm-li for each line, pm-meta for its source.
7
+ * It reads and writes /api/positioning (lib/routes-strategy-card.js) and nothing else.
8
+ * · Nothing kept, no draft: one quiet line, "Positioning · not drafted yet", and the ✦ that drafts.
9
+ * · Kept lines: each with the strategy lines it comes from; a line whose strategy line changed since says so. ✕ drops it.
10
+ * · A draft: each line in an input the PM can edit, with where it comes from, ✓ to keep it and ✕ to leave it. Lines put together
11
+ * without AI say so once.
12
+ * The controls carry ids (bdPosDraft, bdPosKeep, bdPosDrop) so the local use log counts their use (the bet's kill line). */
13
+ import { pmPost } from './http.js';
14
+
15
+ const API = '/api/positioning';
16
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
17
+ const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
18
+ const I = { spark: 'M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z', ok: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', again: 'M4 12a8 8 0 0 1 14-5.3M20 4v5h-5M20 12a8 8 0 0 1-14 5.3M4 20v-5h5' };
19
+ const LABELS = { for: 'Who it is for', problem: 'The problem', bet: 'The bet', win: 'How we win', wont: "What we won't do" };
20
+ const btn = (id, icon, label, kind, data = '') => `<button type="button" class="pm-btn${kind ? ' ' + kind : ''}" id="${id}"${data} aria-label="${esc(label)}" title="${esc(label)}">${SV(icon)}</button>`;
21
+
22
+ /** "From The bet: One weekly plan per child · Who it is for: Parents" */
23
+ export const fromLine = (l) => 'From ' + (l.cites || []).map((c) => `${LABELS[c] || c}: ${(l.quotes && l.quotes[c]) || ''}`).join(' · ');
24
+ const kindWord = (l) => (l.kind === 'positioning' ? 'Positioning' : 'Message');
25
+
26
+ /** The part's markup. state = { kept, draft, busy }. Pure, so the test reads it. */
27
+ export function partHtml(state) {
28
+ const kept = Array.isArray(state.kept) ? state.kept : [];
29
+ const d = state.draft && state.draft.state === 'ready' ? state.draft : null;
30
+ const pending = state.busy || (state.draft && state.draft.state === 'pending');
31
+ const keptIds = new Set(kept.map((l) => l.id));
32
+ const fresh = d ? d.lines.filter((l) => !keptIds.has(l.id) && !(state.left || []).includes(l.id)) : [];
33
+ const head = `<div class="head"><h4 class="pm-h-sm" style="flex:1">Positioning${kept.length || fresh.length || pending ? '' : ' <span class="pm-meta">· not drafted yet</span>'}${pending ? ' <span class="pm-meta">· drafting…</span>' : ''}</h4>`
34
+ + (pending ? '' : btn('bdPosDraft', kept.length || d ? I.again : I.spark, kept.length || d ? 'Draft again from the strategy' : 'Draft positioning from the strategy')) + '</div>';
35
+ const keptRows = kept.map((l) => `<div class="pm-li" role="listitem" data-pos="${esc(l.id)}"><span class="txt"><span class="t">${esc(l.text)}</span><span class="w">${esc(kindWord(l))} · ${esc(fromLine(l))}${l.stale ? ' · the strategy changed since you kept this' : ''}</span></span>${btn('bdPosDrop', I.x, 'Drop this line', 'outline', ` data-id="${esc(l.id)}"`)}</div>`).join('');
36
+ const draftRows = fresh.map((l) => `<div class="pm-li" role="listitem" data-draft="${esc(l.id)}"><span class="txt"><input class="pm-input" data-text="${esc(l.id)}" maxlength="200" value="${esc(l.text)}" aria-label="${esc(kindWord(l))}" /><span class="w">${esc(kindWord(l))} · ${esc(fromLine(l))}</span></span>${btn('bdPosKeep', I.ok, 'Keep this line', 'primary', ` data-id="${esc(l.id)}"`)}${btn('bdPosLeave', I.x, 'Leave this line', 'outline', ` data-id="${esc(l.id)}"`)}</div>`).join('');
37
+ const note = fresh.length && d.by === 'template' ? '<p class="pm-meta">Put together from the strategy word for word, without AI. Edit before you keep.</p>' : '';
38
+ return `<div aria-label="Positioning">${head}${keptRows ? `<div role="list">${keptRows}</div>` : ''}${note}${draftRows ? `<div role="list">${draftRows}</div>` : ''}</div>`;
39
+ }
40
+
41
+ /** Draw the part into `host` and wire its presses. */
42
+ export async function mount(host, opts = {}) {
43
+ if (!host) return;
44
+ const { ws = null, say = null } = opts;
45
+ const q = ws ? '?ws=' + encodeURIComponent(ws) : '';
46
+ const get = async () => { try { return await (await fetch(API + q, { credentials: 'same-origin' })).json(); } catch { return null; } };
47
+ const r = await get();
48
+ if (!r || !r.ok || !r.complete) { host.hidden = true; host.innerHTML = ''; return; } // an extra: no strategy, no part
49
+ const S = { kept: r.kept, draft: r.draft, busy: false, left: [] };
50
+ const draw = () => { host.hidden = false; host.innerHTML = partHtml(S); };
51
+ let tries = 0;
52
+ const poll = async () => {
53
+ if (!host.isConnected) return;
54
+ const x = await get();
55
+ if (x && x.ok) { S.kept = x.kept; S.draft = x.draft; }
56
+ if (S.draft && S.draft.state === 'pending' && ++tries < 60) setTimeout(poll, 3000); else S.busy = false;
57
+ draw();
58
+ };
59
+ host.onclick = async (e) => {
60
+ const b = e.target.closest('button'); if (!b) return;
61
+ const id = b.dataset.id;
62
+ if (b.id === 'bdPosDraft') {
63
+ S.busy = true; S.left = []; draw();
64
+ const res = await pmPost(API, { ws, again: !!S.draft }).catch(() => null);
65
+ if (!res || !res.ok) { S.busy = false; draw(); if (say) say((res && res.error) || 'The draft did not start.'); return; }
66
+ S.draft = res.draft; tries = 0;
67
+ if (S.draft.state === 'pending') setTimeout(poll, 2000); else S.busy = false;
68
+ draw();
69
+ } else if (b.id === 'bdPosKeep') {
70
+ const l = S.draft && S.draft.lines.find((x) => x.id === id); if (!l) return;
71
+ const input = host.querySelector(`[data-text="${CSS.escape(id)}"]`);
72
+ const res = await pmPost(API + '/keep', { ws, line: { kind: l.kind, text: input ? input.value : l.text, cites: l.cites, from: l.text } }).catch(() => null);
73
+ if (!res || !res.ok) { if (say) say((res && res.error) || 'The line was not kept.'); return; }
74
+ S.kept = res.kept; S.left.push(id); draw();
75
+ const kid = res.line && res.line.id;
76
+ if (say) say('Line kept.', async () => { if (kid) await pmPost(API + '/drop', { ws, id: kid }).catch(() => null); S.left = S.left.filter((x) => x !== id); poll(); });
77
+ } else if (b.id === 'bdPosLeave') { S.left.push(id); draw(); }
78
+ else if (b.id === 'bdPosDrop') {
79
+ const was = S.kept.find((x) => x.id === id);
80
+ const res = await pmPost(API + '/drop', { ws, id }).catch(() => null);
81
+ if (!res || !res.ok) { if (say) say((res && res.error) || 'The line was not dropped.'); return; }
82
+ S.kept = res.kept; draw();
83
+ if (say && was) say('Line dropped.', async () => { await pmPost(API + '/keep', { ws, line: { kind: was.kind, text: was.text, cites: was.cites, edited: was.edited } }).catch(() => null); poll(); });
84
+ }
85
+ };
86
+ host.onkeydown = (e) => {
87
+ if (e.key === 'Enter' && e.target.matches('[data-text]')) { e.preventDefault(); const k = e.target.closest('.pm-li').querySelector('#bdPosKeep'); if (k) k.click(); }
88
+ };
89
+ draw();
90
+ if (S.draft && S.draft.state === 'pending') { S.busy = true; draw(); setTimeout(poll, 2000); }
91
+ }
@@ -0,0 +1,64 @@
1
+ /* pm/bd-principles.js — the product's principles, drafted by PMOS from its past decisions, below the strategy on its Board (bet A352,
2
+ * initiative product-principles-draft).
3
+ *
4
+ * mount(host, { ws, single, say }) → draws the block into `host`; a Board that shows several products at once shows none
5
+ *
6
+ * Built only from Komorebi parts: a Detail block (pm-block, its head), pm-li rows, pm-btn icon buttons. It reads and writes GET and POST
7
+ * /api/principles (lib/routes-principles.js) and nothing else.
8
+ * · Kept principles first, each with the decisions it came from.
9
+ * · Drafts after them, each with ✦, its why, its sources, and ✓ keep / ✕ drop. A press offers Undo in the Board's toast.
10
+ * · While PMOS drafts them: one quiet line. No principle and no draft: no block (zero is silence).
11
+ * The controls are named bdPrinKeep and bdPrinDrop (the button's name, its value the principle's id; one per row, so no id) and each press
12
+ * notes that name in the local use log (noteUse), which counts their use (the bet's kill line). */
13
+ import { pmPost } from './http.js';
14
+ import { noteUse } from './use-log.js';
15
+
16
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
17
+ const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
18
+ const I = { scale: 'M12 4v16M5 20h14M6 8h12M6 8l-3 6a3 3 0 0 0 6 0zM18 8l-3 6a3 3 0 0 0 6 0z', ok: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18' };
19
+
20
+ /** "from D12, D31". */
21
+ export const fromLine = (sources) => (Array.isArray(sources) && sources.length ? 'from ' + sources.join(', ') : '');
22
+
23
+ /** The block's markup. state = { items, drafting }. Pure, so the test reads it. '' when there is nothing to show. */
24
+ export function blockHtml(state) {
25
+ const items = Array.isArray(state && state.items) ? state.items : [];
26
+ const kept = items.filter((x) => x.state === 'kept'), open = items.filter((x) => x.state === 'open');
27
+ if (!kept.length && !open.length) {
28
+ return state && state.drafting ? `<section class="pm-block flat" aria-label="Principles"><div class="head">${SV(I.scale)}<h3 class="pm-h-sm" style="flex:1">Principles <span class="pm-meta">· PMOS is drafting them from your decisions</span></h3></div></section>` : '';
29
+ }
30
+ const btn = (name, icon, label, x, kind) => `<button type="button" class="pm-btn${kind ? ' ' + kind : ''}" name="${name}" value="${esc(x.id)}" aria-label="${esc(label)}" title="${esc(label)}">${SV(icon)}</button>`;
31
+ const row = (x) => {
32
+ const from = fromLine(x.sources);
33
+ const sub = [x.state === 'open' ? x.why : '', from].filter(Boolean).join(' · ');
34
+ const acts = x.state === 'open' ? `<span class="acts">${btn('bdPrinDrop', I.x, 'Drop this principle', x, 'outline')}${btn('bdPrinKeep', I.ok, 'Keep this principle', x, 'primary')}</span>` : '';
35
+ return `<div class="pm-li" role="listitem" data-prin-row="${esc(x.id)}"><span class="txt"><span class="t">${x.state === 'open' ? '<span aria-label="Drafted by PMOS">✦</span> ' : ''}${esc(x.text)}</span>${sub ? `<span class="w">${esc(sub)}</span>` : ''}</span>${acts}</div>`;
36
+ };
37
+ const meta = open.length ? (open.length === 1 ? '1 draft to keep or drop' : open.length + ' drafts to keep or drop') : '';
38
+ return `<section class="pm-block" aria-label="Principles"><div class="head">${SV(I.scale)}<h3 class="pm-h-sm" style="flex:1">Principles${meta ? ` <span class="pm-meta">· ${esc(meta)}</span>` : ''}</h3></div>`
39
+ + `<div role="list">${kept.map(row).join('')}${open.map(row).join('')}</div></section>`;
40
+ }
41
+
42
+ /** Draw the block into `host` and wire its presses. */
43
+ export async function mount(host, opts = {}) {
44
+ if (!host) return;
45
+ const { ws = null, single = true, say = null } = opts;
46
+ if (!single) { host.hidden = true; host.innerHTML = ''; return; }
47
+ let r = null; try { r = await (await fetch('/api/principles' + (ws ? '?ws=' + encodeURIComponent(ws) : ''), { credentials: 'same-origin' })).json(); } catch { r = null; }
48
+ if (!r || !r.ok) { host.hidden = true; return; } // the block is an extra: a failed read leaves the Board as it was
49
+ const html = blockHtml(r);
50
+ host.hidden = !html; host.innerHTML = html;
51
+ host.onclick = async (e) => {
52
+ const b = e.target.closest('button[name="bdPrinKeep"], button[name="bdPrinDrop"]'); if (!b) return;
53
+ const act = b.name === 'bdPrinKeep' ? 'keep' : 'drop', id = b.value;
54
+ noteUse(b.name);
55
+ b.disabled = true;
56
+ const res = await pmPost('/api/principles', { ws, act, id }).catch(() => null);
57
+ if (!res || !res.ok) { b.disabled = false; if (say) say((res && res.error) || 'Not saved.'); return; }
58
+ if (say) say(act === 'keep' ? 'Principle kept.' : 'Principle dropped.', async () => { await pmPost('/api/principles', { ws, act: 'undo', id }).catch(() => null); mount(host, opts); });
59
+ mount(host, opts);
60
+ };
61
+ }
62
+
63
+ /** Draw the block again after a read of the Board. */
64
+ export const refresh = (host, opts) => mount(host, opts);
@@ -546,7 +546,7 @@ function scaled(rows, M, o) {
546
546
  const ticks = W.ticks.map((k) => `<span style="left:${P(X(k.at))}" data-y="${k.y}" data-base="${esc(k.base)}"${k.plain ? ' data-plain' : ''}><b>${esc(k.label)}</b><small>${esc(k.sub)}</small></span>`).join('');
547
547
  const tn = now > W.from && now < W.to ? X(now) : null;
548
548
  const pill = tn != null ? `<span class="tg-tpill" style="left:${P(tn)}">Today</span>` : '';
549
- const back = `<button type="button" class="tg-tback" data-today hidden aria-label="Back to today">${SV(CHL)}<span>Today</span>${SV(CHR)}</button>`;
549
+ const back = `<button type="button" class="tg-tback" data-today hidden aria-label="Back to today">${SV('M19 12H5M11 6l-6 6 6 6')}<span>Today</span>${SV(CHR)}</button>`;
550
550
  const attrs = `data-span="${sp}" data-from="${+W.from}" data-to="${+W.to}" data-ratio="${W.fixed ? 1 : ratio.toFixed(5)}" data-now="${+now}"${W.fixed ? ' data-fixed' : ''}`;
551
551
  const style = `--tw:${Math.round(tpx * (W.fixed ? 1 : ratio))}px`;
552
552
  // every undated initiative is a row that says "No dates" beside today, in every grouping and in no program too (batch 26 item 8, Wawan:
@@ -13,7 +13,7 @@ import { sugHtml } from './bd-stands.js';
13
13
 
14
14
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
15
15
  const SV = (d, n = 16) => `<svg class="pm-ic" width="${n}" height="${n}" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
16
- const I = { star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', pen: 'M4 20h4L19 9l-4-4L4 16z', read: 'M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7',
16
+ const I = { star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', pen: 'M4 20h4L19 9l-4-4L4 16v4zM13.5 6.5l4 4', read: 'M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7',
17
17
  down: 'M7 10l5 5 5-5', ok: 'M5 12.5l4.5 4.5L19 7.5', x: 'M6 6l12 12M18 6L6 18' };
18
18
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
19
19
  export const dayText = (d) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(d || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
@@ -23,7 +23,7 @@ import * as DS from './bd-sprint-ds.js'; // This sprint from the system's part
23
23
 
24
24
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
25
25
  const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
26
- const I = { ok: 'M5 12.5l4.5 4.5L19 7', x: 'M6 6l12 12M18 6L6 18', pen: 'M4 20h4L19 9l-4-4L4 16z', read: 'M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7',
26
+ const I = { ok: 'M5 12.5l4.5 4.5L19 7.5', x: 'M6 6l12 12M18 6L6 18', pen: 'M4 20h4L19 9l-4-4L4 16v4zM13.5 6.5l4 4', read: 'M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7',
27
27
  down: 'M7 10l5 5 5-5', chev: 'M10 7l5 5-5 5', lock: 'M7 11V8a5 5 0 0 1 10 0v3M6 11h12v9H6z', jira: 'M12 3l9 9-9 9-9-9z M12 8l4 4-4 4-4-4z' };
28
28
  const SPARK = '✦';
29
29
  const OLD_MS = 36 * 3600000; // the Board's own line for an old Jira read (pm/premium-board.js jMood)
@@ -8,8 +8,11 @@
8
8
  * · Written: the five lines. Once all five are written, new work that does not fit folds under one line, "2 don't fit", that opens
9
9
  * them, each with why. A note informs only; nothing is moved or blocked. No note, no line (zero is silence).
10
10
  * · The pencil turns the lines into inputs; the tick (or Enter) saves, Esc puts them back. A save offers Undo in the Board's toast.
11
+ * · Once all five are written, the Positioning part (pm/bd-positioning.js, idea A328) sits under the lines: positioning and key
12
+ * messages drafted from them, each citing its line, kept or edited by the PM.
11
13
  * The controls carry ids (bdStratEdit, bdStratSave, bdStratFits) so the local use log counts their use (the bet's kill line). */
12
14
  import { pmPost } from './http.js';
15
+ import * as POS from './bd-positioning.js';
13
16
 
14
17
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
15
18
  const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
@@ -38,12 +41,15 @@ export function cardHtml(state) {
38
41
  const fold = n ? `<button type="button" class="pm-fold" id="bdStratFits" aria-expanded="${!!open}">${SV(I.chev)}${esc(fitsLine(n))}</button>`
39
42
  + (open ? `<div role="list">${notes.map((x) => `<div class="pm-li" role="listitem" data-ini="${esc(x.id)}"><span class="txt"><span class="t">${esc(x.title)}</span><span class="w">Doesn't fit the strategy because it ${esc(x.why)}</span></span></div>`).join('')}</div>` : '')
40
43
  : '';
41
- return `<section class="pm-block" aria-label="Strategy">${head('Strategy', '', btn('bdStratEdit', I.pen, 'Edit the strategy'))}<dl class="pm-field" style="margin:0">${rows}</dl>${fold}</section>`;
44
+ const pos = state.complete ? '<div id="bdPos" hidden></div>' : '';
45
+ return `<section class="pm-block" aria-label="Strategy">${head('Strategy', '', btn('bdStratEdit', I.pen, 'Edit the strategy'))}<dl class="pm-field" style="margin:0">${rows}</dl>${fold}${pos}</section>`;
42
46
  }
43
47
 
44
48
  /** Draw the card again after a read of the Board, unless the PM is writing in it. */
45
49
  export function refresh(host, opts) {
46
50
  if (!host || host.querySelector('[data-strat]')) return;
51
+ const a = typeof document !== 'undefined' ? document.activeElement : null;
52
+ if (a && a.closest && a.closest('#bdPos')) return; // the PM is editing a drafted positioning line
47
53
  mount(host, opts);
48
54
  }
49
55
 
@@ -59,6 +65,7 @@ export async function mount(host, opts = {}) {
59
65
  const draw = () => {
60
66
  host.hidden = false; host.innerHTML = cardHtml(S);
61
67
  if (S.editing) { const f = host.querySelector('[data-strat]'); if (f) f.focus(); }
68
+ else if (S.complete) POS.mount(host.querySelector('#bdPos'), { ws, say });
62
69
  };
63
70
  const save = async () => {
64
71
  const fields = {}; host.querySelectorAll('[data-strat]').forEach((el) => { fields[el.dataset.strat] = el.value; });
@@ -70,14 +77,14 @@ export async function mount(host, opts = {}) {
70
77
  mount(host, opts);
71
78
  };
72
79
  host.onclick = (e) => {
73
- const b = e.target.closest('button'); if (!b) return;
80
+ const b = e.target.closest('button'); if (!b || b.closest('#bdPos')) return; // the Positioning part wires its own presses
74
81
  if (b.id === 'bdStratEdit') { S.editing = true; draw(); }
75
82
  else if (b.id === 'bdStratCancel') { S.editing = false; draw(); }
76
83
  else if (b.id === 'bdStratSave') save();
77
84
  else if (b.id === 'bdStratFits') { S.open = !S.open; host.dataset.open = S.open ? '1' : ''; draw(); }
78
85
  };
79
86
  host.onkeydown = (e) => {
80
- if (!S.editing) return;
87
+ if (!S.editing || e.target.closest('#bdPos')) return;
81
88
  if (e.key === 'Escape') { e.preventDefault(); S.editing = false; draw(); }
82
89
  else if (e.key === 'Enter' && e.target.matches('[data-strat]')) { e.preventDefault(); save(); }
83
90
  };
@@ -19,7 +19,7 @@ import { provenStatus, NO_SIGNAL } from './status-proof.js'; // T3: a status r
19
19
 
20
20
  let A = null; // the page: { M(), statusOf(r), usual(t), trail(r), sel(), groups(L), folded(key), laneHead(g), subTile(name), memberIcon(id), programOf(r), programs(),
21
21
  // wf() → { list, cur, ended } the workflows on the board, the picked one (null for All) and the rows that ended (pm/bd-wf.js) }
22
- export function init(api) { A = api; }
22
+ export function init(api) { A = api; bindSig(); }
23
23
  const M = () => A.M();
24
24
  const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
25
25
  const MORE = 'M5 12h.01M12 12h.01M19 12h.01';
@@ -28,6 +28,38 @@ const cap = (s) => (s ? s.charAt(0).toUpperCase() + s.slice(1) : '');
28
28
  export const initials = (name) => { const s = String(name || '').trim(); if (!s) return ''; const p = s.split(/\s+/); return p.length > 1 ? (p[0][0] + p[1][0]).toUpperCase() : s.length <= 3 ? s : s.slice(0, 2); };
29
29
  export const avatar = (name, cls = '') => (name ? `<span class="bd-av${cls ? ' ' + cls : ''}" title="${esc(name)}" aria-label="${esc(name)}">${esc(initials(name))}</span>` : '<span class="bd-amut">—</span>');
30
30
 
31
+ /* ── the customer signals behind a row (roadmap-signal-count, bet A157) ──────────────────────────────────────────────────────────────
32
+ * The count sits in the Next cell; a press opens the list (a native disclosure, so no page code is needed and Escape-free closing is the
33
+ * browser's own): who, where, the link and the note. Zero is silence: a row with none draws nothing. The phone row says the count in words.
34
+ * The list is read from the record and the ledger (lib/customer-signals.js); chat adds one with `node workspace/lib/customer-signals.js add`. */
35
+ const SIG_WHERE = { ticket: 'Ticket', call: 'Call', email: 'Email', chat: 'Chat', survey: 'Survey', review: 'Review', other: 'Other', record: 'Raised it' };
36
+ const SIG_IC = 'M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8M22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8';
37
+ const safeLink = (u) => (/^https?:\/\//i.test(String(u || '')) ? String(u) : '');
38
+ const sigWords = (n) => n + (n === 1 ? ' customer signal' : ' customer signals');
39
+ export function sigHtml(r) {
40
+ const s = r && r.signals;
41
+ if (!s || !s.n) return '';
42
+ const items = (s.items || []).map((x) => {
43
+ const href = safeLink(x.link);
44
+ const what = [SIG_WHERE[x.where] || 'Other', x.at ? String(x.at).slice(0, 10) : ''].filter(Boolean).join(' · ');
45
+ const link = href ? ` <a href="${esc(href)}" target="_blank" rel="noopener noreferrer" class="bd-sigl">Open</a>` : x.link ? ` <span class="bd-amut">${esc(x.link)}</span>` : '';
46
+ return `<li><b>${esc(x.who)}</b> <span class="bd-amut">${esc(what)}</span>${link}${x.note ? `<span class="bd-sign">${esc(x.note)}</span>` : ''}</li>`;
47
+ }).join('');
48
+ const more = s.n > (s.items || []).length ? `<li class="bd-amut">${s.n - s.items.length} more</li>` : '';
49
+ return `<details class="bd-sig"><summary data-signals aria-label="${esc(sigWords(s.n))}" title="${esc(sigWords(s.n))}">${SV(SIG_IC)}<span>${s.n}</span></summary>`
50
+ + `<div class="bd-sigp" role="group" aria-label="${esc(sigWords(s.n))} for ${esc(r.title)}"><ul>${items}${more}</ul></div></details>`;
51
+ }
52
+ /** One open list at a time: opening one closes the others, and a press outside closes it. */
53
+ let sigBound = false;
54
+ function bindSig() {
55
+ if (sigBound || typeof document === 'undefined') return;
56
+ sigBound = true;
57
+ document.addEventListener('click', (e) => {
58
+ const mine = e.target && e.target.closest ? e.target.closest('details.bd-sig') : null;
59
+ document.querySelectorAll('details.bd-sig[open]').forEach((d) => { if (d !== mine) d.open = false; });
60
+ }, true);
61
+ }
62
+
31
63
  /* ── the step a row is in, and what a row needs ─────────────────────────────────────────────────────────────── */
32
64
  const kOf = (r) => WF.posOf(r); // stage order across workflows: category, then how far along its own list (Product feature: the eight steps)
33
65
  const isME = (r) => r.track && r.track.k >= 6; // Monitor and Evaluate: only a Product feature row has a step index
@@ -87,7 +119,7 @@ function listRow(r, pg) {
87
119
  + `<button type="button" class="bd-ltn ini2" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${WK.iconHtml(r.kind)}${nameHtml(r)}</b></button>${pcells}`
88
120
  + `<span role="cell" class="bd-wfn">${WF.wfIcon(WF.wfOf(r), 18)}<span class="bd-ell">${esc(WF.wfOf(r).name)}</span></span><span role="cell">${stageChip(r, { ms: (r.track || {}).ms })}${(r.track || {}).days ? ' <span class="bd-ell">' + (r.track || {}).days + 'd</span>' : ''}</span><span role="cell">${catPill(r)}</span>`
89
121
  + `<span role="cell" class="cs s-${s.tone}"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i>${esc(s.text)}</span>`
90
- + `<span role="cell">${avatar(r.owner)}</span><span role="cell" class="bd-nxc">${nextHtml(r, { self: M().board.self, factory: M().board.factory, due: false })}${markFor(r.ws || M().board.ws || '', r.id)}</span>`
122
+ + `<span role="cell">${avatar(r.owner)}</span><span role="cell" class="bd-nxc">${sigHtml(r)}${nextHtml(r, { self: M().board.self, factory: M().board.factory, due: false })}${markFor(r.ws || M().board.ws || '', r.id)}</span>`
91
123
  + `<span role="cell"${r.over ? ' class="bd-late"' : ''}>${esc(finish)}</span>`
92
124
  + `<button type="button" class="bd-ib sm" data-rowmenu="${esc(r.key)}" aria-haspopup="menu" aria-expanded="false" aria-label="More for ${esc(r.title)}" title="Actions">${SV(MORE)}</button></div>`;
93
125
  }
@@ -278,7 +310,8 @@ function phoneRow(r) {
278
310
  const nx = ahead ? esc(ahead.name || 'Next milestone') + ' ' + dmy(ahead.date) : '';
279
311
  const lt = nLate ? `<em class="late">${nLate} late</em>` : '';
280
312
  const stIc = st ? '<svg class="bd-stic" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01"/></svg>' : '';
281
- const sub = [st ? stIc + esc(st) : '', ends, nx, lt, say ? `<em class="${t.you ? 'you' : esc(s.tone)}">${esc(say)}</em>` : '', r.owner ? esc(r.owner) : ''].filter(Boolean).join(' · ');
313
+ const sg = r.signals && r.signals.n ? esc(sigWords(r.signals.n)) : ''; // A157: the count in words; the panel the row opens is the tap
314
+ const sub = [st ? stIc + esc(st) : '', ends, nx, lt, sg, say ? `<em class="${t.you ? 'you' : esc(s.tone)}">${esc(say)}</em>` : '', r.owner ? esc(r.owner) : ''].filter(Boolean).join(' · ');
282
315
  return `<button type="button" class="bd-lrow ini2${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}" aria-haspopup="dialog"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i><span class="tx"><span class="t">${nameHtml(r)}</span><span class="s q">${sub}</span></span>${t.you && t.days != null ? `<span class="r">${t.days}d</span>` : ''}${many() ? WF.wfIcon(WF.wfOf(r), 18) : ''}</button>`;
283
316
  }
284
317
  export function phoneListHtml(L) {
@@ -467,7 +467,7 @@ export function menuHtml(o = {}) {
467
467
  const S = v.sorts, word = (k) => (SORT_KEYS.find(([x]) => x === k) || [k, (byK[k] || {}).n || k])[1];
468
468
  const sortPills = `<button type="button" class="${S.length ? '' : 'on'}" aria-pressed="${!S.length}" data-wksortp="">PMOS order</button>`
469
469
  + sortKeys(o, S).map(([k, n]) => { const i = S.findIndex((x) => x.k === k); if (i < 0) return `<button type="button" aria-pressed="false" data-wksortp="${k}">${esc(n)}</button>`;
470
- return `<span class="wk-sk"><button type="button" class="on" aria-pressed="true" data-wksortp="${k}" aria-label="${esc((i + 1) + ': ' + n + ', ' + (S[i].up ? 'first to last' : 'last to first') + '. Turn it round')}"><b>${i + 1}</b>${esc(n)}<span class="wk-sar${S[i].up ? '' : ' dn'}">${SV(I.sort, 11)}</span></button><button type="button" class="x" data-wksortx="${k}" aria-label="Stop sorting by ${esc(n.toLowerCase())}">${SV(I.x, 11)}</button></span>`; }).join('');
470
+ return `<span class="wk-sk"><button type="button" class="on" aria-pressed="true" data-wksortp="${k}" aria-label="${esc((i + 1) + ': ' + n + ', ' + (S[i].up ? 'first to last' : 'last to first') + '. Turn it round')}"><b>${i + 1}</b>${esc(n)}<span class="wk-sar${S[i].up ? '' : ' dn'}">${SV(I.sort, 11)}</span></button><button type="button" class="x" data-wksortx="${k}" aria-label="Clear sorting by ${esc(n.toLowerCase())}">${SV(I.x, 11)}</button></span>`; }).join('');
471
471
  const differs = JSON.stringify(v) !== JSON.stringify(u) || filterOn();
472
472
  // a copy (shared-copy brief Part A 3): filter and sort, for this visit; nothing is kept and nothing reaches the publisher
473
473
  if (RO || o.ro) return `<div class="wk-menu" role="dialog" aria-label="Filter and sort">`
@@ -1594,3 +1594,17 @@ html.ro body.wk-on .bd-hd { display: none; } /* find and tune moved to the top
1594
1594
  body.cz-phmore .bd-lrow.ini2 .s em.risk { color: var(--cz-risk); }
1595
1595
  body.cz-phmore .bd-lrow.ini2 .s em.you { color: var(--cz-blueink); }
1596
1596
  }
1597
+
1598
+ /* the customer signals behind a row (roadmap-signal-count, bet A157; pm/bd-views.js sigHtml): the count in the Next cell, a press lists them */
1599
+ .bd-sig { position: relative; display: inline-block; vertical-align: middle; margin-right: var(--space-8); }
1600
+ .bd-sig > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 var(--space-8); border-radius: var(--radius-pill); background: var(--cz-well); color: var(--cz-ink2); font: var(--fw-strong) var(--fs-label)/var(--lh-label) var(--cz-sans); }
1601
+ .bd-sig > summary::-webkit-details-marker { display: none; }
1602
+ .bd-sig > summary svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
1603
+ .bd-sig > summary:hover, .bd-sig[open] > summary { background: var(--cz-bluebg); color: var(--cz-blueink); }
1604
+ .bd-sig > summary:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
1605
+ .bd-sigp { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(320px, 80vw); max-height: 320px; overflow: auto; padding: var(--space-8) var(--space-12); background: var(--cz-card); border: 1px solid var(--cz-hair); border-radius: 14px; box-shadow: var(--cz-sheet); }
1606
+ .bd-sigp ul { list-style: none; margin: 0; padding: 0; }
1607
+ .bd-sigp li { padding: 6px 0; border-top: 1px solid var(--cz-hair); font-size: var(--fs-label); line-height: var(--lh-label); white-space: normal; }
1608
+ .bd-sigp li:first-child { border-top: 0; }
1609
+ .bd-sigp .bd-sign { display: block; color: var(--cz-ink2); }
1610
+ .bd-sigl { color: var(--cz-blueink); }
@@ -53,7 +53,7 @@ export function monthGrid(at, o = {}) {
53
53
  }
54
54
 
55
55
  const CAL = 'M7 3v3M17 3v3M4 8h16M5 5h14a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z';
56
- const ARR = { prev: 'M14 7l-5 5 5 5', next: 'M10 7l5 5-5 5' };
56
+ const ARR = { prev: 'M15 6l-6 6 6 6', next: 'M9 6l6 6-6 6' };
57
57
  const svg = (d) => `<svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
58
58
 
59
59
  export function mountDay(el, o = {}) {
@@ -49,7 +49,7 @@ const WD = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
49
49
  export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
50
50
  const svg = (d, w = 16) => `<svg class="pm-ic" aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
51
51
  export const ICON = {
52
- yes: 'M5 12.5l4.5 4.5L19 7.5', no: 'M6 6l12 12M18 6L6 18', go: 'M9 6l6 6-6 6', back: 'M15 6l-6 6 6 6', plus: 'M12 5v14M5 12h14',
52
+ yes: 'M5 12.5l4.5 4.5L19 7.5', no: 'M6 6l12 12M18 6L6 18', go: 'M9 6l6 6-6 6', back: 'M19 12H5M11 6l-6 6 6 6', plus: 'M12 5v14M5 12h14',
53
53
  lock: 'M7 11V8a5 5 0 0 1 10 0v3M5.5 11h13v9h-13z', date: 'M7 5.5h10a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3v-8a3 3 0 0 1 3-3zM4 10h16M8.5 3.5v4M15.5 3.5v4',
54
54
  done: 'M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17M8.5 12.2l2.4 2.4 4.6-5', spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z',
55
55
  };