create-pmos 0.759.0 → 0.760.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.759.0",
3
+ "version": "0.760.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -33,6 +33,19 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.760.0",
38
+ "at": "2026-11-24T02:57:16.535Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1707,
43
+ "t": "The weekly digest (quiet rows slice C)",
44
+ "s": "The weekly digest (quiet rows slice C)",
45
+ "k": "new"
46
+ }
47
+ ]
48
+ },
36
49
  {
37
50
  "v": "0.759.0",
38
51
  "at": "2026-11-24T02:32:35.299Z",
@@ -369,33 +382,6 @@
369
382
  "k": "new"
370
383
  }
371
384
  ]
372
- },
373
- {
374
- "v": "0.739.0",
375
- "at": "2026-11-23T07:58:34.158Z",
376
- "f": 4,
377
- "prs": [
378
- {
379
- "n": 1649,
380
- "t": "Ctrl K answers a question from your own files, with its sources",
381
- "s": "Ctrl K answers a question from your own files, with its sources",
382
- "k": "new",
383
- "try": {
384
- "steps": [
385
- "Press Ctrl K (Cmd K on the Mac).",
386
- "Type a why or how question about your work, for example: why did the paywall date move?"
387
- ],
388
- "see": "A short answer, with the files it came from listed under it.",
389
- "open": "/today.html"
390
- }
391
- },
392
- {
393
- "n": 1651,
394
- "t": "Open questions styles use tokens (open-questions-today, Checker C6)",
395
- "s": "Open questions styles use tokens (open-questions-today, Checker C6)",
396
- "k": "fix"
397
- }
398
- ]
399
385
  }
400
386
  ]
401
387
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@48ca42f0
1
+ kernel-source: pmos@e8e8ef03
2
2
  assembled: 2026-11-24
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-24T02:32:31Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T02:57:14Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-11-24T02:32:31Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T02:57:14Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-11-24T02:32:31Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T02:57:14Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,17 @@
1
1
  [
2
+ {
3
+ "v": "0.760.0",
4
+ "at": "2026-11-24T02:57:16.535Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1707,
9
+ "t": "The weekly digest (quiet rows slice C)",
10
+ "s": "The weekly digest (quiet rows slice C)",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
2
15
  {
3
16
  "v": "0.759.0",
4
17
  "at": "2026-11-24T02:32:35.299Z",
@@ -50,6 +50,7 @@ Home, the Board, Insights and the Viewer use one typeface, Plus Jakarta Sans, wi
50
50
  - **At most 3 rows a day for each product.** A row from a product's own records counts toward the 3: an open question, a check, a grill finding, a date change from a meeting, a key result, or a change PMOS proposes on an initiative. A reply someone waits for, your own task and a draft never count. The rows are fixed the first time Today shows them that day. When you finish a row, nothing takes its place until tomorrow. A new row that holds up a ship date takes the place of that product's lowest row and never makes a fourth. Rows over the 3 wait under **Later** with "Waits for tomorrow". A product with nothing for you has no row.
51
51
  - **Today's batch.** Everything other people will see (a review request, Jira tickets, a follow-up, a closed ask) is one row: "Today's batch: 5 to send". Press it to open the batch full size. **Back** returns to Today. The drafts are in groups by kind, and each one says who will see it. ✎ **Change it first** opens the draft, ✕ **Skip** drops it (with Undo), and ✓ **Approve** sends it. When more than one draft waits, PMOS suggests **Approve and send all**. Nothing is sent until you press. If no channel is connected yet, the draft stays in the batch and says so. A draft you leave for 7 days lapses and is not sent. On a phone the batch shows one draft at a time, full text first: swipe right to approve, left to skip.
52
52
  - **The dashed line.** Your move ends with one dashed line, for example "9 more move in the line by themselves · none stuck" (or "· 1 stuck"). It counts the live initiatives of your products that do not wait on you. Press it to open the Line on Work. With nothing on the line there is no dashed line.
53
+ - **The weekly digest.** On a Monday the Overview sentence ends with "Last week's digest is ready to read." Press it to read last week in the Viewer: one sentence on the line, What moved (each initiative that reached a new station, and what put it there), What PMOS did by itself (with what you undid and what the Checker sampled), Not sent (drafts that lapsed after 7 days) and Next week (initiatives that reach their station's limit). A section with nothing is left out. The digest is only to read: anything that needs you is already in Your move. The switch in its header, or **Weekly digest** in Settings › General, turns it off; off means PMOS does not make it.
53
54
  - **One press per initiative.** An initiative's proposals are one row, for example "Checkout: 6 changes to keep" with "3 dates, 2 names, 1 link" under it. Press it to see them grouped as Dates, Names, Done and Links. ✓ keeps all of them, with one Undo for the batch. ✕ drops them, then offers three reasons and **Say why**. A proposal that needs your own check keeps its own ✓ and ✕. **See every change** opens the full list on the initiative.
54
55
  - **An ask expires after 14 days with no answer.** PMOS leaves it as it was and writes why in the initiative's History. Your move says it once: "2 asks expired after 14 days with no answer." Dates computed from your tasks never expire: PMOS reads them again each time.
55
56
  - **Done** lists what PMOS finished by itself in the last 14 days, one line each with Undo.
@@ -68,6 +68,10 @@ When PMOS sees a pattern, one suggestion opens the section, with **Why**, **PMOS
68
68
 
69
69
  **Sharpen prompts.** Suggest the next prompt (on by default) shows up to two prompts above the chat box after a reply. Sharpen as I type offers a sharper version of a rough prompt. It is on by default and runs in your own Claude session. Sharpen as picks Polish, Prompt engineer (the default) or Your own, and Your own rules holds the rules for Your own. The same style and switch are in the menu on the chat's Sharper card. See [The next prompt, suggested and sharpened](home.md).
70
70
 
71
+ ## General › Weekly digest
72
+
73
+ **Weekly digest** is on by default. Each Monday PMOS makes one page about last week, linked from Today's Overview (see [Today](home.md)). Off means PMOS does not make it and reads nothing for it. The same switch is in the digest's own header.
74
+
71
75
  ## General › Extras: Adler, Jev and Laya
72
76
 
73
77
  At the bottom of **General**, **Extras** has three rows. Press the arrow on a row to open its settings; the back arrow returns to General.
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+ /* digest-parts.js — one product's parts of the weekly digest (initiative quiet-rows-digest; GET /api/digest in lib/routes-your-move.js).
3
+ * READ ONLY: it reads the line (lineRows, the route's cached lib/line.js lineOf), the autonomy ledger (lib/autonomy.js) and the queued or
4
+ * blocked drafts of the outbox store; it never writes, confirms or sends. The page builds the digest (pm/digest-view.js).
5
+ * partsOf(ctx, w, lineRows, now) → Promise of { rows, did: [{ title, ini, at, undone, checked, src }], lapsed: [draft older than 7 days] } */
6
+ /** The digest's parts for one product (GET /api/digest). */
7
+ async function partsOf(ctx, w, lineRows, now = Date.now()) {
8
+ const AU = require('./autonomy.js');
9
+ const dir = require('./driver.js').stateDirOf(w.root);
10
+ const since = now - 14 * 864e5, did = [];
11
+ if (dir) {
12
+ for (const j of AU.fold(AU.read(dir)).jobs.values()) {
13
+ for (const a of j.applied) {
14
+ const t = Date.parse(a.at); if (!(t >= since)) continue;
15
+ did.push({ title: a.title || '', ini: a.ini || null, at: a.at, undone: !!a.undone, checked: a.checked ? a.checked.verdict : null, src: !!(a.src && a.src.length) });
16
+ }
17
+ }
18
+ }
19
+ let lapsed = [];
20
+ try {
21
+ lapsed = require('./outbox-store.js').readOutbox(ctx.runtimeDir).filter((e) => e && e.id && !e.about && (e.state === 'queued' || e.state === 'blocked')
22
+ && (e.ws ? e.ws === w.id : true) && Date.parse(e.created_at || e.at) <= now - 7 * 864e5)
23
+ .map((e) => ({ id: e.id, subject: e.subject || '', body: String(e.body || '').split('\n')[0], recipient: e.recipient || '', created_at: e.created_at || e.at, ws: e.ws || '' }));
24
+ } catch { lapsed = []; }
25
+ return { rows: await lineRows(w, now), did, lapsed };
26
+ }
27
+
28
+ module.exports = { partsOf };
@@ -24,7 +24,11 @@
24
24
  *
25
25
  * GET /api/line?ws=<id> → { ok, ws, rows: [lib/line.js lineOf row + ws], you: [initiative id] } (quiet-rows slice B: Work's Line
26
26
  * tab and Today's dashed line). lineOf reads every row of the repository, so it runs in a child process and its answer is kept LINE_MS per
27
- * product. you: the initiatives with a question to the PM or a check due today (they are in Your move). */
27
+ * product. you: the initiatives with a question to the PM or a check due today (they are in Your move).
28
+ * GET /api/digest?ws=<id> → { ok, ws, rows, did, lapsed } | { ok, ws, off: true } (quiet-rows slice C: the weekly digest, built on the
29
+ * page by pm/digest-view.js). rows: the cached line; did: the autonomy ledger's applied changes of the last
30
+ * 14 days ({ title, ini, at, undone, checked: PASS | FAIL | null, src }); lapsed: the queued or blocked
31
+ * drafts waiting to send for this product, older than 7 days (lib/digest-parts.js). With the setting digest.on false it reads nothing. */
28
32
  const YM = require('./your-move.js');
29
33
 
30
34
  const localDay = (ms = Date.now()) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
@@ -152,10 +156,25 @@ function youOf(ctx, w, today) {
152
156
  return [...out];
153
157
  }
154
158
 
159
+ const digestParts = (ctx, w, now) => require('./digest-parts.js').partsOf(ctx, w, lineRows, now); // quiet-rows-digest (reads only)
160
+
155
161
  module.exports = {
156
- expire, questions, asksOf, lineRows,
157
- prefixes: ['/api/your-move', '/api/line'],
162
+ expire, questions, asksOf, lineRows, digestParts,
163
+ prefixes: ['/api/your-move', '/api/line', '/api/digest'],
158
164
  handle: async (req, res, url, ctx) => {
165
+ if (url.pathname === '/api/digest') {
166
+ if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
167
+ let w = null;
168
+ try { w = ctx.getWs(url.searchParams.get('ws') || null); } catch { w = null; }
169
+ if (!w || !w.root) { ctx.json(res, { ok: false, error: 'no such workspace' }, 404); return true; }
170
+ // off means it is never made: nothing is read
171
+ if (require('./settings-store.js').get(ctx.runtimeDir, 'digest.on', w.id) === false) { ctx.json(res, { ok: true, ws: w.id, off: true }); return true; }
172
+ let P;
173
+ try { P = await digestParts(ctx, w); } catch (e) { ctx.json(res, { ok: false, error: 'the digest could not be read: ' + (e && e.message) }, 500); return true; }
174
+ console.info('[quiet-rows-digest] parts ws=' + w.id + ' rows=' + P.rows.length + ' did=' + P.did.length + ' lapsed=' + P.lapsed.length);
175
+ ctx.json(res, { ok: true, ws: w.id, ...P });
176
+ return true;
177
+ }
159
178
  if (url.pathname === '/api/line') {
160
179
  if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
161
180
  let w = null;
@@ -100,6 +100,8 @@ const DEFS = Object.freeze({
100
100
  // Settings > General > Your impact (feedback batch 16 item 7, canvas GmP1Switch): the one switch. Off hides every impact surface, Adler's
101
101
  // leaf included, and stops the daily impact run (lib/routes-impact.js, lib/impact-runs.js).
102
102
  'impact.on': bool('general', 'computer', true),
103
+ // the weekly digest (quiet-rows-digest): made each Monday from last week; off means it is never made (GET /api/digest reads nothing)
104
+ 'digest.on': bool('general', 'computer', true),
103
105
  // Claude's checks (Grill and Forecast, part G-A; lib/grill.js): when Claude grills an initiative by itself (full, only at stage exits, off)
104
106
  // and the monthly credit cap in US dollars. At the cap Claude pauses. `pmos grill mode|cap` reads and sets them.
105
107
  'grill.mode': one('checks', 'computer', ['full', 'exits', 'off'], 'full'),
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.759.0",
3
+ "version": "0.760.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.759.0",
9
+ "version": "0.760.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.759.0",
3
+ "version": "0.760.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",
@@ -119,6 +119,7 @@ function general() {
119
119
  + trow('New work starts as', 'The kind a new initiative starts as. Project hides Triage, Discover and the product documents. Each initiative can change it.', seg('New work starts as', 'work.role', roleVal(), [['product', 'Product'], ['project', 'Project'], ['sdlc', 'Full SDLC']]))
120
120
  + trow('Your day', 'When the end-of-day card shows', `<label class="ev-vh" for="evDay">Your day ends at</label><select id="evDay" class="ev-inp" data-ev-day>${hours.map((h) => `<option value="${h}"${h === end ? ' selected' : ''}>${pad(h)}:00</option>`).join('')}</select>`)
121
121
  + trow('Your impact', 'Adler’s sprout and your impact log. Only you see it. Nothing leaves PMOS.', sw(impactOn(), 'data-ev-impact', 'Your impact'))
122
+ + trow('Weekly digest', 'Each Monday, one page to read about last week: what moved, what PMOS did by itself, what was not sent. Off means it is never made.', sw(digestOn(), 'data-ev-digest', 'Weekly digest'))
122
123
  + trow('Agents write to Jira', 'Only after you press Commit. Never on their own.', (ready() ? '' : adFace('needs-you', 24)) + '<span class="pm-badge">Fixed</span>')
123
124
  + upd
124
125
  + '<h4 class="pm-h-sm">Extras</h4>'
@@ -183,6 +184,7 @@ const ROLE_SAY = { product: 'Saved. New initiatives start as Product work.', pro
183
184
  const subBtn = (k) => `<button type="button" class="ev-ib pm-btn" data-ev-sub="${k}" aria-label="${esc(SUBS[k])}" title="${esc(SUBS[k])}">${svg(CHEV, 18)}</button>`;
184
185
  const subHead = (k) => `<div class="ev-dr-hd"><button type="button" class="ev-ib pm-btn" data-ev-sub="" aria-label="Back to ${esc((SECTIONS.find((x) => x[0] === T.sec) || SECTIONS[0])[1])}" title="Back">${svg(BACK, 18)}</button><h4 class="ev-grow">${esc(SUBS[k])}</h4></div>`;
185
186
  /* Your impact (GmP1Switch): on by default; off hides every impact surface and stops Claude's daily read */
187
+ function digestOn() { const x = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((y) => y.key === 'digest.on') : null; return x ? x.value !== false : true; }
186
188
  function impactOn() { const x = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((y) => y.key === 'impact.on') : null; return x ? x.value !== false : true; }
187
189
  /** One Dress for the day press: POST /api/settings, keep the row, and tell the page (the event adler:dress) so Adler changes at once. */
188
190
  async function saveDress(key, value, said = 'Saved.') {
@@ -725,6 +727,12 @@ async function press(e) {
725
727
  if (t.dataset.evDday) { const P = dp(), x = SE.moreDays(P).find((y) => y.key === t.dataset.evDday); if (x) await saveDress('adler.dress.days', { ...(P['adler.dress.days'] || {}), [x.key]: !x.on }); return; }
726
728
  if (t.dataset.evWear) { const P = dp(), k = t.dataset.evWear, w = P['adler.dress.wear'], worn = !!(w && w.key === k && w.day === SE.wearNow(k, Date.now(), P).value.day); const r = SE.wearNow(worn ? '' : k, Date.now(), P); await saveDress(r.key, r.value, worn ? 'Taken off.' : 'He wears it until midnight.'); return; }
727
729
  if ('evDaytint' in t.dataset) { const on = !tintOn(); setDayTint(on); T.msg = on ? 'The background follows the time of day.' : 'The background stays the same all day.'; draw(); return; }
730
+ if ('evDigest' in t.dataset) {
731
+ const on = !digestOn(), r = await pmPost('/api/settings', { key: 'digest.on', value: on });
732
+ if (r && r.ok) { const x = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((y) => y.key === 'digest.on') : null; if (x) x.value = on; }
733
+ T.msg = r && r.ok ? (on ? 'The weekly digest is on. PMOS makes it each Monday.' : 'The weekly digest is off. PMOS does not make it.') : (r && r.error) || 'Not saved.';
734
+ draw(); return;
735
+ }
728
736
  if ('evImpact' in t.dataset) {
729
737
  const on = !impactOn(), r = await pmPost('/api/settings', { key: 'impact.on', value: on });
730
738
  if (r && r.ok) { const x = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((y) => y.key === 'impact.on') : null; if (x) x.value = on; window.dispatchEvent(new CustomEvent('pmos:impact', { detail: { on } })); }
@@ -19,6 +19,7 @@ import { productName, whenNames } from './scope-chip.js';
19
19
  import * as TP from './cozy-today-view.js';
20
20
  import * as OM from './mention-one-model.js'; // the one mention's title and the self check's proof line (Today round 3)
21
21
  import { wireSwipe } from './cozy-phone-swipe.js';
22
+ let DG = null; // quiet-rows-digest: pm/digest-view.js, loaded on a Monday only (on other days Today loads nothing of the digest)
22
23
  import { noteUse } from './use-log.js'; // your-move (A468): each press on a Your move row is one ym-act line in the local use log (its health number)
23
24
  import * as QB from './quiet-batch.js'; // quiet-rows: Today's batch, the popup (Approve, Skip, Change it first; nothing sent without a press)
24
25
  import * as CC from './change-cues.js'; // idea A313: a short cue on the row that is done, moved or dropped, before the log draws again // the phone: rows and the proposal swipe (phone design, Ph2_today)
@@ -41,6 +42,7 @@ export function mountToday(ctx) {
41
42
  readReports();
42
43
  readQuestions();
43
44
  readLine();
45
+ readDigest();
44
46
  }
45
47
  /* open-questions-today (A420, board QuestionsA): every product's register (GET /api/open-questions), one list for the Decide tab. A product
46
48
  * that does not answer is left out; nothing is guessed. Read-only: taking a default and putting it off a week are slice 2. */
@@ -56,6 +58,39 @@ export function mountToday(ctx) {
56
58
  X.questions = lines;
57
59
  draw();
58
60
  }
61
+ /* quiet-rows-digest (board QuietDigest): on a Monday, each product's part of last week's digest (GET /api/digest); off means none is made */
62
+ async function readDigest() {
63
+ if (new Date(ctx.now()).getDay() !== 1) return;
64
+ DG = DG || await import('./digest-view.js').catch(() => null);
65
+ if (!DG || !DG.weekOf(ctx.now()).monday) return;
66
+ const P = ((ctx.S.M && ctx.S.M.products) || []).filter((p) => p && p.model);
67
+ const W = [...new Set((P.length ? P.map((p) => p.ws || ctx.boardWs() || '') : [ctx.boardWs() || '']))];
68
+ const got = await Promise.all(W.map((ws) => ctx.pmGet('/api/digest' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)));
69
+ const parts = got.filter((r) => r && r.ok);
70
+ X.digestOff = parts.some((r) => r.off);
71
+ X.digest = X.digestOff ? null : DG.digestModel(parts, { now: ctx.now(), nameOf: productOf });
72
+ console.info('[quiet-rows-digest] made=' + !!X.digest + (X.digestOff ? ' off' : ''));
73
+ X.html = ''; draw();
74
+ }
75
+ /** The digest in the reading view (the Viewer), read only; its header's switch turns it off (digest.on, POST /api/settings). */
76
+ function openDigest() {
77
+ const VW = window.czViewer; if (!VW || !DG) return;
78
+ noteUse('qr-digest');
79
+ const D = X.digest, sub = D ? DG.weekWord(D.week) : 'Weekly digest';
80
+ let on = true;
81
+ VW.open({ id: 'digest:' + (D ? D.week.to : ''), kind: 'Weekly digest', title: 'Weekly digest', sub, icon: 'M5 4h11l3 3v13H5zM8 10h8M8 14h8M8 18h5', presses: [],
82
+ render: (body) => {
83
+ body.innerHTML = DG.digestHtml(D, { on });
84
+ body.onclick = async (e) => {
85
+ const b = e.target.closest('[data-dg="off"]'); if (!b || !body.contains(b)) return;
86
+ const r = await ctx.pmPost('/api/settings', { key: 'digest.on', value: !on }).catch(() => null);
87
+ if (!r || !r.ok) { ctx.toast((r && r.error) || 'Not saved.'); return; }
88
+ on = !on; console.info('[quiet-rows-digest] switched ' + (on ? 'on' : 'off'));
89
+ body.innerHTML = DG.digestHtml(D, { on });
90
+ if (!on) { X.digest = null; X.digestOff = true; X.html = ''; draw(); }
91
+ };
92
+ } });
93
+ }
59
94
  /* quiet-rows-line (board QuietLine): each product's line (GET /api/line), for the dashed line at the end of Your move. A product that does not
60
95
  * answer is left out; with nothing on the line there is no dashed line (zero is silence). */
61
96
  async function readLine() {
@@ -103,7 +138,7 @@ export function mountToday(ctx) {
103
138
  const lead = L.rows.find((r) => !r.done && r.src !== 'note' && r.src !== 'own' && r.src !== 'lab');
104
139
  const A = TM.agendaModel({ meetings: ctx.meetings(), own: X.log.entries, reports: X.reports || [], focus: lead ? { key: lead.key, title: lead.title } : null, now,
105
140
  iniOf: (m) => (m && (m.initiative || (m.level && m.level.kind === 'initiative' && m.level.id) || (m.about && m.about.kind === 'initiative' && m.about.id))) || null });
106
- const O = TM.overviewModel(L, A);
141
+ const O = DG && X.digest ? DG.withDigest(TM.overviewModel(L, A), X.digest, now) : TM.overviewModel(L, A);
107
142
  O.suggest = O.suggest.filter((x) => !X.hide.has(x.key));
108
143
  return { L, A, O };
109
144
  }
@@ -470,6 +505,7 @@ export function mountToday(ctx) {
470
505
  if (x.ini && ctx.hasIni(x.ini)) { ctx.goIni(x.ini); return; }
471
506
  ctx.VW.popNext({ keep: true, id: x.key, kind: 'meeting', title: x.title }); ctx.openMeeting(x.ref); return;
472
507
  }
508
+ if (act === 'open' && key === 'digest') { openDigest(); return; }
473
509
  const r = rowOf(key); if (!r) return;
474
510
  if (r.tier != null && (act === 'open' || act === 'done' || act === 'tomorrow')) noteUse('ym-act'); // your-move's health number
475
511
  if (act === 'q-remind') { remindQuestion(r.ref); return; }
@@ -188,3 +188,7 @@ button.td-ev:focus-visible { outline: none; box-shadow: var(--glow); }
188
188
  .tdp-gh { padding: var(--space-16) 0 var(--space-8); }
189
189
  .tdp-m.oq-u.d { color: var(--cz-blueink); }
190
190
  }
191
+ /* quiet-rows-digest (board QuietDigest): the weekly digest in the reading view, read only */
192
+ .dg-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--space-12); }
193
+ .dg-on { display: inline-flex; align-items: center; gap: var(--space-8); }
194
+ .dg-l { margin: 0; padding-left: 1.2em; }
@@ -0,0 +1,99 @@
1
+ /* pm/digest-view.js — the weekly digest (initiative quiet-rows-digest, quiet rows slice C; board QuietDigest on the main canvas, In
2
+ * development). Pure: Node imports it (quiet-rows-digest.test.js).
3
+ *
4
+ * weekOf(now) → { from, to, fromMs, toMs, monday } last week: Monday 00:00 of the week before to this Monday 00:00
5
+ * digestModel(parts, { now, nameOf }) → { week, products, sum, moved, stuck, did, lapsed, next } | null (zero is silence)
6
+ * digestHtml(D, { on }) → the reading view's body: read only; the one control is the off switch (data-dg="off")
7
+ * withDigest(O, D, now) → the Overview with "Last week's digest is ready to read." on a Monday (a ref with key 'digest')
8
+ *
9
+ * parts: GET /api/digest answers, one per product: { ws, rows: lib/line.js lineOf rows, did: [{ title, ini, at, undone, checked, src }],
10
+ * lapsed: [outbox draft] }. It is never a row on Today and holds nothing that needs the PM: that is already in Your move. Off means it is
11
+ * never made. Text from records goes through esc(). The UI says PMOS. */
12
+ const DAY = 864e5;
13
+ const LAPSE_DAYS = 7;
14
+ export const UNDO_DAYS = 14;
15
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
16
+ const MONTH = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
17
+ const DOW = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
18
+ export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
19
+ const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
20
+ const dayKey = (ms) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
21
+ const dayWord = (ms) => { const d = new Date(ms); return DOW[d.getDay()] + ' ' + d.getDate() + ' ' + MON[d.getMonth()]; };
22
+ const ms = (v) => { const t = Date.parse(String(v || '')); return Number.isFinite(t) ? t : null; };
23
+ const clip = (s, n) => { const t = String(s || '').replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
24
+
25
+ /** Last week, in local time. On Monday 30 Nov: 23 Nov 00:00 to 30 Nov 00:00. */
26
+ export function weekOf(now = Date.now()) {
27
+ const d = new Date(now); d.setHours(0, 0, 0, 0);
28
+ const back = (d.getDay() + 6) % 7; // days since Monday
29
+ const to = new Date(d); to.setDate(d.getDate() - back);
30
+ const from = new Date(to); from.setDate(to.getDate() - 7);
31
+ return { from: dayKey(from.getTime()), to: dayKey(to.getTime()), fromMs: from.getTime(), toMs: to.getTime(), monday: back === 0 };
32
+ }
33
+
34
+ /** The digest of last week over every product's part. null when nothing happened and nothing is coming (zero is silence). */
35
+ export function digestModel(parts, o = {}) {
36
+ const now = o.now == null ? Date.now() : o.now, W = weekOf(now);
37
+ const nameOf = typeof o.nameOf === 'function' ? o.nameOf : (w) => w;
38
+ const inWeek = (t) => t != null && t >= W.fromMs && t < W.toMs;
39
+ const moved = [], next = [], did = [], lapsed = [], seen = new Set(), products = [];
40
+ let stuck = 0;
41
+ for (const P of parts || []) {
42
+ if (!P || P.off) continue;
43
+ const name = P.ws ? nameOf(P.ws) || '' : '';
44
+ let any = false;
45
+ for (const r of P.rows || []) {
46
+ if (!r || !r.live) continue;
47
+ if (r.flag === 'stuck') stuck++;
48
+ const st = r.station && r.station.name;
49
+ if (st && inWeek(ms(r.since))) { any = true; moved.push({ id: r.id, ws: P.ws || '', title: r.title || r.id, text: `${r.title || r.id} reached ${st}` + (r.setBy ? ` (${r.setBy})` : '') + '.' }); }
50
+ const left = typeof r.limit === 'number' && r.limit > 0 && r.daysThere != null && r.flag !== 'waiting' ? r.limit - r.daysThere : null;
51
+ if (st && left != null && left > 0 && left <= 7) {
52
+ any = true;
53
+ next.push({ id: r.id, ws: P.ws || '', at: now + left * DAY, text: `${r.title || r.id} reaches its ${st} limit (${plural(r.limit, 'day', 'days')}) on ${dayWord(now + left * DAY)}.` });
54
+ }
55
+ }
56
+ for (const a of P.did || []) if (a && inWeek(ms(a.at))) { any = true; did.push(a); }
57
+ for (const e of P.lapsed || []) {
58
+ const c = ms(e && (e.created_at || e.at)); if (!e || !e.id || seen.has(e.id) || c == null) continue;
59
+ const lapse = c + LAPSE_DAYS * DAY;
60
+ if (!inWeek(lapse)) continue;
61
+ seen.add(e.id); any = true;
62
+ lapsed.push({ id: e.id, text: `${clip(e.subject || String(e.body || '').split('\n')[0] || 'A draft', 90)}` + (e.recipient ? ` (to ${e.recipient})` : '') + ' lapsed after 7 days and was not sent.' });
63
+ }
64
+ if (any && name && !products.includes(name)) products.push(name);
65
+ }
66
+ if (!moved.length && !next.length && !did.length && !lapsed.length) return null;
67
+ moved.sort((a, b) => a.text.localeCompare(b.text));
68
+ next.sort((a, b) => a.at - b.at);
69
+ const undone = did.filter((a) => a.undone), checked = did.filter((a) => a.checked);
70
+ const sum = [plural(moved.length, 'initiative moved', 'initiatives moved'), stuck + ' stuck now', plural(lapsed.length, 'thing not sent', 'things not sent')].join(', ') + '.';
71
+ return { week: W, products, sum, moved, stuck, next, lapsed,
72
+ did: { n: did.length, sourced: did.filter((a) => a.src).length, undone: undone.map((a) => a.title || 'a change'), checked: checked.length, passed: checked.filter((a) => a.checked === 'PASS').length } };
73
+ }
74
+
75
+ const sec = (title, items) => (items.length ? `<section class="dg-s"><h3 class="pm-h-sm">${esc(title)}</h3><ul class="dg-l">${items.map((t) => `<li>${esc(t)}</li>`).join('')}</ul></section>` : '');
76
+ /** "Week of 16 November" */
77
+ export const weekWord = (W) => { const d = new Date(W.fromMs); return 'Week of ' + d.getDate() + ' ' + MONTH[d.getMonth()]; };
78
+ /** The reading view's body. Read only: the one control is the switch that turns the digest off (on: its state). */
79
+ export function digestHtml(D, o = {}) {
80
+ const on = o.on !== false;
81
+ const sw = `<span class="dg-on"><span class="pm-meta" aria-hidden="true">Each Monday</span><button type="button" class="pm-switch" role="switch" aria-checked="${on}" data-dg="off" aria-label="Make the weekly digest each Monday" title="Make the weekly digest each Monday"></button></span>`;
82
+ if (!on) return `<div class="dg"><div class="dg-hd">${sw}</div><p class="pm-meta">Off. PMOS does not make the weekly digest. Switch it on here or in Settings › General.</p></div>`;
83
+ if (!D) return `<div class="dg"><div class="dg-hd">${sw}</div><p class="pm-meta">Nothing moved last week, and nothing is due next week.</p></div>`;
84
+ const head = `<div class="dg-hd"><p class="pm-meta">${esc([weekWord(D.week), D.products.join(', ')].filter(Boolean).join(' · '))}</p>${sw}</div>`;
85
+ const did = [];
86
+ if (D.did.n) {
87
+ did.push(`PMOS applied ${plural(D.did.n, 'change', 'changes')} by itself` + (D.did.sourced === D.did.n ? ', each with a source.' : D.did.sourced ? `, ${D.did.sourced} with a source.` : '.')
88
+ + (D.did.undone.length ? ` You undid ${D.did.undone.length}: ${D.did.undone.slice(0, 3).map((t) => clip(t, 60)).join('; ')}${D.did.undone.length > 3 ? '; and more' : ''}.` : '') + ` Undo stays open ${UNDO_DAYS} days.`);
89
+ if (D.did.checked) did.push(`The Checker sampled ${D.did.checked}: ${D.did.passed === D.did.checked ? 'all passed' : D.did.passed + ' passed'}.`);
90
+ }
91
+ return `<div class="dg">${head}<section class="dg-s"><h3 class="pm-h-sm">The line this week</h3><p>${esc(D.sum)}</p><p class="pm-meta">Nothing here needs you; it is only to read.</p></section>`
92
+ + sec('What moved', D.moved.map((x) => x.text)) + sec('What PMOS did by itself', did) + sec('Not sent', D.lapsed.map((x) => x.text)) + sec('Next week', D.next.map((x) => x.text)) + '</div>';
93
+ }
94
+ export const LINK = 'Last week’s digest is ready to read.';
95
+ /** The Overview on a Monday with a digest: the sentence ends with the link (a ref the page opens with key 'digest'). Other days: O as it is. */
96
+ export function withDigest(O, D, now = Date.now()) {
97
+ if (!O || !D || !weekOf(now).monday) return O;
98
+ return { ...O, said: [O.said, LINK].filter(Boolean).join(' '), refs: [...(O.refs || []), { text: LINK, key: 'digest' }] };
99
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "The weekly digest (initiative quiet-rows-digest, done test D1-D6): the week, the model, the page, the Overview link, the route and its off switch. No browser.",
3
+ "modules": [
4
+ "quiet-rows-digest.test.js"
5
+ ],
6
+ "seconds": {
7
+ "quiet-rows-digest.test.js": 1
8
+ }
9
+ }