create-pmos 0.289.0 → 0.291.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.289.0",
3
+ "version": "0.291.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@76ac34a
1
+ kernel-source: pmos@f217528
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:35:48Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T03:45: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:35:48Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T03:45: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:35:48Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T03:45:27Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -117,7 +117,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
117
117
  {
118
118
  const R = await open({ model: mk({ sprints: { source: 'jira', readAt: '2026-10-16', sprints: [{ name: 'Sprint 42', state: 'active', start: '2026-10-12', end: '2026-10-23', counts: { todo: 11, doing: 9, done: 14 }, goal: 'Self-serve onboarding reaches beta' }] }, nextRelease: { id: 'r1', type: 'minor', at: '2026-10-23T00:00:00Z' } }) });
119
119
  const d = await R.page.evaluate(() => ({ sp: document.querySelector('#sprBody').textContent.replace(/\s+/g, ' '), cnt: [...document.querySelectorAll('#sprBody .cnt b')].map((b) => b.textContent).join(), rel: document.querySelector('#relBody').textContent.replace(/\s+/g, ' '), cap: document.querySelector('#relCap').textContent }));
120
- ok('B9 B8 a sprint read and a release are drawn from their records', /Sprint 42/.test(d.sp) && /12 Oct to 23 Oct/.test(d.sp) && d.cnt === '14,9,11' && /Self-serve onboarding reaches beta/.test(d.sp) && /23 Oct/.test(d.rel) && /minor release/.test(d.rel) && d.cap === '6 days away', JSON.stringify(d));
120
+ ok('B9 B8 a sprint read and a release are drawn from their records', d.cnt === '14,9,11' && /Goal: Self-serve onboarding reaches beta/.test(d.sp) && /Sprint review in 6 days/.test(d.sp) && /r1Next23 Oct · 6 days away/.test(d.rel), JSON.stringify(d));
121
121
  await R.ctx.close();
122
122
  }
123
123
 
@@ -171,7 +171,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
171
171
  const base = F.facts(), docs3 = Object.assign({}, base.docs, { docs: base.docs.docs.concat([F.doc('intake', 'Intake log'), F.doc('roadmap', 'Roadmap note')]) });
172
172
  const D = await open({ model: BP.build(Object.assign({}, base, { docs: docs3 })) });
173
173
  const q = D.page;
174
- ok('B15 the third card is "Coming up", as the mockup names it', await q.evaluate(() => document.querySelector('#hRel').textContent === 'Coming up' && !/Next release/.test(document.body.textContent)));
174
+ ok('B15 the third card is "Next release", as the mockup names it', await q.evaluate(() => document.querySelector('#hRel').textContent === 'Next release'));
175
175
  ok('B15 the header is the crumb: the board\'s name, no switcher for one board, and the sparkle', await q.evaluate(() => document.querySelector('#crBoard').disabled && document.querySelector('#crBoard').textContent === 'pmos' && document.querySelector('#crSw').hidden && document.querySelector('#crAsk').getAttribute('aria-label') === 'Ask about this board' && !document.querySelector('#bsw')));
176
176
  await q.click('#crAsk'); await until(() => q.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(500);
177
177
  const bd = await q.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, grid: [...document.querySelectorAll('#oMain .kv2 span')].map((x) => x.textContent).join('|'), ask: document.querySelector('#askF').hidden }));
@@ -67,12 +67,6 @@ const ready = (model) => ({ status: 200, body: { ok: true, state: 'ready', model
67
67
  if (!shown) return finish(1);
68
68
  const place = await p.evaluate(() => ({ above: document.querySelector('#cMet').getBoundingClientRect().bottom <= document.querySelector('#cIni').getBoundingClientRect().top, cap: document.querySelector('#metCap').textContent, h: document.querySelector('#hMet').textContent }));
69
69
  ok('C1 the card sits above the Initiatives card and says which repository it counts', place.above && place.cap === 'counted from idpf' && place.h === 'Metrics', JSON.stringify(place));
70
- {
71
- const R = await open({ answers: () => ({ status: 200, body: { ok: true, state: 'none', why: 'no card' } }) });
72
- await sleep(800);
73
- ok('C1 the home workspace\'s board draws no card', await R.page.evaluate(() => document.querySelector('#cMet').hidden), '');
74
- await R.ctx.close();
75
- }
76
70
 
77
71
  /* C2 */
78
72
  const tiles = await p.evaluate(() => [...document.querySelectorAll('#metBody .mt1')].map((t) => ({ l: t.querySelector('span').textContent, v: t.querySelector('.mval').textContent, c: t.querySelector('.mwk').textContent, chart: !!t.querySelector('svg'), cls: t.className, chg: (t.querySelector('.mchg') || {}).textContent || '' })));
@@ -141,14 +135,14 @@ const ready = (model) => ({ status: 200, body: { ok: true, state: 'ready', model
141
135
  /* C7 the real route */
142
136
  {
143
137
  const home = await fetch(BASE + '/api/board-metrics-premium').then((r) => r.json());
144
- ok('C7 the real route gives the home workspace no card', home.ok === true && home.state === 'none', JSON.stringify(home));
138
+ ok('C7 the real route gives the home workspace the card too', home.ok === true && home.state === 'ready', JSON.stringify(home));
145
139
  const post = await fetch(BASE + '/api/board-metrics-premium', { method: 'POST', headers: await T.pressHeaders(BASE), body: '{}' }).then((r) => r.status);
146
140
  ok('C7 the route is read-only', post === 405, String(post));
147
141
  const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 } }), pg = await ctx.newPage(), errs = [];
148
142
  pg.on('pageerror', (e) => errs.push(String(e)));
149
143
  await pg.goto(BASE + '/premium-board.html');
150
144
  await until(() => pg.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 40000); await sleep(1500);
151
- ok('C7 the real PMOS board draws no Metrics card and no script error', await pg.evaluate(() => document.querySelector('#cMet').hidden) && errs.length === 0, errs.join(' | '));
145
+ ok('C7 the real PMOS board draws the Metrics card and no script error', await pg.evaluate(() => !document.querySelector('#cMet').hidden) && errs.length === 0, errs.join(' | '));
152
146
  await ctx.close();
153
147
  }
154
148
 
@@ -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,9 @@ 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
+ **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.
193
+
194
+ **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
195
 
193
196
  - **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
197
  - **One count.** "To clear" is the inbox, plus today, plus agent drafts to review. The hero, the card and the dock use it.
@@ -225,7 +228,7 @@ Board is the third place on the rail, at `/premium-board.html`. It reads what th
225
228
  - **New initiative** (beside the Initiatives heading, team boards only) asks for a title, a lane and an anchor (a KR or a health budget). It writes an ask and accepts it, as the console does. An unanchored initiative is refused on the page.
226
229
  - **⋯ on a row** (and the bar under an initiative page's heading) moves it to the next or another stage, puts it on hold with a reason and a check-back day, cancels it with a reason, or archives it. Each press writes one line through the console's route, says what it recorded, and offers Undo for a few seconds. An on-hold row offers Resume; a cancelled one offers Reopen; an archived one offers Restore. Cancelled and archived initiatives leave the list and sit under a fold below it. On the PMOS board the workflow engine places each initiative, so the moves are not offered and New asks and New initiative are hidden.
227
230
 
228
- Not drawn, because PMOS holds no record for them: the Metrics card on the PMOS board, the mockup's demo measures (Activation, Partner uptime, API p95), targets, and the mockup's demo boards.
231
+ Not drawn, because PMOS holds no record for them: the mockup's demo measures (Activation, Partner uptime, API p95), targets, and the mockup's demo boards.
229
232
 
230
233
 
231
234
  ## Initiative page
@@ -113,16 +113,46 @@ function build(f) {
113
113
 
114
114
  const sp = f.sprints || {};
115
115
  const sprints = Array.isArray(sp.sprints) ? sp.sprints : [];
116
- const active = sp.source === 'jira' ? (sprints.find((s) => s.state === 'active') || sprints[0] || null) : null;
116
+ // The current sprint: the active one, else the next to start, else the latest closed by its end date (the list sorts closed sprints by name, oldest first).
117
+ const latestClosed = sprints.filter((s) => s.state === 'closed').sort((a, b) => String(b.end || '').localeCompare(String(a.end || '')) || String(b.name).localeCompare(String(a.name), undefined, { numeric: true }))[0];
118
+ const active = sp.source === 'jira' ? (sprints.find((s) => s.state === 'active') || sprints.find((s) => s.state !== 'closed') || latestClosed || null) : null;
119
+ const goalText = active && active.goal ? (typeof active.goal === 'object' ? active.goal.text || '' : String(active.goal)) : '';
120
+ const wd = (a, b) => { const x = isoDay(a), y = isoDay(b); if (!x || !y) return null; let n = 0; for (const d = new Date(x); d <= y; d.setDate(d.getDate() + 1)) if (d.getDay() % 6) n++; return n; }; // weekdays, both ends counted
117
121
  const sprint = active
118
- ? { cap: active.state || '', name: active.name, state: active.state, start: active.start ? shortDate(active.start) : '', end: active.end ? shortDate(active.end) : '', counts: { done: (active.counts || {}).done || 0, doing: (active.counts || {}).doing || 0, todo: (active.counts || {}).todo || 0 }, goal: active.goal ? clip(active.goal, 300) : '', summary: active.summary ? clip(active.summary, 400) : '' }
122
+ ? (() => {
123
+ const k = active.counts || {}, c = { done: k.done || 0, doing: k.doing || 0, todo: k.todo || 0 }, tot = c.done + c.doing + c.todo, st = active.start && String(active.start).slice(0, 10), en = active.end && String(active.end).slice(0, 10);
124
+ const open = active.state !== 'closed', len = st && en ? wd(st, en) : null, at = len && todayIso >= st ? Math.min(len, wd(st, todayIso)) : null, left = open && en ? days(todayIso, en) : null;
125
+ return { cap: open && len && at != null ? 'day ' + at + ' of ' + len : active.state || '', name: active.name, state: active.state, start: st ? shortDate(st) : '', end: en ? shortDate(en) : '', counts: c,
126
+ pct: tot ? { done: +(c.done / tot * 100).toFixed(1), doing: +(c.doing / tot * 100).toFixed(1) } : { done: 0, doing: 0 },
127
+ goal: goalText ? clip(goalText, 300) : '', tickets: (active.issues || []).slice(0, 40).map((i) => ({ key: i.key, title: clip(i.summary || i.key, 120), status: i.status || ({ done: 'Done', doing: 'Doing', todo: 'To do' })[i.category] || '' })), review: left == null ? '' : left < 0 ? 'Sprint ended ' + plural(-left, 'a day', -left + ' days') + ' ago.' : left === 0 ? 'Sprint review is today.' : 'Sprint review in ' + left + ' ' + plural(left, 'day', 'days') + '.' };
128
+ })()
119
129
  : { cap: 'none', why: 'No sprint is on record for this board. A sprint appears when an agent session has read Jira for it.' };
120
130
 
131
+ // The sprint's dialog (initiative premium-board-actions): its tickets with status and, only where a closed sprint's note holds one, the last sprint review.
132
+ const lastC = sprints.filter((x) => x !== active && x.state === 'closed' && (x.closed || x.hit)).sort((x, y) => String(y.end || '').localeCompare(String(x.end || '')) || String(y.name).localeCompare(String(x.name), undefined, { numeric: true }))[0];
133
+ const goalOf = (x) => (x && x.goal ? (typeof x.goal === 'object' ? x.goal.text || '' : String(x.goal)) : '');
134
+ const HIT = { met: ' (met)', partly: ' (partly met)', missed: ' (missed)' };
135
+ const review = lastC ? [['Last sprint review', lastC.name], ['Goal', goalOf(lastC) ? clip(goalOf(lastC), 200) + (HIT[lastC.hit] || '') : ''], ['Done', lastC.closed && lastC.closed.total ? lastC.closed.done + ' of ' + lastC.closed.total + ' tickets' : ''],
136
+ ['Carried over', lastC.closed && lastC.closed.carried ? lastC.closed.carried + ' ' + plural(lastC.closed.carried, 'ticket', 'tickets') + (lastC.closed.carriedTo ? ' moved to ' + lastC.closed.carriedTo : ' carried over') : ''], ['What got in the way', lastC.got || '']].filter((x) => x[1]) : [];
137
+ const sprintRow = sprint.name ? (() => {
138
+ const say = sprint.name + (sprint.cap ? ' · ' + sprint.cap : '') + '. ' + sprint.counts.done + ' done, ' + sprint.counts.doing + ' doing, ' + sprint.counts.todo + ' to do.';
139
+ const rs = [['Dates', [sprint.start, sprint.end].filter(Boolean).join(' to ')], ['State', sprint.state || ''], ['Goal', sprint.goal], ['Done', String(sprint.counts.done)], ['Doing', String(sprint.counts.doing)], ['To do', String(sprint.counts.todo)]].filter((x) => x[1])
140
+ .concat(sprint.tickets.map((t) => [t.key, t.title + (t.status ? ' · ' + t.status : '')]), review);
141
+ return { key: 'board:sprint', id: null, title: sprint.name, sub: 'Sprint', dialog: { eye: 'Sprint', logTitle: 'Read from Jira', log: ['Read the sprint and its tickets from the cached Jira reading', 'Counted them by status', 'Changed nothing'], say, head: 'Where it stands', facts: rs, hold: 'This dialog changes nothing. Sprints mirror Jira.', pane: { label: 'Sprint', file: '', note: 'The sprint as the cached Jira reading holds it. A review shows only where a closed sprint has a note.', rows: rs } } };
142
+ })() : null;
121
143
  const nr = f.nextRelease;
122
- const rd = nr && nr.at ? days(todayIso, String(nr.at).slice(0, 10)) : null;
144
+ const relOf = (r, tag) => {
145
+ const rd = days(todayIso, String(r.at).slice(0, 10));
146
+ return { name: r.name || r.id, tag, at: shortDate(String(r.at).slice(0, 10)), days: rd, away: rd != null ? (rd === 0 ? 'today' : rd + ' ' + plural(rd, 'day', 'days') + ' away') : '', type: r.type || '',
147
+ ini: (r.ini || []).map((id) => rows.find((x) => x.id === id)).filter(Boolean).map((x) => ({ id: x.id, key: x.key, title: x.title, status: x.statusLabel || '', tone: x.late ? 'bad' : x.bad ? 'warn' : '' })) };
148
+ };
123
149
  const release = nr && nr.at
124
- ? { cap: rd != null ? (rd === 0 ? 'today' : rd + ' ' + plural(rd, 'day', 'days') + ' away') : '', type: nr.type || '', at: shortDate(String(nr.at).slice(0, 10)), days: rd }
125
- : { cap: 'none', why: 'No release is planned for this board.' };
150
+ ? { ...relOf(nr, 'Next'), cap: relOf(nr, 'Next').away, rel: [relOf(nr, 'Next')].concat(nr.later && nr.later.at ? [relOf(nr.later, 'Planned')] : []) }
151
+ : { cap: 'none', why: 'No release is planned for this board. A release appears here when one carries an initiative of this board.', rel: [] };
152
+ const relRow = release.rel.length ? (() => {
153
+ const rs = release.rel.flatMap((r) => [[r.name + ' · ' + r.tag, [r.at, r.away].filter(Boolean).join(' · ') + (r.type ? ' · ' + r.type : '')]].concat(r.ini.map((i) => ['Rides on it', i.title + (i.status ? ' · ' + i.status : '')])));
154
+ return { key: 'board:release', id: null, title: release.name, sub: 'Release', dialog: { eye: 'Release', logTitle: 'Read from the releases', log: ['Read the releases that carry an initiative of this board', 'Took the earliest date from today on', 'Changed nothing'], say: release.name + ' is next: ' + release.at + ', ' + release.away + '.', head: 'Where it stands', facts: rs, hold: 'This dialog changes nothing.', pane: { label: 'Release', file: '', note: 'The releases as the release records hold them.', rows: rs } } };
155
+ })() : null;
126
156
 
127
157
  const dd = f.docs || null;
128
158
  const custom = (f.custom || []).map((d) => Object.assign(Custom.rowOf(d), { added: shortDate(d.at) }));
@@ -152,8 +182,8 @@ function build(f) {
152
182
  },
153
183
  sprint, release, docs,
154
184
  asks: f.asks == null ? { missing: true, rows: [] } : { rows: f.asks.filter((a) => a && a.state !== 'accepted' && a.state !== 'declined').slice(0, 50).map(askOf) },
155
- dock: { needs: risk + late, label: 'need a look', next: (rows.find((r) => r.late) || rows.find((r) => r.bad) || {}).title || null },
156
- rows: rows.concat(stageRows.filter((r) => !rows.some((x) => x.key === r.key)), gone.cancelled, gone.archived).concat([{ key: 'board:this-board', id: null, title: board.name || 'This board', sub: 'Board', dialog: { eye: 'Board', logTitle: 'Read from the board', log: ['Read the board and its initiatives', 'Counted them by status', 'Changed nothing'], say: (board.name || 'This board') + ' has ' + open + ' open ' + plural(open, 'initiative', 'initiatives') + ': ' + on + ' on track, ' + risk + ' at risk, ' + late + ' late' + (hold ? ', ' + hold + ' on hold' : '') + '.', head: 'Where it stands', facts: [['Open initiatives', String(open)], ['On track', String(on)], ['At risk', String(risk)], ['Late', String(late)], ['On hold', hold ? String(hold) : '']].filter((x) => x[1] !== ''), hold: 'Nothing here changes a board.', pane: { label: 'Board record', file: '', note: 'The board as its records hold it.', rows: [['Open initiatives', String(open)], ['On track', String(on)], ['At risk', String(risk)], ['Late', String(late)], ['On hold', hold ? String(hold) : '']].filter((x) => x[1] !== '') } } }]),
185
+ dock: { needs: risk + late, label: 'need a look', release: nr && nr.at ? { at: shortDate(String(nr.at).slice(0, 10)), name: nr.name || nr.id } : null, next: (rows.find((r) => r.late) || rows.find((r) => r.bad) || {}).title || null },
186
+ rows: rows.concat(stageRows.filter((r) => !rows.some((x) => x.key === r.key)), gone.cancelled, gone.archived, [sprintRow, relRow].filter(Boolean)).concat([{ key: 'board:this-board', id: null, title: board.name || 'This board', sub: 'Board', dialog: { eye: 'Board', logTitle: 'Read from the board', log: ['Read the board and its initiatives', 'Counted them by status', 'Changed nothing'], say: (board.name || 'This board') + ' has ' + open + ' open ' + plural(open, 'initiative', 'initiatives') + ': ' + on + ' on track, ' + risk + ' at risk, ' + late + ' late' + (hold ? ', ' + hold + ' on hold' : '') + '.', head: 'Where it stands', facts: [['Open initiatives', String(open)], ['On track', String(on)], ['At risk', String(risk)], ['Late', String(late)], ['On hold', hold ? String(hold) : '']].filter((x) => x[1] !== ''), hold: 'Nothing here changes a board.', pane: { label: 'Board record', file: '', note: 'The board as its records hold it.', rows: [['Open initiatives', String(open)], ['On track', String(on)], ['At risk', String(risk)], ['Late', String(late)], ['On hold', hold ? String(hold) : '']].filter((x) => x[1] !== '') } } }]),
157
187
  };
158
188
  last = model;
159
189
  return model;
@@ -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
  }
@@ -111,7 +111,7 @@ function weekOf({ today, items, events }) {
111
111
 
112
112
  function rowOf(it, list, v, inReview, focusIds) {
113
113
  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(' · ');
114
+ 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
115
  const days = it.waiting_since ? daysBetween(String(it.waiting_since).slice(0, 10), today) : null;
116
116
  const facts = [
117
117
  ['From', srcLabel(it)], ['Place', list === 'upcoming' ? 'Upcoming' : list.charAt(0).toUpperCase() + list.slice(1)], ['Due', it.due ? shortDate(it.due) + (overdue ? ' (overdue)' : '') : ''],
@@ -29,14 +29,12 @@ async function via(mod, pathAndQuery, req, ctx) {
29
29
  const qs = (o) => '?' + Object.entries(o).filter(([, v]) => v != null && v !== '').map(([k, v]) => k + '=' + encodeURIComponent(v)).join('&');
30
30
 
31
31
  /** GET /api/board-metrics-premium?ws=<id> — the Metrics card of a tenant's Board (initiative briefing-premium-metrics). Read-only, and apart from the Board's own
32
- * route so the Board never waits for it. The home workspace has no card: { ok, state: 'none' }. */
32
+ * route so the Board never waits for it. Every board has the card, the PMOS board's counted from the PMOS repository. */
33
33
  async function metrics(req, res, url, ctx) {
34
34
  if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
35
35
  try {
36
36
  const w = ctx.getWs && ctx.getWs(url.searchParams.get('ws') || null);
37
37
  if (!w || !w.root) { ctx.json(res, { ok: false, state: 'error', error: 'that workspace is not registered' }, 404); return true; }
38
- const home = ctx.homeRoot || ctx.selfRoot || null;
39
- if (home && path.resolve(w.root) === path.resolve(home)) { ctx.json(res, { ok: true, state: 'none', why: 'The board of this repository has no Metrics card.' }); return true; }
40
38
  const engine = ENGINE_PATHS.find((p) => fs.existsSync(p)) || null;
41
39
  const model = await Metrics.read({ root: w.root, engine, now: Date.now() });
42
40
  // the read-only agent finds a tile's row in the Board's model
@@ -336,14 +336,17 @@ function readReleases(ctx) {
336
336
  /** The next release that carries an initiative of the board: the earliest release (or deploy) date from today on. */
337
337
  function nextReleaseOf(releases, ids) {
338
338
  const day = today();
339
- let best = null;
339
+ const hits = [];
340
340
  for (const r of releases) {
341
- if (!(r.initiative_ids || []).some((x) => ids.has(x))) continue;
341
+ const on = (r.initiative_ids || []).filter((x) => ids.has(x));
342
+ if (!on.length) continue;
342
343
  const at = r.release_at || r.deploy_at;
343
344
  if (!at || at.slice(0, 10) < day) continue;
344
- if (!best || at < best.at) best = { id: r.id, type: r.type, at };
345
+ hits.push({ id: r.id, type: r.type, at, name: r.fix_version || r.id, ini: on });
345
346
  }
346
- return best;
347
+ hits.sort((x, y) => String(x.at).localeCompare(String(y.at)));
348
+ // the next one, with the one after it (the mockup's Planned row)
349
+ return hits[0] ? { ...hits[0], later: hits[1] || null } : null;
347
350
  }
348
351
  const openAsks = (folded, boardId) => [...folded.asks.values()].filter((a) => a.board === boardId && a.state === 'open').length;
349
352
  const pageAsk = (a) => ({ ...a, by: actorLib.pageName(a.by) });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.289.0",
3
+ "version": "0.291.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.289.0",
9
+ "version": "0.291.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.289.0",
3
+ "version": "0.291.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()));
@@ -97,15 +97,22 @@ const rowOf = (key) => (M && M.rows || []).find((r) => r.key === key) || null;
97
97
 
98
98
  /* ── sprint, release, documents ─────────────────────────────────────────────────────────────────────────── */
99
99
  function drawSide() {
100
- const S = M.sprint;
100
+ const S = M.sprint, R = M.release;
101
+ $('#hSpr').textContent = S.name || 'Sprint';
101
102
  $('#sprCap').textContent = S.cap || '';
102
103
  $('#sprBody').innerHTML = S.name
103
- ? `<div class="spr"><div class="sph"><b>${esc(S.name)}</b><span class="mut">${esc([S.state, S.start && S.end ? S.start + ' to ' + S.end : ''].filter(Boolean).join(' · '))}</span></div>${S.goal ? `<p class="goal2"><b>Goal</b> ${esc(S.goal)}</p>` : ''}${S.summary ? `<p class="sum3">${esc(S.summary)}</p>` : ''}<div class="cnt"><span><b>${S.counts.done}</b> done</span><span><b>${S.counts.doing}</b> doing</span><span><b>${S.counts.todo}</b> to do</span></div></div>`
104
+ ? `<button type="button" class="spr sprb" data-open="board:sprint" aria-haspopup="dialog" aria-label="${esc(S.name)}, ${esc(S.cap || '')}. Open the sprint"><span class="sbar" aria-hidden="true"><i class="d" style="width:${S.pct.done}%"></i><i class="g" style="width:${S.pct.doing}%"></i></span>`
105
+ + `<span class="cnt"><span><b>${S.counts.done}</b> done</span><span><b>${S.counts.doing}</b> doing</span><span><b>${S.counts.todo}</b> to do</span></span>`
106
+ + `${S.goal ? `<span class="goal2">Goal: ${esc(S.goal)}</span>` : ''}${S.review ? `<span class="sum3">${esc(S.review)}</span>` : ''}</button>`
104
107
  : `<p class="mut">${esc(S.why)}</p>`;
105
- const R = M.release;
106
- $('#relCap').textContent = R.cap || '';
107
- $('#relBody').innerHTML = R.at ? `<div class="irow st"><time>${esc(R.at)}</time><span class="itx"><b>${esc(R.type ? R.type + ' release' : 'Release')}</b><small>${esc(R.cap)}</small></span></div>` : `<p class="empty3 plain">${esc(R.why)}</p>`;
108
+ $('#hRel').textContent = 'Next release';
109
+ $('#relCap').textContent = R.rel && R.rel.length ? '' : 'none';
110
+ $('#relBody').innerHTML = R.rel && R.rel.length
111
+ ? `<div class="rels">${R.rel.map((r) => `<button type="button" class="rel" data-open="board:release" aria-haspopup="dialog"><span class="rh"><b>${esc(r.name)}</b><em class="rtag">${esc(r.tag)}</em><time>${esc(r.at)}${r.away ? ' · ' + esc(r.away) : ''}</time></span>${r.ini.map((i) => `<span class="ri"><i class="hd ${i.tone}"></i>${esc(i.title)}${i.status ? ' · ' + esc(i.status) : ''}</span>`).join('')}</button>`).join('')}</div>`
112
+ : `<p class="empty3 plain">${esc(R.why)}</p>`;
108
113
  }
114
+ $('#cSpr').addEventListener('click', (e) => { const b = e.target.closest('[data-open]'); if (b) openRow(rowOf(b.dataset.open)); });
115
+ $('#cRel').addEventListener('click', (e) => { const b = e.target.closest('[data-open]'); if (b) openRow(rowOf(b.dataset.open)); });
109
116
  function docRow(d) {
110
117
  const act = !d.act ? '' : d.act.kind === 'draft' ? `<button class="dmcta alt" data-draft="${esc(d.key)}"${d.running ? ' disabled' : ''}>${d.running ? '<span class="spin"></span>' : ICO('<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"/>')}${esc(d.act.label)}</button>` : `<button class="dmcta alt" data-tab="${esc(d.act.tab)}">${esc(d.act.label)}</button>`;
111
118
  return `<div class="dmr ${esc(d.st || '')}" role="listitem">${d.path ? `<button class="dmo" data-doc="${esc(d.key)}" aria-haspopup="dialog">` : '<span class="dmo">'}<span class="dmi c-Board">${ICO(DOCI)}</span><span class="dmn"><b>${esc(d.title)}</b><small>${esc(d.what)}</small><span class="dmm"><span class="s ${esc(d.st || 'live')}">${ICO(STATE_ICO[d.state] || STATE_ICO['Not started'])}${esc(d.state)}</span>${d.added ? `<span>${ICO('<rect x="3" y="5" width="18" height="16" rx="3"/><path d="M3 10h18M8 3v4M16 3v4"/>')}added ${esc(d.added)}</span>` : ''}${d.cadence ? `<span>${ICO('<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>')}${esc(d.cadence)}</span>` : ''}${d.by ? `<span>${ICO('<circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/>')}${esc(d.by)}</span>` : ''}</span></span>${d.path ? '</button>' : '</span>'}<span class="dmq">${act}</span></div>`;
@@ -166,7 +173,7 @@ $('#asksHost').addEventListener('click', (e) => { if (M) onAsks(e, ctxOf(), M.as
166
173
  $('#newIni').onclick = () => { closeMenu(); openIniForm(ctxOf(), null); };
167
174
 
168
175
  /* ── dock ───────────────────────────────────────────────────────────────────────────────────────────────── */
169
- function drawDock() { $('#dN').textContent = M.dock.needs; $('#dLab').textContent = M.dock.label; $('#dNext').innerHTML = M.dock.next ? `<i></i>First <b>${esc(M.dock.next)}</b>` : 'Nothing is late or at risk'; }
176
+ function drawDock() { $('#dN').textContent = M.dock.needs; $('#dLab').textContent = M.dock.label; $('#dNext').innerHTML = (M.dock.next ? `<i></i>First <b>${esc(M.dock.next)}</b>` : 'Nothing is late or at risk') + (M.dock.release ? ` <span class="sep"></span> Next release <b>${esc(M.dock.release.at)}</b> ${esc(M.dock.release.name)}` : ''); }
170
177
 
171
178
  /* ── the dialog: the initiative's record, no press, the read-only agent beside it ──────────────────────────── */
172
179
  function cardHtml(r) { return `<div class="acard" id="card"><p class="ct">What this page can do</p><p class="nodef" id="holdWhy">${esc(r.dialog.hold)}</p></div>`; }
@@ -290,7 +297,6 @@ async function startMetrics(ws) {
290
297
  clearTimeout(metTimer);
291
298
  let r = null;
292
299
  try { const res = await fetch('/api/board-metrics-premium?ws=' + encodeURIComponent(ws || ''), { credentials: 'same-origin' }); r = await res.json(); } catch { r = null; }
293
- if (r && r.ok && r.state === 'none') { MM = null; metDraw(); return; } // the home workspace's board has no card
294
300
  if (!r || !r.ok || r.state !== 'ready') {
295
301
  MM = null; metDraw(); $('#cMet').hidden = false; $('#metCap').textContent = 'not read'; $('#metHint').textContent = 'The metrics could not be read, so none is shown.' + (r && r.error ? ' The reason: ' + r.error : ''); $('#metBody').innerHTML = ''; $('#metNote').textContent = '';
296
302
  return;
@@ -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') || '';
@@ -114,10 +114,21 @@ const WHO = [['you', 'You'], ['agent-drafts', 'Agent drafts'], ['agent-does', 'A
114
114
  const PRIS = ['P1', 'P2', 'P3', ''];
115
115
  let dlgKind = null; // 'item' | 'fjobs': what the open dialog shows
116
116
  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: '' });
117
+ 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
118
  const dlgOpen = () => $('#dlg').classList.contains('on');
119
119
  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
120
 
121
+ /* 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. */
122
+ function choicesHtml(r, a) {
123
+ const nm = nextMonday(M.today), pick = ui.pick || 'agent';
124
+ 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')}.`]];
125
+ if (r.list !== 'today') opts.push(['today', '', 'Do it today', 'Moves to Today']);
126
+ opts.push(['nb', '', 'Not before ' + dayLabel(nm), 'Out of Today until then']);
127
+ const go = pick === 'agent' ? ['ag-brief', 'Let the agent draft this'] : pick === 'today' ? ['ag-today', 'Do it today'] : ['ag-nb', 'Not before ' + dayLabel(nm)];
128
+ 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>`
129
+ + `<div class="cact two"><button class="cta" data-p="${go[0]}"><span>${esc(go[1])}</span></button></div>`;
130
+ }
131
+
121
132
  /* the agent block: one state, the controls that state allows, and nothing is posted before the confirm */
122
133
  function agentHtml(r) {
123
134
  const a = r.dialog.agent;
@@ -128,7 +139,7 @@ function agentHtml(r) {
128
139
  if (a.state === 'suggest') {
129
140
  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
141
  + `<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>`;
142
+ + choicesHtml(r, a);
132
143
  } else if (a.state === 'queued' || a.state === 'working' || a.state === 'sending') {
133
144
  const line = a.state === 'queued' ? 'Queued. The agent starts as soon as a session is free. You can close this page.'
134
145
  : a.state === 'sending' ? `Posting to ${esc(w)}. A session does exactly the step you approved and nothing else.`
@@ -304,6 +315,10 @@ function dlgClick(b, r) {
304
315
  case 'remove': return commit({ send: () => post('/api/pm-items/remove', { id }), say: SAID.remove, undo: () => post('/api/pm-items/undo', { id }) });
305
316
  case 'flag': return todayP(r);
306
317
  case 'keep': return commit({ send: () => post('/api/pm-items/keep', { id }), say: SAID.keep });
318
+ case 'pick': ui.pick = b.dataset.v; return paint(`[data-p="pick"][data-v="${b.dataset.v}"]`);
319
+ case 'ag-today': return todayP(r);
320
+ case 'ag-nb': return deferP(r, nextMonday(M.today));
321
+ case 'round': ui.round = ui.round === +b.dataset.i ? null : +b.dataset.i; return paint(`[data-p="round"][data-i="${b.dataset.i}"]`);
307
322
  case 'xt': {
308
323
  const t = b.dataset.k;
309
324
  if (t === 'someday') return somedayP(r);
@@ -697,6 +697,19 @@ a.round{color:inherit;text-decoration:none}
697
697
  .ini2.ibi{width:calc(100% + 24px);margin:0 -12px;padding:12px;border-radius:var(--r-in);text-align:left;transition:background .25s}
698
698
  .ini2.ibi:hover{background:var(--well)}
699
699
  #cSpr .spr{background:var(--well)}
700
+ /* Sprint and Next release cards as the mockup draws them */
701
+ .spr.sprb{display:grid;width:100%;text-align:left;background:none;padding:0;border-radius:var(--r-in);gap:12px;cursor:pointer}
702
+ .sbar{display:flex;gap:4px;height:6px}
703
+ .sbar i{display:block;border-radius:8px}
704
+ .sbar::after{content:"";flex:1;border-radius:8px;background:var(--b3)}
705
+ .sbar .d{background:var(--ok)}.sbar .g{background:var(--solid)}
706
+ .rels{display:grid;gap:14px}
707
+ .rel{display:grid;gap:6px;width:100%;text-align:left;cursor:pointer}
708
+ .rel .rh{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
709
+ .rel .rh b{font-size:15px}
710
+ .rel .rh time{margin-left:auto;font:500 12px var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--ink-2)}
711
+ .rtag{font-style:normal;font-size:12px;font-weight:650;padding:2px 10px;border-radius:12px;background:var(--well)}
712
+ .rel .ri{font-size:13.5px;color:var(--ink-2)}
700
713
  .goal2,.sum3{margin:0;font-size:var(--t-body);line-height:1.5}
701
714
  .sum3{color:var(--ink-2)}
702
715
  @media (max-width:999px){
@@ -1849,6 +1862,9 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
1849
1862
  .mtg .tp small{color:var(--ink-3);font-size:12.5px}
1850
1863
  .mtg .mtg-link{margin:8px 0 6px}
1851
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)}
1852
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 */
1853
1869
  .dsm2{display:flex;flex-wrap:wrap;gap:6px 8px;align-items:center;margin:0 0 12px}
1854
1870
  .dsm2 .chp{padding:4px 10px;font-size:12px;gap:6px;font-weight:600}
@@ -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
  }
@@ -64,7 +64,7 @@
64
64
  <div id="sprBody"></div>
65
65
  </section>
66
66
  <section class="card rise" style="--d:7" id="cRel" aria-labelledby="hRel">
67
- <div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><rect x="3" y="5" width="18" height="16" rx="3"/><path d="M3 10h18M8 3v4M16 3v4"/></svg></span><h2 id="hRel">Coming up</h2><small id="relCap"></small></div>
67
+ <div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><rect x="3" y="5" width="18" height="16" rx="3"/><path d="M3 10h18M8 3v4M16 3v4"/></svg></span><h2 id="hRel">Next release</h2><small id="relCap"></small></div>
68
68
  <div id="relBody"></div>
69
69
  </section>
70
70
  </div>
@@ -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
  },