create-pmos 0.401.0 → 0.403.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -30
- package/payload/KIT-VERSION +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/board-programs-test.js +227 -0
- package/workspace/board-shot.js +54 -0
- package/workspace/briefing-premium-adddoc-test.js +28 -22
- package/workspace/briefing-premium-board-test.js +107 -82
- package/workspace/briefing-premium-calendar-2-test.js +23 -10
- package/workspace/briefing-premium-calendar-3-test.js +23 -19
- package/workspace/briefing-premium-calendar-test.js +20 -15
- package/workspace/briefing-premium-initiative-test.js +25 -12
- package/workspace/briefing-premium-insights-test.js +31 -18
- package/workspace/briefing-premium-metrics-test.js +8 -8
- package/workspace/briefing-premium-sources-test.js +15 -10
- package/workspace/briefing-premium-test.js +39 -16
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/board-premium-facts.js +20 -3
- package/workspace/fixtures/briefing-premium-facts.js +18 -2
- package/workspace/fixtures/premium-viewer-fixtures.js +24 -2
- package/workspace/fixtures/program-ascent.js +101 -0
- package/workspace/guide/home.md +11 -7
- package/workspace/guide/index.md +1 -0
- package/workspace/guide/jira.md +38 -6
- package/workspace/guide/programs.md +37 -0
- package/workspace/home-rows-test.js +184 -0
- package/workspace/lib/briefing-premium-products.js +4 -4
- package/workspace/lib/briefing-premium.js +2 -2
- package/workspace/lib/calendar-layers.js +8 -4
- package/workspace/lib/initiative-layout.js +4 -3
- package/workspace/lib/jira-cli.js +17 -12
- package/workspace/lib/jira-status.js +1 -1
- package/workspace/lib/jira-tickets.js +126 -24
- package/workspace/lib/meeting-files.js +58 -0
- package/workspace/lib/meeting-learn.js +139 -0
- package/workspace/lib/meeting-material.js +12 -5
- package/workspace/lib/notes.js +3 -0
- package/workspace/lib/programs.js +129 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-brief-page.js +8 -1
- package/workspace/lib/routes-briefing-premium.js +1 -1
- package/workspace/lib/routes-calendar-views.js +24 -3
- package/workspace/lib/routes-meeting-material.js +38 -0
- package/workspace/lib/routes-meeting-points.js +23 -3
- package/workspace/lib/routes-programs.js +122 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +31 -25
- package/workspace/premium-chat-context-test.js +1 -1
- package/workspace/premium-chat-goal-view-test.js +1 -1
- package/workspace/premium-chat-viewer-test.js +1 -1
- package/workspace/premium-core-doc-issue-test.js +13 -7
- package/workspace/premium-discuss-landing-test.js +83 -0
- package/workspace/premium-link-suggest-test.js +103 -0
- package/workspace/premium-report-read-test.js +86 -82
- package/workspace/premium-vw-backlog-test.js +6 -5
- package/workspace/premium-vw-cal-test.js +45 -19
- package/workspace/premium-vw-item-test.js +8 -6
- package/workspace/premium-vw-jira-test.js +3 -2
- package/workspace/premium-vw-meet-test.js +122 -66
- package/workspace/premium-vw-notes-test.js +7 -6
- package/workspace/premium-vw-rec-test.js +14 -13
- package/workspace/premium-vw-slides-test.js +11 -5
- package/workspace/program-panel-test.js +152 -0
- package/workspace/public/pm/bd-acts.js +24 -15
- package/workspace/public/pm/bd-asks.js +111 -30
- package/workspace/public/pm/bd-ini-panel.js +229 -0
- package/workspace/public/pm/bd-pop.js +2 -2
- package/workspace/public/pm/bd-prog-panel.js +436 -0
- package/workspace/public/pm/bd-prog.js +191 -0
- package/workspace/public/pm/bd-span.js +98 -15
- package/workspace/public/pm/bd-views.js +93 -29
- package/workspace/public/pm/cozy-board.css +214 -20
- package/workspace/public/pm/cozy-evui.js +4 -2
- package/workspace/public/pm/cozy-home-rows.css +54 -0
- package/workspace/public/pm/cozy-home.css +35 -0
- package/workspace/public/pm/cozy-insights.css +1 -2
- package/workspace/public/pm/cozy-mtg-present.css +160 -0
- package/workspace/public/pm/cozy-panel.css +155 -0
- package/workspace/public/pm/cozy-rec-pill.css +12 -0
- package/workspace/public/pm/cozy-rec-pill.js +46 -0
- package/workspace/public/pm/cozy-today.css +189 -0
- package/workspace/public/pm/cozy-viewer.js +307 -43
- package/workspace/public/pm/cozy-vw-mtg.css +96 -94
- package/workspace/public/pm/cozy-vw-rp.css +40 -25
- package/workspace/public/pm/cozy-vw-shell.css +127 -0
- package/workspace/public/pm/cozy-xv.css +51 -0
- package/workspace/public/pm/cozy-xv.js +34 -0
- package/workspace/public/pm/home-app.js +192 -72
- package/workspace/public/pm/home-chat.js +17 -4
- package/workspace/public/pm/home-data.js +1 -1
- package/workspace/public/pm/home-day.js +64 -0
- package/workspace/public/pm/home-ini-model.js +1 -1
- package/workspace/public/pm/home-ini.js +197 -54
- package/workspace/public/pm/home-list.js +100 -27
- package/workspace/public/pm/home-mentions.js +187 -0
- package/workspace/public/pm/home-rec-row.js +67 -0
- package/workspace/public/pm/home-review.js +20 -10
- package/workspace/public/pm/home-task.js +19 -18
- package/workspace/public/pm/home-today.js +137 -59
- package/workspace/public/pm/premium-board.js +294 -288
- package/workspace/public/pm/premium-insights.js +118 -82
- package/workspace/public/pm/premium-mtg-present.js +408 -100
- package/workspace/public/pm/premium-mtg-replay.js +70 -10
- package/workspace/public/pm/premium-report-read.js +118 -63
- package/workspace/public/pm/premium-vw-cal.js +62 -34
- package/workspace/public/pm/premium-vw-mtg.js +348 -192
- package/workspace/public/pm/program-model.js +192 -0
- package/workspace/public/pm/rec-state.js +63 -0
- package/workspace/public/pm/rp-parts.js +33 -8
- package/workspace/public/pm/tk-draft.js +107 -0
- package/workspace/public/pm/tk-model.js +134 -0
- package/workspace/public/pm/tk-send.js +124 -0
- package/workspace/public/pm/tk-tasks.css +120 -0
- package/workspace/public/premium-board.html +4 -2
- package/workspace/server.js +4 -2
- package/workspace/skills/jira-push.skill +3 -3
- package/workspace/test-lists/board-programs.json +9 -0
- package/workspace/test-lists/prd-to-jira.json +6 -0
- package/workspace/test-lists/program-hierarchy.json +11 -0
- package/workspace/test-lists/program-panel.json +9 -0
- package/workspace/test-lists/viewer-home-rows.json +9 -0
- package/workspace/test-lists/viewer-meetings.json +9 -0
- package/workspace/test-lists/viewer-shell-a.json +15 -0
- package/workspace/tk-tasks-test.js +199 -0
|
@@ -25,8 +25,11 @@ import { mountPhoneCard } from './home-phone-card.js';
|
|
|
25
25
|
import { mountFirst } from './premium-first.js';
|
|
26
26
|
import * as L from './home-list.js';
|
|
27
27
|
import * as TD from './home-today.js';
|
|
28
|
+
import * as YD from './home-day.js'; // Your day in the Viewer (XvAPhDay)
|
|
28
29
|
import { canDictate, dictate } from './home-dictate.js';
|
|
29
30
|
import { mountIni, iniList, iniOverview } from './home-ini.js'; // the initiative's stage move, Tasks and Core documents (premium-uncovered-features)
|
|
31
|
+
import * as MEN from './home-mentions.js'; // @Mentions, the permanent row at the top of Home and its Viewer (Viewer kit, XvANew)
|
|
32
|
+
import { mountRecRow } from './home-rec-row.js'; // the pinned recording row above it (XvARecHome)
|
|
30
33
|
|
|
31
34
|
const $ = (s, r = document) => r.querySelector(s);
|
|
32
35
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
@@ -75,10 +78,14 @@ const S = {
|
|
|
75
78
|
doneOpen: false, sheet: false, rec: {}, pin: new Set(JSON.parse(store.get('pmos.home.pin') || '[]')),
|
|
76
79
|
cardFold: store.get('pmos.home.cardfold') === '1', // the card's checklist folded to one line (AgInitSpec), kept in this browser
|
|
77
80
|
// the one list (premium-uncovered-features): the filter, the picked product, which groups and initiatives are open, kept in this browser
|
|
78
|
-
filter: 'today', product: store.get('pmos.home.product') || null, kidsOff: new Set(), rest: new Set(), tasks: new Set(), cap: false,
|
|
81
|
+
filter: 'today', product: store.get('pmos.home.product') || null, kidsOff: new Set(), rest: new Set(), tasks: new Set(), cap: false, day: false,
|
|
79
82
|
pg: (() => { try { return JSON.parse(store.get('pmos.home.pg') || '{}') || {}; } catch { return {}; } })(),
|
|
80
83
|
eodHidden: store.get('pmos.home.eod') === L.dayOf(), phoneChat: false,
|
|
81
84
|
};
|
|
85
|
+
// every fold of the list is kept in this browser (HvAC: "every group can be hidden or shown, and the choice is remembered"): the groups in
|
|
86
|
+
// pmos.home.pg, an initiative's rows and its "N more" in pmos.home.kids
|
|
87
|
+
(() => { try { const k = JSON.parse(store.get('pmos.home.kids') || '{}') || {}; for (const [n, v] of [['on', S.kids], ['off', S.kidsOff], ['rest', S.rest], ['tasks', S.tasks]]) for (const x of k[n] || []) v.add(x); } catch { /* none kept */ } })();
|
|
88
|
+
const keepKids = () => store.set('pmos.home.kids', JSON.stringify({ on: [...S.kids], off: [...S.kidsOff], rest: [...S.rest], tasks: [...S.tasks] }));
|
|
82
89
|
const toast = (t) => { const el = $('#toast'); el.textContent = t; el.classList.add('on'); clearTimeout(toast.t); toast.t = setTimeout(() => el.classList.remove('on'), 4200); };
|
|
83
90
|
|
|
84
91
|
/* ── reading ── */
|
|
@@ -91,9 +98,10 @@ async function getRetry(path, tries = 20) {
|
|
|
91
98
|
return { ok: false, error: 'still reading' };
|
|
92
99
|
}
|
|
93
100
|
async function load() {
|
|
94
|
-
const [brief, board, ses, desk, today, sch, work, day, rev] = await Promise.all([
|
|
101
|
+
const [brief, board, ses, desk, today, sch, work, day, rev, progs] = await Promise.all([
|
|
95
102
|
getRetry('/api/briefing-premium' + wsQ()), getRetry('/api/board-premium' + wsQ() + boardQ(WS ? '&' : '?')), pmGet('/api/sessions'), pmGet('/api/home-desk' + wsQ()),
|
|
96
103
|
pmGet('/api/brief-page' + wsQ()), pmGet('/api/schedules' + wsQ()), pmGet('/api/my-work-premium' + wsQ()), pmGet('/api/phone-day'), pmGet('/api/home-review' + wsQ()),
|
|
104
|
+
pmGet('/api/programs'),
|
|
97
105
|
]);
|
|
98
106
|
const D = S.D;
|
|
99
107
|
D.brief = brief && brief.ok && brief.model ? brief.model : null;
|
|
@@ -105,6 +113,7 @@ async function load() {
|
|
|
105
113
|
D.work = work && work.ok && work.model ? work.model : null; // the PM's own list (GET /api/my-work-premium): the filters and "Not in an initiative"
|
|
106
114
|
D.phoneDay = day && day.ok ? day : null; // what finished today, the recap and tomorrow (the end-of-day card, the Done filter)
|
|
107
115
|
D.review = rev && rev.ok ? rev : null; // this week's review (GET /api/home-review)
|
|
116
|
+
D.programs = progs && progs.ok ? progs.programs : []; // programs above initiatives, across products (GET /api/programs)
|
|
108
117
|
D.now = Date.now();
|
|
109
118
|
D.err = [brief, board].filter((x) => !x || !x.ok).map((x) => (x && x.error) || 'the server did not answer');
|
|
110
119
|
const rows = H.boardRows(D);
|
|
@@ -189,7 +198,8 @@ function recOf() { // a recording that is on and is no calendar meeting: the T
|
|
|
189
198
|
return { id: r.id, title: r.title || (n && n.title) || '', at: (REC && REC.started && REC.started()) || (n && (n.started || n.created)) || null, paused: !!(n && n.state === 'paused'), meeting };
|
|
190
199
|
}
|
|
191
200
|
function todayModel() {
|
|
192
|
-
|
|
201
|
+
// a recording that is on is the pinned row at the top of the list (XvARecHome): the Today card does not say it again; its pause and stop are in the meeting
|
|
202
|
+
const T = L.todayCard(S.D, { now: NOW(), rec: RECROW.state().on ? null : recOf(), hidden: S.eodHidden, titleOf: (id) => iniTitle(id) });
|
|
193
203
|
const R = L.reviewModel(S.D, NOW());
|
|
194
204
|
if (T.mode === 'day' && R.open && R.started) {
|
|
195
205
|
const left = R.steps.filter((x) => !x.done).length;
|
|
@@ -202,16 +212,42 @@ function homeListHtml() {
|
|
|
202
212
|
S.M = M;
|
|
203
213
|
const R = L.reviewModel(S.D, NOW());
|
|
204
214
|
// the first initiative where it is your turn shows what is under it, until the PM closes it
|
|
205
|
-
const firstTurn = M.groups.filter((g) => g.kind === 'product').flatMap((g) => g.inis).find((x) => x.turn);
|
|
215
|
+
const firstTurn = M.groups.filter((g) => g.kind === 'product' || g.kind === 'program').flatMap((g) => g.inis).find((x) => x.turn);
|
|
206
216
|
const open = (id) => S.kids.has(id) || (!!firstTurn && firstTurn.id === id && !S.kidsOff.has(id));
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
-
const pins = H.needsOf(S.D).filter((r) => S.pin.has(r.key)).length;
|
|
217
|
+
// a group is open until the PM folds it; another product starts folded; "Not in an initiative" starts folded on a phone (HvAC, HvACDesk)
|
|
218
|
+
const pOpen = (g) => (g.key in S.pg ? !!S.pg[g.key] : g.kind === 'loose' ? !isPhone() : g.kind === 'program' || g.primary || M.products.length === 1 || (!!S.product && !!g.product && S.product === g.product.key));
|
|
210
219
|
return TD.listHtml(M, todayModel(), {
|
|
211
220
|
sel: S.sel, isOpen: open, pOpen, restOpen: (k) => S.rest.has(k), cap: S.cap, tasksOpen: (k) => S.tasks.has(k), pin: S.pin, avHtml, ready: S.ready, err: S.D.err.length ? S.D.err[0] : '',
|
|
212
|
-
product: S.product, review: R, mic: canDictate(),
|
|
221
|
+
product: S.product, review: R, mic: canDictate(), phone: isPhone(), day: S.day, top: S.ready ? RECROW.html() + MEN.rowHtml(S.D, { sel: S.sel }) : '',
|
|
213
222
|
});
|
|
214
223
|
}
|
|
224
|
+
/** Your day (XvAPhDay, was the HvAOpen sheet): "Good morning" opens it in the Viewer, shell A. Full screen on a phone, beside the chat on a
|
|
225
|
+
* desktop; on a phone the moment card (TfPhone) is its Now section, and the calendar is under ⋯. */
|
|
226
|
+
function dayHtml() { return ''; }
|
|
227
|
+
function day(on) {
|
|
228
|
+
S.day = !!on;
|
|
229
|
+
if (!on) { const c = VW.current(); if (c && c.id === 'day') VW.close(); return; }
|
|
230
|
+
if (!S.M) return;
|
|
231
|
+
const Y = YD.dayModel(S.M, S.D, L.reviewModel(S.D, NOW()), NOW());
|
|
232
|
+
const ph = isPhone() && PHC;
|
|
233
|
+
const P = YD.dayParts(Y, { moment: !!ph });
|
|
234
|
+
VW.open({ id: 'day', kind: 'Your day', title: 'Your day', icon: YD.DAY_ICON, more: [{ label: 'Open the calendar', on: () => openCalendar() }],
|
|
235
|
+
onClose: () => { S.day = false; },
|
|
236
|
+
render: (body) => {
|
|
237
|
+
YD.drawDay(body, P, VW, ph ? (el) => { el.append(PHC.el); PHC.read(true); } : null);
|
|
238
|
+
body.onclick = (e) => { // the rows are the list's own rows: the same presses open them
|
|
239
|
+
const b = e.target.closest('button'); if (!b) return;
|
|
240
|
+
if (b.dataset.hmSel) { select(b.dataset.hmSel); return; }
|
|
241
|
+
if ('hmReview' in b.dataset) { openReviewVw(); return; }
|
|
242
|
+
if ('hdMeet' in b.dataset && Y.next) openMeeting(Y.next.meeting);
|
|
243
|
+
};
|
|
244
|
+
} });
|
|
245
|
+
}
|
|
246
|
+
/* the list's filter (HvACDesk): Today, Kept or Done, behind the icon in the list's top bar */
|
|
247
|
+
function filterMenu(b) {
|
|
248
|
+
const M = S.M || L.homeList(S.D, { now: NOW() });
|
|
249
|
+
menu(b, [{ key: 'today', label: 'Today' }].concat(M.filters).map((f) => ({ label: f.label, k: f.n ? String(f.n) : '', checked: S.filter === f.key, go: () => { S.filter = f.key; drawList(); const x = $('#hmList [data-hm-flt]'); if (x) x.focus(); } })), 'Show');
|
|
250
|
+
}
|
|
215
251
|
|
|
216
252
|
/* ── the initiative card ── */
|
|
217
253
|
function iniRowOf(id) { return H.boardRows(S.D).find((r) => r.id === id) || null; }
|
|
@@ -307,8 +343,8 @@ function elseHtml() {
|
|
|
307
343
|
function drawList() {
|
|
308
344
|
const el = $('#hmList');
|
|
309
345
|
// the list column: the groups scroll; the Elsewhere card is the column's foot (AgInitSpec, AgInitPhone)
|
|
310
|
-
let sc = el.querySelector(':scope > .hm-lsc'), ft = el.querySelector(':scope > .hm-lft');
|
|
311
|
-
if (!sc || !ft) { el.innerHTML = '<div class="hm-lsc"></div><div class="hm-lft"></div>'; sc
|
|
346
|
+
let sc = el.querySelector(':scope > .hm-lsc'), ft = el.querySelector(':scope > .hm-lft'), dy = el.querySelector(':scope > .hm-lday');
|
|
347
|
+
if (!sc || !ft || !dy) { el.innerHTML = '<div class="hm-lsc"></div><div class="hm-lft"></div><div class="hm-lday"></div>'; [sc, ft, dy] = el.children; }
|
|
312
348
|
const html = S.ini ? iniListHtml() : homeListHtml();
|
|
313
349
|
if (sc.__h !== html) {
|
|
314
350
|
const st = sc.scrollTop, cap = sc.querySelector('#hmCap'), capV = cap ? cap.value : '', capF = !!cap && document.activeElement === cap;
|
|
@@ -318,6 +354,9 @@ function drawList() {
|
|
|
318
354
|
}
|
|
319
355
|
const fh = elseHtml();
|
|
320
356
|
if (ft.__h !== fh) { ft.__h = fh; ft.innerHTML = fh; }
|
|
357
|
+
const dh = dayHtml();
|
|
358
|
+
if (dy.__h !== dh) { dy.__h = dh; dy.innerHTML = dh; dy.querySelectorAll('.hm-load i[data-f]').forEach((i) => i.style.setProperty('--bd-f', i.dataset.f)); }
|
|
359
|
+
document.body.classList.toggle('hm-dayon', !!dh);
|
|
321
360
|
iniList(sc);
|
|
322
361
|
// the first-run card after an import tops the list. The phone moment card is not in the list: it is the detail of the greeting
|
|
323
362
|
// at the top, and opens in the Viewer when the greeting is pressed (testing fixes: in the list it took a screen of room)
|
|
@@ -335,7 +374,7 @@ function allRows() {
|
|
|
335
374
|
const M = S.M || L.homeList(S.D, { now: NOW() });
|
|
336
375
|
const add = (r) => { if (!r) return; out.push(r); (r.kids || []).forEach(add); };
|
|
337
376
|
H.needsOf(S.D).forEach(add);
|
|
338
|
-
for (const g of M.groups) { (g.flat || []).forEach(add); (g.inis || []).forEach(add); (g.rest || []).forEach(add); (g.rows || []).forEach(add); }
|
|
377
|
+
for (const g of M.groups) { (g.flat || []).forEach(add); (g.inis || []).forEach(add); (g.rest || []).forEach(add); (g.rows || []).forEach(add); (g.tasks || []).forEach(add); }
|
|
339
378
|
if (M.list) M.list.rows.forEach(add);
|
|
340
379
|
if (S.filter !== 'today') { const T = L.homeList(S.D, { now: NOW() }); T.groups.forEach((g) => { (g.rows || []).forEach(add); (g.inis || []).concat(g.rest || []).forEach(add); }); }
|
|
341
380
|
if (S.lay) S.lay.groups.forEach((g) => g.rows.forEach(add));
|
|
@@ -365,6 +404,9 @@ const chat = mountChat($('#hmChat'), {
|
|
|
365
404
|
queue: (sid, text) => pmPost('/api/home-desk/queue', { session: sid, text }).then((r) => { if (r && r.ok && S.D.desk) { const q = { ...(S.D.desk.queued || {}) }; q[sid] = (q[sid] || []).concat({ text, at: r.at }); S.D.desk.queued = q; chat.refresh(); } }),
|
|
366
405
|
unqueue: (sid, at) => { pmPost('/api/home-desk/queue-drop', { session: sid, at }); if (S.D.desk && S.D.desk.queued && S.D.desk.queued[sid]) S.D.desk.queued[sid] = S.D.desk.queued[sid].filter((x) => x.at !== at); },
|
|
367
406
|
onScope: (b) => menu(b, scopeItems(), 'Where this goes'),
|
|
407
|
+
suggestLink: (t, first) => suggestLink(t, first),
|
|
408
|
+
linkTo: (sid, ini) => link(sid, ini),
|
|
409
|
+
dismissLink: (sid) => { try { localStorage.setItem('cz-linksug-x:' + sid, '1'); } catch { /* a private window: it shows again next time */ } },
|
|
368
410
|
onLink: (b, t) => menu(b, H.boardRows(S.D).map((r) => ({ label: r.title, sub: r.stage, go: () => link(t.sid, r.id) })), 'Link it to an initiative'),
|
|
369
411
|
onTo: (b, t) => menu(b, toItems(t), 'Send your messages to'), // @ and the To: chip: which conversation of this initiative you are writing in
|
|
370
412
|
workItem: (text, t) => workItem(text, t),
|
|
@@ -373,7 +415,22 @@ const chat = mountChat($('#hmChat'), {
|
|
|
373
415
|
wait: MORE.WAIT, // the Notes viewer only: the Home canvas does not draw it
|
|
374
416
|
desk: () => !isPhone(),
|
|
375
417
|
reopenViewer: () => reopenViewer(),
|
|
418
|
+
head: (t) => (isPhone() ? '' : TD.chatHeadHtml(chatHead(t))), // the phone names it in its top bar (#hmTop)
|
|
376
419
|
});
|
|
420
|
+
/* The chat's header line on a desktop (HvACDesk): the open row's mark and title, and where it sits: its initiative with the stage track, or
|
|
421
|
+
* its program. Home's own chat names nothing. */
|
|
422
|
+
function chatHead(t) {
|
|
423
|
+
if (!t || t.key === 'chat:main' || !t.title || t.title === 'Reading') return null;
|
|
424
|
+
const r = S.sel ? rowById(S.sel) : null;
|
|
425
|
+
if (t.prog) return { row: r, title: t.title, scope: t.prog.title, prog: true };
|
|
426
|
+
const title = r && r.kind !== 'ini' ? r.name : t.title;
|
|
427
|
+
// the weekly update and the product's own chat sit in the product: its name, no stage track
|
|
428
|
+
if (t.ini === 'product' || (r && r.ini === 'product')) return { row: r, title, scope: H.productName(S.D) };
|
|
429
|
+
const ini = t.ini || (r && r.ini) || null;
|
|
430
|
+
const ir = ini ? rowById('i:' + ini) : null, b = ini ? iniRowOf(ini) : null;
|
|
431
|
+
const stage = (ir && ir.stage) || (b && b.stage) || '';
|
|
432
|
+
return { row: r || ir, title, scope: ini ? iniTitle(ini) : '', at: L.stageAt(stage), stage };
|
|
433
|
+
}
|
|
377
434
|
function scopeItems() {
|
|
378
435
|
return [{ label: 'All work', sub: 'Home', go: () => select(null) }, { label: H.productName(S.D) + ' · product', go: () => goIni('product') }]
|
|
379
436
|
.concat(H.boardRows(S.D).map((r) => ({ label: r.title, sub: [r.lane, r.stage].filter(Boolean).join(' · '), go: () => goIni(r.id) })));
|
|
@@ -386,6 +443,24 @@ function toItems(cur) {
|
|
|
386
443
|
.concat(ses.map((s) => { const r = H.roleOf(s, S.D.desk && S.D.desk.roles), st = sessionTarget(s); return { label: (s.hx && s.hx.title) || s.name, sub: r.name + ' · another session of this initiative', checked: at === st.key, go: () => openTarget(st) }; }))
|
|
387
444
|
.concat([{ label: 'A new session', sub: 'A fresh conversation in ' + iniTitle(id), go: () => newIn(id) }]);
|
|
388
445
|
}
|
|
446
|
+
/* A loose chat's best guess at its initiative, by the words its title and first message share with an initiative's title (XvALinkSuggest).
|
|
447
|
+
* Two shared words, or one that is half the initiative's title, are enough; a dismissed guess does not come back for that chat. */
|
|
448
|
+
const STOP = new Set('the and for with from this that into about what when your our are was were has have not but can how new page work chat its'.split(' '));
|
|
449
|
+
const wordsOf = (x) => String(x || '').toLowerCase().split(/[^a-z0-9]+/).filter((w) => w.length >= 3 && !STOP.has(w));
|
|
450
|
+
function suggestLink(t, first) {
|
|
451
|
+
try { if (localStorage.getItem('cz-linksug-x:' + t.sid)) return null; } catch { /* no storage: still guess */ }
|
|
452
|
+
const have = new Set(wordsOf(t.title + ' ' + (first || '').slice(0, 400)));
|
|
453
|
+
if (!have.size) return null;
|
|
454
|
+
let best = null;
|
|
455
|
+
for (const r of H.boardRows(S.D)) {
|
|
456
|
+
const ws = [...new Set(wordsOf(r.title))]; if (!ws.length) continue;
|
|
457
|
+
const n = ws.filter((w) => have.has(w)).length;
|
|
458
|
+
if (!(n >= 2 || (n >= 1 && n / ws.length >= 0.5))) continue;
|
|
459
|
+
const sc = n + n / ws.length;
|
|
460
|
+
if (!best || sc > best.sc) best = { id: r.id, title: r.title, sc };
|
|
461
|
+
}
|
|
462
|
+
return best && { id: best.id, title: best.title };
|
|
463
|
+
}
|
|
389
464
|
async function link(sid, ini) {
|
|
390
465
|
const r = await pmPost('/api/session/initiative', { id: sid, initiative: ini });
|
|
391
466
|
if (!r || !r.ok) { toast((r && r.error) || 'The session was not linked.'); return; }
|
|
@@ -483,6 +558,15 @@ function updateTarget() {
|
|
|
483
558
|
context: 'The weekly update draft for ' + H.productName(S.D) + ':\n' + H.updateText(U, H.productName(S.D)) + '\nRecipients: ' + (U.to.join(', ') || 'none yet') + '. You can change the draft; the PM sends it from their own mail.',
|
|
484
559
|
placeholder: 'Tell Communicator what to change', also: null };
|
|
485
560
|
}
|
|
561
|
+
/** A program's conversation (?ask=program:<id>, a program task's row): Claude with the program as its scope. task names the open row. */
|
|
562
|
+
function programTarget(id, task) {
|
|
563
|
+
const pr = (S.D.programs || []).find((p) => p && p.id === id) || { id, title: (P.get('label') || '').slice(0, 80) || id };
|
|
564
|
+
const inis = (pr.members || []).map((m) => m && m.initiative).filter(Boolean);
|
|
565
|
+
return { key: 'chat:program:' + id, ws: WS || undefined, title: task ? task.name : pr.title, sub: task ? pr.title : 'Program', prog: { id, title: pr.title },
|
|
566
|
+
scope: { text: pr.title, icon: TD.P.layers }, rich: false, role: CLAUDE, placeholder: 'Message Claude about ' + pr.title,
|
|
567
|
+
empty: 'Ask about ' + pr.title + '. Claude reads the program and its initiatives in a real Claude Code session.',
|
|
568
|
+
context: 'Program ' + pr.title + ' (' + id + ')' + (inis.length ? ', with the initiatives ' + inis.join(', ') : '') + '.' + (task ? ' The PM opened its task "' + task.name + '"' + (task.hint ? ' (' + task.hint + ')' : '') + '.' : ''), also: null };
|
|
569
|
+
}
|
|
486
570
|
function homeTarget() {
|
|
487
571
|
return { key: 'chat:main', ws: WS || undefined, title: 'Home', scope: { text: 'All work', icon: I.home }, rich: false, placeholder: 'Message Claude', role: CLAUDE,
|
|
488
572
|
empty: 'Ask anything about your work. Claude reads your repositories and works in a real Claude Code session.', also: alsoOf(null) };
|
|
@@ -505,9 +589,9 @@ function select(id, o = {}) {
|
|
|
505
589
|
if (r.kind === 'update') { openTarget(updateTarget()); if (!o.keepViewer) openUpdateViewer(); }
|
|
506
590
|
else if (r.kind === 'need' && r.row) { openTarget(needTarget(r)); if (!o.keepViewer) openNeedViewer(r); }
|
|
507
591
|
else if (r.kind === 'session' || r.needSession) { const s = S.D.sessions.find((x) => x.id === r.sid); if (s) { openTarget(sessionTarget(s)); if (isMetricsSession(s) && !o.keepViewer && !isPhone()) openMetricsViewer(); } }
|
|
592
|
+
else if (r.kind === 'ptask') { S.phoneChat = isPhone(); openTarget(programTarget(r.program, r)); }
|
|
508
593
|
else if (r.kind === 'task') { openBoardTask(r.task); }
|
|
509
594
|
else if (r.kind === 'item') { import('./home-work.js').then((M) => M.openWorkItem(r.key)); }
|
|
510
|
-
else if (r.kind === 'mention') { openMention(r); }
|
|
511
595
|
else if (r.kind === 'finished') { openFinished(r.finished); }
|
|
512
596
|
else if (r.kind === 'meeting') { openMeeting(r.meeting); }
|
|
513
597
|
else if (r.kind === 'routine') { if (isMetrics(r.schedule)) openMetrics(o); else openRoutine(r.schedule); }
|
|
@@ -530,10 +614,11 @@ async function goIni(id) {
|
|
|
530
614
|
function goHome() { S.ini = null; S.sel = null; S.IM = null; syncUrl(); drawList(); openTarget(homeTarget()); }
|
|
531
615
|
function syncUrl() {
|
|
532
616
|
const q = new URLSearchParams(location.search);
|
|
533
|
-
['ini', 'open', 'item', 'session', 'ask', 'say', 'q', 'about', 'label', 'meeting', 'id', 'view'].forEach((k) => { if (!(k === 'open' && /^(report|chart|dashboard):/.test(q.get('open') || ''))) q.delete(k); });
|
|
617
|
+
['ini', 'open', 'item', 'session', 'ask', 'say', 'q', 'about', 'label', 'meeting', 'id', 'view', 'vk', 'vid'].forEach((k) => { if (!(k === 'open' && /^(report|chart|dashboard):/.test(q.get('open') || ''))) q.delete(k); });
|
|
534
618
|
if (S.ini) q.set('ini', S.ini);
|
|
535
619
|
const r = S.sel ? rowById(S.sel) : null;
|
|
536
|
-
if (r && r.
|
|
620
|
+
if (r && r.kind === 'ptask') q.set('item', r.id); // a program task: pt:<program>:<key>, the link the program panel makes
|
|
621
|
+
else if (r && r.key && r.kind !== 'session') q.set('open', r.key); else if (r && r.sid) q.set('session', r.sid);
|
|
537
622
|
const s = q.toString();
|
|
538
623
|
history.replaceState(null, '', location.pathname + (s ? '?' + s : ''));
|
|
539
624
|
}
|
|
@@ -558,21 +643,6 @@ function openBoardTask(t) {
|
|
|
558
643
|
onChange: () => load(),
|
|
559
644
|
}));
|
|
560
645
|
}
|
|
561
|
-
function openMention(r) {
|
|
562
|
-
const m = r.mention || {};
|
|
563
|
-
const draw = (b) => {
|
|
564
|
-
b.innerHTML = `<div class="ut-vc"><div><h2 class="ut-h2">${esc(r.name)}</h2><p class="ut-sub">${esc(['Mention', m.where || m.source, m.at ? H.hm(m.at) : ''].filter(Boolean).join(' · '))}</p></div>`
|
|
565
|
-
+ (m.text ? `<div class="ut-box">${esc(m.text)}</div>` : '') + (m.reply ? `<p class="ut-lbl">A reply you could send</p><div class="ut-box">${esc(m.reply)}</div>` : '')
|
|
566
|
-
+ `<div class="ut-foot">${HTTPS.test(m.link || '') ? `<a class="ut-btn pri" href="${esc(m.link)}" target="_blank" rel="noopener noreferrer">Open it</a>` : ''}<button type="button" class="ut-btn" data-mn-read>Mark it read</button></div>`
|
|
567
|
-
+ '<p class="ut-small ut-mut">PMOS sends nothing. Reply where the mention is.</p></div>';
|
|
568
|
-
};
|
|
569
|
-
const body = VW.open({ id: 'mention:' + (m.id || r.id), kind: 'Mention', title: r.name, icon: 'info', render: draw });
|
|
570
|
-
body.onclick = async (e) => {
|
|
571
|
-
if (!e.target.closest('[data-mn-read]')) return;
|
|
572
|
-
const res = await pmPost('/api/mentions/read', { id: m.id, read: true });
|
|
573
|
-
if (res && res.ok) { toast('Marked read.'); VW.close(); load(); } else toast((res && res.error) || 'Not marked read.');
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
646
|
function openFinished(f) {
|
|
577
647
|
if (!f) return;
|
|
578
648
|
VW.open({ id: 'fin:' + (f.id || f.title), kind: f.status === 'review' ? 'Finished · waits for your review' : 'Finished', title: f.title, icon: 'doc',
|
|
@@ -617,6 +687,7 @@ async function checkRow(id) {
|
|
|
617
687
|
let res = null;
|
|
618
688
|
if (r.kind === 'task' && r.task) res = await pmPost('/api/boards/tasks/state', { ws: r.task.ws || boardWs(), board: r.task.board || boardId(), task: r.task.uid, state: 'Done' });
|
|
619
689
|
else if (r.kind === 'item' && r.item) res = await pmPost('/api/pm-items/done', { id: r.item.id });
|
|
690
|
+
else if (r.kind === 'ptask') res = await pmPost('/api/programs/task-done', { ws: r.ws, program: r.program, key: r.key, done: true });
|
|
620
691
|
else return;
|
|
621
692
|
if (!res || !res.ok) { toast((res && res.error) || 'Not marked done.'); return; }
|
|
622
693
|
toast('Done.');
|
|
@@ -664,13 +735,17 @@ function openNeedViewer(r, focusWhy) {
|
|
|
664
735
|
// the decision is recorded on the chat's card (HmDecide); the Viewer keeps the facts it rests on
|
|
665
736
|
rec = '<p class="ut-small ut-mut">Record your decision on the card in the chat.</p>';
|
|
666
737
|
} else if (w.kind === 'return') {
|
|
667
|
-
//
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
+
|
|
673
|
-
|
|
738
|
+
// shell A (canvas XvAReturn): the summary says what the review found and holds Return it with Keep it as is beside it;
|
|
739
|
+
// why it goes back and what to change are open rows below, the facts the review rests on fold under them
|
|
740
|
+
const score = (pane.rows || d.facts || []).find((x) => /score|rubric/i.test(String(x[0] || '')));
|
|
741
|
+
b.innerHTML = VW.czSummary({ line: score ? String(score[1]) : r.hint || pane.h || 'Waits for your review', tone: 'warn', text: pane.intro || (pane.paras || [])[0] || r.hint || '',
|
|
742
|
+
meta: (w.agent || 'The agent') + ' gets this note and tries again. It counts as one correction.', primary: { label: 'Return it', act: 'return', disabled: !st.ret }, second: { label: 'Keep it as is', act: 'keep' } })
|
|
743
|
+
+ VW.czSections([
|
|
744
|
+
{ id: 'why', title: 'Why it goes back', open: true, html: `<div class="ut-chips" role="group" aria-label="Why it goes back">${RET_REASONS.map((x) => `<button type="button" class="cz-chip${st.ret === x ? ' on' : ''}" aria-pressed="${st.ret === x}" data-hv-ret="${esc(x)}">${esc(RET_LABEL[x] || x)}</button>`).join('')}</div>` },
|
|
745
|
+
{ id: 'note', title: 'What to change', open: true, html: `<div class="ut-field"><label for="hvNote" class="hi-vh">What to change</label><textarea id="hvNote" rows="3" placeholder="Say what the agent should change">${esc(st.note || '')}</textarea></div>` },
|
|
746
|
+
facts ? { id: 'facts', title: pane.h || 'The review', count: (pane.rows || d.facts || []).length, html: facts } : null,
|
|
747
|
+
], { key: 'return' })
|
|
748
|
+
+ '<p class="ut-small ut-mut" role="status" id="hvMsg"></p>';
|
|
674
749
|
if (focusWhy) { const t = b.querySelector('#hvNote'); if (t) setTimeout(() => t.focus(), 0); focusWhy = false; }
|
|
675
750
|
return;
|
|
676
751
|
} else if (w.kind === 'start') {
|
|
@@ -690,8 +765,8 @@ function openNeedViewer(r, focusWhy) {
|
|
|
690
765
|
if (t.dataset.hvUntil) { const res = await bpPost('put-off', { key: r.key, until: t.dataset.hvUntil }); if (res.ok) { toast('Put off. It comes back by itself, and it is not counted as done.'); VW.close(); await load(); select(null); } else say(res.error); return; }
|
|
691
766
|
if ('hvPin' in t.dataset) { if (S.pin.has(r.key)) S.pin.delete(r.key); else S.pin.add(r.key); store.set('pmos.home.pin', JSON.stringify([...S.pin])); draw(body); drawList(); return; }
|
|
692
767
|
if ('hvStart' in t.dataset) { start(r); return; }
|
|
693
|
-
if ('hvKeep' in t.dataset) { delete S.rec[r.key]; VW.close(); return; }
|
|
694
|
-
if ('hvRec' in t.dataset) {
|
|
768
|
+
if ('hvKeep' in t.dataset || t.dataset.czsAct === 'keep') { delete S.rec[r.key]; VW.close(); return; }
|
|
769
|
+
if ('hvRec' in t.dataset || t.dataset.czsAct === 'return') {
|
|
695
770
|
t.disabled = true;
|
|
696
771
|
const res = w.kind === 'decision' ? await bpPost('decide', { key: r.key, choice: st.choice, why: st.why }) : await bpPost('return', { run: w.run, reason: st.ret, ...(w.ws ? { ws: w.ws } : {}) });
|
|
697
772
|
if (!res.ok) { t.disabled = false; say(res.error); return; }
|
|
@@ -717,25 +792,42 @@ async function start(r) {
|
|
|
717
792
|
}
|
|
718
793
|
|
|
719
794
|
/* the weekly update: the recipients are editable; Send opens a mail draft in the PM's own mail and records that it was sent */
|
|
720
|
-
function openUpdateViewer() {
|
|
795
|
+
function openUpdateViewer(o = {}) {
|
|
796
|
+
// shell A (XvAWeekly, XvAWeeklyMore): the summary card says where it stands and holds the one primary, Send; the three groups fold;
|
|
797
|
+
// who gets it, copy as text and the past updates are under ⋯ (the xvMore note). Every line still opens its initiative.
|
|
798
|
+
let edit = !!o.edit, past = false;
|
|
721
799
|
const draw = (b) => {
|
|
722
800
|
const U = H.weeklyUpdate(S.D, S.D.now);
|
|
723
801
|
const sent = (U.sent || []).find((x) => x.week === U.week.iso);
|
|
724
|
-
const
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
802
|
+
const [ok, risk, dec] = U.sections.map((x) => x[2].length);
|
|
803
|
+
const words = [ok ? ok + ' on track' : '', risk ? risk + ' at risk' : '', dec ? dec + (dec === 1 ? ' needs' : ' need') + ' a decision' : ''].filter(Boolean);
|
|
804
|
+
const flag = U.sections.flatMap((x) => x[2]).find((x) => x.flag);
|
|
805
|
+
const text = (words.length ? words.join(', ').replace(/, ([^,]*)$/, ' and $1') + '.' : 'No initiative is open this week.') + (flag ? ' ' + flag.title + ': ' + flag.flag.toLowerCase() + '.' : '');
|
|
806
|
+
const sum = VW.czSummary({ line: sent ? 'Sent ' + new Date(sent.at).toDateString().slice(0, 10) : 'Ready to send', tone: sent ? '' : 'you', text,
|
|
807
|
+
meta: 'Communicator · ' + (U.to.length ? 'to ' + U.to.join(', ') : 'say who gets it under More'), primary: { label: sent ? 'Send again' : 'Send now', act: 'send' } });
|
|
808
|
+
const it = (x) => `<button type="button" class="czs-it" data-hv-ini="${esc(x.id)}"><span class="w">${esc(x.title)}<span>${esc([x.meta, x.text].filter(Boolean).join(' · '))}</span>${x.flag ? `<span class="flag">${esc(x.flag)}</span>` : ''}</span></button>`;
|
|
809
|
+
const secs = VW.czSections(U.sections.map(([k, h, L]) => ({ id: k, title: h, count: L.length, open: k !== 'ok' && L.length > 0, html: L.map(it).join('') }))
|
|
810
|
+
.concat([{ id: 'src', title: 'Sources', count: 'ladders and run logs · ' + H.hm(new Date(S.D.now).toISOString()), html: '<p>Drafted by Communicator from the ladders and run logs. Every line links to its source.</p>' }]), { key: 'weekly' });
|
|
811
|
+
const to = edit ? `<div class="hv-to"><span>To</span>${U.to.map((x, i) => `<button type="button" class="hv-chip" data-hv-rm="${i}" aria-label="Remove ${esc(x)}" title="Remove">${esc(x)}</button>`).join('')}<input id="hvTo" placeholder="${U.to.length ? 'Add' : 'Who gets it: a name, a mail or #channel'}" aria-label="Add a recipient"></div>` : '';
|
|
812
|
+
const old = past ? `<div class="czs-secs"><div class="czs-body" style="padding-top:12px">${(U.sent || []).length ? U.sent.slice().reverse().map((x) => `<div class="czs-it"><span class="w">Week ${esc(x.week)}<span>${esc(new Date(x.at).toDateString())} · to ${esc((x.to || []).join(', '))}</span></span></div>`).join('') : '<p>No update was sent yet.</p>'}</div></div>` : '';
|
|
813
|
+
b.innerHTML = to + sum + old + secs + '<p class="hx-n">Send opens a draft in your own mail app. PMOS sends nothing by itself; it records that you opened the draft.</p><p class="hx-n" role="status" id="hvMsg"></p>';
|
|
814
|
+
if (edit) { const i = b.querySelector('#hvTo'); if (i) i.focus(); }
|
|
729
815
|
};
|
|
730
816
|
const U0 = H.weeklyUpdate(S.D, S.D.now);
|
|
731
|
-
const
|
|
817
|
+
const copy = async () => { try { await navigator.clipboard.writeText(H.updateText(H.weeklyUpdate(S.D, S.D.now), H.productName(S.D))); toast('The update is copied as text.'); } catch { toast('The text could not be copied.'); } };
|
|
818
|
+
const more = () => [
|
|
819
|
+
{ label: 'Change who gets it', note: U0.to.length ? U0.to.length + (U0.to.length === 1 ? ' person' : ' people') : '', on: () => { edit = !edit; draw(body); } },
|
|
820
|
+
{ label: 'Copy as text', on: copy },
|
|
821
|
+
{ label: 'Past updates', note: (U0.sent || []).length ? U0.sent.length + ((U0.sent.length === 1) ? ' week' : ' weeks') : '', on: () => { past = !past; draw(body); } },
|
|
822
|
+
];
|
|
823
|
+
const body = VW.open({ id: 'update', kind: 'Weekly update', title: H.productName(S.D) + ' · week of ' + U0.week.label, icon: 'doc', url: selfUrl({ ini: 'product' }), more: more(), render: draw });
|
|
732
824
|
const saveTo = async (to) => { const r = await pmPost('/api/home-desk/recipients', { ws: deskWs(), to }); if (r && r.ok) { S.D.desk.product = { ...(S.D.desk.product || {}), recipients: r.recipients }; draw(body); drawList(); } else toast((r && r.error) || 'The recipients were not saved.'); };
|
|
733
825
|
body.onkeydown = (e) => { if (e.target.id === 'hvTo' && (e.key === 'Enter' || e.key === ',')) { e.preventDefault(); const v = e.target.value.trim(); if (v) saveTo(H.weeklyUpdate(S.D).to.concat(v)); } };
|
|
734
826
|
body.onclick = async (e) => {
|
|
735
827
|
const t = e.target.closest('button'); if (!t) return;
|
|
736
828
|
if (t.dataset.hvRm) { const to = H.weeklyUpdate(S.D).to.slice(); to.splice(+t.dataset.hvRm, 1); saveTo(to); return; }
|
|
737
829
|
if (t.dataset.hvIni) { goIni(t.dataset.hvIni); return; }
|
|
738
|
-
if ('hvSend' in t.dataset) sendUpdate();
|
|
830
|
+
if (t.dataset.czsAct === 'send' || 'hvSend' in t.dataset) sendUpdate();
|
|
739
831
|
};
|
|
740
832
|
}
|
|
741
833
|
/** This page's address for one view (the Viewer's Open in a new tab): the workspace and board of this page, and the view's own keys. */
|
|
@@ -743,7 +835,7 @@ const selfUrl = (o) => { const q = new URLSearchParams(); if (WS) q.set('ws', WS
|
|
|
743
835
|
const deskWs = () => (S.D.desk && S.D.desk.ws) || ((S.D.board && S.D.board.board) || {}).ws || WS || undefined;
|
|
744
836
|
async function sendUpdate() {
|
|
745
837
|
const U = H.weeklyUpdate(S.D, S.D.now);
|
|
746
|
-
if (!U.to.length) { openUpdateViewer(); toast('Say who the update goes to first.'); setTimeout(() => { const i = $('#hvTo'); if (i) i.focus(); }, 0); return; }
|
|
838
|
+
if (!U.to.length) { openUpdateViewer({ edit: true }); toast('Say who the update goes to first.'); setTimeout(() => { const i = $('#hvTo'); if (i) i.focus(); }, 0); return; }
|
|
747
839
|
const name = H.productName(S.D), subject = name + ' · week of ' + U.week.label;
|
|
748
840
|
const mails = U.to.filter((x) => /@/.test(x));
|
|
749
841
|
location.href = 'mailto:' + mails.map(encodeURIComponent).join(',') + '?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(H.updateText(U, name) + (U.to.length > mails.length ? '\n\nAlso for: ' + U.to.filter((x) => !/@/.test(x)).join(', ') : ''));
|
|
@@ -879,10 +971,15 @@ function openMetricsViewer() {
|
|
|
879
971
|
const draw = (b) => {
|
|
880
972
|
const m = MET && MET.model, V = metricsView(m);
|
|
881
973
|
if (!m) { b.innerHTML = `<div class="hv"><p class="hx-n" role="status">${MET && MET.error ? 'The metrics were not read: ' + esc(MET.error) + '.' : 'Reading the metrics.'}</p></div>`; return; }
|
|
882
|
-
|
|
974
|
+
// shell A (canvas XvAMetrics): the summary card leads with the correction rate and the month in one line; the weekly bars follow;
|
|
975
|
+
// the other tiles and what moved it are rows below. There is no primary: nothing here writes (honest state).
|
|
976
|
+
const [first, ...rest] = V.tiles;
|
|
977
|
+
const fell = /fell/.test(V.line), rose = /rose/.test(V.line);
|
|
978
|
+
b.innerHTML = VW.czSummary({ line: first ? first.label + ' ' + first.value : '', tone: rose ? 'warn' : fell ? 'ok' : '', text: V.line, meta: (m && m.note) || '' })
|
|
883
979
|
+ (V.bars.length ? `<figure class="hm-fig"><figcaption>Correction rate per agent run, by week (lower is better)</figcaption><div class="hm-chart" role="img" aria-label="${esc('Correction rate by week: ' + V.bars.map((x) => x.w + ' ' + x.v).join(', '))}">${V.bars.map((x) => `<div title="${esc(x.week ? 'Week to ' + x.week : x.w)}"><span>${esc(x.v)}</span><i class="${x.now ? 'now' : ''}" data-h="${x.h}"></i></div>`).join('')}</div><div class="hm-chx" aria-hidden="true">${V.bars.map((x) => `<span>${x.w}</span>`).join('')}</div></figure>` : '')
|
|
884
|
-
+
|
|
885
|
-
|
|
980
|
+
+ VW.czSections([{ id: 'moved', title: 'What moved it', count: V.moved.length, open: true,
|
|
981
|
+
html: `<table class="hm-moved"><thead><tr><th scope="col">What moved it</th><th scope="col">Effect</th></tr></thead><tbody>${V.moved.map(([n, e]) => `<tr><td>${esc(n)}</td><td>${esc(e)}</td></tr>`).join('') || '<tr><td colspan="2">Nothing moved since the week before.</td></tr>'}</tbody></table>` }]
|
|
982
|
+
.concat(rest.map((t, i) => ({ id: 't' + i, title: t.label, count: t.value, html: t.note ? `<p>${esc(t.note)}</p>` : '' }))), { key: 'metrics' }); // the first tile's note (was N the week before) is already in the line: said once
|
|
886
983
|
b.querySelectorAll('.hm-chart i[data-h]').forEach((i) => i.style.setProperty('--bd-h', i.dataset.h + 'px')); // each bar's height: run-time geometry
|
|
887
984
|
};
|
|
888
985
|
const body = VW.open({ id: 'metrics', kind: 'Metrics review', title: H.productName(S.D) + ' · ' + MONTHS[new Date(S.D.now).getMonth()], icon: I.chart, url: selfUrl({ ini: 'product', view: 'metrics' }), render: draw });
|
|
@@ -922,15 +1019,6 @@ async function openMeeting(m) {
|
|
|
922
1019
|
if (typeof v.openMeeting === 'function') return v.openMeeting(m.note ? { note: m.note } : m, { ws: deskWs() });
|
|
923
1020
|
try { const M = await import('./premium-vw-mtg.js'); return M.openMeeting(m.note ? { note: m.note } : m, { ws: deskWs() }); } catch { return VW.placeholder('Meeting', { icon: 'meet' }); }
|
|
924
1021
|
}
|
|
925
|
-
/** A phone: the greeting's detail, the moment card of the day (home-phone-card.js) in the Viewer, with the calendar one press on. */
|
|
926
|
-
function openMoment() {
|
|
927
|
-
VW.open({ id: 'moment', kind: 'Your day', title: L.greetWord(), icon: 'cal', render: (body) => {
|
|
928
|
-
body.append(PHC.el);
|
|
929
|
-
body.insertAdjacentHTML('beforeend', '<p class="ut-acts hm-mcal"><button type="button" class="ut-btn sm soft" data-hm-mcal>Open the calendar</button></p>');
|
|
930
|
-
body.onclick = (e) => { if (e.target.closest('[data-hm-mcal]')) openCalendar(); };
|
|
931
|
-
PHC.read(true);
|
|
932
|
-
} });
|
|
933
|
-
}
|
|
934
1022
|
async function openCalendar() {
|
|
935
1023
|
const v = await V();
|
|
936
1024
|
if (typeof v.openCalendar === 'function') return v.openCalendar({ ws: deskWs(), view: 'day' });
|
|
@@ -941,6 +1029,19 @@ async function openCalendar() {
|
|
|
941
1029
|
let REC = null;
|
|
942
1030
|
import('./premium-meeting.js').then((M) => { REC = M.recCore({ pmGet, pmPost, ws: () => WS || null }); REC.refresh().then(() => drawList()); }).catch(() => { REC = null; });
|
|
943
1031
|
addEventListener('premium-rec', () => drawList());
|
|
1032
|
+
const RECROW = mountRecRow({ notes: () => (REC && REC.notes ? REC.notes() : []), refresh: () => REC && REC.refresh(), redraw: () => drawList() });
|
|
1033
|
+
/* what the Mentions Viewer needs from Home (home-mentions.js) */
|
|
1034
|
+
function menCtx() {
|
|
1035
|
+
return { D: () => S.D, pmPost, toast, reload: () => load(), iniTitle, goIni: (id) => goIni(id), stageOf: (id) => (iniRowOf(id) || {}).stage || '',
|
|
1036
|
+
draft: (m) => { // Draft a reply: Home's chat writes it with the PM; PMOS sends nothing, the PM answers where the mention is
|
|
1037
|
+
const who = String(m.who || 'them').split(/\s+/)[0];
|
|
1038
|
+
S.phoneChat = isPhone(); if (isPhone()) VW.close();
|
|
1039
|
+
openTarget({ ...homeTarget(), key: 'chat:mention-' + m.id, title: 'Reply to ' + who, scope: { text: MEN.placeOf(m), icon: I.chat },
|
|
1040
|
+
intro: { role: CLAUDE, text: (m.who || 'Someone') + (m.reply ? ' asks: “' : ' wrote: “') + (m.text || '') + '” Tell me what to answer and I will draft it. You send it in ' + MEN.placeOf(m) + '.' },
|
|
1041
|
+
placeholder: 'What should the reply say?', context: 'A mention of the PM to answer. ' + (m.who || 'Someone') + ' in ' + MEN.placeOf(m) + ': ' + (m.text || '') + (m.initiative ? ' (initiative ' + m.initiative + ')' : '') });
|
|
1042
|
+
drawList(); chat.focus();
|
|
1043
|
+
} };
|
|
1044
|
+
}
|
|
944
1045
|
function recLive() {
|
|
945
1046
|
if (!REC) return null;
|
|
946
1047
|
const h = REC.holding && REC.holding();
|
|
@@ -1062,7 +1163,7 @@ $('#hmNeeds').onclick = () => sheet(!S.sheet);
|
|
|
1062
1163
|
// My work's "Weekly review" (home-work.js) asks Home, which holds the data the review reads
|
|
1063
1164
|
addEventListener('hm:review', (e) => { e.preventDefault(); openReviewVw(); });
|
|
1064
1165
|
// a phone: the day's moment card opens on the greeting's press, and on this event from any other place that asks for the day
|
|
1065
|
-
addEventListener('hm:day', () =>
|
|
1166
|
+
addEventListener('hm:day', () => day(true));
|
|
1066
1167
|
$('#hmBack').onclick = () => { S.phoneChat = false; S.sel = null; drawList(); syncUrl(); const f = $('#hmList .hm-rm'); if (f) f.focus(); };
|
|
1067
1168
|
$('#hmMoreP').onclick = (e) => moreMenu(e.currentTarget);
|
|
1068
1169
|
$('#hmDesk').onclick = (e) => { if (S.sheet && e.target === $('#hmDesk')) sheet(false); }; // a press beside the sheet closes it; Escape and the N need you button do too
|
|
@@ -1071,21 +1172,26 @@ $('#hmDesk').onclick = (e) => { if (S.sheet && e.target === $('#hmDesk')) sheet(
|
|
|
1071
1172
|
$('#hmList').onclick = (e) => { // delegated: every press on the list is a <button>
|
|
1072
1173
|
const b = e.target.closest('button'); if (!b) return;
|
|
1073
1174
|
const d = b.dataset;
|
|
1074
|
-
if (d.hmSel) { select(d.hmSel); return; }
|
|
1175
|
+
if (d.hmSel) { if (S.day) S.day = false; select(d.hmSel); return; }
|
|
1176
|
+
if ('hrMentions' in d) { if (S.day) S.day = false; S.sel = 'mentions'; drawList(); MEN.openMentions(menCtx()); return; }
|
|
1177
|
+
if ('hmDay' in d) { day(!S.day); return; }
|
|
1178
|
+
if ('hmDayx' in d) { day(false); return; }
|
|
1179
|
+
if ('hmFlt' in d) { filterMenu(b); return; }
|
|
1180
|
+
if (d.hmProg) { location.href = '/premium-board.html?program=' + encodeURIComponent(d.hmProg) + wsQ('&'); return; } // the program panel (the Board opens it)
|
|
1075
1181
|
if (d.hmKids) { // the chevron of an initiative: what sits under it shows or hides
|
|
1076
1182
|
if (b.getAttribute('aria-expanded') === 'true') { S.kids.delete(d.hmKids); S.kidsOff.add(d.hmKids); } else { S.kids.add(d.hmKids); S.kidsOff.delete(d.hmKids); }
|
|
1077
|
-
drawList(); const f = $(`#hmList [data-hm-kids="${CSS.escape(d.hmKids)}"]`); if (f) f.focus(); return;
|
|
1183
|
+
keepKids(); drawList(); const f = $(`#hmList [data-hm-kids="${CSS.escape(d.hmKids)}"]`); if (f) f.focus(); return;
|
|
1078
1184
|
}
|
|
1079
1185
|
if (d.hmPg) { const open = b.getAttribute('aria-expanded') === 'true'; S.pg[d.hmPg] = !open; store.set('pmos.home.pg', JSON.stringify(S.pg)); drawList(); const f = $(`#hmList [data-hm-pg="${CSS.escape(d.hmPg)}"]`); if (f) f.focus(); return; }
|
|
1080
1186
|
if ('hmProd' in d) { goIni('product'); return; }
|
|
1081
|
-
if (d.hmTasks) { if (S.tasks.has(d.hmTasks)) S.tasks.delete(d.hmTasks); else S.tasks.add(d.hmTasks); drawList(); return; }
|
|
1082
|
-
if (d.hmRest) { if (S.rest.has(d.hmRest)) S.rest.delete(d.hmRest); else S.rest.add(d.hmRest); drawList(); return; }
|
|
1187
|
+
if (d.hmTasks) { if (S.tasks.has(d.hmTasks)) S.tasks.delete(d.hmTasks); else S.tasks.add(d.hmTasks); keepKids(); drawList(); return; }
|
|
1188
|
+
if (d.hmRest) { if (S.rest.has(d.hmRest)) S.rest.delete(d.hmRest); else S.rest.add(d.hmRest); keepKids(); drawList(); return; }
|
|
1083
1189
|
if (d.hmFilter) { S.filter = S.filter === d.hmFilter ? 'today' : d.hmFilter; drawList(); const f = $(`#hmList [data-hm-filter="${d.hmFilter}"]`); if (f) f.focus(); return; }
|
|
1084
1190
|
if (d.hmCheck) { checkRow(d.hmCheck); return; }
|
|
1085
|
-
if ('hmReview' in d) { openReviewVw(); return; }
|
|
1191
|
+
if ('hmReview' in d) { if (S.day) day(false); openReviewVw(); return; }
|
|
1086
1192
|
if ('hmPick' in d) { pickProduct(b); return; }
|
|
1087
1193
|
if ('hmCapmic' in d) { const i = $('#hmCap'); if (i) capMic(i, b); return; }
|
|
1088
|
-
if (d.hmTc) { todayPress(d.hmTc, b); return; }
|
|
1194
|
+
if (d.hmTc) { if (S.day && d.hmTc === 'cal') day(false); todayPress(d.hmTc, b); return; }
|
|
1089
1195
|
if (d.hmEnd) { endRow(d.hmEnd); return; }
|
|
1090
1196
|
if (d.hmGroup) { if (S.shut.has(d.hmGroup)) S.shut.delete(d.hmGroup); else S.shut.add(d.hmGroup); store.set('pmos.home.shut', JSON.stringify([...S.shut])); drawList(); return; }
|
|
1091
1197
|
if ('hmAllneeds' in d) { S.allNeeds = !S.allNeeds; drawList(); return; }
|
|
@@ -1104,7 +1210,7 @@ $('#hmList').onclick = (e) => { // delegated: every press on the list is a <bu
|
|
|
1104
1210
|
if ('hmElse' in d) { const f = S.lay && S.lay.elsewhere && S.lay.elsewhere.first; goHome(); if (f) select(f.id); return; }
|
|
1105
1211
|
if ('hmPerson' in d) addPerson();
|
|
1106
1212
|
};
|
|
1107
|
-
$('#hmList').addEventListener('keydown', (e) => { if (e.key === 'Escape' && e.target.id === 'hmCap' && S.cap) { e.stopPropagation(); S.cap = false; drawList(); } });
|
|
1213
|
+
$('#hmList').addEventListener('keydown', (e) => { if (e.key === 'Escape' && e.target.id === 'hmCap' && S.cap) { e.stopPropagation(); S.cap = false; drawList(); } else if (e.key === 'Escape' && S.day) { e.stopPropagation(); day(false); } });
|
|
1108
1214
|
$('#hmList').addEventListener('submit', async (e) => { // the capture box: Enter adds the task
|
|
1109
1215
|
if (e.target.id !== 'hmCapF') return;
|
|
1110
1216
|
e.preventDefault();
|
|
@@ -1128,7 +1234,7 @@ function capMic(input, b) {
|
|
|
1128
1234
|
/* the Today card's presses (HmDay, HmMic): the calendar, the meeting's prep, the live meeting, the recording, the end of the day */
|
|
1129
1235
|
async function todayPress(k, b) {
|
|
1130
1236
|
const T = todayModel();
|
|
1131
|
-
if (k === 'cal') { if (isPhone()
|
|
1237
|
+
if (k === 'cal') { if (isPhone()) day(true); else openCalendar(); return; }
|
|
1132
1238
|
if ((k === 'prep' || k === 'open') && T.meeting) { openMeeting(T.meeting); return; }
|
|
1133
1239
|
if (k === 'record') { MORE.openRecorder().then(() => drawList()); return; }
|
|
1134
1240
|
if (k === 'hl') { const r = REC && await REC.highlight(); toast(r && r.ok ? 'Highlighting the last 30 seconds and the next ones.' : (r && r.error) || 'The highlight did not start.'); return; }
|
|
@@ -1178,9 +1284,17 @@ drawList(); drawTop();
|
|
|
1178
1284
|
: sidAt ? { ...homeTarget(), key: '', title: 'Reading', empty: 'Reading the session.' }
|
|
1179
1285
|
: S.ini ? (S.ini === 'product' ? { ...homeTarget(), title: 'Reading' } : iniTarget(S.ini)) : homeTarget());
|
|
1180
1286
|
}
|
|
1287
|
+
/* "Discuss in chat" on another page (cozy-viewer.js discuss): the chat about the item opens, and the item opens in the Viewer beside it when
|
|
1288
|
+
* Home has a view of its own for it: a document by its path, a work-item by its key. Anything else is the chat alone, named by its label. */
|
|
1289
|
+
function discussed(about, vid, label) {
|
|
1290
|
+
if (!vid || isPhone()) return;
|
|
1291
|
+
if (/^doc:/.test(about) && /^[\w./-]+\.\w+$/.test(vid)) openFile({ path: vid, name: label || vid.split('/').pop() });
|
|
1292
|
+
else if (/^work:/.test(about)) import('./home-work.js').then((M) => M.openWorkItem(vid)).catch(() => {});
|
|
1293
|
+
}
|
|
1181
1294
|
/* The address: ?ini=<id> an initiative's layout · ?open=<row key> a Needs-you row · ?session=<id> a session · ?ask=<initiative id> | board:<key> |
|
|
1182
1295
|
* insights | verdict with the question in ?q, or ?about=<key>&label=<name>: that conversation · ?open=report:|chart:|dashboard:<id> that one in the
|
|
1183
|
-
* Viewer · ?say=<words> or ?q a first message in the box, not sent · ?meeting=<note id> the meeting card
|
|
1296
|
+
* Viewer · ?say=<words> or ?q a first message in the box, not sent · ?meeting=<note id> the meeting card · ?vk=<kind>&vid=<id> with ?about: the
|
|
1297
|
+
* item Discuss in chat came from, opened in the Viewer beside its chat. */
|
|
1184
1298
|
const KEY = /^(decision|blocked|waited|src|ev|work|board|init|doc|ins|chat|pop):[A-Za-z0-9][A-Za-z0-9._:-]{0,100}$/;
|
|
1185
1299
|
load().then(() => {
|
|
1186
1300
|
const open = P.get('open') || P.get('item'), sid = P.get('session'), mt = P.get('meeting');
|
|
@@ -1190,10 +1304,16 @@ load().then(() => {
|
|
|
1190
1304
|
const asked = !ask ? '' : /^board:/.test(ask) ? ask : /^(insights|verdict)$/.test(ask) ? 'ins:' + ask : 'init:' + ask;
|
|
1191
1305
|
const about = KEY.test(P.get('about') || '') ? P.get('about') : KEY.test(asked) ? asked : null;
|
|
1192
1306
|
if (isPhone() && ((open && !blockOpen) || sid || about)) { S.phoneChat = true; drawList(); } // the conversation the address names, not the list
|
|
1193
|
-
if (open && !blockOpen) {
|
|
1307
|
+
if (open && !blockOpen) {
|
|
1308
|
+
// ?item=pt:<program>:<key> (the program panel's link to a program task) names the row by its id; its program group opens to show it
|
|
1309
|
+
const r = allRows().find((x) => x.key === open || (/^pt:/.test(open) && x.id === open));
|
|
1310
|
+
if (r && r.kind === 'ptask') { S.pg['g:' + r.program] = true; drawList(); }
|
|
1311
|
+
if (r) select(r.id); else if (KEY.test(open)) openTarget({ ...homeTarget(), key: open, title: open });
|
|
1312
|
+
}
|
|
1194
1313
|
else if (sid) { const s = S.D.sessions.find((x) => x.id === sid); if (s) { S.sel = 's:' + s.id; openTarget(sessionTarget(s)); drawList(); } else { openTarget(homeTarget()); toast('That session is not on this machine.'); } }
|
|
1195
|
-
else if (
|
|
1196
|
-
else if (about
|
|
1314
|
+
else if (/^program:[A-Za-z0-9][A-Za-z0-9._-]{0,100}$/.test(ask)) openTarget(programTarget(ask.slice(8))); // Ask in Home from the program panel
|
|
1315
|
+
else if (about && /^init:/.test(about) && iniRowOf(P.get('vid') || about.slice(5))) { const id = iniRowOf(P.get('vid')) ? P.get('vid') : about.slice(5); goIni(id).then(() => { if (P.get('vk') && S.ini === id && !isPhone()) iniOverview(); }); }
|
|
1316
|
+
else if (about) { openTarget({ ...homeTarget(), key: about, title: (P.get('label') || '').slice(0, 80) || about }); discussed(about, P.get('vid'), P.get('label')); }
|
|
1197
1317
|
else if (S.ini && P.get('view') === 'metrics') goIni(S.ini).then(() => openMetrics()); // ?view=metrics: the metrics review, as its Open in a new tab names it
|
|
1198
1318
|
else if (S.ini) goIni(S.ini);
|
|
1199
1319
|
else if (!isPhone() && !blockOpen && !say && !VW.isOpen()) { const first = H.needsOf(S.D)[0]; if (first) select(first.id); } // a card the PM opened while Home was reading stays
|