create-pmos 0.836.0 → 0.838.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 +124 -47
- package/payload/KIT-VERSION +1 -1
- 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/workspace/changelog.json +123 -2
- package/workspace/guide/cli.md +29 -0
- package/workspace/guide/home.md +1 -0
- package/workspace/guide/initiatives-and-next-steps.md +8 -0
- package/workspace/guide/layout.md +5 -1
- package/workspace/lib/built-vs-design-http.js +81 -0
- package/workspace/lib/built-vs-design.js +454 -0
- package/workspace/lib/deps-cli.js +47 -2
- package/workspace/lib/features.json +2 -0
- package/workspace/lib/hire-draft.js +4 -3
- package/workspace/lib/initiative-rows.js +3 -0
- package/workspace/lib/meeting-stance.js +199 -0
- package/workspace/lib/needs-providers.js +1 -0
- package/workspace/lib/people-cli.js +44 -1
- package/workspace/lib/pmos-verbs.js +7 -1
- package/workspace/lib/prefs-sync.js +1 -0
- package/workspace/lib/review-cli.js +6 -0
- package/workspace/lib/route-modules.js +3 -0
- package/workspace/lib/routes-meeting-stance.js +43 -0
- package/workspace/lib/routes-pop-work.js +4 -1
- package/workspace/lib/routes-segments.js +47 -0
- package/workspace/lib/routes-surface-moments.js +36 -0
- package/workspace/lib/routes-team-waits.js +39 -2
- package/workspace/lib/segments-cli.js +102 -0
- package/workspace/lib/segments.js +214 -0
- package/workspace/lib/surface-moments.js +185 -0
- package/workspace/lib/team-slips.js +160 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/ask-here-ctx.js +20 -2
- package/workspace/public/pm/ask-here.css +6 -1
- package/workspace/public/pm/ask-here.js +38 -25
- package/workspace/public/pm/bd-backlog.js +34 -5
- package/workspace/public/pm/built-vs-design.css +16 -0
- package/workspace/public/pm/built-vs-design.js +95 -0
- package/workspace/public/pm/cozy-board.css +11 -0
- package/workspace/public/pm/cozy-events-view.js +1 -1
- package/workspace/public/pm/cozy-home.css +10 -0
- package/workspace/public/pm/cozy-pop-work.js +11 -6
- package/workspace/public/pm/cozy-today-app.js +42 -1
- package/workspace/public/pm/cozy-today-model.js +70 -3
- package/workspace/public/pm/cozy-today-view.js +10 -1
- package/workspace/public/pm/goals-ds.js +3 -2
- package/workspace/public/pm/home-chat.js +19 -3
- package/workspace/public/pm/ini-tasks.js +2 -2
- package/workspace/public/pm/meeting-stance.js +113 -0
- package/workspace/public/pm/page-chat.js +2 -1
- package/workspace/public/pm/premium-board.js +2 -0
- package/workspace/public/pm/segments.js +113 -0
- package/workspace/public/pm/team-slips.js +48 -0
- package/workspace/public/premium-board.html +2 -0
- package/workspace/test-lists/built-vs-design.json +9 -0
- package/workspace/test-lists/meeting-stance.json +9 -0
- package/workspace/test-lists/segments.json +9 -0
- package/workspace/test-lists/surface-moments.json +9 -0
- package/workspace/test-lists/team-slips.json +9 -0
|
@@ -38,10 +38,12 @@ import * as IF from './inline-fields.js'; // a task's sprint and priority, set
|
|
|
38
38
|
import * as SD from './star-draft.js'; // a ✦ draft runs as a PMOS background job and lands on its line (star-buttons-act-directly A7)
|
|
39
39
|
import * as CAP from './pop-cap.js'; // five actions at most: Ask PMOS and the toolbar's four, the rest under ⋯ (popup-cap, idea A498)
|
|
40
40
|
import { noteUse } from './use-log.js';
|
|
41
|
+
import * as BVD from './built-vs-design.js'; // the built screen beside its design, its circles, Accept and Send back (built-vs-design, A380)
|
|
41
42
|
import * as STMAP from './story-map.js'; // a new bet's story map with the Release 1 line (initiative story-map, A419)
|
|
42
43
|
import * as TLY from './three-layouts.js'; // three layouts for a new screen, pick one (initiative three-layouts, A317)
|
|
43
44
|
import * as PR from './print-pdf.js'; // Print or PDF under ⋯ (job #1911, A379)
|
|
44
45
|
import * as SMAP from './stakeholder-map.js'; // the People block: who decides, must agree, needs to know (stakeholder-map, A371)
|
|
46
|
+
import * as MST from './meeting-stance.js'; // before the meeting: the two questions for a contested decision, and where each stands (meeting-stance, A333)
|
|
45
47
|
import * as PD from './bd-pop-ds.js'; // the popup on a computer, built from the design system's blocks (initiative work-ds-popup) // the Kind of a file and one row per kind (round 3 point 16), shared with the Library // the rename and its Undo, the same write as the old List (batch 18 item 16)
|
|
46
48
|
|
|
47
49
|
const CSS = new URL('./cozy-pop-work.css', import.meta.url).href, DSCSS = new URL('./bd-pop-ds.css', import.meta.url).href;
|
|
@@ -108,7 +110,7 @@ export const resetItems = () => { ITEMS.clear(); CRIT.clear(); };
|
|
|
108
110
|
/* A chat turn may have written what the popup shows (initiative chat-saves-to-cards, Wawan 2026-11-23: the chat saved the case and the card
|
|
109
111
|
* kept saying no line is written): the popup's reads of one initiative (the case's artefacts, the Library's rows, the done test's criteria)
|
|
110
112
|
* were kept for the page's life, so they are read again after every chat turn, and when the page comes back into view. */
|
|
111
|
-
function rereadAll() { ART.clear(); ITEMS.clear(); CRIT.clear(); TLY.forget(); if (artRedraw) artRedraw(); }
|
|
113
|
+
function rereadAll() { ART.clear(); ITEMS.clear(); CRIT.clear(); BVD.reset(); TLY.forget(); if (artRedraw) artRedraw(); }
|
|
112
114
|
if (typeof document !== 'undefined' && document.addEventListener) {
|
|
113
115
|
document.addEventListener('cz:chat-turn', () => rereadAll());
|
|
114
116
|
document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'visible') rereadAll(); });
|
|
@@ -454,7 +456,7 @@ function model(r, v0, o) {
|
|
|
454
456
|
}
|
|
455
457
|
export function html(r, v, o = {}) {
|
|
456
458
|
const { W, S } = model(r, v, o), C = cols(), mode = store.get(SPAN, 'full');
|
|
457
|
-
if (phone() && !RO) return phoneHtml(W, S, keyOf(v, o), v);
|
|
459
|
+
if (phone() && !RO) return phoneHtml(W, S, keyOf(v, o), v).replace('<form class="pw-pask"', BVD.html(keyOf(v, o), o.ws) + '<form class="pw-pask"');
|
|
458
460
|
if (S.big) return `<div class="pw" data-pw-big-on>${breakdownHtml(W, C, mode, true, S)}</div>`;
|
|
459
461
|
if (!RO && !phone()) return dsHtml(r, v, o, W, S, C, mode);
|
|
460
462
|
return `<div class="pw">${overviewHtml(W, S, keyOf(v, o))}${breakdownHtml(W, C, mode, false, S)}${artefactsHtml(W.artefacts, C, true, { scope: keyOf(v, o), recPath: v.prd && (v.prd.path || v.prd) })}</div>`;
|
|
@@ -498,10 +500,12 @@ function dsHtml(r, v, o, W, S, C, mode) {
|
|
|
498
500
|
// a new screen's three layouts under the stages (three-layouts, A317): zero is silence, so an initiative that adds no screen shows nothing
|
|
499
501
|
const lay = TLY.html(TLY.seen(id));
|
|
500
502
|
// the People block under the Overview (stakeholder-map, BatchPeopleDS panel 9): drawn from memory, read once per initiative; no name, no block
|
|
501
|
-
const
|
|
503
|
+
const ppl0 = SMAP.blockFor(id, o.ws, () => { if (artRedraw) artRedraw(); });
|
|
504
|
+
// before the meeting (meeting-stance, BatchPeopleDS panel 10): under People; no contested decision, no block
|
|
505
|
+
const ppl = ppl0 + MST.blockFor(id, o.ws, () => { if (artRedraw) artRedraw(); });
|
|
502
506
|
// the story map (A419): a new bet's journey and its Release 1 line, above the breakdown; nothing when there is no map and the bet has tasks
|
|
503
507
|
const smap = STMAP.blockHtml({ id, ws: o.ws || '', title: W.title || '', tasks: stagesOf(r, v, { ...o, today: W.today, subAll: true }).filter((x) => x.kind === 'task').length });
|
|
504
|
-
return `<div class="pw pwd">${PD.overviewHtml(W, r, { oid: id, dropped: dropped(), open: ovOpen() })}${ppl}<div class="pwd-main">${PD.stagesHtml(st, W)}${lay}${smap}${crit}${wbs}</div></div>`;
|
|
508
|
+
return `<div class="pw pwd">${PD.overviewHtml(W, r, { oid: id, dropped: dropped(), open: ovOpen() })}${ppl}<div class="pwd-main">${PD.stagesHtml(st, W)}${lay}${smap}${crit}${BVD.html(id, o.ws)}${wbs}</div></div>`;
|
|
505
509
|
}
|
|
506
510
|
|
|
507
511
|
/** The grouping ✦ the PM said no to, for this initiative: 'group:<stage>'. */
|
|
@@ -912,7 +916,7 @@ export function wire(body, h0, x0) {
|
|
|
912
916
|
// the Viewer reuses its body for the next item: the presses read the item shown now from the body, so one set of listeners serves all
|
|
913
917
|
body.__pwh = ED.writes(h0); body.__pwx = x0;
|
|
914
918
|
{ const o = x0 && x0.o ? x0.o() || {} : {}; ASK_AT = o.id ? { id: String(o.id), ws: o.ws || '' } : null; }
|
|
915
|
-
{ const c = cur(); if (c) { readItems(c.id, (x0.o() || {}).ws, () => redraw()); readCrit(c.id, (x0.o() || {}).ws, () => redraw()); if (!RO && !phone()) TLY.read((x0.o() || {}).ws, c.id, () => redraw()); if (c.S.top) body.scrollTop = c.S.top; }
|
|
919
|
+
{ const c = cur(); if (c) { readItems(c.id, (x0.o() || {}).ws, () => redraw()); readCrit(c.id, (x0.o() || {}).ws, () => redraw()); if (!RO && !phone()) TLY.read((x0.o() || {}).ws, c.id, () => redraw()); if (!RO) BVD.read(c.id, (x0.o() || {}).ws, () => redraw()); if (c.S.top) body.scrollTop = c.S.top; }
|
|
916
920
|
const q = OPEN_ON_DRAW;
|
|
917
921
|
if (c && q && q.id === String(c.id) && Date.now() - q.at < 15000) { OPEN_ON_DRAW = null; setTimeout(() => { const c2 = cur(); if (c2) openSmall(q.uid, c2, body.__pwh, body.__pwx, body); }, 0); } }
|
|
918
922
|
if (body.__pw) return;
|
|
@@ -925,7 +929,7 @@ export function wire(body, h0, x0) {
|
|
|
925
929
|
wireGrip(body);
|
|
926
930
|
STMAP.wire(body, { redraw: () => { if (body.querySelector('.pw')) redraw(); } }); // the story map's presses and drag (A419)
|
|
927
931
|
// the People block's presses (stakeholder-map), before the popup's own handler below
|
|
928
|
-
body.addEventListener('click', (e) => {
|
|
932
|
+
body.addEventListener('click', (e) => { const say = (t) => { const hh = body.__pwh; if (hh && hh.toast) hh.toast(t); }; if (!SMAP.press(e, body, { say })) MST.press(e, body, { say }); });
|
|
929
933
|
// a phone: a proposal swiped right says yes, left says no (its own hidden Yes and No presses, so the popup's writes and Undo stay theirs)
|
|
930
934
|
wireSwipe(body, { on: phone, act: (row, way) => { const b = row.querySelector(way === 'right' ? '[data-sw-yes]' : '[data-sw-no]'); if (b) b.click(); } });
|
|
931
935
|
body.addEventListener('submit', (e) => {
|
|
@@ -953,6 +957,7 @@ export function wire(body, h0, x0) {
|
|
|
953
957
|
if (b.disabled || !body.contains(b)) return;
|
|
954
958
|
const c = cur(); if (!c) return;
|
|
955
959
|
const h = body.__pwh, x = body.__pwx;
|
|
960
|
+
if (BVD.press(b, h)) return; // the Review block: ✓ Accept, ↩ Send back as a fix (built-vs-design)
|
|
956
961
|
const d = b.dataset, S = c.S, W = c.W;
|
|
957
962
|
if (d.pwv) { store.set(VIEW, d.pwv); redraw(); return; }
|
|
958
963
|
if ('pwOv' in d) { try { localStorage.setItem(OV, ovOpen() ? '0' : '1'); } catch { /* a private window */ } redraw(); return; }
|
|
@@ -48,6 +48,7 @@ export function mountToday(ctx) {
|
|
|
48
48
|
readQuestions();
|
|
49
49
|
readSignoffs();
|
|
50
50
|
readSwitches();
|
|
51
|
+
readMoments();
|
|
51
52
|
readLine();
|
|
52
53
|
readDigest();
|
|
53
54
|
readSync();
|
|
@@ -206,6 +207,41 @@ export function mountToday(ctx) {
|
|
|
206
207
|
await readSwitches();
|
|
207
208
|
return after(true);
|
|
208
209
|
}
|
|
210
|
+
/* surface-moments (job #1985, LINE.md Rule 12): each product's moments (GET /api/surface-moments), one Your move row each. What Today's own
|
|
211
|
+
* data shows (a free gap, leave, a steering meeting) goes with the ask; the server checks the rest against the files. A product that does not
|
|
212
|
+
* answer is left out; with no moment there is no row (zero is silence). The same AI run kind is one row however many products name it. */
|
|
213
|
+
let momentsAt = 0;
|
|
214
|
+
async function readMoments() {
|
|
215
|
+
const now = ctx.now(), today = day();
|
|
216
|
+
momentsAt = now;
|
|
217
|
+
const P = ((ctx.S.M && ctx.S.M.products) || []).filter((p) => p && p.model);
|
|
218
|
+
const L = [...new Set((P.length ? P.map((p) => p.ws || ctx.boardWs() || '') : [ctx.boardWs() || '']))];
|
|
219
|
+
const free = TM.gapNow(ctx.meetings() || [], now), away = TM.awayOf((X.log && X.log.entries) || [], X.events || [], today), steer = TM.steerOf(X.events || [], today);
|
|
220
|
+
const q = new URLSearchParams();
|
|
221
|
+
if (free) q.set('free', String(free));
|
|
222
|
+
if (away) { q.set('away', away.day); q.set('awayWord', away.word); q.set('awayFrom', away.from); }
|
|
223
|
+
if (steer) { q.set('steer', steer.title); q.set('steerDay', steer.day); q.set('steerWord', steer.word); }
|
|
224
|
+
const got = await Promise.all(L.map((ws) => { const qq = new URLSearchParams(q); if (ws) qq.set('ws', ws); return ctx.pmGet('/api/surface-moments?' + qq.toString()).catch(() => null); }));
|
|
225
|
+
const rows = [], seen = new Set();
|
|
226
|
+
got.forEach((r, i) => { if (!r || !r.ok) return; for (const m of r.rows || []) { const one = m.kind === 'worth' ? 'worth:' + m.act.job : m.kind === 'away' ? 'away' : m.key; if (seen.has(one)) continue; seen.add(one); rows.push({ ...m, ws: L[i] }); } });
|
|
227
|
+
console.info('[moments] products=' + L.length + ' rows=' + rows.length);
|
|
228
|
+
const next = JSON.stringify(rows);
|
|
229
|
+
if (next === (X.moSeen || '[]')) return;
|
|
230
|
+
X.moSeen = next; X.moments = rows;
|
|
231
|
+
draw();
|
|
232
|
+
}
|
|
233
|
+
setInterval(() => { if (ctx.now() - momentsAt > 5 * 60e3) readMoments(); }, 60e3); // a free gap is a matter of minutes
|
|
234
|
+
/** ✓ on a moment: its one step, with Undo in the toast. A free gap's ✓ opens what fits it; nothing is written. */
|
|
235
|
+
async function momentPress(r) {
|
|
236
|
+
const m = r.ref || {}, a = m.act || {};
|
|
237
|
+
if (a.kind === 'minutes') { if (a.ini && ctx.hasIni(a.ini)) ctx.goIni(a.ini); return; }
|
|
238
|
+
const res = await ctx.pmPost('/api/surface-moments', { ws: m.ws || null, ...a }).catch(() => null);
|
|
239
|
+
if (!res || !res.ok) return ctx.toast((res && res.error) || 'It did not go through. Nothing changed.');
|
|
240
|
+
const undo = res.undo ? async () => { const u = await ctx.pmPost('/api/surface-moments', { ws: m.ws || null, ...res.undo }).catch(() => null); await readMoments(); return u || { ok: false }; } : null;
|
|
241
|
+
if (undo) ctx.toastUndo(res.said, undo); else ctx.toast(res.said);
|
|
242
|
+
await readMoments();
|
|
243
|
+
return after(true);
|
|
244
|
+
}
|
|
209
245
|
/** ✓ on a sign-off row: recorded with its source; when it was the stage's last missing item the stage moves in the same press. One Undo. */
|
|
210
246
|
async function signoffRecord(r) {
|
|
211
247
|
const s = r.ref || {};
|
|
@@ -313,7 +349,9 @@ export function mountToday(ctx) {
|
|
|
313
349
|
if (!r || !r.ok) return;
|
|
314
350
|
const today = day();
|
|
315
351
|
X.reports = (r.items || []).filter((x) => x && x.kind === 'report' && x.date === today && x.time).map((x) => ({ key: x.key, title: x.title, time: x.time }));
|
|
352
|
+
X.events = (r.items || []).filter((x) => x && x.kind === 'meeting').map((x) => ({ kind: 'meeting', date: x.date, title: x.title })); // surface-moments: leave and steering
|
|
316
353
|
draw();
|
|
354
|
+
readMoments();
|
|
317
355
|
}
|
|
318
356
|
// the head's clock: the time on it moves each minute, and only its words change
|
|
319
357
|
setInterval(() => { const w = el && el.querySelector('.td-when'); if (w) w.textContent = TM.headModel(ctx.now()).when; }, 30000);
|
|
@@ -339,6 +377,7 @@ export function mountToday(ctx) {
|
|
|
339
377
|
own: X.log.entries, marks: X.log.marks, lab, questions: X.questions || [], titleOf: ctx.titleOf, productOf, now, fixed: X.log.fixed || {},
|
|
340
378
|
signoffs: X.signoffs || [], signoffSuggest: X.signoffSuggest || [],
|
|
341
379
|
switches: X.switches || [],
|
|
380
|
+
moments: X.moments || [],
|
|
342
381
|
// your-move (A468): an initiative's ship date is its board end date; a line with no default on work that ships soon blocks it
|
|
343
382
|
shipOf: (id) => { const r = byId.get('i:' + id); return (r && r.board && r.board.end) || ''; } });
|
|
344
383
|
if (L.move.length !== X.ymN) { X.ymN = L.move.length; console.info('[your-move] rows=' + L.move.length + ' shown=' + L.first.length + (L.move[0] ? ' first-tier=' + L.move[0].tier : '')); }
|
|
@@ -489,6 +528,7 @@ export function mountToday(ctx) {
|
|
|
489
528
|
if (r.src === 'question') { openQuestion(ref); return; }
|
|
490
529
|
if (r.src === 'signoff') { if (ref.ini && ctx.hasIni(ref.ini)) ctx.goIni(ref.ini); return; }
|
|
491
530
|
if (r.src === 'switch') { location.href = '/premium-board.html' + (ref.ws ? '?ws=' + encodeURIComponent(ref.ws) : ''); return; } // the Switches block on Work
|
|
531
|
+
if (r.src === 'moment') { momentPress(r); return; }
|
|
492
532
|
if (r.src === 'signoff-by') { if (ref.ini && ctx.hasIni(ref.ini)) ctx.goIni(ref.ini); return; }
|
|
493
533
|
if (r.src === 'draft') { pop(r); ctx.openFinished(ref.fin); return; }
|
|
494
534
|
if (r.src === 'review') { pop(r); ctx.openReviewVw(); return; }
|
|
@@ -791,7 +831,7 @@ export function mountToday(ctx) {
|
|
|
791
831
|
}
|
|
792
832
|
if (act === 'open' && key === 'digest') { openDigest(); return; }
|
|
793
833
|
const r = rowOf(key); if (!r) return;
|
|
794
|
-
if (r.tier != null && (act === 'open' || act === 'done' || act === 'tomorrow' || /^(so|sb|sw)-/.test(act))) noteUse('ym-act'); // your-move's health number
|
|
834
|
+
if (r.tier != null && (act === 'open' || act === 'done' || act === 'tomorrow' || /^(so|sb|sw|mo)-/.test(act))) noteUse('ym-act'); // your-move's health number
|
|
795
835
|
if (act === 'q-remind') { remindQuestion(r.ref); return; }
|
|
796
836
|
if (act === 'open') { open(r); return; }
|
|
797
837
|
if (act === 'so-open') { signoffOpen(r); return; }
|
|
@@ -810,6 +850,7 @@ export function mountToday(ctx) {
|
|
|
810
850
|
else if (act === 'lab-keep' || act === 'lab-drop') await lab(r, act === 'lab-keep');
|
|
811
851
|
else if (act === 'so-record') await signoffRecord(r);
|
|
812
852
|
else if (act === 'sw-yes' || act === 'sw-no') await switchPress(r, act === 'sw-yes');
|
|
853
|
+
else if (act === 'mo-yes') await momentPress(r);
|
|
813
854
|
else if (act === 'so-ask') await signoffAsk(r);
|
|
814
855
|
else if (act === 'sb-keep' || act === 'sb-change') await signoffSuggest(r, act === 'sb-keep');
|
|
815
856
|
else if (act === 'lk-yes' || act === 'lk-no') await looks(r, act === 'lk-yes');
|
|
@@ -143,7 +143,7 @@ function typeOf(r) {
|
|
|
143
143
|
const ref = r.ref || {};
|
|
144
144
|
if (r.bullet === 'note' || r.src === 'note') return 'Note';
|
|
145
145
|
if (r.src === 'draft') return 'Report';
|
|
146
|
-
if (r.src === 'lab' || r.src === 'question' || r.src === 'signoff' || r.src === 'signoff-by' || r.src === 'switch') return 'Decision';
|
|
146
|
+
if (r.src === 'lab' || r.src === 'question' || r.src === 'signoff' || r.src === 'signoff-by' || r.src === 'switch' || r.src === 'moment') return 'Decision';
|
|
147
147
|
if (r.src !== 'ask') return 'Task';
|
|
148
148
|
switch (ref.kind) {
|
|
149
149
|
case 'mention': return 'Ask';
|
|
@@ -162,7 +162,8 @@ function typeOf(r) {
|
|
|
162
162
|
* shipOf(ini) → its ship date 'YYYY-MM-DD' or '' (Your move: a line with no default on work that ships soon blocks it), now,
|
|
163
163
|
* fixed: GET /api/today-log fixed ({ [ws]: keys }, quiet-rows: the line rows Your move shows today per product),
|
|
164
164
|
* signoffs: GET /api/stage-signoffs rows, each with its ws; signoffSuggest: its suggest list (factory-signoffs-reach-you);
|
|
165
|
-
* switches: GET /api/switches rows with a waiting turn, each with its ws (switch-owners)
|
|
165
|
+
* switches: GET /api/switches rows with a waiting turn, each with its ws (switch-owners),
|
|
166
|
+
* moments: GET /api/surface-moments rows, each with its ws (surface-moments) }
|
|
166
167
|
* quiet-rows: the drafts in the outbox are one row, Today's batch (pm/quiet-rows.js batchRow); Your move keeps at most 3 line rows a day per
|
|
167
168
|
* product (capLine), the rest wait under Later (`held`), and `toFix` is what the page writes once to the day ledger.
|
|
168
169
|
* A row: { key, src, bullet, first, title, work, ini, ws, job, when, late, carried, done, dates: 'task' | 'item' | 'mark', drop, ref }
|
|
@@ -280,6 +281,11 @@ export function logModel(o = {}) {
|
|
|
280
281
|
put({ key: 'switch:' + (w.ws || '') + ':' + w.id, src: 'switch', bullet: 'task', title: 'Turn ' + w.name + ' ' + w.waiting.to + ' for ' + w.customer, ini: null, ws: w.ws || '', work: '', job: 'Decide',
|
|
281
282
|
carried: 0, late: false, when: '', reason: 'Waits for you: PMOS turns nothing', age: at ? Math.max(0, between(at, today) || 0) : 0, ref: w });
|
|
282
283
|
}
|
|
284
|
+
// surface-moments (job #1985, LINE.md Rule 12): a feature that shows by itself when the PM's data says it is time; one ✓ and Put off a day
|
|
285
|
+
for (const m of o.moments || []) {
|
|
286
|
+
if (!m || !m.key || !m.title) continue;
|
|
287
|
+
put({ key: m.key, src: 'moment', bullet: 'task', title: m.title, ini: null, ws: m.ws || '', work: '', job: 'Decide', carried: 0, late: false, when: '', reason: m.why || '', age: 0, ref: m });
|
|
288
|
+
}
|
|
283
289
|
oneLine(out);
|
|
284
290
|
// a row done today whose source has let it go keeps its × from what it said when it was done
|
|
285
291
|
for (const [k, m] of Object.entries(marks)) {
|
|
@@ -456,7 +462,7 @@ export function costOf(r, today, shipOf = () => '') {
|
|
|
456
462
|
if (r.type === 'Ask' && !(r.who && r.who.length)) return null; // nobody waits on the answer
|
|
457
463
|
if (r.src === 'batch') return [2, r.left == null ? QR.LAPSE_DAYS : r.left, r.why]; // quiet-rows: Today's batch, a send today, soonest lapse first
|
|
458
464
|
const ref = r.ref || {}, c = ref.call || null, ld = lateDays(r, today);
|
|
459
|
-
const waits = r.src === 'ask' || r.src === 'question' || r.src === 'signoff' || r.src === 'signoff-by' || r.src === 'switch' || r.src === 'draft' || r.src === 'review' || (r.src === 'own' && r.first) || ld > 0;
|
|
465
|
+
const waits = r.src === 'ask' || r.src === 'question' || r.src === 'signoff' || r.src === 'signoff-by' || r.src === 'switch' || r.src === 'moment' || r.src === 'draft' || r.src === 'review' || (r.src === 'own' && r.first) || ld > 0;
|
|
460
466
|
if (!waits) return null;
|
|
461
467
|
if (r.src === 'own' && r.first) return [0, 0, 'You marked it first'];
|
|
462
468
|
const age = r.src === 'question' || r.src === 'signoff' || r.src === 'switch' ? r.age || 0 : r.carried || 0;
|
|
@@ -470,6 +476,7 @@ export function costOf(r, today, shipOf = () => '') {
|
|
|
470
476
|
if (c && c.kind === 'session' && (c.state === 'blocked' || c.state === 'needs')) return [3, 0, 'A session waits on you; its work stops until you answer'];
|
|
471
477
|
if (r.src === 'question') return [4, -age, r.reason || 'Waits on you ' + plural(age, 'day', 'days')];
|
|
472
478
|
if (r.src === 'signoff' || r.src === 'signoff-by' || r.src === 'switch') return [4, -age, r.reason || 'Waits on you'];
|
|
479
|
+
if (r.src === 'moment') return [4, 0, '✦ ' + (r.reason || 'PMOS suggests it now')];
|
|
473
480
|
const w = whyOf(r, today);
|
|
474
481
|
return [4, -age, w && !/^Waits on you$/.test(w) ? w : age ? 'Waits on you ' + plural(age, 'day', 'days') : 'Waits on you'];
|
|
475
482
|
}
|
|
@@ -647,3 +654,63 @@ export function syncSuggest(parts, o = {}) {
|
|
|
647
654
|
why: 'Someone set these in PMOS by hand, and Jira says otherwise. PMOS changes nothing in Jira. Undo puts back what PMOS said.' + (p.unread ? ' ' + p.unread + (p.unread === 1 ? ' task' : ' tasks') + ' could not be read and are not counted.' : '') };
|
|
648
655
|
});
|
|
649
656
|
}
|
|
657
|
+
|
|
658
|
+
/* surface-moments (job #1985, LINE.md Rule 12): the moments Today's own data shows. Each is PURE; pm/cozy-today-app.js passes what it finds to
|
|
659
|
+
* GET /api/surface-moments, which checks the rest against the files (lib/surface-moments.js). */
|
|
660
|
+
const WD = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
661
|
+
const WD_RE = /\b(sun|mon|tues?|wed(?:nes)?|thu(?:rs?)?|fri|sat(?:ur)?)(?:day)?\b/i;
|
|
662
|
+
const LEAVE_RE = /\b(ooo|out of office|on leave|annual leave|leave|holiday|vacation|day off|pto|cuti)\b/i;
|
|
663
|
+
const OFF_RE = /\b(off|away|on leave|out of office|ooo|holiday|vacation|day off)\b/i;
|
|
664
|
+
/** "Fri 28 Nov" for a YYYY-MM-DD. */
|
|
665
|
+
export function weekdayWord(k) { const t = dayMs(k); if (t == null) return ''; const d = new Date(t); return WD[d.getDay()] + ' ' + d.getDate() + ' ' + MON[d.getMonth()]; }
|
|
666
|
+
/** Weekdays after `from`, up to and including `to` (0 for the same day). */
|
|
667
|
+
export function workDays(from, to) {
|
|
668
|
+
const a = dayMs(from), b = dayMs(to); if (a == null || b == null || b < a) return -1;
|
|
669
|
+
let n = 0; for (let t = new Date(a); t.getTime() < b;) { t.setDate(t.getDate() + 1); const w = t.getDay(); if (w !== 0 && w !== 6) n++; }
|
|
670
|
+
return n;
|
|
671
|
+
}
|
|
672
|
+
/** The minutes of a free gap that starts within 10 minutes, 15 to 90, between 09:00 and 18:00; 0 when there is none. meetings: Today's. */
|
|
673
|
+
export function gapNow(meetings, now) {
|
|
674
|
+
const d0 = new Date(now); d0.setHours(9, 0, 0, 0); const d1 = new Date(now); d1.setHours(18, 0, 0, 0);
|
|
675
|
+
if (now < d0.getTime() || now >= d1.getTime()) return 0;
|
|
676
|
+
const S = (meetings || []).filter((m) => m && m.start && Number.isFinite(Date.parse(m.start))).map(span).sort((x, y) => x.a - y.a);
|
|
677
|
+
let start = now;
|
|
678
|
+
const cur = S.find((x) => x.a <= now && x.b > now);
|
|
679
|
+
if (cur) { if (cur.b - now > 10 * 60000) return 0; start = cur.b; }
|
|
680
|
+
const next = S.find((x) => x.a >= start);
|
|
681
|
+
const end = Math.min(next ? next.a : d1.getTime(), d1.getTime());
|
|
682
|
+
const mins = Math.floor((end - start) / 60000 / 5) * 5;
|
|
683
|
+
return mins >= 15 && mins <= 90 ? mins : 0;
|
|
684
|
+
}
|
|
685
|
+
/** The day a Today line names: "tomorrow", a weekday (the next one from today), or "28 Nov". '' when none. */
|
|
686
|
+
function namedDay(text, today) {
|
|
687
|
+
const t = String(text || '');
|
|
688
|
+
if (/\btomorrow\b/i.test(t)) return addDays(today, 1);
|
|
689
|
+
const dm1 = /\b(\d{1,2})\s+(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*\b/i.exec(t);
|
|
690
|
+
if (dm1) { const y = +today.slice(0, 4), m = MON.findIndex((x) => x.toLowerCase() === dm1[2].slice(0, 3).toLowerCase()); const k = y + '-' + String(m + 1).padStart(2, '0') + '-' + String(+dm1[1]).padStart(2, '0'); return k >= today ? k : (y + 1) + k.slice(4); }
|
|
691
|
+
const w = WD_RE.exec(t);
|
|
692
|
+
if (w) { const want = WD.findIndex((x) => x.toLowerCase() === w[1].slice(0, 3).toLowerCase()); for (let i = 1; i <= 7; i++) { const k = addDays(today, i); if (new Date(dayMs(k)).getDay() === want) return k; } }
|
|
693
|
+
return '';
|
|
694
|
+
}
|
|
695
|
+
/** Leave within 7 days: an all-day or leave event on the calendar, else an open Today line ("off Friday"). { day, word, from } | null. */
|
|
696
|
+
export function awayOf(own, events, today) {
|
|
697
|
+
const near = (k) => { const n = between(today, k); return n != null && n >= 0 && n <= 7; };
|
|
698
|
+
for (const e of events || []) {
|
|
699
|
+
if (!e || e.kind !== 'meeting' || !LEAVE_RE.test(e.title || '')) continue;
|
|
700
|
+
const k = String(e.date || '').slice(0, 10); if (near(k)) return { day: k, word: weekdayWord(k), from: 'calendar' };
|
|
701
|
+
}
|
|
702
|
+
for (const e of own || []) {
|
|
703
|
+
if (!e || e.done || !OFF_RE.test(e.text || '')) continue;
|
|
704
|
+
const k = namedDay(e.text, today); if (k && near(k)) return { day: k, word: weekdayWord(k), from: 'line' };
|
|
705
|
+
}
|
|
706
|
+
return null;
|
|
707
|
+
}
|
|
708
|
+
/** A steering meeting within 2 working days: { title, day, word } | null. events: GET /api/events-place items. */
|
|
709
|
+
export function steerOf(events, today) {
|
|
710
|
+
for (const e of (events || []).slice().sort((a, b) => String(a.date).localeCompare(String(b.date)))) {
|
|
711
|
+
if (!e || e.kind !== 'meeting' || !/steer/i.test(e.title || '')) continue;
|
|
712
|
+
const k = String(e.date || '').slice(0, 10), n = workDays(today, k);
|
|
713
|
+
if (n >= 0 && n <= 2) return { title: e.title, day: k, word: k === today ? 'today' : weekdayWord(k) };
|
|
714
|
+
}
|
|
715
|
+
return null;
|
|
716
|
+
}
|
|
@@ -28,7 +28,10 @@ export function setCapShown(ids) { if (Array.isArray(ids) && ids.length) CAP_SHO
|
|
|
28
28
|
/** What a right-click on a Today row names (initiative ask-anywhere): its initiative when it has one, else the row itself. */
|
|
29
29
|
function askOf(r) {
|
|
30
30
|
if (r.ini) return ` data-ask="initiative:${esc(r.ini)}" data-ask-title="${esc(r.work || r.ini)}"${r.ws ? ` data-ask-ws="${esc(r.ws)}"` : ''}`;
|
|
31
|
-
|
|
31
|
+
// a morning-brief call of a "needs you" item (call:n:<key>) opens that item's viewer: need:<key>, or the Weekly update's own viewer
|
|
32
|
+
// (update) for its row (home-app.js openRow). Name the item it opens, so the Ask card's chat is that item's own.
|
|
33
|
+
const k = String(r.key || ''), n = /^call:n:/.test(k) ? k.slice(7) : null, id = n === null ? k : n === 'update' ? 'update' : 'need:' + n;
|
|
34
|
+
return ` data-ask="today item:${esc(id)}" data-ask-title="${esc(r.title || r.text || '')}"`;
|
|
32
35
|
}
|
|
33
36
|
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
34
37
|
const svg = (d, w = 15, sw = 1.9) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
@@ -90,6 +93,9 @@ export function switchActs(r) {
|
|
|
90
93
|
return ib('sw-yes', 'I turned ' + w.name + ' ' + to + ' for ' + w.customer, I.yes, r.key) + ib('sw-no', 'Keep ' + w.name + ' ' + (w.on ? 'on' : 'off') + ' for ' + w.customer, I.no, r.key);
|
|
91
94
|
}
|
|
92
95
|
|
|
96
|
+
/** surface-moments (job #1985): ✓ does the moment's one step, with Undo in the toast. */
|
|
97
|
+
export function momentAct(r) { const m = r.ref || {}; return ib('mo-yes', m.label || 'Do it: ' + r.title, I.yes, r.key); }
|
|
98
|
+
|
|
93
99
|
/** name-links (A536): the words of a line you typed, with the names that resolve to one record as links (r.ref.links: GET /api/name-links);
|
|
94
100
|
* any other row's words, escaped. The words never change. */
|
|
95
101
|
export function ownWords(r) { return r && r.src === 'own' && r.ref && r.ref.links ? linkedHtml(r.title, r.ref.links, esc) : esc(r && r.title); }
|
|
@@ -103,6 +109,7 @@ export function rowHtml(r, o = {}) {
|
|
|
103
109
|
if (r.src === 'question') acts = ib('open', 'Answer: ' + t, I.decide, r.key); // the register's line: it is answered where it opens, not marked done here
|
|
104
110
|
else if (r.src === 'signoff' || r.src === 'signoff-by') acts = signoffActs(r);
|
|
105
111
|
else if (r.src === 'switch') acts = switchActs(r);
|
|
112
|
+
else if (r.src === 'moment') acts = momentAct(r) + ib('tomorrow', 'Move to tomorrow: ' + t, I.tomorrow, r.key);
|
|
106
113
|
else if (r.src === 'lab') acts = ib('lab-keep', 'Keep it: start an initiative from ' + t, I.yes, r.key) + ib('lab-drop', 'Drop it: ' + t, I.no, r.key);
|
|
107
114
|
else {
|
|
108
115
|
const j = JOB_ACT[r.job];
|
|
@@ -198,6 +205,7 @@ function moveAct(r) {
|
|
|
198
205
|
if (r.src === 'question') return ib('open', 'Answer: ' + t, I.decide, r.key);
|
|
199
206
|
if (r.src === 'signoff' || r.src === 'signoff-by') return signoffActs(r);
|
|
200
207
|
if (r.src === 'switch') return switchActs(r);
|
|
208
|
+
if (r.src === 'moment') return momentAct(r);
|
|
201
209
|
const j = JOB_ACT[r.job];
|
|
202
210
|
if (j) return ib('open', j[1] + ': ' + t, j[2], r.key);
|
|
203
211
|
if (r.members) return ib('open', 'Show them: ' + t, I.more, r.key, ` aria-expanded="false"`);
|
|
@@ -352,6 +360,7 @@ export function swipeActs(r) {
|
|
|
352
360
|
if (r.members && r.drafts) return { right: 'same-yes', left: 'same-no' };
|
|
353
361
|
// a Your move row (your-move): right does its action, so a reply, an answer, a decision or a send opens the item; left puts it off a day
|
|
354
362
|
if (r.src === 'switch') return { right: '', left: 'tomorrow' }; // a turn is recorded by a press, never by a swipe
|
|
363
|
+
if (r.src === 'moment') return { right: '', left: 'tomorrow' }; // a moment acts on a press, never on a swipe
|
|
355
364
|
if (r.src === 'signoff-by') return { right: 'sb-keep', left: 'tomorrow' };
|
|
356
365
|
if (r.src === 'signoff') { const a = (r.ref || {}).action; return { right: a === 'record' ? 'so-record' : a === 'open' ? 'so-open' : 'so-ask', left: 'tomorrow' }; }
|
|
357
366
|
if (r.tier != null && (r.src === 'question' || JOB_ACT[r.job] || r.members)) return { right: 'open', left: 'tomorrow' };
|
|
@@ -169,10 +169,11 @@ export function tableHtml(p, o) {
|
|
|
169
169
|
left: (k) => `<td class="pm-meta">${esc(k.left)}</td>`,
|
|
170
170
|
levers: (k, ob, i) => `<td class="gl-lvs">${i === 0 ? ob.levers.map((l) => `<span><b>${esc(l.title)}</b> <span class="pm-meta${l.tone ? ' gl-al' : ''}">${esc(l.txt)}</span></span>`).join('') : ''}</td>`,
|
|
171
171
|
};
|
|
172
|
-
const group = (label, sub, extra = '') => `<tr class="gl-g"><td colspan="${n}"><div class="pm-group"><b>${esc(label)}</b><span>${esc(sub)}</span>${extra}</div></td></tr>`;
|
|
172
|
+
const group = (label, sub, extra = '', ask = '') => `<tr class="gl-g"${ask}><td colspan="${n}"><div class="pm-group"><b>${esc(label)}</b><span>${esc(sub)}</span>${extra}</div></td></tr>`;
|
|
173
173
|
let body = '';
|
|
174
174
|
for (const ob of T.objectives) {
|
|
175
|
-
|
|
175
|
+
// the objective is the record a right-click names (ask-anywhere)
|
|
176
|
+
body += group(ob.label + (ob.title ? ' · ' + ob.title : ''), noun(ob.krs.length, 'key result', 'key results'), '', ob.id ? ` data-ask="goal:${esc(ob.id)}" data-ask-title="${esc(ob.label + (ob.title ? ' · ' + ob.title : ''))}"` : '');
|
|
176
177
|
body += ob.krs.map((k, i) => `<tr><td class="gl-kr"><a href="#" class="gl-k" data-gl-ws="${esc(ws)}" data-gl-kr="${esc(k.key)}" title="${esc(k.sub)}">${esc(k.token)} · ${esc(k.title)}</a></td>`
|
|
177
178
|
+ cols.map(([c]) => cell[c](k, ob, i)).join('') + '</tr>').join('');
|
|
178
179
|
}
|
|
@@ -47,6 +47,18 @@ import { nextPromptUi } from './next-prompt-ui.js'; // the suggested next prom
|
|
|
47
47
|
import { cardsUi } from './chat-cards.js';
|
|
48
48
|
import { a2uiUi } from './a2ui-view.js'; // a2ui-inbound-render: another agent's A2UI v1.0 surface, drawn with PMOS's own parts; a press goes back as words // ask-cards-and-pickers: the rows an answer names, live, and a picker (canvas A2Cards, A2Ask)
|
|
49
49
|
import { runAction, routeOf } from './action-run.js';
|
|
50
|
+
|
|
51
|
+
/* The chat's text size, one for every chat (the person's choice, kept with their view choices: pmos.chat.fs, lib/prefs-sync.js). The page's
|
|
52
|
+
* <html data-chat-fs> sets it; cozy-home.css scales the chat's type roles from it. */
|
|
53
|
+
const FS = [['s', 'Small', 'A−'], ['m', 'Normal', 'A'], ['l', 'Large', 'A+']];
|
|
54
|
+
const FS_KEY = 'pmos.chat.fs';
|
|
55
|
+
export function chatFs() { try { const v = localStorage.getItem(FS_KEY); return FS.some((f) => f[0] === v) ? v : ''; } catch { return ''; } }
|
|
56
|
+
export function setChatFs(v) {
|
|
57
|
+
if (!FS.some((f) => f[0] === v)) return;
|
|
58
|
+
try { localStorage.setItem(FS_KEY, v); } catch { /* the size still shows on this page */ }
|
|
59
|
+
if (typeof document !== 'undefined') document.documentElement.dataset.chatFs = v;
|
|
60
|
+
}
|
|
61
|
+
if (typeof document !== 'undefined' && document.documentElement && chatFs()) document.documentElement.dataset.chatFs = chatFs();
|
|
50
62
|
import { tellCards } from './card-log.js'; // each answer's card list and each press to the local use log (card catalog rule 9, A511)
|
|
51
63
|
/* The views a chat opens go in the Viewer: on a page with no dialog the old viewer's views draw in the cozy card (premium-viewer.js). */
|
|
52
64
|
let REPORT_TAB = false; // a report tab was opened from a chat on this page: only then is premium-report-tab.js read at send
|
|
@@ -504,9 +516,12 @@ export function mountChat(el, host) {
|
|
|
504
516
|
// One box everywhere (testing fixes: a loose chat and an initiative's chat drew two different boxes): +, / and @ (in an initiative), the
|
|
505
517
|
// To: or In: chip, the mic and ↑ send. A loose session's "Link to an initiative" is in the + menu, and no hint line repeats under the box.
|
|
506
518
|
const link = sc.loose && t.sid ? '<button type="button" role="menuitem" data-hm-link><b>Link to an initiative</b><em>Move this chat under one</em></button>' : '';
|
|
507
|
-
|
|
508
|
-
const
|
|
509
|
-
|
|
519
|
+
// the chat's text size (Wawan 2026-11-25: "I can edit the font size on the chat, any chat"): three sizes in the + menu, kept for the person
|
|
520
|
+
const fsz = chatFs();
|
|
521
|
+
const size = '<span class="hm-fsz" role="group" aria-label="Text size"><b>Text size</b>' + FS.map(([k, n, a]) => `<button type="button" class="hm-fsb fs-${k}${fsz === k ? ' on' : ''}" data-hm-fs="${k}" aria-pressed="${fsz === k}" aria-label="${n} text" title="${n} text">${a}</button>`).join('') + '</span>';
|
|
522
|
+
const addOpen = !!C.addOpen;
|
|
523
|
+
const add = `<span class="hm-mw hm-addw"><button type="button" class="hm-tool" id="hmAdd" data-hm-add aria-haspopup="menu" aria-expanded="${addOpen}" aria-label="${t.key ? 'Attach a file, notes and more' : 'More'}" title="${t.key ? 'Attach a file' : 'More'}">${SVG(PLUS)}</button>`
|
|
524
|
+
+ `<span class="hm-pmenu hm-addm" role="menu" aria-label="Add"${addOpen ? ' data-esc-layer' : ' hidden'}>${attach}${notesBtn}${term}${link}${size}</span>${t.key ? '<input type="file" id="hmFile" multiple hidden>' : ''}</span>`;
|
|
510
525
|
const wait = C.conv && C.conv.ask && t.also ? `<button type="button" class="hm-chip" data-hm-also><i class="dot" aria-hidden="true"></i><span>1 more next step</span></button>` : '';
|
|
511
526
|
const to = t.to && !wait ? `<button type="button" class="hm-chip to" data-hm-to aria-label="Who reads this: ${esc(t.to.name)}. Change">${avHtml(t.to, 20)}<span>To: ${esc(t.to.name)}</span></button>` : '';
|
|
512
527
|
// chief-of-staff C5 (CsB): the soft "You are on …" chip of the chat over a page; × drops it (sc.drop), and the chip then reads Everything
|
|
@@ -632,6 +647,7 @@ export function mountChat(el, host) {
|
|
|
632
647
|
if (CU.owns(b)) { await CU.press(b); return; } // a row's button, a picker's choice, its ✓ or Undo (pm/chat-cards.js); any other button stays synchronous
|
|
633
648
|
const ic = b.closest('.hm-icard'), card = C.t && C.t.intro && C.t.intro.card;
|
|
634
649
|
if (ic && card && card.press) { if (await card.press(b)) draw(); return; }
|
|
650
|
+
if (d.hmFs) { setChatFs(d.hmFs); drawFoot({ role: role() }); return; } // the menu stays open: the size shows at once, and a second press is one step on
|
|
635
651
|
if ('hmMic' in d) { mic(); return; }
|
|
636
652
|
if (d.hmVer && C.t && C.t.ini) { import('./cozy-proto.js').then((M) => M.openVersion({ ws: C.t.ws, ini: C.t.ini, n: Number(d.hmVer) })).catch(() => {}); return; }
|
|
637
653
|
if (d.hmUnmark) { if (C.mark) C.mark[d.hmUnmark] = null; drawFoot({ role: role() }); return; }
|
|
@@ -107,7 +107,7 @@ const stageKeyOf = (v) => { const L = stagesOf(v), k = STAGE.get(v.id || v.key);
|
|
|
107
107
|
* view sheet (a bottom sheet on a phone, a popover under it on a desktop): View, Group by and Zoom, three rows of the same shape. ── */
|
|
108
108
|
export function viewBtnHtml(m) {
|
|
109
109
|
const x = VIEWS.find((y) => y[0] === m) || VIEWS[0];
|
|
110
|
-
return `<button type="button" class="ivx-vb" data-iv-vbtn aria-haspopup="dialog" aria-expanded="false" aria-label="${esc('Tasks view: ' + x[1] + '. Change the view, grouping or zoom')}" title="View, group and zoom">${SVG(x[2], 18)}${SVG(P.down, 13, 2.2)}</button>`;
|
|
110
|
+
return `<button type="button" class="ivx-vb" data-iv-vbtn aria-haspopup="dialog" aria-expanded="${POP && POP.el.isConnected && POP.el.querySelector('.ivs') ? 'true' : 'false'}" aria-label="${esc('Tasks view: ' + x[1] + '. Change the view, grouping or zoom')}" title="View, group and zoom">${SVG(x[2], 18)}${SVG(P.down, 13, 2.2)}</button>`;
|
|
111
111
|
}
|
|
112
112
|
/** The Kanban's stage picker (or group picker): at the top of the Kanban, not in the header. */
|
|
113
113
|
export function kanbanPickHtml(v) {
|
|
@@ -588,7 +588,7 @@ function rehang(P) {
|
|
|
588
588
|
if (!n || P.el.contains(n)) return;
|
|
589
589
|
P.anchor = n; n.setAttribute('aria-expanded', 'true'); const r = n.getBoundingClientRect(); P.at = [r.left, r.top];
|
|
590
590
|
}
|
|
591
|
-
export function closePop() { if (!POP) return; const { el, anchor, scrim } = POP; POP = null; el.remove(); if (scrim) scrim.remove(); if (anchor && anchor.isConnected) anchor.setAttribute('aria-expanded', 'false'); }
|
|
591
|
+
export function closePop() { if (!POP) return; const { el, anchor, scrim } = POP; POP = null; el.remove(); if (scrim) scrim.remove(); if (anchor && anchor.isConnected) anchor.setAttribute('aria-expanded', 'false'); document.querySelectorAll('[data-iv-vbtn][aria-expanded="true"]').forEach((b) => b.setAttribute('aria-expanded', 'false')); } // a redraw while open drew a new button as expanded
|
|
592
592
|
/** o.sheet: a bottom sheet over a scrim (a phone); o.right: the popover's right edge under the press's right edge. */
|
|
593
593
|
export function openPop(anchor, html, onPress, o = {}) {
|
|
594
594
|
closePop(); cardStyle();
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/* pm/meeting-stance.js — "Before the meeting: who agrees", under the People block of an initiative on Work: the two questions PMOS drafted
|
|
2
|
+
* for the contested decision, and where each person stands (initiative meeting-stance, job #1897, idea A333; board BatchPeopleDS panel 10,
|
|
3
|
+
* agreed 2026-11-25).
|
|
4
|
+
*
|
|
5
|
+
* blockHtml(stance) → the block's markup ('' when no decision is contested: zero is silence). Pure, so the test reads it.
|
|
6
|
+
* stance: GET /api/meeting-stance → stance
|
|
7
|
+
* blockFor(ini, ws, redraw) → the block for the popup drawn now: reads GET /api/meeting-stance once per initiative, then draws from memory
|
|
8
|
+
* press(e, body, { say }) → the popup's click listener hands each press here first: copy, I sent them, an answer cell
|
|
9
|
+
*
|
|
10
|
+
* Built only from the system parts on the board: pm-block, pm-table, pm-said, pm-btn, pm-meta. The two buttons are icon-only with an
|
|
11
|
+
* aria-label. Before the send the grid's cells are dashes and a ✦ line says PMOS drafted the questions; the PM copies them and sends them.
|
|
12
|
+
* PMOS NEVER SENDS THEM: "I sent them" only records it (POST act sent). Then each cell is a press that goes yes → no → empty, and the ✦
|
|
13
|
+
* line names the point the meeting must settle. Each write offers Undo in the toast. The UI says PMOS, never Claude. */
|
|
14
|
+
import { pmGet, pmPost } from './http.js';
|
|
15
|
+
import { noteUse } from './use-log.js';
|
|
16
|
+
import { undoToast } from './hi-pop.js';
|
|
17
|
+
|
|
18
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
19
|
+
const SV = (d, w = 16) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
20
|
+
const I = { spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z', copy: 'M9 9h10v10H9zM5 15V5h10', sent: 'M4 12l16-8-6 16-3-7z' };
|
|
21
|
+
const btn = (attrs, label, icon, kind = '') => `<button type="button" class="pm-btn${kind ? ' ' + kind : ''}" ${attrs} aria-label="${esc(label)}" title="${esc(label)}">${SV(icon)}</button>`;
|
|
22
|
+
/** The next answer a press on a cell gives: empty → yes → no → empty. */
|
|
23
|
+
export const NEXT_SAYS = Object.freeze({ '': 'yes', yes: 'no', no: '' });
|
|
24
|
+
|
|
25
|
+
export function blockHtml(s) {
|
|
26
|
+
if (!s || !Array.isArray(s.grid) || !s.grid.length || !Array.isArray(s.people) || !s.people.length) return '';
|
|
27
|
+
const asked = !!s.asked;
|
|
28
|
+
const head = `<tr><th scope="col"><span class="ms-sr">Question</span></th>${s.people.map((p) => `<th scope="col">${esc(p.name)}</th>`).join('')}</tr>`;
|
|
29
|
+
const cell = (r, c) => {
|
|
30
|
+
const word = c.says || '—';
|
|
31
|
+
if (!asked) return `<td>${esc(word)}</td>`;
|
|
32
|
+
const label = `${c.name} on "${r.q}": ${c.says || 'no answer yet'}. Press to record ${NEXT_SAYS[c.says || ''] || 'no answer'}`;
|
|
33
|
+
return `<td${c.diff ? ' class="ms-diff"' : ''}><button type="button" class="ms-cell" data-ms-act="answer" data-ms-person="${esc(c.id)}" data-ms-name="${esc(c.name)}" data-ms-q="${r.n}" data-ms-says="${esc(NEXT_SAYS[c.says || ''])}" aria-label="${esc(label)}">${esc(word)}</button></td>`;
|
|
34
|
+
};
|
|
35
|
+
const rows = s.grid.map((r) => `<tr><td>${esc(r.q)}</td>${r.cells.map((c) => cell(r, c)).join('')}</tr>`).join('');
|
|
36
|
+
const said = !asked
|
|
37
|
+
? `<div class="pm-said ms-said" role="group" aria-label="PMOS drafted these questions; you send them">${SV(I.spark, 14)}<p>PMOS drafted these two questions for ${esc(s.people.map((p) => p.name).join(', '))}. You send them.</p>`
|
|
38
|
+
+ `<span class="ms-b">${btn('data-ms-act="copy"', 'Copy the questions', I.copy, 'outline')}${btn('data-ms-act="sent"', 'I sent them', I.sent, 'primary')}</span></div>`
|
|
39
|
+
: s.settle ? `<div class="pm-said ms-said">${SV(I.spark, 14)}<p>${esc(s.settle)}</p></div>` : '';
|
|
40
|
+
const meta = asked ? `<p class="pm-meta ms-meta">${s.answered} of ${s.total} answered · ${esc(s.askedWord)}</p>` : '';
|
|
41
|
+
return `<section class="pm-block ms-block" aria-label="Before the meeting" data-ms-ini="${esc(s.ini)}" data-ms-dec="${esc(s.decision && s.decision.id)}">`
|
|
42
|
+
+ `<table class="pm-table ms-grid"><thead>${head}</thead><tbody>${rows}</tbody></table>${said}${meta}</section>`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* ── the popup ── */
|
|
46
|
+
const ST = new Map(); // ws|ini → stance | null while reading | false when there is none
|
|
47
|
+
const kOf = (ini, ws) => (ws || '') + '|' + ini;
|
|
48
|
+
let CSS_DONE = false;
|
|
49
|
+
function css() {
|
|
50
|
+
if (CSS_DONE || typeof document === 'undefined' || !document.head) return;
|
|
51
|
+
CSS_DONE = true;
|
|
52
|
+
const s = document.createElement('style');
|
|
53
|
+
s.textContent = '.ms-block .ms-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.ms-block .ms-grid td:first-child{width:50%}'
|
|
54
|
+
+ '.ms-block .ms-cell{all:unset;cursor:pointer;min-width:44px;min-height:32px;display:inline-flex;align-items:center}.ms-block .ms-cell:focus-visible{outline:2px solid var(--blue);outline-offset:2px}'
|
|
55
|
+
+ '.ms-block .ms-diff{color:var(--state-late)}.ms-block .ms-said{max-width:none;margin:8px 0 0;align-items:flex-start}.ms-block .ms-said p{flex:1;margin:0}'
|
|
56
|
+
+ '.ms-block .ms-said>svg{color:var(--blue);flex:none;margin-top:3px}.ms-block .ms-b{display:flex;gap:4px}.ms-block .ms-meta{margin:4px 0 0}';
|
|
57
|
+
document.head.appendChild(s);
|
|
58
|
+
}
|
|
59
|
+
let lastRedraw = null, lastWs = '';
|
|
60
|
+
function load(ini, ws, again = false) {
|
|
61
|
+
const k = kOf(ini, ws);
|
|
62
|
+
if (!again) ST.set(k, null);
|
|
63
|
+
pmGet('/api/meeting-stance?ini=' + encodeURIComponent(ini) + (ws ? '&ws=' + encodeURIComponent(ws) : ''))
|
|
64
|
+
.then((x) => { ST.set(k, x && x.ok && x.stance ? x.stance : false); if (x && x.ok && (x.stance || again) && lastRedraw) lastRedraw(); })
|
|
65
|
+
.catch(() => ST.set(k, false));
|
|
66
|
+
}
|
|
67
|
+
export function blockFor(ini, ws, redraw) {
|
|
68
|
+
if (!ini) return '';
|
|
69
|
+
lastRedraw = redraw; lastWs = ws || '';
|
|
70
|
+
const k = kOf(ini, ws);
|
|
71
|
+
if (!ST.has(k)) load(ini, ws);
|
|
72
|
+
const s = ST.get(k);
|
|
73
|
+
if (!s) return '';
|
|
74
|
+
css();
|
|
75
|
+
return blockHtml(s);
|
|
76
|
+
}
|
|
77
|
+
if (typeof document !== 'undefined' && document.addEventListener) document.addEventListener('cz:chat-turn', () => { ST.clear(); if (lastRedraw) lastRedraw(); });
|
|
78
|
+
|
|
79
|
+
async function write(ini, body) {
|
|
80
|
+
const r = await pmPost('/api/meeting-stance', { ws: lastWs || null, ini, ...body }).catch(() => null);
|
|
81
|
+
load(ini, lastWs, true);
|
|
82
|
+
return r;
|
|
83
|
+
}
|
|
84
|
+
/** One press inside the popup body: the popup's own click listener (pm/cozy-pop-work.js) hands every press here first; true when it was
|
|
85
|
+
* this block's, so the popup leaves it alone. */
|
|
86
|
+
export function press(e, body, { say } = {}) {
|
|
87
|
+
const b = e.target.closest && e.target.closest('[data-ms-act]');
|
|
88
|
+
if (!b || !body || !body.contains(b)) return false;
|
|
89
|
+
const sec = b.closest('[data-ms-ini]');
|
|
90
|
+
if (!sec) return false;
|
|
91
|
+
e.stopImmediatePropagation();
|
|
92
|
+
act(b, sec, say);
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
async function act(b, sec, say) {
|
|
96
|
+
const ini = sec.dataset.msIni, decision = sec.dataset.msDec, what = b.dataset.msAct;
|
|
97
|
+
const s = ST.get(kOf(ini, lastWs));
|
|
98
|
+
if (!s) return;
|
|
99
|
+
const tell = (text, undoIt) => { if (undoIt) undoToast(text, undoIt); else if (say) say(text); };
|
|
100
|
+
if (what === 'copy') {
|
|
101
|
+
noteUse('meetingStanceCopy');
|
|
102
|
+
try { await navigator.clipboard.writeText(s.draft || ''); tell('Copied. Send them from your mail or chat.'); } catch { tell('Select the questions and copy them.'); }
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
noteUse(what === 'sent' ? 'meetingStanceSent' : 'meetingStanceAnswer');
|
|
106
|
+
b.disabled = true;
|
|
107
|
+
const body = what === 'sent' ? { decision, act: 'sent', people: s.people }
|
|
108
|
+
: { decision, act: 'answer', person: b.dataset.msPerson, name: b.dataset.msName, q: Number(b.dataset.msQ), says: b.dataset.msSays || '' };
|
|
109
|
+
const r = await write(ini, body);
|
|
110
|
+
if (!r || !r.ok) { b.disabled = false; tell((r && r.error) || 'Not saved.'); return; }
|
|
111
|
+
const word = what === 'sent' ? 'Marked: you sent the questions' : `${b.dataset.msName}: ${b.dataset.msSays || 'answer cleared'}`;
|
|
112
|
+
tell(word, () => { write(ini, { decision, act: 'undo' }); });
|
|
113
|
+
}
|
|
@@ -126,9 +126,10 @@ export function itemTarget(it, ws) {
|
|
|
126
126
|
const kind = String((it && it.kind) || 'item').trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'item';
|
|
127
127
|
const id = String((it && it.id) || '').replace(/[^A-Za-z0-9._:-]+/g, '-').replace(/^[^A-Za-z0-9]+/, '');
|
|
128
128
|
if (!id || !title) return null;
|
|
129
|
+
const where = String((it && it.where) || '').replace(/\s+/g, ' ').trim().slice(0, 40); // the field pressed (ask-here.js): "In: <title> › <field>"
|
|
129
130
|
const key = ('pop:' + kind + ':' + id).slice(0, 104);
|
|
130
131
|
const facts = (Array.isArray(it.facts) ? it.facts : []).filter((f) => Array.isArray(f) && f[1] != null && String(f[1]).trim()).slice(0, 12).map(([a, b]) => [String(a), String(b)]);
|
|
131
|
-
return { key, ws: ws || undefined, title, about: title, role: CLAUDE, rich: false, popAbout: true, scope: { text: 'In: ' + title, icon: PIN, drop: true },
|
|
132
|
+
return { key, ws: ws || undefined, title, about: title, role: CLAUDE, rich: false, popAbout: true, scope: { text: 'In: ' + title + (where ? ' › ' + where : ''), icon: PIN, drop: true },
|
|
132
133
|
context: { title, subject: String(it.subject || ''), say: String(it.say || ''), facts }, placeholder: 'Ask or tell PMOS', empty: COS_EMPTY };
|
|
133
134
|
}
|
|
134
135
|
export function cosTarget(here, ws) {
|
|
@@ -74,6 +74,7 @@ import * as ST from './bd-stands.js'; // Where it stands, its Suggestion and t
|
|
|
74
74
|
import * as LS from './load-shapes.js'; // the skeleton and the slow-case line while the board is read (page-open-speed, SpD) // the Board as the first panel: fit(), the rows that open beside, the open row's mark
|
|
75
75
|
import * as STRAT from './bd-strategy.js'; // the product's strategy in five lines above the initiatives (bet A458)
|
|
76
76
|
import * as PRIN from './bd-principles.js'; // the product's principles drafted from its decisions, below the strategy (bet A352)
|
|
77
|
+
import * as SEG from './segments.js'; // the product's user groups and the roadmap items that serve each, below the principles (idea A327)
|
|
77
78
|
import * as SWO from './switch-owners.js'; // who has which switch, per customer, below the principles (idea A263)
|
|
78
79
|
import * as SKM from './skill-map.js'; // the team skill map below the principles (bet A208)
|
|
79
80
|
import * as FHR from './first-hour.js'; // the first hour for a new engineer, below Team skills (bet A55)
|
|
@@ -1532,6 +1533,7 @@ async function load() {
|
|
|
1532
1533
|
LE.loaded({ since, stale: !!r.stale }); // a change still saving stays on the new read; open views (the big Work breakdown) follow it
|
|
1533
1534
|
STRAT.refresh($('#cStrat'), { ws: M.board.ws || null, board: M.board.id || null, single: !ALL, say });
|
|
1534
1535
|
PRIN.refresh($('#cPrin'), { ws: M.board.ws || null, single: !ALL, say });
|
|
1536
|
+
SEG.refresh($('#cSeg'), { ws: M.board.ws || null, single: !ALL, say });
|
|
1535
1537
|
SWO.refresh($('#cSw'), { ws: M.board.ws || null, single: !ALL, say });
|
|
1536
1538
|
SKM.refresh($('#cSkills'), { ws: M.board.ws || null, single: !ALL, say });
|
|
1537
1539
|
FHR.refresh($('#cWelcome'), { ws: M.board.ws || null, single: !ALL, say });
|