create-pmos 0.758.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 +27 -49
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/guide/home.md +1 -0
- package/workspace/guide/settings-and-switches.md +5 -1
- package/workspace/lib/digest-parts.js +28 -0
- package/workspace/lib/routes-your-move.js +22 -3
- package/workspace/lib/settings-store.js +2 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-settings.js +8 -0
- package/workspace/public/pm/cozy-today-app.js +37 -1
- package/workspace/public/pm/cozy-today-page.css +4 -0
- package/workspace/public/pm/digest-view.js +99 -0
- package/workspace/public/pm/wf-page.js +7 -11
- package/workspace/public/pm/wf-stage.js +3 -2
- package/workspace/public/pm/wf-ws.js +28 -0
- package/workspace/test-lists/quiet-rows-digest.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "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,32 @@
|
|
|
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
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"v": "0.759.0",
|
|
51
|
+
"at": "2026-11-24T02:32:35.299Z",
|
|
52
|
+
"f": 4,
|
|
53
|
+
"prs": [
|
|
54
|
+
{
|
|
55
|
+
"n": 1710,
|
|
56
|
+
"t": "Workflows stage panel follows the picked workspace; a removed pick never opens on a 404",
|
|
57
|
+
"s": "Workflows stage panel follows the picked workspace; a removed pick never opens on a 404",
|
|
58
|
+
"k": "fix"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
36
62
|
{
|
|
37
63
|
"v": "0.758.0",
|
|
38
64
|
"at": "2026-11-24T02:19:59.803Z",
|
|
@@ -356,54 +382,6 @@
|
|
|
356
382
|
"k": "new"
|
|
357
383
|
}
|
|
358
384
|
]
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
"v": "0.739.0",
|
|
362
|
-
"at": "2026-11-23T07:58:34.158Z",
|
|
363
|
-
"f": 4,
|
|
364
|
-
"prs": [
|
|
365
|
-
{
|
|
366
|
-
"n": 1649,
|
|
367
|
-
"t": "Ctrl K answers a question from your own files, with its sources",
|
|
368
|
-
"s": "Ctrl K answers a question from your own files, with its sources",
|
|
369
|
-
"k": "new",
|
|
370
|
-
"try": {
|
|
371
|
-
"steps": [
|
|
372
|
-
"Press Ctrl K (Cmd K on the Mac).",
|
|
373
|
-
"Type a why or how question about your work, for example: why did the paywall date move?"
|
|
374
|
-
],
|
|
375
|
-
"see": "A short answer, with the files it came from listed under it.",
|
|
376
|
-
"open": "/today.html"
|
|
377
|
-
}
|
|
378
|
-
},
|
|
379
|
-
{
|
|
380
|
-
"n": 1651,
|
|
381
|
-
"t": "Open questions styles use tokens (open-questions-today, Checker C6)",
|
|
382
|
-
"s": "Open questions styles use tokens (open-questions-today, Checker C6)",
|
|
383
|
-
"k": "fix"
|
|
384
|
-
}
|
|
385
|
-
]
|
|
386
|
-
},
|
|
387
|
-
{
|
|
388
|
-
"v": "0.738.0",
|
|
389
|
-
"at": "2026-11-23T07:20:29.240Z",
|
|
390
|
-
"f": 4,
|
|
391
|
-
"prs": [
|
|
392
|
-
{
|
|
393
|
-
"n": 1639,
|
|
394
|
-
"t": "Every edit shows at once, and a failed save says so",
|
|
395
|
-
"s": "Every edit shows at once, and a failed save says so",
|
|
396
|
-
"k": "fix",
|
|
397
|
-
"try": {
|
|
398
|
-
"steps": [
|
|
399
|
-
"Open Work, then an initiative's Work breakdown.",
|
|
400
|
-
"Change a task's status or date."
|
|
401
|
-
],
|
|
402
|
-
"see": "It changes the moment you press. If the save fails, it goes back and says Not saved, with Try again.",
|
|
403
|
-
"open": "/premium-board.html"
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
]
|
|
407
385
|
}
|
|
408
386
|
]
|
|
409
387
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -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:
|
|
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:
|
|
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:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T02:57:14Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
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
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"v": "0.759.0",
|
|
17
|
+
"at": "2026-11-24T02:32:35.299Z",
|
|
18
|
+
"f": 4,
|
|
19
|
+
"prs": [
|
|
20
|
+
{
|
|
21
|
+
"n": 1710,
|
|
22
|
+
"t": "Workflows stage panel follows the picked workspace; a removed pick never opens on a 404",
|
|
23
|
+
"s": "Workflows stage panel follows the picked workspace; a removed pick never opens on a 404",
|
|
24
|
+
"k": "fix"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
2
28
|
{
|
|
3
29
|
"v": "0.758.0",
|
|
4
30
|
"at": "2026-11-24T02:19:59.803Z",
|
package/workspace/guide/home.md
CHANGED
|
@@ -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.
|
|
@@ -17,7 +17,7 @@ Press the round menu button at the bottom of any page, then the **Settings** ico
|
|
|
17
17
|
| Prototype rules | What every prototype version is checked for before you see it. |
|
|
18
18
|
| Connectors | Every connector your Claude session has, and a directory of services you can connect. A switch chooses only what PMOS reads on its own. PMOS reads and never posts. |
|
|
19
19
|
| Your account | The Claude login and profile that new sessions start with, the Anthropic API key for PMOS's own runs, and Sharpen prompts. |
|
|
20
|
-
| Workspaces | The repositories PMOS works in. Remove forgets the address only; the folder is not deleted. Add one by its folder path. The **Workflows ›** row opens the stages each kind of initiative goes through, inside Settings, which then takes the whole window. Each workspace keeps its own workflows: when PMOS works in more than one, the **Workspace** picker over the list says whose workflows show, and PMOS remembers your pick. See [Workflows](statuses.md). |
|
|
20
|
+
| Workspaces | The repositories PMOS works in. Remove forgets the address only; the folder is not deleted. Add one by its folder path. The **Workflows ›** row opens the stages each kind of initiative goes through, inside Settings, which then takes the whole window. Each workspace keeps its own workflows: when PMOS works in more than one, the **Workspace** picker over the list says whose workflows show, and PMOS remembers your pick. A stage's Only when readings come from the same workspace. If the workspace you picked is removed, the page opens on the server's own. See [Workflows](statuses.md). |
|
|
21
21
|
| Updates | The version of the app and of each workspace's kit, the check for updates, and what changed. |
|
|
22
22
|
|
|
23
23
|
## Update PMOS and the kit
|
|
@@ -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.
|
|
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.
|
|
9
|
+
"version": "0.760.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -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) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[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
|
+
}
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
* Reads GET /api/workflows and GET /api/workflows/draft. Every write is the PM's press: POST /api/workflows/save | copy | archive | draft.
|
|
17
17
|
* Product feature ships with PMOS and is read-only here: Copy makes an editable one. */
|
|
18
18
|
import { pmGet, pmPost } from './http.js';
|
|
19
|
-
import { esc, svg, ICON
|
|
19
|
+
import { esc, svg, ICON } from './cozy-evui.js';
|
|
20
|
+
import { wsNow, wsQs, setWs, prune, fixed } from './wf-ws.js'; // the one answer to which workspace shows, shared with pm/wf-stage.js
|
|
20
21
|
import * as VW from './cozy-viewer.js';
|
|
21
22
|
import { CATS, wfIcon, PRODUCT_FEATURE_ID } from './wf-model.js';
|
|
22
23
|
import * as E from './wf-edit.js';
|
|
@@ -27,9 +28,6 @@ const $ = (s) => document.querySelector(s);
|
|
|
27
28
|
/* THE WORKSPACE THIS PAGE SHOWS. Each workspace keeps its own library (its pmos/state/workflows.jsonl), so the page says which one it shows
|
|
28
29
|
* and lets the PM pick another (bug 2026-11-24: Settings opened the server's home, a demo repository, and the PM's own workflows in IDPF
|
|
29
30
|
* looked lost). ?ws= wins, then the PM's last pick, then the server's own. */
|
|
30
|
-
const WS_KEY = 'pmos.wf.ws';
|
|
31
|
-
const wsNow = () => wsParam() || store.get(WS_KEY) || '';
|
|
32
|
-
const wsQs = () => (wsNow() ? '?ws=' + encodeURIComponent(wsNow()) : '');
|
|
33
31
|
const post = (path, body) => pmPost(path, wsNow() ? { ws: wsNow(), ...body } : body);
|
|
34
32
|
const PHONE = 760;
|
|
35
33
|
const isPhone = () => innerWidth <= PHONE;
|
|
@@ -113,13 +111,12 @@ function wsPick() {
|
|
|
113
111
|
async function readWorkspaces() {
|
|
114
112
|
const r = await pmGet('/api/workspaces').catch(() => null);
|
|
115
113
|
S.wss = r && Array.isArray(r.workspaces) ? r.workspaces : [];
|
|
116
|
-
// a remembered pick that is no longer a workspace falls back to the server's own
|
|
117
|
-
if (!wsParam() && store.get(WS_KEY) && !S.wss.some((w) => w.id === store.get(WS_KEY))) store.set(WS_KEY, '');
|
|
114
|
+
prune(S.wss); // a remembered pick that is no longer a workspace falls back to the server's own
|
|
118
115
|
drawList();
|
|
119
116
|
}
|
|
120
117
|
function pickWs(id) {
|
|
121
|
-
if (
|
|
122
|
-
|
|
118
|
+
if (fixed() || id === wsNow()) return;
|
|
119
|
+
setWs(id);
|
|
123
120
|
VW.close(); S.sel = null; S.list = null; S.draft = null; S.edit = null; S.msg = ''; S.err = '';
|
|
124
121
|
draw(); load(); readDraft();
|
|
125
122
|
}
|
|
@@ -498,9 +495,8 @@ export function mount(host, o = {}) {
|
|
|
498
495
|
setStageHost(stageCtx());
|
|
499
496
|
if (fresh) bind();
|
|
500
497
|
draw();
|
|
501
|
-
|
|
502
|
-
readDraft(); // a draft PMOS wrote (in this chat or another) shows as its row
|
|
503
|
-
readWorkspaces();
|
|
498
|
+
// the workspaces first: a remembered pick that was removed must go before the first read, or the page opens on "no such workspace"
|
|
499
|
+
readWorkspaces().then(() => { load(); readDraft(); }); // readDraft: a draft PMOS wrote (in this chat or another) shows as its row
|
|
504
500
|
return ROOT;
|
|
505
501
|
}
|
|
506
502
|
/** Settings leaves the panel (another section, or closed): the Viewer leaves the dialog, and nothing keeps reading. */
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* Every change saves at once through the page's save (POST /api/workflows/save). A workflow that ships with PMOS shows read-only.
|
|
11
11
|
* setStageHost(ctx) · openStage(wf, key, { rename? }) */
|
|
12
12
|
import { pmGet } from './http.js';
|
|
13
|
-
import { esc, svg
|
|
13
|
+
import { esc, svg } from './cozy-evui.js';
|
|
14
|
+
import { wsQs } from './wf-ws.js'; // the workspace Settings › Workflows shows (pm/wf-ws.js), not only ?ws=
|
|
14
15
|
import * as VW from './cozy-viewer.js';
|
|
15
16
|
import { CATS, OUTPUT_KINDS, WHEN, wfIcon } from './wf-model.js';
|
|
16
17
|
import * as E from './wf-edit.js';
|
|
@@ -126,7 +127,7 @@ function change(e, key) {
|
|
|
126
127
|
/* ── Only when (WfACond) ── */
|
|
127
128
|
let ROWS = null;
|
|
128
129
|
async function readRows() {
|
|
129
|
-
const r = await pmGet('/api/board-premium' +
|
|
130
|
+
const r = await pmGet('/api/board-premium' + wsQs()).catch(() => null);
|
|
130
131
|
ROWS = r && r.ok && r.model && Array.isArray(r.model.rows) ? r.model.rows : r && r.state === 'reading' ? 'reading' : [];
|
|
131
132
|
return ROWS;
|
|
132
133
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* pm/wf-ws.js — the workspace Settings › Workflows shows (bug 2026-11-24, initiative workflows-pick-workspace). Each workspace keeps its own
|
|
2
|
+
* workflow library, so the page (pm/wf-page.js) and the stage panel (pm/wf-stage.js) read and write the SAME one: ?ws= wins, then the PM's
|
|
3
|
+
* last pick (localStorage 'pmos.wf.ws'), then the server's own. A remembered pick that is no longer a workspace is dropped before the first
|
|
4
|
+
* read (keep), so the page never opens on a 404. Nothing here fetches.
|
|
5
|
+
* pickOf({ param, stored }) → the workspace id, '' for the server's own
|
|
6
|
+
* keep(stored, list) → the stored id when it is still a workspace in list, else ''
|
|
7
|
+
* wsNow() / wsQs() / setWs(id) the browser's answer, its ?ws= query, and the pick */
|
|
8
|
+
import { wsParam } from './cozy-evui.js';
|
|
9
|
+
|
|
10
|
+
export const WS_KEY = 'pmos.wf.ws';
|
|
11
|
+
const store = { get(k) { try { return localStorage.getItem(k); } catch { return null; } }, set(k, v) { try { if (v) localStorage.setItem(k, v); else localStorage.removeItem(k); } catch { /* a private window */ } } };
|
|
12
|
+
|
|
13
|
+
export const pickOf = ({ param, stored } = {}) => param || stored || '';
|
|
14
|
+
export function keep(stored, list) {
|
|
15
|
+
if (!stored) return '';
|
|
16
|
+
return (Array.isArray(list) ? list : []).some((w) => w && w.id === stored && !w.linked) ? stored : '';
|
|
17
|
+
}
|
|
18
|
+
export const wsNow = () => pickOf({ param: wsParam(), stored: store.get(WS_KEY) });
|
|
19
|
+
export const wsQs = () => (wsNow() ? '?ws=' + encodeURIComponent(wsNow()) : '');
|
|
20
|
+
export const fixed = () => !!wsParam();
|
|
21
|
+
export function setWs(id) { store.set(WS_KEY, id || ''); }
|
|
22
|
+
/** After reading the workspaces: a stale pick goes, so the next read is the server's own. true when it dropped one. */
|
|
23
|
+
export function prune(list) {
|
|
24
|
+
const s = store.get(WS_KEY);
|
|
25
|
+
if (wsParam() || !s || keep(s, list)) return false;
|
|
26
|
+
store.set(WS_KEY, '');
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
@@ -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
|
+
}
|