create-pmos 0.290.0 → 0.292.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.290.0",
3
+ "version": "0.292.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": {
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@6598172
1
+ kernel-source: pmos@55dde98
2
2
  assembled: 2026-10-19
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-10-19T03:40:41Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T04:07:27Z"}
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-19T03:40:41Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T04:07:27Z"}
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-19T03:40:41Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T04:07:27Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -139,7 +139,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
139
139
  ok('M8 Undo posts Reopen for that item', await until(() => A.posts.some((x) => x.path === '/api/pm-items/reopen' && x.body.id === 'item-bbbbbbbbbbb2')));
140
140
  await openKey('work:item-aaaaaaaaaaa1');
141
141
  const dlg = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, btn: [...document.querySelectorAll('#card button')].map((b) => b.textContent.trim()), mod: document.querySelector('#dlg').getAttribute('aria-modal'), ask: !!document.querySelector('#askGo'), wDis: document.querySelector('#wBtn').disabled }));
142
- ok('M8 a dialog offers the agent, Done, Not yet, Move to, the tool row, Waiting and Drop, and the agent box; Keep only where the review list holds the item', dlg.title === 'Decide how partial refunds are handled' && dlg.btn.join() === 'Let the agent draft this,Done,Later today,Tomorrow,Next week,Do today,Edit,Who does each step,Not before…,Someday,Wait for them,Drop it' && dlg.mod === 'true' && dlg.ask && dlg.wDis, JSON.stringify(dlg));
142
+ ok('M8 a dialog offers the agent, Done, Not yet, Move to, the tool row, Waiting and Drop, and the agent box; Keep only where the review list holds the item', dlg.title === 'Decide how partial refunds are handled' && dlg.btn.slice(3).join() === 'Let the agent draft this,Done,Later today,Tomorrow,Next week,Do today,Edit,Who does each step,Not before…,Someday,Wait for them,Drop it' && dlg.mod === 'true' && dlg.ask && dlg.wDis, JSON.stringify(dlg));
143
143
  await p.locator('#card [data-p="notyet"][data-when="tomorrow"]').click();
144
144
  ok('M8 Not yet posts the item and the day, and closes the dialog', await until(() => A.posts.some((x) => x.path === '/api/pm-items/notyet' && x.body.id === 'item-aaaaaaaaaaa1' && x.body.when === 'tomorrow' && Object.keys(x.body).sort().join() === 'id,when')) && await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on'))));
145
145
  for (const [sel, route, check] of [['[data-p="flag"]', '/api/pm-items/flag', (b) => b.flagged === true], ['[data-p="xt"][data-k="someday"]', '/api/pm-items/someday', (b) => Object.keys(b).join() === 'id'], ['[data-p="done"]', '/api/pm-items/done', (b) => Object.keys(b).join() === 'id'], ['[data-p="remove"]', '/api/pm-items/remove', (b) => Object.keys(b).join() === 'id']]) {
@@ -117,12 +117,13 @@ Not built in premium: translation, Present and the slides stage, Ask PMOS quietl
117
117
 
118
118
  ## Around you
119
119
 
120
- Under Today, the **Around you** card holds what the agents and the outside world have left for you. It has five rows. A row opens a dialog and states what it found in one line. The caption says how many rows wait on you, or "quiet". If a source cannot be read, its row says so and gives the reason. It never reads as empty.
120
+ Under Today, the **Around you** card holds what the agents and the outside world have left for you. It has six rows. A row opens a dialog and states what it found in one line. The caption says how many rows wait on you, or "quiet". If a source cannot be read, its row says so and gives the reason. It never reads as empty.
121
121
 
122
122
  - **Agent proposals.** Every open draft of the Initiative Driver, for initiatives and for Work items, when the agent mode for that kind is Approve. **Keep** records that you accept it and applies it (a problem statement, a stage move, a next step). **Send back** needs a note and starts a new run. **Drop** counts as a correction. None of the three can be undone. A decided proposal stays in the list and says what was recorded.
123
123
  - **Mentions.** The people who named you in Slack, Jira, Confluence or mail, from today's morning brief. The row names who waits on a reply. **Make it a task** adds one Work item. **Mark read** hides the mention, and **Mark unread** brings it back. **Open in Slack** (or Jira, Confluence, mail) opens the original in a new tab. Nothing here replies, reacts or posts. The Mentions dialog has no question box, because a mention has no agent thread.
124
124
  - **Portfolio pulse.** How many initiatives are late or at risk, by the Calendar's own status: the promised date against the forecast, or the Jira read. It is read only and it is not a forecast of its own. **Open the initiative** goes to its page.
125
125
  - **Horizon scan.** When the scan last ran, when it runs next, its reports and their proposals. Each proposal says what **Approve** does before you press it. **Dismiss** asks for a reason and counts as a correction, and **Undo** takes a dismissal back. **Scan now** starts an agent that reads the public web and the repository, and says how many manual scans are left. A scan that is switched off says so and the button stays off.
126
+ - **Report found.** What the report finder found in your calendar, Slack and the subjects of mail you sent: each finding with its name, why, its evidence lines and how sure it is (Likely or Not sure). **Set up** creates the recurring report and drafts its first cycle on this machine. **Not a report** tells the finder not to raise it again. PMOS drafts only and nothing is sent. **Change first** and the finder settings stay in Insights and the console. A finder that is off says so.
126
127
  - **Data freshness.** When each source was last read and its schedule. **Refresh** reads one source again. **Refresh all** reads every source except the repository. A source outside the machine is read by a skill, in an agent session, with your own connection. The page never says "up to date".
127
128
 
128
129
  With one product picked, the dialogs show its data. With several, each product's part has its own heading, and the counts are not added across products. The agent mode, the scan's watch list and setting and the report documents stay in the console.
@@ -188,7 +189,11 @@ My work is the second place on the rail, at `/premium-work.html`. It reads the l
188
189
 
189
190
  **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
 
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
+ **Weekly review.** A card lists five steps: sort the inbox, place your tray, check who owes you, review agent drafts, and look at what sat untouched. Each step shows a count from your list and opens its first item. **Start the review** opens the first step that has something. On a Friday the card reads Friday review. PMOS keeps no review schedule and no timing, so the card shows none. The tray's shelf of agent answers, ideas and reports is not built, because PMOS holds no records for it.
193
+
194
+ **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. **View round** opens the text of that round.
195
+
196
+ **An agent's offer.** When an agent has offered to draft an item, the dialog shows three choices: let the agent draft it (suggested), do it today, or not before next Monday. You pick one and press its button. A row with steps says how many it has and how many an agent can do. PMOS does not record that a step is done, so it shows no "done" count.
192
197
 
193
198
  - **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.
194
199
  - **One count.** "To clear" is the inbox, plus today, plus agent drafts to review. The hero, the card and the dock use it.
@@ -59,7 +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
+ 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), body: t.body ? String(t.body).slice(0, 4000) : '' })),
63
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,
64
64
  };
65
65
  }
@@ -109,9 +109,24 @@ function weekOf({ today, items, events }) {
109
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
110
  }
111
111
 
112
+ /** The weekly review: a count and a first item for each place the PM sorts things. Every figure is a count of the list. No step time is made: PMOS does not time a review. */
113
+ function fridayOf({ today, work, tray, ready, review }) {
114
+ const first = (a) => (a[0] ? 'work:' + (a[0].it ? a[0].it.id : a[0].id) : null);
115
+ const steps = [
116
+ { key: 'inbox', label: 'Sort the inbox', n: (work.inbox || []).length, first: first(work.inbox || []) },
117
+ { key: 'tray', label: 'Place your tray', n: tray.length, first: first(tray) },
118
+ { key: 'waiting', label: 'Check who owes you', n: (work.waiting || []).length, first: first(work.waiting || []) },
119
+ { key: 'drafts', label: 'Review agent drafts', n: ready.length, first: first(ready) },
120
+ { key: 'stale', label: 'Look at what sat untouched', n: review.length, first: first(review) },
121
+ ];
122
+ const fri = isoDay(today).getDay() === 5;
123
+ return { title: fri ? 'Friday review' : 'Weekly review', cap: steps.filter((x) => x.n).length + ' of ' + steps.length + ' have something', steps, start: (steps.find((x) => x.n) || {}).key || null,
124
+ note: 'One step for each place a thing waits for you. A step opens its first item. PMOS keeps no review schedule or timing, so none is shown.' };
125
+ }
126
+
112
127
  function rowOf(it, list, v, inReview, focusIds) {
113
128
  const today = v.today, { chip, overdue } = dueChip(it, today);
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(' · ');
129
+ const sub = [srcLabel(it) + (it.key && it.source !== 'local' ? ' ' + it.key : ''), it.priority, it.waiting_on ? 'waiting on ' + it.waiting_on : null, (it.steps || []).length ? (it.steps || []).length + ' ' + plural((it.steps || []).length, 'step', 'steps') + ((it.steps || []).some((x) => x.who === 'agent-does' || x.who === 'agent-drafts') ? ' · agent can do ' + (it.steps || []).filter((x) => x.who !== 'you').length : '') : null].filter(Boolean).join(' · ');
115
130
  const days = it.waiting_since ? daysBetween(String(it.waiting_since).slice(0, 10), today) : null;
116
131
  const facts = [
117
132
  ['From', srcLabel(it)], ['Place', list === 'upcoming' ? 'Upcoming' : list.charAt(0).toUpperCase() + list.slice(1)], ['Due', it.due ? shortDate(it.due) + (overdue ? ' (overdue)' : '') : ''],
@@ -210,6 +225,7 @@ function build({ v, now, events }) {
210
225
  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 },
211
226
  review: { n: (v.review || []).length, days: v.review_days, ids: (v.review || []).map((i) => i.id) },
212
227
  dock: { needs: clear, label: 'to clear', next: firstToday ? firstToday.title : (sections[0].rows[0] ? sections[0].rows[0].title : null) },
228
+ friday: fridayOf({ today, work, tray, ready, review: v.review || [] }),
213
229
  week: weekOf({ today, items: v.items || all.map((x) => x.it), events }),
214
230
  focus, jobs,
215
231
  rows: rowsAll,
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.290.0",
3
+ "version": "0.292.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.290.0",
9
+ "version": "0.292.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.290.0",
3
+ "version": "0.292.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -5,7 +5,7 @@
5
5
  * ever runs), with a driver ledger, a scan ledger and a brief of today that this suite seeds with the writers the product uses. The real page
6
6
  * presses the real routes. Only two presses are answered in the browser, because they start an agent: scan/now and sources/refresh. The
7
7
  * Calendar's rows are answered in the browser too, because they need plan dates and a clock.
8
- * R rows · A agent proposals · M mentions · P portfolio pulse · S horizon scan · F data freshness · E a source that fails · W the POST allow-list · L floors
8
+ * R rows · A agent proposals · M mentions · P portfolio pulse · S horizon scan · G report found · F data freshness · E a source that fails · W the POST allow-list · L floors
9
9
  * Set BRIEFING_DEPTH_SHOTS=<dir> to save screenshots of the card and its dialogs, at 1280 and 390 wide, light and dark. */
10
10
  const fs = require('fs');
11
11
  const path = require('path');
@@ -81,6 +81,12 @@ const GANTT = [
81
81
  const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
82
82
  let ganttFail = false;
83
83
  await p.route('**/api/calendar-views*', (r) => (ganttFail ? json(r, { ok: false, error: 'the Calendar could not be read' }, 500) : json(r, { ok: true, view: 'quarter', gantt: GANTT, no_plan: 2, strategy: [], today: day(0) })));
84
+ let repReply = null, repFail = false; // null: the real server answers GET /api/report-setups; the presses of G are always answered here
85
+ await p.route('**/api/report-setups**', (r) => {
86
+ const u = new URL(r.request().url());
87
+ if (r.request().method() === 'GET') return repReply ? json(r, repReply) : r.continue();
88
+ return repFail ? json(r, { ok: false, error: 'that finding is no longer open' }, 409) : json(r, u.pathname.endsWith('/setup') ? { ok: true, setup: { id: 'weekly-status', name: 'Weekly status' } } : { ok: true });
89
+ });
84
90
  await p.route('**/api/scan/now', (r) => json(r, { ok: true, scan: 'scan-00000000ff' }));
85
91
  await p.route('**/api/sources/refresh', (r) => json(r, { ok: true, started: 'session' }));
86
92
  await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(ws)}`);
@@ -96,7 +102,7 @@ const GANTT = [
96
102
 
97
103
  /* R: the card */
98
104
  const R0 = await rows();
99
- ok('R1 the card has five rows in the PRD order', Object.keys(R0).join() === 'prop,men,pulse,scan,src', Object.keys(R0).join());
105
+ ok('R1 the card has six rows in the PRD order', Object.keys(R0).join() === 'prop,men,pulse,scan,rep,src', Object.keys(R0).join());
100
106
  ok('R2 agent proposals counts the three open proposals', /^3 agent proposals wait on you/.test(R0.prop.t) && R0.prop.m === '3', JSON.stringify(R0.prop));
101
107
  ok('R3 mentions names who waits, from the brief, and leaves out nothing it was not told', R0.men.t === 'Dana in Slack and Priya in Jira are waiting on your reply. 1 more is for your information.' && R0.men.m === 'Reply', JSON.stringify(R0.men));
102
108
  ok('R4 the pulse counts what the Calendar said', R0.pulse.t === 'Portfolio pulse: 1 late, 1 at risk' && /1 on plan · 3 with no plan date/.test(R0.pulse.s), JSON.stringify(R0.pulse));
@@ -253,14 +259,57 @@ const GANTT = [
253
259
  await close();
254
260
  ganttFail = false;
255
261
 
262
+ /* G: Report found, against a stubbed finder (the finder itself runs an agent, which this suite never starts) */
263
+ const FIND = [
264
+ { id: 'f-weekly', name: 'Weekly status', why: 'You sent a status email every Friday for six weeks.', confidence: 'likely', evidence: [{ kind: 'mail', text: 'Weekly status, 6 times' }, { kind: 'calendar', text: 'Friday review' }], proposal: {} },
265
+ { id: 'f-qbr', name: 'Quarterly review', why: 'You presented the same deck twice.', confidence: 'not-sure', evidence: [{ kind: 'slack', text: '#leads' }], proposal: {} },
266
+ ];
267
+ repReply = { ok: true, ws, setups: [], asks: [], findings: FIND, finder: { cadence: 'daily', sources: {}, last_run: null, next_run: null } };
268
+ await p.reload();
269
+ await until(() => p.evaluate(() => document.querySelector('#aroundCap') && !/Reading…/.test(document.querySelector('#aroundBody').textContent)), 30000);
270
+ const RG = await rows();
271
+ ok('G1 two findings make the row say so, with the count', /^2 reports found in your work/.test(RG.rep.t) && RG.rep.m === '2', JSON.stringify(RG.rep));
272
+ await open('rep');
273
+ const gb = await body();
274
+ ok('G2 the dialog shows each finding with its why, its evidence and its confidence word', /Weekly status/.test(gb) && /every Friday for six weeks/.test(gb) && /Mail: Weekly status, 6 times/.test(gb) && /Calendar: Friday review/.test(gb) && /Likely/.test(gb) && /Not sure/.test(gb), gb);
275
+ ok('G3 the buttons say what they record before they are pressed', /PMOS drafts only\. Nothing is sent\./.test(gb) && /will not raise it again/.test(gb) && !/Change first/.test(await p.evaluate(() => [...document.querySelectorAll('#oMain .bd-a button')].map((b) => b.textContent).join('|'))), gb);
276
+ const g0 = posts.length;
277
+ await click('#oMain [data-id="f-weekly"] [data-bda="rset"]');
278
+ await until(() => posts.some((x) => x.path === '/api/report-setups/setup'));
279
+ const ps = posts.slice(g0).find((x) => x.path === '/api/report-setups/setup');
280
+ ok('G4 Set up posts the finding and the product, nothing more', ps && JSON.stringify(Object.keys(ps.body).sort()) === JSON.stringify(['finding', 'ws']) && ps.body.finding === 'f-weekly', JSON.stringify(ps));
281
+ ok('G5 after Set up the dialog names the report that was set up and that nothing was sent', await until(async () => /Set up as Weekly status\..*Nothing was sent/.test(await body())), await body());
282
+ await click('#oMain [data-id="f-qbr"] [data-bda="rno"]');
283
+ await until(() => posts.some((x) => x.path === '/api/report-setups/dismiss'));
284
+ const pd = posts.find((x) => x.path === '/api/report-setups/dismiss');
285
+ ok('G6 Not a report posts the finding, its name and the product', pd && pd.body.finding === 'f-qbr' && pd.body.name === 'Quarterly review' && pd.body.ws === ws && Object.keys(pd.body).length === 3, JSON.stringify(pd));
286
+ await close();
287
+ repReply = { ok: true, ws, setups: [], asks: [], findings: [FIND[1]], finder: { cadence: 'daily', sources: {}, last_run: null, next_run: null } };
288
+ repFail = true;
289
+ await p.reload();
290
+ await until(() => p.evaluate(() => document.querySelector('#aroundCap') && !/Reading…/.test(document.querySelector('#aroundBody').textContent)), 30000);
291
+ const R1f = await rows();
292
+ ok('G7 one finding is named in the row', /^Report found: Quarterly review/.test(R1f.rep.t), JSON.stringify(R1f.rep));
293
+ await open('rep');
294
+ await click('#oMain [data-bda="rset"]');
295
+ ok('G8 a refused press shows the reason and keeps the finding', await until(async () => /no longer open/.test(await body()) && await p.evaluate(() => !!document.querySelector('#oMain .nodef.err') && !!document.querySelector('#oMain [data-bda="rset"]'))), await body());
296
+ await close();
297
+ repFail = false;
298
+ repReply = { ok: true, ws, setups: [], asks: [], findings: [], finder: { cadence: 'off', sources: {}, last_run: null, next_run: null } };
299
+ await p.reload();
300
+ await until(() => p.evaluate(() => document.querySelector('#aroundCap') && !/Reading…/.test(document.querySelector('#aroundBody').textContent)), 30000);
301
+ const R0f = await rows();
302
+ ok('G9 with none found and the finder off, the row says so and does not count as waiting', /finder is off/.test(R0f.rep.t) && R0f.rep.m === '', JSON.stringify(R0f.rep));
303
+ repReply = null;
304
+
256
305
  /* W: the POST allow-list */
257
- const allowed = new Set(['/api/mentions/read', '/api/pm-items/add', '/api/driver/keep', '/api/driver/return', '/api/driver/drop', '/api/scan/proposal', '/api/scan/now', '/api/scan/stop', '/api/sources/refresh']);
306
+ const allowed = new Set(['/api/mentions/read', '/api/pm-items/add', '/api/driver/keep', '/api/driver/return', '/api/driver/drop', '/api/scan/proposal', '/api/scan/now', '/api/scan/stop', '/api/sources/refresh', '/api/report-setups/setup', '/api/report-setups/dismiss']);
258
307
  const strays = posts.filter((x) => !allowed.has(x.path));
259
308
  ok('W1 every POST is one of the existing routes in the PRD', posts.length > 0 && strays.length === 0, JSON.stringify(strays));
260
- const fields = { '/api/driver/keep': ['ws', 'proposal'], '/api/driver/return': ['ws', 'proposal', 'note'], '/api/driver/drop': ['ws', 'proposal'], '/api/mentions/read': ['id', 'read'], '/api/pm-items/add': ['line'], '/api/scan/proposal': ['ws', 'id', 'action', 'why'], '/api/scan/now': ['ws'], '/api/sources/refresh': ['ws', 'source'] };
309
+ const fields = { '/api/driver/keep': ['ws', 'proposal'], '/api/driver/return': ['ws', 'proposal', 'note'], '/api/driver/drop': ['ws', 'proposal'], '/api/mentions/read': ['id', 'read'], '/api/pm-items/add': ['line'], '/api/scan/proposal': ['ws', 'id', 'action', 'why'], '/api/scan/now': ['ws'], '/api/sources/refresh': ['ws', 'source'], '/api/report-setups/setup': ['ws', 'finding'], '/api/report-setups/dismiss': ['ws', 'finding', 'name'] };
261
310
  const extra = posts.filter((x) => fields[x.path] && Object.keys(x.body || {}).some((k) => !fields[x.path].includes(k)));
262
311
  ok('W2 no POST carries a field the route was not told', extra.length === 0, JSON.stringify(extra));
263
- ok('W3 every GET the card made is a console route in the PRD', gets.filter((g) => !['/api/briefing-premium', '/api/brief-page', '/api/driver/open', '/api/calendar-views', '/api/scan/portfolio', '/api/sources', '/api/pm-items', '/api/workspaces', '/api/products', '/api/state'].includes(g) && /around|depth|bd-/.test(g)).length === 0);
312
+ ok('W3 every GET the card made is a console route in the PRD', gets.filter((g) => !['/api/briefing-premium', '/api/brief-page', '/api/driver/open', '/api/calendar-views', '/api/scan/portfolio', '/api/report-setups', '/api/sources', '/api/pm-items', '/api/workspaces', '/api/products', '/api/state'].includes(g) && /around|depth|bd-/.test(g)).length === 0);
264
313
 
265
314
  /* L: floors */
266
315
  await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(ws)}`);
@@ -173,7 +173,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
173
173
  /* W7 the agent */
174
174
  await openKey(p, 'work:item-aaaaaaaaaaa1');
175
175
  const ag1 = await p.evaluate(() => ({ state: document.querySelector('.agblk').dataset.state, ask: document.querySelector('#agAsk').value, say: document.querySelector('.agblk .nodef').textContent, btn: [...document.querySelectorAll('.agblk button')].map((b) => b.textContent.trim()) }));
176
- ok('W7 a suggestion shows what the agent will do, where nothing goes, and one press', ag1.state === 'suggest' && ag1.ask === 'Draft your reply: partial refunds' && /Nothing goes to Jira until you post it/.test(ag1.say) && ag1.btn.join() === 'Let the agent draft this', JSON.stringify(ag1));
176
+ ok('W7 a suggestion shows what the agent will do, where nothing goes, the three choices and the press of the picked one', ag1.state === 'suggest' && ag1.ask === 'Draft your reply: partial refunds' && /Nothing goes to Jira until you post it/.test(ag1.say) && ag1.btn.length === 4 && /^SuggestedLet the agent draft this/.test(ag1.btn[0]) && /^Do it today/.test(ag1.btn[1]) && /^Not before /.test(ag1.btn[2]) && ag1.btn[3] === 'Let the agent draft this', JSON.stringify(ag1));
177
177
  await p.fill('#agAsk', 'Draft your reply: partial refunds, short');
178
178
  await p.click('[data-p="ag-brief"]');
179
179
  ok('W7 Let the agent draft this posts act brief with the item, the PM\'s words and the workspace', await wait(() => A.last().path === '/api/my-work/act' && A.last().body.action === 'brief' && A.last().body.item === 'item-aaaaaaaaaaa1' && A.last().body.instruction === 'Draft your reply: partial refunds, short' && 'ws' in A.last().body && Object.keys(A.last().body).sort().join() === 'action,instruction,item,ws'), JSON.stringify(A.last()));
@@ -18,7 +18,7 @@ const GLYPH = {
18
18
  };
19
19
  const mdHtml = (t) => { try { const d = document.createElement('div'); d.append(...mdRender(String(t)).blocks.map((b) => b.node || b)); return d.innerHTML; } catch { return '<p class="tt">' + esc(t) + '</p>'; } }; // mdRender builds nodes, never a string, so nothing in a draft runs
20
20
  const KIND = { ask: 'You asked', draft: 'Agent drafted', edit: 'You edited it', note: 'You sent it back', sent: 'Posted', post: 'Posted' };
21
- const turnsHtml = (a) => (a.turns && a.turns.length ? `<h3 class="h2">Conversation with the agent</h3><ol class="agturns">${a.turns.map((t) => `<li class="${t.who}"><b>${esc(t.who === 'agent' ? 'Agent' : 'You')}</b> ${esc(KIND[t.kind] || t.kind || 'said')}${t.at ? ' · ' + esc(String(t.at).slice(0, 10)) : ''}${t.text ? `<span>${esc(t.text)}</span>` : ''}</li>`).join('')}</ol>` : '');
21
+ const turnsHtml = (a) => (a.turns && a.turns.length ? `<h3 class="h2">Conversation with the agent</h3><ol class="agturns">${a.turns.map((t, i) => `<li class="${t.who}"><b>${esc(t.who === 'agent' ? 'Agent' : 'You')}</b> ${esc(KIND[t.kind] || t.kind || 'said')}${t.at ? ' · ' + esc(String(t.at).slice(0, 10)) : ''}${t.text ? `<span>${esc(t.text)}</span>` : ''}${t.body ? `<button class="xtb" data-p="round" data-i="${i}" aria-expanded="${ui.round === i}">${t.who === 'agent' ? 'View round' : 'View your edit'}</button>${ui.round === i ? `<div class="mdr">${mdHtml(t.body)}</div>` : ''}` : ''}</li>`).join('')}</ol>` : '');
22
22
  const glyph = (src) => GLYPH[src] || '<circle cx="12" cy="12" r="4"/>';
23
23
  wireRail('work');
24
24
  const WS = new URLSearchParams(location.search).get('ws') || '';
@@ -95,6 +95,17 @@ function drawReview() {
95
95
  $('#revCap').textContent = R.n + ' ' + (R.n === 1 ? 'item' : 'items');
96
96
  $('#revTxt').innerHTML = `<b>${R.n}</b> ${R.n === 1 ? 'item has' : 'items have'} sat untouched for ${R.days} days. Open one to keep it or let it go.`;
97
97
  }
98
+ function drawFriday() {
99
+ const F = M.friday; if (!F) return;
100
+ $('#hFr').textContent = F.title; $('#frCap').textContent = F.cap;
101
+ $('#frBody').innerHTML = `<ol class="frl">${F.steps.map((s, i) => `<li><button type="button" class="frs" data-fr="${s.key}"${s.n ? '' : ' disabled'}><i>${i + 1}</i><span>${esc(s.label)}</span><b>${s.n}</b></button></li>`).join('')}</ol>`
102
+ + `<div class="cact two"><button type="button" class="cta" data-fr="${F.start || ''}"${F.start ? '' : ' disabled'}><span>${F.start ? 'Start the review' : 'Nothing to review'}</span></button></div><p class="note" style="margin-top:12px">${esc(F.note)}</p>`;
103
+ }
104
+ $('#frBody').addEventListener('click', (e) => {
105
+ const b = e.target.closest('[data-fr]'); if (!b || !b.dataset.fr || !M || !M.friday) return;
106
+ const st = M.friday.steps.find((x) => x.key === b.dataset.fr); const r = st && st.first ? rowOf(st.first) : null;
107
+ if (r) openRow(r); else toast('Nothing to open here.');
108
+ });
98
109
  function drawWeek() {
99
110
  const W = M.week; if (!W) return;
100
111
  $('#weekCap').textContent = W.cap;
@@ -105,7 +116,7 @@ function drawWeek() {
105
116
  return `<div class="wkc${d.today ? ' now' : ''}${d.past ? ' past' : ''}" role="listitem" aria-label="${esc(d.dow + ' ' + d.n + ': ' + (W.calendar ? (d.meet_min ? hrs + ' of meetings, ' : 'no meetings, ') : '') + d.done + ' done, ' + d.due + ' due')}"><span class="wkl">${d.dow}</span><b>${d.n}</b><span class="wkb">${h ? `<i style="height:${h}%"></i>` : ''}</span><span class="wkt">${W.calendar ? (hrs || 'free') : '·'}</span><span class="wkn">${d.done} done${d.due ? ' · ' + d.due + ' due' : ''}</span></div>`;
106
117
  }).join('')}</div><p class="note" style="margin-top:12px">${esc(W.note)}</p>`;
107
118
  }
108
- function draw() { drawHero(); drawWeek(); drawFocus(); drawPlate(); drawTray(); drawAgents(); drawWaiting(); drawReview(); drawDock(); onScroll(); backFocus(); }
119
+ function draw() { drawHero(); drawWeek(); drawFriday(); drawFocus(); drawPlate(); drawTray(); drawAgents(); drawWaiting(); drawReview(); drawDock(); onScroll(); backFocus(); }
109
120
  const rowOf = (key) => (M && M.rows || []).find((r) => r.key === key) || null;
110
121
 
111
122
  /* ── the dialog: detail first, the presses of the Work page, the tool row, the agent, the read-only agent beside it ─────────────────── */
@@ -114,10 +125,21 @@ const WHO = [['you', 'You'], ['agent-drafts', 'Agent drafts'], ['agent-does', 'A
114
125
  const PRIS = ['P1', 'P2', 'P3', ''];
115
126
  let dlgKind = null; // 'item' | 'fjobs': what the open dialog shows
116
127
  let ui = {}; // what is typed or opened in the item dialog; kept across a redraw
117
- const freshUi = () => ({ xp: null, ed: null, dd: '', sn: '', ask: null, body: null, editing: false, confirm: false, back: false, note: '', wo: '' });
128
+ const freshUi = () => ({ xp: null, ed: null, dd: '', sn: '', ask: null, body: null, editing: false, confirm: false, back: false, note: '', wo: '', pick: null, round: null });
118
129
  const dlgOpen = () => $('#dlg').classList.contains('on');
119
130
  const paras = (t) => String(t || '').split(/\n{2,}/).filter((x) => x.trim()).map((x) => `<p>${esc(x.trim()).replace(/\n/g, '<br>')}</p>`).join('');
120
131
 
132
+ /* the choice the console offers on an agent offer: the agent draft (suggested), Do it today, Not before next Monday. Each runs a route that already exists. */
133
+ function choicesHtml(r, a) {
134
+ const nm = nextMonday(M.today), pick = ui.pick || 'agent';
135
+ const opts = [['agent', 'Suggested', 'Let the agent draft this', a.mine ? 'Drafts it here in PMOS. Nothing leaves PMOS.' : `Drafts it here in PMOS. Nothing goes to ${esc(a.where || 'anyone')}.`]];
136
+ if (r.list !== 'today') opts.push(['today', '', 'Do it today', 'Moves to Today']);
137
+ opts.push(['nb', '', 'Not before ' + dayLabel(nm), 'Out of Today until then']);
138
+ const go = pick === 'agent' ? ['ag-brief', 'Let the agent draft this'] : pick === 'today' ? ['ag-today', 'Do it today'] : ['ag-nb', 'Not before ' + dayLabel(nm)];
139
+ return `<div class="xch" role="radiogroup" aria-label="What to do with this">${opts.map((o) => `<button class="xco" role="radio" data-p="pick" data-v="${o[0]}" aria-checked="${pick === o[0]}">${o[1] ? `<em>${o[1]}</em>` : ''}<b>${esc(o[2])}</b><span>${o[3]}</span></button>`).join('')}</div>`
140
+ + `<div class="cact two"><button class="cta" data-p="${go[0]}"><span>${esc(go[1])}</span></button></div>`;
141
+ }
142
+
121
143
  /* the agent block: one state, the controls that state allows, and nothing is posted before the confirm */
122
144
  function agentHtml(r) {
123
145
  const a = r.dialog.agent;
@@ -128,7 +150,7 @@ function agentHtml(r) {
128
150
  if (a.state === 'suggest') {
129
151
  h = `<p class="nodef">${a.mine ? 'The agent can draft a first version of this for you. You read it here. Nothing leaves PMOS.' : `The agent can draft this for you. You read it here first. Nothing goes to ${esc(w)} until you post it.`}</p>`
130
152
  + `<label class="whyl" for="agAsk">What the agent will do</label><input id="agAsk" maxlength="500" autocomplete="off" value="${esc(ui.ask == null ? a.ask : ui.ask)}">`
131
- + `<div class="cact two"><button class="cta" data-p="ag-brief"><span>Let the agent draft this</span></button></div>`;
153
+ + choicesHtml(r, a);
132
154
  } else if (a.state === 'queued' || a.state === 'working' || a.state === 'sending') {
133
155
  const line = a.state === 'queued' ? 'Queued. The agent starts as soon as a session is free. You can close this page.'
134
156
  : a.state === 'sending' ? `Posting to ${esc(w)}. A session does exactly the step you approved and nothing else.`
@@ -304,6 +326,10 @@ function dlgClick(b, r) {
304
326
  case 'remove': return commit({ send: () => post('/api/pm-items/remove', { id }), say: SAID.remove, undo: () => post('/api/pm-items/undo', { id }) });
305
327
  case 'flag': return todayP(r);
306
328
  case 'keep': return commit({ send: () => post('/api/pm-items/keep', { id }), say: SAID.keep });
329
+ case 'pick': ui.pick = b.dataset.v; return paint(`[data-p="pick"][data-v="${b.dataset.v}"]`);
330
+ case 'ag-today': return todayP(r);
331
+ case 'ag-nb': return deferP(r, nextMonday(M.today));
332
+ case 'round': ui.round = ui.round === +b.dataset.i ? null : +b.dataset.i; return paint(`[data-p="round"][data-i="${b.dataset.i}"]`);
307
333
  case 'xt': {
308
334
  const t = b.dataset.k;
309
335
  if (t === 'someday') return somedayP(r);
@@ -1862,6 +1862,9 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
1862
1862
  .mtg .tp small{color:var(--ink-3);font-size:12.5px}
1863
1863
  .mtg .mtg-link{margin:8px 0 6px}
1864
1864
 
1865
+ .xch{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px;margin-top:10px}
1866
+ .xco{display:flex;flex-direction:column;gap:3px;align-items:flex-start;text-align:left;min-height:44px;padding:11px 13px;border-radius:16px;border:1.5px solid var(--hair);font-size:13px;color:var(--ink-3)}
1867
+ .xco[aria-checked="true"]{border-color:var(--ink);box-shadow:0 0 0 1px var(--ink)}.xco b{color:var(--ink);font-size:14px}.xco em{font:500 11px var(--mono);font-style:normal;letter-spacing:.04em;color:var(--ember-ink)}
1865
1868
  /* the document sheet as the mockup and the console reader draw it: one status line, the file's path and front matter behind a toggle, an outline with Find, a full-width body */
1866
1869
  .dsm2{display:flex;flex-wrap:wrap;gap:6px 8px;align-items:center;margin:0 0 12px}
1867
1870
  .dsm2 .chp{padding:4px 10px;font-size:12px;gap:6px;font-weight:600}
@@ -1893,3 +1896,6 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
1893
1896
  .dsbody .dsat i{width:18px;height:18px;border-radius:50%;background:var(--well);display:grid;place-items:center;font:600 10px var(--mono);font-style:normal;color:var(--ink-2)}
1894
1897
  .rdbar .rdsp{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap}
1895
1898
  .rdbar .dsvw:last-child .dsmn,.rdbar .rdsp .dsmn{left:auto;right:0}
1899
+
1900
+ .frl{list-style:none;margin:0 0 12px;padding:0}.frs{display:grid;grid-template-columns:30px minmax(0,1fr) auto;gap:10px;align-items:center;width:100%;min-height:44px;padding:6px 4px;text-align:left;border-top:1px solid var(--hair);font-size:14px}
1901
+ .frl li:first-child .frs{border-top:0}.frs i{font:600 12px var(--mono);font-style:normal;width:26px;height:26px;border-radius:50%;display:grid;place-items:center;background:var(--well);color:var(--ink-2)}.frs b{font-weight:650}.frs:disabled{opacity:.5}
@@ -277,7 +277,7 @@ $('#pickMenu').addEventListener('click', async (e) => {
277
277
  });
278
278
 
279
279
  /* ── Around you: what the agents and the outside world left for you (initiative premium-briefing-depth) ─────────────────────────────
280
- * One card under Today with five rows; each row opens the standard dialog. Every read is a route the console already uses and every
280
+ * One card under Today with six rows; each row opens the standard dialog. Every read is a route the console already uses and every
281
281
  * write is a press that says what it does first, through the launch nonce (pmPost). A source that cannot be read is named in its row,
282
282
  * never shown as empty. Which products: ?ws=<id> that one, otherwise every product the Briefing reads. */
283
283
  const SRCN = { slack: 'Slack', jira: 'Jira', confluence: 'Confluence', mail: 'Mail' };
@@ -289,12 +289,13 @@ const BDI = {
289
289
  prop: '<path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/>',
290
290
  pulse: '<path d="M3 12h4l3-7 4 14 3-7h4"/>',
291
291
  scan: '<circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/>',
292
+ rep: '<path d="M7 3h8l4 4v14H7z"/><path d="M14 3v5h5M10 13h6M10 17h6"/>',
292
293
  src: '<path d="M20 11a8 8 0 0 0-14.6-4.5M4 13a8 8 0 0 0 14.6 4.5"/><path d="M5 3v4h4M19 21v-4h-4"/>',
293
294
  ret: '<path d="M9 14 4 9l5-5"/><path d="M4 9h10a6 6 0 0 1 0 12h-3"/>',
294
295
  x: '<path d="M6 6l12 12M18 6 6 18"/>',
295
296
  };
296
297
  const bdIco = (d) => `<svg class="i" viewBox="0 0 24 24">${d}</svg>`;
297
- const A = { prop: null, men: null, pulse: null, scan: null, src: null }; // the last answer of each source: { ok, … } or { ok: false, error }
298
+ const A = { prop: null, men: null, pulse: null, scan: null, rep: null, src: null }; // the last answer of each source: { ok, … } or { ok: false, error }
298
299
  const DEC = new Map(); // proposals decided on this visit: id → { item, st: 'kept' | 'back' | 'dropped', note, wrote, warnings }
299
300
  const PNOTE = {}, PERR = {}, PBACK = new Set(); // the send-back note typed, the refusal shown, the proposals whose note box is open
300
301
  const MREAD = new Map(), MADD = new Set(); // mentions marked read or unread on this visit; mentions made a task
@@ -370,10 +371,22 @@ async function readScan(P) {
370
371
  if (!got.length && errs.length) return { ok: false, error: errs[0] };
371
372
  return { ok: true, scans: got, errs };
372
373
  }
374
+ /** The report finder's findings, one read per product. A product that cannot be read is named, never shown as empty. */
375
+ async function readReps(P) {
376
+ const got = [], errs = [];
377
+ await Promise.all(P.map(async (p, i) => {
378
+ const r = await getj('/api/report-setups' + (p.ws ? '?' + wq(p.ws) : ''));
379
+ if (!r.ok) errs.push((P.length > 1 && p.name ? p.name + ': ' : '') + r.error);
380
+ else got.push({ ws: r.ws || p.ws, pname: P.length > 1 ? p.name : '', at: i, finder: r.finder || null, findings: Array.isArray(r.findings) ? r.findings : [] });
381
+ }));
382
+ got.sort((a, b) => a.at - b.at);
383
+ if (!got.length && errs.length) return { ok: false, error: errs[0] };
384
+ return { ok: true, prods: got, errs };
385
+ }
373
386
  const readSrc = () => getj('/api/sources' + (wsParam() ? '?' + wq(wsParam()) : ''));
374
387
  const readAll = async (which) => {
375
388
  const P = prods(), all = !which, job = {
376
- prop: () => readProps(P), men: () => readMen(), pulse: () => readPulse(P), scan: () => readScan(P), src: () => readSrc(),
389
+ prop: () => readProps(P), men: () => readMen(), pulse: () => readPulse(P), scan: () => readScan(P), rep: () => readReps(P), src: () => readSrc(),
377
390
  };
378
391
  await Promise.all(Object.keys(job).filter((k) => all || which.includes(k)).map(async (k) => { try { A[k] = await job[k](); } catch (e) { A[k] = { ok: false, error: String((e && e.message) || e) }; } }));
379
392
  drawAround();
@@ -419,6 +432,9 @@ const dayWord = (iso) => {
419
432
  return d.toDateString() === n.toDateString() ? 'today, ' + hm : d.toDateString() === y.toDateString() ? 'yesterday, ' + hm : d.getDate() + ' ' + ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][d.getMonth()] + ', ' + hm;
420
433
  };
421
434
  const scanOpen = () => (A.scan && A.scan.ok ? A.scan.scans.reduce((n, s) => n + (s.proposals_waiting || 0), 0) : 0);
435
+ const REC = new Map(); // findings decided on this visit: id → { st: 'set' | 'no', f, setup }
436
+ const RERR = {};
437
+ const repFound = () => (A.rep && A.rep.ok ? A.rep.prods.flatMap((q) => q.findings.map((f) => ({ ...f, ws: q.ws, pname: q.pname }))) : []);
422
438
  const behindSrc = () => {
423
439
  if (!A.src || !A.src.ok) return [];
424
440
  const ids = behindOf(lineItems(A.src.sources)).map((i) => i.id);
@@ -426,7 +442,7 @@ const behindSrc = () => {
426
442
  };
427
443
  const joinN = (a) => (a.length < 2 ? a.join('') : a.slice(0, -1).join(', ') + ' and ' + a[a.length - 1]);
428
444
 
429
- /** The five rows of the card: { k, ic, t, s, m (count html), bar, wait }. Pure of the DOM; every word comes from A. */
445
+ /** The six rows of the card: { k, ic, t, s, m (count html), bar, wait }. Pure of the DOM; every word comes from A. */
430
446
  function aroundRows() {
431
447
  const R = [], rd = 'Reading…';
432
448
  { // agent proposals
@@ -455,6 +471,12 @@ function aroundRows() {
455
471
  t: !a ? rd : !a.ok ? 'Horizon scan ' + said(a) : run ? 'Horizon scan: scanning now' : w ? 'Horizon scan: ' + pl(w, 'proposal waits', 'proposals wait') + ' for you' : S.every((x) => x.switched_off) ? 'Horizon scan: switched off' : last ? 'Horizon scan: nothing waits' : 'Horizon scan: no scan has run yet',
456
472
  s: !a || !a.ok ? '' : run ? 'Reading the web and the repository' : last ? 'Ran ' + dayWord(last).toLowerCase() + (nrep ? ' · ' + pl(nrep, 'report', 'reports') : '') : 'Start one from here', m: w ? `<span class="due">${w}</span>` : '' });
457
473
  }
474
+ { // report found
475
+ const a = A.rep, L = repFound(), n = L.length, fd = a && a.ok ? a.prods.map((q) => q.finder).filter(Boolean) : [], off = fd.length > 0 && fd.every((x) => x.cadence === 'off'), nx = fd.map((x) => x.next_run).filter(Boolean).sort()[0];
476
+ R.push({ k: 'rep', ic: BDI.rep, wait: n > 0,
477
+ t: !a ? rd : !a.ok ? 'Report finder ' + said(a) : n === 1 ? 'Report found: ' + L[0].name : n ? pl(n, 'report', 'reports') + ' found in your work' : off ? 'The report finder is off' : 'No report found',
478
+ s: !a || !a.ok ? '' : n ? 'Set it up, or say it is not a report' : nx ? 'The finder looks next ' + dayWord(nx) : off ? 'Switch it on in the console' : 'It reads your calendar, Slack and the subjects of mail you sent', m: n ? `<span class="due">${n}</span>` : '' });
479
+ }
458
480
  { // data freshness
459
481
  const a = A.src, b = behindSrc();
460
482
  R.push({ k: 'src', ic: BDI.src, wait: b.length > 0,
@@ -658,6 +680,40 @@ const openScan = () => {
658
680
  scanPoll(redraw);
659
681
  };
660
682
 
683
+ /* ── report found ── */
684
+ const EVK = { mail: 'Mail', calendar: 'Calendar', slack: 'Slack', drive: 'Drive', confluence: 'Confluence' };
685
+ const CONF = { likely: 'Likely', 'not-sure': 'Not sure' };
686
+ function repItem(f) {
687
+ const d = REC.get(f.id), id = f.id;
688
+ const ev = (f.evidence || []).filter((e) => e && e.text).map((e) => bdChip((EVK[e.kind] || String(e.kind || 'Source')) + ': ' + e.text, 'mono')).join('');
689
+ const act = d ? (d.st === 'set' ? bdDone(true, 'Set up' + (d.setup ? ' as ' + d.setup : '') + '. Its first cycle is drafted on this machine. Nothing was sent.') : bdDone(true, 'Marked not a report. The finder will not raise it again.'))
690
+ : bdActs(bdBtn('Set up', 'rset', id, false, ` data-ws="${esc(f.ws)}"`), bdBtn('Not a report', 'rno', id, true, ` data-ws="${esc(f.ws)}"`)) + '<p class="bd-why">Set up creates the recurring report and drafts its first cycle on this machine. PMOS drafts only. Nothing is sent. Not a report: the finder will not raise it again.</p>' + bdFail(id, RERR);
691
+ return `<div class="bd-it${d ? ' decided' : ''}" data-id="${esc(id)}"><div class="bd-h">${f.confidence && CONF[f.confidence] ? bdChip(CONF[f.confidence]) : ''}${f.pname ? bdChip(f.pname, 'mono') : ''}</div><span class="bd-t">${esc(f.name)}</span>${f.why ? `<p class="bd-q">${esc(f.why)}</p>` : ''}${ev ? `<p class="bd-h">${ev}</p>` : ''}${act}</div>`;
692
+ }
693
+ function repHtml() {
694
+ const a = A.rep; if (!a.ok) return `<p class="nodef err" role="alert">Report finder ${esc(said(a))}</p>`;
695
+ const L = repFound().concat([...REC.values()].map((d) => d.f).filter((f) => !repFound().some((o) => o.id === f.id && o.ws === f.ws)));
696
+ return (L.length ? `<p class="bd-top">${repFound().length ? pl(repFound().length, 'report was', 'reports were') + ' found in your work.' : 'All decided.'} PMOS drafts only. Nothing is sent.</p><div class="bd-list">${L.map(repItem).join('')}</div>` : `<p class="empty3">${CHECK}No report found.</p>`)
697
+ + (a.errs.length ? `<p class="note">Not read: ${esc(a.errs[0])}</p>` : '') + '<p class="note">The finder reads your calendar, Slack and the subjects of mail you sent, never message bodies. Change first, the report finder settings and every other report press stay in Insights and the console.</p>';
698
+ }
699
+ async function repPress(e, redraw) {
700
+ const b = e.target.closest('[data-bda]'); if (!b || BUSY) return;
701
+ const act = b.dataset.bda, id = b.dataset.id, ws = b.dataset.ws || '', f = repFound().find((x) => x.id === id && x.ws === ws);
702
+ if (!f) return;
703
+ BUSY = id; b.disabled = true;
704
+ const r = act === 'rset' ? await pmPost('/api/report-setups/setup', { ws, finding: id }) : await pmPost('/api/report-setups/dismiss', { ws, finding: id, name: f.name });
705
+ BUSY = '';
706
+ if (!r || r.ok !== true) { RERR[id] = (r && r.error) || 'It did not go through.'; redraw(); toast(RERR[id]); return; }
707
+ delete RERR[id];
708
+ REC.set(id, { st: act === 'rset' ? 'set' : 'no', f, setup: act === 'rset' && r.setup ? r.setup.name || '' : '' });
709
+ toast(act === 'rset' ? 'Set up. Nothing is sent.' : 'Marked not a report.');
710
+ await readAll(['rep']); redraw(`.bd-it[data-id="${CSS.escape(id)}"] .bd-done`);
711
+ }
712
+ const openReport = () => {
713
+ const n = repFound().length;
714
+ bdDlg('rep', 'Report finder · real data', 'Report found', 'From your calendar, Slack and the subjects of mail you sent', A.rep && A.rep.ok ? (n ? pl(n, 'report was', 'reports were') + ' found in your work. Set it up, or say it is not a report. PMOS drafts only.' : 'No report waits for you.') : 'The findings could not be read.', repHtml, repPress);
715
+ };
716
+
661
717
  /* ── data freshness ── */
662
718
  const SSTATE = { fresh: 'Recent', stale: 'Old', never: 'Never read', building: 'Reading now…', failed: 'Failed', off: 'Off' };
663
719
  const SNOTE = {};
@@ -703,7 +759,7 @@ function mountAround() {
703
759
  t.insertAdjacentElement('afterend', s);
704
760
  s.addEventListener('click', (e) => {
705
761
  const b = e.target.closest('[data-bd]'); if (!b) return;
706
- ({ prop: openPropsDlg, men: openMen, pulse: openPulse, scan: openScan, src: openSrc })[b.dataset.bd]();
762
+ ({ prop: openPropsDlg, men: openMen, pulse: openPulse, scan: openScan, rep: openReport, src: openSrc })[b.dataset.bd]();
707
763
  });
708
764
  drawAround();
709
765
  }
@@ -72,6 +72,10 @@
72
72
  <div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg></span><h2 id="hWait">Waiting on others</h2><small id="waitCap"></small></div>
73
73
  <div id="waitBody"></div>
74
74
  </section>
75
+ <section class="card rise" style="--d:9" id="frCard" aria-labelledby="hFr">
76
+ <div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><rect x="4" y="5" width="16" height="15" rx="3"/><path d="m8.5 13 2.5 2.5 4.5-5"/></svg></span><h2 id="hFr">Weekly review</h2><small id="frCap"></small></div>
77
+ <div id="frBody"></div>
78
+ </section>
75
79
  <section class="card rise" style="--d:9" id="revCard" aria-labelledby="hRev" hidden>
76
80
  <div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><path d="M4 12a8 8 0 0 1 14-5.3M20 12a8 8 0 0 1-14 5.3"/><path d="M18 3v4h-4M6 21v-4h4"/></svg></span><h2 id="hRev">Untouched</h2><small id="revCap"></small></div>
77
81
  <div class="revc"><p id="revTxt"></p><button id="revBtn" type="button">Look at them</button></div>
@@ -83,7 +87,7 @@
83
87
  <div class="tgrid" id="trayBody"></div>
84
88
  <p class="note" id="trayNote" style="margin-top:14px"></p>
85
89
  </section>
86
- <p class="foot" id="foot">This page reads your list, the same one the Work page reads. It writes only when you press a button that says what it does, and each press uses the Work page's own route. The shelf, the capacity bars and starting an agent are not built here. Jira and Slack items appear only when an agent session has read them.</p>
90
+ <p class="foot" id="foot">This page reads your list, the same one the Work page reads. It writes only when you press a button that says what it does, and each press uses the Work page's own route. Starting an agent from a list is not built here. The tray's shelf (agent answers, ideas and reports waiting, with Keep, Use and Let go), effort figures and review timing need records PMOS does not hold yet. Jira and Slack items appear only when an agent session has read them.</p>
87
91
  </main>
88
92
  <noscript>This page needs JavaScript.</noscript>
89
93
  <script type="module" src="/pm/premium-work.js"></script>
@@ -1,5 +1,5 @@
1
1
  {
2
- "_comment": "Initiative premium-briefing-depth: the Around you card on the premium Briefing (agent proposals, mentions, portfolio pulse, horizon scan, data freshness), against the real server on a scratch repository with a seeded driver ledger, scan ledger and brief.",
2
+ "_comment": "Initiative premium-briefing-depth: the Around you card on the premium Briefing (agent proposals, mentions, portfolio pulse, horizon scan, report found, data freshness), against the real server on a scratch repository with a seeded driver ledger, scan ledger and brief.",
3
3
  "seconds": {
4
4
  "premium-briefing-depth-test.js": 90
5
5
  },