create-pmos 0.308.0 → 0.310.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 +1 -1
- 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/briefing-premium-test.js +7 -4
- package/workspace/briefing-premium-work-test.js +4 -1
- package/workspace/guide/briefing-premium.md +8 -1
- package/workspace/lib/briefing-premium-products.js +13 -1
- package/workspace/lib/briefing-premium-sources.js +12 -1
- package/workspace/lib/briefing-premium.js +36 -2
- package/workspace/lib/my-work-premium.js +5 -2
- package/workspace/lib/routes-briefing-premium.js +8 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/c3-brief-needs.js +2 -2
- package/workspace/public/pm/c3-brief-pulse.js +5 -0
- package/workspace/public/pm/premium-brief.js +56 -0
- package/workspace/public/pm/premium-work.js +10 -2
- package/workspace/public/pm/premium.css +3 -0
- package/workspace/public/pm/premium.js +43 -1
- package/workspace/test-lists/premium-brief-parity.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.310.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": {
|
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-10-19T12:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T12:47:33Z"}
|
|
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-10-19T12:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T12:47:33Z"}
|
|
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-10-19T12:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T12:47:33Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -168,11 +168,12 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
168
168
|
await p.keyboard.press('Escape'); await p.unroute('**/api/sessions'); await p.unroute('**/api/session/remove');
|
|
169
169
|
for (let i = A.reqs.length - 1; i >= 0; i--) if (/^POST \/api\/(session\/remove|runs\/answer)$/.test(A.reqs[i])) A.reqs.splice(i, 1); }
|
|
170
170
|
|
|
171
|
-
/* R2 */
|
|
171
|
+
/* R2: the hero is the console's The brief (premium-brief.js) once its reads come back; the same composer gives the same words */
|
|
172
|
+
await until(() => p.evaluate(() => /^The same paragraph as The brief/.test(document.querySelector('#brief').title || '')));
|
|
172
173
|
const hero = await p.evaluate(() => ({ text: document.querySelector('#brief').textContent, k: [...document.querySelectorAll('#brief .k')].map((x) => x.textContent) }));
|
|
173
|
-
const want =
|
|
174
|
-
ok('R2 the hero reads the
|
|
175
|
-
ok('R2 the
|
|
174
|
+
const want = await p.evaluate(() => import('/pm/premium-brief.js').then((m) => m.consoleBrief()).then((r) => (r ? r.parts.map((x) => x.t).join('') : null)));
|
|
175
|
+
ok('R2 the hero reads the console brief, word for word', !!want && hero.text === want, hero.text + ' | ' + want);
|
|
176
|
+
ok('R2 the hero is not the records-only sentences', hero.text !== MODEL.hero.map((s) => s.parts.map((x) => x.t).join('')).join(' '), hero.text);
|
|
176
177
|
ok('R2 the date line is the model\'s', await p.evaluate((d) => document.querySelector('#date').textContent === d, MODEL.date));
|
|
177
178
|
|
|
178
179
|
/* R3, R4 */
|
|
@@ -480,6 +481,8 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
480
481
|
ok('R4 hovering the decision lights the meeting that needs it', await (async () => { await p.evaluate(() => window.scrollTo(0, 0)); await p.locator('#rank .rr[data-link]').first().hover(); return p.evaluate(() => document.querySelector('#tl .ev[data-link]').classList.contains('hl-k')); })());
|
|
481
482
|
await p.evaluate(() => window.scrollTo(0, 900));
|
|
482
483
|
await sleep(400);
|
|
484
|
+
// the dock scales in over 0.7 s: measure its button once the transition is done, not half-way through it
|
|
485
|
+
await until(() => p.evaluate(() => document.body.classList.contains('docked') && !document.querySelector('#dock').getAnimations().some((a) => a.playState === 'running')));
|
|
483
486
|
/* R11 floors */
|
|
484
487
|
{
|
|
485
488
|
const t = await p.evaluate(() => {
|
|
@@ -98,8 +98,11 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
98
98
|
|
|
99
99
|
/* M5 */
|
|
100
100
|
const ag = await p.evaluate(() => ({ tiles: [...document.querySelectorAll('#pipe .pst')].map((x) => x.textContent.replace(/\s+/g, ' ').trim()), hot: document.querySelectorAll('#pipe .pst.hot').length, rows: [...document.querySelectorAll('#agl .ws')].map((x) => x.textContent), cap: document.querySelector('#agCap').textContent, hold: document.querySelector('#agHold').textContent, buttons: [...document.querySelectorAll('#agCard button')].map((b) => b.textContent).join('|') }));
|
|
101
|
-
ok('M5 three counts from the agent field and the rows that are running or ready', ag.tiles.join() === '1Running,1Failed,1To review' && ag.hot ===
|
|
101
|
+
ok('M5 three counts from the agent field and the rows that are running or ready', ag.tiles.join() === '1Running,1Failed,1To review' && ag.hot === 0 && ag.rows.length === 3 && /draft ready to review/.test(ag.rows[0]) && /the run failed/.test(ag.rows.join()) && ag.cap === 'one to review', JSON.stringify(ag));
|
|
102
102
|
ok('M5 the With agents card offers no press of its own, and says nothing is posted before a confirm', !/\b(Give to agent|Approve|Revise|Retry)\b/i.test(ag.buttons) && /Nothing is posted until you confirm it/.test(ag.hold));
|
|
103
|
+
const tile = async (k) => { await p.click(`#pipe [data-ag="${k}"]`); return p.evaluate(() => ({ pressed: [...document.querySelectorAll('#pipe [aria-pressed="true"]')].map((b) => b.dataset.ag), rows: [...document.querySelectorAll('#agl .ws')].map((x) => x.textContent), empty: (document.querySelector('#agl .empty3') || {}).textContent || '', focus: document.activeElement && document.activeElement.dataset.ag })); };
|
|
104
|
+
const tf = await tile('failed'), tr = await tile('ready'), tc = await tile('ready');
|
|
105
|
+
ok('M5 a count filters the list to that state, a second press shows every item again, and focus stays on the tile', tf.pressed.join() === 'failed' && tf.rows.length === 1 && /the run failed/.test(tf.rows[0]) && tr.pressed.join() === 'ready' && tr.rows.length === 1 && /draft ready to review/.test(tr.rows[0]) && tc.pressed.length === 0 && tc.rows.length === 3 && tc.focus === 'ready', JSON.stringify({ tf, tr, tc }));
|
|
103
106
|
|
|
104
107
|
/* M6 */
|
|
105
108
|
const wt = await p.evaluate(() => ({ cap: document.querySelector('#waitCap').textContent, rows: [...document.querySelectorAll('#waitBody .wtit')].map((x) => x.textContent), subs: [...document.querySelectorAll('#waitBody .ws')].map((x) => x.textContent), nudge: /Nudge/.test(document.querySelector('#waitCard').textContent) }));
|
|
@@ -68,8 +68,15 @@ Two reads feed the page. The quick read takes the kill conditions, the failed-re
|
|
|
68
68
|
|
|
69
69
|
The pill at the top right says when the data was read and which source could not be read. A source that cannot be read adds nothing. The page does not guess.
|
|
70
70
|
|
|
71
|
+
Two buttons sit beside the pill:
|
|
72
|
+
|
|
73
|
+
- **Refresh** reads every included repository again now, without waiting for the 5-minute age. If a read is already running, Refresh does not start a second one. A read that failed is tried again at once. Mail, Jira and the calendar are read by skills, not by Refresh. To refresh them, use **Around you → Data freshness**.
|
|
74
|
+
- **Sources** lists each source that the pill names, with its state: **Read**, **Not read**, **Not included** or **Off**. For each source, it also gives the reason. Examples: `planning/runs/agent-runs.jsonl` is missing in that repository; the product is not chosen under **Products**; the source is switched off under **Settings → Connectors**; the morning brief could not reach it.
|
|
75
|
+
|
|
71
76
|
## The hero sentence
|
|
72
77
|
|
|
78
|
+
The headline is the same paragraph as **The brief** on the console Briefing. It uses the same reads (the briefing, your own items, the agent's drafts, today's calendar and the portfolio plan), the same Needs you rows and the same wording, so both pages give the same counts. If those reads fail, the page shows the records-only sentences below instead. Those sentences are the fallback.
|
|
79
|
+
|
|
73
80
|
The hero is one short paragraph. Each part of it comes from one record:
|
|
74
81
|
|
|
75
82
|
- **Merges.** How many changes reached `main` today.
|
|
@@ -208,7 +215,7 @@ My work is the second place on the rail, at `/premium-work.html`. It reads the l
|
|
|
208
215
|
- **Add** takes one line, read by the Work page's own parser (`Reply to Rina about SSO by Friday !p1`). A new item with no date waits in **Your tray** and its dialog opens at once, so you can place it. An item with a date goes where its date says.
|
|
209
216
|
- **Your tray** holds what you threw in and have not placed. It is not counted to clear until you place it (Do today, Later, Not yet, Waiting, Done or Drop).
|
|
210
217
|
- **On your plate** has Inbox, Today, Upcoming and Someday. A row shows where it came from (Yours, Jira, Slack, Board) and a due chip only when a date was set. The round check marks it done, with Undo for a few seconds. "Do this first" appears only on an overdue item.
|
|
211
|
-
- **With agents** counts running, failed and to-review drafts from each item's agent field. A draft is labelled "Agent draft, not checked" and is never counted as done. The agent itself is started, stopped, edited, sent back or approved in the item's dialog (see below).
|
|
218
|
+
- **With agents** counts running, failed and to-review drafts from each item's agent field. Press a count to show only the items in that state; press it again to show every item. The dark tile is the filter you picked. A draft is labelled "Agent draft, not checked" and is never counted as done. The agent itself is started, stopped, edited, sent back or approved in the item's dialog (see below).
|
|
212
219
|
- **Waiting on others** lists who you wait for and for how long. There is no nudge.
|
|
213
220
|
- **An item's dialog** offers Done, Not yet (later today, tomorrow, next week), Do today, Waiting on a name, Drop (with Undo), and Keep for an item untouched for seven days. The read-only agent from "Asking the agent" is beside it. Below those is a tool row with four more presses, each through the Work page's own route:
|
|
214
221
|
- **Edit** changes the title, due day, priority, who you wait on and the job. A title that Jira, the breakdown or the morning brief owns is read-only, and the panel says so. Only the fields you changed are saved, and Undo writes the old values back.
|
|
@@ -103,6 +103,18 @@ async function modelOfMany({ available, engine, runtimeDir, sources, agent }) {
|
|
|
103
103
|
return { state: 'ready', model, as_of: asOf || now, refreshing, pending: model.pending, ...(error ? { error } : {}) };
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
/** The PM's Refresh: read every included workspace again now, without waiting for the 5-minute age. A read already running is not doubled; a failed one is tried again at once. Returns the names it started and the names already being read. */
|
|
107
|
+
function refreshNow({ available, engine, runtimeDir }) {
|
|
108
|
+
const started = [], already = [];
|
|
109
|
+
for (const p of (available || []).filter((a) => a.on)) {
|
|
110
|
+
const s = stateOf(p.root);
|
|
111
|
+
if (s.inflight) { already.push(p.name); continue; }
|
|
112
|
+
s.lastError = null; s.lastErrorAt = 0;
|
|
113
|
+
start(p, engine, runtimeDir); started.push(p.name);
|
|
114
|
+
}
|
|
115
|
+
return { started, already };
|
|
116
|
+
}
|
|
117
|
+
|
|
106
118
|
/** After a write: the quick facts of one workspace again (the PM's decision or a returned run changed its records). */
|
|
107
119
|
async function rebuildOne({ root, runtimeDir }) {
|
|
108
120
|
const s = stateOf(root);
|
|
@@ -118,4 +130,4 @@ const peekModel = () => last;
|
|
|
118
130
|
const settle = () => Promise.all([...states.values()].map((s) => s.inflight).filter(Boolean));
|
|
119
131
|
const forget = () => { states.clear(); last = null; };
|
|
120
132
|
|
|
121
|
-
module.exports = { choose, splitKey, modelOfMany, rebuildOne, peekModel, settle, forget, refreshOne, STALE_MS };
|
|
133
|
+
module.exports = { choose, splitKey, modelOfMany, refreshNow, rebuildOne, peekModel, settle, forget, refreshOne, STALE_MS };
|
|
@@ -108,8 +108,18 @@ function notReadOf(brief) {
|
|
|
108
108
|
.map((k) => SOURCE_WORD[k].toLowerCase() + (st[k] === 'off' ? ' (switched off)' : ' (the brief says it was not reached)'));
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
/** One line per source the morning brief names, for the Sources list: { name, state: 'read'|'not-read'|'off', reason }. Only what the brief's own `sources` field says. */
|
|
112
|
+
function statusOf(brief) {
|
|
113
|
+
const st = brief.sources && typeof brief.sources === 'object' ? brief.sources : {};
|
|
114
|
+
return ['mail', 'jira', 'confluence', 'slack'].filter((k) => k in st).map((k) => st[k] === 'off'
|
|
115
|
+
? { name: SOURCE_WORD[k], state: 'off', reason: 'Switched off under Settings, Connectors.' }
|
|
116
|
+
: st[k] === 'not-reached'
|
|
117
|
+
? { name: SOURCE_WORD[k], state: 'not-read', reason: 'The morning brief says it could not reach ' + SOURCE_WORD[k] + '. Your Claude session reaches it through its own connector, so check that connector there.' }
|
|
118
|
+
: { name: SOURCE_WORD[k], state: 'read', reason: 'Read by the morning brief of ' + brief.date + '.' });
|
|
119
|
+
}
|
|
120
|
+
|
|
111
121
|
function build({ brief, myWork, itemLines, today, products } = {}) {
|
|
112
|
-
const out = { rows: [], digests: [], state: 'absent', notRead: [], from: [] };
|
|
122
|
+
const out = { rows: [], digests: [], state: 'absent', notRead: [], status: [], from: [] };
|
|
113
123
|
const b = brief && brief.state === 'ok' && brief.brief && brief.brief.date === today ? brief.brief : null;
|
|
114
124
|
out.state = b ? 'ok' : brief && brief.state === 'ok' ? 'stale' : (brief && brief.state) || 'absent';
|
|
115
125
|
const tickets = (Real.build({ brief: null, myWork, itemLines, today }).needs || []).filter((n) => n.origin === 'jira' && n.itemId)
|
|
@@ -119,6 +129,7 @@ function build({ brief, myWork, itemLines, today, products } = {}) {
|
|
|
119
129
|
out.rows.push(...rowItems(b).map(({ x, ask }) => itemRow(x, ask, b, products)));
|
|
120
130
|
out.digests = list(b.digests).map((d) => digestItem(d, b)).filter(Boolean);
|
|
121
131
|
out.notRead = notReadOf(b);
|
|
132
|
+
out.status = statusOf(b);
|
|
122
133
|
}
|
|
123
134
|
return out;
|
|
124
135
|
}
|
|
@@ -365,6 +365,33 @@ function build(f) {
|
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
|
|
368
|
+
/** Why a quick read came back empty: only what the read itself does, named by the file or command it uses. */
|
|
369
|
+
const MISSING_WHY = {
|
|
370
|
+
runs: 'planning/runs/agent-runs.jsonl is missing or cannot be read. The repository has logged no agent run yet.',
|
|
371
|
+
evals: 'planning/runs/evals.jsonl is missing or cannot be read. The repository has logged no review verdict yet.',
|
|
372
|
+
merges: 'git log failed in this repository.',
|
|
373
|
+
workflow: 'The initiative state could not be read: scripts/workflow-state.js gave no answer.',
|
|
374
|
+
tripwires: 'planning/okrs/kill-conditions.md is missing or cannot be read.',
|
|
375
|
+
};
|
|
376
|
+
/** The Sources list behind the Real data line: one entry per thing the line names, with the state and the reason. [{ name, state: 'read'|'not-read'|'not-included'|'off', reason }] */
|
|
377
|
+
function sourceList({ meetings, parts, available, sx, sxState }) {
|
|
378
|
+
const out = [];
|
|
379
|
+
out.push(meetings === null ? { name: 'Calendar', state: 'not-read', reason: 'The calendar file PMOS holds could not be read. Refresh it under Around you, Data freshness.' } : { name: 'Calendar', state: 'read', reason: 'Read from the calendar PMOS holds.' });
|
|
380
|
+
for (const p of parts) {
|
|
381
|
+
if (p.state === 'error') { out.push({ name: p.product.name, state: 'not-read', reason: 'The read failed: ' + String(p.error || 'no reason was given').slice(0, 200) }); continue; }
|
|
382
|
+
if (!p.f) { out.push({ name: p.product.name, state: 'not-read', reason: 'It is still being read for the first time.' }); continue; }
|
|
383
|
+
const miss = p.f.missing || [];
|
|
384
|
+
for (const k of ['runs', 'evals', 'merges', 'workflow', 'tripwires']) {
|
|
385
|
+
if (k === 'tripwires' && p.f.tripwires === null && !miss.includes(k)) { out.push({ name: SOURCE_NAME[k] + ' of ' + p.product.name, state: 'not-read', reason: MISSING_WHY[k] }); continue; }
|
|
386
|
+
out.push({ name: SOURCE_NAME[k] + ' of ' + p.product.name, state: miss.includes(k) ? 'not-read' : 'read', reason: miss.includes(k) ? MISSING_WHY[k] : 'Read from the repository.' });
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
for (const a of available.filter((x) => !x.on)) out.push({ name: a.name, state: 'not-included', reason: a.home ? 'PMOS itself is left out unless you choose it under Products.' : 'Not chosen under Products, so no file of it is opened.' });
|
|
390
|
+
if (sx) out.push(...sx.status);
|
|
391
|
+
if (sxState && sxState !== 'ok') out.push({ name: 'Morning brief', state: 'not-read', reason: sxState === 'bad' ? 'Today\'s brief file could not be parsed.' : 'No morning brief file exists for today. The morning brief skill writes it.' });
|
|
392
|
+
return out;
|
|
393
|
+
}
|
|
394
|
+
|
|
368
395
|
/* ── several products (initiative briefing-premium-products) ──────────────────────────────────────────────── */
|
|
369
396
|
const KIND_RANK = { blocked: 0, decision: 1, waited: 2 };
|
|
370
397
|
const longest = (r) => { const d = (r.detail && r.detail.days) || []; return d.length ? d[d.length - 1] : 0; };
|
|
@@ -417,7 +444,7 @@ function buildMany(g) {
|
|
|
417
444
|
return {
|
|
418
445
|
date: dateLine(now),
|
|
419
446
|
pending,
|
|
420
|
-
header: { text: 'Real data · as of ' + hhmm(asOf) + ' · ' + (none ? 'no product included' : joinNames(inc.map((a) => a.name))) + (out.length ? ' · ' + joinNames(out.map((a) => a.name)) + ' not included' : '') + (missText.length ? ' · not read: ' + missText.join(', ') : '') + sxNote + (waiting.length ? ' · reading ' + joinNames(waiting.map((p) => p.product.name)) : '') + (skipped.n ? ' · ' + skipped.n + (skipped.n === 1 ? ' record' : ' records') + ' could not be read and ' + (skipped.n === 1 ? 'was' : 'were') + ' left out' : ''), missing },
|
|
447
|
+
header: { text: 'Real data · as of ' + hhmm(asOf) + ' · ' + (none ? 'no product included' : joinNames(inc.map((a) => a.name))) + (out.length ? ' · ' + joinNames(out.map((a) => a.name)) + ' not included' : '') + (missText.length ? ' · not read: ' + missText.join(', ') : '') + sxNote + (waiting.length ? ' · reading ' + joinNames(waiting.map((p) => p.product.name)) : '') + (skipped.n ? ' · ' + skipped.n + (skipped.n === 1 ? ' record' : ' records') + ' could not be read and ' + (skipped.n === 1 ? 'was' : 'were') + ' left out' : ''), missing, sources: sourceList({ meetings, parts, available, sx, sxState: sx ? sx.state : null }) },
|
|
421
448
|
hero: hero.length ? hero : [{ parts: [{ t: pending ? 'Reading the initiative state. What needs you is not known yet.' : 'Nothing needs you and nothing moved today that the records show.', s: false }], from: [] }],
|
|
422
449
|
list: { title: 'What you need to do', rows, more, count: rows.length + more, pendingNote: pending ? 'Blocked work, prototypes waiting for you and failed reviews appear when the initiative state has been read.' : null, putOff: putOff.map((x) => ({ key: x.key, title: x.title, ...(x.product ? { product: x.product } : {}), until: x.until, text: (x.product ? x.product + ': ' : '') + x.title + ' · back ' + backAt(x.until, now) })), order: 'In this order: blocked work first, then decisions only you can make, then what has waited longest.' },
|
|
423
450
|
today: todayOf(cf),
|
|
@@ -579,6 +606,13 @@ function modelOf({ root, engine, runtimeDir }) {
|
|
|
579
606
|
if (lastError && !inflight) return Promise.resolve({ state: 'error', error: lastError });
|
|
580
607
|
return Promise.resolve({ state: 'reading', elapsed_ms: Date.now() - startedAt });
|
|
581
608
|
}
|
|
609
|
+
/** The PM's Refresh for the one-workspace page: read again now. A read already running is not doubled. true when one started. */
|
|
610
|
+
function refreshNow({ root, engine, runtimeDir }) {
|
|
611
|
+
if (inflight) return false;
|
|
612
|
+
lastError = null; lastErrorAt = 0; startedAt = Date.now();
|
|
613
|
+
inflight = refresh({ root, engine, runtimeDir }).catch((e) => { lastError = String((e && e.stack) || e).split('\n').slice(0, 3).join(' | ').slice(0, 300); lastErrorAt = Date.now(); }).finally(() => { inflight = null; });
|
|
614
|
+
return true;
|
|
615
|
+
}
|
|
582
616
|
/** After a write: rebuild the kept answer from fresh records without the slow read. A caller waits for a read in progress first. */
|
|
583
617
|
async function rebuild({ root, runtimeDir }) {
|
|
584
618
|
await settle();
|
|
@@ -594,4 +628,4 @@ const peekModel = (root) => (kept && kept.root === root ? kept.model : partial &
|
|
|
594
628
|
const settle = () => inflight || Promise.resolve();
|
|
595
629
|
const forget = () => { kept = null; partial = null; inflight = null; lastError = null; startedAt = 0; };
|
|
596
630
|
|
|
597
|
-
module.exports = { build, buildMany, allRowsOf, readMeetings, hooks, refresh, readSources, readFast, readInitiatives, repoKey, readFm, readTripwires, modelOf, settle, forget, rebuild, peekModel, rowsOf, heroOf, todayOf, failedReviews, num };
|
|
631
|
+
module.exports = { build, buildMany, allRowsOf, readMeetings, hooks, refresh, readSources, readFast, readInitiatives, repoKey, readFm, readTripwires, modelOf, refreshNow, settle, forget, rebuild, peekModel, rowsOf, heroOf, todayOf, failedReviews, num };
|
|
@@ -215,9 +215,12 @@ function build({ v, now, events }) {
|
|
|
215
215
|
});
|
|
216
216
|
const waitingRows = (work.waiting || []).slice(0, MAX_PER).map((it) => rowOf(it, 'waiting', v, reviewIds.has(it.id), focusIds));
|
|
217
217
|
const agentRows = ready.concat(running, failed.filter((x) => !ready.includes(x))).slice(0, MAX_PER).map((x) => rowOf(x.it, x.list, v, reviewIds.has(x.it.id), focusIds));
|
|
218
|
+
// one list per tile, so a tile filters the card to every item in that state and not only the ones the mixed list had room for
|
|
219
|
+
const agentBy = {};
|
|
220
|
+
for (const [k, xs] of [['running', running], ['failed', failed], ['ready', ready]]) agentBy[k] = { more: Math.max(0, xs.length - MAX_PER), rows: xs.slice(0, MAX_PER).map((x) => rowOf(x.it, x.list, v, reviewIds.has(x.it.id), focusIds)) };
|
|
218
221
|
const trayRows = tray.slice(0, MAX_PER).map((it) => rowOf(it, 'tray', v, reviewIds.has(it.id), focusIds));
|
|
219
222
|
const shelf = shelfOf();
|
|
220
|
-
const rowsAll = [].concat(...sections.map((s) => s.rows), waitingRows, agentRows, trayRows, ...shelf.tabs.map((t) => t.rows));
|
|
223
|
+
const rowsAll = [].concat(...sections.map((s) => s.rows), waitingRows, agentRows, ...Object.values(agentBy).map((g) => g.rows), trayRows, ...shelf.tabs.map((t) => t.rows));
|
|
221
224
|
/* The tray as tabs, from the item records alone: To place, Ready (an agent draft is ready), Working (an agent runs), Kept (a Keep press was recorded), Used (done in the last 7 days), Compost (untouched for the review days). */
|
|
222
225
|
function shelfOf() {
|
|
223
226
|
const loc = (v.items || all.map((x) => x.it)).filter(isLocal);
|
|
@@ -243,7 +246,7 @@ function build({ v, now, events }) {
|
|
|
243
246
|
capture: { placeholder: 'Add anything: "Reply to Rina about SSO by Friday"', hint: 'One line. The date and priority are read from it.' },
|
|
244
247
|
plate: { title: 'On your plate', cap: clear + ' to clear', n: clear, sections, note: 'Each item comes from your list. A suggestion shows only when an agent offered it, a draft is ready, or a date says so; PMOS does not guess a place. A date shows only when one was set. Nothing changes in Jira or Slack from here.' },
|
|
245
248
|
tray: { title: 'Your tray', cap: tray.length ? tray.length + ' to place' : 'empty', n: tray.length, more: Math.max(0, tray.length - MAX_PER), rows: trayRows, note: 'Anything you add lands here first. Open one to place it: Today, Later, waiting on someone, or drop it. Nothing here counts as work to clear until you place it.' },
|
|
246
|
-
agents: { title: 'With agents', cap: ready.length ? num(ready.length) + ' to review' : running.length ? num(running.length) + ' running' : 'nothing running', counts: { running: running.length, ready: ready.length, failed: failed.length }, rows: agentRows, hold: HOLD.agent },
|
|
249
|
+
agents: { title: 'With agents', cap: ready.length ? num(ready.length) + ' to review' : running.length ? num(running.length) + ' running' : 'nothing running', counts: { running: running.length, ready: ready.length, failed: failed.length }, rows: agentRows, by: agentBy, hold: HOLD.agent },
|
|
247
250
|
waiting: { title: 'Waiting on others', cap: longest != null ? 'longest ' + longest + ' ' + plural(longest, 'day', 'days') : (work.waiting || []).length ? num(work.waiting.length) + ' waiting' : '', n: (work.waiting || []).length, more: Math.max(0, (work.waiting || []).length - MAX_PER), rows: waitingRows },
|
|
248
251
|
review: { n: (v.review || []).length, days: v.review_days, ids: (v.review || []).map((i) => i.id) },
|
|
249
252
|
dock: { needs: clear, label: 'to clear', next: firstToday ? firstToday.title : (sections[0].rows[0] ? sections[0].rows[0].title : null) },
|
|
@@ -42,7 +42,7 @@ function ownerOf(ctx, ws) {
|
|
|
42
42
|
|
|
43
43
|
const enginePath = () => ENGINE_PATHS.find((p) => fs.existsSync(p)) || null;
|
|
44
44
|
|
|
45
|
-
const POSTS = ['decide', 'put-off', 'return', 'ask'];
|
|
45
|
+
const POSTS = ['decide', 'put-off', 'return', 'ask', 'refresh'];
|
|
46
46
|
const rootOf = (url, ctx) => {
|
|
47
47
|
let root; try { const w = ctx.getWs && ctx.getWs(url.searchParams.get('ws') || null); root = w && w.root; } catch { root = null; }
|
|
48
48
|
return root || path.resolve(__dirname, '..', '..');
|
|
@@ -66,6 +66,13 @@ async function post(req, res, url, ctx) {
|
|
|
66
66
|
if (o.error) { ctx.json(res, { ok: false, error: o.error }, 400); return true; }
|
|
67
67
|
root = o.root; merged = true;
|
|
68
68
|
}
|
|
69
|
+
if (act === 'refresh') {
|
|
70
|
+
// the PM's Refresh: read the included repositories again now. Mail, Jira and the calendar are read by skills (Around you, Data freshness), not here.
|
|
71
|
+
if (url.searchParams.get('ws')) { const started = BP.refreshNow({ root, engine: enginePath(), runtimeDir }); ctx.json(res, { ok: true, started: started ? ['this repository'] : [], already: started ? [] : ['this repository'] }); return true; }
|
|
72
|
+
const r = Prod.refreshNow({ available: products(ctx).available, engine: enginePath(), runtimeDir });
|
|
73
|
+
ctx.json(res, { ok: true, ...r });
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
69
76
|
if (act === 'ask') {
|
|
70
77
|
let wsId; try { const w = merged && sk ? { id: sk.ws } : ctx.getWs && ctx.getWs(url.searchParams.get('ws') || null); wsId = w && w.id; } catch { wsId = undefined; }
|
|
71
78
|
const a = Ag.ask({ runtimeDir, key: b.key, text: b.text, model: /^work:/.test(String(b.key || '')) ? WP.peekModel() : /^board:/.test(String(b.key || '')) ? BoardP.peekModel() : /^ins:/.test(String(b.key || '')) ? InsP.peekModel() : /^(init|doc):/.test(String(b.key || '')) ? InitP.peekModel() : sk || /^src:/.test(String(b.key || '')) ? Prod.peekModel() : BP.peekModel(root), spawnSession: ctx.spawnSession, wsId });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.310.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.310.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -98,9 +98,9 @@ export function needsCount(b, page) {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/* an engine card a PM decides on; a card from the PM's own data (origin) is a reminder, and its row comes in `needs` instead */
|
|
101
|
-
const isDecision = (c) => !!c && !c.origin && !!(c.move || c.tag === 'Critical');
|
|
101
|
+
export const isDecision = (c) => !!c && !c.origin && !!(c.move || c.tag === 'Critical');
|
|
102
102
|
/* a needs row that carries an engine card is drawn from the card, as the cards-only path draws it */
|
|
103
|
-
function fromCard(n, i) {
|
|
103
|
+
export function fromCard(n, i) {
|
|
104
104
|
if (!n || !n.card) return n;
|
|
105
105
|
const v = cardView(n.card); const T = TAG_STYLE[v.tag] || TAG_STYLE['Just in'];
|
|
106
106
|
return { key: n.key || v.key || String(i), headline: v.headline, kind: v.tag, icon: T.icon, color: T.color, time: v.deadline && v.deadline.text ? v.deadline.text : null, src: v.tag, view: v };
|
|
@@ -44,6 +44,11 @@ export function pulseRow(g) {
|
|
|
44
44
|
return r;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/** The rows the Portfolio pulse draws from the Calendar's gantt rows: a row without a plan shows only when its Jira epic has progress. Pure. */
|
|
48
|
+
export function pulseRows(gantt) {
|
|
49
|
+
return (gantt || []).filter((g) => g.pulse || g.status !== 'no plan' || !!jiraOf(g)).map(pulseRow);
|
|
50
|
+
}
|
|
51
|
+
|
|
47
52
|
function planRow(g) {
|
|
48
53
|
if (g.pulse && RAG[g.pulse.c]) {
|
|
49
54
|
const [cls, word] = RAG[g.pulse.c];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* pm/premium-brief.js — the premium Briefing's headline paragraph is the console's "The brief" (parity rule: the console is the content baseline).
|
|
2
|
+
*
|
|
3
|
+
* consoleBrief(now?) → Promise of { parts: [{ t, go? }], sources } | null reads what the console Briefing reads, composes with composeBrief
|
|
4
|
+
* briefNeeds(b, page, agent) → { decisions, own, agentN } PURE. The rows the console's Needs you holds, in its ranked order (c3-brief-needs.js)
|
|
5
|
+
* briefInputOf(...) → the composeBrief input PURE
|
|
6
|
+
* The same five reads, the same row rules and the same composer as the console: GET /api/briefing, GET /api/brief-page, GET /api/needs (agent drafts),
|
|
7
|
+
* the calendar quarter, and the day part of the clock. A read that fails leaves its sentence out. null when the needs reads failed, so the page keeps
|
|
8
|
+
* its own records-only hero rather than guess. No write, no model call. */
|
|
9
|
+
import { composeBrief } from './c3-brief-summary.js';
|
|
10
|
+
import { isDecision, fromCard } from './c3-brief-needs.js';
|
|
11
|
+
import { rank, fromOwn, fromDecision, fromAgent, rankMentions } from './priority-model.js';
|
|
12
|
+
import { dayPartFor } from './briefing-model.js';
|
|
13
|
+
import { loadBriefing } from './shell-ticker.js';
|
|
14
|
+
import { loadBriefPage } from './c3-brief-data.js';
|
|
15
|
+
import { loadDriverNeeds } from './c3-driver.js';
|
|
16
|
+
import { readQuarter } from './c3-plan.js';
|
|
17
|
+
import { pulseRows } from './c3-brief-pulse.js';
|
|
18
|
+
import { cardView, TAG_STYLE } from './briefing-model.js';
|
|
19
|
+
|
|
20
|
+
/** The rows Needs you shows, ranked together as the console does: group rows are not counted, a row held back is not shown. */
|
|
21
|
+
export function briefNeeds(b, page, agent) {
|
|
22
|
+
const decide = ((b && b.cards) || []).filter(isDecision);
|
|
23
|
+
const needs = b && Array.isArray(b.needs) && b.needs.length ? b.needs.map(fromCard) : null;
|
|
24
|
+
const decRows = needs || decide.map(cardView).map((v, i) => { const T = TAG_STYLE[v.tag] || TAG_STYLE['Just in']; return { key: v.key || String(i), headline: v.headline, kind: v.tag, icon: T.icon, color: T.color, time: v.deadline && v.deadline.text ? v.deadline.text : null, src: v.tag, view: v }; });
|
|
25
|
+
const meta = new Map(decRows.map((n) => {
|
|
26
|
+
const late = /^(\d+) days? overdue$/.exec(String(n.dueText || ''));
|
|
27
|
+
return [String(n.key), { time: n.time || null, decide: !!n.view || /^decide$/i.test(String(n.kind || '')), overdue: n.kind === 'Overdue', days_late: late ? Number(late[1]) : 0 }];
|
|
28
|
+
}));
|
|
29
|
+
const ownRows = (page && page.ok !== false ? (page.needs || []) : []).filter((r) => r.kind !== 'decision');
|
|
30
|
+
const pool = [
|
|
31
|
+
...ownRows.map((r) => ({ src: 'own', raw: r, rank: fromOwn(r) })),
|
|
32
|
+
...(agent || []).map((r) => ({ src: 'agent', raw: r, rank: fromAgent(r) })),
|
|
33
|
+
...decRows.map((n) => ({ src: 'decision', raw: n, rank: fromDecision(n) })),
|
|
34
|
+
];
|
|
35
|
+
const byKey = new Map(pool.map((x) => [x.rank.key, x]));
|
|
36
|
+
const R = rank(pool.map((x) => x.rank), { held: page && page.held && typeof page.held === 'object' ? page.held : null });
|
|
37
|
+
const ordered = [...R.first, ...R.rest].filter((r) => !(R.byKey.get(r.key) || {}).members).map((r) => byKey.get(r.key)).filter(Boolean);
|
|
38
|
+
const decisions = ordered.filter((x) => x.src === 'decision').map((x) => { const m = meta.get(String(x.raw.key)) || {}; return { key: String(x.raw.key), headline: x.raw.headline || '', time: m.time || null, decide: !!m.decide, overdue: !!m.overdue, days_late: m.days_late || 0 }; });
|
|
39
|
+
const own = ordered.filter((x) => x.src === 'own').map((x) => ({ key: String(x.raw.key), headline: x.raw.headline || '', kind: x.raw.kind, days_late: x.raw.days_late || 0 }));
|
|
40
|
+
return { decisions, own, agentN: ordered.filter((x) => x.src === 'agent').length };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function briefInputOf({ b, page, agent, quarter, now }) {
|
|
44
|
+
const p = page && page.ok !== false ? page : null;
|
|
45
|
+
const n = p ? briefNeeds(b, p, agent) : null;
|
|
46
|
+
return { lens: dayPartFor(now || new Date()), decisions: n ? n.decisions : null, own: n ? n.own : null, agentN: n ? n.agentN : 0,
|
|
47
|
+
mentions: p && Array.isArray(p.mentions) ? rankMentions(p.mentions) : null, agenda: p ? (p.today || []) : null,
|
|
48
|
+
pulse: quarter && quarter.ok !== false ? pulseRows(quarter.gantt) : null };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export async function consoleBrief(now) {
|
|
52
|
+
const [b, page, agent, quarter] = await Promise.all([loadBriefing(true), loadBriefPage(), loadDriverNeeds().catch(() => []), readQuarter().catch(() => null)]);
|
|
53
|
+
if (!page || page.ok === false) return null; // the needs reads failed: keep the records-only hero rather than half a brief
|
|
54
|
+
const r = composeBrief(briefInputOf({ b, page, agent, quarter, now }));
|
|
55
|
+
return r.parts.length ? r : null;
|
|
56
|
+
}
|
|
@@ -83,11 +83,18 @@ function drawTray() {
|
|
|
83
83
|
$('#trayNote').textContent = T.note + ' ' + Sh.note;
|
|
84
84
|
}
|
|
85
85
|
$('#trayTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-tab]'); if (!b) return; shelfTab = b.dataset.tab; drawTray(); const n = $(`#trayTabs [data-tab="${shelfTab}"]`); if (n) n.focus(); });
|
|
86
|
+
/* the three counts filter the list under them: a press shows one state, a second press on the same tile shows all again */
|
|
87
|
+
const AG_TILES = [['running', 'Running'], ['failed', 'Failed'], ['ready', 'To review']];
|
|
88
|
+
const AG_EMPTY = { running: 'No agent is running right now.', failed: 'No agent run has failed.', ready: 'No draft waits for your review.' };
|
|
89
|
+
let agTile = null;
|
|
86
90
|
function drawAgents() {
|
|
87
91
|
const A = M.agents, c = A.counts;
|
|
88
92
|
$('#agCap').textContent = A.cap;
|
|
89
|
-
|
|
90
|
-
$('#
|
|
93
|
+
if (agTile && !(A.by && A.by[agTile])) agTile = null;
|
|
94
|
+
$('#pipe').innerHTML = AG_TILES.map(([k, label]) => `<button type="button" class="pst${agTile === k ? ' hot' : ''}" data-ag="${k}" aria-pressed="${agTile === k}" aria-controls="agl" title="${agTile === k ? 'Show every item again' : 'Show only the items that are ' + label.toLowerCase()}"><b>${c[k]}</b><span>${label}</span></button>`).join('');
|
|
95
|
+
const g = agTile ? A.by[agTile] : null, rows = g ? g.rows : A.rows;
|
|
96
|
+
$('#agl').innerHTML = rows.length ? rows.map((r) => rowHtml(r, { sm: 'ag' })).join('') + (g && g.more ? `<p class="note">${g.more} more not shown here.</p>` : '')
|
|
97
|
+
: `<p class="empty3 plain">${g ? AG_EMPTY[agTile] : 'No agent is working on your items.'}</p>`;
|
|
91
98
|
$('#agHold').textContent = A.hold;
|
|
92
99
|
}
|
|
93
100
|
function drawWaiting() {
|
|
@@ -510,6 +517,7 @@ document.addEventListener('click', async (e) => {
|
|
|
510
517
|
/* ── the list: a check marks done, a row opens its dialog, keys and swipe act on a row ───────────────────────────────────── */
|
|
511
518
|
$('#plateBody').addEventListener('click', async (e) => { await listClick(e); });
|
|
512
519
|
$('#agl').addEventListener('click', (e) => { listClick(e); });
|
|
520
|
+
$('#pipe').addEventListener('click', (e) => { const b = e.target.closest('[data-ag]'); if (!b) return; agTile = agTile === b.dataset.ag ? null : b.dataset.ag; drawAgents(); const n = $(`#pipe [data-ag="${b.dataset.ag}"]`); if (n) n.focus(); });
|
|
513
521
|
$('#waitBody').addEventListener('click', (e) => { listClick(e); });
|
|
514
522
|
$('#trayBody').addEventListener('click', (e) => { listClick(e); });
|
|
515
523
|
async function listClick(e) {
|
|
@@ -524,6 +524,7 @@ a.round{color:inherit;text-decoration:none}
|
|
|
524
524
|
.pst{padding:12px 14px;border-radius:var(--r-in);background:var(--well);display:grid;gap:3px;transition:background .3s}
|
|
525
525
|
.pst b{font-size:28px;letter-spacing:-.04em;line-height:1;font-weight:650}.pst span{font-size:12.5px;color:var(--ink-2)}
|
|
526
526
|
.pst.hot{background:var(--solid);color:var(--on-solid)}.pst.hot span{color:inherit;opacity:.8}
|
|
527
|
+
button.pst{border:0;font:inherit;color:inherit;text-align:left;cursor:pointer}button.pst:not(.hot):hover{box-shadow:inset 0 0 0 1px var(--hair)}
|
|
527
528
|
.agl{margin-top:8px}
|
|
528
529
|
.wrow.sm .wrh{padding:11px 0}.wrow.sm .wtit{font-size:15px}
|
|
529
530
|
.ags{width:34px;height:34px;border-radius:14px;display:grid;place-items:center;background:var(--well);color:var(--ink-2)}
|
|
@@ -1972,6 +1973,8 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
|
|
|
1972
1973
|
.dzcg{display:grid;grid-template-columns:1fr 1fr;gap:12px}
|
|
1973
1974
|
@media (max-width:700px){.dzcg{grid-template-columns:1fr}}
|
|
1974
1975
|
.dzch{margin-bottom:6px}
|
|
1976
|
+
|
|
1977
|
+
.rdbtns{display:inline-flex;gap:6px;align-items:center}
|
|
1975
1978
|
.wkd .wkc{font:400 12px var(--sans);letter-spacing:0;text-transform:none;padding:12px 4px 10px}
|
|
1976
1979
|
.wkc .wkl{font:500 11px var(--mono);letter-spacing:.08em}
|
|
1977
1980
|
.wkc .wkb{flex-direction:column-reverse;gap:3px;width:36px;height:100px;border-radius:12px;padding:0}.wkb i{flex:none;border-radius:4px}
|
|
@@ -7,6 +7,7 @@ import { startAgent } from './page-agent.js';
|
|
|
7
7
|
import { mountMeeting } from './premium-meeting.js';
|
|
8
8
|
import { mountFirst } from './premium-first.js';
|
|
9
9
|
import { lineItems, behindOf, refreshTargets, whenRead } from './freshness-words.js';
|
|
10
|
+
import { consoleBrief } from './premium-brief.js';
|
|
10
11
|
import { momentOf, inText } from './c3-phone-model.js';
|
|
11
12
|
import { $, $$, esc, store, THEME_KEY, RM, AI, S, theme, toast, kv, H, openDlg, closeDlg, setTab, setMode, CHECK, CHEV, ptx, turnA, turnU, H1, H2, P1, UL, logHtml, loadThread, onScroll, wireRail, pvFeed } from './premium-shell.js';
|
|
12
13
|
const ICON = {
|
|
@@ -35,9 +36,22 @@ function baseline(keys) {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
/* ── hero ───────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
39
|
+
/* The headline is the console's "The brief", from the same reads and the same composer (premium-brief.js). Until it comes back, or when its reads fail, the
|
|
40
|
+
* records-only sentences above stay. Each draw asks again; a late answer to an older ask is dropped. */
|
|
41
|
+
let briefAsk = 0, shownBrief = null; // once the console brief is shown, a re-read keeps it on screen until the next answer: the hero does not flip back
|
|
42
|
+
function drawConsoleBrief() {
|
|
43
|
+
const ask = ++briefAsk;
|
|
44
|
+
consoleBrief().then((r) => {
|
|
45
|
+
if (ask !== briefAsk || !r) return;
|
|
46
|
+
shownBrief = r.parts.map((p) => (p.go ? `<span class="k">${esc(p.t)}</span>` : esc(p.t))).join('');
|
|
47
|
+
if ($('#brief').innerHTML !== shownBrief) { $('#brief').innerHTML = shownBrief; onScroll(); }
|
|
48
|
+
$('#brief').title = 'The same paragraph as The brief on the console Briefing. Read from: ' + r.sources.join(', ') + '.';
|
|
49
|
+
}, () => {});
|
|
50
|
+
}
|
|
38
51
|
function drawHero() {
|
|
39
52
|
$('#date').textContent = M.date;
|
|
40
|
-
$('#brief').innerHTML = M.hero.map((s) => s.parts.map((p) => (p.s ? `<span class="k">${esc(p.t)}</span>` : esc(p.t))).join('')).join(' ');
|
|
53
|
+
if (shownBrief == null) $('#brief').innerHTML = M.hero.map((s) => s.parts.map((p) => (p.s ? `<span class="k">${esc(p.t)}</span>` : esc(p.t))).join('')).join(' ');
|
|
54
|
+
drawConsoleBrief();
|
|
41
55
|
$('#snap').textContent = M.header.text;
|
|
42
56
|
$('#snap').title = M.header.missing.length ? 'A source that cannot be read adds nothing. It is named here, and the page does not guess.' : 'Every figure on this page comes from a record in the repository.';
|
|
43
57
|
}
|
|
@@ -906,6 +920,34 @@ async function load() {
|
|
|
906
920
|
else if (r.pending) setTimeout(load, 3000);
|
|
907
921
|
else if (r.refreshing) setTimeout(load, 10000);
|
|
908
922
|
}
|
|
923
|
+
/* ── Refresh and Sources, beside the Real data line: read the repositories again now, and see which source was read, which was not, and why ── */
|
|
924
|
+
const RDST = { read: ['fresh', 'Read'], 'not-read': ['failed', 'Not read'], 'not-included': ['off', 'Not included'], off: ['off', 'Off'] };
|
|
925
|
+
function sourcesHtml() {
|
|
926
|
+
const L = (M && M.header && M.header.sources) || [];
|
|
927
|
+
if (!L.length) return '<p class="note">The Briefing has not read anything yet.</p>';
|
|
928
|
+
const bad = L.filter((x) => x.state === 'not-read').length;
|
|
929
|
+
return `<div class="bd-top"><p>${bad ? bad + (bad === 1 ? ' source was' : ' sources were') + ' not read. Each reason is below.' : 'Every source was read.'}</p></div>`
|
|
930
|
+
+ L.map((x) => { const [c, w] = RDST[x.state] || ['off', x.state]; return `<div class="bd-src"><span><b>${esc(x.name)}</b><small><span class="bd-st ${c}">${w}</span></small><small>${esc(x.reason)}</small></span></div>`; }).join('')
|
|
931
|
+
+ '<p class="note">Refresh reads the included repositories again. Mail, Jira and the calendar are read by skills: refresh them under Around you, Data freshness.</p>';
|
|
932
|
+
}
|
|
933
|
+
async function pressRefresh(btn) {
|
|
934
|
+
if (btn.disabled) return;
|
|
935
|
+
btn.disabled = true; btn.textContent = 'Refreshing';
|
|
936
|
+
const ws = new URLSearchParams(location.search).get('ws');
|
|
937
|
+
const r = await pmPost('/api/briefing-premium/refresh' + (ws ? '?ws=' + encodeURIComponent(ws) : ''), {});
|
|
938
|
+
if (!r || !r.ok) { btn.disabled = false; btn.textContent = 'Refresh'; toast('Refresh did not start: ' + ((r && r.error) || 'the server did not answer') + '.'); return; }
|
|
939
|
+
toast(r.started && r.started.length ? 'Reading again: ' + r.started.join(', ') + '.' : r.already && r.already.length ? 'Already reading ' + r.already.join(', ') + '.' : 'No repository is included, so there is nothing to read.');
|
|
940
|
+
clearTimeout(RTIMER); RTIMER = setTimeout(async () => { await load(); btn.disabled = false; btn.textContent = 'Refresh'; }, 4000);
|
|
941
|
+
}
|
|
942
|
+
let RTIMER = null;
|
|
943
|
+
(function mountReal() {
|
|
944
|
+
const snap = $('#snap'); if (!snap) return;
|
|
945
|
+
const w = document.createElement('span'); w.className = 'rdbtns';
|
|
946
|
+
w.innerHTML = '<button type="button" class="fchip" id="rdRefresh" title="Read the included repositories again now">Refresh</button><button type="button" class="fchip" id="rdSources" aria-haspopup="dialog" title="Which source was read, which was not, and why">Sources</button>';
|
|
947
|
+
snap.insertAdjacentElement('afterend', w);
|
|
948
|
+
$('#rdRefresh').addEventListener('click', (e) => pressRefresh(e.currentTarget));
|
|
949
|
+
$('#rdSources').addEventListener('click', () => bdDlg('rd', 'Sources · real data', 'What the Briefing read', 'Which source was read, which was not, and why', M ? 'Each source below says whether it was read and, when it was not, the reason.' : 'The Briefing has not read anything yet.', sourcesHtml, () => {}));
|
|
950
|
+
})();
|
|
909
951
|
$('#brief').textContent = 'Reading the repository.';
|
|
910
952
|
load();
|
|
911
953
|
mountFirst(); // the "Your first Briefing" card, only when the page was opened with first=<import id> (initiative premium-welcome)
|