create-pmos 0.437.0 → 0.438.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 +13 -13
- 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/adler-moments-test.js +121 -0
- package/workspace/briefing-premium-board-test.js +2 -1
- package/workspace/changelog.json +12 -0
- package/workspace/guide/adler.md +12 -1
- package/workspace/guide/briefing-premium.md +1 -1
- package/workspace/guide/home.md +1 -0
- package/workspace/home-rows-test.js +16 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-chat-context-test.js +20 -0
- package/workspace/public/pm/bd-asks.js +5 -2
- package/workspace/public/pm/bd-deliveries.js +11 -2
- package/workspace/public/pm/cozy-adler.css +7 -1
- package/workspace/public/pm/cozy-adler.js +17 -0
- package/workspace/public/pm/cozy-board.css +5 -0
- package/workspace/public/pm/cozy-ev.css +8 -0
- package/workspace/public/pm/cozy-home.css +7 -0
- package/workspace/public/pm/cozy-live-pill.css +2 -0
- package/workspace/public/pm/cozy-live-pill.js +6 -3
- package/workspace/public/pm/cozy-nav.js +18 -5
- package/workspace/public/pm/cozy-pull.js +62 -0
- package/workspace/public/pm/cozy-rec-tab.css +2 -0
- package/workspace/public/pm/cozy-rec-tab.js +18 -1
- package/workspace/public/pm/cozy-settings.js +14 -5
- package/workspace/public/pm/cozy-steps.css +3 -0
- package/workspace/public/pm/cozy-steps.js +5 -4
- package/workspace/public/pm/cozy-today.css +5 -0
- package/workspace/public/pm/home-app.js +33 -2
- package/workspace/public/pm/home-day.js +39 -5
- package/workspace/public/pm/home-mentions.js +13 -2
- package/workspace/public/pm/home-review.js +9 -1
- package/workspace/public/pm/home-stage-card.js +9 -3
- package/workspace/public/pm/impact.css +1 -0
- package/workspace/public/pm/impact.js +5 -2
- package/workspace/public/pm/ini-tasks.js +19 -3
- package/workspace/public/pm/premium-board.js +12 -4
- package/workspace/public/pm/premium-shell.js +12 -4
- package/workspace/public/pm/premium-vw-ctx.js +16 -2
- package/workspace/public/pm/premium-vw-doc-model.js +11 -0
- package/workspace/public/pm/premium-vw-doc.css +2 -0
- package/workspace/public/pm/premium-vw-doc.js +8 -2
- package/workspace/public/pm/premium.css +14 -0
- package/workspace/public/pm/program-charter.js +2 -1
- package/workspace/public/pm/session-rail.js +12 -5
- package/workspace/public/premium-rec.html +1 -1
- package/workspace/task-views-test.js +10 -1
- package/workspace/test-lists/adler-followups.json +9 -0
- package/workspace/test-lists/batch17-adler-moments.json +13 -0
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
* with the "moves on by itself" icon when that is on. A tap on it opens the move sheet (home-ini.js). Every step done and the next stage
|
|
11
11
|
* a milestone (or the switch off): the last node is the primary button "Move to ◆ Deliver". */
|
|
12
12
|
import { stepsHtml, stepTail } from './cozy-steps.js';
|
|
13
|
+
import { adler, prefs as adPrefs } from './cozy-adler.js';
|
|
14
|
+
|
|
15
|
+
/* Adler on the stage card (batch 17 item 4-A, canvas AdM1 "Stage card · Claude works on it", AdU3, AdM2 "Every part is done"): his face wears
|
|
16
|
+
* glasses in the node of the step a session runs, instead of the spinner; with every step done he holds the move. The PM's own steps keep
|
|
17
|
+
* their rings and boxes. Settings > Adler > Off keeps the spinner and the arrow. */
|
|
18
|
+
const adNode = (mood, cls) => (adPrefs()['adler.amount'] === 'off' ? undefined : `<span class="cz-nd ${cls} cz-ad" aria-hidden="true">${adler(mood, 24, { label: false })}</span>`);
|
|
13
19
|
|
|
14
20
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
15
21
|
const CLOCK = '<svg aria-hidden="true" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 7.5V12l3 2M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17"/></svg>';
|
|
@@ -32,7 +38,7 @@ export function stepRows(h, o = {}) {
|
|
|
32
38
|
let first = true;
|
|
33
39
|
for (const x of (h && h.rest) || []) {
|
|
34
40
|
if (x.kind === 'you') { you.push({ state: 'you', label: x.label, note: x.note, go: first ? { attr: 'data-hm-go', label: x.label + '. Open it' } : null, attr: first ? '' : 'data-hm-go', aria: x.label + '. Open it' }); first = false; }
|
|
35
|
-
else if (x.kind === 'agent' && o.run && !ran) { ran = true; run.push({ state: 'run', label: x.label, note: runNote(), owner: { kind: 'claude', live: true } }); }
|
|
41
|
+
else if (x.kind === 'agent' && o.run && !ran) { ran = true; run.push({ state: 'run', label: x.label, note: runNote(), owner: { kind: 'claude', live: true }, node: adNode('thinking', 'run') }); }
|
|
36
42
|
else if (x.kind === 'agent') wait.push({ state: 'wait', label: x.label, note: x.note, owner: { kind: 'claude' },
|
|
37
43
|
...(x.task ? { act: { attr: `data-hi-chk="${esc(x.task)}"`, icon: 'check', label: 'Mark done: ' + x.label } } : {}) }); // a stage task closes here (home-ini.js hiChk)
|
|
38
44
|
else if (x.kind === 'risk') risk.push({ state: 'risk', label: x.label, note: x.note, noteWarn: true });
|
|
@@ -40,7 +46,7 @@ export function stepRows(h, o = {}) {
|
|
|
40
46
|
else wait.push({ state: 'wait', label: x.label, note: x.note });
|
|
41
47
|
}
|
|
42
48
|
// a session works on this initiative but no step names it: its own line, so the spinner is never invented and never hidden
|
|
43
|
-
if (o.run && !ran) run.push({ state: 'run', label: o.run.title || 'Claude works on it', note: runNote(), owner: { kind: 'claude', live: true } });
|
|
49
|
+
if (o.run && !ran) run.push({ state: 'run', label: o.run.title || 'Claude works on it', note: runNote(), owner: { kind: 'claude', live: true }, node: adNode('thinking', 'run') });
|
|
44
50
|
const open = you.concat(run, risk, wait);
|
|
45
51
|
const shown = o.moreOpen ? open : open.slice(0, OPEN_MAX);
|
|
46
52
|
const done = ((h && h.done) || []).map((x) => ({ state: 'done', label: x.label }));
|
|
@@ -51,7 +57,7 @@ export function stepRows(h, o = {}) {
|
|
|
51
57
|
export function tailOf(h, mv) {
|
|
52
58
|
if (!mv || !mv.next) return mv && mv.why ? `<li class="cz-sli tail"><p class="hm-scwhy">${esc(mv.why)}</p></li>` : '';
|
|
53
59
|
if (mv.why) return stepTail({ name: mv.next, ms: mv.ms, note: mv.why });
|
|
54
|
-
if (mv.canMove && mv.allDone && (mv.ms || !mv.auto || mv.held)) return stepTail({ name: mv.next, ms: mv.ms, ready: { attr: 'data-hi-move', label: 'Move to' } });
|
|
60
|
+
if (mv.canMove && mv.allDone && (mv.ms || !mv.auto || mv.held)) return stepTail({ name: mv.next, ms: mv.ms, ready: { attr: 'data-hi-move', label: 'Move to' }, face: adNode('needs-you', 'go') });
|
|
55
61
|
const note = nextNote(h, mv);
|
|
56
62
|
const autoOn = mv.auto && !mv.held && !mv.ms;
|
|
57
63
|
return stepTail({ name: mv.next, ms: mv.ms, auto: autoOn, note, attr: 'data-hi-next',
|
|
@@ -29,6 +29,7 @@ b.im-t { font-weight: 700; }
|
|
|
29
29
|
.im-first, .im-mh { display: flex; align-items: center; gap: 12px; }
|
|
30
30
|
.im-first { background: var(--cz-card); border: 1px solid var(--cz-hair); border-radius: 18px; padding: 14px; }
|
|
31
31
|
.im-made { margin-top: 18px; }
|
|
32
|
+
.im-win { margin-bottom: 12px; border-radius: 18px; overflow: hidden; }
|
|
32
33
|
.im-ch { margin: 12px 0; }
|
|
33
34
|
.im-mt { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: var(--fs-3); color: var(--cz-ink2); }
|
|
34
35
|
.im-face { width: 40px; height: 44px; border: 0; padding: 0; margin: 0 -4px 0 0; background: none; border-radius: 22px; flex: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* source you can open, so an item whose source has no safe address is not drawn. Pure string builders above the Viewer part. */
|
|
20
20
|
import { pmGet, pmPost } from './http.js';
|
|
21
21
|
import { open as vwOpen, current as vwCurrent } from './cozy-viewer.js';
|
|
22
|
-
import { adler, prefs as adPrefs } from './cozy-adler.js';
|
|
22
|
+
import { adler, adlerScene, celebrateOnce, prefs as adPrefs } from './cozy-adler.js';
|
|
23
23
|
|
|
24
24
|
const CSS = new URL('./impact.css', import.meta.url).href;
|
|
25
25
|
function addCss() {
|
|
@@ -174,7 +174,10 @@ const initial = (s) => esc(String(s || '?').trim().charAt(0).toUpperCase() || '?
|
|
|
174
174
|
export function madeHtml(x, W = W0) {
|
|
175
175
|
if (!x || !shows(W)) return '';
|
|
176
176
|
addCss();
|
|
177
|
-
|
|
177
|
+
// AdH2: Adler celebrates once, on the first view of this delivery (and at most once a week), in the small win scene; every later view is calm.
|
|
178
|
+
// The diamond on the timeline stays plain and nothing is sent.
|
|
179
|
+
const joy = celebrateOnce('made.' + x.ms.name + '.' + x.ms.date), scene = joy && adPrefs()['adler.amount'] === 'full';
|
|
180
|
+
return `<section class="im im-made" aria-label="Who made it happen">${scene ? `<div class="im-win">${adlerScene('win', 'celebrating', { w: 500, h: 200, label: false })}</div>` : ''}<div class="im-mh">${scene ? '' : adler(joy ? 'celebrating' : 'handled', 44, { label: false })}<span class="im-tx"><b class="im-t">${esc(x.ms.name)} delivered on ${esc(x.ms.date)}.</b><span class="im-s">Here’s who made it happen.</span></span></div>`
|
|
178
181
|
+ `<div class="im-card">${x.people.map((p) => `<div class="im-row"><span class="im-av" aria-hidden="true">${initial(p.who)}</span><span class="im-tx"><b class="im-t">${esc(p.who)}</b><span class="im-s">${esc(p.what)}</span></span>`
|
|
179
182
|
+ `<a class="im-ib" href="${esc(p.url)}"${linkAttrs(p.url)} aria-label="Open ${esc(p.key || p.what)}" title="Open ${esc(p.key || 'the ticket')}">${svg(I.open, 20)}</a></div>`).join('')}</div>${LOCK}</section>`;
|
|
180
183
|
}
|
|
@@ -48,8 +48,10 @@ export function setViewMode(m) { VIEW = m === 'timeline' || m === 'kanban' ? m :
|
|
|
48
48
|
* (body.ivt-full; the css applies only to a Viewer that holds one), so List and Kanban stay in the panel; Escape or the same icon goes back. */
|
|
49
49
|
const PHONE = () => typeof matchMedia === 'function' && matchMedia('(max-width: 720px)').matches;
|
|
50
50
|
const fullOn = () => typeof document !== 'undefined' && document.body.classList.contains('ivt-full');
|
|
51
|
+
let REDRAW = null; // the Viewer's redraw: a Year, 2 years or 5 years axis stretches to the new width
|
|
51
52
|
function setFull(on) {
|
|
52
53
|
document.body.classList.toggle('ivt-full', !!on);
|
|
54
|
+
if (REDRAW && document.querySelector('#czViewer .ivt')) REDRAW();
|
|
53
55
|
const b = document.querySelector('#czViewer [data-iv-full]'), l = on ? 'Back to the panel' : 'Full width';
|
|
54
56
|
if (b) { b.setAttribute('aria-pressed', String(!!on)); b.setAttribute('aria-label', l); b.title = l; b.innerHTML = SVG(on ? P.unfull : P.full, 18); }
|
|
55
57
|
// Escape goes back to the panel first: the Viewer leaves Escape to a [data-esc-layer] (pm/cozy-viewer.js), so the Viewer carries the mark
|
|
@@ -160,15 +162,27 @@ export function dateBtn(x, o) {
|
|
|
160
162
|
}
|
|
161
163
|
|
|
162
164
|
/* ── Timeline ── */
|
|
165
|
+
// Year, 2 years and 5 years show a fixed span: it fills the width the Timeline has (the panel, or the window in full width), never narrower
|
|
166
|
+
// than the zoom's own scale; the name column is the css --nw, clamp(150px, 36cqw, 320px)
|
|
167
|
+
function fitPx(z, days) {
|
|
168
|
+
if (!['year', 'y2', 'y5'].includes(z[0]) || typeof document === 'undefined') return z[2];
|
|
169
|
+
const tl = document.querySelector('#czViewer .ivt'), vw = document.getElementById('czViewer');
|
|
170
|
+
const w = tl ? tl.getBoundingClientRect().width - 2 : vw ? vw.getBoundingClientRect().width - 48 : 0;
|
|
171
|
+
if (!(w > 0)) return z[2];
|
|
172
|
+
const nw = Math.min(320, Math.max(150, w * 0.36));
|
|
173
|
+
return Math.max(z[2], Math.floor(((w - nw - 24 - 36) / days) * 1000) / 1000);
|
|
174
|
+
}
|
|
163
175
|
const tone = (x) => (x.closed ? 'dn' : x.late ? 'lt' : x.prog ? 'pr' : '');
|
|
164
176
|
export function timelineHtml(v, o, isOpen) {
|
|
165
|
-
const today = dn(v.today) || Math.round(Date.now() / 864e5), z = ZOOMS.find((x) => x[0] === zoomOf())
|
|
177
|
+
const today = dn(v.today) || Math.round(Date.now() / 864e5), z = ZOOMS.find((x) => x[0] === zoomOf());
|
|
166
178
|
const S = v.tasks.sections;
|
|
167
179
|
// the range: the open tasks around today, a little air each side; never more than a few years
|
|
168
180
|
const ns = [];
|
|
169
181
|
for (const s of S) { for (const x of flat(s).concat(flatDone(s))) { const a = dn(x.start), b = dn(x.end); if (a != null) ns.push(a); if (b != null) ns.push(b); if (x.cmp) { const c = dn(x.cmp.start), d = dn(x.cmp.due); if (c != null) ns.push(c); if (d != null) ns.push(d); } } for (const k of jiraOf(s)) { const b = dn(k.due); if (b != null) ns.push(b); } }
|
|
170
182
|
const lo = Math.max(today - 730, Math.min(today - 14, ...ns) - 4), hi = Math.min(today + Math.max(1095, z[3]), Math.max(today + z[3], ...ns) + 10);
|
|
171
|
-
|
|
183
|
+
let O = lo - ((new Date(lo * 864e5).getUTCDay() + 6) % 7); // start on a Monday
|
|
184
|
+
const px = fitPx(z, hi - O + 1);
|
|
185
|
+
if (px !== z[2]) O -= Math.ceil(36 / px); // a fitted axis keeps room for the Today pill before today
|
|
172
186
|
const W = Math.ceil((hi - O + 1) * px), X = (n) => Math.round((n - O) * px);
|
|
173
187
|
// the axis: Mondays (Weeks), the 1st (Months), the quarter's first day (Quarter, Year, 2 years), the year's first day (5 years)
|
|
174
188
|
const ticks = [];
|
|
@@ -180,6 +194,8 @@ export function timelineHtml(v, o, isOpen) {
|
|
|
180
194
|
if (z[0] === 'y2' && d.getUTCDate() === 1 && m % 3 === 0) ticks.push({ x: X(n), t: m === 0 ? String(y) : 'Q' + (m / 3 + 1), b: m === 0 });
|
|
181
195
|
if (z[0] === 'y5' && d.getUTCDate() === 1 && m === 0) ticks.push({ x: X(n), t: String(y), b: true });
|
|
182
196
|
}
|
|
197
|
+
// a tick label under the Today pill gives way to it (its line stays)
|
|
198
|
+
for (const t of ticks) if (Math.abs(t.x - X(today)) < 44) t.t = '';
|
|
183
199
|
const drag = o.quick ? ' data-ivt-drag="1"' : '';
|
|
184
200
|
// the compared version's days: a thin dark line with end caps under the bar, only where they differ; a dropped task keeps only its line
|
|
185
201
|
const planLine = (x) => {
|
|
@@ -391,7 +407,7 @@ export function press(b, d, root, H, e) {
|
|
|
391
407
|
if (hidden && d.ivView === viewMode()) { menuPop(b, 'Tasks view', VIEWS.map(([k, l]) => ({ k, label: l, on: k === viewMode() })), (x) => { setViewMode(x.k); if (H.redraw) H.redraw(); }); return true; }
|
|
392
408
|
setViewMode(d.ivView); closePop(); if (H.redraw) H.redraw(); return true;
|
|
393
409
|
}
|
|
394
|
-
if ('ivFull' in d) { setFull(!fullOn()); return true; }
|
|
410
|
+
if ('ivFull' in d) { REDRAW = H && H.redraw; setFull(!fullOn()); return true; }
|
|
395
411
|
if ('ivZoom' in d) { menuPop(b, 'Zoom', ZOOMS.map(([k, l]) => ({ k, label: l, on: k === zoomOf() })), (x) => { ZOOM = x.k; store.set('pmos.tasks.zoom', x.k); if (H.redraw) H.redraw(); }); return true; }
|
|
396
412
|
if ('ivKstage' in d) {
|
|
397
413
|
const v = H.__v; if (!v) return true;
|
|
@@ -37,7 +37,8 @@ import { open as viewerOpen, current as viewerCur } from './cozy-viewer.js';
|
|
|
37
37
|
import * as VW from './cozy-viewer.js';
|
|
38
38
|
import * as PP from './bd-prog-panel.js';
|
|
39
39
|
import * as PO from './prog-order.js';
|
|
40
|
-
import * as SO from './sort-order.js';
|
|
40
|
+
import * as SO from './sort-order.js';
|
|
41
|
+
import { faceOr } from './cozy-adler.js'; // Adler on the Jira chip (batch 17 item 4-A, canvas AdM2 Jira freshness) // the sort button and ONE order with Home and the Timeline (batch 14 item 8, canvas SoADesk, SoABoardPhone)
|
|
41
42
|
import { sortTop, sortInis, prodKey } from './order-model.js';
|
|
42
43
|
import * as SM from './split-merge.js'; // split one initiative in two, or merge two: Claude suggests, the PM approves (batch 11 item 14)
|
|
43
44
|
import * as PM from './prog-move.js'; // move an initiative out of its program, or to another (canvas LpA1More, LpA2Other)
|
|
@@ -216,6 +217,7 @@ function drawHead() {
|
|
|
216
217
|
$('#newIni').hidden = ALL ? (M.board.products || []).every((p) => p.self) : !!M.board.self;
|
|
217
218
|
setPageGaps(((M.header && M.header.missing) || []).length);
|
|
218
219
|
}
|
|
220
|
+
let jiraReading = false; // a press is reading Jira again: the chip's Adler wears his glasses until the next read of the Board lands
|
|
219
221
|
const CHIP_F = [['late', 'late', 'm-warn', (n) => n + ' late'], ['risk', 'risk', 'm-warn', (n) => n + ' at risk'], ['blocked', 'red', 'm-crit', (n) => n + ' blocked'], ['idle', 'q', '', (n) => n + ' idle 30+ days']];
|
|
220
222
|
/** The sprint filter (the "Sprint N only" chip and Filter's Sprint group) shows on the Sprint span only among the timeline's spans (TsSprintFilter);
|
|
221
223
|
* the stage track keeps its chip. */
|
|
@@ -229,7 +231,10 @@ function drawChips() {
|
|
|
229
231
|
const flt = (keys) => CHIP_F.filter(([k]) => keys.includes(k)).map(([k, tone, mo, word]) => (C[k] ? `<button type="button" class="bd-chip gh${F.chips.has(k) ? ' on' : ''}" data-f="${k}" aria-pressed="${F.chips.has(k)}"><i class="cz-dot ${tone} ${mo}"></i>${esc(word(C[k]))}</button>` : '')).join('');
|
|
230
232
|
const thisSprint = sp && (view === 'track' || view === 'time' || phone) && sprintFilterOn() ? `<button type="button" class="bd-chip${F.chips.has('sprint') ? ' on' : ''}" data-f="sprint" aria-pressed="${F.chips.has('sprint')}" title="${F.chips.has('sprint') ? 'Shows only the initiatives with work in ' + esc(sp.name) + '. Press to show all.' : 'Press to show only the initiatives with work in ' + esc(sp.name) + '.'}">${esc(sp.name)} only</button>` : ''; // it named no sprint and read like a heading (testing fixes)
|
|
231
233
|
// All products (PgBoard): one Jira chip with the oldest read of any product, and every product's new asks; the sprint stays per product
|
|
232
|
-
|
|
234
|
+
// AdM2: the chip's S face carries the read's mood: calm when Jira was read within a day and a half, honest when it was not, glasses on while
|
|
235
|
+
// a press reads it again. Settings > Adler > Off keeps the refresh icon.
|
|
236
|
+
const jMood = jiraReading ? 'thinking' : J.readAt && Date.now() - Date.parse(J.readAt) < 36 * 3600000 ? 'handled' : 'honest';
|
|
237
|
+
const jiraChip = `<button type="button" class="bd-chip bd-adc" id="chJira" title="${ALL ? 'Read Jira again for every product' : 'Read Jira again'}">${faceOr(jMood, 's', SV(I.refresh), { label: false })}<span>${esc(jira)}</span></button>`;
|
|
233
238
|
const askChip = `<button type="button" class="bd-chip" id="chAsks" aria-haspopup="dialog">${asks ? esc(asks) : `<i class="cz-dot you${C.asks ? ' m-info' : ''}"></i><b>${C.asks}</b> new ${plural(C.asks, 'ask', 'asks')}`}</button>`;
|
|
234
239
|
if (phone) {
|
|
235
240
|
const docs = M.docs && M.docs.rows ? M.docs.rows.length : 0;
|
|
@@ -261,12 +266,15 @@ $('#bdChipset').addEventListener('click', (e) => {
|
|
|
261
266
|
/** Read Jira again: the Jira source's own refresh (POST /api/sources/refresh), the one the Sources list runs. It starts a read and changes no record. */
|
|
262
267
|
async function refreshJira(btn) {
|
|
263
268
|
if (btn) btn.disabled = true;
|
|
269
|
+
jiraReading = true; drawChips();
|
|
270
|
+
btn = btn && $('#chJira');
|
|
264
271
|
// All products: each product's own Jira source, one after the other
|
|
265
272
|
const W = ALL ? (M.board.products || []).filter((p) => !p.self).map((p) => p.ws) : [(M && M.board.ws) || ''];
|
|
266
273
|
const R = [];
|
|
267
274
|
for (const ws of W) R.push(await pmPost('/api/sources/refresh', { ws, source: 'jira' }).catch(() => null));
|
|
268
|
-
if (btn) btn.disabled = false;
|
|
269
275
|
const bad = R.filter((r) => !r || !r.ok), ok = R.length - bad.length;
|
|
276
|
+
if (!ok) { jiraReading = false; drawChips(); }
|
|
277
|
+
else if ((btn = $('#chJira'))) btn.disabled = false;
|
|
270
278
|
say(!bad.length ? 'Reading Jira again. The Board shows it when the read lands.' : ok ? 'Reading Jira again for ' + ok + ' of ' + R.length + ' products. The others did not start: ' + ((bad[0] && bad[0].error) || 'the server did not answer') + '.' : 'Jira was not read again: ' + ((bad[0] && bad[0].error) || 'the server did not answer') + '.');
|
|
271
279
|
if (ok) setTimeout(load, 4000);
|
|
272
280
|
}
|
|
@@ -976,7 +984,7 @@ async function load() {
|
|
|
976
984
|
setTimeout(load, 15000);
|
|
977
985
|
return;
|
|
978
986
|
}
|
|
979
|
-
M = r.model; holdNames(); draw();
|
|
987
|
+
M = r.model; jiraReading = false; holdNames(); draw();
|
|
980
988
|
focusOnce(); programOnce(); newOnce(); loadOthers(); loadWorkflows();
|
|
981
989
|
if (r.stale) setTimeout(load, 2000); // a press is still being derived: ask again
|
|
982
990
|
else { loadTrail(); loadGrill(); }
|
|
@@ -18,6 +18,7 @@ export const openBlockTab = (b) => (b && b.kind === 'report' ? openReportTab(b)
|
|
|
18
18
|
import { mountNotes, openNotes, flushNotes, syncNotes } from './premium-notes.js';
|
|
19
19
|
import { attachMarkup, attachRowMarkup, mountAttach, attachNames, clearAttach, syncAttach, dropFiles, splitFiles, filesHtml, openAttachment } from './premium-attach.js';
|
|
20
20
|
import { railModel, railHtml, teaser, loudestRow, factsOf, titleOf, endAsks, DOT, WORD } from './session-rail.js';
|
|
21
|
+
import { adler } from './cozy-adler.js'; // the session card's question: Adler holds it (batch 17 item 4-A, canvas AdU7)
|
|
21
22
|
/* premium-agreed-design (Home): a page without the old dialog (Home has none) can still import this module. Its top-level wiring then binds to a
|
|
22
23
|
* detached copy of the dialog's parts that is never put in the page, so nothing old shows and nothing throws. A page with #dlg is unchanged. */
|
|
23
24
|
const DETACHED = typeof document !== 'undefined' && !document.getElementById('dlg') ? (() => {
|
|
@@ -1363,7 +1364,7 @@ async function endRows(rows) {
|
|
|
1363
1364
|
function railDraw() {
|
|
1364
1365
|
const m = R.model = railModel(R.rows, R.goals, { showAll: R.showAll, showIdle: R.showIdle });
|
|
1365
1366
|
if (R.ending && !m.rows.some((x) => x.id === R.ending)) R.ending = null;
|
|
1366
|
-
const l = $('#srlList'); if (l) putHtml(l, railHtml(m, { sel: R.sel, shut: R.shut, showAll: R.showAll, showIdle: R.showIdle, ending: R.ending }));
|
|
1367
|
+
const l = $('#srlList'); if (l) putHtml(l, railHtml(m, { sel: R.sel, shut: R.shut, showAll: R.showAll, showIdle: R.showIdle, ending: R.ending, asking: Object.keys(R.asks || {}) }));
|
|
1367
1368
|
const t = $('#sTease'), tz = teaser(m);
|
|
1368
1369
|
if (t) {
|
|
1369
1370
|
t.hidden = !tz || !t.dataset.on || $('#dlg').classList.contains('full');
|
|
@@ -1373,9 +1374,17 @@ function railDraw() {
|
|
|
1373
1374
|
}
|
|
1374
1375
|
/** Home: open one session from the list's own rows (an initiative's sessions). */
|
|
1375
1376
|
export function openSessionRow(id) { if (R.model && R.model.rows.some((x) => x.id === id)) pickSession(id); }
|
|
1377
|
+
/** The runs whose question card waits on the PM (GET /api/runs, state asking): the session card draws the question, the list gives that row Adler (AdU5). */
|
|
1378
|
+
function readAsks(runs) {
|
|
1379
|
+
if (!runs || !runs.ok || !runs.cards) return;
|
|
1380
|
+
R.asks = {};
|
|
1381
|
+
for (const [k, c] of Object.entries(runs.cards)) if (c && c.state === 'asking' && c.ask && c.ask.q && Array.isArray(c.ask.options) && c.ask.options.length) R.asks[k] = { request: c.asked || c.ask.id, q: c.ask.q, options: c.ask.options };
|
|
1382
|
+
}
|
|
1376
1383
|
async function railRead() {
|
|
1377
1384
|
const [s, g] = await Promise.all([pmGet('/api/sessions').catch(() => null), pmGet('/api/briefing-premium/goals').catch(() => null)]);
|
|
1378
1385
|
if (s && Array.isArray(s.sessions)) R.rows = s.sessions;
|
|
1386
|
+
// a run asks only while it waits, so the runs are read only when a session waits on the PM (Ready or Maybe blocked)
|
|
1387
|
+
if (R.rows.some((x) => x.shown === 'needs' || x.shown === 'blocked')) readAsks(await pmGet('/api/runs').catch(() => null)); else R.asks = {};
|
|
1379
1388
|
if (g && g.ok && g.goals) R.goals = g.goals;
|
|
1380
1389
|
if (R.sel && !R.rows.some((x) => x.id === R.sel && x.shown !== 'exited') && S.sid === R.sel) { S.sid = null; sessionCard(null); }
|
|
1381
1390
|
railDraw();
|
|
@@ -1424,15 +1433,14 @@ async function loadSid(id) {
|
|
|
1424
1433
|
async function sessionCard(r) {
|
|
1425
1434
|
delete $('#oMain').dataset.empty; vwReset(); $('#oLab').textContent = 'Session';
|
|
1426
1435
|
if (!r) { $('#oMain').innerHTML = '<article class="paper doc"><p class="note">This session has ended. Pick another from the list.</p></article>'; return; }
|
|
1427
|
-
|
|
1428
|
-
if (runs && runs.ok && runs.cards) for (const [k, c] of Object.entries(runs.cards)) if (c && c.state === 'asking' && c.ask && c.ask.q && Array.isArray(c.ask.options) && c.ask.options.length) R.asks[k] = { request: c.asked || c.ask.id, q: c.ask.q, options: c.ask.options };
|
|
1436
|
+
readAsks(await pmGet('/api/runs').catch(() => null));
|
|
1429
1437
|
cardDraw(r);
|
|
1430
1438
|
}
|
|
1431
1439
|
function cardDraw(r) {
|
|
1432
1440
|
if (R.sel !== r.id) return;
|
|
1433
1441
|
const q = R.asks[r.id], what = r.headless ? 'This ends the background run.' : 'This ends the session and closes its terminal.';
|
|
1434
1442
|
$('#oMain').innerHTML = `<article class="paper doc scard"><p class="scs"><i class="sdot2 ${DOT[r.state]}" aria-hidden="true"></i>${esc(WORD[r.state])}</p><h3 class="d2">${esc(r.name)}</h3>${kv(factsOf(r))}
|
|
1435
|
-
${q ? `<div class="ssc ssq" role="group" aria-label="${esc(r.name)} asks"><p
|
|
1443
|
+
${q ? `<div class="ssc ssq" role="group" aria-label="${esc(r.name)} asks"><p class="ssq-h">${adler('needs-you', 40, { label: false })}<b>${esc(q.q)}</b></p><div class="ssx">${q.options.map((o) => `<button type="button" class="cta${o.rec ? '' : ' alt'}" data-ans="${esc(o.label)}"${R.busy ? ' disabled' : ''}>${esc(o.label)}</button>`).join('')}</div></div>` : ''}
|
|
1436
1444
|
${R.ask ? `<div class="ssc" role="group" aria-label="Confirm stop"><p><b>Stop “${esc(r.name)}”?</b> ${what} Files it already wrote stay where they are.</p><div class="ssx"><button type="button" class="cta bad" data-yes="1">Stop</button><button type="button" class="cta alt" data-no="1">Keep running</button></div></div>`
|
|
1437
1445
|
: R.slow ? `<div class="ssc" role="group" aria-label="Still running"><p><b>Asked “${esc(r.name)}” to end.</b> It has not exited yet. Press Stop again to remove it.</p><div class="ssx"><button type="button" class="cta bad" data-yes="1">Stop again</button><button type="button" class="cta alt" data-no="1">Keep running</button></div></div>`
|
|
1438
1446
|
: `<div class="ssx"><button type="button" class="cta alt" data-stop="1"${R.busy ? ' disabled' : ''}>${R.busy ? 'Ending…' : 'Stop'}</button></div>`}
|
|
@@ -19,11 +19,25 @@ const ICO = {
|
|
|
19
19
|
const icon = (k) => `<svg class="i" viewBox="0 0 24 24" aria-hidden="true">${ICO[k] || ICO.file}</svg>`;
|
|
20
20
|
const ref = (it) => (it.kind === 'file' ? it.path : it.kind === 'jira' ? it.key : it.url || it.channel || '');
|
|
21
21
|
|
|
22
|
-
/** The chip row under an answer. Pure. The first item is the main one: it is what opened by itself.
|
|
22
|
+
/** The chip row under an answer. Pure. The first item is the main one: it is what opened by itself.
|
|
23
|
+
* Two or more things Claude only read fold into one "+N read" (batch 17 item 5): what it wrote or named stays in sight. */
|
|
24
|
+
const chipHtml = (it, lead) => `<button type="button" class="ctxchip${lead ? ' lead' : ''}" role="listitem" data-ctx="${esc(it.kind)}" data-ctx-ref="${esc(ref(it))}"${it.ts ? ` data-ctx-ts="${esc(it.ts)}"` : ''}${it.web ? ` data-ctx-web="${esc(it.web)}"` : ''} title="${esc(ref(it))}">${icon(it.kind)}<span><b>${esc(it.title)}</b><em>${esc(it.sub)}</em></span></button>`;
|
|
25
|
+
const OPEN = new Set(); // the folds the PM opened stay open when the conversation redraws
|
|
26
|
+
const foldId = (items) => items.map((it) => it.id || ref(it)).join('|');
|
|
23
27
|
export function chipsHtml(items) {
|
|
24
28
|
if (!items || !items.length) return '';
|
|
25
|
-
|
|
29
|
+
const read = items.filter((it) => it.how === 'read');
|
|
30
|
+
let shown = items, fold = [];
|
|
31
|
+
if (read.length >= 2) {
|
|
32
|
+
shown = items.filter((it) => it.how !== 'read');
|
|
33
|
+
if (!shown.length) shown = [read[0]];
|
|
34
|
+
fold = items.filter((it) => !shown.includes(it));
|
|
35
|
+
}
|
|
36
|
+
const id = fold.length ? foldId(fold) : '';
|
|
37
|
+
const more = fold.length ? `<details class="ctxmore" role="listitem" data-ctx-fold="${esc(id)}"${OPEN.has(id) ? ' open' : ''}><summary aria-label="${fold.length} more files and pages Claude read">+${fold.length} read</summary><div class="ctxc">${fold.map((it) => chipHtml(it, false)).join('')}</div></details>` : '';
|
|
38
|
+
return `<div class="ctxc" role="list" aria-label="What Claude worked with">${shown.map((it, i) => chipHtml(it, i === 0)).join('')}${more}</div>`;
|
|
26
39
|
}
|
|
40
|
+
if (typeof document !== 'undefined') document.addEventListener('toggle', (e) => { const d = e.target; if (!d || !d.dataset || d.dataset.ctxFold == null) return; if (d.open) OPEN.add(d.dataset.ctxFold); else OPEN.delete(d.dataset.ctxFold); }, true);
|
|
27
41
|
/** An item from a chip's data attributes. */
|
|
28
42
|
export function itemOf(b) {
|
|
29
43
|
const k = b.dataset.ctx, r = b.dataset.ctxRef || '';
|
|
@@ -152,6 +152,17 @@ export function overlay(current, p, kept) {
|
|
|
152
152
|
const n = live.filter((s) => on(s.name)).length;
|
|
153
153
|
return { blocks, live: live.map((s) => s.name), stale: stale.map((s) => s.name), applied: n, total: live.length };
|
|
154
154
|
}
|
|
155
|
+
/** The quiet sign-off under a document the agent wrote last (batch 17 item 4-A, canvas AdH4): only facts the page holds. last: the newest
|
|
156
|
+
* revision; text: the file. null when a person wrote it last. → { mood, text } where the open questions (the list items under a heading
|
|
157
|
+
* "Open question(s)", the ticked ones left out) are the PM's. */
|
|
158
|
+
export function signOffOf(last, text) {
|
|
159
|
+
if (!last || !(last.text_by === 'agent' || last.by === 'agent')) return null;
|
|
160
|
+
const sec = splitDoc(text || '').sections.find((x) => /^open questions?\b/i.test(x.name.trim()));
|
|
161
|
+
const n = sec ? sec.body.split('\n').filter((l) => /^\s*(?:[-*+]|\d+[.)])\s+\S/.test(l) && !/^\s*[-*+]\s+\[[xX]\]/.test(l)).length : 0;
|
|
162
|
+
if (!n) return { mood: 'handled', text: 'I drafted this. It is yours to keep or change.' };
|
|
163
|
+
return { mood: 'needs-you', text: n === 1 ? 'I drafted this. The open question is yours.' : `I drafted this. The ${n} open questions are yours.` };
|
|
164
|
+
}
|
|
165
|
+
|
|
155
166
|
/** The bar's words over an agent edit. */
|
|
156
167
|
export function overlayLine(o, v) {
|
|
157
168
|
if (!o.total) return o.stale.length ? `The document changed where the agent proposed ${o.stale.length === 1 ? 'its change' : 'its changes'}, so nothing can be applied. Undo all closes it; ask again for a new one.` : '';
|
|
@@ -113,6 +113,8 @@
|
|
|
113
113
|
.cb pre{margin:0;padding:12px 14px;font:400 var(--fs-2)/1.6 var(--mono);overflow-x:auto;outline:0}
|
|
114
114
|
.cff{display:flex;gap:16px;align-items:center;flex-wrap:wrap;border-top:1px solid var(--hair);margin-top:24px;padding-top:12px;font-size:var(--fs-2);color:var(--ink-3)}
|
|
115
115
|
.cff code{font:400 var(--fs-1) var(--mono);overflow-wrap:anywhere}
|
|
116
|
+
/* the sign-off under a page the agent drafted (batch 17 item 4-A, AdH4): Adler's face and one line, quiet */
|
|
117
|
+
.vwsign{display:flex;align-items:center;gap:10px;margin:12px 0 0;padding:10px 14px;border-radius:14px;background:var(--well);color:var(--ink-2);font-size:var(--fs-3)}
|
|
116
118
|
/* editing: a toolbar over the page, a / menu, and the save row */
|
|
117
119
|
.vwetb{position:sticky;top:0;z-index:4;display:flex;align-items:center;gap:1px;overflow-x:auto;scrollbar-width:none;margin:0 0 12px;padding:4px;border-radius:8px;background:var(--card-solid);border:1px solid var(--hair);box-shadow:var(--card-shadow)}
|
|
118
120
|
.vwetb::-webkit-scrollbar{display:none}
|
|
@@ -12,7 +12,8 @@ import { pmPost } from './http.js';
|
|
|
12
12
|
import { vwOpen, vwStyle, vwConfirm } from './premium-viewer.js';
|
|
13
13
|
import { $, $$, esc, toast, AI, CHECK } from './premium-shell.js';
|
|
14
14
|
import { editBody, acceptBody, rejectBody, askBody, askLine, relationsOf, copyKindOf, copyView, proposalsModel } from './premium-doc-edit.js';
|
|
15
|
-
import { bodyHtml, pageHead, propHtml, splitDoc, overlay, overlayLine, mergeEdit, readMinutes, dayOf, PANELS } from './premium-vw-doc-model.js';
|
|
15
|
+
import { bodyHtml, pageHead, propHtml, splitDoc, overlay, overlayLine, mergeEdit, readMinutes, dayOf, PANELS, signOffOf } from './premium-vw-doc-model.js';
|
|
16
|
+
import { adler } from './cozy-adler.js'; // the sign-off under a page the agent drafted (batch 17 item 4-A, canvas AdH4)
|
|
16
17
|
|
|
17
18
|
const I = (d) => `<svg class="i" viewBox="0 0 24 24" aria-hidden="true">${d}</svg>`;
|
|
18
19
|
const IC = {
|
|
@@ -266,6 +267,11 @@ function makePage(d, ctx) {
|
|
|
266
267
|
return `<section class="vwside" aria-label="Edit log and proposals"><p class="hx-wait"><i aria-hidden="true"></i>Waiting for design</p><div class="vwrow">${tab('log', 'Edit log')}${tab('props', 'Proposals', m.count)}</div>`
|
|
267
268
|
+ `<p class="vwerr" id="vwSideErr" role="alert">${esc(P.sideErr || '')}</p>${body ? `<div class="vwmp" role="region" aria-label="${P.side === 'log' ? 'Edit log' : 'Proposals'}">${body}</div>` : ''}</section>`;
|
|
268
269
|
}
|
|
270
|
+
/* AdH4: a quiet sign-off at the end of a page the agent wrote last; a page a person wrote last has none */
|
|
271
|
+
function signHtml() {
|
|
272
|
+
const revs = (P.log && P.log.revisions) || [], so = signOffOf(revs[revs.length - 1], P.text);
|
|
273
|
+
return so ? `<p class="vwsign" role="note">${adler(so.mood, 40, { label: false })}<span>${esc(so.text)}</span></p>` : '';
|
|
274
|
+
}
|
|
269
275
|
function pageHtml() {
|
|
270
276
|
if (P.err) return `<p class="vwempty">${esc(P.err)}</p>`;
|
|
271
277
|
if (P.text == null) return '<p class="vwempty">Reading the file.</p>';
|
|
@@ -277,7 +283,7 @@ function makePage(d, ctx) {
|
|
|
277
283
|
return toolsHtml(p) + (P.mode === 'read' ? moreBar() : '') + unsaved + agentBar(p, o) + (P.mode === 'edit' ? editBar() : '')
|
|
278
284
|
+ `<article class="cf${P.mode === 'edit' ? ' editing' : ''}">${headHtml(h)}<div class="cfb"${P.mode === 'edit' ? ' contenteditable="true" spellcheck="true" aria-label="The page" role="textbox" aria-multiline="true"' : ''}>${body || '<p class="vwmut">The file has no text yet.</p>'}</div>`
|
|
279
285
|
+ `<footer class="cff"><span>${v() ? 'v' + v() + (p ? ' · edited by the agent, not kept yet' : '') : ''}</span><span class="gap"></span><code>${esc(d.path)}</code></footer></article>`
|
|
280
|
-
+ (P.mode === 'edit' ? saveRow() : '') + (P.mode === 'read' ? sideHtml() : '');
|
|
286
|
+
+ (P.mode === 'read' && !p ? signHtml() : '') + (P.mode === 'edit' ? saveRow() : '') + (P.mode === 'read' ? sideHtml() : '');
|
|
281
287
|
}
|
|
282
288
|
/* the contents: the page's section headings, as links under the header (testing fixes: a long PRD had no table of contents).
|
|
283
289
|
* Open on a desk, folded on a phone. Shown only when the page has 3 or more headings. */
|
|
@@ -1578,6 +1578,11 @@ button.dsn:hover{box-shadow:inset 0 0 0 1.5px rgb(79,109,245)}
|
|
|
1578
1578
|
.ssc{border-top:1px solid var(--hair);padding-top:14px;margin-top:8px;font-size:var(--fs-2);color:var(--ink-2)}
|
|
1579
1579
|
.ssc b{color:var(--ink);font-weight:600}
|
|
1580
1580
|
.ssx{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}.ssx .cta{height:44px;padding:0 20px}
|
|
1581
|
+
/* Adler holds a run's question in the session card, and stands where the dot stood on the row that asks (batch 17 item 4-A, AdU5, AdU7) */
|
|
1582
|
+
.ssq-h{display:flex;align-items:center;gap:10px;margin:0}
|
|
1583
|
+
.srl-ad{display:inline-flex;flex:none;width:20px;height:20px;align-items:center;justify-content:center}
|
|
1584
|
+
.srl-ad svg.ad-svg{width:22px;height:22px}
|
|
1585
|
+
.srl-min .srl-r .srl-ad{position:absolute;top:0;right:0}
|
|
1581
1586
|
.cta.bad{background:var(--bad);color:rgb(255,255,255)}
|
|
1582
1587
|
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .cta.bad{color:rgb(40,12,10)}}
|
|
1583
1588
|
:root[data-theme="dark"] .cta.bad{color:rgb(40,12,10)}
|
|
@@ -2685,3 +2690,12 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
|
|
|
2685
2690
|
/* Adler on the Welcome page (batch 16 item 2, canvas AdH6): the scene once, over the first step */
|
|
2686
2691
|
.wl-ad{max-width:420px;margin:0 0 12px}
|
|
2687
2692
|
.wl-hi{margin:0 0 6px;font-weight:600;color:var(--ink)}
|
|
2693
|
+
/* "+N read": what Claude only read, folded (batch 17 item 5) */
|
|
2694
|
+
.ctxmore{display:contents}
|
|
2695
|
+
.ctxmore>summary{display:inline-flex;align-items:center;min-height:44px;padding:0 12px;border-radius:var(--r-chip);color:var(--ink-3);font-size:var(--fs-1);cursor:pointer;list-style:none}
|
|
2696
|
+
.ctxmore>summary::-webkit-details-marker{display:none}
|
|
2697
|
+
.ctxmore>summary:hover{color:var(--ink);background:var(--well)}
|
|
2698
|
+
.ctxmore>summary:focus-visible{outline:2px solid var(--ink);outline-offset:1px}
|
|
2699
|
+
.ctxmore[open]>summary{display:none}
|
|
2700
|
+
.ctxmore>.ctxc{display:contents}
|
|
2701
|
+
.ctxmore:not([open])>.ctxc{display:none}
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* date, so there is no drag handle. Drafts are dashed and nothing is written until Save. A save resends every field and the program id, so
|
|
25
25
|
* nothing is lost (POST /api/programs/save: the last line wins); new milestones get ids from their names, never from their place. */
|
|
26
26
|
import { milestoneStep, shortDay } from './program-model.js';
|
|
27
|
+
import { faceOr } from './cozy-adler.js'; // Adler on the check line: glasses while Claude checks (batch 17 item 4-A, canvas AdM2 charter check)
|
|
27
28
|
|
|
28
29
|
const MAX = 12;
|
|
29
30
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
@@ -229,7 +230,7 @@ function checkedHtml() {
|
|
|
229
230
|
const R = C.o.review() || {}, run = !!(R.running || C.checking);
|
|
230
231
|
const when = R.checked ? lastWhen(R.checked) : '';
|
|
231
232
|
const line = run ? 'Claude is checking the milestones now.' : 'Claude checks every Monday and when a date, Jira or a meeting changes.' + (when ? ' Last checked ' + when + '.' : '');
|
|
232
|
-
return `<div class="msg-chk">${SV('M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0', 14)}<span>${esc(line)}</span>${C.o.checkNow ? `<button type="button" class="msg-ib${run ? ' on' : ''}" data-pc="checknow" aria-label="Check now" title="Check now"${run ? ' disabled' : ''}>${SV('M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7', 15)}</button>` : ''}</div>`;
|
|
233
|
+
return `<div class="msg-chk">${faceOr(run ? 'thinking' : 'handled', 's', SV('M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0', 14), { label: false })}<span>${esc(line)}</span>${C.o.checkNow ? `<button type="button" class="msg-ib${run ? ' on' : ''}" data-pc="checknow" aria-label="Check now" title="Check now"${run ? ' disabled' : ''}>${SV('M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7', 15)}</button>` : ''}</div>`;
|
|
233
234
|
}
|
|
234
235
|
/** "today, 09:12", "yesterday, 17:40" or "Oct 21". */
|
|
235
236
|
function lastWhen(iso) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* pm/session-rail.js — the session list beside the chat (initiative premium-session-list, PRD L2). Pure: no DOM, no fetch, so Node tests it.
|
|
2
2
|
*
|
|
3
3
|
* railModel(rows, goals, { showAll, showIdle }) → { groups: [{ id, title, rows, hidden, idle }], ready, blocked, working, live, warn, idle }
|
|
4
|
-
* railHtml(model, { sel, shut, showAll, showIdle, ending }) → the list's markup; every row has an End button (premium-session-end)
|
|
4
|
+
* railHtml(model, { sel, shut, showAll, showIdle, ending, asking }) → the list's markup; every row has an End button (premium-session-end);
|
|
5
|
+
* asking: the ids of runs whose question waits (Adler's face on those rows only, AdU5)
|
|
5
6
|
* endAsks(r) → whether ending this row asks first (anything but an idle session)
|
|
6
7
|
* teaser(model) → { dot, text } | null the chip in a normal-size chat dialog
|
|
7
8
|
* menuCount(rows) → how many live sessions need the PM (Ready or Maybe blocked): the ⋯ menu badge
|
|
@@ -10,6 +11,8 @@
|
|
|
10
11
|
* rows are GET /api/sessions rows (origin, automatic, shown, label, name, created, headless); goals is GET /api/briefing-premium/goals.
|
|
11
12
|
* Every word on a row is a record field or the fixed word for its state. Exited sessions are not listed. */
|
|
12
13
|
|
|
14
|
+
import { faceOr } from './cozy-adler.js'; // Adler only on the session that asks (batch 17 item 4-A, canvas AdU5)
|
|
15
|
+
|
|
13
16
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
14
17
|
// lib/session-state.js ATTENTION, minus exited: the order rows sort in and the state a folded group stands for
|
|
15
18
|
export const RANK = Object.freeze({ needs: 4, blocked: 3, working: 2, quiet: 1 });
|
|
@@ -77,19 +80,23 @@ const XI = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l
|
|
|
77
80
|
const CHEV = '<svg class="i chev" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg>';
|
|
78
81
|
|
|
79
82
|
/* one row: the session button and, beside it, its End button. `ending` is the row whose End asked first: the row becomes the question. */
|
|
80
|
-
|
|
83
|
+
/* AdU5: only the session that asks gets Adler: a goal that asked the PM, or a run whose question card waits (GET /api/runs, state asking). The
|
|
84
|
+
* needs-you face stands where its dot stood; every other row keeps its dot. Settings > Adler > Off keeps the dot. */
|
|
85
|
+
const asks = (r, asking) => (r.goal && r.goal.state === 'waiting') || asking.includes(r.id);
|
|
86
|
+
const markHtml = (r, asking) => { const d = `<i class="sdot2 ${DOT[r.state]}" aria-hidden="true"></i>`; return asks(r, asking) ? `<span class="srl-ad">${faceOr('needs-you', 's', d, { label: false })}</span>` : d; };
|
|
87
|
+
function rowHtml(r, sel, ending, asking = []) {
|
|
81
88
|
if (ending === r.id) return `<li class="srl-li srl-cf" role="group" aria-label="${esc('End ' + r.name)}"><span>End “${esc(r.name)}”? It is ${esc(WORD[r.state].toLowerCase())}.</span><button type="button" class="srl-yes" data-endyes="${esc(r.id)}">End</button><button type="button" class="srl-no" data-endno="1">Keep</button></li>`;
|
|
82
|
-
return `<li class="srl-li"><button type="button" class="srl-r${r.id === sel ? ' on' : ''}${r.state === 'needs' ? ' rd' : ''}" data-sid="${esc(r.id)}" aria-current="${r.id === sel}" aria-label="${esc(r.name + ', ' + r.hint)}" title="${esc(r.name + ' · ' + r.hint)}"
|
|
89
|
+
return `<li class="srl-li"><button type="button" class="srl-r${r.id === sel ? ' on' : ''}${r.state === 'needs' ? ' rd' : ''}" data-sid="${esc(r.id)}" aria-current="${r.id === sel}" aria-label="${esc(r.name + ', ' + r.hint)}" title="${esc(r.name + ' · ' + r.hint)}">${markHtml(r, asking)}<span class="srl-ic">${icon(r.kind)}</span><span class="srl-n">${esc(r.name)}</span><span class="srl-h">${esc(r.hint)}</span></button><button type="button" class="srl-x" data-end="${esc(r.id)}" aria-label="${esc('End ' + r.name)}" title="End this session">${XI}</button></li>`;
|
|
83
90
|
}
|
|
84
91
|
|
|
85
|
-
export function railHtml(m, { sel = null, shut = [], showAll = false, showIdle = false, ending = null } = {}) {
|
|
92
|
+
export function railHtml(m, { sel = null, shut = [], showAll = false, showIdle = false, ending = null, asking = [] } = {}) {
|
|
86
93
|
if (!m || !m.live) return '<p class="srl-none">No sessions are running. Write in a chat to start one.</p>';
|
|
87
94
|
let h = m.warn ? `<p class="srl-warn" role="status"><b>${m.warn} agents are working at once.</b> Each one is a program running on this computer, so many at once can slow it. Stop the ones you are not watching.</p>` : '';
|
|
88
95
|
for (const g of m.groups) {
|
|
89
96
|
const open = !shut.includes(g.id);
|
|
90
97
|
h += `<section class="srl-g"><button type="button" class="srl-gh" data-sg="${g.id}" aria-expanded="${open}">${CHEV}<span>${esc(g.title)}</span><em>${g.all}</em></button>`;
|
|
91
98
|
if (!open) { h += '</section>'; continue; }
|
|
92
|
-
h += '<ul>' + g.rows.map((r) => rowHtml(r, sel, ending)).join('');
|
|
99
|
+
h += '<ul>' + g.rows.map((r) => rowHtml(r, sel, ending, asking)).join('');
|
|
93
100
|
if (g.id === 'yours' && g.idle) h += `<li class="srl-li"><button type="button" class="srl-more" data-sidle="1">${showIdle ? 'Hide the idle shells' : g.idle + ' more idle · Show'}</button><button type="button" class="srl-endall" data-endidle="1">End all idle</button></li>`;
|
|
94
101
|
if (g.id === 'pmos' && (g.hidden || showAll)) h += `<li><button type="button" class="srl-more" data-smore="1">${showAll ? 'Hide the ones that need nothing' : g.hidden + ' more working on their own · Show'}</button></li>`;
|
|
95
102
|
h += '</ul></section>';
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<body class="cz rt-page">
|
|
16
16
|
<main class="rt" id="rt" data-mode="idle">
|
|
17
17
|
<div class="rt-main">
|
|
18
|
-
<header class="rt-hd"><span class="rt-dot" aria-hidden="true"></span><b class="rt-clock" id="rtClock">0:00</b><h1 class="rt-title" id="rtTitle">Meeting</h1><span class="rt-past" id="rtPast" hidden></span></header>
|
|
18
|
+
<header class="rt-hd"><span class="rt-dot" aria-hidden="true"></span><b class="rt-clock" id="rtClock">0:00</b><h1 class="rt-title" id="rtTitle">Meeting</h1><span class="rt-ad" id="rtAd" hidden></span><span class="rt-past" id="rtPast" hidden></span></header>
|
|
19
19
|
<p class="rt-alert" id="rtAlert" role="alert" hidden></p>
|
|
20
20
|
<section class="rt-stage" id="rtStage" aria-label="The meeting"></section>
|
|
21
21
|
<div class="rt-line" id="rtLine" hidden></div>
|
|
@@ -155,7 +155,7 @@ const model = () => { const M = BP.build(F.facts()); const r = M.rows.find((x) =
|
|
|
155
155
|
ok('V4 the zoom picker offers Weeks, Months, Quarter, Year, 2 years and 5 years (batch 17 item 3)', ['Weeks', 'Months', 'Quarter', 'Year', '2 years', '5 years'].every((t) => zl.some((x) => x.includes(t))), JSON.stringify(zl));
|
|
156
156
|
await p.evaluate(() => { const b = [...document.querySelectorAll('.tkc.ivq [data-ivq-i]')].find((x) => /5 years/.test(x.textContent)); if (b) b.click(); });
|
|
157
157
|
const y5 = await until(() => p.evaluate(() => { const z = document.querySelector('#czViewer [data-iv-zoom]'); if (!z || z.textContent !== '5 years') return null; const T = document.querySelector('#czViewer .ivt'); return { px: T.dataset.px, ticks: [...T.querySelectorAll('.ivt-r.ax .ivt-c span')].map((e) => e.textContent.trim()).filter(Boolean).slice(0, 8) }; }));
|
|
158
|
-
ok('V4 5 years draws the axis by year', y5 && y5.px
|
|
158
|
+
ok('V4 5 years draws the axis by year', y5 && +y5.px >= 0.16 && y5.ticks.length && y5.ticks.every((t) => /^\d{4}$/.test(t)), JSON.stringify(y5));
|
|
159
159
|
await p.click('#czViewer [data-iv-zoom]');
|
|
160
160
|
await p.evaluate(() => { const b = [...document.querySelectorAll('.tkc.ivq [data-ivq-i]')].find((x) => /Weeks/.test(x.textContent)); if (b) b.click(); });
|
|
161
161
|
await until(() => p.evaluate(() => (document.querySelector('#czViewer [data-iv-zoom]') || {}).textContent === 'Weeks'));
|
|
@@ -187,9 +187,18 @@ const model = () => { const M = BP.build(F.facts()); const r = M.rows.find((x) =
|
|
|
187
187
|
const fw = await until(() => p.evaluate(() => { const r = document.querySelector('#czViewer').getBoundingClientRect(); return r.width > innerWidth - 40 ? { w: Math.round(r.width), pressed: document.querySelector('#czViewer [data-iv-full]').getAttribute('aria-pressed') } : null; }));
|
|
188
188
|
ok('V4 Full width spreads the Timeline over the window, the icon pressed', !!fw && fw.pressed === 'true' && pw < fw.w, JSON.stringify({ pw, fw }));
|
|
189
189
|
await shot(p, 'timeline-full-1440');
|
|
190
|
+
const zoomTo = async (l) => { await p.click('#czViewer [data-iv-zoom]'); await p.evaluate((l) => { const b = [...document.querySelectorAll('.tkc.ivq [data-ivq-i]')].find((x) => x.textContent.includes(l)); if (b) b.click(); }, l); await until(() => p.evaluate((l) => (document.querySelector('#czViewer [data-iv-zoom]') || {}).textContent === l, l)); };
|
|
191
|
+
await zoomTo('5 years');
|
|
192
|
+
const fit = await p.evaluate(() => { const T = document.querySelector('#czViewer .ivt'), I = T.querySelector('.ivt-in'), td = +T.dataset.today; return { px: +T.dataset.px, tw: Math.round(T.getBoundingClientRect().width), iw: Math.round(I.getBoundingClientRect().width), under: [...T.querySelectorAll('.ivt-r.ax .ivt-c span')].filter((e) => e.textContent.trim() && Math.abs(+e.dataset.tlx - td) < 44).map((e) => e.textContent) }; });
|
|
193
|
+
ok('V4 in full width 5 years stretches to the window, past its own scale', fit.px > 0.16 && fit.iw >= fit.tw - 40, JSON.stringify(fit));
|
|
194
|
+
ok('V4 no axis label sits under the Today pill', fit.under.length === 0, JSON.stringify(fit));
|
|
195
|
+
await shot(p, 'timeline-full-5y-1440');
|
|
190
196
|
await p.keyboard.press('Escape');
|
|
191
197
|
const back = await until(() => p.evaluate(() => (!document.body.classList.contains('ivt-full') && !!document.querySelector('#czViewer .ivt') ? Math.round(document.querySelector('#czViewer').getBoundingClientRect().width) : null)));
|
|
192
198
|
ok('V4 Escape takes the Timeline back to the panel, the Viewer stays open', back != null && back < fw.w, String(back));
|
|
199
|
+
const pfit = await p.evaluate(() => { const T = document.querySelector('#czViewer .ivt'), I = T.querySelector('.ivt-in'); return { tw: Math.round(T.getBoundingClientRect().width), iw: Math.round(I.getBoundingClientRect().width) }; });
|
|
200
|
+
ok('V4 back in the panel 5 years fits the panel again', pfit.iw >= pfit.tw - 40 && pfit.iw <= pfit.tw + 4, JSON.stringify(pfit));
|
|
201
|
+
await zoomTo('Weeks');
|
|
193
202
|
|
|
194
203
|
/* V6 Kanban: one stage at a time (the current first), columns by status, Won't do a folded strip */
|
|
195
204
|
await p.click('#czViewer [data-iv-view="kanban"]');
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Batch 17 item 4-A, Adler on the Board, the Viewer and the sessions: the delivered milestone celebrates once then is calm, the Jira chip, New asks, the Deliveries lane's missed header, the charter's check line, the stage card's thinking node and held move, the asking session's row and question card, the Viewer's sign-off (pm/cozy-adler.js, impact.js, home-stage-card.js, session-rail.js, premium-vw-doc-model.js, bd-deliveries.js). Pure builders.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"adler-followups.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"adler-followups.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "batch 17 item 4-B: Adler on the phone, the recording and Jira (a failed source on Your day, pull to refresh, the ears on the menu button, headphones, the weekly review and Settings moments). adler-moments.test.js is pure; adler-moments-test.js drives the real Home at 390 px with touch, GET /api/sources stubbed with Jira failed.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"adler-moments.test.js"
|
|
5
|
+
],
|
|
6
|
+
"panels": [
|
|
7
|
+
"adler-moments-test.js"
|
|
8
|
+
],
|
|
9
|
+
"seconds": {
|
|
10
|
+
"adler-moments.test.js": 1,
|
|
11
|
+
"adler-moments-test.js": 25
|
|
12
|
+
}
|
|
13
|
+
}
|