create-pmos 0.396.0 → 0.398.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 (177) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/scripts/nine-stages.js +49 -20
  6. package/payload/state/discoveries.md +1 -1
  7. package/payload/state/log.md +1 -1
  8. package/workspace/briefing-premium-adddoc-test.js +103 -74
  9. package/workspace/briefing-premium-board-test.js +316 -154
  10. package/workspace/briefing-premium-calendar-2-test.js +135 -195
  11. package/workspace/briefing-premium-calendar-3-test.js +143 -413
  12. package/workspace/briefing-premium-calendar-test.js +86 -185
  13. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  14. package/workspace/briefing-premium-initiative-test.js +166 -294
  15. package/workspace/briefing-premium-insights-test.js +351 -214
  16. package/workspace/briefing-premium-metrics-test.js +53 -118
  17. package/workspace/briefing-premium-products-test.js +40 -27
  18. package/workspace/briefing-premium-sources-test.js +91 -52
  19. package/workspace/briefing-premium-test.js +150 -633
  20. package/workspace/briefing-premium-work-test.js +88 -269
  21. package/workspace/changelog.json +24 -0
  22. package/workspace/fixtures/board-premium-facts.js +2 -1
  23. package/workspace/fixtures/board-premium-jira.js +28 -0
  24. package/workspace/fixtures/board-premium-trail.js +32 -0
  25. package/workspace/fixtures/initiative-premium-facts.js +2 -1
  26. package/workspace/fixtures/initiatives-api/list.json +30 -42
  27. package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
  28. package/workspace/fixtures/initiatives-api/sheet.json +10 -14
  29. package/workspace/fixtures/insights-premium-facts.js +11 -2
  30. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  31. package/workspace/guide/briefing-premium.md +3 -1
  32. package/workspace/guide/home.md +47 -0
  33. package/workspace/guide/index.md +2 -0
  34. package/workspace/guide/lifecycle.md +51 -0
  35. package/workspace/home-shot.js +38 -0
  36. package/workspace/lib/agent-roles.js +71 -0
  37. package/workspace/lib/board-premium.js +160 -3
  38. package/workspace/lib/board-trail.js +223 -0
  39. package/workspace/lib/engine/boards.js +15 -14
  40. package/workspace/lib/engine/nine-stages.js +49 -20
  41. package/workspace/lib/engine/signals/detectors.js +13 -11
  42. package/workspace/lib/home-work-item.js +58 -0
  43. package/workspace/lib/insights-goals.js +196 -0
  44. package/workspace/lib/insights-premium.js +126 -1
  45. package/workspace/lib/insights-records.js +101 -0
  46. package/workspace/lib/jira-tickets.js +1 -1
  47. package/workspace/lib/route-modules.js +4 -0
  48. package/workspace/lib/routes-board-premium.js +3 -2
  49. package/workspace/lib/routes-board-trail.js +33 -0
  50. package/workspace/lib/routes-home-desk.js +176 -0
  51. package/workspace/lib/routes-initiatives.js +1 -1
  52. package/workspace/lib/routes-insights-premium.js +19 -3
  53. package/workspace/lib/routes-insights-records.js +129 -0
  54. package/workspace/lib/routes-notes.js +1 -0
  55. package/workspace/lib/routes-viewer.js +108 -0
  56. package/workspace/lib/transcript-steps.js +123 -0
  57. package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
  58. package/workspace/lib/viewer-meeting.js +205 -0
  59. package/workspace/lib/viewer-report.js +89 -0
  60. package/workspace/package-lock.json +2 -2
  61. package/workspace/package.json +1 -1
  62. package/workspace/premium-agreed-viewer-shots.js +76 -0
  63. package/workspace/premium-board-actions-test.js +85 -73
  64. package/workspace/premium-briefing-depth-test.js +66 -53
  65. package/workspace/premium-chat-attach-test.js +54 -63
  66. package/workspace/premium-chat-chart-tab-test.js +35 -36
  67. package/workspace/premium-chat-context-test.js +22 -19
  68. package/workspace/premium-chat-goal-view-test.js +28 -26
  69. package/workspace/premium-chat-notes-test.js +29 -33
  70. package/workspace/premium-chat-report-tab-test.js +35 -25
  71. package/workspace/premium-chat-term-test.js +16 -14
  72. package/workspace/premium-chat-viewer-test.js +60 -53
  73. package/workspace/premium-core-doc-issue-test.js +50 -41
  74. package/workspace/premium-html-viewer-test.js +17 -18
  75. package/workspace/premium-phone-card-test.js +8 -2
  76. package/workspace/premium-phone-room-test.js +42 -31
  77. package/workspace/premium-report-read-test.js +115 -197
  78. package/workspace/premium-viewer-download-test.js +19 -22
  79. package/workspace/premium-viewer-flicker-test.js +11 -16
  80. package/workspace/premium-viewer-share-test.js +6 -9
  81. package/workspace/premium-viewer-test.js +41 -60
  82. package/workspace/premium-vw-backlog-test.js +53 -31
  83. package/workspace/premium-vw-cal-test.js +82 -123
  84. package/workspace/premium-vw-copy-test.js +17 -33
  85. package/workspace/premium-vw-doc-test.js +12 -11
  86. package/workspace/premium-vw-item-test.js +50 -48
  87. package/workspace/premium-vw-jira-test.js +55 -26
  88. package/workspace/premium-vw-meet-test.js +118 -187
  89. package/workspace/premium-vw-notes-test.js +85 -107
  90. package/workspace/premium-vw-rec-test.js +72 -193
  91. package/workspace/premium-vw-slides-test.js +46 -50
  92. package/workspace/premium-welcome-test.js +3 -2
  93. package/workspace/premium-work-depth-test.js +63 -51
  94. package/workspace/public/pm/bd-acts.js +305 -0
  95. package/workspace/public/pm/bd-span.js +224 -0
  96. package/workspace/public/pm/bd-stages.js +47 -0
  97. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  98. package/workspace/public/pm/c3-md.js +3 -395
  99. package/workspace/public/pm/c3-phone-detail.js +1 -1
  100. package/workspace/public/pm/c3-phone-model.js +3 -68
  101. package/workspace/public/pm/chat-term.js +3 -3
  102. package/workspace/public/pm/cozy-board.css +640 -0
  103. package/workspace/public/pm/cozy-home.css +580 -0
  104. package/workspace/public/pm/cozy-home.js +172 -0
  105. package/workspace/public/pm/cozy-initiative.css +138 -0
  106. package/workspace/public/pm/cozy-insights.css +421 -0
  107. package/workspace/public/pm/cozy-md.js +396 -0
  108. package/workspace/public/pm/cozy-nav.js +65 -0
  109. package/workspace/public/pm/cozy-placeholder.js +26 -0
  110. package/workspace/public/pm/cozy-viewer.css +143 -0
  111. package/workspace/public/pm/cozy-viewer.js +144 -0
  112. package/workspace/public/pm/cozy-vw.css +485 -0
  113. package/workspace/public/pm/cozy.css +254 -0
  114. package/workspace/public/pm/home-adddoc.js +48 -0
  115. package/workspace/public/pm/home-app.js +905 -0
  116. package/workspace/public/pm/home-around.js +515 -0
  117. package/workspace/public/pm/home-chat.js +459 -0
  118. package/workspace/public/pm/home-data.js +312 -0
  119. package/workspace/public/pm/home-draft.js +68 -0
  120. package/workspace/public/pm/home-more.js +249 -0
  121. package/workspace/public/pm/home-phone-card.js +109 -0
  122. package/workspace/public/pm/home-work.js +519 -0
  123. package/workspace/public/pm/lifecycle-lens-model.js +45 -27
  124. package/workspace/public/pm/lifecycle-lens.js +22 -11
  125. package/workspace/public/pm/phone-moment.js +69 -0
  126. package/workspace/public/pm/pm-work-view.js +1 -1
  127. package/workspace/public/pm/premium-attach.js +4 -0
  128. package/workspace/public/pm/premium-board.js +544 -253
  129. package/workspace/public/pm/premium-brief.js +1 -1
  130. package/workspace/public/pm/premium-chart-tab.js +110 -62
  131. package/workspace/public/pm/premium-chat.js +17 -10
  132. package/workspace/public/pm/premium-deck.js +3 -3
  133. package/workspace/public/pm/premium-first.js +25 -21
  134. package/workspace/public/pm/premium-initiative-head.js +138 -0
  135. package/workspace/public/pm/premium-initiative.js +28 -4
  136. package/workspace/public/pm/premium-insights.js +950 -440
  137. package/workspace/public/pm/premium-meeting.js +61 -549
  138. package/workspace/public/pm/premium-notes.js +1 -1
  139. package/workspace/public/pm/premium-report-frame.css +20 -0
  140. package/workspace/public/pm/premium-report-read.js +509 -480
  141. package/workspace/public/pm/premium-report-tab.js +87 -63
  142. package/workspace/public/pm/premium-shell.js +107 -124
  143. package/workspace/public/pm/premium-viewer.js +27 -1
  144. package/workspace/public/pm/premium-vw-cal.js +187 -48
  145. package/workspace/public/pm/premium-vw-doc.css +6 -0
  146. package/workspace/public/pm/premium-vw-doc.js +40 -2
  147. package/workspace/public/pm/premium-vw-file.js +2 -2
  148. package/workspace/public/pm/premium-vw-jira-model.js +22 -5
  149. package/workspace/public/pm/premium-vw-jira.css +11 -0
  150. package/workspace/public/pm/premium-vw-jira.js +11 -4
  151. package/workspace/public/pm/premium-vw-meet.js +6 -83
  152. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  153. package/workspace/public/pm/premium-vw-notes.js +56 -69
  154. package/workspace/public/pm/premium-vw-open.js +35 -0
  155. package/workspace/public/pm/premium-vw-page.js +16 -0
  156. package/workspace/public/pm/premium-vw-rec.js +11 -215
  157. package/workspace/public/pm/premium-vw-slides.css +5 -0
  158. package/workspace/public/pm/premium-vw-slides.js +44 -8
  159. package/workspace/public/pm/term-view.js +22 -0
  160. package/workspace/public/premium-board.html +57 -64
  161. package/workspace/public/premium-chat.html +7 -33
  162. package/workspace/public/premium-initiative.html +8 -41
  163. package/workspace/public/premium-insights.html +63 -62
  164. package/workspace/public/premium-viewer.html +20 -0
  165. package/workspace/public/premium-work.html +6 -72
  166. package/workspace/public/premium.html +21 -66
  167. package/workspace/public/vendor/nunito-var.woff2 +0 -0
  168. package/workspace/server.js +25 -3
  169. package/workspace/test-files.json +1 -0
  170. package/workspace/test-lists/home-libs.json +9 -0
  171. package/workspace/test-lists/premium-agreed-viewer.json +9 -0
  172. package/workspace/test-lists/premium-report-read.json +1 -1
  173. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  174. package/workspace/test-lists/premium-vw-notes.json +1 -1
  175. package/workspace/third-party/README.md +1 -0
  176. package/workspace/public/pm/premium-work.js +0 -719
  177. package/workspace/public/pm/premium.js +0 -1133
@@ -1,4 +1,13 @@
1
- /* pm/premium-vw-cal.js — the calendar grid in the premium viewer: Day, Week and Month (initiative premium-viewer, R8).
1
+ /* pm/premium-vw-cal.js — Calendar | Notes in the Viewer (initiative premium-agreed-design, area viewer; Main.dc.html viewer props cal and
2
+ * notelist), and the pure calendar model of the earlier grid (initiative premium-viewer, R8), kept for its suite.
3
+ * THE VIEW (openCalendar): one card with a Calendar | Notes switch and New note.
4
+ * Calendar Mon to Fri, each day with its load bar (meeting count) and its hours; the picked day's meetings and the untitled notes of that
5
+ * day, each with its status chip (Done, Next · 45 min, Recording, Not linked, Link it); the footer line. "Day, week and month"
6
+ * opens a plain list of any range (the design has none yet: it carries the Waiting for design marker).
7
+ * Notes the meeting notes grouped by initiative, a series as one row; search what was said (GET /api/notes/search).
8
+ * Reads GET /api/calendar-views (view=week, and day|week|month for the list), GET /api/notes, GET /api/notes/search. A meeting or a note opens
9
+ * the meeting card (premium-vw-mtg.js). New note starts an untitled note now (POST /api/notes/new) and records it.
10
+ * THE OLD GRID's pure half follows (calModel, calHtml, placeAll); the view no longer draws calHtml.
2
11
  * Reads GET /api/calendar-views?view=day|week|month&date=YYYY-MM-DD only, the same answer the console's Calendar draws (pm/calendar-views.js).
3
12
  * Meetings come from the answer's cells; the all-day row also carries the answer's dated layers (an initiative's promised date, a plan item,
4
13
  * a release, a report, your own due items). Nothing is invented: a range with no meeting says so, and a calendar that did not answer says why.
@@ -9,7 +18,11 @@
9
18
  * or one tied to no initiative, prep or record) drawn muted. A week is at least 620px wide and scrolls sideways in a narrower pane.
10
19
  * calModel(r, view, date, today) pure · calHtml(M, esc) pure · mountCal(el, st, d) · openCalendar(d, st?) */
11
20
  import { weekView } from './premium-meeting.js';
12
- import { vwOpen, vwShow, vwStyle } from './premium-viewer.js';
21
+ import { open as vOpen, current as vCur } from './cozy-viewer.js';
22
+ import { placeholderHtml } from './cozy-placeholder.js';
23
+ import { pmGet } from './http.js';
24
+ import { notesGroups } from './premium-vw-notes.js';
25
+ import './premium-vw-open.js'; // registers window.czViews
13
26
 
14
27
  export const VIEWS = [['day', 'Day'], ['week', 'Week'], ['month', 'Month']];
15
28
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
@@ -158,61 +171,187 @@ export function placeAll(el) {
158
171
  });
159
172
  }
160
173
 
161
- const S = new WeakMap(); // host -> { st, M, seq }
174
+ /* ── the view (pure half) ─────────────────────────────────────────────────────────────────────────────────────── */
175
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
176
+ const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
177
+ const hmOf = (iso) => { const t = new Date(iso); return Number.isFinite(t.getTime()) ? pad(t.getHours()) + ':' + pad(t.getMinutes()) : ''; };
178
+ const localKey = (iso) => { const t = new Date(iso); return `${t.getFullYear()}-${pad(t.getMonth() + 1)}-${pad(t.getDate())}`; };
179
+ const hrsText = (min) => (!min ? '' : min < 60 ? min + ' min' : (Math.round(min / 6) / 10) + ' h');
180
+ const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many || one + 's');
181
+ export const CAL_FOOT = 'From your calendar. PMOS never writes to it. A meeting with no initiative stays Not linked until you link it.';
182
+ export const NEW_NOTE_TIP = 'Starts an untitled note now. It needs no calendar event; link it to an initiative later.';
183
+ export const SEARCH_HINT = 'Search notes and what was said';
184
+ const sameEv = (m, row) => !!m && m.kind === 'event' && ((m.event_id && row.id && m.event_id === row.id) || (Date.parse(m.start) === Date.parse(row.at) && String(m.title || '').toLowerCase().trim() === String(row.title || '').toLowerCase().trim()));
162
185
 
163
- /** Draws the grid in `el` and keeps it live. st = { view, date }. d = { pmGet, esc, ws(), openRow(row) } */
164
- export function mountCal(el, st, d) {
165
- vwStyle('cal');
166
- const me = { st: { view: (st && st.view) || 'week', date: (st && st.date) || todayKey() }, M: null, seq: 0 };
167
- S.set(el, me); el.classList.add('vc');
168
- const nowMin = () => { const t = new Date(); return t.getHours() * 60 + t.getMinutes(); };
169
- const paint = () => { el.innerHTML = me.M ? calHtml(me.M, d.esc, nowMin()) : `<div class="vc-w"><p class="vc-empty" role="status">Reading the calendar PMOS holds.</p></div>`; placeAll(el); };
170
- const read = async () => {
171
- const n = ++me.seq, { view, date } = me.st, w = d.ws && d.ws();
172
- const res = await d.pmGet(`/api/calendar-views?view=${view}&date=${date}${w ? '&ws=' + encodeURIComponent(w) : ''}`);
173
- if (n !== me.seq || !el.isConnected) return;
174
- me.M = calModel(res, view, date, todayKey()); paint();
175
- };
176
- const go = (view, date, focus) => { me.st = { view, date }; read().then(() => { if (!focus) return; const b = el.querySelector(focus); if (b) b.focus(); }); };
177
- el.onclick = (e) => { // delegated: every control of the grid is a button inside el
178
- const b = e.target.closest('button'); if (!b || !el.contains(b)) return;
179
- if (b.dataset.cv) return go(b.dataset.cv, me.st.date, `[data-cv="${b.dataset.cv}"]`);
180
- if (b.dataset.cn != null) { const dir = +b.dataset.cn; return go(me.st.view, dir ? shift(me.st.view, me.st.date, dir) : todayKey(), `[data-cn="${b.dataset.cn}"]`); }
181
- if (b.dataset.day) return go('day', b.dataset.day, '[data-cv="day"]');
182
- if (b.dataset.ev) {
183
- const [k, i] = b.dataset.ev.split('|'), x = me.M && me.M.days.find((y) => y.key === k);
184
- const hit = x && [...x.timed, ...x.allday].find((y) => y.ref === k + '|' + i);
185
- if (hit && hit.row && d.openRow) d.openRow(hit.row, { ...me.st });
186
+ /** Monday to Friday of the week answer (weekView W), with the day `picked` pressed. A day's bar is its meeting count; its line is "done" for a
187
+ * past day with meetings, else its meeting hours, and "today". */
188
+ export function stripModel(W, picked, today) {
189
+ const keys = (() => { const [y, m, d] = parts(today), w0 = (new Date(Date.UTC(y, m - 1, d)).getUTCDay() + 6) % 7; return [0, 1, 2, 3, 4].map((i) => keyOf(new Date(Date.UTC(y, m - 1, d - w0 + i)))); })();
190
+ const ok = !!(W && W.state === 'ok');
191
+ return keys.map((k) => {
192
+ const rows = ok ? ((W.days.find((x) => x.key === k) || {}).rows || []) : [];
193
+ const min = rows.reduce((a, r) => { const v = hasTime(r.at) && hasTime(r.end) ? Math.round((Date.parse(r.end) - Date.parse(r.at)) / 60000) : 0; return a + (v > 0 && v < 1440 ? v : 0); }, 0);
194
+ const past = k < today, now = k === today;
195
+ return { key: k, dow: DOW[wd(k)].toUpperCase(), n: parts(k)[2], count: rows.length, on: k === picked, today: now,
196
+ bar: rows.length ? Math.min(1, 0.35 + rows.length * 0.22) : 0,
197
+ sub: [past && rows.length ? 'done' : hrsText(min), now ? 'today' : ''].filter(Boolean).join(' · ') };
198
+ });
199
+ }
200
+ /** The picked day's entries: its meetings from the week answer and the notes of that day with no calendar event. notes = GET /api/notes rows. */
201
+ export function dayModel(W, notes, picked, today, now = Date.now()) {
202
+ const day = W && W.state === 'ok' ? W.days.find((x) => x.key === picked) : null;
203
+ const rows = day ? day.rows : [];
204
+ const N = Array.isArray(notes) ? notes : [];
205
+ let nextDone = false;
206
+ const ents = rows.map((r) => {
207
+ const n = N.filter((x) => sameEv(x.meeting, r)).sort((a, b) => String(b.updated_at || '').localeCompare(String(a.updated_at || '')))[0] || null;
208
+ const at = Date.parse(r.at), end = Date.parse(r.end), linked = !!r.about;
209
+ const about = r.level ? (r.level.kind === 'portfolio' ? 'Portfolio' : clip(r.level.name || r.level.id, 50)) : (n && n.initiative && n.initiative.id ? clip(n.initiative.title || n.initiative.id, 50) : '');
210
+ let chip = '', k = '', next = false;
211
+ if (n && (n.state === 'recording' || n.state === 'paused')) { chip = n.state === 'paused' ? 'Paused' : 'Recording'; k = 'rec'; }
212
+ else if (n && n.state === 'ended') { chip = 'Done'; k = 'ok'; }
213
+ else if (picked === today && hasTime(r.at) && at > now && !nextDone) { nextDone = true; next = true; const m = Math.max(1, Math.round((at - now) / 60000)); chip = 'Next · ' + (m < 60 ? m + ' min' : Math.floor(m / 60) + ' h' + (m % 60 ? ' ' + (m % 60) + ' min' : '')); k = 'warn'; }
214
+ else if (!about) chip = 'Not linked';
215
+ else if (picked > today) chip = DOW[wd(picked)];
216
+ else if (Number.isFinite(end) && end < now) chip = 'Ended';
217
+ else chip = hasTime(r.at) ? 'Today' : 'All day';
218
+ const status = n && n.state === 'ended' ? 'notes ready' : n && (n.state === 'recording' || n.state === 'paused') ? 'recording' : '';
219
+ const who = (r.who || []).slice(0, 3).join(', ') + ((r.who || []).length > 3 ? ' and ' + ((r.who || []).length - 3) + ' more' : '');
220
+ return { kind: 'event', t: Number.isFinite(at) ? at : 0, time: hasTime(r.at) ? hmOf(r.at) : 'All day', title: r.title, sub: [about || 'Not linked', who, status].filter(Boolean).join(' · '), chip, k, next, linked: !!about || linked, row: r, note: n ? n.id : '' };
221
+ });
222
+ for (const n of N) {
223
+ const m = n.meeting;
224
+ if (m && m.kind === 'event') continue;
225
+ const s = (m && m.start) || n.recorded_from || n.created_at; if (!s || localKey(s) !== picked) continue;
226
+ const ini = n.initiative && n.initiative.id ? clip(n.initiative.title || n.initiative.id, 50) : '';
227
+ const len = n.meeting_ms >= 60000 ? Math.round(n.meeting_ms / 60000) + ' min' : '';
228
+ const live = n.state === 'recording' || n.state === 'paused';
229
+ ents.push({ kind: 'note', t: Date.parse(s) || 0, time: hmOf(s), title: clip(n.title || 'Untitled note', 120), sub: ['Recorded without a calendar event', len, ini || 'not linked'].filter(Boolean).join(' · '),
230
+ chip: live ? (n.state === 'paused' ? 'Paused' : 'Recording') : ini ? (n.state === 'ended' ? 'Done' : 'Note') : 'Link it', k: live ? 'rec' : ini && n.state === 'ended' ? 'ok' : '', next: false, linked: !!ini, note: n.id });
231
+ }
232
+ ents.sort((a, b) => a.t - b.t);
233
+ const [, m, d] = parts(picked);
234
+ const label = DOW[wd(picked)] + ' ' + d + ' ' + MON[m - 1];
235
+ return { title: picked === today ? 'Today, ' + label : label, sub: ents.length ? plural(ents.length, 'entry', 'entries') : 'No meetings', rows: ents, state: W && W.state === 'error' ? 'error' : 'ok', reason: W && W.reason };
236
+ }
237
+ const chipHtml = (c, k) => `<span class="vz-cc" data-k="${k || ''}">${esc(c)}</span>`;
238
+ /** The card's body. st = { tab, picked, q, searching, more: { view, date, M } | null }. */
239
+ export function calViewHtml(st, X) {
240
+ const h = [];
241
+ h.push(`<div class="vz-r1"><div class="vz-seg" role="tablist" aria-label="Meetings">${[['cal', 'Calendar'], ['notes', 'Notes']].map(([k, l]) => `<button type="button" role="tab" aria-selected="${st.tab === k}" data-c="tab" data-k="${k}">${l}</button>`).join('')}</div><span class="vz-sp"></span><button type="button" class="vz-new vz-hv" data-c="new" title="${esc(NEW_NOTE_TIP)}"><i aria-hidden="true"></i>New note</button></div>`);
242
+ if (X.msg) h.push(`<p class="vz-msg" role="status" data-tone="${X.msg.tone || ''}">${esc(X.msg.text)}</p>`);
243
+ if (st.tab === 'cal') {
244
+ const S = X.strip || [], D = X.day;
245
+ h.push(`<div class="vz-days" role="group" aria-label="This week">${S.map((d) => `<button type="button" class="vz-day vz-hv" aria-pressed="${d.on}" data-c="day" data-k="${d.key}" aria-label="${esc(d.dow + ' ' + d.n + (d.today ? ', today' : '') + ': ' + plural(d.count, 'meeting'))}"><span>${d.dow}</span><b>${d.n}</b><i aria-hidden="true"${d.count ? ` data-on="${Math.min(3, d.count)}"` : ''}></i><small>${esc(d.sub || ' ')}</small></button>`).join('')}</div>`);
246
+ if (!D) h.push('<p class="vz-empty" role="status">Reading the calendar PMOS holds.</p>');
247
+ else if (D.state === 'error') h.push(`<p class="vz-empty" role="status">The calendar was not read. ${esc(D.reason || '')}</p>`);
248
+ else {
249
+ h.push(`<h3>${esc(D.title)} <small>${esc(D.sub)}</small></h3>`);
250
+ D.rows.forEach((r, i) => h.push(`<button type="button" class="vz-row vz-hv" data-c="open" data-i="${i}"${r.next ? ' data-next' : ''}><time>${esc(r.time)}</time><span><b>${esc(r.title)}</b><small>${esc(r.sub)}</small></span>${r.chip === 'Link it' || r.chip === 'Not linked' ? `<span class="vz-cc" data-c="link" data-i="${i}" role="button" tabindex="0" title="Link it to an initiative">${esc(r.chip)}</span>` : chipHtml(r.chip, r.k)}</button>`));
186
251
  }
187
- };
188
- paint(); read();
189
- return { state: () => ({ ...me.st }), reload: read };
252
+ h.push(`<p class="vz-note">${esc(CAL_FOOT)}</p>`);
253
+ h.push(`<div class="vz-more2"><div class="vz-r1"><button type="button" class="vz-link vz-hv" data-c="more" aria-expanded="${!!st.more}">Day, week and month</button>${st.more ? `<span class="vz-wait" data-cz-placeholder="Day/Week/Month calendar">Waiting for design</span>` : ''}</div>${st.more ? moreHtml(st.more) : ''}</div>`);
254
+ } else {
255
+ h.push(`<input type="search" class="vz-search" data-c="q" aria-label="${esc(SEARCH_HINT)}" placeholder="${esc(SEARCH_HINT)}" value="${esc(st.q || '')}">`);
256
+ const G = X.groups;
257
+ if (!G) h.push('<p class="vz-empty" role="status">Reading the notes.</p>');
258
+ else if (G.state === 'error') h.push(`<p class="vz-empty" role="status">The notes could not be read. ${esc(G.error)}</p>`);
259
+ else if (!G.total) h.push('<p class="vz-empty">No notes yet. Notes you record show here, grouped by initiative.</p>');
260
+ else if (!G.groups.length) h.push(`<p class="vz-empty" role="status">${st.searching ? 'Searching what was said.' : 'No note matches “' + esc(st.q) + '”.'}</p>`);
261
+ else G.groups.forEach((g, gi) => h.push(`<section class="vz-grp"><h3>${esc(g.title)} <small>${esc(g.n)}</small></h3>${g.rows.map((r, ri) => `<button type="button" class="vz-row vz-sm vz-hv" data-c="note" data-id="${esc(r.id)}"${r.series ? ` data-series="${esc(r.series)}"` : ''}><span><b>${esc(r.title)}</b><small>${esc(r.sub)}</small></span>${chipHtml(r.chip, r.k)}</button>`).join('')}</section>`));
262
+ }
263
+ return `<div class="vz vz-cal" data-tab="${st.tab}">${h.join('')}</div>`;
264
+ }
265
+ function moreHtml(M0) {
266
+ const M = M0.M;
267
+ const seg = `<div class="vz-r1"><div class="vz-seg" role="group" aria-label="Range">${VIEWS.map(([k, l]) => `<button type="button" aria-pressed="${M0.view === k}" data-c="mv" data-k="${k}">${l}</button>`).join('')}</div><span class="vz-sp"></span><button type="button" class="vz-ib vz-small vz-hv" data-c="mn" data-k="-1" aria-label="Before"><svg viewBox="0 0 24 24" width="14" height="14"><path d="M15 6l-6 6 6 6"/></svg></button><button type="button" class="vz-link vz-hv" data-c="mn" data-k="0">Today</button><button type="button" class="vz-ib vz-small vz-hv" data-c="mn" data-k="1" aria-label="After"><svg viewBox="0 0 24 24" width="14" height="14"><path d="M9 6l6 6-6 6"/></svg></button></div>`;
268
+ if (!M) return seg + '<p class="vz-empty" role="status">Reading the calendar.</p>';
269
+ if (M.state !== 'ok') return seg + `<p class="vz-empty">The calendar was not read. ${esc(M.reason || '')}</p>`;
270
+ const days = M.days.filter((d) => d.inRange && d.meetings);
271
+ return seg + `<h3>${esc(M.title)} <small>${esc(M.caption)}</small></h3>` + (days.length ? days.map((d) => `<p class="vz-dayh">${esc(d.label)}${d.today ? ' · today' : ''}</p>` + [...d.timed, ...d.allday.filter((x) => x.row)].map((x) => `<button type="button" class="vz-row vz-sm vz-hv" data-c="mrow" data-ref="${esc(x.ref)}"><time>${esc(x.time ? x.time.slice(0, 5) : 'All day')}</time><span><b>${esc(x.title)}</b><small>${esc([x.about, x.sub].filter(Boolean).join(' · '))}</small></span></button>`).join('')).join('') : `<p class="vz-empty">${esc(M.empty || 'No meetings.')}</p>`);
190
272
  }
191
273
 
192
- /** The calendar on its own: a dialog whose detail is the grid. d = { openDlg, setMode, turnA, ptx, $, pmGet, esc, ws(), openRow(row) } where openRow
193
- * opens the meeting dialog. After a meeting opens, the grid comes back as a tab beside it at the same view and date. */
194
- export function openCalendar(d, st) {
195
- const open = (row, at) => {
196
- d.openRow(row); // openDlg runs at once inside, so the tab below belongs to the meeting's dialog
197
- vwOpen({ id: 'cal', title: 'Calendar', icon: 'cal', render: (el) => { el.classList.add('vc'); mountCal(el, at, { ...d, openRow: open }); } });
198
- vwShow('main');
199
- };
200
- d.openDlg({ eye: 'Calendar · real data', title: 'Calendar', stream: d.turnA(d.ptx('This is the calendar PMOS holds. Press a meeting to open its detail; the calendar stays as a tab beside it.')),
201
- pane: '<div class="vc" id="vcMain"></div>', label: 'Calendar' });
202
- const f = d.$('#askF'); if (f) f.hidden = true;
203
- if (d.setMode) d.setMode('detail'); // the grid takes the whole dialog; the dialog's own button brings the conversation back
204
- return mountCal(d.$('#vcMain'), st || { view: 'week', date: todayKey() }, { ...d, openRow: open });
274
+ /* ── the view (page half) ─────────────────────────────────────────────────────────────────────────────────────── */
275
+ let CV = null;
276
+ export function calendarUrl(tab, ws) { return '/premium-viewer.html?' + ['open=' + (tab === 'notes' ? 'notes' : 'calendar'), ws ? 'ws=' + encodeURIComponent(ws) : ''].filter(Boolean).join('&'); }
277
+ /** Opens Calendar | Notes in the Viewer. o = { ws, tab: 'cal' | 'notes', date, view, initiative } */
278
+ export function openCalendar(o = {}) {
279
+ if (o && (o.openDlg || o.$)) o = {}; // an old caller passed the shell's deps
280
+ const today = todayKey();
281
+ const me = CV = { ws: o.ws || new URLSearchParams(location.search).get('ws') || '', st: { tab: o.tab === 'notes' ? 'notes' : 'cal', picked: o.date && /^\d{4}-\d{2}-\d{2}$/.test(o.date) ? o.date : today, q: '', more: o.view && o.view !== 'day' ? { view: o.view, date: today, M: null } : null }, X: {}, today, seq: 0, initiative: o.initiative || '' };
282
+ vOpen({ id: 'calendar', kind: 'Meetings', title: 'Calendar and notes', icon: 'cal', url: calendarUrl(me.st.tab, me.ws), render: (b) => paintCal(me, b), onClose: () => { if (CV === me) CV = null; } });
283
+ readCal(me);
284
+ if (me.st.more) readMore(me);
285
+ return me;
286
+ }
287
+ export const openNotesTab = (o = {}) => openCalendar({ ...o, tab: 'notes' });
288
+ const calBody = (me) => (CV === me && vCur() && vCur().id === 'calendar' ? document.querySelector('#czViewer .cz-vw-body') : null);
289
+ function paintCal(me, b) {
290
+ const body = b || calBody(me); if (!body) return;
291
+ const keep = document.activeElement && document.activeElement.dataset && document.activeElement.dataset.c === 'q' ? document.activeElement.selectionStart : null;
292
+ me.X.strip = stripModel(me.W, me.st.picked, me.today);
293
+ me.X.day = me.W ? dayModel(me.W, me.notes, me.st.picked, me.today) : null;
294
+ body.innerHTML = calViewHtml(me.st, me.X);
295
+ if (keep != null) { const i = body.querySelector('[data-c="q"]'); if (i) { i.focus(); i.setSelectionRange(keep, keep); } }
296
+ body.onclick = (e) => calPress(me, e);
297
+ body.oninput = (e) => { if (e.target.dataset.c === 'q') search(me, e.target.value); };
298
+ body.onkeydown = (e) => { if ((e.key === 'Enter' || e.key === ' ') && e.target.dataset.c === 'link') { e.preventDefault(); calPress(me, e); } };
299
+ }
300
+ async function readCal(me) {
301
+ const wsq = me.ws ? '&ws=' + encodeURIComponent(me.ws) : '';
302
+ const weekOfPicked = me.st.picked;
303
+ const [w, n] = await Promise.all([pmGet('/api/calendar-views?view=week&date=' + weekOfPicked + wsq), pmGet('/api/notes')]);
304
+ if (CV !== me) return;
305
+ me.W = weekView(w, me.today); me.notesAnswer = n; me.notes = n && n.ok ? n.notes || [] : [];
306
+ me.X.groups = notesGroups(n, { q: me.st.q, found: me.found, initiative: me.initiative });
307
+ paintCal(me);
308
+ }
309
+ async function readMore(me) {
310
+ const m = me.st.more; if (!m) return;
311
+ const wsq = me.ws ? '&ws=' + encodeURIComponent(me.ws) : '';
312
+ const r = await pmGet('/api/calendar-views?view=' + m.view + '&date=' + m.date + wsq);
313
+ if (CV !== me || me.st.more !== m) return;
314
+ m.M = calModel(r, m.view, m.date, me.today); paintCal(me);
315
+ }
316
+ let searchT = null;
317
+ function search(me, v) {
318
+ me.st.q = v; clearTimeout(searchT);
319
+ me.found = null; me.st.searching = String(v).trim().length >= 2;
320
+ me.X.groups = notesGroups(me.notesAnswer, { q: v, found: null, initiative: me.initiative }); paintCal(me);
321
+ if (!me.st.searching) return;
322
+ searchT = setTimeout(async () => {
323
+ const r = await pmGet('/api/notes/search?q=' + encodeURIComponent(v.trim()));
324
+ if (CV !== me || me.st.q !== v) return;
325
+ me.found = new Set(r && r.ok && Array.isArray(r.ids) ? r.ids : []); me.st.searching = false;
326
+ me.X.groups = notesGroups(me.notesAnswer, { q: v, found: me.found, initiative: me.initiative }); paintCal(me);
327
+ }, 250);
328
+ }
329
+ const mtg = () => import('./premium-vw-mtg.js');
330
+ async function calPress(me, e) {
331
+ const t = e.target.closest('[data-c]'); if (!t) return;
332
+ const c = t.dataset.c, D = me.X.day;
333
+ if (c === 'tab') { me.st.tab = t.dataset.k; return paintCal(me); }
334
+ if (c === 'day') { const was = me.st.picked; me.st.picked = t.dataset.k; paintCal(me); if (me.W && !me.W.days.some((d) => d.key === t.dataset.k) && was !== t.dataset.k) readCal(me); return; }
335
+ if (c === 'new') { t.disabled = true; const M = await mtg(); const r = await M.newNote(me.ws); if (r && !r.ok) { me.X.msg = { text: r.error, tone: 'bad' }; t.disabled = false; paintCal(me); } return; }
336
+ if (c === 'link') { e.stopPropagation(); const r = D && D.rows[+t.dataset.i]; if (!r) return; const M = await mtg(); await M.openMeeting(r.note ? { note: r.note } : r.row, { ws: me.ws, about: true }); return; }
337
+ if (c === 'open') { const r = D && D.rows[+t.dataset.i]; if (!r) return; const M = await mtg(); return M.openMeeting(r.note && r.kind === 'note' ? { note: r.note } : r.row, { ws: me.ws }); }
338
+ if (c === 'note') { const M = await mtg(); return M.openMeeting({ note: t.dataset.id }, { ws: me.ws }); }
339
+ if (c === 'more') { me.st.more = me.st.more ? null : { view: 'week', date: me.today, M: null }; paintCal(me); return readMore(me); }
340
+ if (c === 'mv') { me.st.more = { view: t.dataset.k, date: me.st.more.date, M: null }; paintCal(me); return readMore(me); }
341
+ if (c === 'mn') { const m = me.st.more, dir = +t.dataset.k; me.st.more = { view: m.view, date: dir ? shift(m.view, m.date, dir) : me.today, M: null }; paintCal(me); return readMore(me); }
342
+ if (c === 'mrow') { const M0 = me.st.more && me.st.more.M; const [k] = t.dataset.ref.split('|'); const d = M0 && M0.days.find((x) => x.key === k); const hit = d && [...d.timed, ...d.allday].find((x) => x.ref === t.dataset.ref); if (hit && hit.row) { const M = await mtg(); return M.openMeeting(hit.row, { ws: me.ws }); } }
205
343
  }
206
344
 
207
- /** The Briefing's Calendar card gets a button that opens the full calendar. */
345
+ /** Kept for Home's old Calendar card: a button that opens Calendar | Notes. Nothing is drawn when the card is not on the page. */
208
346
  export function mountCalEntry(card, d) {
209
347
  if (!card || card.querySelector('.vc-open')) return;
210
- vwStyle('cal');
211
348
  const b = document.createElement('button'); b.type = 'button'; b.className = 'vc-open'; b.setAttribute('aria-label', 'Open the calendar'); b.title = 'Open the calendar';
212
- b.innerHTML = '<svg class="i" viewBox="0 0 24 24"><path d="M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7"/></svg><span>Full calendar</span>';
213
- const h = card.querySelector('.ch'), menu = card.querySelector('#calMenu'), fold = h && h.querySelector('.foldb');
214
- if (menu) menu.append(b); else if (fold) fold.before(b); else if (h) h.append(b); // in the header's ⋯ menu (premium-calmer-first-screen)
215
- b.onclick = () => openCalendar(d);
349
+ b.innerHTML = '<span>Calendar</span>';
350
+ const h = card.querySelector('.ch'), menu = card.querySelector('#calMenu');
351
+ if (menu) menu.append(b); else if (h) h.append(b); else card.append(b);
352
+ b.onclick = () => openCalendar({ ws: d && d.ws ? d.ws() : '' });
216
353
  }
354
+ /** The earlier grid's mount is the plain list now (no old layout). Kept so an old caller gets the view. */
355
+ export function mountCal(el, st) { return openCalendar({ view: st && st.view, date: st && st.date }); }
217
356
 
218
357
  if (typeof window !== 'undefined') window.__premiumCal = { calModel, openCalendar };
@@ -227,3 +227,9 @@ iframe.vwprint{position:fixed;right:0;bottom:0;width:1px;height:1px;border:0;opa
227
227
  .vwsm,.vwsrow2,.vwsoff,.vwshp .vwseg,.vwsgo{min-height:44px}.vwsw{width:48px;height:30px}.vwsw::after{width:22px;height:22px}.vwsw[aria-checked="true"]::after{left:23px}
228
228
  }
229
229
  @media (prefers-reduced-motion:reduce){.vwsw::after{transition:none}}
230
+ /* The Edit log and Proposals under the page: a plain minimal section until the Agreed design draws them (initiative premium-agreed-design) */
231
+ .vwside{display:grid;gap:8px;margin:18px 0 0;padding:14px 0 0;border-top:1px solid var(--hair)}
232
+ .vwside .vwmp{display:grid;gap:8px}
233
+ .vwprop{display:grid;gap:4px;padding:10px 12px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid)}
234
+ .vwprop>p{margin:0}
235
+ .vwside .evl{display:grid;gap:4px}
@@ -7,7 +7,7 @@
7
7
  import { pmPost } from './http.js';
8
8
  import { vwOpen, vwStyle, vwConfirm } from './premium-viewer.js';
9
9
  import { $, $$, esc, toast, AI, CHECK } from './premium-shell.js';
10
- import { editBody, acceptBody, rejectBody, askBody, askLine, relationsOf, copyKindOf, copyView } from './premium-doc-edit.js';
10
+ import { editBody, acceptBody, rejectBody, askBody, askLine, relationsOf, copyKindOf, copyView, proposalsModel } from './premium-doc-edit.js';
11
11
  import { bodyHtml, pageHead, propHtml, splitDoc, overlay, overlayLine, mergeEdit, readMinutes, dayOf, PANELS } from './premium-vw-doc-model.js';
12
12
 
13
13
  const I = (d) => `<svg class="i" viewBox="0 0 24 24" aria-hidden="true">${d}</svg>`;
@@ -230,6 +230,28 @@ function makePage(d, ctx) {
230
230
  + `<p class="vwerr" id="vwErr" role="alert">${esc(P.msg)}</p><div class="vwrow"><span class="vwmut" id="vwSv">${P.mode === 'edit' ? 'Type straight into the page. Press / for a block.' : 'The file as it is on disk.'}</span>`
231
231
  + `<button type="button" class="vwbtn" data-vd="cancel">Cancel</button><button type="button" class="vwbtn pri" data-vd="save"${P.busy ? ' disabled' : ''}>Save as v${v() + 1}</button></div></div>`;
232
232
  }
233
+ /** The Edit log and the Proposals list under the page. The Agreed design does not draw them yet, so this is a plain minimal section with a
234
+ * "Waiting for design" marker (initiative premium-agreed-design). Each revision shows its reason; each proposal shows who asked, the request, each
235
+ * section, and Accept (only the sections still current) or Reject (with a reason). Closed proposals keep their state and reason. */
236
+ function sideHtml() {
237
+ if (ctx.host) return '';
238
+ const m = proposalsModel(P.props), revs = (P.log && P.log.revisions) || [];
239
+ const tab = (k, label, n) => `<button type="button" class="vwbtn" data-vd="side:${k}" aria-expanded="${P.side === k}">${label}${n ? ` <em>${n}</em>` : ''}</button>`;
240
+ const one = (p) => {
241
+ const secs = p.sections.map((x) => `<p class="vwmut"><b>${esc(x.name)}</b> ${x.kind === 'removed' ? esc(x.add) : '+ ' + esc(x.add)}${x.stale ? ' · Changed since this was proposed' : ''}</p>`).join('');
242
+ const acts = p.open ? `<div class="vwrow">${p.canAccept ? `<button type="button" class="vwbtn pri" data-vd="pacc:${esc(p.id)}"${P.busy ? ' disabled' : ''}>Accept</button>` : ''}<button type="button" class="vwbtn" data-vd="prej:${esc(p.id)}"${P.busy ? ' disabled' : ''}>Reject</button></div>`
243
+ + (P.rej === p.id ? `<div class="vwrow"><input id="vwRj" class="vwin" placeholder="Why are you rejecting it? Kept in the Edit log." aria-label="Why are you rejecting it" value="${esc(P.rejWhy || '')}"><button type="button" class="vwbtn pri" data-vd="prejgo:${esc(p.id)}"${P.busy ? ' disabled' : ''}>Reject it</button><button type="button" class="vwbtn" data-vd="prejno">Cancel</button></div>` : '') : '';
244
+ return `<div class="vwprop ${esc(p.state)}" data-prop="${esc(p.id)}"><p><b>${esc(p.who)}</b> ${esc(p.request)}${p.open ? '' : ` · <em>${esc(p.label)}</em>${p.why ? ' · ' + esc(p.why) : ''}`}</p>${secs}`
245
+ + (p.staleAll ? '<p class="vwmut">The document changed since this was proposed, so it cannot be accepted. Ask again.</p>' : '') + acts + '</div>';
246
+ };
247
+ const body = P.side === 'log'
248
+ ? (revs.length ? `<div class="evl">${revs.slice().reverse().map((r) => `<p class="vwmut"><b>v${esc(r.rev)}</b> ${esc(r.why || (r.by === 'baseline' ? 'The file as the sheet first saw it' : 'No reason recorded'))} · ${esc(whoOf(r))}${r.at ? ' · ' + esc(dayOf(r.at)) : ''}</p>`).join('')}</div>` : '<p class="vwmut">No revision is recorded.</p>')
249
+ : P.side === 'props'
250
+ ? `<p class="vwlab">Open proposals · ${m.count}</p>${m.open.length ? m.open.map(one).join('') : '<p class="vwmut">No open proposals.</p>'}${m.closed.length ? `<p class="vwlab">Closed · ${m.closed.length}</p>${m.closed.map(one).join('')}` : ''}`
251
+ : '';
252
+ return `<section class="vwside" aria-label="Edit log and proposals"><p class="hx-wait"><i aria-hidden="true"></i>Waiting for design</p><div class="vwrow">${tab('log', 'Edit log')}${tab('props', 'Proposals', m.count)}</div>`
253
+ + `<p class="vwerr" id="vwSideErr" role="alert">${esc(P.sideErr || '')}</p>${body ? `<div class="vwmp" role="region" aria-label="${P.side === 'log' ? 'Edit log' : 'Proposals'}">${body}</div>` : ''}</section>`;
254
+ }
233
255
  function pageHtml() {
234
256
  if (P.err) return `<p class="vwempty">${esc(P.err)}</p>`;
235
257
  if (P.text == null) return '<p class="vwempty">Reading the file.</p>';
@@ -241,7 +263,7 @@ function makePage(d, ctx) {
241
263
  return toolsHtml(p) + (P.mode === 'read' ? moreBar() : '') + unsaved + agentBar(p, o) + (P.mode === 'edit' ? editBar() : '')
242
264
  + `<article class="cf${P.mode === 'edit' ? ' editing' : ''}">${headHtml(h)}<div class="cfb"${P.mode === 'edit' ? ' contenteditable="true" spellcheck="true" aria-label="The page" role="textbox" aria-multiline="true"' : ''}>${body || '<p class="vwmut">The file has no text yet.</p>'}</div>`
243
265
  + `<footer class="cff"><span>${v() ? 'v' + v() + (p ? ' · edited by the agent, not kept yet' : '') : ''}</span><span class="gap"></span><code>${esc(d.path)}</code></footer></article>`
244
- + (P.mode === 'edit' ? saveRow() : '');
266
+ + (P.mode === 'edit' ? saveRow() : '') + (P.mode === 'read' ? sideHtml() : '');
245
267
  }
246
268
  function draw() {
247
269
  if (!el || !el.isConnected) return;
@@ -382,6 +404,21 @@ function makePage(d, ctx) {
382
404
  if (!res || res.ok !== true || !res.id) { P.ask = { state: 'failed', error: (res && res.error) || 'The agent could not be asked.' }; draw(); return; }
383
405
  P.askText = ''; P.askOpen = false; P.ask = { state: 'working', id: res.id }; draw(); pollAsk(res.id); return;
384
406
  }
407
+ if (k === 'side') { P.side = P.side === arg ? null : arg; P.sideErr = ''; draw(); return; }
408
+ if (k === 'prejno') { P.rej = null; P.rejWhy = ''; P.sideErr = ''; draw(); return; }
409
+ if (k === 'prej') { P.rej = arg; P.rejWhy = ''; P.sideErr = ''; draw(); const f = $('#vwRj', el); if (f) f.focus(); return; }
410
+ if (k === 'pacc' || k === 'prejgo') {
411
+ const raw = (P.props || []).find((x) => x.id === arg); if (!raw) return;
412
+ const r = k === 'pacc' ? acceptBody(d.path, raw, raw.sections.filter((x) => !x.stale).map((x) => x.name)) : rejectBody(d.path, raw, ($('#vwRj', el) || {}).value || P.rejWhy);
413
+ if (r.error) { P.sideErr = r.error; draw(); return; }
414
+ P.busy = true; P.sideErr = ''; draw();
415
+ const res = await pmPost('/api/doc-sheet/' + (k === 'pacc' ? 'accept' : 'reject') + (ws() ? '?ws=' + encodeURIComponent(ws()) : ''), r.body).catch(() => null);
416
+ P.busy = false;
417
+ if (!res || res.ok !== true) { P.sideErr = (res && res.error) || (k === 'pacc' ? 'The proposal could not be accepted.' : 'The proposal could not be rejected.'); await load(); return; }
418
+ P.rej = null; P.rejWhy = ''; P.kept = null; P.pop = null;
419
+ toast(k === 'pacc' ? 'Accepted. The new version is in the Edit log.' : 'Rejected. The reason is in the Edit log.');
420
+ await load(); if (ctx.onWrite) ctx.onWrite(); return;
421
+ }
385
422
  if (!p) return;
386
423
  if (k === 'keep') {
387
424
  const o = overlay(P.text, p, P.kept);
@@ -451,6 +488,7 @@ function makePage(d, ctx) {
451
488
  if (e.target.id === 'vwWhy') { P.why = e.target.value; return; }
452
489
  if (e.target.id === 'vwMd') return;
453
490
  if (e.target.id === 'vwCpUrl') { P.cpUrl = e.target.value; return; }
491
+ if (e.target.id === 'vwRj') { P.rejWhy = e.target.value; return; }
454
492
  if (!e.target.closest || !e.target.closest('.cfb')) return;
455
493
  if (e.inputType === 'insertText' && e.data === '/') { slash = { q: '' }; showMenu(caretRect(), BLOCKS, (it) => { const n = slash ? slash.q.length + 1 : 1; slash = null; delBack(n); doBlock(it.k); }, { slash: true }); }
456
494
  else if (slash && menu) {
@@ -160,7 +160,7 @@ export function openChatFile(p, ctx = {}) {
160
160
  };
161
161
  const pane = vwOpen({ id, title: base(p), icon: 'doc', render: (el) => { el.innerHTML = fileHtml(st.f, st.view); wire(el); } });
162
162
  const draw = () => {
163
- const el = document.querySelector(`#dOut .obody.vw[data-vw="${CSS.escape(id)}"]`);
163
+ const el = document.querySelector(`.obody.vw[data-vw="${CSS.escape(id)}"]`);
164
164
  if (!el) return false;
165
165
  const y = el.scrollTop; el.innerHTML = fileHtml(st.f, st.view); wire(el); el.scrollTop = y;
166
166
  return true;
@@ -179,7 +179,7 @@ export function openChatFile(p, ctx = {}) {
179
179
  clearTimeout(st.timer);
180
180
  const tick = async () => {
181
181
  const changed = await read();
182
- if (!document.querySelector(`#dOut .obody.vw[data-vw="${CSS.escape(id)}"]`)) { OPEN.delete(id); return; } // the tab or the dialog closed: stop checking
182
+ if (!document.querySelector(`.obody.vw[data-vw="${CSS.escape(id)}"]`)) { OPEN.delete(id); return; } // the tab or the dialog closed: stop checking
183
183
  if (changed) draw();
184
184
  st.timer = setTimeout(tick, CHECK_MS);
185
185
  };
@@ -2,8 +2,10 @@
2
2
  * request: it turns the answers of the two routes the views read into what they draw, so a node test loads it with import().
3
3
  * GET /api/jira/tickets?ws&initiative → the initiative's ticket draft and the last Jira reading of each pushed ticket (lib/jira-tickets.js view)
4
4
  * GET /api/boards/sprints?ws&board → the board's sprints from the cached Jira readings (scripts/boards.js sprintsOf)
5
- * Every value comes from one of the two answers. The readings hold titles, statuses, sprints, subtask counts and points only (lib/jira-status.js:
6
- * "never a description, a comment or a person"), so the ticket draws no assignee and no subtask list, and says that the rest stays in Jira.
5
+ * Every value comes from one of the two answers. The readings hold titles, statuses, sprints, subtask counts and points (lib/jira-status.js).
6
+ * Agreed design V1 (initiative premium-agreed-design): the ticket names its engineer assignee when a reading holds one (`assignee`, a name or
7
+ * { name | displayName }) and says "Not in the Jira read" otherwise, never a guess; and it says how long ago Jira was read (agoLine).
8
+ * Engineers build outside PMOS, in Jira: the ticket's build story is its Jira status and assignee, never a PMOS agent or pull request.
7
9
  * Nothing here writes to Jira: PMOS owns the ticket text and Jira owns its status (D88). */
8
10
 
9
11
  export const COLS = [['todo', 'To do'], ['doing', 'In progress'], ['done', 'Done']];
@@ -11,6 +13,8 @@ const CAT = { todo: 'To do', doing: 'In progress', done: 'Done' };
11
13
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
12
14
  const str = (s) => (typeof s === 'string' ? s.trim() : '');
13
15
  const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
16
+ /** A reading's assignee as a name: a string, or an object with name or displayName; '' when the reading holds none. */
17
+ export const personOf = (a) => (typeof a === 'string' ? a.trim() : a && typeof a === 'object' ? str(a.displayName) || str(a.name) : '');
14
18
 
15
19
  /** 2026-10-07 → "7 Oct"; anything else → '' */
16
20
  export function day(iso) {
@@ -59,9 +63,10 @@ export function ticketModel(view, ref, sprints = null) {
59
63
  const epic = view && view.epic && view.epic.key ? { key: view.epic.key, title: view.epic.summary || '' } : null;
60
64
  const points = hit && typeof hit.issue.points === 'number' ? hit.issue.points : null;
61
65
  const flagged = !!((j && j.flagged) || (hit && hit.issue.flagged));
66
+ const assignee = personOf(j && j.assignee) || personOf(hit && hit.issue.assignee) || personOf(t && t.assignee) || null;
62
67
  return {
63
68
  ok: true, id: t ? t.id : '', key, inJira: !!key && (!t || !!t.key), title: (t && t.summary) || (hit && hit.issue.summary) || key,
64
- type: (t && t.type) || '', priority: (t && t.priority) || '', estimate: (t && t.estimate) || '', points,
69
+ type: (t && t.type) || '', priority: (t && t.priority) || '', estimate: (t && t.estimate) || '', points, assignee,
65
70
  status: status || (t && !t.key ? 'Not in Jira yet' : ''), category: category || (t && !t.key ? 'draft' : 'todo'),
66
71
  sprint: sp && sp.name ? { name: sp.name, state: sp.state || '', dates: [day(sp.start), day(sp.end)].filter(Boolean).join(' – ') } : null,
67
72
  flagged, reason: flagged ? (j && j.reason) || (hit && hit.issue.reason) || 'Flagged in Jira' : '',
@@ -100,7 +105,7 @@ export function sprintModel(sprints, name, { today } = {}) {
100
105
  const a = Date.parse(String(sp.end).slice(0, 10)), b = Date.parse(String(today).slice(0, 10));
101
106
  if (Number.isFinite(a) && Number.isFinite(b)) { const d = Math.round((a - b) / 864e5); left = d < 0 ? 'ended ' + plural(-d, 'day', 'days') + ' ago' : d === 0 ? 'ends today' : plural(d, 'day', 'days') + ' left'; }
102
107
  }
103
- const cards = (sp.issues || []).map((i) => ({ key: i.key, title: i.summary || i.key, status: i.status || CAT[i.category] || '', cat: CAT[i.category] ? i.category : 'todo',
108
+ const cards = (sp.issues || []).map((i) => ({ key: i.key, title: i.summary || i.key, status: i.status || CAT[i.category] || '', cat: CAT[i.category] ? i.category : 'todo', assignee: personOf(i.assignee) || null,
104
109
  points: typeof i.points === 'number' ? i.points : null, initiative: i.initiative || null, url: safeUrl(i.url), flagged: !!i.flagged, reason: i.flagged ? i.reason || 'Flagged in Jira' : '' }));
105
110
  const cols = COLS.map(([cat, label]) => ({ cat, label, cards: cards.filter((c) => c.cat === cat) }));
106
111
  const other = cards.filter((c) => !c.initiative).length;
@@ -120,6 +125,18 @@ export function readLine(iso, now = Date.now()) {
120
125
  return 'read ' + (same ? String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0') : d.getDate() + ' ' + MON[d.getMonth()]);
121
126
  }
122
127
 
128
+ /** "Jira · read 12 min ago" (V1): just now, minutes, hours, then days; a time no record holds says so. */
129
+ export function agoLine(iso, now = Date.now()) {
130
+ const t = Date.parse(String(iso || ''));
131
+ if (!Number.isFinite(t)) return 'Jira · no read time on record';
132
+ const m = Math.max(0, Math.round((now - t) / 60000));
133
+ if (m < 1) return 'Jira · read just now';
134
+ if (m < 60) return 'Jira · read ' + m + ' min ago';
135
+ const h = Math.round(m / 60);
136
+ if (h < 24) return 'Jira · read ' + plural(h, 'hour', 'hours') + ' ago';
137
+ return 'Jira · read ' + plural(Math.round(h / 24), 'day', 'days') + ' ago';
138
+ }
139
+
123
140
  /**
124
141
  * A ticket that is in no ticket draft and no sprint read, from GET /api/jira/ticket (popup context slice 4): the newest Jira check
125
142
  * snapshot that holds it, or else the stored Jira source read. ans: that answer (or null), ref: the key.
@@ -138,7 +155,7 @@ export function storedModel(ans, ref) {
138
155
  const sub = t.subtasks && Number.isInteger(t.subtasks.total) && t.subtasks.total > 0 ? { done: Math.min(t.subtasks.done || 0, t.subtasks.total), total: t.subtasks.total } : null;
139
156
  const about = [str(t.about), t.who && t.ask ? `${str(t.who)} asks: ${str(t.ask)}` : str(t.ask)].filter(Boolean).join('\n\n');
140
157
  return {
141
- ok: true, id: '', key: str(t.key) || r, inJira: true, title: str(t.summary) || r, type: '', priority: '', estimate: '', points: null,
158
+ ok: true, id: '', key: str(t.key) || r, inJira: true, title: str(t.summary) || r, type: '', priority: '', estimate: '', points: null, assignee: personOf(t.assignee) || null,
142
159
  status: str(t.status) || (src === 'source-read' ? 'Status not in the read' : 'No status read'), category: t.category || 'todo', sprint: sp,
143
160
  flagged: !!t.flagged, reason: t.flagged ? str(t.reason) || 'Flagged in Jira' : '', stale: false,
144
161
  sections: about ? [{ key: 'about', name: 'What the Jira read says', text: about }] : [], subtasks: sub, links: [], epic: null, prd: '', initiative: '',
@@ -1,3 +1,7 @@
1
+ @font-face{font-family:"Space Grotesk";src:url(/vendor/space-grotesk-var.woff2) format("woff2");font-weight:300 700;font-display:swap}
2
+ @font-face{font-family:"IBM Plex Mono";src:url(/vendor/ibm-plex-mono-400.woff2) format("woff2");font-weight:400;font-display:swap}
3
+ @font-face{font-family:"IBM Plex Mono";src:url(/vendor/ibm-plex-mono-500.woff2) format("woff2");font-weight:500;font-display:swap}
4
+ @font-face{font-family:"IBM Plex Mono";src:url(/vendor/ibm-plex-mono-700.woff2) format("woff2");font-weight:600 700;font-display:swap}
1
5
  :root{--fs-1:11px;--fs-2:12px;--fs-3:14px;--fs-4:16px;--fs-5:20px;--fs-6:28px}
2
6
  /* pm/premium-vw-jira.css — the Jira ticket and sprint tabs of the premium viewer (initiative premium-viewer, S5). Loaded once by
3
7
  * pm/premium-vw-jira.js. Console type only: sizes var(--fs-1..6), weights 400, 500 and 600. */
@@ -86,3 +90,10 @@ button.jcrd{cursor:pointer}
86
90
  .jbrd{grid-template-columns:1fr}
87
91
  }
88
92
  @media (hover:hover){.jbtn:hover{background:var(--well)}.jln button:hover b{text-decoration:underline}button.jcrd:hover{box-shadow:0 6px 16px -10px rgba(0,0,0,.35)}}
93
+ /* Agreed design V1: the ticket's facts grid (Status, Assignee, Points, Sprint, Initiative, Jira read), two columns of soft wells */
94
+ .jfields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:12px 0 4px}
95
+ .jfd{padding:10px 12px;border-radius:8px;background:var(--well);min-width:0}
96
+ .jfd dt{font-size:var(--fs-1);font-weight:600;color:var(--ink-3)}
97
+ .jfd dd{margin:2px 0 0;font-size:var(--fs-3);font-weight:600;color:var(--ink);overflow-wrap:anywhere}
98
+ .jfd.mut dd{font-weight:600;color:var(--ink-3)}
99
+ .jago{color:var(--ink-3)}
@@ -4,12 +4,14 @@
4
4
  * history or fields panel; those stay in Jira)
5
5
  * openSprint({ ws, board, name }) a sprint of the board as columns by status; a card of the board opens its ticket
6
6
  * Reads GET /api/jira/tickets and GET /api/boards/sprints only; the model is pm/premium-vw-jira-model.js. Read-only: Jira owns status, sprint and
7
- * assignee (D88), so nothing here moves a ticket. With no Jira data a view says what is missing. */
7
+ * assignee (D88), so nothing here moves a ticket. With no Jira data a view says what is missing.
8
+ * Agreed design V1: the ticket's facts grid names the engineer assignee and "Jira · read N min ago". Engineers build in Jira, so the ticket never
9
+ * shows a PMOS builder agent, a pull request, CI or a diff as its build story. */
8
10
  import { vwOpen, vwStyle } from './premium-viewer.js';
9
11
  import { openBacklog } from './premium-vw-backlog.js';
10
12
  import { mdRender } from './markdown.js';
11
13
  import { esc, toast, askHere } from './premium-shell.js';
12
- import { ticketModel, sprintModel, readLine, storedModel } from './premium-vw-jira-model.js';
14
+ import { ticketModel, sprintModel, readLine, storedModel, agoLine } from './premium-vw-jira-model.js';
13
15
 
14
16
  const ICO = (p) => `<svg class="i" viewBox="0 0 24 24">${p}</svg>`;
15
17
  const EXT = ICO('<path d="M14 4h6v6M20 4l-9 9M18 14v6H4V6h6"/>');
@@ -23,7 +25,7 @@ async function getJson(p, q) {
23
25
  }
24
26
  // mdRender builds nodes, never a string, so nothing in a ticket's text runs
25
27
  const md = (t) => { try { const d = document.createElement('div'); d.append(...mdRender(String(t)).blocks.map((b) => b.node || b)); return d.innerHTML; } catch { return `<p>${esc(t)}</p>`; } };
26
- const bar = (what, m) => `<div class="jbar"><span class="jlg" aria-hidden="true">J</span><span class="jbt"><b>From the last Jira read</b> · ${esc(what)} · ${esc(readLine(m.readAt))}</span>${m.url ? `<a class="jbtn" href="${esc(m.url)}" target="_blank" rel="noopener">${EXT}Open in Jira</a>` : ''}<button type="button" class="jbtn" data-jre>Read again</button></div>`;
28
+ const bar = (what, m) => `<div class="jbar"><span class="jlg" aria-hidden="true">J</span><span class="jbt"><b>From the last Jira read</b> · ${esc(what)} · ${esc(readLine(m.readAt))}<span class="jago"> · ${esc(agoLine(m.readAt).replace(/^Jira · /, ''))}</span></span>${m.url ? `<a class="jbtn" href="${esc(m.url)}" target="_blank" rel="noopener">${EXT}Open in Jira</a>` : ''}<button type="button" class="jbtn" data-jre>Read again</button></div>`;
27
29
  // the bars' widths are run-time geometry, set as a property rather than an inline style
28
30
  const bars = (el) => el.querySelectorAll('[data-pct]').forEach((i) => i.style.setProperty('--bd-w', Math.max(0, Math.min(100, +i.dataset.pct || 0)) + '%'));
29
31
  const empty = (why, canRead) => `<div class="jv"><div class="jempty"><b>${canRead ? 'Not read yet' : 'Nothing to show'}</b><p>${esc(why)}</p>${canRead ? '<button type="button" class="jbtn" data-jread>Read it now</button>' : ''}</div></div>`;
@@ -44,6 +46,10 @@ function ticketHtml(m) {
44
46
  const links = m.links.length || m.prd ? `<h3>Linked</h3><div class="jlinks">${m.links.map((l) => `<div class="jln"><em>${esc(l.rel)}</em>${l.open
45
47
  ? `<button type="button" data-jt="${esc(l.ref)}">${LINK}<span class="jk">${esc(l.key || l.ref)}</span><b>${esc(l.title)}</b></button>`
46
48
  : `<span class="jlx">${LINK}<span class="jk">${esc(l.ref)}</span></span>`}</div>`).join('')}${m.prd ? `<div class="jln"><em>from</em><span class="jlx">${DOC}<b>${esc(m.prd)}</b></span></div>` : ''}</div>` : '';
49
+ // V1: the design's facts grid. The assignee is the engineer the Jira read names; a read with no person says so rather than guess.
50
+ const fields = [['Status', m.status || 'No status read'], ['Assignee', m.assignee ? m.assignee + ' (engineer)' : 'Not in the Jira read'], ['Points', m.points != null ? String(m.points) : 'None on record'],
51
+ ['Sprint', m.sprint ? m.sprint.name + (m.sprint.dates ? ' · ' + m.sprint.dates : '') : 'No sprint'], ['Initiative', m.initiative || ''], ['Jira', agoLine(m.readAt).replace(/^Jira · /, '').replace(/^read/, 'Read')]].filter((f) => f[1]);
52
+ const facts = `<dl class="jfields" aria-label="Ticket facts">${fields.map(([k, v]) => `<div class="jfd${k === 'Assignee' && !m.assignee ? ' mut' : ''}" data-jf="${esc(k.toLowerCase())}"><dt>${esc(k)}</dt><dd>${esc(v)}</dd></div>`).join('')}</dl>`;
47
53
  const body = m.sections.length ? m.sections.map((s) => `<h3>${esc(s.name)}</h3><div class="jmd">${md(s.text)}</div>`).join('')
48
54
  : `<p class="jnote">${m.fromStore ? `This ticket is not in the initiative's ticket draft. Its title and status come from ${m.fromStore === 'source-read' ? 'the stored Jira read' : 'the last Jira check that held it'}.` : m.noDraft ? 'This ticket is on no initiative of this board, so PMOS holds no text for it. Its title, status and points come from the sprint read.' : m.draftOnly ? 'This ticket is not in the initiative\'s ticket draft, so PMOS holds no text for it. Its title, status and points come from the sprint read.' : 'The ticket draft holds no text for this ticket.'}</p>`;
49
55
  return `<div class="jv">${bar('ticket', m)}<article class="jtk">
@@ -53,8 +59,9 @@ function ticketHtml(m) {
53
59
  ${m.flagged ? `<p class="jflag">${FLAG}${esc(m.reason)}</p>` : ''}
54
60
  ${m.stale ? '<p class="jnote">The last Jira check did not return this ticket, so this is an older reading.</p>' : ''}
55
61
  ${m.readingOnly ? '<p class="jnote">This ticket is in Jira, but no Jira check has read it yet.</p>' : ''}
62
+ ${facts}
56
63
  <div class="jbody">${body}</div>${sub}${links}
57
- <p class="jfoot">Assignee, comments, history and the other fields stay in Jira.${m.url ? ` <a href="${esc(m.url)}" target="_blank" rel="noopener">Open in Jira</a>` : m.inJira ? ' The reading holds no link to the ticket.' : ' This ticket is not in Jira yet; push it from the initiative\'s Jira tickets tab.'}</p>
64
+ <p class="jfoot">Comments, history and the other fields stay in Jira. The engineers build there; Jira owns the status and the assignee.${m.url ? ` <a href="${esc(m.url)}" target="_blank" rel="noopener">Open in Jira</a>` : m.inJira ? ' The reading holds no link to the ticket.' : ' This ticket is not in Jira yet; push it from the initiative\'s Jira tickets tab.'}</p>
58
65
  </article></div>`;
59
66
  }
60
67