create-pmos 0.836.0 → 0.837.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.
Files changed (38) hide show
  1. package/package.json +51 -17
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/changelog.json +50 -2
  7. package/workspace/guide/cli.md +18 -0
  8. package/workspace/guide/layout.md +5 -1
  9. package/workspace/lib/built-vs-design-http.js +81 -0
  10. package/workspace/lib/built-vs-design.js +454 -0
  11. package/workspace/lib/deps-cli.js +47 -2
  12. package/workspace/lib/features.json +1 -0
  13. package/workspace/lib/needs-providers.js +1 -0
  14. package/workspace/lib/pmos-verbs.js +3 -0
  15. package/workspace/lib/prefs-sync.js +1 -0
  16. package/workspace/lib/review-cli.js +6 -0
  17. package/workspace/lib/routes-pop-work.js +4 -1
  18. package/workspace/lib/routes-team-waits.js +39 -2
  19. package/workspace/lib/team-slips.js +160 -0
  20. package/workspace/package-lock.json +2 -2
  21. package/workspace/package.json +1 -1
  22. package/workspace/public/pm/ask-here-ctx.js +20 -2
  23. package/workspace/public/pm/ask-here.css +6 -1
  24. package/workspace/public/pm/ask-here.js +38 -25
  25. package/workspace/public/pm/bd-backlog.js +34 -5
  26. package/workspace/public/pm/built-vs-design.css +16 -0
  27. package/workspace/public/pm/built-vs-design.js +95 -0
  28. package/workspace/public/pm/cozy-events-view.js +1 -1
  29. package/workspace/public/pm/cozy-home.css +10 -0
  30. package/workspace/public/pm/cozy-pop-work.js +6 -4
  31. package/workspace/public/pm/cozy-today-view.js +4 -1
  32. package/workspace/public/pm/goals-ds.js +3 -2
  33. package/workspace/public/pm/home-chat.js +19 -3
  34. package/workspace/public/pm/ini-tasks.js +2 -2
  35. package/workspace/public/pm/page-chat.js +2 -1
  36. package/workspace/public/pm/team-slips.js +48 -0
  37. package/workspace/test-lists/built-vs-design.json +9 -0
  38. package/workspace/test-lists/team-slips.json +9 -0
@@ -4,11 +4,48 @@
4
4
  * GET /api/team-waits?ws=<id> → { ok, ws, today, waits: [lib/team-waits.js wait] } open waits, oldest first; 404 for an unknown ws
5
5
  *
6
6
  * Read only. The chat and a terminal write the same store with `pmos deps wait|done|undo` (lib/deps-cli.js), so what they write shows here
7
- * on the next read. Nothing is sent: Chase is a draft in the PM's own mail app (public/pm/team-waits.js chaseDraft). */
7
+ * on the next read. Nothing is sent: Chase is a draft in the PM's own mail app (public/pm/team-waits.js chaseDraft).
8
+ *
9
+ * Other teams' slips (initiative team-slips, bet A15; lib/team-slips.js is the store):
10
+ * GET /api/team-slips?ws=<id> → { ok, ws, today, watching, slips } the Upstream block on Work › Dependencies
11
+ * POST /api/team-slips/handle { ws, key, how } → { ok, line } the PM acted (shift | chase | skip): the row goes until a later likely date
12
+ * POST /api/team-slips/undo { ws, key } → { ok, line } Undo: the row is back
13
+ * A POST is a press on the page (pm-guard requirePagePress). No date is written and nothing is sent here. */
8
14
  const TW = require('./team-waits.js');
15
+ const TS = require('./team-slips.js');
16
+ const guard = require('./pm-guard.js');
9
17
  const { todayOf } = require('./parked-reasons.js');
10
18
 
19
+ const wsOf = (ctx, id) => { try { return ctx.getWs(id || null); } catch { return null; } };
20
+
21
+ async function slips(req, res, url, ctx) {
22
+ const p = url.pathname;
23
+ if (req.method === 'GET' && p === '/api/team-slips') {
24
+ const w = wsOf(ctx, url.searchParams.get('ws'));
25
+ if (!w || !w.root) { ctx.json(res, { ok: false, error: 'no such workspace' }, 404); return true; }
26
+ const today = todayOf();
27
+ let S = { watching: 0, slips: [] };
28
+ try { S = TS.slipsOf(w.root, { today }); } catch { S = { watching: 0, slips: [] }; }
29
+ ctx.json(res, { ok: true, ws: w.id, today, watching: S.watching, slips: S.slips });
30
+ return true;
31
+ }
32
+ if (p !== '/api/team-slips/handle' && p !== '/api/team-slips/undo') { ctx.json(res, { ok: false, error: 'no such route' }, 404); return true; }
33
+ if (req.method !== 'POST') { ctx.json(res, { ok: false, error: 'POST only' }, 405); return true; }
34
+ let body = {};
35
+ try { body = JSON.parse((await ctx.readBody(req)) || '{}'); } catch { ctx.json(res, { ok: false, error: 'invalid JSON body' }, 400); return true; }
36
+ const g = guard.requirePagePress(req, body);
37
+ if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
38
+ const w = wsOf(ctx, typeof body.ws === 'string' ? body.ws : '');
39
+ if (!w || !w.root) { ctx.json(res, { ok: false, error: 'no such workspace' }, 404); return true; }
40
+ const who = { by: (g.actor && g.actor.by) || undefined, via: (g.actor && g.actor.via) || 'ui' };
41
+ const r = p.endsWith('/handle') ? TS.handle(w.root, { key: String(body.key || '') }, { ...who, how: body.how }) : TS.undo(w.root, { key: String(body.key || '') }, who);
42
+ if (r.ok) { try { if (ctx.invalidateNeedsAgg) ctx.invalidateNeedsAgg(w.id); } catch { /* the next poll recounts */ } }
43
+ ctx.json(res, r, r.ok ? 200 : 409);
44
+ return true;
45
+ }
46
+
11
47
  async function handle(req, res, url, ctx) {
48
+ if (url.pathname.startsWith('/api/team-slips')) return slips(req, res, url, ctx);
12
49
  if (url.pathname !== '/api/team-waits') { ctx.json(res, { ok: false, error: 'no such route' }, 404); return true; }
13
50
  if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
14
51
  let w = null;
@@ -21,4 +58,4 @@ async function handle(req, res, url, ctx) {
21
58
  return true;
22
59
  }
23
60
 
24
- module.exports = { prefixes: ['/api/team-waits'], handle };
61
+ module.exports = { prefixes: ['/api/team-waits', '/api/team-slips'], handle };
@@ -0,0 +1,160 @@
1
+ 'use strict';
2
+ /* team-slips.js — other teams' slips, before they hit you (initiative team-slips, bet A15; board BatchMoreADS panel 27: Today one row ·
3
+ * Work › Dependencies).
4
+ *
5
+ * PMOS reads only the other teams' boards your work waits on: the Jira keys of the open waits (lib/team-waits.js). A reading of one of those
6
+ * tickets records their date and their likely new date (`pmos deps slip`, run by the tracker read or the chat). When the likely date is past
7
+ * their date, that is a slip: one row, with their likely new date and what of yours it hits. PMOS offers one move under ✦: shift your date
8
+ * when the slip lands on or past your date, else chase them (a draft message the PM sends). The row goes once the PM has acted on it (or
9
+ * waved it off); a later likely date warns again. No slip, no row.
10
+ *
11
+ * slipsOf(root, { today }) → { file, watching, slips: [slip] }
12
+ * watching how many boards (Jira projects) of open waits PMOS watches
13
+ * slip = { key, wait, ini, title, team, theirs, likely, late (days), yours, yours_what, hits, from, move, shift_to, who, email, since }
14
+ * move 'shift' (the slip lands on or past your date) | 'chase'
15
+ * shift_to your date moved by the same days they slipped (only with move 'shift')
16
+ * read(root, { key, theirs, likely, yours, yours_what, from }, { now, by, via }) → { ok, line } | { ok: false, error } one reading
17
+ * handle(root, { key }, { now, by, via, how }) → { ok, line } the PM acted (how: 'shift' | 'chase' | 'skip'); this likely date is warned once
18
+ * undo(root, { key }, { now, by, via }) → { ok, line } Undo of handle: the row is back
19
+ * acted(root, { days, now }) → count of slips the PM acted on (shift or chase) in the last `days` days: the health number
20
+ * (`node workspace/lib/team-slips.js acted --days 30 [--root <dir>]` prints it on its last line)
21
+ * needs provider: kinds ['team-slip'] · rowsFor(w, { lead }) · sig(w) the one Today row (the first slip; "and n more" says the rest once)
22
+ *
23
+ * THE STORE. `team-slips.jsonl` next to team-waits.jsonl: { kind: 'slip-read' | 'slip-handled' | 'slip-back', key, … }. Append only.
24
+ * Nothing is sent and no date is written here: shift opens the initiative so its owner moves the date; chase is a draft in the PM's own mail app. */
25
+ const fs = require('fs');
26
+ const path = require('path');
27
+ const P = require('./parked-reasons.js');
28
+ const TW = require('./team-waits.js');
29
+
30
+ const NAME = 'team-slips';
31
+ const FILE = 'team-slips.jsonl';
32
+ const TAG = '[team-slips]';
33
+ const DAY = 864e5;
34
+ const DATE = /^\d{4}-\d{2}-\d{2}$/;
35
+ const KEY_RE = /^[A-Z][A-Z0-9_]*-\d+$/;
36
+
37
+ const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).trimEnd() + '…' : t; };
38
+ const isDay = (v) => typeof v === 'string' && DATE.test(v) && Number.isFinite(Date.parse(v));
39
+ const addDays = (d, n) => new Date(Date.parse(d) + n * DAY).toISOString().slice(0, 10);
40
+ const diff = (a, b) => Math.round((Date.parse(b) - Date.parse(a)) / DAY);
41
+ function jsonl(file) {
42
+ let text = '';
43
+ try { text = fs.readFileSync(file, 'utf8'); } catch { return []; }
44
+ const out = [];
45
+ for (const l of text.split('\n')) { if (!l.trim()) continue; try { const r = JSON.parse(l); if (r && typeof r === 'object' && !Array.isArray(r)) out.push(r); } catch { /* a torn line */ } }
46
+ return out;
47
+ }
48
+ const fileOf = (root) => { const L = P.layoutOf(root); return L ? path.join(L.runs, FILE) : null; };
49
+ const stamp = (now, by, via) => ({ at: new Date(now).toISOString(), by: by || 'pm', via: via || 'cli' });
50
+ const append = (file, line) => { fs.mkdirSync(path.dirname(file), { recursive: true }); fs.appendFileSync(file, JSON.stringify(line) + '\n'); return line; };
51
+
52
+ /** Per key: the latest reading, and the likely date the PM last acted on (null after an Undo). */
53
+ function foldOf(file) {
54
+ const m = new Map();
55
+ for (const r of jsonl(file)) {
56
+ if (!KEY_RE.test(r.key || '')) continue;
57
+ const s = m.get(r.key) || { read: null, handled: null };
58
+ if (r.kind === 'slip-read') s.read = r;
59
+ else if (r.kind === 'slip-handled') s.handled = r;
60
+ else if (r.kind === 'slip-back') s.handled = null;
61
+ m.set(r.key, s);
62
+ }
63
+ return m;
64
+ }
65
+
66
+ function slipsOf(root, { today = P.todayOf() } = {}) {
67
+ root = path.resolve(root);
68
+ const file = fileOf(root);
69
+ if (!file) return { file: null, watching: 0, slips: [] };
70
+ const waits = TW.waitsOf(root, { today }).waits.filter((w) => w.key);
71
+ const byKey = new Map(waits.map((w) => [w.key, w]));
72
+ const watching = new Set(waits.map((w) => w.key.split('-')[0])).size;
73
+ const slips = [];
74
+ for (const [key, s] of foldOf(file)) {
75
+ const w = byKey.get(key);
76
+ const r = s.read;
77
+ if (!w || !r || !isDay(r.theirs) || !isDay(r.likely)) continue; // only the boards your open waits are on
78
+ if (r.likely <= r.theirs) continue; // no slip, no row
79
+ if (s.handled && s.handled.likely >= r.likely) continue; // warned once: acted on this likely date or a later one
80
+ const late = diff(r.theirs, r.likely);
81
+ const yours = isDay(r.yours) ? r.yours : null;
82
+ const hits = !!(yours && r.likely >= yours);
83
+ slips.push({ key, wait: w.id, ini: w.ini, title: w.title, team: w.team || w.what, theirs: r.theirs, likely: r.likely, late, yours,
84
+ yours_what: clip(r.yours_what, 80) || w.title, hits, from: clip(r.from, 60) || key.split('-')[0], move: hits ? 'shift' : 'chase',
85
+ shift_to: hits ? addDays(yours, late) : null, who: w.who, email: w.email, since: w.since });
86
+ }
87
+ slips.sort((a, b) => (b.hits - a.hits) || String(a.yours || '9999').localeCompare(String(b.yours || '9999')) || a.key.localeCompare(b.key));
88
+ return { file: path.relative(root, file).split(path.sep).join('/'), watching, slips };
89
+ }
90
+
91
+ function read(root, x = {}, { now = Date.now(), by, via } = {}) {
92
+ const file = fileOf(path.resolve(root));
93
+ if (!file) return { ok: false, error: 'no initiatives folder here (planning/initiatives or pmos/state/initiatives)' };
94
+ if (!KEY_RE.test(x.key || '')) return { ok: false, error: 'name the ticket your work waits on: a Jira key such as SEC-12' };
95
+ if (!isDay(x.theirs) || !isDay(x.likely)) return { ok: false, error: '--theirs and --likely must be days, YYYY-MM-DD' };
96
+ if (x.yours && !isDay(x.yours)) return { ok: false, error: '--yours must be a day, YYYY-MM-DD' };
97
+ const open = TW.waitsOf(path.resolve(root), { today: P.todayOf(now) }).waits;
98
+ if (!open.some((w) => w.key === x.key)) return { ok: false, error: `no open wait is on ${x.key}: PMOS reads only the boards your work waits on (pmos deps wait --key ${x.key} first)` };
99
+ return { ok: true, line: append(file, { kind: 'slip-read', key: x.key, theirs: x.theirs, likely: x.likely, yours: x.yours || '', yours_what: clip(x.yours_what, 80), from: clip(x.from, 60), ...stamp(now, by, via) }) };
100
+ }
101
+
102
+ function handle(root, { key } = {}, { now = Date.now(), by, via, how = 'skip' } = {}) {
103
+ const S = slipsOf(root, { today: P.todayOf(now) });
104
+ const s = S.slips.find((x) => x.key === key);
105
+ if (!s) return { ok: false, error: `no slip on ${key} to act on` };
106
+ return { ok: true, line: append(fileOf(path.resolve(root)), { kind: 'slip-handled', key, likely: s.likely, how: ['shift', 'chase', 'skip'].includes(how) ? how : 'skip', ...stamp(now, by, via) }) };
107
+ }
108
+
109
+ function undo(root, { key } = {}, { now = Date.now(), by, via } = {}) {
110
+ const file = fileOf(path.resolve(root));
111
+ if (!file) return { ok: false, error: 'no initiatives folder here' };
112
+ const s = foldOf(file).get(key);
113
+ if (!s || !s.handled) return { ok: false, error: `nothing to undo on ${key}` };
114
+ return { ok: true, line: append(file, { kind: 'slip-back', key, ...stamp(now, by, via) }) };
115
+ }
116
+
117
+ /** Slips the PM acted on (shift or chase, not skip) in the last `days` days, the latest per key and likely date. */
118
+ function acted(root, { days = 30, now = Date.now() } = {}) {
119
+ const file = fileOf(path.resolve(root));
120
+ if (!file) return 0;
121
+ const since = now - days * DAY;
122
+ const seen = new Set();
123
+ for (const r of jsonl(file)) if (r.kind === 'slip-handled' && r.how !== 'skip' && Date.parse(r.at) >= since) seen.add(r.key + '@' + r.likely);
124
+ return seen.size;
125
+ }
126
+
127
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
128
+ const dayWords = (d) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(d || '')); return m ? `${Number(m[3])} ${MON[Number(m[2]) - 1]}` : ''; };
129
+
130
+ /* ── the needs provider: one Today row, the first slip; the rest are on Work › Dependencies ── */
131
+ function rowsFor(w, { lead } = {}) {
132
+ if (!lead || !w || !w.root) return [];
133
+ const { file, slips } = slipsOf(w.root);
134
+ if (!slips.length) return [];
135
+ const s = slips[0];
136
+ const more = slips.length > 1 ? ` (and ${slips.length - 1} more on Work › Dependencies)` : '';
137
+ const cause = `${s.team} will likely slip to ${dayWords(s.likely)}${s.yours ? `; your ${s.yours_what} is ${dayWords(s.yours)}` : ''}${more}.`;
138
+ return [{
139
+ run_id: `${NAME}:${w.id}:${s.key}:${s.likely}`, kind: 'team-slip', initiative_id: s.ini || null, question: cause, doc: file, ws: w.id,
140
+ today: { kind: 7, source: NAME, cause, evidence: `${s.key} on ${s.from}: was ${s.theirs}, likely ${s.likely}`,
141
+ act: { label: s.move === 'shift' ? `Shift your date to ${dayWords(s.shift_to)}` : `Chase ${s.who || s.team}`, cli: `pmos deps slips` } },
142
+ }];
143
+ }
144
+ function sig(w) {
145
+ if (!w || !w.root) return '';
146
+ const L = P.layoutOf(w.root);
147
+ if (!L) return 'none';
148
+ return [FILE, TW.FILE].map((f) => { try { const st = fs.statSync(path.join(L.runs, f)); return st.size + ':' + st.mtimeMs; } catch { return '-'; } }).join('|') + '@' + P.todayOf();
149
+ }
150
+
151
+ module.exports = { kinds: ['team-slip'], rowsFor, sig, NAME, FILE, TAG, slipsOf, read, handle, undo, acted, dayWords };
152
+
153
+ if (require.main === module) {
154
+ const a = process.argv.slice(2);
155
+ const opt = (k, d) => { const i = a.indexOf('--' + k); return i >= 0 && a[i + 1] !== undefined ? a[i + 1] : d; };
156
+ if (a[0] !== 'acted') { console.log('usage: node lib/team-slips.js acted [--days 30] [--root <dir>]'); process.exit(2); }
157
+ const days = Number(opt('days', 30)) || 30;
158
+ console.log(`${TAG} slips acted on in the last ${days} days`);
159
+ console.log(String(acted(opt('root', process.cwd()), { days })));
160
+ }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.836.0",
3
+ "version": "0.837.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.836.0",
9
+ "version": "0.837.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.836.0",
3
+ "version": "0.837.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",
@@ -192,12 +192,30 @@ export function target(c) {
192
192
  if (l === 'field') { if (c.field) facts.push(['Field', c.field]); if (c.at) facts.push(['Place', c.at]); facts.push(['Shows', c.value]); }
193
193
  const subject = l === 'field' ? [c.field || c.at, c.value].filter(Boolean).join(': ') : '';
194
194
  return {
195
- id: c.record.id, kind: c.record.kind.replace(/\s+/g, '-'), title: c.record.title || c.record.id, subject,
195
+ id: c.record.id, kind: c.record.kind.replace(/\s+/g, '-'), title: c.record.title || c.record.id, subject, where: l === 'field' ? (c.field || c.at) : '',
196
196
  say: 'The PM pressed ' + (l === 'field' ? (c.field || c.at || 'part') + ' of ' : '') + 'the ' + c.record.kind + ' "' + (c.record.title || c.record.id) + '" on ' + (c.page || 'this page') + '. Read that record with pmos before you answer.'
197
197
  + (c.record.kind === 'person' ? ' For a 1:1, run `pmos people prep "' + (c.record.title || c.record.id) + '"` and answer from its lines, with their sources.' : ''),
198
198
  facts: facts.filter((f) => clean(f[1])),
199
199
  };
200
200
  }
201
+ /** Where the card sits (done test U1): beside the press, under it by 14 px, above it when there is no room below, always 8 px inside the
202
+ * window. size: { width, height } of the card; at: { x, y } of the press (the window's middle third when absent). → { left, top } */
203
+ export function placeAt(size, at, W, H) {
204
+ const w = Number(size && size.width) || 0, h = Number(size && size.height) || 0;
205
+ const x = at && Number.isFinite(at.x) ? at.x : W / 2, y = at && Number.isFinite(at.y) ? at.y : H / 3;
206
+ const left = Math.max(8, Math.min(x - 40, W - w - 8));
207
+ let top = y + 14;
208
+ if (top + h > H - 8) top = Math.max(8, y - h - 14);
209
+ return { left: Math.round(left), top: Math.round(top) };
210
+ }
211
+ /** Where a dragged card goes (Wawan 2026-11-25: "move this popup freely"): the pointer's place less where it was held, kept so at least
212
+ * 48 px of the card, and all of its top line, stay in the window. at: { x, y } of the card's top-left; size: { width, height }. */
213
+ export function dragTo(at, size, W, H) {
214
+ const w = Number(size && size.width) || 0;
215
+ const left = Math.min(Math.max(48 - w, Math.round(at.x)), W - 48);
216
+ const top = Math.min(Math.max(0, Math.round(at.y)), H - 48);
217
+ return { left, top };
218
+ }
201
219
  /** The words for the chat when nothing narrower than a section or the page was pressed. */
202
220
  export function hereWords(c) { return [c && c.page, c && c.section].filter(Boolean).join(' · '); }
203
221
 
@@ -296,7 +314,7 @@ export function nativeMenu(el, o = {}) {
296
314
  /** The presses that open the Ask card (cozy-nav.js mountNav calls it once per page). A right-click outside nativeMenu's places opens it at
297
315
  * the pointer; a phone's long-press (LONG_MS still, under MOVE_PX of movement) opens it as a sheet and eats the click that follows. The
298
316
  * card's own module loads on the first press (load: () => import('./ask-here.js')), so a page that is never pressed pays nothing. */
299
- export const LONG_MS = 600, MOVE_PX = 10;
317
+ export const LONG_MS = 500, MOVE_PX = 10;
300
318
  /** Places where a press and hold already means something (pick rows, drag to order, tick a check): a long-press there is theirs. */
301
319
  export const HOLDS = '[data-pw-row], [data-iv-edit][data-drag], [data-iv-check], .bk-i, [data-po-list] [data-po-id], .gl-tip';
302
320
  export function wire(document, load) { // the page's own document (a test passes a stand-in)
@@ -4,7 +4,11 @@
4
4
  .ah-card { position: fixed; left: var(--bd-ahx, 8px); top: var(--bd-ahy, 8px); z-index: 2147483000; width: 392px; max-width: calc(100vw - 16px); max-height: min(640px, calc(100vh - 16px)); display: flex; flex-direction: column;
5
5
  background: var(--cz-card); color: var(--cz-ink); border-radius: 8px; box-shadow: var(--cz-lift), 0 0 0 1px var(--cz-hair);
6
6
  font-family: var(--cz-sans); font-size: var(--fs-body); line-height: var(--lh-body); overflow: hidden; }
7
- .ah-hd { display: flex; align-items: center; gap: 2px; padding: 10px 6px 6px 12px; }
7
+ .ah-hd { display: flex; align-items: center; gap: 2px; padding: 10px 6px 6px 12px; cursor: grab; touch-action: none; } /* hold the top line to move the card */
8
+ .ah-card.moving { user-select: none; } .ah-card.moving .ah-hd { cursor: grabbing; }
9
+ .ah-card.sheet .ah-hd { cursor: auto; }
10
+ /* a small card reads smaller than a page (Wawan 2026-11-25: "the font is too big"); the size the person picks in a chat's + menu wins */
11
+ html:not([data-chat-fs]) .ah-card { --chat-k: .87; }
8
12
  .ah-crumb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
9
13
  .ah-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 26px; padding: 0 10px; border-radius: 6px; background: var(--cz-well); font-size: var(--fs-meta);
10
14
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@@ -17,6 +21,7 @@
17
21
  .ah-icb[disabled] { opacity: .35; cursor: default; }
18
22
  .ah-bd { padding: 2px 12px 8px; display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; }
19
23
  .ah-sug { display: flex; flex-direction: column; gap: 2px; }
24
+ .ah-sug[hidden], .ah-do[hidden] { display: none; } /* gone once a question is asked (Wawan 2026-11-25) */
20
25
  .ah-sug button { all: unset; display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--cz-ink); font-size: var(--fs-body); }
21
26
  .ah-sug button:focus-visible { outline: 2px solid var(--cz-blue); }
22
27
  .ah-sug svg { color: var(--cz-ok); flex: none; }
@@ -79,6 +79,7 @@ export async function open(el, o = {}) {
79
79
  sheet();
80
80
  const ctx = C.resolve(el, { scope: scopeOf(el), page: pageWords() });
81
81
  if (!ctx) return false;
82
+ S.moved = false;
82
83
  S.ctx = ctx; S.el = el; S.ws = wsOf(el); S.row = undefined; S.key += 1; S.today = new Date().toISOString().slice(0, 10);
83
84
  const card = document.createElement('section');
84
85
  card.className = 'ah-card' + (o.sheet ? ' sheet' : '');
@@ -159,11 +160,11 @@ async function mountChat() {
159
160
  holder.appendChild(el);
160
161
  chat.open(await targetOf());
161
162
  }
163
+ function hideSug(card) { for (const id of ['#ahSug', '#ahDo']) { const el = card && card.querySelector(id); if (el) el.hidden = true; } }
162
164
  function ask(q) {
163
165
  const holder = S.card && S.card.querySelector('#ahChat'); if (!holder) return;
164
166
  holder.classList.remove('quiet');
165
- const sug = S.card.querySelector('#ahSug'); if (sug) sug.hidden = true;
166
- const can = S.card.querySelector('#ahDo'); if (can) can.hidden = true;
167
+ hideSug(S.card);
167
168
  const ta = holder.querySelector('textarea'), form = holder.querySelector('form.hm-box');
168
169
  if (!ta || !form) return;
169
170
  ta.value = q; ta.dispatchEvent(new Event('input', { bubbles: true }));
@@ -177,32 +178,44 @@ async function full() {
177
178
  return M.openAbout(t);
178
179
  }
179
180
  function place(o) {
180
- const card = S.card; if (!card || o.sheet) return;
181
- const r = card.getBoundingClientRect(), W = innerWidth, H = innerHeight;
182
- const x = Number.isFinite(o.x) ? o.x : W / 2, y = Number.isFinite(o.y) ? o.y : H / 3;
183
- let left = Math.min(Math.max(8, x - 40), W - r.width - 8), top = y + 14;
184
- if (top + r.height > H - 8) top = Math.max(8, y - r.height - 14);
185
- card.style.setProperty('--bd-ahx', Math.round(left) + 'px'); card.style.setProperty('--bd-ahy', Math.round(top) + 'px');
181
+ const card = S.card; if (!card || o.sheet || S.moved) return;
182
+ const { left, top } = C.placeAt(card.getBoundingClientRect(), o, innerWidth, innerHeight);
183
+ card.style.setProperty('--bd-ahx', left + 'px'); card.style.setProperty('--bd-ahy', top + 'px');
186
184
  }
187
185
  // one click listener on the document for every card (a card's own buttons are real <button>s; the listener only routes them)
188
186
  let routed = false;
189
- function wireCard() {
190
- if (routed) return; routed = true;
191
- document.addEventListener('click', async (e) => {
192
- const card = S.card; if (!card || !e.target || !e.target.closest || !card.contains(e.target)) return;
193
- const b = e.target.closest('button'); if (!b) return;
194
- if (S.CU && S.CU.owns(b)) { e.preventDefault(); await S.CU.press(b); return; }
195
- const a = b.getAttribute('data-ah');
196
- if (a === 'x') { close(); return; }
197
- if (a === 'full') { full(); return; }
198
- if (a === 'up') { const w = C.widen(S.ctx); if (w) { S.ctx = w; S.row = undefined; S.key += 1; noteUse('ask-here-widen'); putChatBack(); draw(); } return; }
199
- const q = b.getAttribute('data-ah-q'); if (q) { noteUse('ask-here-question'); ask(q); return; }
200
- const d = b.getAttribute('data-ah-do'); if (d) { noteUse('ask-here-do'); ask(d); }
201
- });
202
- card.addEventListener('input', (e) => { if (e.target && e.target.matches('textarea')) card.querySelector('#ahChat').classList.remove('quiet'); });
187
+ function wireCard(card) {
188
+ if (!routed) {
189
+ routed = true;
190
+ document.addEventListener('click', async (e) => {
191
+ const c = S.card; if (!c || !e.target || !e.target.closest || !c.contains(e.target)) return;
192
+ const b = e.target.closest('button'); if (!b) return;
193
+ if (S.CU && S.CU.owns(b)) { e.preventDefault(); await S.CU.press(b); return; }
194
+ const a = b.getAttribute('data-ah');
195
+ if (a === 'x') { close(); return; }
196
+ if (a === 'full') { full(); return; }
197
+ if (a === 'up') { const w = C.widen(S.ctx); if (w) { S.ctx = w; S.row = undefined; S.key += 1; noteUse('ask-here-widen'); putChatBack(); draw(); } return; }
198
+ const q = b.getAttribute('data-ah-q'); if (q) { noteUse('ask-here-question'); ask(q); return; }
199
+ const d = b.getAttribute('data-ah-do'); if (d) { noteUse('ask-here-do'); ask(d); }
200
+ });
201
+ }
202
+ // every card gets its own Esc and press-outside (close() takes them off again): a second card closes on Esc like the first
203
+ card.addEventListener('submit', () => hideSug(card)); // a typed question too: the ✦ lines have done their part
204
+ card.addEventListener('input', (e) => { if (e.target && e.target.matches && e.target.matches('textarea')) { const h = card.querySelector('#ahChat'); if (h) h.classList.remove('quiet'); } });
205
+ const drag = (e) => {
206
+ const c = S.card; if (!c || c.classList.contains('sheet') || e.button !== 0 || !e.target.closest) return;
207
+ const hd = e.target.closest('.ah-hd'); if (!hd || !c.contains(hd) || e.target.closest('button')) return;
208
+ e.preventDefault();
209
+ const r = c.getBoundingClientRect(), dx = e.clientX - r.left, dy = e.clientY - r.top;
210
+ c.classList.add('moving');
211
+ const mv = (m) => { const p = C.dragTo({ x: m.clientX - dx, y: m.clientY - dy }, r, innerWidth, innerHeight); S.moved = true; c.style.setProperty('--bd-ahx', p.left + 'px'); c.style.setProperty('--bd-ahy', p.top + 'px'); };
212
+ const up = () => { c.classList.remove('moving'); document.removeEventListener('pointermove', mv, true); document.removeEventListener('pointerup', up, true); };
213
+ document.addEventListener('pointermove', mv, true); document.addEventListener('pointerup', up, true);
214
+ };
215
+ document.addEventListener('pointerdown', drag, true);
203
216
  const esc = (e) => { if (e.key === 'Escape' && S.card) { e.stopPropagation(); close(); } };
204
- const outside = (e) => { if (S.card && !S.card.contains(e.target) && !e.target.closest('.cz-pop-card, .cz-vw, [data-esc-layer]')) close(); };
217
+ const outside = (e) => { if (S.card && !S.card.contains(e.target) && !(e.target.closest && e.target.closest('.cz-pop-card, .cz-vw, [data-esc-layer]'))) close(); };
205
218
  window.addEventListener('keydown', esc, true);
206
- setTimeout(() => document.addEventListener('pointerdown', outside, true), 0);
207
- S.off = () => { window.removeEventListener('keydown', esc, true); document.removeEventListener('pointerdown', outside, true); };
219
+ const t = setTimeout(() => document.addEventListener('pointerdown', outside, true), 0);
220
+ S.off = () => { clearTimeout(t); document.removeEventListener('pointerdown', drag, true); window.removeEventListener('keydown', esc, true); document.removeEventListener('pointerdown', outside, true); };
208
221
  }
@@ -21,8 +21,9 @@ import * as WS from './work-select.js'; // the bulk move with one Undo, shared
21
21
  import * as IF from './inline-fields.js'; // a task's sprint and priority, set in the row (initiative inline-sprint-priority)
22
22
  import * as LE from './live-edit.js'; // a task's status or days show at once in the list, before it is read again; a failed save is put back
23
23
  import { noteUse } from './use-log.js'; // the sprint draft's presses, counted on this computer only (sprint-draft-capacity)
24
- import { pmGet } from './http.js'; // Work › Factory and Work › Dependencies read through the page's own GET helper
24
+ import { pmGet, pmPost } from './http.js'; // Work › Factory and Work › Dependencies read through the page's own GET helper
25
25
  import * as TWV from './team-waits.js'; // team-waits (A364): Work › Dependencies, the waits on other teams (GET /api/team-waits)
26
+ import * as TSV from './team-slips.js'; // team-slips (A15): Upstream on Work › Dependencies, other teams' slips (GET /api/team-slips)
26
27
  import * as LV from './line-view.js'; // quiet-rows slice B: the Line tab, every initiative by station (GET /api/line)
27
28
  import * as FV from './factory.js'; // Work › Factory (factory-page-ui): the stations and the work they make, from GET /api/factory
28
29
  import * as LB from './list-balance.js'; // the balance meter under the Backlog header (bet A448, board BalanceDS) // quiet-rows slice B: the Line tab, every initiative by station (GET /api/line)
@@ -241,11 +242,13 @@ function factoryPress(e) {
241
242
  return !!e.target.closest('.ff');
242
243
  }
243
244
  /* ── the Dependencies tab (team-waits, board BatchCodeDS panel 14) ── the pick's waits on other teams, from GET /api/team-waits ── */
244
- const DP = { got: null, key: '', used: false, rows: [] };
245
+ const DP = { got: null, key: '', used: false, rows: [], slips: [], undo: null };
245
246
  async function readDeps() {
246
247
  const ws = [...new Set(A.scope().map((s) => s.ws || ''))];
247
- const got = await Promise.all(ws.map((w) => pmGet('/api/team-waits' + (w ? '?ws=' + encodeURIComponent(w) : '')).catch(() => null)));
248
- return got.filter((r) => r && r.ok).map((r) => ({ ws: r.ws, today: r.today, waits: (r.waits || []).map((x) => ({ ...x, ws: r.ws })) }));
248
+ const q = (w) => (w ? '?ws=' + encodeURIComponent(w) : '');
249
+ const got = await Promise.all(ws.map((w) => Promise.all([pmGet('/api/team-waits' + q(w)).catch(() => null), pmGet('/api/team-slips' + q(w)).catch(() => null)])));
250
+ return got.filter(([r]) => r && r.ok).map(([r, s]) => ({ ws: r.ws, today: r.today, waits: (r.waits || []).map((x) => ({ ...x, ws: r.ws })),
251
+ watching: s && s.ok ? s.watching || 0 : 0, slips: s && s.ok ? (s.slips || []).map((x) => ({ ...x, ws: r.ws })) : [] }));
249
252
  }
250
253
  function drawDeps() {
251
254
  if (!host) return;
@@ -259,11 +262,37 @@ function drawDeps() {
259
262
  const today = (DP.got[0] || {}).today || '';
260
263
  const waits = DP.got.flatMap((g) => g.waits).sort((a, b) => String(a.since).localeCompare(String(b.since)));
261
264
  DP.rows = TWV.rowsOf(waits, { today });
262
- host.innerHTML = TWV.waitsHtml(DP.rows) || '<p class="bk-wait">Nothing waits on another team.</p>';
265
+ DP.slips = TSV.rowsOf(DP.got.flatMap((g) => g.slips || []));
266
+ const watching = DP.got.reduce((n, g) => n + (g.watching || 0), 0);
267
+ const undo = DP.undo ? `<p class="bk-wait" role="status">${TWV.esc(DP.undo.said)} <button type="button" class="pm-btn" data-ts-undo="1">Undo</button></p>` : '';
268
+ host.innerHTML = undo + TSV.slipsHtml(DP.slips, { watching }) + (TWV.waitsHtml(DP.rows) || '<p class="bk-wait">Nothing waits on another team.</p>');
269
+ }
270
+ /** A press on an Upstream slip (team-slips): ✦ shifts (opens the initiative) or chases (a mail draft); ✕ waves it off. The row goes, with Undo. */
271
+ function slipPress(e) {
272
+ const u = e.target.closest('[data-ts-undo]');
273
+ if (u) {
274
+ const was = DP.undo; DP.undo = null;
275
+ if (was) pmPost('/api/team-slips/undo', { ws: was.ws, key: was.key }).then(() => { DP.got = null; if (depsOn()) drawDeps(); });
276
+ return true;
277
+ }
278
+ const b = e.target.closest('[data-ts-go],[data-ts-skip]');
279
+ if (!b) return false;
280
+ const r = DP.slips[Number(b.dataset.tsGo !== undefined ? b.dataset.tsGo : b.dataset.tsSkip)];
281
+ if (!r) return true;
282
+ const how = b.dataset.tsGo !== undefined ? r.move : 'skip';
283
+ if (how === 'shift' && A && A.openIni && r.ini) A.openIni(r.ini, r.ws); // its owner moves the date there: PMOS writes no date
284
+ else if (how === 'chase') location.href = TSV.chaseDraft(r.chase).mailto;
285
+ console.info(`[team-slips] ${how} ${r.key}`);
286
+ pmPost('/api/team-slips/handle', { ws: r.ws, key: r.key, how }).then((x) => {
287
+ if (x && x.ok) DP.undo = { ws: r.ws, key: r.key, said: how === 'skip' ? `Waved off ${r.key}.` : `${r.act}: done.` };
288
+ DP.got = null; if (depsOn()) drawDeps();
289
+ });
290
+ return true;
263
291
  }
264
292
  /** A press in the Dependencies tab: Chase opens a draft in the PM's own mail app. PMOS sends nothing. true when it was one. */
265
293
  function depsPress(e) {
266
294
  if (!depsOn()) return false;
295
+ if (slipPress(e)) return true;
267
296
  const b = e.target.closest('[data-tw-chase]');
268
297
  if (!b) return false;
269
298
  const r = DP.rows[Number(b.dataset.twChase)];
@@ -0,0 +1,16 @@
1
+ /* built-vs-design.css — the work popup's Review block (pm/built-vs-design.js). Tokens only. */
2
+ .bvd-rv { display: flex; flex-direction: column; gap: var(--space-8); }
3
+ .bvd-rv + .bvd-rv { border-top: 1px solid var(--line); padding-top: var(--space-12); }
4
+ .bvd-hd { justify-content: space-between; }
5
+ .bvd-two { display: flex; gap: var(--space-8); }
6
+ .bvd-fig { flex: 1 1 0; min-width: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-4); }
7
+ .bvd-pic { position: relative; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line); overflow: visible; background: var(--card); }
8
+ .bvd-pic img { display: block; width: 100%; height: auto; }
9
+ .bvd-marks { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
10
+ .bvd-marks ellipse { fill: none; stroke: var(--alert); stroke-width: 2; vector-effect: non-scaling-stroke; }
11
+ .bvd-marks text { fill: var(--alert); font-size: var(--fs-label); font-weight: var(--fw-strong); }
12
+ .bvd-ring.sent ellipse { stroke: var(--muted); }
13
+ .bvd-ring.sent text { fill: var(--muted); }
14
+ .bvd-list { list-style: none; margin: 0; padding: 0; }
15
+ .bvd-n { color: var(--alert); font-weight: var(--fw-strong); min-width: 1.5em; }
16
+ @media (max-width: 760px) { .bvd-two { flex-direction: column; } }
@@ -0,0 +1,95 @@
1
+ /* pm/built-vs-design.js — the work popup's Review block: the built screen beside the design it came from (initiative built-vs-design, job
2
+ * #1903, idea A380; agreed board BatchDesignDS panel 17). The data is GET /api/built-vs-design (lib/built-vs-design-http.js); `pmos review`
3
+ * writes the same store, so a review the chat makes shows here on the next read.
4
+ *
5
+ * read(ini, ws, redraw) GET once per initiative (again after reset()); redraw() when a review came back
6
+ * reset() forget what was read (a chat turn may have written a review)
7
+ * html(ini, ws) PURE over what read() kept → the Review block, '' when there is no open review (zero is silence)
8
+ * blockHtml(reviews, ws) PURE → the block for these reviews
9
+ * press(b, h) → true when b is one of the block's buttons: ✓ Accept, ↩ Send back as a fix; each with Undo in h.toast
10
+ *
11
+ * Design and Built side by side; on Built, each difference is a numbered circle where it is; the numbered lines under them. Matching parts
12
+ * get no mark. Built from the system's parts (pm-block, pm-h-sm, pm-li, pm-btn, pm-meta); icon-only buttons with an aria-label. The UI says
13
+ * PMOS, never Claude. Each press notes the use-log control builtVsDesign (the health number). */
14
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
15
+ const SV = (d, w = 16) => `<svg class="pm-ic" aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
16
+ const I = { ok: 'M5 12.5l4.5 4.5L19 7.5', back: 'M9 14L4 9l5-5M4 9h11a5 5 0 0 1 0 10h-3' };
17
+ const f01 = (v) => Math.max(0, Math.min(1, Number(v) || 0));
18
+ const SHOWN = 420;
19
+ const n1 = (v) => (Math.round(v * 10) / 10).toString();
20
+
21
+ const CSS = typeof document !== 'undefined' && typeof URL !== 'undefined' ? new URL('./built-vs-design.css', import.meta.url).href : '';
22
+ if (CSS && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
23
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
24
+ }
25
+
26
+ const READ = new Map(); // initiative id → [review] | null while reading | false when there is none
27
+ const http = () => import('./http.js');
28
+ export function reset() { READ.clear(); }
29
+ export function read(ini, ws, redraw) {
30
+ if (!ini || READ.has(ini)) return;
31
+ READ.set(ini, null);
32
+ http().then(({ pmGet }) => pmGet('/api/built-vs-design?ini=' + encodeURIComponent(ini) + (ws ? '&ws=' + encodeURIComponent(ws) : '')))
33
+ .then((x) => { const L = x && x.ok && Array.isArray(x.reviews) && x.reviews.length ? x.reviews : false; READ.set(ini, L); if (L && redraw) redraw(); })
34
+ .catch(() => READ.set(ini, false));
35
+ }
36
+ export function html(ini, ws) { const L = READ.get(ini); return L ? blockHtml(L, ws) : ''; }
37
+
38
+ const shot = (ws, r, which) => '/api/built-vs-design/shot?' + new URLSearchParams({ ...(ws ? { ws } : {}), pair: r.id, which }).toString();
39
+ function reviewHtml(r, ws) {
40
+ const diffs = r.diffs || [];
41
+ // the circles are an SVG over the built screen in its own pixels (no inline style): an ellipse round each box (the box grown by √2, so the
42
+ // ellipse passes outside its corners) and its number at the top right
43
+ const W = Number(r.w) > 0 ? Number(r.w) : 1000, H = Number(r.h) > 0 ? Number(r.h) : 1000;
44
+ // the number keeps its type size: the screen is drawn about SHOWN px wide, so a wider screenshot scales its number up by W / SHOWN
45
+ const k = Math.max(1, W / SHOWN);
46
+ const marks = diffs.length ? `<svg class="bvd-marks" viewBox="0 0 ${W} ${H}" aria-hidden="true">${diffs.map((d) => {
47
+ const x = f01(d.x) * W, y = f01(d.y) * H, w = f01(d.w) * W, h = f01(d.h) * H, rx = Math.max(8, w * 0.71), ry = Math.max(8, h * 0.71);
48
+ return `<g class="bvd-ring${d.task ? ' sent' : ''}" data-n="${esc(d.n)}"><ellipse cx="${n1(x + w / 2)}" cy="${n1(y + h / 2)}" rx="${n1(rx)}" ry="${n1(ry)}"/><text transform="translate(${n1(x + w / 2 + rx * 0.72)} ${n1(y + h / 2 - ry * 0.72)}) scale(${n1(k)})">${esc(d.n)}</text></g>`;
49
+ }).join('')}</svg>` : '';
50
+ const pic = (which, label, extra) => `<figure class="bvd-fig"><figcaption class="pm-meta">${label}</figcaption><div class="bvd-pic"><img src="${esc(shot(ws, r, which))}" alt="${esc(label + ' of ' + r.screen)}" loading="lazy">${extra}</div></figure>`;
51
+ const list = diffs.length
52
+ ? `<ol class="bvd-list" aria-label="Differences">${diffs.map((d) => `<li class="pm-li bvd-li"><span class="bvd-n" aria-hidden="true">${esc(d.n)}</span><span class="txt">${esc(d.words)}${d.task ? ' <span class="pm-meta">· sent back as a fix</span>' : ''}</span>`
53
+ + `<button type="button" class="pm-btn ghost sm" data-bvd-fix="${esc(d.n)}" data-bvd-pair="${esc(r.id)}" data-bvd-ini="${esc(r.ini)}" data-bvd-undo="${d.task ? '1' : ''}" aria-label="${esc(d.task ? 'Take back the fix for difference ' + d.n : 'Send difference ' + d.n + ' back as a fix')}" title="${esc(d.task ? 'Take back the fix' : 'Send back as a fix')}" aria-pressed="${d.task ? 'true' : 'false'}">${SV(I.back, 14)}</button></li>`).join('')}</ol>`
54
+ + (r.more ? `<p class="pm-meta">${esc(r.more === 1 ? '1 more difference, not circled.' : r.more + ' more differences, not circled.')}</p>` : '')
55
+ : '<p class="pm-meta">Matches its design.</p>';
56
+ const ok = `<button type="button" class="pm-btn primary sm" data-bvd-accept="${esc(r.id)}" data-bvd-ini="${esc(r.ini)}" aria-label="${esc('Accept the built ' + r.screen)}" title="Accept">${SV(I.ok, 14)}</button>`;
57
+ return `<div class="bvd-rv" data-bvd="${esc(r.id)}"><div class="pm-row bvd-hd"><b class="bvd-sc">${esc(r.screen)}</b>${ok}</div>`
58
+ + `<div class="bvd-two">${pic('design', 'Design', '')}${pic('built', 'Built', marks)}</div>${list}</div>`;
59
+ }
60
+ export function blockHtml(reviews, ws) {
61
+ const L = (reviews || []).filter((r) => r && r.id);
62
+ if (!L.length) return '';
63
+ return `<section class="pm-block pwd-blk bvd" aria-label="Review"><h2 class="pm-h-sm">Review</h2>${L.map((r) => reviewHtml(r, ws)).join('')}</section>`;
64
+ }
65
+
66
+ const where = (h) => (h && h.where ? h.where() || {} : {});
67
+ async function post(h, body) { const { pmPost } = await http(); return pmPost('/api/built-vs-design', { ws: where(h).ws, ...body }).catch(() => null); }
68
+ async function used() { try { (await import('./use-log.js')).noteUse('builtVsDesign'); } catch { /* a count, never a reason to fail */ } }
69
+ const say = (h, m, undo) => { if (h && h.toast) h.toast(m, undo); };
70
+ const again = (h, ini) => { READ.delete(ini); if (h && h.redraw) h.redraw(); };
71
+ /** A press on the block: true when it was one of its buttons. */
72
+ export function press(b, h) {
73
+ const d = b && b.dataset;
74
+ if (!d || (d.bvdAccept == null && d.bvdFix == null)) return false;
75
+ const ini = d.bvdIni;
76
+ b.disabled = true;
77
+ (async () => {
78
+ if (d.bvdAccept != null) {
79
+ const pair = d.bvdAccept, res = await post(h, { ini, pair, act: 'accept' });
80
+ if (!res || res.ok === false) { b.disabled = false; say(h, (res && res.error) || 'The review was not accepted.'); return; }
81
+ used(); again(h, ini);
82
+ say(h, 'Accepted.', async () => { const u = await post(h, { ini, pair, act: 'reopen' }); if (!u || u.ok === false) say(h, (u && u.error) || 'The undo did not land.'); again(h, ini); });
83
+ return;
84
+ }
85
+ const pair = d.bvdPair, n = Number(d.bvdFix), undo = d.bvdUndo === '1';
86
+ const res = await post(h, { ini, pair, n, act: undo ? 'unfix' : 'fix' });
87
+ if (!res || res.ok === false) { b.disabled = false; say(h, (res && res.error) || 'Nothing was changed.'); return; }
88
+ if (!undo) used();
89
+ again(h, ini); if (h && h.reload) h.reload();
90
+ say(h, undo ? 'The fix was taken back.' : 'Sent back: ' + (res.title || 'a fix task was added') + '.', undo ? undefined : async () => {
91
+ const u = await post(h, { ini, pair, n, act: 'unfix' }); if (!u || u.ok === false) say(h, (u && u.error) || 'The undo did not land.'); again(h, ini); if (h && h.reload) h.reload();
92
+ });
93
+ })();
94
+ return true;
95
+ }
@@ -199,7 +199,7 @@ export function todayHtml(rows, o = {}) {
199
199
  const ev = (x) => {
200
200
  const over = now && (x.until || x.time) < now;
201
201
  const fixLine = !!x.suggest;
202
- return `<div class="evp-tr${o.busy && o.busy.has(x.key) ? ' busy' : ''}" data-key="${esc(x.key)}" data-kind="${esc(x.kind)}" data-type="${esc(typeOf(x))}"><span class="evp-tm pm-meta">${esc(x.time || (x.kind === 'meeting' ? 'All day' : 'Due'))}</span>`
202
+ return `<div class="evp-tr${o.busy && o.busy.has(x.key) ? ' busy' : ''}" data-key="${esc(x.key)}" data-kind="${esc(x.kind)}" data-type="${esc(typeOf(x))}"${askOf(x)}><span class="evp-tm pm-meta">${esc(x.time || (x.kind === 'meeting' ? 'All day' : 'Due'))}</span>`
203
203
  + `<div class="evp-ev pm-ev${over ? ' over' : ''}${x.fixed ? ' fixed' : ''}">${markHtml(x)}${whatHtml(x, o, fixLine)}${actsHtml(x, o, fixLine)}</div></div>${srcHtml(x, o)}`;
204
204
  };
205
205
  const line = '<div class="evp-tr evp-nowl" aria-label="Now"><span class="evp-tm pm-meta">now</span><span class="evp-nl" aria-hidden="true"></span></div>';
@@ -171,6 +171,16 @@ body.cz-home { min-height: 100vh; overflow: hidden; }
171
171
  /* with the Viewer closed the conversation and its box sit in a centred column about 880px wide (AgInitStalled); the reopen button stays at
172
172
  * the top right, and where the column reaches it the log keeps its first line clear of it */
173
173
  .hm-chat { container-type: inline-size; }
174
+ /* the chat's text size (pmos.chat.fs, the + menu): the chat's type roles scale from the system's own sizes; Normal is the system size */
175
+ .hm-chat, .ah-card { --fs-body: calc(var(--type-body) * var(--chat-k, 1)); --fs-row: calc(var(--type-body) * var(--chat-k, 1)); --fs-field: calc(16px * var(--chat-k, 1));
176
+ --fs-meta: calc(var(--type-small) * var(--chat-k, 1)); --fs-label: calc(var(--type-small) * var(--chat-k, 1)); --fs-badge: calc(var(--type-small) * var(--chat-k, 1)); }
177
+ html[data-chat-fs="s"] { --chat-k: .87; }
178
+ html[data-chat-fs="l"] { --chat-k: 1.13; }
179
+ .hm-fsz { display: flex; align-items: center; gap: 4px; padding: 6px 8px 4px; border-top: 1px solid var(--cz-hair); margin-top: 4px; }
180
+ .hm-fsz b { flex: 1; font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink2); }
181
+ .hm-pmenu .hm-fsb { flex: none; width: 36px; height: 32px; background: none; color: var(--cz-ink); cursor: pointer; text-align: center; font-weight: var(--fw-strong); }
182
+ .hm-fsb.fs-s { font-size: var(--fs-meta); } .hm-fsb.fs-m { font-size: var(--fs-body); } .hm-fsb.fs-l { font-size: var(--fs-panel); }
183
+ .hm-fsb.on { background: var(--cz-okbg); box-shadow: inset 0 0 0 1px var(--cz-ok); }
174
184
  @media (min-width: 761px) {
175
185
  /* the log scrolls at the panel's edge, not at the column's (PM, 2026-10-27 "Bad layout": the scrollbar stood in the middle of the page);
176
186
  * its content and the header line keep to the same centred column as the box */