create-pmos 0.661.0 → 0.662.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 +9 -3
- 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 +8 -2
- package/workspace/guide/routine.md +4 -5
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-routine-detail.js +99 -0
- package/workspace/public/pm/cozy-routine-model.js +2 -2
- package/workspace/public/pm/cozy-routine.css +64 -66
- package/workspace/public/pm/cozy-routine.js +127 -38
- package/workspace/public/premium-routine.html +16 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.662.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": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
36
|
{
|
|
37
|
-
"v": "0.
|
|
38
|
-
"at": "2026-11-22T04:
|
|
37
|
+
"v": "0.662.0",
|
|
38
|
+
"at": "2026-11-22T04:06:35.609Z",
|
|
39
39
|
"f": 4,
|
|
40
40
|
"prs": [
|
|
41
41
|
{
|
|
@@ -49,6 +49,12 @@
|
|
|
49
49
|
"t": "Rebuild the Intelligence page from Komorebi blocks",
|
|
50
50
|
"s": "Rebuild the Intelligence page from Komorebi blocks",
|
|
51
51
|
"k": "new"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"n": 1442,
|
|
55
|
+
"t": "Routine is built from the design system's blocks",
|
|
56
|
+
"s": "Routine is built from the design system's blocks",
|
|
57
|
+
"k": "new"
|
|
52
58
|
}
|
|
53
59
|
]
|
|
54
60
|
},
|
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-22T04:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T04:06:31Z"}
|
|
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-22T04:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T04:06:31Z"}
|
|
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-22T04:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T04:06:31Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"v": "0.
|
|
4
|
-
"at": "2026-11-22T04:
|
|
3
|
+
"v": "0.662.0",
|
|
4
|
+
"at": "2026-11-22T04:06:35.609Z",
|
|
5
5
|
"f": 4,
|
|
6
6
|
"prs": [
|
|
7
7
|
{
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"t": "Rebuild the Intelligence page from Komorebi blocks",
|
|
16
16
|
"s": "Rebuild the Intelligence page from Komorebi blocks",
|
|
17
17
|
"k": "new"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"n": 1442,
|
|
21
|
+
"t": "Routine is built from the design system's blocks",
|
|
22
|
+
"s": "Routine is built from the design system's blocks",
|
|
23
|
+
"k": "new"
|
|
18
24
|
}
|
|
19
25
|
]
|
|
20
26
|
},
|
|
@@ -10,14 +10,13 @@ Routine is the place for everything PMOS does by itself on a schedule, and for y
|
|
|
10
10
|
|
|
11
11
|
## The table
|
|
12
12
|
|
|
13
|
-
Routine is
|
|
13
|
+
Routine is built from the PMOS design system's blocks. One "PMOS did" line is at the top, then the kinds as tabs, then one table. A switch that is on is green. A late Next shows as a rust-coloured label. Undo is the arrow in the toast at the bottom.
|
|
14
14
|
|
|
15
|
-
Routine is one table. Each row has these columns:
|
|
15
|
+
Routine is one table. The group a row is in says its type, so there is no Type column. Each row has these columns:
|
|
16
16
|
|
|
17
17
|
| Column | What it shows |
|
|
18
18
|
|---|---|
|
|
19
19
|
| Routine | The name of the report, the source, the job or the task. |
|
|
20
|
-
| Type | Report, Read, PMOS job or Your task. |
|
|
21
20
|
| Product | The product the routine belongs to, by the same name as on every other page (IDPF, not a folder name). This column shows only when the table holds routines of two products or more. |
|
|
22
21
|
| What it does | For a report, who it tells. A report that names no reader tells you. For a read or a job, what it does. |
|
|
23
22
|
| When | How often it repeats, in short words, for example "Every two weeks, Wed 09:00". |
|
|
@@ -32,7 +31,7 @@ The rows are in these groups, in this order:
|
|
|
32
31
|
4. **PMOS jobs.** The jobs PMOS runs by itself, such as the day check and the initiative driver.
|
|
33
32
|
5. **Your tasks.** Your own scheduled tasks.
|
|
34
33
|
|
|
35
|
-
A group with no rows does not show. Use the kinds at the top (All, Reports, Reads,
|
|
34
|
+
A group with no rows does not show. Use the kinds at the top (All, Reports, Reads, Jobs, Your tasks) to show one kind. Each kind shows how many routines it holds. PMOS remembers the kind you chose on this computer.
|
|
36
35
|
|
|
37
36
|
The chip on the left of the kinds is the same chip as on Events. Tick products, programs or projects to show only their routines. The products you tick are the same as on Work. A report shows under a program or a project when its setup is about it. Reads and PMOS jobs serve every product, so they always show. When you tick a program or a project, they fold to their heading, so its reports come first. Press the heading to open them. When the chip hides routines, one grey line says how many. Press **Show all** to show them on this page. What you ticked does not change.
|
|
38
37
|
|
|
@@ -44,7 +43,7 @@ The line at the top says how many things PMOS did since yesterday, and how many
|
|
|
44
43
|
|
|
45
44
|
## Open a routine
|
|
46
45
|
|
|
47
|
-
Press a row.
|
|
46
|
+
Press a row. On a desk, the first press shows the routine at the right: what it does, its product, when it runs, what it reads, its template and its last runs. When PMOS sees a pattern, for example the last two runs failed, a suggestion sits under it. Press the row again, press Enter or press Open in full to open it in the popup. When Ask PMOS is hidden, press **Ask PMOS** to show it on the right.
|
|
48
47
|
|
|
49
48
|
Every routine has the same parts:
|
|
50
49
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.662.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.662.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/* pm/cozy-routine-detail.js — a routine in the Detail at the right of Routine (initiative routine-ds-page; board RoutineDS on Exploring 3,
|
|
2
|
+
* page "pages"; done test planning/done-tests/routine-ds-page.md C3, C4). PURE: no DOM and no fetch, so node tests it (routine-place.test.js).
|
|
3
|
+
*
|
|
4
|
+
* Main + open item (Komorebi MainItem): the table stays, the pressed row opens here. The Detail part: the name, the row's own switch, then
|
|
5
|
+
* icon buttons Chat (the chat slide-over about this routine), Open in full (the full popup, pm/cozy-routine-pop.js or pm/cozy-routine-job.js,
|
|
6
|
+
* where every value edits, ▶ runs it now and ⋯ deletes it) and Close. Then what it does, the fields (Product, When, Reads, Tells, Next) and
|
|
7
|
+
* Last runs: a report's issues, each opens the issue; a read's, job's or task's runs, a failed one says why.
|
|
8
|
+
*
|
|
9
|
+
* One expanded Suggestion (pm-sug x, the shared sugHtml of pm/bd-stands.js) only when PMOS sees a pattern in the records:
|
|
10
|
+
* wait a report PMOS proposes (its row waits in Waits for you): Yes starts it (confirm, or move to the product it is about), No drops it.
|
|
11
|
+
* fail a read, a job or your task whose last two runs failed: Yes runs it once now, No hides the line for those runs on this computer.
|
|
12
|
+
* Every word comes from a field of a record; a field the record leaves silent is not drawn.
|
|
13
|
+
* detailHtml(D) · patternOf(D) · fieldsOf(D) · lastOf(D) D = { row, rep?, job?: { raw, tools, own, svc, extra }, hide?: Set } */
|
|
14
|
+
import { runsOf } from './cozy-routine-job.js';
|
|
15
|
+
import { builtFrom, dayMon, issueName } from './cozy-routine-pop.js';
|
|
16
|
+
import { dayTime } from './cozy-routine-model.js';
|
|
17
|
+
import { sugHtml } from './bd-stands.js';
|
|
18
|
+
|
|
19
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
20
|
+
const svg = (d, n = 16) => `<svg class="pm-ic" viewBox="0 0 24 24" width="${n}" height="${n}" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
21
|
+
export const DI = {
|
|
22
|
+
chat: 'M4 5h16v11H9l-5 4z', full: 'M14 4h6v6M20 4l-7 7M10 20H4v-6M4 20l7-7', x: 'M6 6l12 12M18 6L6 18', open: 'M14 4h6v6M20 4l-9 9M18 14v6H4V6h6',
|
|
23
|
+
};
|
|
24
|
+
const KIND = { reports: 'Report', reads: 'PMOS reads', jobs: 'PMOS job', tasks: 'Your task' };
|
|
25
|
+
|
|
26
|
+
/** What it does, in one paragraph: a report's purpose (or who it tells), a read's or job's own words, your task's instruction. */
|
|
27
|
+
export function doesOf(D) {
|
|
28
|
+
const r = D.row || {}, raw = (D.job && D.job.raw) || {};
|
|
29
|
+
if (r.kind === 'reports') return String((D.rep && D.rep.purpose) || r.does || '');
|
|
30
|
+
if (r.kind === 'tasks') return String(raw.args || r.does || '');
|
|
31
|
+
if (r.svc) return 'Reads what is new in ' + r.name + ' and puts it into Today. It reads only; it sends nothing.';
|
|
32
|
+
return String(raw.what || r.does || '');
|
|
33
|
+
}
|
|
34
|
+
/** The fields, as [label, words]: only what the records say. */
|
|
35
|
+
export function fieldsOf(D) {
|
|
36
|
+
const r = D.row || {}, rep = D.rep || null, J = D.job || {}, raw = J.raw || {};
|
|
37
|
+
const out = [];
|
|
38
|
+
out.push(['Product', (r.wss && r.wss.length ? r.wss.join(', ') : r.kind === 'reads' || r.kind === 'jobs' ? 'Every product' : '')]);
|
|
39
|
+
out.push(['When', r.when || '']);
|
|
40
|
+
const reads = r.kind === 'reports' ? (rep && rep.source ? builtFrom(rep) : '') : r.kind === 'tasks' ? String(raw.skill || raw.task || '') : (raw.inputs || []).map((i) => i && i.label).filter(Boolean).join(', ');
|
|
41
|
+
out.push(['Reads', reads]);
|
|
42
|
+
if (r.kind === 'reports') out.push(['Tells', String((rep && rep.audience) || 'You')]);
|
|
43
|
+
if (!r.proposed) out.push(['Next', r.next || '']); // a proposal has no Next: its Suggestion says what starts it
|
|
44
|
+
return out.filter(([, v]) => v);
|
|
45
|
+
}
|
|
46
|
+
/** Last runs, newest first (at most 5): { when, said, ok, path? }. A report's are its issues (Draft or Issued); the rest come from runsOf. */
|
|
47
|
+
export function lastOf(D) {
|
|
48
|
+
const r = D.row || {};
|
|
49
|
+
if (r.kind === 'reports') {
|
|
50
|
+
const L = ((D.rep && D.rep.issues) || []).filter((x) => x && !x.archived && x.path).slice().sort((a, b) => (a.slot < b.slot ? 1 : -1)).slice(0, 5);
|
|
51
|
+
return L.map((x) => ({ when: dayMon(x.slot), said: (issueName(D.rep.issues, x.path) || 'Issue').replace(/ · .*$/, '') + (x.state === 'issued' ? ' · issued' : ' · a draft'), ok: true, path: x.path }));
|
|
52
|
+
}
|
|
53
|
+
if (!D.job) return [];
|
|
54
|
+
return runsOf({ row: r, raw: D.job.raw || {}, tools: D.job.tools || null, svc: D.job.svc || null }).map((u) => ({ when: dayTime(u.at), said: u.said, ok: u.ok }));
|
|
55
|
+
}
|
|
56
|
+
/** The one pattern PMOS sees in the records, as an expanded Suggestion's words, or null. */
|
|
57
|
+
export function patternOf(D) {
|
|
58
|
+
const r = D.row || {};
|
|
59
|
+
if (r.proposed && r.kind === 'reports') {
|
|
60
|
+
const act = (D.rep && D.rep.act) || {}, move = act.act === 'move';
|
|
61
|
+
if (!act.act) return null;
|
|
62
|
+
return { id: 'wait', title: move ? 'Move ' + r.name + ' to ' + (act.toName || act.to) + ' and start it?' : 'Start ' + r.name + '?',
|
|
63
|
+
why: 'PMOS wrote its definition and it waits for your word. Until then nothing drafts it.',
|
|
64
|
+
will: [move ? 'Move the definition to ' + (act.toName || act.to) : 'Turn the switch on', 'Draft it ' + (r.when ? r.when.replace(/^Every/, 'every') : 'on its schedule') + ' and put each issue in Library'],
|
|
65
|
+
changes: 'It moves from Waits for you to Reports, switched on. Nothing is sent: you send each issue yourself.',
|
|
66
|
+
basis: D.rep && D.rep.definition ? 'Its definition, ' + D.rep.definition : 'Its definition' };
|
|
67
|
+
}
|
|
68
|
+
if (r.kind === 'reports' || !D.job) return null;
|
|
69
|
+
const runs = runsOf({ row: r, raw: D.job.raw || {}, tools: D.job.tools || null, svc: D.job.svc || null });
|
|
70
|
+
const fails = [];
|
|
71
|
+
for (const u of runs) { if (u.ok || u.said === 'Running') break; fails.push(u); }
|
|
72
|
+
if (fails.length < 2) return null;
|
|
73
|
+
const sig = 'fail:' + r.key + ':' + fails[0].at;
|
|
74
|
+
if (D.hide && D.hide.has(sig)) return null;
|
|
75
|
+
return { id: 'fail', sig, title: 'Run ' + r.name + ' again now?',
|
|
76
|
+
why: 'The last ' + fails.length + ' runs failed. The newest says: ' + fails[0].said.replace(/^Failed:?\s*/, '') + '.',
|
|
77
|
+
will: [r.kind === 'reads' ? 'Read it once now' : 'Run it once now', 'Show what came out under Last runs'],
|
|
78
|
+
changes: 'Nothing else. Its schedule and its switch stay as they are.',
|
|
79
|
+
basis: 'Its last ' + fails.length + ' runs, ' + dayTime(fails[fails.length - 1].at) + ' to ' + dayTime(fails[0].at) };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** The Detail, as html. */
|
|
83
|
+
export function detailHtml(D) {
|
|
84
|
+
const r = D.row || {}, busy = !!D.busy;
|
|
85
|
+
const label = r.proposed ? r.name + ': proposed by PMOS. Press to start it' : r.name + (r.on ? ': on. Press to pause it' : ': paused. Press to start it again');
|
|
86
|
+
const sw = r.on === null || r.on === undefined ? '' : `<button type="button" class="pm-switch" role="switch" aria-checked="${!!r.on}" data-sw="${esc(r.key)}" aria-label="${esc(label)}" title="${r.proposed ? 'Proposed. Turn on to start it' : r.on ? 'On' : 'Paused'}"${busy ? ' disabled' : ''}></button>`;
|
|
87
|
+
const btn = (k, icon, l) => `<button type="button" class="pm-btn" data-rd="${k}" aria-label="${esc(l)}" title="${esc(l)}">${svg(icon)}</button>`;
|
|
88
|
+
const head = `<div class="head"><h2 class="pm-h rt-dt">${esc(r.name)}</h2>${sw}${btn('chat', DI.chat, 'Chat about ' + r.name)}${btn('full', DI.full, 'Open in full')}${btn('close', DI.x, 'Close')}</div>`;
|
|
89
|
+
const does = doesOf(D);
|
|
90
|
+
const f = fieldsOf(D);
|
|
91
|
+
const fields = f.length ? `<dl class="pm-field">${f.map(([k, v]) => `<dt>${esc(k)}</dt><dd>${esc(v)}</dd>`).join('')}</dl>` : '';
|
|
92
|
+
const L = lastOf(D);
|
|
93
|
+
const runs = `<div class="rt-runs"><h3 class="pm-meta rt-dh">Last runs</h3>${L.length ? `<div class="rows">${L.map((u) => `<div class="pm-li"><span class="pm-meta rt-when">${esc(u.when)}</span><span class="txt"><span class="w${u.ok ? '' : ' bad'}">${esc(u.said)}</span></span>`
|
|
94
|
+
+ (u.path ? `<span class="acts"><button type="button" class="pm-btn" data-rd="issue" data-path="${esc(u.path)}" aria-label="${esc('Open ' + u.said)}" title="Open it">${svg(DI.open)}</button></span>` : '') + '</div>').join('')}</div>` : '<p class="pm-meta">It has not run yet.</p>'}</div>`;
|
|
95
|
+
const p = patternOf(D);
|
|
96
|
+
const sug = p ? sugHtml(p, `data-pat="${esc(p.id)}" data-key="${esc(r.key)}"${p.sig ? ` data-sig="${esc(p.sig)}"` : ''}`, 'data-rsug') : '';
|
|
97
|
+
const msg = D.msg ? `<p class="pm-meta" role="status">${esc(D.msg)}</p>` : '';
|
|
98
|
+
return `<section class="pm-block rt-detail pm-motion-enter" aria-label="${esc(KIND[r.kind] + ': ' + r.name)}">${head}${does ? `<p class="rt-does">${esc(does)}</p>` : ''}${fields}${runs}${sug}${msg}</section>`;
|
|
99
|
+
}
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
* wait { act, label, say } on a row of Waits for you: its one ✓ (confirm the definition, or move it to the product it is about)
|
|
16
16
|
* routineGroups(rows, kind) → [{ id, title, rows }] the groups in order; a group with no row is left out (zero is silence)
|
|
17
17
|
* didLine(done, now) → { n, recent, shown, text } | null the one "PMOS did" line over GET /api/autonomy done of every product
|
|
18
|
-
* KINDS the filter: All, Reports, Reads,
|
|
18
|
+
* KINDS the filter (the Tabs): All, Reports, Reads, Jobs, Your tasks
|
|
19
19
|
*
|
|
20
20
|
* Every word comes from a field of a record. A field the record leaves silent is '' and its cell is empty; nothing is filled with a guess. */
|
|
21
21
|
import { atOf, everyLine } from './cozy-evmodel.js';
|
|
22
22
|
|
|
23
|
-
export const KINDS = [['all', 'All'], ['reports', 'Reports'], ['reads', 'Reads'], ['jobs', '
|
|
23
|
+
export const KINDS = [['all', 'All'], ['reports', 'Reports'], ['reads', 'Reads'], ['jobs', 'Jobs'], ['tasks', 'Your tasks']];
|
|
24
24
|
/** A work copy's product: "pmos-idpf ⑂ initiative/psle-paywall-lock" → "pmos-idpf". A branch name never shows (round 3 item 2). */
|
|
25
25
|
export const productName = (n) => String(n || '').split(' ⑂ ')[0].trim();
|
|
26
26
|
/** The Type word of each kind (round 2): the first column after the name. */
|
|
@@ -1,69 +1,63 @@
|
|
|
1
|
-
/* pm/cozy-routine.css — Routine (initiative routine-place, board 11
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
1
|
+
/* pm/cozy-routine.css — Routine (initiative routine-place, board 11; rebuilt from blocks by routine-ds-page, board RoutineDS) and a routine
|
|
2
|
+
* in the popup (board 10).
|
|
3
|
+
* The page is drawn from the PMOS design system (Komorebi, ui/pages.md: Main + open item). Its parts come from pm/komorebi.css: the top line
|
|
4
|
+
* is pm-path and icon pm-btn, "PMOS did" a pm-block flat, the table a pm-block holding pm-tabs and one pm-table whose group rows are
|
|
5
|
+
* pm-group, the switch pm-switch, a late Next the alert pm-badge, the fold line pm-fold, the Detail a pm-block with pm-field, pm-li and the
|
|
6
|
+
* expanded Suggestion (pm-sug x), and the toast pm-toast. This first part only places them. The popup (board 10, below) opens outside the
|
|
7
|
+
* page and keeps cozy.css's tokens. */
|
|
6
8
|
.rt-page { gap: var(--space-16); }
|
|
7
|
-
|
|
8
|
-
.rt-page
|
|
9
|
-
.rt-page .rt-toast { width: auto; max-width: none; }
|
|
9
|
+
.rt-page > * { width: 100%; }
|
|
10
|
+
.rt-page .rt-toast { width: auto; }
|
|
10
11
|
.rt-pick:empty { display: none; }
|
|
11
|
-
.rt-
|
|
12
|
-
.rt-
|
|
13
|
-
|
|
14
|
-
.rt-
|
|
15
|
-
.rt-page
|
|
16
|
-
.rt-
|
|
17
|
-
.rt-
|
|
18
|
-
.rt-
|
|
19
|
-
|
|
20
|
-
.rt-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.rt-
|
|
24
|
-
.rt-
|
|
25
|
-
.rt-page .rt-
|
|
26
|
-
|
|
27
|
-
.rt-
|
|
28
|
-
.rt-
|
|
29
|
-
.rt-tbl
|
|
30
|
-
.rt-
|
|
31
|
-
|
|
32
|
-
.rt-
|
|
33
|
-
.rt-
|
|
34
|
-
.rt-
|
|
35
|
-
.rt-
|
|
36
|
-
.rt-
|
|
37
|
-
.rt-
|
|
38
|
-
.rt-
|
|
39
|
-
.rt-
|
|
40
|
-
.rt-
|
|
41
|
-
.rt-
|
|
42
|
-
.rt-
|
|
43
|
-
|
|
44
|
-
.rt-r .n, .rt-r .c { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 6px 0; line-height: 1.35; }
|
|
45
|
-
.rt-r .c { color: var(--muted); }
|
|
46
|
-
.rt-r .c .w { white-space: normal; height: auto; min-height: 22px; }
|
|
47
|
-
.rt-r.off .n, .rt-r.off .c { color: var(--muted); }
|
|
48
|
-
.rt-r.off .n { font-weight: var(--fw-regular); }
|
|
49
|
-
.rt-page .rt-sw { justify-self: end; }
|
|
50
|
-
.rt-page .rt-sw[disabled] { opacity: .5; cursor: default; }
|
|
51
|
-
/* one-time reports and loose drafts: one fold line at the end of Reports (round 3 item 1) */
|
|
52
|
-
.rt-page .rt-r.rt-fold { display: block; min-height: 0; padding: 0; }
|
|
53
|
-
.rt-page .rt-fold .pm-fold { border-top: 0; padding: 0 18px; }
|
|
54
|
-
.rt-page .rt-fold .pm-ic, .rt-gf .pm-ic { width: 14px; height: 14px; transition: transform var(--duration-quick) var(--ease-drift); }
|
|
12
|
+
.rt-top { display: flex; align-items: center; gap: var(--space-12); min-height: 32px; }
|
|
13
|
+
.rt-top .rt-sp { flex: 1; }
|
|
14
|
+
/* Main + open item: the table stays, the open routine sits at the right */
|
|
15
|
+
.rt-mi { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-16); align-items: start; }
|
|
16
|
+
.rt-page.rt-open .rt-mi { grid-template-columns: minmax(0, 1fr) 400px; }
|
|
17
|
+
.rt-main { display: flex; flex-direction: column; gap: var(--space-12); min-width: 0; }
|
|
18
|
+
.rt-aside:empty { display: none; }
|
|
19
|
+
.rt-aside { position: sticky; top: var(--space-16); min-width: 0; }
|
|
20
|
+
/* PMOS did */
|
|
21
|
+
.rt-page .rt-did { flex-direction: row; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer; }
|
|
22
|
+
.rt-did .rt-say { flex: 1; min-width: 0; }
|
|
23
|
+
/* the table */
|
|
24
|
+
.rt-tbl .head .pm-tabs { flex-wrap: wrap; }
|
|
25
|
+
.rt-tbl .pm-tab .rt-n { font-weight: var(--fw-regular); color: var(--muted); font-variant-numeric: tabular-nums; }
|
|
26
|
+
.rt-page .pm-tab:focus-visible, .rt-page .rt-row:focus-visible { outline: none; box-shadow: var(--glow); }
|
|
27
|
+
.rt-tbl .pm-table th.pm-group { display: table-cell; height: 32px; }
|
|
28
|
+
.rt-tbl .pm-table th.pm-group b { color: var(--ink); }
|
|
29
|
+
.rt-tbl .pm-table .rt-g:hover th { background: var(--well); }
|
|
30
|
+
.rt-tbl .rt-row { cursor: pointer; }
|
|
31
|
+
.rt-tbl .rt-row td:first-child { padding-left: var(--space-16); }
|
|
32
|
+
.rt-tbl .rt-name { white-space: nowrap; }
|
|
33
|
+
.rt-tbl .rt-name b { font-weight: var(--fw-strong); }
|
|
34
|
+
.rt-tbl .rt-does { color: var(--muted); }
|
|
35
|
+
.rt-tbl .rt-when, .rt-tbl .rt-nx { white-space: nowrap; }
|
|
36
|
+
.rt-tbl .rt-next { font-family: var(--font-mono); }
|
|
37
|
+
.rt-tbl .rt-on { width: 1%; white-space: nowrap; }
|
|
38
|
+
.rt-tbl .rt-on .pm-row { justify-content: flex-end; flex-wrap: nowrap; }
|
|
39
|
+
.rt-tbl .rt-row.off .rt-name b { font-weight: var(--fw-regular); color: var(--muted); }
|
|
40
|
+
.rt-tbl .rt-drop { visibility: hidden; color: var(--muted); }
|
|
41
|
+
.rt-tbl .rt-row:hover .rt-drop, .rt-tbl .rt-drop:focus-visible { visibility: visible; }
|
|
42
|
+
.rt-tbl .pm-switch[disabled] { opacity: .5; cursor: default; }
|
|
43
|
+
.rt-tbl .rt-fold td { padding: 0; }
|
|
44
|
+
.rt-page .rt-fold .pm-ic, .rt-gf .pm-ic { transition: transform var(--duration-quick) var(--ease-drift); }
|
|
55
45
|
.rt-page .rt-fold button[aria-expanded="true"] .pm-ic, .rt-gf[aria-expanded="true"] .pm-ic { transform: rotate(90deg); }
|
|
56
|
-
.rt-page .rt-fold button:focus-visible { outline: none; box-shadow: var(--glow); }
|
|
57
|
-
/* ✕ on a proposed report: shown on hover, where the chevron is */
|
|
58
|
-
.rt-page .rt-r .go .rt-drop { width: 28px; height: 28px; margin: -7px; color: var(--muted); }
|
|
59
|
-
.rt-r .go:has(.rt-drop) { opacity: 0; }
|
|
60
|
-
.rt-r.rt-row:hover .go:has(.rt-drop), .rt-r .go:has(.rt-drop:focus-visible) { opacity: 1; }
|
|
61
|
-
/* PMOS reads and PMOS jobs fold to their heading while a program or project is picked */
|
|
62
46
|
.rt-gf { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
|
|
63
|
-
.rt-gf
|
|
64
|
-
.rt-
|
|
65
|
-
.rt-
|
|
66
|
-
.rt-page .rt-msg { margin: 0
|
|
47
|
+
.rt-gf:focus-visible, .rt-page .rt-fold button:focus-visible { box-shadow: var(--glow); border-radius: var(--radius-sm); }
|
|
48
|
+
.rt-hid { margin: 0; }
|
|
49
|
+
.rt-hid .pm-chip { border: 0; font: inherit; font-weight: var(--fw-strong); color: var(--blue); background: var(--blue-tint); cursor: pointer; }
|
|
50
|
+
.rt-page .rt-quiet, .rt-page .rt-msg { margin: 0; min-height: 1em; }
|
|
51
|
+
/* the Detail */
|
|
52
|
+
.rt-detail .head .rt-dt { flex: 1; min-width: 0; }
|
|
53
|
+
.rt-detail .rt-does { margin: 0; font-size: var(--fs-body); line-height: 22px; }
|
|
54
|
+
.rt-detail .pm-field { margin: 0; }
|
|
55
|
+
.rt-detail .rt-dh { margin: 0 0 4px; font-weight: var(--fw-regular); }
|
|
56
|
+
.rt-detail .rt-when { width: 96px; flex: none; font-family: var(--font-mono); white-space: nowrap; }
|
|
57
|
+
.rt-detail .pm-li { min-height: 44px; }
|
|
58
|
+
.rt-detail .pm-li .w { color: var(--ink); white-space: normal; }
|
|
59
|
+
.rt-detail .pm-li .w.bad { color: var(--alert); }
|
|
60
|
+
.rt-detail .pm-sug.x dd { overflow-wrap: anywhere; }
|
|
67
61
|
/* the toast: the Toast part, bottom centre; the leaf line counts down the time the Undo has */
|
|
68
62
|
.rt-page .rt-toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); z-index: 90; opacity: 0; pointer-events: none; transition: opacity var(--duration-enter) var(--ease-out), transform var(--duration-enter) var(--ease-out); }
|
|
69
63
|
.rt-page .rt-toast:empty { display: none; }
|
|
@@ -74,11 +68,15 @@
|
|
|
74
68
|
.rt-page .rt-toast.on .timer { animation: rtTimer 4.2s linear both; }
|
|
75
69
|
@keyframes rtTimer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
|
|
76
70
|
@media (prefers-reduced-motion: reduce) { .rt-page .rt-toast { transform: translate(-50%, 0); } .rt-page .rt-toast.on .timer { animation: none; } }
|
|
71
|
+
@media (max-width: 1100px) { .rt-page.rt-open .rt-mi { grid-template-columns: minmax(0, 1fr) 340px; } }
|
|
72
|
+
/* a phone: the Table reads as a List (the name, Next and the switch); a row opens the popup, so the Detail never shows */
|
|
77
73
|
@media (max-width: 760px) {
|
|
78
|
-
.rt-
|
|
79
|
-
.rt-
|
|
80
|
-
.rt-
|
|
81
|
-
.rt-
|
|
74
|
+
body.cz-phmore .rt-top { padding-right: 48px; }
|
|
75
|
+
.rt-page.rt-open .rt-mi { grid-template-columns: minmax(0, 1fr); }
|
|
76
|
+
.rt-aside { display: none; }
|
|
77
|
+
.rt-tbl .rt-does, .rt-tbl .rt-when, .rt-tbl .rt-prod { display: none; }
|
|
78
|
+
.rt-tbl .rt-name { white-space: normal; }
|
|
79
|
+
.rt-tbl .rt-row td { padding-top: 12px; padding-bottom: 12px; }
|
|
82
80
|
.rt-page .pm-btn { width: 44px; height: 44px; }
|
|
83
81
|
}
|
|
84
82
|
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
/* pm/cozy-routine.js — Routine, the place (initiative routine-place, slice 8 of the six-place navigation;
|
|
2
|
-
*
|
|
1
|
+
/* pm/cozy-routine.js — Routine, the place (initiative routine-place, slice 8 of the six-place navigation; rebuilt from the design system's
|
|
2
|
+
* blocks by initiative routine-ds-page, board RoutineDS on Exploring 3 page "pages"; done tests planning/done-tests/routine-place.md and
|
|
3
|
+
* planning/done-tests/routine-ds-page.md).
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Main + open item (Komorebi MainItem). The top line is the path, the product chip (the shared scope chip of Events), then + as an icon
|
|
6
|
+
* button: it asks PMOS for a new routine. "PMOS did" is one line on top (a pm-block flat); a press opens the full log in the popup, each line
|
|
7
|
+
* with its Undo. Then one Table block: the kinds as Tabs in its head (All, Reports, Reads, Jobs, Your tasks with counts; PMOS remembers the
|
|
8
|
+
* choice on this computer), and one pm-table of everything that repeats: Routine, Product (two products or more), What it does, When, Next,
|
|
9
|
+
* and the same switch on every row. Group rows (pm-group) say the type, so there is no Type column: Waits for you, Reports, PMOS reads,
|
|
10
|
+
* PMOS jobs, Your tasks (pm/cozy-routine-model.js). A proposed routine waits in Waits for you with its switch off.
|
|
11
|
+
* On a desk a row opens the Detail at the right (pm/cozy-routine-detail.js); a second press, Enter on the open row, or Open in full opens the
|
|
12
|
+
* one popup (pm/cozy-routine-pop.js for a report, pm/cozy-routine-job.js for the rest), where every value edits. Esc closes the Detail; j and
|
|
13
|
+
* k move to the next and the previous routine. A phone opens the popup at once. It replaces the Scheduled work list of Settings › Connectors.
|
|
8
14
|
*
|
|
9
15
|
* READS GET /api/workspaces, then per product GET /api/report-setups/routine?ws and GET /api/autonomy?ws; once GET /api/refresh and
|
|
10
16
|
* GET /api/schedules?all=1. Every product is read: Routine has no product choice (slice 1).
|
|
11
17
|
* WRITES, each the PM's press: a report's switch → POST /api/report-setups/pause | resume; a read or a job → POST /api/refresh/source { id, on };
|
|
12
|
-
* your task → POST /api/schedules/update { id, enabled }; the switch of a proposed report (Waits for you)
|
|
13
|
-
*
|
|
18
|
+
* your task → POST /api/schedules/update { id, enabled }; the switch of a proposed report (Waits for you), or Yes on its Suggestion →
|
|
19
|
+
* /api/report-setups/confirm | move; No on it → /api/report-setups/drop after its Undo; Yes on "run it again" → /api/refresh/run,
|
|
20
|
+
* /api/scan/now or /api/schedules/run; Undo in the log → POST /api/autonomy/undo. Nothing here sends anything outside. */
|
|
14
21
|
import { pmGet, pmPost } from './http.js';
|
|
15
22
|
import { mountNav } from './cozy-nav.js';
|
|
16
23
|
import { mountLivePill } from './cozy-live-pill.js';
|
|
@@ -22,6 +29,7 @@ import { scopeChipHtml, openScope, scopeWords, whenNames, displayName, productNa
|
|
|
22
29
|
import { atOf } from './cozy-evmodel.js';
|
|
23
30
|
import { openReport } from './cozy-routine-pop.js';
|
|
24
31
|
import { openJob, openNew } from './cozy-routine-job.js'; // reads, jobs, services and your tasks: manage them in the popup (round 3 item 3)
|
|
32
|
+
import { detailHtml } from './cozy-routine-detail.js'; // the Detail at the right (routine-ds-page)
|
|
25
33
|
|
|
26
34
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
27
35
|
const svg = (d, n = 18) => `<svg class="pm-ic" viewBox="0 0 24 24" width="${n}" height="${n}" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
@@ -32,7 +40,8 @@ const I = {
|
|
|
32
40
|
};
|
|
33
41
|
const KIND_KEY = 'pmos.routine.kind';
|
|
34
42
|
const store = { get(k) { try { return localStorage.getItem(k); } catch { return null; } }, set(k, v) { try { localStorage.setItem(k, v); } catch { /* a private window */ } } };
|
|
35
|
-
const S = { ws: [], reports: [], refresh: [], tasks: [], done: [], kind: KINDS.some(([k]) => k === store.get(KIND_KEY)) ? store.get(KIND_KEY) : 'all', rows: [], busy: new Set(), gone: new Set(), read: false, err: '', pick: null, all: false, openG: new Set() };
|
|
43
|
+
const S = { ws: [], reports: [], refresh: [], tasks: [], done: [], kind: KINDS.some(([k]) => k === store.get(KIND_KEY)) ? store.get(KIND_KEY) : 'all', rows: [], busy: new Set(), gone: new Set(), read: false, err: '', pick: null, all: false, openG: new Set(), open: null, msg: '' };
|
|
44
|
+
const NOFAIL = 'pmos.routine.nofail.'; // No on "run it again": hidden for those runs on this computer
|
|
36
45
|
const $ = (id) => document.getElementById(id);
|
|
37
46
|
/** A short line at the bottom. With `undo`, it carries an Undo button and stays 10 s, the time the undo has. */
|
|
38
47
|
const toast = (t, undo) => {
|
|
@@ -92,8 +101,8 @@ async function load() {
|
|
|
92
101
|
}
|
|
93
102
|
|
|
94
103
|
function kindsHtml(n) {
|
|
95
|
-
// each kind says how many it holds (round 2);
|
|
96
|
-
return KINDS.map(([k, l]) => `<button type="button" class="pm-tab" data-kind="${k}" aria-
|
|
104
|
+
// the Tabs part: each kind says how many it holds (round 2); a kind with none says none (zero is silence)
|
|
105
|
+
return `<div class="pm-tabs" role="tablist" aria-label="Show">${KINDS.map(([k, l]) => `<button type="button" class="pm-tab" role="tab" data-kind="${k}" aria-selected="${S.kind === k}"${n ? ` aria-label="${esc(l + ', ' + (n[k] || 0))}"` : ''}>${esc(l)}${n && n[k] ? ` <span class="rt-n">${n[k]}</span>` : ''}</button>`).join('')}</div>`;
|
|
97
106
|
}
|
|
98
107
|
/* ── the chip (round 2, PR 3): the shared scope chip of Events (pm/scope-chip.js). Products is the saved pick of Work; Programs and Projects
|
|
99
108
|
* are this page's own (kept on this computer). A report is under a program or a project when its setup says so (lib/routine-reports.js
|
|
@@ -155,21 +164,24 @@ function drawPick(groups) {
|
|
|
155
164
|
whenNames().then(() => draw()); // product display names (IDPF, not a folder name) arrive after the first draw
|
|
156
165
|
addEventListener('pp:changed', (e) => { if (e.detail && e.detail.ok) { S.pick = e.detail; S.all = false; draw(); } });
|
|
157
166
|
/** The fold line at the end of Reports: one-time reports and loose drafts, opened as plain rows. */
|
|
158
|
-
const foldHtml = (f) => `<
|
|
167
|
+
const foldHtml = (f, cols) => `<tr class="rt-fold"><td colspan="${cols}"><button type="button" class="pm-fold" data-once aria-expanded="${!!S.once}">${svg(I.chev, 14)}<span>${esc(f.words)}</span></button></td></tr>`;
|
|
159
168
|
/** The Product cell: the product, or the first and +N when one report is in several. Empty for what serves every product. */
|
|
160
169
|
const prodWords = (r) => (r.wss && r.wss.length ? r.wss[0] + (r.wss.length > 1 ? ' +' + (r.wss.length - 1) : '') : '');
|
|
161
170
|
function rowHtml(r, multi) {
|
|
162
171
|
const busy = S.busy.has(r.key);
|
|
163
172
|
// round 3 item 1: the same switch on every row. A proposed routine's switch is off, and turning it on is the yes.
|
|
164
173
|
const label = r.proposed ? r.name + ': proposed by PMOS. Press to start it' : r.name + (r.on ? ': on. Press to pause it' : ': paused. Press to start it again');
|
|
165
|
-
const end = r.on === null ? '
|
|
166
|
-
: `<button type="button" class="
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
const end = r.on === null ? ''
|
|
175
|
+
: `<button type="button" class="pm-switch" role="switch" aria-checked="${r.on}" data-sw="${esc(r.key)}" aria-label="${esc(label)}" title="${r.proposed ? 'Proposed. Turn on to start it' : r.on ? 'On' : 'Paused'}"${busy ? ' disabled' : ''}></button>`;
|
|
176
|
+
// ✕ on a proposed report: PMOS stops proposing it, with Undo (shown on hover, beside the switch)
|
|
177
|
+
const drop = r.proposed && r.kind === 'reports' ? `<button type="button" class="pm-btn rt-drop" data-drop="${esc(r.key)}" aria-label="${esc('Drop ' + r.name + '. PMOS stops proposing it')}" title="Drop this proposal">${svg(I.x, 14)}</button>` : '';
|
|
178
|
+
// a proposal has no Next (its group says it waits); a stuck or missed one, or a draft that waits, is the alert Badge
|
|
179
|
+
const next = r.proposed ? '' : r.late || (r.group === 'once' && r.draft) ? `<span class="pm-badge alert">${esc(r.next)}</span>` : `<span class="pm-meta rt-next">${esc(r.next)}</span>`;
|
|
180
|
+
const star = r.proposed ? `<b class="pm-star" aria-hidden="true">✦</b> ` : '';
|
|
181
|
+
return `<tr class="rt-row${r.off && !r.proposed ? ' off' : ''}${S.open === r.key ? ' sel' : ''}" tabindex="0" data-key="${esc(r.key)}" aria-label="${esc('Open ' + r.name)}"${S.open === r.key ? ' aria-current="true"' : ''}>`
|
|
182
|
+
+ `<td class="rt-name">${star}<b title="${esc(r.name)}">${esc(r.name)}</b></td>${multi ? `<td class="rt-prod" title="${esc((r.wss || []).join(', '))}">${esc(prodWords(r))}</td>` : ''}`
|
|
183
|
+
+ `<td class="rt-does" title="${esc(r.does)}">${esc(r.does)}</td><td class="rt-when"><span class="pm-meta">${esc(r.when)}</span></td>`
|
|
184
|
+
+ `<td class="rt-nx">${next}</td><td class="rt-on"><span class="pm-row">${drop}${end}</span></td></tr>`;
|
|
173
185
|
}
|
|
174
186
|
function draw() {
|
|
175
187
|
const on = onSet();
|
|
@@ -180,10 +192,11 @@ function draw() {
|
|
|
180
192
|
const known = new Set([...groups.programs, ...groups.projects].map((g) => g.id));
|
|
181
193
|
if (S.read) S.sel = { programs: S.sel.programs.filter((t) => known.has(t)), projects: S.sel.projects.filter((t) => known.has(t)) };
|
|
182
194
|
const mine = S.read ? tag(routineRows({ reports: S.reports.filter(inPick(on)), refresh: S.refresh, jobs: S.jobs, tasks: S.tasks.filter(inPick(on)), spaces: S.ws.flatMap((x) => [x.id, x.name]) })).filter(inScope) : [];
|
|
183
|
-
|
|
195
|
+
const counts = S.read ? kindCounts(mine.filter((r) => r.group !== 'once' && (!r.unclear || S.unclear))) : null; // the routines, not the one-time reports
|
|
184
196
|
drawPick(groups);
|
|
185
197
|
const D = didLine(S.done);
|
|
186
|
-
|
|
198
|
+
// PMOS did: one flat block, PMOS speaking; the chevron opens the full log with Undo on each line
|
|
199
|
+
$('rtDid').innerHTML = D ? `<section class="pm-block flat rt-did" aria-label="PMOS did" data-did><b class="pm-star" aria-hidden="true">✦</b><span class="rt-say">${esc(D.text)} <span class="pm-meta">${esc(D.sub)}</span></span><button type="button" class="pm-btn" data-did aria-label="${esc('See what PMOS did. ' + D.text)}" title="See what PMOS did">${svg(I.chev, 16)}</button></section>` : '';
|
|
187
200
|
if (!S.read) return;
|
|
188
201
|
S.rows = mine.filter((r) => !S.gone.has(r.key)); // a deleted task leaves at once; its delete is sent when the Undo has passed
|
|
189
202
|
// rows a PM cannot read are held back, counted in one grey line (round 3 item 2); one-time reports fold under Reports (item 1)
|
|
@@ -204,20 +217,25 @@ function draw() {
|
|
|
204
217
|
// with a program or project picked, PMOS reads and PMOS jobs fold to their heading: they serve every product, so the picked
|
|
205
218
|
// work's own reports come first (design note on #1384). Pressing the heading opens the rows.
|
|
206
219
|
const shut = (g) => extraOn() && (g.id === 'reads' || g.id === 'jobs') && !S.openG.has(g.id) && g.rows.length > 0;
|
|
220
|
+
const cols = multi ? 6 : 5;
|
|
221
|
+
const gwords = { wait: 'PMOS proposes it; turn it on to start' };
|
|
222
|
+
const gline = (g) => `<b>${esc(g.title)}</b> <span class="pm-meta">${g.rows.filter((r) => !r.fold).length}${gwords[g.id] ? ' · ' + gwords[g.id] : ''}</span>`;
|
|
207
223
|
const head = (g) => shut(g) || (extraOn() && S.openG.has(g.id))
|
|
208
|
-
? `<
|
|
209
|
-
: `<
|
|
210
|
-
const unLine = unclear.length ? `<p class="rt-hid">${unclear.length === 1 ? 'One row is' : unclear.length + ' rows are'} hidden because their source is unclear. <button type="button" data-unclear>Show</button></p>` : '';
|
|
224
|
+
? `<tr class="rt-g"><th colspan="${cols}" scope="rowgroup" class="pm-group"><button type="button" class="rt-gf" data-gfold="${esc(g.id)}" aria-expanded="${!shut(g)}" aria-label="${esc((shut(g) ? 'Show ' : 'Fold ') + g.title)}">${svg(I.chev, 14)}${gline(g)}</button></th></tr>`
|
|
225
|
+
: `<tr class="rt-g"><th colspan="${cols}" scope="rowgroup" class="pm-group">${gline(g)}</th></tr>`;
|
|
226
|
+
const unLine = unclear.length ? `<p class="rt-hid pm-meta">${unclear.length === 1 ? 'One row is' : unclear.length + ' rows are'} hidden because their source is unclear. <button type="button" class="pm-chip" data-unclear>Show</button></p>` : '';
|
|
211
227
|
const only = extraOn() ? scopeWords(on ? S.pick : null, S.sel, groups) : '';
|
|
212
|
-
const hidLine = unLine + (hid ? `<p class="rt-hid">${only ? esc('Showing ' + only + ' only. ') + (hid === 1 ? 'One routine is' : hid + ' routines are') : hid === 1 ? 'One routine of another product is' : hid + ' routines of other products are'} not shown. <button type="button" data-showall>Show all</button></p>` : '');
|
|
213
|
-
const f = document.activeElement && document.activeElement.closest && document.activeElement.closest('[data-key],[data-sw],[data-yes]');
|
|
214
|
-
const fk = f ? (f.dataset.key || f.dataset.sw || f.dataset.yes) + (f.dataset.sw ? ':sw' : f.dataset.yes ? ':yes' : '') : '';
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
228
|
+
const hidLine = unLine + (hid ? `<p class="rt-hid pm-meta">${only ? esc('Showing ' + only + ' only. ') + (hid === 1 ? 'One routine is' : hid + ' routines are') : hid === 1 ? 'One routine of another product is' : hid + ' routines of other products are'} not shown. <button type="button" class="pm-chip" data-showall>Show all</button></p>` : '');
|
|
229
|
+
const f = document.activeElement && document.activeElement.closest && document.activeElement.closest('[data-key],[data-sw],[data-yes],[data-kind]');
|
|
230
|
+
const fk = f ? (f.dataset.kind ? 'kind:' + f.dataset.kind + ':kind' : (f.dataset.key || f.dataset.sw || f.dataset.yes) + (f.dataset.sw ? ':sw' : f.dataset.yes ? ':yes' : '')) : '';
|
|
231
|
+
const tabs = kindsHtml(counts);
|
|
232
|
+
// the Table block: the Tabs in its head, then one pm-table; the group rows say the type
|
|
233
|
+
$('rtTable').innerHTML = `<section class="pm-block rt-tbl" aria-label="Everything that repeats"><div class="head">${tabs}</div>` + hidLine + (S.err ? `<p class="rt-quiet pm-meta">${esc(S.err)}</p>`
|
|
234
|
+
: !G.length ? `<p class="rt-quiet pm-meta">${S.kind === 'all' ? 'Nothing repeats yet. Tell PMOS what to do on a schedule with +.' : 'Nothing of this kind repeats.'}</p>`
|
|
235
|
+
: `<table class="pm-table" aria-label="Routine"><thead><tr><th scope="col">Routine</th>${multi ? '<th scope="col" class="rt-prod">Product</th>' : ''}<th scope="col" class="rt-does">What it does</th><th scope="col" class="rt-when">When</th><th scope="col">Next</th><th scope="col" class="rt-on">On</th></tr></thead>`
|
|
236
|
+
+ G.map((g) => `<tbody>${head(g)}${shut(g) ? '' : g.rows.map((r) => (r.fold ? foldHtml(r, cols) : rowHtml(r, multi))).join('')}</tbody>`).join('') + '</table>') + '</section>';
|
|
237
|
+
drawDetail();
|
|
238
|
+
if (fk) { const [k, x] = [fk.replace(/:(sw|yes|kind)$/, ''), (/:(sw|yes|kind)$/.exec(fk) || [])[1]]; const el = $('rtTable').querySelector(x === 'kind' ? `[data-kind="${CSS.escape(k.slice(5))}"]` : x === 'sw' ? `[data-sw="${CSS.escape(k)}"]` : x === 'yes' ? `[data-yes="${CSS.escape(k)}"]` : `[data-key="${CSS.escape(k)}"]`); if (el) el.focus(); }
|
|
221
239
|
}
|
|
222
240
|
|
|
223
241
|
const rowOf = (k) => S.rows.find((r) => r.key === k);
|
|
@@ -226,7 +244,7 @@ const said = (x, ok) => (x && x.ok !== false && !(x && x.error) ? ok : 'Nothing
|
|
|
226
244
|
async function press(key, fn) {
|
|
227
245
|
if (S.busy.has(key)) return;
|
|
228
246
|
S.busy.add(key); draw();
|
|
229
|
-
try {
|
|
247
|
+
try { const m = await fn(); say(m); if (S.open === key) S.msg = m; } finally { S.busy.delete(key); }
|
|
230
248
|
await load();
|
|
231
249
|
}
|
|
232
250
|
function flip(r) {
|
|
@@ -294,6 +312,70 @@ function open(r) {
|
|
|
294
312
|
openJob(r, H);
|
|
295
313
|
}
|
|
296
314
|
|
|
315
|
+
/* ── the Detail at the right (Main + open item; pm/cozy-routine-detail.js draws it) ── */
|
|
316
|
+
const desk = () => typeof innerWidth !== 'number' || innerWidth > 760;
|
|
317
|
+
const hidden = () => { const h = new Set(); try { for (let i = 0; i < localStorage.length; i++) { const k = localStorage.key(i); if (k && k.startsWith(NOFAIL)) h.add(k.slice(NOFAIL.length)); } } catch { /* a private window */ } return h; };
|
|
318
|
+
function detailOf(r) {
|
|
319
|
+
if (r.kind === 'reports') return { row: r, rep: reportOf(r) || null, hide: hidden(), busy: S.busy.has(r.key), msg: S.msg };
|
|
320
|
+
const g = rawOf(r);
|
|
321
|
+
return { row: r, job: { raw: g.raw || {}, tools: g.tools || null, own: g.own || null, svc: r.svc || null, extra: g.extra || null }, hide: hidden(), busy: S.busy.has(r.key), msg: S.msg };
|
|
322
|
+
}
|
|
323
|
+
function drawDetail() {
|
|
324
|
+
const host = $('rtDetail'), page = $('stage'); if (!host) return;
|
|
325
|
+
const r = S.open && desk() ? rowOf(S.open) : null;
|
|
326
|
+
if (S.open && !r && S.read) S.open = null; // the open routine left the table (a filter, a drop): the Detail closes
|
|
327
|
+
const had = host.querySelector('.rt-detail'), keep = had && had.dataset.key === (r && r.key);
|
|
328
|
+
host.innerHTML = r ? detailHtml(detailOf(r)) : '';
|
|
329
|
+
const sec = host.querySelector('.rt-detail'); if (sec) { sec.dataset.key = r.key; if (keep) sec.classList.remove('pm-motion-enter'); }
|
|
330
|
+
if (page) page.classList.toggle('rt-open', !!r);
|
|
331
|
+
}
|
|
332
|
+
/** Show a routine in the Detail (a desk), or open it in full (a phone, or a second press on the open one). */
|
|
333
|
+
function show(r) {
|
|
334
|
+
if (!desk() || S.open === r.key) { open(r); return; }
|
|
335
|
+
S.open = r.key; S.msg = ''; draw();
|
|
336
|
+
const d = $('rtDetail').querySelector('.rt-detail h2'); if (d) d.setAttribute('tabindex', '-1');
|
|
337
|
+
}
|
|
338
|
+
function closeDetail() {
|
|
339
|
+
const k = S.open; if (!k) return;
|
|
340
|
+
S.open = null; S.msg = ''; draw();
|
|
341
|
+
const row = $('rtTable').querySelector(`[data-key="${CSS.escape(k)}"]`); if (row) row.focus(); // back to the list, the row still there
|
|
342
|
+
}
|
|
343
|
+
/** j and k: the next and the previous routine in the table, as it shows. */
|
|
344
|
+
function step(n) {
|
|
345
|
+
const keys = [...$('rtTable').querySelectorAll('tr[data-key]')].map((x) => x.dataset.key), i = keys.indexOf(S.open);
|
|
346
|
+
const k = keys[i < 0 ? 0 : Math.max(0, Math.min(keys.length - 1, i + n))]; if (!k || k === S.open) return;
|
|
347
|
+
S.open = k; S.msg = ''; draw();
|
|
348
|
+
const row = $('rtTable').querySelector(`[data-key="${CSS.escape(k)}"]`); if (row) row.focus();
|
|
349
|
+
}
|
|
350
|
+
/** Yes on "run it again": the same routes as ▶ in the popup (pm/cozy-routine-job.js run). */
|
|
351
|
+
function runNow(r) {
|
|
352
|
+
return press(r.key, async () => {
|
|
353
|
+
const ws = S.home || undefined;
|
|
354
|
+
if (r.kind === 'tasks') return said(await pmPost('/api/schedules/run', { id: r.id }), 'Started. ' + r.name + ' runs now.');
|
|
355
|
+
if (r.id === 'scan') return said(await pmPost('/api/scan/now', { ws }), 'Started. PMOS scans now.');
|
|
356
|
+
if (r.svc) return said(await pmPost('/api/refresh/run', { id: r.parent, svcs: [r.svc], ws }), 'Started. PMOS reads ' + r.name + ' now.');
|
|
357
|
+
return said(await pmPost('/api/refresh/run', { id: r.id, ws }), 'Started. ' + r.name + ' runs now.');
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
async function detailPress(t) {
|
|
361
|
+
const r = rowOf(S.open); if (!r) return;
|
|
362
|
+
const k = t.dataset.rd;
|
|
363
|
+
if (k === 'close') { closeDetail(); return; }
|
|
364
|
+
if (k === 'full') { open(r); return; }
|
|
365
|
+
if (k === 'chat') { const PC = await import('./page-chat.js'); PC.openChat({ id: 'routine-' + r.key, kind: 'routine', title: r.name }, { ws: r.ws || S.home }); return; }
|
|
366
|
+
if (k === 'issue' && t.dataset.path) { const M = await import('./premium-report-read.js'); VW.drill(); M.openReportView(t.dataset.path, { ws: r.ws || undefined, name: r.name }); }
|
|
367
|
+
}
|
|
368
|
+
function sugPress(t) {
|
|
369
|
+
const r = rowOf(t.dataset.key); if (!r) return;
|
|
370
|
+
const a = t.dataset.rsug, pat = t.dataset.pat;
|
|
371
|
+
if (a === 'edit') { open(r); return; } // Change it first: the full popup, where every value edits and the chat is about it
|
|
372
|
+
if (pat === 'wait') { if (a === 'yes') yes(r); else drop(r); return; }
|
|
373
|
+
if (pat === 'fail') {
|
|
374
|
+
if (a === 'yes') { runNow(r); return; }
|
|
375
|
+
store.set(NOFAIL + t.dataset.sig, '1'); draw();
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
297
379
|
/* PMOS did, the full log: newest first, each with what it did, why, when, and Undo (POST /api/autonomy/undo) */
|
|
298
380
|
const logHtml = () => `<div class="rt-log" role="list">${S.done.map((d) => `<div class="l" role="listitem"><span><b>${esc(d.title || 'Done')}</b><em>${esc([d.reason, atOf(d.at)].filter(Boolean).join(' · '))}</em></span>`
|
|
299
381
|
+ `<button type="button" data-undo="${esc(d.ref)}" data-ws="${esc(d.ws)}" aria-label="${esc('Undo: ' + (d.title || 'this'))}" title="Undo">${svg(I.undo, 16)}</button></div>`).join('') || '<p class="rt-quiet">Nothing in the last 14 days.</p>'}</div>`;
|
|
@@ -315,6 +397,8 @@ document.addEventListener('click', (e) => {
|
|
|
315
397
|
const k = e.target.closest('[data-kind]');
|
|
316
398
|
if (k) { S.kind = k.dataset.kind; store.set(KIND_KEY, S.kind); draw(); return; }
|
|
317
399
|
if (e.target.closest('[data-did]')) { openLog(); return; }
|
|
400
|
+
const rd = e.target.closest('[data-rd]'); if (rd) { detailPress(rd); return; }
|
|
401
|
+
const rs = e.target.closest('[data-rsug]'); if (rs) { if (!rs.disabled) sugPress(rs); return; }
|
|
318
402
|
if (e.target.closest('[data-showall]')) { S.all = true; draw(); return; }
|
|
319
403
|
if (e.target.closest('[data-unclear]')) { S.unclear = true; draw(); return; }
|
|
320
404
|
if (e.target.closest('[data-once]')) { S.once = !S.once; draw(); return; }
|
|
@@ -325,13 +409,18 @@ document.addEventListener('click', (e) => {
|
|
|
325
409
|
const d = e.target.closest('[data-drop]'); if (d) { const r = rowOf(d.dataset.drop); if (r) drop(r); return; }
|
|
326
410
|
const s = e.target.closest('[data-sw]'); if (s) { const r = rowOf(s.dataset.sw); if (r && !s.disabled) flip(r); return; }
|
|
327
411
|
const y = e.target.closest('[data-yes]'); if (y) { const r = rowOf(y.dataset.yes); if (r && !y.disabled) yes(r); return; }
|
|
328
|
-
const row = e.target.closest('[data-key]'); if (row && $('rtTable').contains(row)) { const r = rowOf(row.dataset.key); if (r)
|
|
412
|
+
const row = e.target.closest('tr[data-key]'); if (row && $('rtTable').contains(row)) { const r = rowOf(row.dataset.key); if (r) show(r); }
|
|
329
413
|
});
|
|
330
414
|
document.addEventListener('keydown', (e) => {
|
|
415
|
+
const typing = e.target && e.target.closest && e.target.closest('input, textarea, select, [contenteditable="true"]');
|
|
416
|
+
if (S.open && !POP.isOpen() && !typing && !e.metaKey && !e.ctrlKey && !e.altKey) {
|
|
417
|
+
if (e.key === 'Escape') { e.preventDefault(); closeDetail(); return; }
|
|
418
|
+
if (e.key === 'j' || e.key === 'k') { e.preventDefault(); step(e.key === 'j' ? 1 : -1); return; }
|
|
419
|
+
}
|
|
331
420
|
if (e.key !== 'Enter' && e.key !== ' ') return;
|
|
332
|
-
const row = e.target.closest && e.target.closest('[data-key]');
|
|
421
|
+
const row = e.target.closest && e.target.closest('tr[data-key]');
|
|
333
422
|
if (!row || e.target !== row) return;
|
|
334
|
-
e.preventDefault(); const r = rowOf(row.dataset.key); if (r)
|
|
423
|
+
e.preventDefault(); const r = rowOf(row.dataset.key); if (r) show(r);
|
|
335
424
|
});
|
|
336
425
|
document.addEventListener('visibilitychange', () => { if (!document.hidden) load(); });
|
|
337
426
|
document.addEventListener('cz:chat-turn', () => load()); // PMOS changed something from the chat: the table shows it
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
<meta name="pmos-nonce" content="" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
7
7
|
<title>PMOS · Routine</title>
|
|
8
|
-
<!-- Routine (initiative routine-place, slice 8 of the six-place navigation;
|
|
9
|
-
|
|
10
|
-
"PMOS did" is one line on top.
|
|
11
|
-
the
|
|
12
|
-
The
|
|
8
|
+
<!-- Routine (initiative routine-place, slice 8 of the six-place navigation; rebuilt from the design system's blocks by initiative
|
|
9
|
+
routine-ds-page, board RoutineDS on Exploring 3 page "pages"): Main + open item. The top line is the path, the product chip and + (ask PMOS
|
|
10
|
+
for a new routine). "PMOS did" is one line on top. One Table block holds everything that repeats, grouped by type, each row with When, Next
|
|
11
|
+
and the same switch. A row opens the Detail at the right (pm/cozy-routine-detail.js); a second press opens the one popup
|
|
12
|
+
(pm/cozy-popup.js). The rail (pm/cozy-nav.js) is the navigation. The page code is pm/cozy-routine.js. -->
|
|
13
13
|
<link rel="preload" href="/vendor/plus-jakarta-sans-var.woff2" as="font" type="font/woff2" crossorigin />
|
|
14
14
|
<link rel="stylesheet" href="/pm/brand.css" />
|
|
15
15
|
<link rel="stylesheet" href="/pm/charts.css" />
|
|
@@ -22,13 +22,19 @@
|
|
|
22
22
|
<main class="cz-panel stage rt-page pm-ds" id="stage">
|
|
23
23
|
<div class="rt-toast pm-toast" id="toast" role="status" aria-live="polite"></div>
|
|
24
24
|
<h1 class="vh">Routine</h1>
|
|
25
|
-
<div class="rt-
|
|
25
|
+
<div class="rt-top">
|
|
26
|
+
<nav class="pm-path" aria-label="Path"><b>Routine</b></nav>
|
|
26
27
|
<div class="rt-pick" id="rtPick"></div>
|
|
27
|
-
<
|
|
28
|
-
<button type="button" class="
|
|
28
|
+
<span class="rt-sp"></span>
|
|
29
|
+
<button type="button" class="pm-btn" id="rtAdd" aria-label="Ask PMOS for a new routine" title="Ask PMOS for a new routine"><svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg></button>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="rt-mi">
|
|
32
|
+
<div class="rt-main">
|
|
33
|
+
<div id="rtDid"></div>
|
|
34
|
+
<div id="rtTable"><p class="rt-quiet pm-meta">Reading what repeats.</p></div>
|
|
35
|
+
</div>
|
|
36
|
+
<aside class="rt-aside" id="rtDetail"></aside>
|
|
29
37
|
</div>
|
|
30
|
-
<div id="rtDid"></div>
|
|
31
|
-
<div id="rtTable"><p class="rt-quiet pm-meta">Reading what repeats.</p></div>
|
|
32
38
|
<p class="rt-msg pm-meta" id="rtMsg" role="status"></p>
|
|
33
39
|
</main>
|
|
34
40
|
<noscript>This page needs JavaScript.</noscript>
|