create-pmos 0.548.0 → 0.550.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.
@@ -5,7 +5,10 @@
5
5
  * for Adler's leaf, the impact log and the weekly check; the page hears `pmos:impact`), Agents write to Jira (fixed: only after Commit).
6
6
  * Extras at the bottom (UI grill U4, 2026-11-08: nine sections became five): "Adler ›" and "Jev and Laya ›" open each as a
7
7
  * sub-panel inside General with the controls they had as sections, nothing removed (T.sub; ‹ goes back to General).
8
- * Claude the Claude profile, the API key, and Sharpen prompts: suggestions after a reply, Sharpen as I type, the style and Your own rules
8
+ * Claude How Claude decides (boards AwG, AwG2, agreed 2026-11-10): each kind of change Claude makes by itself, how many it made and you
9
+ * kept, and Quietly, Show me or Ask first (GET /api/autonomy/kinds; the PM's way is claude.ways, POST /api/settings). Then the
10
+ * five Always yours rows (the six calls that always wait) and Lessons (GET /api/artefacts/lessons, the D107 artefact). Then
11
+ * the Claude profile, the API key, and Sharpen prompts: suggestions after a reply, Sharpen as I type, the style and Your own rules
9
12
  * (GET/POST /api/next-prompt/prefs; batch 26 item 2)
10
13
  * › Checks (a heading inside Claude since U4; it was the section Claude’s checks) Grill by itself (Full, Only at stage exits, Off) and the monthly credit for checks with what this month used (grill.mode,
11
14
  * grill.cap, POST /api/settings; GET /api/grill; canvas GrillEntry). At the cap Claude pauses and says so once here.
@@ -286,6 +289,43 @@ function weeks() {
286
289
  const arc = old.length ? `<div class="ev-arc"><button type="button" class="ev-arcb" data-ev-arc aria-expanded="${T.arc}"><b>Archive</b><span class="ev-small ev-mut">${old.length} earlier ${old.length === 1 ? 'week' : 'weeks'}</span>${svg(ICON.down, 14)}</button>${T.arc ? rows : ''}</div>` : '';
287
290
  return `<div class="ev-wk">${head}${weekTop(w)}${arc}</div>`;
288
291
  }
292
+ /* Settings › Claude › How Claude decides (AwG): one row per kind of change Claude made by itself, with what it made and you kept and the way
293
+ * it acts now. Pressing the automatic way clears yours. Then Always yours (AwG2): the calls that never move without you. Then Lessons. */
294
+ const WAY = [['quiet', 'Quietly'], ['show', 'Show me'], ['ask', 'Ask first']];
295
+ const dayOf = (iso) => { const t = Date.parse(iso || ''); return Number.isFinite(t) ? new Date(t).toLocaleDateString('en-GB', { day: 'numeric', month: 'short' }) : ''; };
296
+ function kindSub(k, until) {
297
+ const made = k.made === 1 ? '1 made' : k.made + ' made', kept = k.kept === k.made ? (k.made === 1 ? 'you kept it' : 'you kept all') : k.kept ? 'you kept ' + k.kept : 'none kept yet';
298
+ const how = k.set ? 'You set this.' : k.auto === 'ask' ? 'Two Undos, so Claude asks first' + (k.until ? ' until ' + dayOf(k.until) : '') + '.'
299
+ : k.auto === 'quiet' ? 'Claude does these quietly.' : 'A new kind shows until you keep ' + until + '.';
300
+ return (k.made ? made + ', ' + kept + '. ' : '') + how;
301
+ }
302
+ const ALWAYS = [['Start a new request', 'Claude recommends. You decide.'], ['Say if it worked', 'The verdict on an outcome is yours.'], ['Send a message to people', 'Claude drafts. Only you send.'],
303
+ ['Move what the team reads', 'Stages and dates in Jira or on the Board.'], ['Merge, delete or spend', '']];
304
+ function lessonRow(l) {
305
+ const [wrong, ...rest] = String(l.text || '').split(/\n+/); // a lesson's first line says what went wrong, the rest what changed
306
+ return `<div class="ev-trow"><div class="ev-tx ev-ls"><b>${esc([dayOf(l.at), l.product].filter(Boolean).join(' · '))}</b><p class="ev-small${rest.length ? ' ev-ms' : ''}">${esc(wrong)}</p>${rest.length ? `<p class="ev-small ev-nx">${esc(rest.join(' '))}</p>` : ''}</div></div>`;
307
+ }
308
+ function decidesSec() {
309
+ const K = T.ck;
310
+ const kinds = !K ? '<p class="ev-small ev-mut">Reading what Claude did by itself.</p>' : K.ok === false ? `<p class="ev-small ev-mut">What Claude did could not be read: ${esc(K.error || 'the server did not answer')}.</p>`
311
+ : !K.kinds.length ? '<p class="ev-small ev-mut">Claude has not changed anything by itself yet. Each kind of change shows here once it has.</p>'
312
+ : K.kinds.map((k) => trow(k.label, kindSub(k, K.showUntil || 3), seg(k.label, 'claude.way:' + k.kind, k.way, WAY))).join('');
313
+ const L = T.ls && T.ls.ok ? T.ls.lessons || [] : [];
314
+ return '<h4>How Claude decides</h4><p class="ev-small ev-mut ev-lead">Claude picks for each kind of change from what you kept and undid. Two Undos on a kind and it asks first for 7 days. You can set any kind yourself.</p>'
315
+ + kinds + '<h4>Always yours</h4>' + ALWAYS.map(([b, p]) => trow(b, p, '<span class="ev-pill">Always asks</span>')).join('')
316
+ + (L.length ? '<h4>Lessons</h4>' + L.slice(0, 8).map(lessonRow).join('') : '');
317
+ }
318
+ /** A press on a kind's way: the PM's way is kept, unless it is the automatic one (then the kind follows the automatic way again). */
319
+ async function saveWay(kind, v) {
320
+ const K = T.ck; if (!K || !K.ok) return;
321
+ const ways = {}; for (const k of K.kinds) if (k.set) ways[k.kind] = k.set;
322
+ const k = K.kinds.find((x) => x.kind === kind); if (!k) return;
323
+ if (v === k.auto) delete ways[kind]; else ways[kind] = v;
324
+ const r = await pmPost('/api/settings', { key: 'claude.ways', value: ways });
325
+ if (r && r.ok) { k.set = ways[kind] || null; k.way = v; }
326
+ T.msg = r && r.ok ? 'Saved. ' + k.label + ': ' + (v === 'ask' ? 'Claude asks you first.' : v === 'show' ? 'Claude does them and shows them first in Claude did.' : 'Claude does them quietly.') : (r && r.error) || 'Not saved.';
327
+ draw();
328
+ }
289
329
  /* Settings > Claude: which Claude profile PMOS starts Claude sessions with, and the API key for Claude's own runs (D101).
290
330
  * The key is typed here and goes to this computer only; the page never gets it back, only whether one is set and where from. */
291
331
  function claudeSec() {
@@ -298,7 +338,7 @@ function claudeSec() {
298
338
  const k = C.key || {};
299
339
  const keySub = k.present ? (k.source === 'environment' ? 'Set in ANTHROPIC_API_KEY. A key saved here is used first.' : 'Saved on this computer only. PMOS never shows it again.') : 'Not set. Claude\u2019s own runs, such as Grill, use a Claude session instead.';
300
340
  const keyRight = `<span class="ev-dr-pl"><label class="ev-vh" for="evKey">Anthropic API key</label><input id="evKey" class="ev-inp" type="password" autocomplete="off" spellcheck="false" placeholder="${k.present ? 'Replace the key' : 'sk-ant-\u2026'}" data-ev-key><button type="button" class="ev-btn sm pri" data-ev-keysave>Save</button>${k.source === 'settings' ? '<button type="button" class="ev-btn sm" data-ev-keyclear>Remove</button>' : ''}</span>`;
301
- return '<h4>Claude login and profile</h4><div data-claude-setup></div>'
341
+ return decidesSec() + '<h4>Claude login and profile</h4><div data-claude-setup></div>'
302
342
  + trow('API key', keySub, keyRight)
303
343
  + (k.present && C.off ? trow('Runs on the API', 'Off: PMOS_GRILL_API is off in the environment.', '<span class="ev-pill">Off</span>') : '')
304
344
  + sharpenRows()
@@ -436,6 +476,7 @@ async function press(e) {
436
476
  if (t.dataset.evMore) { T.wkMore.add(t.dataset.evMore); draw(); return; }
437
477
  if (t.dataset.evGo) { T.sec = t.dataset.evGo; T.sub = ''; draw(); return; }
438
478
  if (t.dataset.evSub !== undefined) { const k = t.dataset.evSub, was = T.sub; T.sub = k; T.dress = false; T.more = false; T.bday = false; T.msg = ''; draw(); const f = T.el.querySelector(k ? '[data-ev-sub=""]' : `[data-ev-sub="${was}"]`); if (f) f.focus(); return; }
479
+ if (t.dataset.evSeg && t.dataset.evSeg.startsWith('claude.way:')) { await saveWay(t.dataset.evSeg.slice(11), t.dataset.v); return; }
439
480
  if (t.dataset.evSeg === 'theme') { const M = await import('./cozy-nav.js'); M.setTheme(t.dataset.v); draw(); return; }
440
481
  if (t.dataset.evSeg && t.dataset.evSeg.startsWith('grill.')) {
441
482
  const key = t.dataset.evSeg, value = key === 'grill.cap' ? Number(t.dataset.v) : t.dataset.v;
@@ -562,7 +603,9 @@ async function readAgain(id) {
562
603
  }
563
604
  async function load() {
564
605
  readFresh();
565
- pmGet('/api/grill').then((g) => { T.gr = g && g.ok ? g : { ok: false, error: (g && g.error) || '' }; draw(); }).catch(() => { T.gr = { ok: false }; draw(); });
606
+ pmGet('/api/autonomy/kinds').then((k) => { T.ck = k && k.ok ? k : { ok: false, error: (k && k.error) || '' }; draw(); }).catch(() => { T.ck = { ok: false }; draw(); });
607
+ pmGet('/api/artefacts/lessons').then((l) => { T.ls = l && l.ok ? l : null; draw(); }).catch(() => { T.ls = null; });
608
+ pmGet('/api/grill').then((g) => { T.gr = g && g.ok ? g : { ok: false, error: (g && g.error) || '' }; draw(); }).catch(() => { T.gr = { ok: false }; draw(); });
566
609
  pmGet('/api/next-prompt/prefs').then((n) => { T.np = n && n.ok ? n : null; draw(); }).catch(() => { T.np = null; });
567
610
  pmGet('/api/profiles').then(async (pr) => { const k = await pmGet('/api/anthropic'); T.cl = { profiles: pr && Array.isArray(pr.profiles) ? pr.profiles : [], prefs: (pr && pr.prefs) || {}, perr: pr && pr.ok === false ? (pr.error || 'the server did not answer') : '', key: k && k.ok ? k.key : { present: false, source: null }, off: !!(k && k.off) }; draw(); }).catch(() => { T.cl = { profiles: [], prefs: {}, perr: 'the server did not answer', key: { present: false, source: null } }; draw(); });
568
611
  const [w, p, s, b] = await Promise.all([pmGet('/api/workspaces'), pmGet('/api/proactive/settings'), pmGet('/api/settings'), pmGet('/api/briefing-premium')]);
@@ -588,7 +631,7 @@ export function openSettings(section, o = {}) {
588
631
  const m = MOVED[section];
589
632
  if (m) { T.sec = m[0]; T.sub = m[1]; T.dress = section === 'dress'; } else if (section && BODY[section]) { T.sec = section; T.sub = ''; T.dress = false; }
590
633
  else if (el.hidden) { T.sec = 'general'; T.sub = ''; T.dress = false; } // a fresh open with no section opens on General (R2), not on the section of the last visit
591
- if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.auto = false; T.wkOpen = new Set(); T.wkMore = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.info = false; T.fold = false; T.dset = {}; T.cl = null; T.gr = null; T.np = null; JL.reset(); }
634
+ if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.auto = false; T.wkOpen = new Set(); T.wkMore = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.info = false; T.fold = false; T.dset = {}; T.cl = null; T.gr = null; T.np = null; T.ck = null; T.ls = null; JL.reset(); }
592
635
  el.hidden = false; document.getElementById('evStScrim').hidden = false; el.setAttribute('data-esc-layer', '');
593
636
  draw();
594
637
  const f = el.querySelector('[aria-current="page"]'); if (f) f.focus();
@@ -250,7 +250,8 @@ export function gmModel(Y, D, now = Date.now(), o = {}) {
250
250
  const move = mine.slice(0, MOVE_CAP), more = mine.length - move.length;
251
251
  // Claude did (AwA): what Claude finished by itself, newest first, each with its reason and Undo; a run that stopped is one amber line
252
252
  const R = Y.rank || {}, recent = (x) => { const t = Date.parse(x.at || ''); return Number.isFinite(t) && now - t <= SINCE_MS; };
253
- const did = (R.done || []).map((d) => ({ ...d, title: d.via === 'proposals' && d.name ? d.name + ': ' + (d.said || 'done') : d.said || 'done',
253
+ // a kind Claude shows you (Settings › Claude: a new kind, or one you set to Show me) comes first; the quiet ones follow, newest first
254
+ const did = (R.done || []).map((d, i) => ({ d, i })).sort((a, b) => (a.d.way === 'show' ? 0 : 1) - (b.d.way === 'show' ? 0 : 1) || a.i - b.i).map(({ d }) => d).map((d) => ({ ...d, title: d.via === 'proposals' && d.name ? d.name + ': ' + (d.said || 'done') : d.said || 'done',
254
255
  why: d.reason || 'Done by itself. You can undo it for 14 days.' }));
255
256
  const didN = did.filter(recent).length;
256
257
  const fl = (R.failed || []).filter(recent);
@@ -386,7 +387,7 @@ export function gmHtml(G, openHtml, o = {}) {
386
387
  else if (quiet) a += `<div class="gm-more">${quiet}</div>`;
387
388
  // Claude did (AwA): the amber line of a run that stopped, then the newest changes with their reasons and Undo; the rest fold
388
389
  const dl = (G.did || []).slice(0, MOVE_CAP), dmore = (G.did || []).length - dl.length;
389
- if (dl.length || G.failed) a += `<section class="gm-sec gm-didl"><h3 class="gm-sh">Claude did${G.didN ? ` <span class="gm-n">${G.didN} since yesterday</span>` : ''}</h3>${failHtml(G.failed)}${dl.map(didRowHtml).join('')}`
390
+ if (dl.length || G.failed) a += `<section class="gm-sec gm-didl"><h3 class="gm-sh">Claude did${G.didN ? ` <span class="gm-n">${G.didN} since yesterday</span>` : ''}<button type="button" class="gm-lnk" data-yd="gm-claude">By product</button></h3>${failHtml(G.failed)}${dl.map(didRowHtml).join('')}`
390
391
  + (dmore > 0 ? `<div class="gm-more"><button type="button" data-yd="gm-fold" data-fold="done"><b>${dmore}</b> more Claude did${svg(CHEV, 14, 2)}</button></div>` : '') + '</section>';
391
392
  const b = G.since.length || G.newsN ? `<section class="gm-sec gm-since"><h3 class="gm-sh">Since yesterday${G.since.length ? `<button type="button" class="yd-all" data-yd="seen" aria-label="Mark all ${G.newsN} seen" title="Mark all seen">${svg(MARK2, 18, 1.9)}</button>` : ''}</h3>`
392
393
  + `<div class="gm-sl">${G.since.map((it) => `<button type="button" class="gm-si${it.rise ? ' hot' : ''}" data-yd="news" data-id="${esc(it.id)}"><i aria-hidden="true"></i><span>${esc(it.kind === 'task' ? String(it.title || '').replace(/^New task: /, '') : it.title)}</span>${it.at ? `<em>${esc(at(it.at))}</em>` : ''}</button>`).join('')}</div>`
@@ -25,6 +25,7 @@ import { ownTab, bring, tabUrl } from './rec-tab-core.js';
25
25
  import * as VW from './cozy-viewer.js';
26
26
  import * as SV from './small-vw.js'; // the small Viewers: a stakeholder, its form, a routine (batch 18 item 2-C)
27
27
  import { pmGet, pmPost, pmHeaders } from './http.js';
28
+ import * as ST from './story.js';
28
29
  import * as H from './home-data.js';
29
30
  import { mountChat, avHtml } from './home-chat.js';
30
31
  import * as MORE from './home-more.js';
@@ -398,7 +399,7 @@ async function readMove() {
398
399
  return pmGet('/api/lab' + (q ? '?' + q : '')).then((r) => (r && r.ok && r.lab && (r.lab.loose || []).length ? { ws: L[i], board: b, n: r.lab.loose.length, say: r.lab.say || '' } : null)).catch(() => null); }));
399
400
  L.forEach((ws, i) => {
400
401
  const r = got[i], A = auto[i] && auto[i].ok ? auto[i] : null; if (!r || !r.ok) return;
401
- const done = A ? (A.done || []).map((d) => ({ ref: d.ref, ini: d.ini || '', said: d.title || 'done', at: d.at, via: 'autonomy', reason: d.reason || '' }))
402
+ const done = A ? (A.done || []).map((d) => ({ ref: d.ref, ini: d.ini || '', said: d.title || 'done', at: d.at, via: 'autonomy', reason: d.reason || '', way: d.way || '' }))
402
403
  : (r.done || []).map((d) => ({ ref: d.batch, ini: d.ini, board: d.board, said: d.said, at: d.at, via: 'proposals' }));
403
404
  // agent-run (AwA, R4): the runs that stopped, one amber line in Claude did
404
405
  next[ws] = { verdicts: r.verdicts || [], kr: r.kr || null, expired: r.expired || [], done, notices: A ? A.notices || [] : [], failed: A ? A.failed || [] : [] };
@@ -526,6 +527,7 @@ async function readNotePicks() {
526
527
  async function gmPress(b) {
527
528
  const act = b.dataset.yd, body = b.closest('.yd');
528
529
  if (act === 'gm-intel') { location.href = insightsHref(deskWs()); return; }
530
+ if (act === 'gm-claude') { import('./cozy-settings.js').then((M) => M.openSettings('claude')); return; } // AwG: how Claude decides, per kind
529
531
  if (act === 'gm-cal') { openCalendar(); return; }
530
532
  if (act === 'gm-fold') {
531
533
  const sec = body && body.querySelector('.czs-sec[data-czs-id="' + b.dataset.fold + '"]'); if (!sec) return;
@@ -1236,8 +1238,11 @@ function productPageHtml(x, ws, vid, name, g) {
1236
1238
  { 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>` },
1237
1239
  { 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>' },
1238
1240
  ];
1239
- const lead = d && d.handled ? d.handled.lead : '', rest = d && d.handled ? d.handled.rest : '';
1240
- return PV.pageHtml({ page: 'product:' + (ws || 'own'), line: { lead, rest, warn: !!(d && d.handled && d.handled.tone === 'warn') }, goal, cards: progs + budgets, props, tabs,
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
1242
+ const story = x.story ? ST.storyHtml(x.story, { sources: true }) : '';
1243
+ const lead = story ? 'Your weekly update is this story.' : d && d.handled ? d.handled.lead : '';
1244
+ const rest = story ? 'I keep it current from the records, and every line says where it came from.' : d && d.handled ? d.handled.rest : '';
1245
+ return PV.pageHtml({ page: 'product:' + (ws || 'own'), line: { lead, rest, warn: !story && !!(d && d.handled && d.handled.tone === 'warn') }, goal: story + goal, cards: progs + budgets, props, tabs,
1241
1246
  tail: isPhone() ? `<button type="button" class="hi-talk" data-hp="talk">Message Claude about ${esc(name)}</button>` : '' });
1242
1247
  }
1243
1248
  function productDash(b, ws, vid, name, g) {
@@ -1260,7 +1265,11 @@ function productDash(b, ws, vid, name, g) {
1260
1265
  paint();
1261
1266
  DB.readDash(ws, 'product', 'read').then((d) => { if (d) { x.d = d; paint(); } });
1262
1267
  DB.readKr(ws).then((k) => { x.kr = k; if (DB.krOf(k).length) paint(); });
1268
+ ST.readStory(ws).then((st) => { STORY.set(ws || '', st); if (JSON.stringify(st) !== JSON.stringify(x.story || null)) { x.story = st; paint(); } });
1263
1269
  }
1270
+ /** The product's story (pm/story.js) by workspace, as last read: the weekly update Claude drafts leads with it. */
1271
+ const STORY = new Map();
1272
+ const deskStory = () => STORY.get(deskWs() || '') || STORY.get('') || null;
1264
1273
  /** A phone: the page's "Message Claude about …" closes the sheet and opens the chat full screen; its ← goes back to the list (HbCPhone). */
1265
1274
  function talk() { S.phoneChat = true; VW.close(); drawList(); chat.focus(); }
1266
1275
  /** "Overview with Claude" on the initiative's card: the ask is typed into the chat box, for the PM to send or change. */
@@ -1711,9 +1720,10 @@ function openUpdateViewer(o = {}) {
1711
1720
  const sent = (U.sent || []).find((x) => x.week === U.week.iso);
1712
1721
  // workspace grill W2: the words come from the sections (H.updateWords); a week with nothing moved and no open risk has no update to send
1713
1722
  const flag = U.sections.flatMap((x) => x[2]).find((x) => x.flag);
1714
- const text = (U.draft || sent ? H.updateWords(U) : 'Nothing moved and no risk is open this week, so there is no update to send.') + (flag ? ' ' + flag.title + ': ' + flag.flag.toLowerCase() + '.' : '');
1715
- const sum = VW.czSummary({ line: sent ? 'Sent ' + new Date(sent.at).toDateString().slice(0, 10) : U.draft ? 'Ready to send' : 'Nothing new this week', tone: sent || !U.draft ? '' : 'you', text,
1716
- meta: 'Communicator · ' + (U.to.length ? 'to ' + U.to.join(', ') : 'say who gets it under More'), primary: U.draft || sent ? { label: sent ? 'Send again' : 'Send now', act: 'send' } : null });
1723
+ const story = deskStory(); // board AwE: the weekly update is the story; the sections below stay what PMOS read
1724
+ const text = story ? ST.storyText(story) : (U.draft || sent ? H.updateWords(U) : 'Nothing moved and no risk is open this week, so there is no update to send.') + (flag ? ' ' + flag.title + ': ' + flag.flag.toLowerCase() + '.' : '');
1725
+ const sum = VW.czSummary({ line: sent ? 'Sent ' + new Date(sent.at).toDateString().slice(0, 10) : U.draft || story ? 'Ready to send' : 'Nothing new this week', tone: sent || !(U.draft || story) ? '' : 'you', text,
1726
+ meta: 'Communicator · ' + (U.to.length ? 'to ' + U.to.join(', ') : 'say who gets it under More'), primary: U.draft || sent || story ? { label: sent ? 'Send again' : 'Send now', act: 'send' } : null });
1717
1727
  const it = (x) => x.key ? `<div class="czs-it"><span class="w">${esc(x.title)}<span>${esc([x.meta, x.text].filter(Boolean).join(' · '))}</span></span></div>` : `<button type="button" class="czs-it" data-hv-ini="${esc(x.id)}"><span class="w">${esc(x.title)}<span>${esc([x.meta, x.text].filter(Boolean).join(' · '))}</span>${x.flag ? `<span class="flag">${esc(x.flag)}</span>` : ''}</span></button>`;
1718
1728
  // "Before you send": Claude's risks the PM has not confirmed, with one press that confirms them all (each a ✓ Keep on its program's charter)
1719
1729
  const confirmAll = (L) => { const say = L.length === 1 ? 'Confirm this risk' : 'Confirm all ' + L.length + ' risks'; return `<p><button type="button" class="hv-chip" data-hv-confirm aria-label="${say}" title="${say}">${SVG(I.check, 15, 2.4)}</button></p>`; };
@@ -1725,13 +1735,14 @@ function openUpdateViewer(o = {}) {
1725
1735
  if (edit) { const i = b.querySelector('#hvTo'); if (i) i.focus(); }
1726
1736
  };
1727
1737
  const U0 = H.weeklyUpdate(S.D, S.D.now);
1728
- const copy = async () => { try { await navigator.clipboard.writeText(H.updateText(H.weeklyUpdate(S.D, S.D.now), H.productName(S.D))); toast('The update is copied as text.'); } catch { toast('The text could not be copied.'); } };
1738
+ const copy = async () => { try { await navigator.clipboard.writeText(updateBody(H.weeklyUpdate(S.D, S.D.now), H.productName(S.D))); toast('The update is copied as text.'); } catch { toast('The text could not be copied.'); } };
1729
1739
  const more = () => [
1730
1740
  { label: 'Change who gets it', note: U0.to.length ? U0.to.length + (U0.to.length === 1 ? ' person' : ' people') : '', on: () => { edit = !edit; draw(body); } },
1731
1741
  { label: 'Copy as text', on: copy },
1732
1742
  { label: 'Past updates', note: (U0.sent || []).length ? U0.sent.length + ((U0.sent.length === 1) ? ' week' : ' weeks') : '', on: () => { past = !past; draw(body); } },
1733
1743
  ];
1734
1744
  const body = VW.open({ id: 'update', kind: 'Weekly update', title: H.productName(S.D) + ' · week of ' + U0.week.label, icon: 'doc', url: selfUrl({ ini: 'product' }), more: more(), render: draw });
1745
+ if (!STORY.has(deskWs() || '')) ST.readStory(deskWs()).then((st) => { STORY.set(deskWs() || '', st); if (st && body && body.isConnected) draw(body); });
1735
1746
  const saveTo = async (to) => { const r = await pmPost('/api/home-desk/recipients', { ws: deskWs(), to }); if (r && r.ok) { S.D.desk.product = { ...(S.D.desk.product || {}), recipients: r.recipients }; draw(body); drawList(); } else toast((r && r.error) || 'The recipients were not saved.'); };
1736
1747
  body.onkeydown = (e) => { if (e.target.id === 'hvTo' && (e.key === 'Enter' || e.key === ',')) { e.preventDefault(); const v = e.target.value.trim(); if (v) saveTo(H.weeklyUpdate(S.D).to.concat(v)); } };
1737
1748
  body.onclick = async (e) => {
@@ -1753,12 +1764,14 @@ async function confirmRisks(L, after) {
1753
1764
  /** This page's address for one view (the Viewer's Open in a new tab): the workspace and board of this page, and the view's own keys. */
1754
1765
  const selfUrl = (o) => { const q = new URLSearchParams(); if (WS) q.set('ws', WS); if (BOARD) q.set('board', BOARD); for (const [k, v] of Object.entries(o)) q.set(k, v); return location.pathname + '?' + q.toString(); };
1755
1766
  const deskWs = () => (S.D.desk && S.D.desk.ws) || ((S.D.board && S.D.board.board) || {}).ws || WS || undefined;
1767
+ /** The words of the weekly update: the story first when Claude keeps one (board AwE; no sources, it goes to people), then what PMOS read. */
1768
+ const updateBody = (U, name) => { const st = deskStory(); const t = H.updateText(U, name); if (!st) return t; const L = t.split('\n'); return [L[0], '', ST.storyText(st), '', ...L.slice(2)].join('\n'); };
1756
1769
  async function sendUpdate() {
1757
1770
  const U = H.weeklyUpdate(S.D, S.D.now);
1758
1771
  if (!U.to.length) { openUpdateViewer({ edit: true }); toast('Say who the update goes to first.'); setTimeout(() => { const i = $('#hvTo'); if (i) i.focus(); }, 0); return; }
1759
1772
  const name = H.productName(S.D), subject = name + ' · week of ' + U.week.label;
1760
1773
  const mails = U.to.filter((x) => /@/.test(x));
1761
- location.href = 'mailto:' + mails.map(encodeURIComponent).join(',') + '?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(H.updateText(U, name) + (U.to.length > mails.length ? '\n\nAlso for: ' + U.to.filter((x) => !/@/.test(x)).join(', ') : ''));
1774
+ location.href = 'mailto:' + mails.map(encodeURIComponent).join(',') + '?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(updateBody(U, name) + (U.to.length > mails.length ? '\n\nAlso for: ' + U.to.filter((x) => !/@/.test(x)).join(', ') : ''));
1762
1775
  const r = await pmPost('/api/home-desk/update-sent', { ws: deskWs(), week: U.week.iso, to: U.to, subject });
1763
1776
  if (r && r.ok) { toast('The draft is open in your mail. Recorded as sent this week.'); await load(); if (S.ini === 'product') openTarget(updateTarget()); }
1764
1777
  else toast((r && r.error) || 'The send was not recorded.');
@@ -128,6 +128,24 @@ function banner() {
128
128
  main.insertBefore(d, main.firstChild);
129
129
  const tabs = tabsHtml(PACK, location);
130
130
  if (tabs) d.insertAdjacentHTML('afterend', tabs);
131
+ // "The story so far" (board AwF): the product's story above the timeline, as its page has it, without sources or Claude's activity
132
+ const st = storyOf(PACK, location);
133
+ if (st) (main.querySelector('.ro-tabs') || d).insertAdjacentHTML('afterend', st);
134
+ }
135
+
136
+ /** The story of the board on screen, from the pack (lib/board-pack.js carries it as text lines). '' when the pack holds none. A program's tab
137
+ * (?program=) has no product story. */
138
+ export function storyOf(pack, loc) {
139
+ const q = new URLSearchParams(loc.search); if (q.get('program')) return '';
140
+ const R = (pack && pack.responses) || {};
141
+ const ws = q.get('ws') || (pack && pack.scope && pack.scope.kind === 'product' ? pack.scope.id : '');
142
+ const a = R['/api/artefacts/story?' + new URLSearchParams({ ws }).toString()];
143
+ const S = a && a.ok && a.story; const L = S && Array.isArray(S.lines) ? S.lines.filter((l) => l && l.text) : [];
144
+ if (!L.length) return '';
145
+ const day = (() => { const t = Date.parse(S.at || ''); return Number.isFinite(t) ? new Date(t).toLocaleDateString('en-GB', { day: 'numeric', month: 'short', year: 'numeric' }) : ''; })();
146
+ const sub = [pack.scope && pack.scope.kind === 'product' ? pack.scope.label : '', day ? 'as of ' + day : ''].filter(Boolean).join(' · ');
147
+ return '<section class="ro-story" aria-label="The story so far"><div class="ro-sth"><b>The story so far</b>' + (sub ? '<small>' + esc(sub) + '</small>' : '') + '</div>'
148
+ + L.map((l) => '<p>' + esc(l.text).replace(/\*\*([^*]+)\*\*/g, '<b>$1</b>') + '</p>').join('') + '</section>';
131
149
  }
132
150
 
133
151
  function start() {
@@ -0,0 +1,8 @@
1
+ /* pm/story.css — "The story so far" (pm/story.js; boards AwE and AwF). Tokens only. */
2
+ .st-story { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; }
3
+ .st-story p { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-ink); }
4
+ .st-story p b { font-weight: var(--fw-strong); }
5
+ .st-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 0 0 2px; }
6
+ .st-h h4 { margin: 0; font-size: var(--fs-row); font-weight: var(--fw-strong); line-height: var(--lh-row); }
7
+ .st-h small { font-size: var(--fs-label); color: var(--cz-ink3); line-height: var(--lh-label); }
8
+ .st-src { display: inline-flex; align-items: center; height: 22px; margin-left: 6px; padding: 0 8px; border-radius: 6px; background: var(--cz-well); color: var(--cz-ink3); font-size: var(--fs-label); font-weight: var(--fw-strong); vertical-align: 1px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
@@ -0,0 +1,39 @@
1
+ /* pm/story.js — "The story so far" (agent-run workspace boards AwE and AwF, agreed by the PM 2026-11-10).
2
+ * The standing Narrative of a product (D107), written by Claude from the records, read with GET /api/artefacts/story?ws.
3
+ *
4
+ * storyHtml(story, { sources, label, sub }) the card. story: { at, lines: [{ text, sources? }] }; sources true draws each line's source
5
+ * chips (the product page); a shared Board draws none (its pack holds none). '' when empty.
6
+ * storyText(story) the story as plain text: the body of the weekly update Claude drafts
7
+ * readStory(ws) the GET; null when there is no story or the server does not answer
8
+ *
9
+ * A line's **words** are bold. Zero is silence: no story, no card. */
10
+ import { pmGet } from './http.js';
11
+
12
+ const CSS = new URL('./story.css', import.meta.url).href;
13
+ if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
14
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
15
+ }
16
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
17
+ const bold = (t) => esc(t).replace(/\*\*([^*]+)\*\*/g, '<b>$1</b>');
18
+ const plain = (t) => String(t || '').replace(/\*\*([^*]+)\*\*/g, '$1');
19
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
20
+ const pad = (n) => String(n).padStart(2, '0');
21
+ /** "3 Nov 16:05" in this browser's time. */
22
+ export function when(iso) {
23
+ const t = Date.parse(iso || ''); if (!Number.isFinite(t)) return '';
24
+ const d = new Date(t); return `${d.getDate()} ${MON[d.getMonth()]} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
25
+ }
26
+ const lines = (s) => (s && Array.isArray(s.lines) ? s.lines.filter((l) => l && String(l.text || '').trim()) : []);
27
+
28
+ export function storyHtml(story, o = {}) {
29
+ const L = lines(story); if (!L.length) return '';
30
+ const chip = (x) => `<span class="st-src" title="${esc(x.ref || x.label)}">${esc(x.label)}</span>`;
31
+ const p = L.map((l) => `<p>${bold(l.text)}${o.sources && Array.isArray(l.sources) ? l.sources.filter((x) => x && x.label).map(chip).join('') : ''}</p>`).join('');
32
+ const sub = o.sub != null ? o.sub : ['Claude keeps it current', when(story.at)].filter(Boolean).join(' · ');
33
+ return `<section class="${o.cls || 'pv-card'} st-story" aria-label="The story so far"><div class="st-h"><h4>${esc(o.label || 'The story so far')}</h4>${sub ? `<small>${esc(sub)}</small>` : ''}</div>${p}</section>`;
34
+ }
35
+ export function storyText(story) { return lines(story).map((l) => plain(l.text)).join('\n\n'); }
36
+ export async function readStory(ws) {
37
+ const r = await pmGet('/api/artefacts/story' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null);
38
+ return r && r.ok && r.story && lines(r.story).length ? r.story : null;
39
+ }
@@ -50,7 +50,8 @@ Procedure:
50
50
  `definition` says whether the definition used is confirmed (`stable`) or only proposed (`draft`). Do not add a `timestamp` or `verified`.
51
51
  5. Under the frontmatter: a Headline (one or two sentences: what the reader most needs to know), then the sections the definition names in its order, then "Needs your call" (decisions or answers only the PM can give), then "Sources reached and not reached" (each source kind: reached or not reached and why; private items skipped).
52
52
  6. If the definition was a draft, say so in the first line of the Headline so the PM sees it.
53
- 7. Finish by saying in one line where the draft is. Do not commit; the PM's Sync carries the file.
53
+ 7. Keep the product's story current (D107 Narrative; the product page shows it as "The story so far", and the weekly update leads with it). Write 3 to 6 short sentences, one per line, on where the product stands now: what was settled, what waits, what is late, what has no verdict yet. Give one `--source` per line, in the same order, each pointing at the record that holds that sentence: `pmos artefacts set portfolio narrative now --text "<line 1>"$'\n'"<line 2>"… --source "<label>=<ref>" --source …`. A label is short ("Jira IDPF-3326 · 30 Oct"). Bold a few words with **two stars** when they are the point. A sentence with no record is left out. The story goes to people only when the PM sends it.
54
+ 8. Finish by saying in one line where the draft is. Do not commit; the PM's Sync carries the file.
54
55
 
55
56
  Default shape, used ONLY when proposing a definition: a weekly report: progress against initiatives, decisions made, risks, what is next. Use the report frame of D78: a Headline, then What moved, Risks and Metrics, then Needs your call and Sources reached and not reached.
56
57