create-pmos 0.285.0 → 0.287.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-initiative-test.js +2 -2
- package/workspace/briefing-premium-work-test.js +1 -1
- package/workspace/guide/briefing-premium.md +18 -1
- package/workspace/lib/briefing-premium-drafts.js +89 -0
- package/workspace/lib/briefing-premium-products.js +2 -2
- package/workspace/lib/briefing-premium.js +6 -1
- package/workspace/lib/my-work-premium.js +44 -4
- package/workspace/lib/report-setups.js +27 -5
- package/workspace/lib/routes-briefing-premium.js +3 -1
- package/workspace/lib/routes-my-work-premium.js +3 -1
- package/workspace/lib/routes-report-setups.js +3 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-core-doc-issue-test.js +8 -7
- package/workspace/public/pm/premium-board.js +4 -60
- package/workspace/public/pm/premium-doc-edit.js +57 -10
- package/workspace/public/pm/premium-doc-sheet.js +236 -0
- package/workspace/public/pm/premium-initiative.js +3 -183
- package/workspace/public/pm/premium-insights.js +9 -3
- package/workspace/public/pm/premium-work.js +27 -3
- package/workspace/public/pm/premium.css +43 -0
- package/workspace/public/pm/premium.js +2 -0
- package/workspace/public/premium-work.html +4 -0
- package/workspace/test-files.json +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.287.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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T03:17:34Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T03:17:34Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T03:17:34Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -180,8 +180,8 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
180
180
|
|
|
181
181
|
/* I8 the document sheet */
|
|
182
182
|
const nPost0 = A.posts.length;
|
|
183
|
-
await p.locator('#dmList .dmo[data-doc="prd"]').click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && /Self-serve onboarding v2/.test(document.querySelector('#oMain').textContent) && document.querySelector('#oMain .dsbody'))); await sleep(500);
|
|
184
|
-
const sh = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, path: document.querySelector('#oMain
|
|
183
|
+
await p.locator('#dmList .dmo[data-doc="prd"]').click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && /Self-serve onboarding v2/.test(document.querySelector('#oMain').textContent) && document.querySelector('#oMain .dsbody'))); await sleep(500); await p.click('#oMain [data-ds="meta"]');
|
|
184
|
+
const sh = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, path: document.querySelector('#oMain [data-ds="meta"]').title, tabs: (() => { document.querySelector('#shV').click(); const t = [...document.querySelectorAll('#shT [data-sh]')].map((b) => b.textContent).join(','); document.querySelector('#shV').click(); return t; })(), fm: [...document.querySelectorAll('#oMain .kv2 span')].map((s) => s.textContent).join('|'), heads: [...document.querySelectorAll('#oMain h3.d2')].map((h) => h.textContent).join('|'), outline: [...document.querySelectorAll('#oMain .dso button')].map((b) => b.textContent).join('|'), pre: [...document.querySelectorAll('#oMain pre')].map((e) => e.textContent).join('|'), li: document.querySelectorAll('#oMain li').length }));
|
|
185
185
|
ok('I8 Read shows the file\'s path, its front matter as a grid, its headings, list and code', sh.title === 'PRD' && sh.path === 'planning/prd/self-serve-v2-prd.md' && sh.tabs === 'Read,Edit,Proposals,Edit log,Health' && /type\|PRD\|title\|Self-serve onboarding v2/.test(sh.fm) && sh.heads === 'PRD: Self-serve onboarding v2|Problem|Goal|Requirements' && sh.li === 2 && /R1 a first call/.test(sh.pre), JSON.stringify(sh));
|
|
186
186
|
ok('I8 Read asked for the log and the last revision, by GET, for this path', A.gets.some((g) => g.path === '/api/doc-sheet/log' && /path=planning%2Fprd%2Fself-serve-v2-prd.md/.test(g.query)) && A.gets.some((g) => g.path === '/api/doc-sheet/at' && /rev=2/.test(g.query)));
|
|
187
187
|
await p.click('#shV'); await p.click('#shT [data-sh="log"]');
|
|
@@ -96,7 +96,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
96
96
|
ok('M4 no suggestion, no estimate and no demo label is drawn', !(await p.evaluate(() => /Accept all|~\d+ min|demo/i.test(document.querySelector('#plate').textContent))));
|
|
97
97
|
|
|
98
98
|
/* M5 */
|
|
99
|
-
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('button')].map((b) => b.textContent).join('|') }));
|
|
99
|
+
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('|') }));
|
|
100
100
|
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 === 1 && 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));
|
|
101
101
|
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));
|
|
102
102
|
|
|
@@ -44,6 +44,15 @@ The page reads today's morning brief (`briefs/<date>.json` in the state folder)
|
|
|
44
44
|
- **The header** says "no morning brief for today" when there is none, or that the brief could not be read, or that it did not reach a source (mail, Jira, Confluence or Slack).
|
|
45
45
|
- **`?ws=<id>`** does not show these rows.
|
|
46
46
|
|
|
47
|
+
## The agent's drafts
|
|
48
|
+
|
|
49
|
+
The list also shows what the Initiative Driver is waiting on you for, the same two rows the console's Needs you shows: "Agent has 4 drafts on <initiative>" and "<initiative> is waiting on you: the drafts are 6 days old". They are read from each included product's Driver ledger. Nothing is recorded from these rows.
|
|
50
|
+
|
|
51
|
+
- **Order.** A product whose agent is stopped on you comes after the repository rows and before mail, Jira and Confluence. Open drafts come after those, the oldest first. The list shows seven rows; the rest are counted under "more".
|
|
52
|
+
- **The hero** says how many agent drafts wait on you, counting every one, shown or not. The dock counts them too.
|
|
53
|
+
- **The dialog** shows only what the Driver's row holds: the cause, the draft count, the age, and the confidence, recommendation, reversibility and effort the agent stated when it filed. A fact nobody stated is left out. **Review the drafts** opens Around you's Agent proposals, where Keep, Send back and Drop are.
|
|
54
|
+
- **Left out.** Core-document drafts open the console's Docs view.
|
|
55
|
+
|
|
47
56
|
## How long it takes to load
|
|
48
57
|
|
|
49
58
|
Two reads feed the page. The quick read takes the kill conditions, the failed-review verdicts, today's merges and agent runs, and the calendar. It finishes in seconds. The slow read derives the state of every initiative from git history. It takes about half a minute on a fast machine, and much longer on a machine that is busy. The page never waits on the slow read:
|
|
@@ -175,6 +184,12 @@ The Start button on a blocked row stays off. Starting an agent that writes needs
|
|
|
175
184
|
|
|
176
185
|
My work is the second place on the rail, at `/premium-work.html`. It reads the list the Work page reads, so the two pages show one list, and every press uses the Work page's own route. It adds no writer of its own.
|
|
177
186
|
|
|
187
|
+
**This week.** A card at the top of the right column shows Monday to Friday. Each day has a bar for its meeting time, from your calendar, and counts of items done and items due that day, from your list. If PMOS cannot read the calendar, the card says so and draws no bars. It makes no "will not fit" note, because no item has a size and PMOS holds no working hours.
|
|
188
|
+
|
|
189
|
+
**Row suggestions and buttons.** A row shows a suggestion line only when a record backs it: an agent's offer on the item, a draft that is ready, or a date. A row also has one button: Today, Tomorrow, Review, or Give to agent. Give to agent opens the item, where you start the agent. A row from Jira shows its Jira key.
|
|
190
|
+
|
|
191
|
+
**The agent's draft.** In an item's dialog the draft shows as formatted text, with a list of the agent's turns under it.
|
|
192
|
+
|
|
178
193
|
- **The hero** is built from counts of your list: new in the inbox, overdue, due today, people who owe you something (and the longest wait), agent drafts to review, and items untouched for seven days. A clause with no record is left out.
|
|
179
194
|
- **One count.** "To clear" is the inbox, plus today, plus agent drafts to review. The hero, the card and the dock use it.
|
|
180
195
|
- **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.
|
|
@@ -241,7 +256,7 @@ Insights is the fourth place on the rail, at `/premium-insights.html`. It reads
|
|
|
241
256
|
- **What stands out.** Up to three plain sentences taken from the series: behind its line for three readings in a row, behind and still moving away from the target, closing in, slipped, reached its target, or a large one-step move. There is no forecast and no cause.
|
|
242
257
|
- **No series recorded.** A KR metric with one reading or none is listed with the reason and is not drawn.
|
|
243
258
|
- **Ask PMOS to set up a report.** Type what the report is for and press **Ask**. A background run proposes a report and does nothing else. The request is listed as Working, then Ready to review. A ready request opens with its proposal: **Set it up**, **Change it** (say what to change; the run revises it), or **Cancel**.
|
|
244
|
-
- **Found in your work.** Up to three reports PMOS found in your calendar, mail or documents, each with why and what it saw. **Set it up** records the report and drafts its first cycle as a file. **Not a report** hides it and records it after 5 seconds, unless you press **Undo**.
|
|
259
|
+
- **Found in your work.** Up to three reports PMOS found in your calendar, mail or documents, each with why and what it saw. **Set it up** records the report and drafts its first cycle as a file. **Not a report** hides it and records it after 5 seconds, unless you press **Undo**. If the finding changed while the window was open, the window says what happened. It was already set up, it was marked not a report, or a new scan replaced it. The list is read again. Close the window and open the report from the list. If PMOS does not hear back, the window says nothing was recorded. Press the button to try again.
|
|
245
260
|
- **Set up.** Your recurring reports, with their schedule and next draft. A report opens with **Draft it now** (for a report drawn from your work) and **Pause** or **Resume**.
|
|
246
261
|
- **Documents.** The report files of the workspace, with cadence, slot and whether each is a draft or issued. Pressing one opens it on the page as a **Deck**: a title slide, then one slide for each section, with the arrow keys and a strip of slides. **Document** shows it as a page. **Present** shows the slide on the whole screen; the arrow keys move and Escape stops. **Download** gives PowerPoint, Word, Excel, CSV or the Markdown file; the files carry the words, not the look. **Print or save as PDF** prints one slide to a page. **Open in the console** is where a document is edited or issued. Nothing is sent from this page.
|
|
247
262
|
- **Shape a report's look.** On a draft, **Add a sample** takes a PDF, PowerPoint, Word, PNG or JPG file to follow. Say how it should look in the conversation; PMOS draws the next design version (D1, D2, …) and says what it changed. Press a version to go back to it. **This is it** saves the version shown as the report's design, and PMOS draws the cycle to match. An issued cycle is frozen with its look.
|
|
@@ -268,3 +283,5 @@ On a phone or tablet (under 1000 px) every dialog opens on **Detail**. A **Detai
|
|
|
268
283
|
A dialog's detail panel opens with the record's path, its heading and one lead line. A decision's evidence reads as a list. A measure's dialog draws the measure's chart above its facts and readings.
|
|
269
284
|
|
|
270
285
|
A calendar meeting's panel follows the mockup's Design review panel: the title with a status chip (when it starts, on now, or done), **Focus** and **Record**, **Prepared for you** (what it is about, people, material and the last meeting, each Ready only when PMOS holds that record), **Material** with **Add material**, **Previous meetings** and **Topics**. What Record and Focus do is one press away under **What Record does** and **What Focus reads**.
|
|
286
|
+
|
|
287
|
+
A document opens in one sheet on both the Board and the initiative page. Its status line shows the state, the version, the checks, the file and the last change; the file's path and front matter sit behind the file chip. The outline lists the headings at their depth, with **Find a heading** when there are many and **Hide the outline**. The body shows lists, tables, bold, code and links. A board draft keeps **Issue it** and **Draft it again**.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* lib/briefing-premium-drafts.js — the agent's drafts on the premium Briefing (initiative briefing-premium-agent-drafts).
|
|
3
|
+
*
|
|
4
|
+
* build({ parts, now }) → { rows } PURE. parts = [{ ws, name, needs }]: each product's driver rows (lib/driver-needs.js).
|
|
5
|
+
* readDrafts(available, now) → parts what the route reads: the driver ledger of each included product. A ledger that cannot be read gives nothing.
|
|
6
|
+
*
|
|
7
|
+
* The console's Needs you lists "Agent has 3 drafts on <title>" and "<title> is waiting on you: the drafts are 6 days old". The premium list had neither.
|
|
8
|
+
* THE RULE: every word comes from the driver's own row (question, cause, age, the facts the agent stated when it asked). A fact nobody stated is left out.
|
|
9
|
+
* A row has no write of its own: Keep, send back and Drop stay in Around you, which posts the existing /api/driver routes. PURE except readDrafts. */
|
|
10
|
+
const crypto = require('crypto');
|
|
11
|
+
|
|
12
|
+
const ACROSS = 'Across products';
|
|
13
|
+
const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
|
|
14
|
+
const plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
15
|
+
|
|
16
|
+
/** A row key the Briefing's ask route accepts: src:<chars>, up to 100 after the prefix. A long id keeps its head and gains a short hash. */
|
|
17
|
+
function keyOf(ws, runId) {
|
|
18
|
+
const raw = `drv:${ws}:${runId}`, safe = raw.replace(/[^A-Za-z0-9._:-]/g, '-');
|
|
19
|
+
return 'src:' + (safe.length <= 90 ? safe : safe.slice(0, 80) + '-' + crypto.createHash('sha1').update(raw).digest('hex').slice(0, 8));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function rowOf(n, product) {
|
|
23
|
+
const blocked = n.kind === 'driver-blocked';
|
|
24
|
+
const rk = n.rank && typeof n.rank === 'object' ? n.rank : {};
|
|
25
|
+
const f = rk.facts && typeof rk.facts === 'object' ? rk.facts : {};
|
|
26
|
+
const age = Number.isFinite(rk.age_days) ? rk.age_days : null;
|
|
27
|
+
const ageWord = age === null ? '' : age === 0 ? 'Filed today' : 'Oldest is ' + plural(age, 'day', 'days') + ' old';
|
|
28
|
+
const why = n.today && n.today.cause ? clip(n.today.cause, 240) : '';
|
|
29
|
+
const facts = [
|
|
30
|
+
['Source', 'The agent (Initiative Driver)'],
|
|
31
|
+
['Product', product.name],
|
|
32
|
+
['Initiative', n.initiative_id || ''],
|
|
33
|
+
['Drafts waiting', Number.isFinite(rk.drafts) ? String(rk.drafts) : ''],
|
|
34
|
+
['Age', ageWord],
|
|
35
|
+
['Wakes held while it waited', Number.isFinite(rk.blocked_runs) && rk.blocked_runs > 0 ? String(rk.blocked_runs) : ''],
|
|
36
|
+
['Agent confidence', typeof f.confidence === 'number' ? Math.round(f.confidence * 100) + '%' : ''],
|
|
37
|
+
['Agent recommends', typeof f.recommended === 'string' ? clip(f.recommended, 120) : ''],
|
|
38
|
+
['Reversible', typeof f.reversible === 'boolean' ? (f.reversible ? 'Yes' : 'No') : ''],
|
|
39
|
+
['Effort', f.effort || ''],
|
|
40
|
+
].filter((x) => x[1]);
|
|
41
|
+
const prepared = blocked ? 'The agent will not go on until you keep, send back or drop its drafts.' : 'Keep, send back or drop each draft.';
|
|
42
|
+
return {
|
|
43
|
+
kind: 'agent', key: keyOf(product.ws, n.run_id), title: clip(n.question, 140),
|
|
44
|
+
subject: ['Agent drafts', blocked ? 'waiting on you' : '', age ? plural(age, 'day', 'days') + ' old' : ''].filter(Boolean).join(' · '),
|
|
45
|
+
prepared, skip: why ? 'Why: ' + why : 'No reason is on record.',
|
|
46
|
+
product: product.name || ACROSS, from: ['driver:' + n.run_id], detail: { blocked },
|
|
47
|
+
dialog: {
|
|
48
|
+
eye: 'Agent drafts', logTitle: 'Read from the Driver ledger', title: clip(n.question, 140), sub: ['Agent drafts', product.name].filter(Boolean).join(' · '),
|
|
49
|
+
log: ['Read the Initiative Driver ledger of ' + product.name, 'Found open drafts for ' + (n.initiative_id ? 'the initiative ' + n.initiative_id : 'a Work task'), 'Read only what the agent stated when it filed them'],
|
|
50
|
+
say: why || 'The agent filed drafts and waits for you. Nothing it wrote has changed a record until you keep it.',
|
|
51
|
+
head: 'The drafts', facts, opts: [], sel: null, nodef: '', proposals: true,
|
|
52
|
+
pane: { label: 'Driver ledger', file: (n.today && n.today.evidence) || 'driver.jsonl', h: clip(n.question, 140), intro: why, rows: facts, paras: [], parasTitle: '' },
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Blocked rows first (the agent is stopped), then drafts, the oldest first. */
|
|
58
|
+
const order = (a, b) => (b.detail.blocked - a.detail.blocked) || ((b._age || 0) - (a._age || 0));
|
|
59
|
+
|
|
60
|
+
function build({ parts } = {}) {
|
|
61
|
+
const rows = [];
|
|
62
|
+
for (const p of parts || []) {
|
|
63
|
+
if (!p || !p.ws || !Array.isArray(p.needs)) continue;
|
|
64
|
+
for (const n of p.needs) {
|
|
65
|
+
if (!n || (n.kind !== 'driver-drafts' && n.kind !== 'driver-blocked') || !n.run_id || !clip(n.question, 140)) continue;
|
|
66
|
+
const r = rowOf(n, { ws: p.ws, name: p.name || p.ws });
|
|
67
|
+
r._age = n.rank && Number.isFinite(n.rank.age_days) ? n.rank.age_days : 0;
|
|
68
|
+
rows.push(r);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
rows.sort(order);
|
|
72
|
+
rows.forEach((r) => delete r._age);
|
|
73
|
+
return { rows };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** One entry per included product: its driver rows. A product whose ledger cannot be read gives none, and no error. */
|
|
77
|
+
function readDrafts(available) {
|
|
78
|
+
const DN = require('./driver-needs.js');
|
|
79
|
+
const out = [];
|
|
80
|
+
for (const a of available || []) {
|
|
81
|
+
if (!a || !a.on || !a.root) continue;
|
|
82
|
+
let needs = [];
|
|
83
|
+
try { needs = DN.rowsFor({ root: a.root }, { lead: true }); } catch { needs = []; }
|
|
84
|
+
out.push({ ws: a.ws, name: a.name, needs });
|
|
85
|
+
}
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
module.exports = { build, readDrafts, keyOf };
|
|
@@ -71,7 +71,7 @@ function start(p, engine, runtimeDir) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/** The merged answer for the workspaces that are on. `available` is choose()'s list (all of them, with `on`). */
|
|
74
|
-
async function modelOfMany({ available, engine, runtimeDir, sources }) {
|
|
74
|
+
async function modelOfMany({ available, engine, runtimeDir, sources, agent }) {
|
|
75
75
|
const now = Date.now();
|
|
76
76
|
const on = (available || []).filter((a) => a.on);
|
|
77
77
|
const parts = [];
|
|
@@ -98,7 +98,7 @@ async function modelOfMany({ available, engine, runtimeDir, sources }) {
|
|
|
98
98
|
const settled = parts.filter((p) => p.state === 'ready').length;
|
|
99
99
|
if (on.length && !settled && parts.every((p) => p.state === 'reading')) return { state: 'reading', elapsed_ms: elapsed };
|
|
100
100
|
if (on.length && !settled && parts.every((p) => p.state === 'error')) return { state: 'error', error: parts.map((p) => p.product.name + ': ' + p.error).join('; ').slice(0, 300) };
|
|
101
|
-
const model = BP.buildMany({ now, asOf: asOf || now, meetings: BP.readMeetings(runtimeDir, now), defers: Object.fromEntries(W.readDefers(runtimeDir, now)), available: (available || []).map((a) => ({ ws: a.ws, name: a.name, home: a.home, on: a.on })), parts, sources });
|
|
101
|
+
const model = BP.buildMany({ now, asOf: asOf || now, meetings: BP.readMeetings(runtimeDir, now), defers: Object.fromEntries(W.readDefers(runtimeDir, now)), available: (available || []).map((a) => ({ ws: a.ws, name: a.name, home: a.home, on: a.on })), parts, sources, agent });
|
|
102
102
|
last = model;
|
|
103
103
|
return { state: 'ready', model, as_of: asOf || now, refreshing, pending: model.pending, ...(error ? { error } : {}) };
|
|
104
104
|
}
|
|
@@ -22,6 +22,7 @@ const path = require('path');
|
|
|
22
22
|
const { execFile } = require('child_process');
|
|
23
23
|
const W = require('./briefing-premium-writes.js');
|
|
24
24
|
const Src = require('./briefing-premium-sources.js');
|
|
25
|
+
const Drafts = require('./briefing-premium-drafts.js');
|
|
25
26
|
|
|
26
27
|
const DAY = 86400000;
|
|
27
28
|
const MAX_ROWS = 7;
|
|
@@ -385,7 +386,9 @@ function buildMany(g) {
|
|
|
385
386
|
const owner = new Map();
|
|
386
387
|
for (const p of read) for (const i of p.f.initiatives) owner.set(i.id, owner.has(i.id) ? null : { ws: p.product.ws, name: p.product.name });
|
|
387
388
|
const sx = g.sources ? Src.build(Object.assign({}, g.sources, { products: (id) => owner.get(id) || null })) : null;
|
|
388
|
-
|
|
389
|
+
// the agent's drafts (initiative: the agent drafts slice): a product whose agent is stopped on the PM comes before the sources, the open drafts after them
|
|
390
|
+
const dx = g.agent ? Drafts.build({ parts: g.agent }).rows : [];
|
|
391
|
+
const { rows, more } = cut(every.concat(dx.filter((r) => r.detail.blocked), sx ? sx.rows : [], dx.filter((r) => !r.detail.blocked)), putOff);
|
|
389
392
|
const tag = (list, p) => list.map((x) => Object.assign({}, x, { ws: p.product.ws, product: p.product.name }));
|
|
390
393
|
const cf = {
|
|
391
394
|
now, asOf, meetings, defers: g.defers || {},
|
|
@@ -408,6 +411,8 @@ function buildMany(g) {
|
|
|
408
411
|
: heroOf(cf, rows);
|
|
409
412
|
const srcRows = rows.filter((r) => r.kind === 'source'), srcSeen = [...new Set(srcRows.map((r) => r.detail.source))];
|
|
410
413
|
if (srcRows.length) hero.push({ parts: [{ t: num(srcRows.length) + ' ' + plural(srcRows.length, 'item', 'items') + ' from ' + joinNames(srcSeen.map((k) => Src.SOURCE_WORD[k])), s: true }, { t: ' ' + plural(srcRows.length, 'needs', 'need') + ' you.', s: false }], from: srcRows.map((r) => r.from[0]) });
|
|
414
|
+
const agRows = rows.filter((r) => r.kind === 'agent'), agAll = dx.length;
|
|
415
|
+
if (agAll) hero.push({ parts: [{ t: num(agAll) + ' ' + plural(agAll, 'agent draft', 'agent drafts') + ' ' + (agAll === 1 ? 'waits' : 'wait'), s: true }, { t: ' on you.', s: false }], from: (agRows.length ? agRows : dx).map((r) => r.from[0]) });
|
|
411
416
|
const sxNote = !sx ? '' : sx.state === 'ok' ? (sx.notRead.length ? ' · not read by the morning brief: ' + sx.notRead.join(', ') : '') : sx.state === 'bad' ? ' · the morning brief could not be read' : ' · no morning brief for today';
|
|
412
417
|
return {
|
|
413
418
|
date: dateLine(now),
|
|
@@ -59,6 +59,7 @@ function agentDetail(it) {
|
|
|
59
59
|
draft: d ? { summary: clip(d.summary || '', 300), body: String(d.body || '').slice(0, 4000), step: d.step ? clip(d.step, 200) : null } : null,
|
|
60
60
|
error: a.error ? clip(a.error, 300) : null, asks: !!a.asks, session: a.session || null,
|
|
61
61
|
mine, where: mine ? null : it.origin === 'jira' ? 'Jira' : PLACE[it.place] || 'its source',
|
|
62
|
+
turns: (Array.isArray(a.log) ? a.log : []).slice(-12).map((t, i) => ({ who: t.who === 'agent' ? 'agent' : 'you', kind: String(t.kind || ''), at: t.at || null, text: clip(t.text || '', 300), has_body: !!t.body })),
|
|
62
63
|
started_at: a.started_at || null, sent_at: a.sent && a.sent.at ? a.sent.at : null, link: a.sent && isUrl(a.sent.link) ? a.sent.link : null,
|
|
63
64
|
};
|
|
64
65
|
}
|
|
@@ -72,15 +73,52 @@ function dueChip(it, today) {
|
|
|
72
73
|
return { chip: shortDate(it.due), overdue: false };
|
|
73
74
|
}
|
|
74
75
|
|
|
76
|
+
/** The suggestion line and the one press on a row. A line shows only when a record says it: an agent's own offer on the item, a draft ready, or a date.
|
|
77
|
+
* PMOS does not guess a place for an item. The press is a route that already exists: Today (/flag), Tomorrow (/defer), or the item's dialog, where the agent brief and the review run. */
|
|
78
|
+
function suggestOf(it, list, today, overdue) {
|
|
79
|
+
const ag = it.agent || {}, state = agentOf(it), d = it.due ? daysBetween(today, it.due) : null;
|
|
80
|
+
let sug = null, cta = null;
|
|
81
|
+
if (state === 'ready') { sug = { b: 'Agent draft, not checked.', t: clip((ag.draft && (ag.draft.summary || ag.draft.body)) || 'Open it to read the draft.', 140) }; cta = { label: 'Review', act: 'open' }; }
|
|
82
|
+
else if (state === 'suggest' && (ag.instruction || ag.suggest)) { sug = { b: 'Agent can:', t: clip(ag.instruction || ag.suggest, 140) }; cta = { label: 'Give to agent', act: 'open' }; }
|
|
83
|
+
else if (overdue) sug = { b: 'Overdue.', t: 'It was due ' + shortDate(it.due) + ' and is still open.' };
|
|
84
|
+
else if (d === 0) sug = { b: 'Due today.', t: 'Its date is today.' };
|
|
85
|
+
else if (d != null && d > 0 && d <= 6) sug = { b: 'This week.', t: 'Its date is ' + shortDate(it.due) + '.' };
|
|
86
|
+
if (!cta && list !== 'waiting' && !isRunning(it) && state !== 'failed') cta = list === 'today' ? { label: 'Tomorrow', act: 'tomorrow' } : { label: 'Today', act: 'today' };
|
|
87
|
+
return { sug, cta };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** This week, Monday to Friday, from three records: the meetings the calendar holds, the items marked done that day, and the open items with that due date.
|
|
91
|
+
* No effort, capacity or "won't fit" figure is made: no item carries a size and PMOS holds no working hours. */
|
|
92
|
+
function weekOf({ today, items, events }) {
|
|
93
|
+
const base = isoDay(today);
|
|
94
|
+
const dow = (base.getDay() + 6) % 7;
|
|
95
|
+
const iso = (d) => d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate());
|
|
96
|
+
const days = [0, 1, 2, 3, 4].map((i) => { const d = new Date(base.getFullYear(), base.getMonth(), base.getDate() - dow + i); return { iso: iso(d), dow: WEEKDAYS[d.getDay()].slice(0, 3).toUpperCase(), n: d.getDate() }; });
|
|
97
|
+
const read = Array.isArray(events);
|
|
98
|
+
for (const d of days) {
|
|
99
|
+
const ev = read ? events.filter((e) => String(e.at || '').slice(0, 10) === d.iso) : [];
|
|
100
|
+
d.meetings = ev.length;
|
|
101
|
+
d.meet_min = ev.reduce((a, e) => { const m = Date.parse(e.end) - Date.parse(e.at); return a + (m > 0 && m < 86400000 ? Math.round(m / 60000) : 0); }, 0);
|
|
102
|
+
d.done = items.filter((it) => it.done && String(it.done_at || '').slice(0, 10) === d.iso).length;
|
|
103
|
+
d.due = items.filter((it) => !it.done && it.due === d.iso).length;
|
|
104
|
+
d.today = d.iso === today; d.past = d.iso < today;
|
|
105
|
+
}
|
|
106
|
+
const tot = (k) => days.reduce((a, d) => a + d[k], 0);
|
|
107
|
+
const bits = [read ? tot('meetings') + ' ' + plural(tot('meetings'), 'meeting', 'meetings') : null, tot('done') + ' done', tot('due') + ' due'].filter(Boolean);
|
|
108
|
+
return { title: 'This week', cap: bits.join(' · '), days, calendar: read,
|
|
109
|
+
note: (read ? 'Bars are meeting time from your calendar. ' : 'The calendar could not be read, so there are no bars. ') + 'Done and due counts come from your list. PMOS holds no estimate or working hours, so it does not say what will not fit.' };
|
|
110
|
+
}
|
|
111
|
+
|
|
75
112
|
function rowOf(it, list, v, inReview, focusIds) {
|
|
76
113
|
const today = v.today, { chip, overdue } = dueChip(it, today);
|
|
77
|
-
const sub = [srcLabel(it), it.priority, it.waiting_on ? 'waiting on ' + it.waiting_on : null].filter(Boolean).join(' · ');
|
|
114
|
+
const sub = [srcLabel(it) + (it.key && it.source !== 'local' ? ' ' + it.key : ''), it.priority, it.waiting_on ? 'waiting on ' + it.waiting_on : null].filter(Boolean).join(' · ');
|
|
78
115
|
const days = it.waiting_since ? daysBetween(String(it.waiting_since).slice(0, 10), today) : null;
|
|
79
116
|
const facts = [
|
|
80
117
|
['From', srcLabel(it)], ['Place', list === 'upcoming' ? 'Upcoming' : list.charAt(0).toUpperCase() + list.slice(1)], ['Due', it.due ? shortDate(it.due) + (overdue ? ' (overdue)' : '') : ''],
|
|
81
118
|
['Priority', it.priority], ['Waiting on', it.waiting_on], ['Waiting since', it.waiting_since ? shortDate(String(it.waiting_since).slice(0, 10)) + (days != null ? ' (' + days + ' ' + plural(days, 'day', 'days') + ')' : '') : ''],
|
|
82
119
|
['Not before', it.defer && it.defer > today ? shortDate(it.defer) : ''], ['Added', it.created_at ? shortDate(String(it.created_at).slice(0, 10)) : ''], ['Last touched', it.touched_at ? shortDate(String(it.touched_at).slice(0, 10)) : ''],
|
|
83
120
|
].filter((x) => x[1]);
|
|
121
|
+
const added = it.created_at ? shortDate(String(it.created_at).slice(0, 10)) : '';
|
|
84
122
|
const draft = it.agent && it.agent.draft && (it.agent.draft.body || it.agent.draft.summary);
|
|
85
123
|
const actions = ['done', 'notyet'];
|
|
86
124
|
if (list !== 'today') actions.push('flag');
|
|
@@ -88,8 +126,9 @@ function rowOf(it, list, v, inReview, focusIds) {
|
|
|
88
126
|
actions.push('remove');
|
|
89
127
|
if (inReview) actions.push('keep');
|
|
90
128
|
const say = overdue ? 'This was due ' + shortDate(it.due) + ' and is still open.' : list === 'tray' ? 'You threw this in. It has no date or place yet. Place it, or drop it.' : list === 'inbox' ? 'This is new and has no date or place yet.' : list === 'waiting' ? 'You are waiting on ' + (it.waiting_on || 'someone') + (days != null ? ' for ' + days + ' ' + plural(days, 'day', 'days') : '') + '.' : 'This is on your list.';
|
|
129
|
+
const { sug, cta } = suggestOf(it, list, today, overdue);
|
|
91
130
|
return {
|
|
92
|
-
key: 'work:' + it.id, id: it.id, list, title: clip(it.title, 140), sub, chip, overdue, src: srcLabel(it),
|
|
131
|
+
key: 'work:' + it.id, id: it.id, list, title: clip(it.title, 140), sub: sub + (added && (list === 'inbox' || list === 'tray') ? ' · added ' + added : ''), chip, overdue, src: srcLabel(it), sug, cta,
|
|
93
132
|
agent: agentOf(it) && agentOf(it) !== 'suggest' ? agentOf(it) : null,
|
|
94
133
|
focus: list === 'today' && focusIds.has(it.id),
|
|
95
134
|
dialog: {
|
|
@@ -108,7 +147,7 @@ function rowOf(it, list, v, inReview, focusIds) {
|
|
|
108
147
|
};
|
|
109
148
|
}
|
|
110
149
|
|
|
111
|
-
function build({ v, now }) {
|
|
150
|
+
function build({ v, now, events }) {
|
|
112
151
|
now = now || Date.now();
|
|
113
152
|
v = v || {};
|
|
114
153
|
const today = v.today || new Date(now).toISOString().slice(0, 10);
|
|
@@ -165,12 +204,13 @@ function build({ v, now }) {
|
|
|
165
204
|
header: { text: 'Real data · as of ' + hhmm(now) + ' · Jira and Slack appear only when an agent session has read them', missing: [] },
|
|
166
205
|
hero, empty,
|
|
167
206
|
capture: { placeholder: 'Add anything: "Reply to Rina about SSO by Friday"', hint: 'One line. The date and priority are read from it.' },
|
|
168
|
-
plate: { title: 'On your plate', cap: clear + ' to clear', n: clear, sections, note: 'Each item comes from your list. A date shows only when one was set. Nothing changes in Jira or Slack from here.' },
|
|
207
|
+
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.' },
|
|
169
208
|
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.' },
|
|
170
209
|
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 },
|
|
171
210
|
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 },
|
|
172
211
|
review: { n: (v.review || []).length, days: v.review_days, ids: (v.review || []).map((i) => i.id) },
|
|
173
212
|
dock: { needs: clear, label: 'to clear', next: firstToday ? firstToday.title : (sections[0].rows[0] ? sections[0].rows[0].title : null) },
|
|
213
|
+
week: weekOf({ today, items: v.items || all.map((x) => x.it), events }),
|
|
174
214
|
focus, jobs,
|
|
175
215
|
rows: rowsAll,
|
|
176
216
|
};
|
|
@@ -629,10 +629,32 @@ function fileFinding(file, input, { run, by, now } = {}) {
|
|
|
629
629
|
append(file, { ev: 'finding', id, run: run || null, pattern, name: x.name.trim(), why: x.why.trim(), evidence: ev.evidence, confidence: x.confidence, proposal: pr.proposal }, { now, by });
|
|
630
630
|
return { ok: true, result: 'filed', id };
|
|
631
631
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
632
|
+
/**
|
|
633
|
+
* Find the finding a page names. A page holds an id from its last read, so the ledger may have moved on: the finding was set up (here or in the console),
|
|
634
|
+
* marked not a report, or a later finder run filed the same report again under a new id. Returns { ok: true, finding, moved } (moved: found by name or
|
|
635
|
+
* pattern, not by id) or a refusal whose `reason` is set-up | dismissed | gone and whose text says what happened and what to do next.
|
|
636
|
+
*/
|
|
637
|
+
function lookupFinding(st, id, name) {
|
|
638
|
+
const q = (id == null ? '' : String(id)).slice(0, 80), nm = name ? slugOf(String(name)) : '';
|
|
639
|
+
const byId = st.findings.get(q);
|
|
640
|
+
const label = (f) => `"${String((f && f.name) || name || 'This report').slice(0, 80)}"`;
|
|
641
|
+
if (byId && byId.state === 'open') return { ok: true, finding: byId, moved: false };
|
|
642
|
+
const sameOpen = [...st.findings.values()].find((f) => f.state === 'open' && !isDismissed(st, f.pattern, f.name)
|
|
643
|
+
&& ((byId && (f.pattern === byId.pattern || slugOf(f.name) === slugOf(byId.name))) || (nm && slugOf(f.name) === nm)));
|
|
644
|
+
if (sameOpen) return { ok: true, finding: sameOpen, moved: true };
|
|
645
|
+
if (byId && byId.state === 'set-up') {
|
|
646
|
+
const s = [...st.setups.values()].find((x) => x.from && x.from.finding === byId.id);
|
|
647
|
+
return { ...refuse(409, `${label(byId)} is already set up${s ? ' as ' + s.id : ''}. Nothing more was recorded. Open it under Set up.`), reason: 'set-up' };
|
|
648
|
+
}
|
|
649
|
+
if (byId && byId.state === 'dismissed') return { ...refuse(409, `${label(byId)} was marked not a report, so it is hidden. Nothing was set up.`), reason: 'dismissed' };
|
|
650
|
+
const known = nm && [...st.setups.values()].find((x) => slugOf(x.name) === nm);
|
|
651
|
+
if (known) return { ...refuse(409, `${label()} is already set up as ${known.id}. Nothing more was recorded. Open it under Set up.`), reason: 'set-up' };
|
|
652
|
+
return { ...refuse(404, `${label()} is no longer in the report ledger; a rescan may have replaced it. Nothing was recorded. The list has refreshed: open it again from Found in your work.`), reason: 'gone' };
|
|
653
|
+
}
|
|
654
|
+
function dismissFinding(file, { id, name, by, now }) {
|
|
655
|
+
const l = lookupFinding(fold(readLines(file)), id, name);
|
|
656
|
+
if (!l.ok) return l.reason === 'dismissed' ? { ok: true, unchanged: true } : l;
|
|
657
|
+
append(file, { ev: 'finding-dismiss', id: l.finding.id, pattern: l.finding.pattern }, { now, by });
|
|
636
658
|
return { ok: true };
|
|
637
659
|
}
|
|
638
660
|
function setFinder(file, { cadence, sources, by, now }) {
|
|
@@ -738,6 +760,6 @@ module.exports = {
|
|
|
738
760
|
ledgerFile, stateDir, append, readLines, fold, stateOf, openFindings, isDismissed, slugOf, patternOf, checkProposal, checkEvidence, checkSchedule,
|
|
739
761
|
scheduleLabel, scheduleOf, firstSlot, initialLastRun, nextDraftAt, definitionText, writeDefinition, definitionsOf, definitionFile, shaOf,
|
|
740
762
|
fileScheduleStore, scheduleFor, registerSchedule, updateSchedule, unregisterSchedule,
|
|
741
|
-
setUp, change, pause, resume, remove, askStart, askChange, askCancel, askEnd, fileProposal, findStart, findEnd, fileFinding, dismissFinding, setFinder,
|
|
763
|
+
setUp, change, pause, resume, remove, askStart, askChange, askCancel, askEnd, fileProposal, findStart, findEnd, fileFinding, dismissFinding, lookupFinding, setFinder,
|
|
742
764
|
writeDocument, frameMarkdown, migrate, migratedKeys, dashboardKeys, dashTitle, keyOfSource, longDate, localDay,
|
|
743
765
|
};
|
|
@@ -23,6 +23,7 @@ const { appendOutbox } = require(repoScript('outbox.js'));
|
|
|
23
23
|
|
|
24
24
|
const Prod = require('./briefing-premium-products.js');
|
|
25
25
|
const Src = require('./briefing-premium-sources.js');
|
|
26
|
+
const Drafts = require('./briefing-premium-drafts.js');
|
|
26
27
|
const settings = require('./settings-store.js');
|
|
27
28
|
|
|
28
29
|
/** The workspaces the Briefing may read right now (initiative briefing-premium-products): choose()'s list, from the server's workspace list and the PM's setting. */
|
|
@@ -103,7 +104,8 @@ module.exports = {
|
|
|
103
104
|
if (!url.searchParams.get('ws')) {
|
|
104
105
|
const sel = products(ctx);
|
|
105
106
|
const sources = await Src.readSources(ctx, Date.now()).catch(() => null);
|
|
106
|
-
const
|
|
107
|
+
const agent = Drafts.readDrafts(sel.available);
|
|
108
|
+
const r = await Prod.modelOfMany({ available: sel.available, engine: enginePath(), runtimeDir: ctx.runtimeDir, sources, agent });
|
|
107
109
|
ctx.json(res, r.state === 'error' ? { ok: false, ...r } : { ok: true, ...r }, r.state === 'ready' ? 200 : r.state === 'reading' ? 202 : 500);
|
|
108
110
|
return true;
|
|
109
111
|
}
|
|
@@ -23,8 +23,10 @@ module.exports = {
|
|
|
23
23
|
let v = null, err = null;
|
|
24
24
|
try { v = await listView(req, ctx); } catch (e) { err = String((e && e.message) || e).slice(0, 200); }
|
|
25
25
|
if (!v || v.ok === false) { ctx.json(res, { ok: false, state: 'error', error: err || (v && v.error) || 'the list could not be read' }, 500); return true; }
|
|
26
|
+
let events = null;
|
|
27
|
+
try { events = require('./calendar-events.js').readAll(ctx.runtimeDir, { now: Date.now() }); } catch { events = null; }
|
|
26
28
|
let model;
|
|
27
|
-
try { model = WP.build({ v, now: Date.now() }); } catch (e) { ctx.json(res, { ok: false, state: 'error', error: 'the page could not be built: ' + String((e && e.message) || e).slice(0, 160) }, 500); return true; }
|
|
29
|
+
try { model = WP.build({ v, now: Date.now(), events }); } catch (e) { ctx.json(res, { ok: false, state: 'error', error: 'the page could not be built: ' + String((e && e.message) || e).slice(0, 160) }, 500); return true; }
|
|
28
30
|
ctx.json(res, { ok: true, state: 'ready', model, as_of: Date.now() });
|
|
29
31
|
return true;
|
|
30
32
|
},
|
|
@@ -309,7 +309,7 @@ async function handle(req, res, url, ctx) {
|
|
|
309
309
|
const root = w.root;
|
|
310
310
|
const file = RS.ledgerFile(root);
|
|
311
311
|
const opts = { by: g.actor, wsId: w.id, scheduleStore: ctx.scheduleStore };
|
|
312
|
-
const fail = (r) => send(
|
|
312
|
+
const fail = (r) => send({ status: r.status || 400, body: { ok: false, error: r.error, ...(r.reason ? { reason: r.reason } : {}) } });
|
|
313
313
|
|
|
314
314
|
if (sub === 'ask') {
|
|
315
315
|
if (typeof ctx.spawnSession !== 'function' || headless.kindFor({ agent: 'claude', origin: 'report-setup:probe' }) !== 'report-setup') {
|
|
@@ -343,7 +343,7 @@ async function handle(req, res, url, ctx) {
|
|
|
343
343
|
const st = RS.fold(RS.readLines(file));
|
|
344
344
|
let from = null; let base = null;
|
|
345
345
|
if (body.ask) { const a = st.asks.get(text(body.ask)); if (!a) return send(bad(404, 'no such request')); from = { ask: a.id }; base = a.proposal; }
|
|
346
|
-
else if (body.finding) { const
|
|
346
|
+
else if (body.finding) { const l = RS.lookupFinding(st, text(body.finding), text(body.name)); if (!l.ok) return send({ status: l.status, body: { ok: false, error: l.error, reason: l.reason } }); from = { finding: l.finding.id }; base = l.finding.proposal; }
|
|
347
347
|
const proposal = body.proposal && typeof body.proposal === 'object' && !Array.isArray(body.proposal) ? body.proposal : base;
|
|
348
348
|
if (!proposal) return send(bad(400, 'say which request or finding to set up, or give the proposal'));
|
|
349
349
|
const r = RS.setUp(root, { ...proposal, ...(from ? { from } : {}) }, opts);
|
|
@@ -356,7 +356,7 @@ async function handle(req, res, url, ctx) {
|
|
|
356
356
|
return send({ status: 200, body: { ok: true, setup: setupOut(r.setup, new Date(), documentsOf(ctx, w), copyIndex(root), root), first_draft: r.first_draft, drafted } });
|
|
357
357
|
}
|
|
358
358
|
if (sub === 'dismiss') {
|
|
359
|
-
const r = RS.dismissFinding(file, { id: text(body.finding), by: g.actor });
|
|
359
|
+
const r = RS.dismissFinding(file, { id: text(body.finding), name: text(body.name), by: g.actor });
|
|
360
360
|
if (!r.ok) return fail(r);
|
|
361
361
|
return send({ status: 200, body: { ok: true } });
|
|
362
362
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.287.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.287.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -34,7 +34,7 @@ const finish = async (code) => {
|
|
|
34
34
|
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
35
35
|
|
|
36
36
|
const ledger = () => { const f = CD.ledgerFile(team); return fs.existsSync(f) ? fs.readFileSync(f, 'utf8').split('\n').filter(Boolean).map((x) => JSON.parse(x)) : []; };
|
|
37
|
-
const ALLOWED = /^\/api\/(?:core-docs\/issue|briefing-premium\/note)$/;
|
|
37
|
+
const ALLOWED = /^\/api\/(?:core-docs\/issue|briefing-premium\/note|doc-health\/check)$/;
|
|
38
38
|
const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers.\n';
|
|
39
39
|
|
|
40
40
|
(async () => {
|
|
@@ -91,17 +91,18 @@ const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers
|
|
|
91
91
|
ok('B1 a board document with a file is a button that opens the reader', await until(() => p.evaluate((k) => !!document.querySelector(`#docBody [data-doc="${k}"]`), bkey)));
|
|
92
92
|
ok('B1 a document with no file is not', await p.evaluate((k) => !document.querySelector('#docBody .dmo:not(button)') || [...document.querySelectorAll('#docBody .dmo:not(button)')].every((x) => !x.closest('.dmr').querySelector(`[data-doc="${k}"]`)), bkey));
|
|
93
93
|
await p.click(`#docBody [data-doc="${bkey}"]`); await dlgOn(p);
|
|
94
|
-
ok('B2 the reader shows the file\'s text and path, and the bar says nothing is sent', await until(() => p.evaluate((pt) => { const o = document.querySelector('#oMain'); return /Why this board exists/.test(o.textContent) && o.
|
|
95
|
-
ok('B2 the
|
|
94
|
+
ok('B2 the reader shows the file\'s text and path, and the bar says nothing is sent', await until(() => p.evaluate((pt) => { const o = document.querySelector('#oMain'); return /Why this board exists/.test(o.textContent) && !!o.querySelector('[data-ds="meta"]') && !!o.querySelector('[data-issue-bar="draft"]') && /Nothing is sent/.test(o.querySelector('[data-issue-bar]').textContent) && !!o.querySelector('[data-ds="issue"]'); }, d1.path)), await p.evaluate(() => document.querySelector('#oMain').textContent));
|
|
95
|
+
ok('B2 the path is behind the file chip, not in the way', await p.evaluate((pt) => !document.querySelector('#oMain .dsmeta') && !!document.querySelector('#oMain [data-ds="meta"]'), d1.path) && (await p.click('#oMain [data-ds="meta"]'), await p.evaluate((pt) => document.querySelector('#oMain .dsmeta').textContent.includes(pt), d1.path)));
|
|
96
|
+
ok('B2 the reader has the sheet\'s view menu, as the initiative page does', await p.evaluate(() => !!document.querySelector('#oMain #shV')));
|
|
96
97
|
const n0 = ledger().filter((l) => l.ev === 'issue').length;
|
|
97
|
-
await p.click('[data-
|
|
98
|
+
await p.click('[data-ds="issue"]');
|
|
98
99
|
ok('B3 Issue it says it sent nothing', !!(await toastIs(p, /Issued\. Nothing was sent to anyone/)));
|
|
99
100
|
const sent = P.posts.filter((x) => x.path === '/api/core-docs/issue');
|
|
100
101
|
ok('B4 it posted the workspace, the scope, the key and the slot, and nothing else, with the launch nonce', sent.length === 1 && Object.keys(sent[0].body).sort().join() === 'key,scope,slot,ws' && sent[0].body.scope === bscope && sent[0].body.key === bkey && sent[0].body.slot === d1.slot && sent[0].body.ws === B.ws && sent[0].headers['x-pmos-nonce'] === nonce && !!nonce, JSON.stringify(sent));
|
|
101
102
|
const il = ledger().filter((l) => l.ev === 'issue');
|
|
102
103
|
ok('B5 the ledger has one new issue line for that draft, written by the PM', il.length === n0 + 1 && il[il.length - 1].slot === d1.slot && il[il.length - 1].scope === bscope && /pm/.test(String(il[il.length - 1].by)), JSON.stringify(il));
|
|
103
104
|
ok('B5 the file now says state: issued', /^state: issued$/m.test(fs.readFileSync(path.join(team, d1.path), 'utf8')));
|
|
104
|
-
ok('B6 the reader says it is issued, the Issue it press is gone, and the row reads Up to date', await until(() => p.evaluate(() => { const o = document.querySelector('#oMain'); return !!o.querySelector('[data-issue-bar="done"]') && !o.querySelector('[data-
|
|
105
|
+
ok('B6 the reader says it is issued, the Issue it press is gone, and the row reads Up to date', await until(() => p.evaluate(() => { const o = document.querySelector('#oMain'); return !!o.querySelector('[data-issue-bar="done"]') && !o.querySelector('[data-ds="issue"]') && /state: issued|issued/.test(o.textContent); })) && await until(() => p.evaluate((k) => { const r = document.querySelector(`#docBody [data-doc="${k}"]`); return r && /Up to date/.test(r.textContent); }, bkey)));
|
|
105
106
|
await p.screenshot({ path: path.join(R.base, 'board-issued.png') });
|
|
106
107
|
await P.ctx.close();
|
|
107
108
|
|
|
@@ -162,8 +163,8 @@ const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers
|
|
|
162
163
|
const S = await open('/premium-board.html', { w, h, theme });
|
|
163
164
|
await until(() => S.page.evaluate((k) => !!document.querySelector(`#docBody [data-doc="${k}"]`), k4), 60000);
|
|
164
165
|
await S.page.click(`#docBody [data-doc="${k4}"]`); await dlgOn(S.page);
|
|
165
|
-
await until(() => S.page.evaluate(() => !!document.querySelector('[data-
|
|
166
|
-
const f = await S.page.evaluate(() => ({ wide: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('#oMain [data-
|
|
166
|
+
await until(() => S.page.evaluate(() => !!document.querySelector('[data-ds="issue"]')));
|
|
167
|
+
const f = await S.page.evaluate(() => ({ wide: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('#oMain [data-ds="issue"], #oMain [data-ds="again"]')].filter((b) => b.getBoundingClientRect().height < 44 || b.getBoundingClientRect().width < 44).map((b) => b.dataset.ds), bg: getComputedStyle(document.querySelector('[data-issue-bar]')).backgroundColor }));
|
|
167
168
|
ok(`F1 ${w} px ${theme}: no sideways scroll and the bar's buttons are at least 44 px`, !f.wide && !f.small.length, JSON.stringify(f));
|
|
168
169
|
await S.page.screenshot({ path: path.join(R.base, `bar-${w}-${theme}.png`) });
|
|
169
170
|
await S.ctx.close();
|