create-pmos 0.440.0 → 0.442.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -25
- 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-seasons-art-test.js +106 -0
- package/workspace/adler-seasons-test.js +111 -0
- package/workspace/briefing-premium-adddoc-test.js +16 -13
- package/workspace/briefing-premium-board-test.js +19 -17
- package/workspace/briefing-premium-initiative-test.js +7 -4
- package/workspace/briefing-premium-products-test.js +4 -4
- package/workspace/briefing-premium-sources-test.js +2 -2
- package/workspace/briefing-premium-test.js +29 -23
- package/workspace/changelog.json +24 -0
- package/workspace/guide/adler.md +10 -0
- package/workspace/guide/core-documents.md +2 -2
- package/workspace/guide/data-freshness.md +7 -5
- package/workspace/guide/home.md +3 -1
- package/workspace/guide/horizon-scan.md +1 -1
- package/workspace/ini-workflow-test.js +6 -2
- package/workspace/lib/agent-inbox.js +20 -2
- package/workspace/lib/briefing-premium-sources.js +3 -0
- package/workspace/lib/briefing-premium.js +37 -7
- package/workspace/lib/driver-cli.js +1 -1
- package/workspace/lib/driver-run.js +15 -1
- package/workspace/lib/driver.js +31 -2
- package/workspace/lib/news-for-you.js +24 -9
- package/workspace/lib/pm-idle.js +12 -0
- package/workspace/lib/refresh.js +17 -8
- package/workspace/lib/routes-core-docs.js +1 -1
- package/workspace/lib/routes-news.js +15 -1
- package/workspace/lib/routes-phone-day.js +6 -4
- package/workspace/lib/settings-store.js +38 -0
- package/workspace/metric-drafts-ui-test.js +2 -2
- package/workspace/need-shot.js +57 -0
- package/workspace/news-viewers-test.js +183 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +2 -1
- package/workspace/premium-chat-attach-test.js +2 -0
- package/workspace/premium-core-doc-issue-test.js +9 -8
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-ini-panel.js +6 -13
- package/workspace/public/pm/c3-ini-ui.js +1 -1
- package/workspace/public/pm/cozy-adler.css +21 -0
- package/workspace/public/pm/cozy-adler.js +415 -8
- package/workspace/public/pm/cozy-ev.css +44 -0
- package/workspace/public/pm/cozy-home.css +8 -0
- package/workspace/public/pm/cozy-news.js +186 -22
- package/workspace/public/pm/cozy-seasons.js +318 -0
- package/workspace/public/pm/cozy-settings.js +88 -5
- package/workspace/public/pm/cozy-today.css +5 -0
- package/workspace/public/pm/cozy-viewer.js +12 -7
- package/workspace/public/pm/cozy-vw-shell.css +49 -0
- package/workspace/public/pm/cozy.css +65 -0
- package/workspace/public/pm/dash-view.js +4 -2
- package/workspace/public/pm/home-adddoc.js +46 -26
- package/workspace/public/pm/home-app.js +142 -114
- package/workspace/public/pm/home-chat.js +1 -1
- package/workspace/public/pm/home-day.js +17 -9
- package/workspace/public/pm/home-draft.js +35 -23
- package/workspace/public/pm/home-ini.js +4 -4
- package/workspace/public/pm/home-mentions.js +1 -1
- package/workspace/public/pm/home-need.js +336 -0
- package/workspace/public/pm/home-today.js +2 -2
- package/workspace/public/pm/home-work.js +51 -4
- package/workspace/public/pm/impact.js +1 -1
- package/workspace/public/pm/ini-groups.js +15 -10
- package/workspace/public/pm/ini-links.js +1 -1
- package/workspace/public/pm/ini-tasks.js +208 -44
- package/workspace/public/pm/ini-view-model.js +8 -2
- package/workspace/public/pm/ini-view.css +305 -1
- package/workspace/public/pm/ini-view.js +190 -80
- package/workspace/public/pm/mission.js +234 -0
- package/workspace/public/pm/premium-board.js +1 -1
- package/workspace/public/pm/premium-welcome.js +2 -2
- package/workspace/public/pm/small-vw.js +128 -0
- package/workspace/public/pm/split-merge.js +1 -1
- package/workspace/public/pm/stage-line.js +2 -2
- package/workspace/server.js +10 -6
- package/workspace/skills/initiative-drive.skill +4 -1
- package/workspace/split-merge-ui-test.js +1 -1
- package/workspace/stage-card-test.js +48 -11
- package/workspace/task-links-test.js +2 -0
- package/workspace/task-milestones-test.js +5 -1
- package/workspace/task-plans-test.js +3 -3
- package/workspace/task-views-test.js +90 -37
- package/workspace/test-lists/adler-seasons-art.json +13 -0
- package/workspace/test-lists/batch18-adler-seasons.json +13 -0
- package/workspace/test-lists/batch18-asks.json +5 -0
- package/workspace/test-lists/mission.json +5 -0
- package/workspace/test-lists/news-viewers.json +13 -0
- package/workspace/test-lists/small-viewers.json +5 -0
- package/workspace/test-lists/viewer-tasks.json +5 -0
- package/workspace/tk-tasks-test.js +25 -30
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/* pm/mission.js — the initiative as a mission (feedback batch 18 item 1, agreed A; canvas In development: XvpL5Rocket, XvpL6RocketDark,
|
|
2
|
+
* XvpE1States, XvpE2Stages, XvpE3TapMs, XvpD1Desktop; the art is mission() in next18/viewer-on-phone-gen/gen_rocket3.py, ported here). It
|
|
3
|
+
* replaces the stage card's one line in the ONE initiative view (pm/ini-view.js): one picture of the whole initiative, 100 px tall.
|
|
4
|
+
*
|
|
5
|
+
* missionOf(L) → the model, from the stage line's model (pm/stage-line.js lineOf): every place is a % of the same line, so the
|
|
6
|
+
* picture and the line never disagree. Pure.
|
|
7
|
+
* missionSvg(M, o) → the SVG. o: { tap (the milestones are presses: a 44 px hit area each) }. Colours are classes (ini-view.css
|
|
8
|
+
* names the --mi-* tokens of cozy.css): no colour is written here.
|
|
9
|
+
* crowded(points, gap) → the ids of the points closer than gap to another one: those are drawn without a press (the tap on the picture
|
|
10
|
+
* opens the list in place instead).
|
|
11
|
+
*
|
|
12
|
+
* THE STORY (xvpA):
|
|
13
|
+
* the ground strip is the stages, on their plan dates: done green, now blue, late orange, on hold grey, dashed with no dates; Today ticks
|
|
14
|
+
* on it. Small flags are the early milestones (gold when passed, grey ahead, orange when late).
|
|
15
|
+
* Discover: a telescope near the left scans for the target planet, which is a "?" until Discover is done.
|
|
16
|
+
* Plan to Build: the rocket is a dashed blueprint on the pad at the start of Build; through the first half of Build it is built from the
|
|
17
|
+
* bottom up (a clip) with sparks. Past Build 50% it lifts off and flies a curve to the planet.
|
|
18
|
+
* The release milestone (the first one named launch, release, rollout or deploy): it lands on the planet and plants a flag. With no such
|
|
19
|
+
* milestone the planet stands at the end of Deliver; with no Build stage it lifts off at the start of the stage the release falls in.
|
|
20
|
+
* The stages say what happened and the dates how far along it is: the rocket stays a blueprint until Build runs, flies once Build is done,
|
|
21
|
+
* and lands only when the release milestone is done (with none, when Deliver is done).
|
|
22
|
+
* Monitor: a dish at the right edge listens, with waves; the last milestone ("Did it work?") lights it green.
|
|
23
|
+
* Motion (draw-in, flame, sparks, scan, twinkle, waves) is CSS; all of it stops under reduced motion and Settings > Adler > Motion: Still. */
|
|
24
|
+
|
|
25
|
+
export const W = 340, H = 100;
|
|
26
|
+
const GY = 78; // the ground line
|
|
27
|
+
export const PX = W - 62, PY = 34; // the target planet, near the right end
|
|
28
|
+
const DX = W - 16; // the dish, at the right edge
|
|
29
|
+
const TX = 30; // the telescope, near the left end
|
|
30
|
+
export const HIT = 44; // a press's square, in px (the picture draws about 1 px a unit)
|
|
31
|
+
export const NEAR = 24; // two presses closer than this are one press on the picture
|
|
32
|
+
export const RELEASE_RE = /\b(launch(es|ed)?|releas(e|es|ed)|roll[- ]?outs?|deploy(s|ed|ment)?)\b/i;
|
|
33
|
+
|
|
34
|
+
const X = (p) => +(6 + (Math.max(0, Math.min(100, p)) * (W - 12)) / 100).toFixed(1);
|
|
35
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
36
|
+
const f1 = (n) => (+n).toFixed(1);
|
|
37
|
+
const clamp = (v, a, b) => Math.max(a, Math.min(b, v));
|
|
38
|
+
const isBuild = (p) => /^build$/i.test(p.key || '') || /\bbuild\b/i.test(p.name || '');
|
|
39
|
+
const isDiscover = (p) => /^discover/i.test(p.key || '') || /\bdiscover/i.test(p.name || '');
|
|
40
|
+
const isDeliver = (p) => /^deliver/i.test(p.key || '') || /\bdeliver/i.test(p.name || '');
|
|
41
|
+
|
|
42
|
+
/** The release milestone among the line's ◇s: the first item (in date order) named for a launch. → { x, item, at } | null */
|
|
43
|
+
export function releaseOf(ms) {
|
|
44
|
+
for (const [at, m] of (ms || []).entries()) for (const it of m.items || []) if (RELEASE_RE.test(it.name || '')) return { x: m.x, item: it, at };
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The mission's model from the stage line's (lineOf). */
|
|
49
|
+
export function missionOf(L) {
|
|
50
|
+
if (!L) return null;
|
|
51
|
+
const finished = !!L.finished, hold = !!(L.chip && L.chip.pause), empty = !!L.empty;
|
|
52
|
+
const now = (L.parts || []).find((p) => p.cls === 'now');
|
|
53
|
+
const late = !hold && !finished && (!!L.over || (L.ms || []).some((m) => m.late && !m.done && now && m.x >= now.l - 0.5 && m.x <= now.l + now.w + 0.5));
|
|
54
|
+
const parts = (L.parts || []).map((p) => ({ key: p.key, name: p.name, l: p.l, w: p.w, dash: !!p.dash,
|
|
55
|
+
cls: finished || p.cls === 'done' ? 'dn' : p.cls === 'now' ? (hold ? 'hold' : late ? 'late' : 'nw') : 'q' }));
|
|
56
|
+
// where it is: Today's place on the line; past every date when it is done, at the start when the work has not begun
|
|
57
|
+
const t = finished ? 101 : L.today != null ? L.today : L.ended ? 101 : 0;
|
|
58
|
+
const ms = empty ? [] : (L.ms || []);
|
|
59
|
+
const rel = releaseOf(ms);
|
|
60
|
+
const endM = ms.find((m) => m.end) || null;
|
|
61
|
+
const evalItem = endM && endM.items && endM.items[0] && !(rel && rel.item === endM.items[0]) ? endM.items[0] : null;
|
|
62
|
+
// the planet's time: the release milestone, else the end of Deliver, else the end of the line
|
|
63
|
+
const del = parts.find(isDeliver);
|
|
64
|
+
const rx = rel ? rel.x : del ? del.l + del.w : 100;
|
|
65
|
+
// the build: the first half of Build, then lift-off; with no Build, it lifts off where the stage the release falls in starts
|
|
66
|
+
const bp = parts.find(isBuild);
|
|
67
|
+
let bA, lift;
|
|
68
|
+
if (bp) { bA = bp.l; lift = bp.l + bp.w / 2; }
|
|
69
|
+
else {
|
|
70
|
+
const i = parts.reduce((k, p, j) => (p.l <= rx + 0.01 ? j : k), -1);
|
|
71
|
+
lift = i >= 0 ? parts[i].l : rx;
|
|
72
|
+
bA = i > 0 ? parts[i - 1].l : 0;
|
|
73
|
+
}
|
|
74
|
+
if (lift <= bA) bA = Math.max(0, lift - 1);
|
|
75
|
+
// the stages say what happened, the dates only how far it is: it never flies before Build runs, nor lands before the release is done
|
|
76
|
+
// (with no Build: built through the stage before the release's, lifted off once the release's stage runs)
|
|
77
|
+
const ri = bp ? -1 : parts.reduce((k, p, j) => (p.l <= rx + 0.01 ? j : k), -1);
|
|
78
|
+
const builtIn = bp || (ri > 0 ? parts[ri - 1] : null), liftIn = bp ? null : ri >= 0 ? parts[ri] : null;
|
|
79
|
+
const mustFly = bp ? bp.cls === 'dn' : !!(liftIn && liftIn.cls !== 'q');
|
|
80
|
+
const landed = finished || (rel ? !!rel.item.done : del ? del.cls === 'dn' : false);
|
|
81
|
+
let phase, frac = 0, fly = 0;
|
|
82
|
+
if (landed) { phase = 'landed'; fly = 1; }
|
|
83
|
+
else if (!mustFly && builtIn && builtIn.cls === 'q') phase = 'pad';
|
|
84
|
+
else if (!mustFly && t < lift) { frac = t <= bA ? 0 : clamp((t - bA) / (lift - bA), 0, 1); phase = frac > 0 ? 'build' : 'pad'; }
|
|
85
|
+
else if (!mustFly && liftIn && liftIn.cls === 'q') { frac = 1; phase = 'build'; }
|
|
86
|
+
else { phase = 'fly'; fly = clamp((t - lift) / Math.max(0.01, rx - lift), 0.05, 0.95); }
|
|
87
|
+
const disc = parts.find(isDiscover);
|
|
88
|
+
const found = finished || !disc || disc.cls === 'dn';
|
|
89
|
+
const heard = finished || !!(evalItem && evalItem.done);
|
|
90
|
+
// the small flags: every ◇ but the release and the last one (a counted ◇ keeps its other milestones)
|
|
91
|
+
const flags = [];
|
|
92
|
+
ms.forEach((m) => {
|
|
93
|
+
if (m.end) return;
|
|
94
|
+
const items = (m.items || []).filter((it) => !rel || it !== rel.item);
|
|
95
|
+
if (!items.length) return;
|
|
96
|
+
flags.push({ x: m.x, n: items.length, items, name: items.length > 1 ? items.length + ' milestones' : items[0].name, date: items.length > 1 ? '' : items[0].date,
|
|
97
|
+
done: items.every((it) => it.done), late: items.some((it) => it.late) });
|
|
98
|
+
});
|
|
99
|
+
return { empty, hold, late, finished, t, today: !empty && !heard && L.today != null ? L.today : null, parts, flags, found, phase, frac, fly, landed, heard,
|
|
100
|
+
listening: landed && !heard, pad: bA, lift, rx,
|
|
101
|
+
planet: rel ? { id: rel.item.id || '', name: rel.item.name, date: rel.item.date || '', done: !!rel.item.done, late: !!rel.item.late } : null,
|
|
102
|
+
dish: evalItem ? { id: evalItem.id || '', name: evalItem.name, date: evalItem.date || '', done: !!evalItem.done, late: !!evalItem.late } : null };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** The presses' centres, in the picture's units: the flags, the planet and the dish. → [{ key, x, y }] */
|
|
106
|
+
export function pointsOf(M) {
|
|
107
|
+
if (!M) return [];
|
|
108
|
+
const out = M.flags.map((f, i) => ({ key: 'f' + i, x: X(f.x) + 3, y: GY - 4 }));
|
|
109
|
+
if (M.planet) out.push({ key: 'planet', x: PX, y: PY });
|
|
110
|
+
if (M.dish) out.push({ key: 'dish', x: DX - 2, y: GY - 12 });
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
/** The keys of the points closer than gap to another point. */
|
|
114
|
+
export function crowded(points, gap = NEAR) {
|
|
115
|
+
const out = new Set();
|
|
116
|
+
for (let i = 0; i < points.length; i++) for (let j = i + 1; j < points.length; j++) {
|
|
117
|
+
if (Math.hypot(points[i].x - points[j].x, points[i].y - points[j].y) < gap) { out.add(points[i].key); out.add(points[j].key); }
|
|
118
|
+
}
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const rocketBody = (fin = 'mi-fin') => '<path d="M-5 0 L-5 -18 Q-5 -26 0 -31 Q5 -26 5 -18 L5 0Z" class="mi-rb mi-ln" stroke-width="1.1" stroke-linejoin="round"/>'
|
|
123
|
+
+ `<path d="M-5 -7 L-10 1 L-5 0Z M5 -7 L10 1 L5 0Z" class="${fin} mi-ln" stroke-width=".9" stroke-linejoin="round"/>`
|
|
124
|
+
+ '<circle cx="0" cy="-17" r="2.4" class="mi-win mi-ln" stroke-width=".8"/>';
|
|
125
|
+
const ghostBody = () => '<path d="M-5 0 L-5 -18 Q-5 -26 0 -31 Q5 -26 5 -18 L5 0Z" fill="none" class="mi-gh" stroke-width="1.1" stroke-dasharray="2 2" stroke-linejoin="round"/>'
|
|
126
|
+
+ '<path d="M-5 -7 L-10 1 L-5 0Z M5 -7 L10 1 L5 0Z" fill="none" class="mi-gh" stroke-width=".9" stroke-dasharray="2 2" stroke-linejoin="round"/>'
|
|
127
|
+
+ '<circle cx="0" cy="-17" r="2.4" fill="none" class="mi-gh" stroke-width=".8" stroke-dasharray="2 2"/>';
|
|
128
|
+
|
|
129
|
+
let seq = 0;
|
|
130
|
+
/** The press around one drawn milestone: a 44 px square, the words for a reader, the task it opens. */
|
|
131
|
+
function press(inner, it, x, y, o, key, hold) {
|
|
132
|
+
if (!o.tap || !it || !it.id || hold.has(key)) return `<g aria-hidden="true">${inner}</g>`;
|
|
133
|
+
const words = it.name + (it.date ? ', ' + it.date : '') + (it.late ? ', late' : it.done ? ', done' : '');
|
|
134
|
+
return `<g class="mi-ms" role="button" tabindex="0" data-mi-ms="${esc(it.id)}" data-mi-tip="${esc(it.name)}" data-mi-date="${esc(it.date || '')}" data-mi-x="${f1((x / W) * 100)}" aria-label="${esc('Milestone ' + words + '. Open its task')}">`
|
|
135
|
+
+ `<rect x="${f1(x - HIT / 2)}" y="${f1(y - HIT / 2)}" width="${HIT}" height="${HIT}" fill="transparent"/>${inner}</g>`;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** The SVG of the mission. */
|
|
139
|
+
export function missionSvg(M, o = {}) {
|
|
140
|
+
if (!M) return '';
|
|
141
|
+
const id = 'mi' + (++seq).toString(36);
|
|
142
|
+
const crowd = crowded(pointsOf(M));
|
|
143
|
+
let s = `<defs><linearGradient id="${id}k" x1="0" y1="0" x2="0" y2="1"><stop offset="0" class="mi-s0"/><stop offset="1" class="mi-s1"/></linearGradient>`
|
|
144
|
+
+ `<linearGradient id="${id}x" x1="0" x2="1"><stop offset="0" class="mi-t0"/><stop offset="1" class="mi-t1"/></linearGradient></defs>`;
|
|
145
|
+
s += `<rect x="0" y="0" width="${W}" height="${H}" rx="14" fill="url(#${id}k)"/>`;
|
|
146
|
+
// the stars
|
|
147
|
+
[[30, 12, 1], [84, 26, 0.8], [124, 9, 1.2], [160, 30, 0.9], [250, 12, 1], [292, 30, 0.8], [W - 26, 8, 1]].forEach(([x, y, r], k) => {
|
|
148
|
+
s += `<circle class="mi-tw mi-star mi-d${k}" transform-origin="${x} ${y}" cx="${x}" cy="${y}" r="${r}"/>`;
|
|
149
|
+
});
|
|
150
|
+
// the target planet
|
|
151
|
+
const planet = `<g class="${M.found ? '' : 'mi-seek'}" transform-origin="${PX} ${PY}">`
|
|
152
|
+
+ `<circle cx="${PX}" cy="${PY}" r="12" class="${M.found ? 'mi-pl' : 'mi-pq'}"${M.found ? '' : ' stroke-dasharray="3 3"'} stroke-width="1.4"/>`
|
|
153
|
+
+ (M.found ? `<ellipse cx="${PX}" cy="${PY}" rx="18" ry="4.5" fill="none" class="mi-ring" stroke-width="1.6" transform="rotate(-18 ${PX} ${PY})"/>`
|
|
154
|
+
+ `<circle cx="${PX - 4}" cy="${PY - 3}" r="2.6" class="mi-spot"/><circle cx="${PX + 4}" cy="${PY + 4}" r="1.8" class="mi-spot"/>`
|
|
155
|
+
: `<text x="${PX}" y="${PY + 4}" text-anchor="middle" class="mi-qm">?</text>`) + '</g>';
|
|
156
|
+
s += press(planet, M.planet, PX, PY, o, 'planet', crowd);
|
|
157
|
+
// the ground and the stage strip
|
|
158
|
+
s += `<path d="M0 ${H} L0 ${GY - 2} Q60 ${GY - 5} 130 ${GY - 2} T${W} ${GY - 3} L${W} ${H}Z" class="mi-gr"/>`;
|
|
159
|
+
for (const p of M.parts) {
|
|
160
|
+
const x = X(p.l), w = Math.max(X(p.l + p.w) - x - 2, 3);
|
|
161
|
+
s += p.dash || M.empty ? `<rect x="${f1(x + 1)}" y="${GY + 4}" width="${f1(w)}" height="6" rx="3" fill="none" class="mi-dsh ${p.cls}" stroke-dasharray="2 2"/>`
|
|
162
|
+
: `<rect x="${f1(x + 1)}" y="${GY + 4}" width="${f1(w)}" height="6" rx="3" class="mi-st ${p.cls}"/>`;
|
|
163
|
+
}
|
|
164
|
+
// the small flags
|
|
165
|
+
M.flags.forEach((f, i) => {
|
|
166
|
+
const x = X(f.x);
|
|
167
|
+
const inner = `<rect x="${f1(x - 0.7)}" y="${GY - 8}" width="1.4" height="12" class="mi-pole"/><path d="M${f1(x + 0.7)} ${GY - 8} L${f1(x + 7)} ${GY - 6} L${f1(x + 0.7)} ${GY - 4}Z" class="mi-fl ${f.late ? 'late' : f.done ? 'dn' : 'q'}"/>`;
|
|
168
|
+
s += press(inner, f.n === 1 ? f.items[0] : null, x + 3, GY - 4, o, 'f' + i, crowd);
|
|
169
|
+
});
|
|
170
|
+
// Discover: the telescope looks for the planet
|
|
171
|
+
const still = M.hold || M.empty;
|
|
172
|
+
const seeking = !M.found && !M.hold;
|
|
173
|
+
const ang = (Math.atan2(PY - (GY - 14), PX - TX) * 180) / Math.PI;
|
|
174
|
+
s += `<g aria-hidden="true"><path d="M${TX - 5} ${GY} L${TX} ${GY - 10} L${TX + 5} ${GY} M${TX} ${GY - 10} L${TX} ${GY}" class="mi-ln" stroke-width="1.1" fill="none" stroke-linecap="round"/>`
|
|
175
|
+
+ `<g class="${seeking ? 'mi-scan' : ''}" transform-origin="${TX} ${GY - 12}"><g transform="translate(${TX} ${GY - 12}) rotate(${ang.toFixed(1)})">`
|
|
176
|
+
+ '<rect x="-4" y="-2.6" width="15" height="5.2" rx="2" class="mi-wh mi-ln" stroke-width="1.1"/><rect x="10" y="-3.4" width="3" height="6.8" rx="1" class="mi-lens mi-ln" stroke-width=".9"/></g></g></g>';
|
|
177
|
+
if (seeking && !M.empty) s += `<line class="mi-beam" x1="${TX + 10}" y1="${GY - 19}" x2="${PX - 12}" y2="${PY + 4}" stroke-width="1.2" stroke-dasharray="2 5" aria-hidden="true"/>`;
|
|
178
|
+
// Plan to Build: the pad at the start of Build; the rocket is a blueprint, then built from the bottom up; past Build 50% it flies
|
|
179
|
+
const bx = X(M.pad) + 4;
|
|
180
|
+
const fin = M.late ? 'mi-fin late' : 'mi-fin';
|
|
181
|
+
s += `<g aria-hidden="true"><rect x="${f1(bx - 12)}" y="${GY - 1}" width="24" height="3" rx="1.5" class="mi-pad"/>`
|
|
182
|
+
+ `<path d="M${f1(bx - 14)} ${GY} L${f1(bx - 14)} ${GY - 34} M${f1(bx - 14)} ${GY - 26} L${f1(bx - 6)} ${GY - 26} M${f1(bx - 14)} ${GY - 14} L${f1(bx - 6)} ${GY - 14}" fill="none" class="mi-padl" stroke-width="1.2"/></g>`;
|
|
183
|
+
if (M.phase === 'pad' || M.phase === 'build') {
|
|
184
|
+
let b = `<g transform="translate(${f1(bx)} ${GY - 1})" role="img" aria-label="${esc(M.phase === 'pad' ? 'The rocket, a blueprint on the pad' : 'The rocket, ' + Math.round(M.frac * 100) + '% built')}">`;
|
|
185
|
+
b += `<g opacity="${M.frac === 0 ? 0.5 : 0.35}">${ghostBody()}</g>`;
|
|
186
|
+
if (M.frac > 0) {
|
|
187
|
+
const h = 34 * M.frac;
|
|
188
|
+
b += `<clipPath id="${id}b"><rect x="-12" y="${f1(2 - h)}" width="24" height="${f1(h)}"/></clipPath><g clip-path="url(#${id}b)">${rocketBody(fin)}</g>`;
|
|
189
|
+
if (!still) for (let k = 0; k < 3; k++) b += `<circle class="mi-spark mi-k${k}" cx="${-6 + k * 6}" cy="${f1(2 - h)}" r="1.1"/>`;
|
|
190
|
+
}
|
|
191
|
+
s += b + '</g>';
|
|
192
|
+
} else {
|
|
193
|
+
s += `<g class="mi-puff" aria-hidden="true"><circle cx="${f1(bx - 6)}" cy="${GY - 3}" r="3.5" class="mi-smoke"/><circle cx="${f1(bx + 5)}" cy="${GY - 4}" r="4" class="mi-smoke"/></g>`;
|
|
194
|
+
const p0 = [bx, GY - 20], c1 = [bx + 6, 6], p1 = [PX - 10, PY + 8];
|
|
195
|
+
const bz = (u) => [(1 - u) ** 2 * p0[0] + 2 * (1 - u) * u * c1[0] + u * u * p1[0], (1 - u) ** 2 * p0[1] + 2 * (1 - u) * u * c1[1] + u * u * p1[1]];
|
|
196
|
+
const all = Array.from({ length: 41 }, (_, i) => bz(i / 40)), pts = Array.from({ length: 41 }, (_, i) => bz((i / 40) * M.fly));
|
|
197
|
+
let len = 0; for (let i = 0; i < 40; i++) len += Math.hypot(pts[i + 1][0] - pts[i][0], pts[i + 1][1] - pts[i][1]);
|
|
198
|
+
const d = (P) => 'M' + P.map(([x, y]) => f1(x) + ' ' + f1(y)).join(' L');
|
|
199
|
+
if (!M.landed) s += `<path d="${d(all)}" fill="none" class="mi-path" stroke-width="1.4" stroke-dasharray="1.5 5" aria-hidden="true"/>`;
|
|
200
|
+
s += `<path class="mi-vn" d="${d(pts)}" fill="none" stroke="url(#${id}x)" stroke-width="${M.landed ? 2.4 : 3}" stroke-linecap="round" opacity="${M.landed ? 0.45 : 1}" pathLength="100" aria-hidden="true"/>`;
|
|
201
|
+
let rx, ry, a, flame = '';
|
|
202
|
+
if (M.landed) { rx = PX - 9; ry = PY - 9; a = -25; }
|
|
203
|
+
else {
|
|
204
|
+
[rx, ry] = pts[40];
|
|
205
|
+
a = (Math.atan2(pts[40][1] - pts[38][1], pts[40][0] - pts[38][0]) * 180) / Math.PI + 90;
|
|
206
|
+
if (!M.hold) flame = '<g class="mi-flame"><path d="M-3.4 1 Q0 12 3.4 1Z" class="mi-fo"/><path d="M-1.8 1 Q0 7 1.8 1Z" class="mi-fy"/></g>';
|
|
207
|
+
}
|
|
208
|
+
s += `<g class="${M.landed ? '' : 'mi-rk'}" role="img" aria-label="${M.landed ? 'Landed at the release' : 'Flying to the release'}"><g transform="translate(${f1(rx)} ${f1(ry)}) rotate(${a.toFixed(1)}) scale(.75)">${flame}${rocketBody(fin)}</g></g>`;
|
|
209
|
+
if (M.landed) s += `<g aria-hidden="true"><rect x="${PX + 5}" y="${PY - 24}" width="1.4" height="13" class="mi-pole"/><path class="mi-flag" transform-origin="${PX + 6} ${PY - 23}" d="M${PX + 6.4} ${PY - 24} L${PX + 15} ${PY - 21} L${PX + 6.4} ${PY - 18}Z"/></g>`;
|
|
210
|
+
}
|
|
211
|
+
// Monitor: the dish listens; the last milestone lights it green
|
|
212
|
+
let dish = `<path d="M${DX} ${GY} L${DX} ${GY - 10}" class="mi-ln" stroke-width="1.2"/>`
|
|
213
|
+
+ `<path d="M${DX - 9} ${GY - 18} Q${DX - 2} ${GY - 6} ${DX + 6} ${GY - 10}" class="mi-wh mi-ln" stroke-width="1.1"/>`
|
|
214
|
+
+ `<line x1="${DX - 2}" y1="${GY - 12}" x2="${DX - 7}" y2="${GY - 20}" class="mi-ln" stroke-width="1"/>`
|
|
215
|
+
+ `<circle cx="${DX - 7}" cy="${GY - 21}" r="1.8" class="mi-lamp ${M.heard ? 'on' : M.listening ? 'ls' : ''}"/>`;
|
|
216
|
+
if (M.listening && !M.hold) for (let k = 0; k < 3; k++) dish += `<path class="mi-wave mi-k${k}" d="M${DX - 14 - k * 7} ${GY - 26 - k * 3} q-4 4 0 8" fill="none" stroke-width="1.3" stroke-linecap="round"/>`;
|
|
217
|
+
s += press(dish, M.dish, DX - 2, GY - 12, o, 'dish', crowd);
|
|
218
|
+
// Today
|
|
219
|
+
if (M.today != null) {
|
|
220
|
+
const xt = X(M.today);
|
|
221
|
+
s += `<g role="img" aria-label="Today"><circle class="mi-glow" cx="${xt}" cy="${GY + 7}" r="5"/><line x1="${xt}" y1="${GY + 1}" x2="${xt}" y2="${GY + 13}" class="mi-td" stroke-width="2" stroke-linecap="round"/></g>`;
|
|
222
|
+
}
|
|
223
|
+
if (M.hold) {
|
|
224
|
+
const xt = X(M.t > 100 ? 100 : M.t);
|
|
225
|
+
s += `<g transform="translate(${f1(xt + 6)} ${GY - 12})" class="mi-pz" role="img" aria-label="On hold"><rect x="0" y="0" width="2" height="7" rx="1"/><rect x="4" y="0" width="2" height="7" rx="1"/></g>`;
|
|
226
|
+
}
|
|
227
|
+
return `<svg class="mi-svg" viewBox="0 0 ${W} ${H}" width="100%" preserveAspectRatio="xMidYMid meet" role="group" aria-label="${esc(o.label || 'The initiative as a mission: its stages and milestones')}">${s}</svg>`;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** The current stage's name under the strip (the desktop's two columns): its place, as a % of the picture. → { name, x, late } | null */
|
|
231
|
+
export function nowName(M) {
|
|
232
|
+
const p = M && M.parts.find((q) => q.cls === 'nw' || q.cls === 'late' || q.cls === 'hold');
|
|
233
|
+
return p ? { name: p.name, x: +((X(p.l + p.w / 2) / W) * 100).toFixed(2), late: p.cls === 'late' } : null;
|
|
234
|
+
}
|
|
@@ -82,7 +82,7 @@ PG.goalsFrom((name) => (M ? M.initiatives.list.rows.filter((r) => !M.board.all |
|
|
|
82
82
|
const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
83
83
|
const I = {
|
|
84
84
|
x: 'M6 6l12 12M18 6L6 18', expand: 'M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7', more: 'M5 12h.01M12 12h.01M19 12h.01', go: 'M5 12h14M13 6l6 6-6 6', next: 'M9 6l6 6-6 6',
|
|
85
|
-
ext: 'M14 4h6v6M20 4l-9 9M10 6H5v13h13v-5', refresh: 'M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7', cal: 'M4 6h16v14H4zM4 10h16M9 3v4M15 3v4', jira: '
|
|
85
|
+
ext: 'M14 4h6v6M20 4l-9 9M10 6H5v13h13v-5', refresh: 'M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7', cal: 'M4 6h16v14H4zM4 10h16M9 3v4M15 3v4', jira: 'M4 7h16v3a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4z',
|
|
86
86
|
flag: 'M5 21V4M5 4h11l-2 4 2 4H5', note: 'M4 5h16v11h-9l-5 4v-4H4z', spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z',
|
|
87
87
|
doc: 'M6 3h9l4 4v14H6zM14 3v5h5', link: 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1', chev: 'M7 10l5 5 5-5', chevUp: 'M7 14l5-5 5 5',
|
|
88
88
|
move: 'M4 12h12M12 6l6 6-6 6M20 5v14', hold: 'M9 5v14M15 5v14', archive: 'M4 5h16v4H4zM6 9v10h12V9M10 13h4',
|
|
@@ -100,7 +100,7 @@ const err = () => (S.error ? `<p class="wl-err" role="alert">${esc(S.error)}</p>
|
|
|
100
100
|
function viewAbout() {
|
|
101
101
|
const a = S.about;
|
|
102
102
|
const f = (k, text, hint, max) => `<label>${text}<input data-f="${k}" maxlength="${max}" value="${esc(a[k])}" placeholder="${esc(hint)}" autocomplete="off"></label>`;
|
|
103
|
-
return `<div class="wl-ad">${adlerScene('morning', 'needs-you', { label: 'Adler says hello' })}</div>${adPrefs()['adler.amount'] === 'off' ? '' : '<p class="wl-hi">Hi, I’m Adler. I do the boring bits, so you get the calls only you can make.</p>'}<h1 id="wlH" tabindex="-1">Welcome to PMOS</h1><p class="wl-lede">Tell PMOS who you are, so your Briefing knows what matters to you. Every field is optional, and you can change them later in the console's Settings.</p>
|
|
103
|
+
return `<div class="wl-ad">${adlerScene('morning', 'needs-you', { label: 'Adler says hello', dress: true })}</div>${adPrefs()['adler.amount'] === 'off' ? '' : '<p class="wl-hi">Hi, I’m Adler. I do the boring bits, so you get the calls only you can make.</p>'}<h1 id="wlH" tabindex="-1">Welcome to PMOS</h1><p class="wl-lede">Tell PMOS who you are, so your Briefing knows what matters to you. Every field is optional, and you can change them later in the console's Settings.</p>
|
|
104
104
|
<div class="wl-f">${f('name', 'Your name', 'For example: Dana', 40)}${f('role', 'Your role', 'For example: Senior PM, Payments', 80)}${f('work', 'What you do', 'In one line, for example: I run checkout and the payment methods', 200)}
|
|
105
105
|
<label>Your job description<textarea data-f="duties" maxlength="1000" placeholder="What you own, decide and deliver. Paste it from your job description if you have one.">${esc(a.duties)}</textarea></label></div>${err()}`
|
|
106
106
|
+ foot('', btn('about', 'Continue', { busy: 'about', busyText: 'Saving' }));
|
|
@@ -116,7 +116,7 @@ function viewSources() {
|
|
|
116
116
|
const rows = [`<li class="wl-row"><span class="wl-ic">${I.folder}</span><span><b>${esc(f.name || 'This folder')}</b><span class="path">${esc(f.root)}</span></span><span class="chip">this folder</span></li>`]
|
|
117
117
|
.concat(S.added.map((a) => `<li class="wl-row"><span class="wl-ic">${I.folder}</span><span><b>${esc(a.name)}</b><span class="path">${esc(a.root)}</span></span><span></span></li>`)).join('');
|
|
118
118
|
if (S.busy === 'scan') {
|
|
119
|
-
return `<div class="wl-ad">${adlerScene('think', 'thinking', { label: false })}</div><h1 id="wlH" tabindex="-1">Reading ${esc(f.name || 'your folder')}</h1><p class="wl-lede">A large folder can take a minute or two. The rest of PMOS keeps working.</p>
|
|
119
|
+
return `<div class="wl-ad">${adlerScene('think', 'thinking', { label: false, dress: true })}</div><h1 id="wlH" tabindex="-1">Reading ${esc(f.name || 'your folder')}</h1><p class="wl-lede">A large folder can take a minute or two. The rest of PMOS keeps working.</p>
|
|
120
120
|
<div class="wl-scan" role="status"><div>${spin('Starting the tools you ticked, then reading the folder')}</div></div>`;
|
|
121
121
|
}
|
|
122
122
|
return `<h1 id="wlH" tabindex="-1">Where does your work live?</h1><p class="wl-lede">PMOS reads your folders and the tools you tick, then shows you your initiatives, your documents and what needs you first.</p>
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/* pm/small-vw.js — the small Viewers in shell A (feedback batch 18 item 2-C; canvas In development OvA8People): a stakeholder, the one
|
|
2
|
+
* stakeholder form Home and the Board share, and a routine. Summary first; no ids, crons or file paths in the body.
|
|
3
|
+
*
|
|
4
|
+
* openPersonVw(p, ctx) p { name, role, note, at }. Title the name, sub the initiative; the summary is the role (no tone), the note, the day
|
|
5
|
+
* it was added. ⋯: Change the role or note, then Remove from this initiative (danger, last; Undo adds it back).
|
|
6
|
+
* openPersonForm(ctx, p?) Add a stakeholder (no p) or change one (p). ✓ in the header saves, ← cancels. The fields keep their ids (hpN, hpR,
|
|
7
|
+
* hpT). A changed name adds the new name, then removes the old one.
|
|
8
|
+
* ctx { VW, pmPost, toast(text, undo?), ws, ini, iniTitle, saved() after a write, back() what ← goes to when nothing is behind }
|
|
9
|
+
* openRoutineVw(s, { VW, now? }) "Next run Monday 09:00", the repeat in words (never the cron) and what it runs said once, when it last ran. There is no
|
|
10
|
+
* primary: a schedule's run keeps no pointer to its result (the metrics review opens its own Viewer, home-app.js).
|
|
11
|
+
* repeatsOf(s) · nextLine(s, now) — pure, for the tests.
|
|
12
|
+
* Writes go to POST /api/home-desk/stakeholder only (the route the old Viewers used). */
|
|
13
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
14
|
+
const I = {
|
|
15
|
+
person: 'M12 4a4 4 0 1 0 0 8a4 4 0 1 0 0-8M4 21c0-4 3.6-6.5 8-6.5s8 2.5 8 6.5',
|
|
16
|
+
routine: 'M4 11a8 8 0 0 1 14-5.3M20 4v5h-5M20 13a8 8 0 0 1-14 5.3M4 20v-5h5',
|
|
17
|
+
check: 'M5 12.5l4.5 4.5L19 7.5',
|
|
18
|
+
pen: 'M4 20h4L19 9l-4-4L4 16zM14 6l4 4',
|
|
19
|
+
x: 'M6 6l12 12M18 6L6 18',
|
|
20
|
+
};
|
|
21
|
+
const DAYS = { Sun: 'Sunday', Mon: 'Monday', Tue: 'Tuesday', Wed: 'Wednesday', Thu: 'Thursday', Fri: 'Friday', Sat: 'Saturday' };
|
|
22
|
+
const WEEK = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
23
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
24
|
+
const hm = (d) => String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0');
|
|
25
|
+
const dayMon = (d) => d.getDate() + ' ' + MON[d.getMonth()];
|
|
26
|
+
const words = (s) => { const t = String(s || '').replace(/[-_]+/g, ' ').trim(); return t ? t.charAt(0).toUpperCase() + t.slice(1) : ''; };
|
|
27
|
+
|
|
28
|
+
/* ── the stakeholder ── */
|
|
29
|
+
export function openPersonVw(p, ctx, opt = {}) {
|
|
30
|
+
const added = p.at && !isNaN(new Date(p.at)) ? 'Added ' + dayMon(new Date(p.at)) : '';
|
|
31
|
+
const body = ctx.VW.open({ id: 'person:' + p.name, kind: 'Stakeholder', title: p.name, keep: !!opt.keep, sub: ctx.iniTitle || '', icon: I.person,
|
|
32
|
+
more: [
|
|
33
|
+
{ label: 'Change the role or note', icon: I.pen, on: () => openPersonForm(ctx, p) },
|
|
34
|
+
{ sep: true },
|
|
35
|
+
{ label: 'Remove from this initiative', icon: I.x, danger: true, on: () => remove() },
|
|
36
|
+
],
|
|
37
|
+
render: (b) => {
|
|
38
|
+
b.innerHTML = ctx.VW.czSummary({ line: p.role || '', text: p.note || '', meta: added })
|
|
39
|
+
|| `<p class="czs-quiet">${esc(added || 'No role or note yet.')}</p>`;
|
|
40
|
+
} });
|
|
41
|
+
async function remove() {
|
|
42
|
+
const r = await ctx.pmPost('/api/home-desk/stakeholder', { ws: ctx.ws, initiative: ctx.ini, name: p.name, remove: true }).catch(() => null);
|
|
43
|
+
if (!(r && r.ok)) { ctx.toast((r && r.error) || 'Not removed.'); return; }
|
|
44
|
+
ctx.toast('Removed ' + p.name + '.', async () => { await ctx.pmPost('/api/home-desk/stakeholder', { ws: ctx.ws, initiative: ctx.ini, name: p.name, role: p.role || '', note: p.note || '' }).catch(() => null); if (ctx.saved) await ctx.saved(); });
|
|
45
|
+
if (ctx.back) ctx.back(); else ctx.VW.close();
|
|
46
|
+
if (ctx.saved) await ctx.saved();
|
|
47
|
+
}
|
|
48
|
+
return body;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** One form for Add a stakeholder on Home and the Board (OvA8People): ✓ in the header saves, ← cancels. */
|
|
52
|
+
export function openPersonForm(ctx, p) {
|
|
53
|
+
const edit = !!p;
|
|
54
|
+
let busy = false;
|
|
55
|
+
const field = (id, label, val, ph, max) => `<label class="czf-l"><span>${label}</span><input id="${id}" maxlength="${max}" autocomplete="off"${ph ? ` placeholder="${esc(ph)}"` : ''} value="${esc(val || '')}"></label>`;
|
|
56
|
+
if (ctx.VW.drill) ctx.VW.drill(); // ← comes back to what opened the form (the stakeholder, or the initiative)
|
|
57
|
+
const body = ctx.VW.open({ id: 'person:' + (edit ? 'edit:' + p.name : 'new'), kind: 'Stakeholder', title: edit ? 'Change ' + p.name : 'Add a stakeholder', sub: ctx.iniTitle || '', icon: I.person, back: true,
|
|
58
|
+
presses: [{ act: 'save', label: edit ? 'Save the stakeholder' : 'Add the stakeholder', icon: I.check, solid: true, blue: true }],
|
|
59
|
+
onPress: (a) => { if (a === 'save') save(); },
|
|
60
|
+
render: (b) => {
|
|
61
|
+
b.innerHTML = `<form class="czf" data-czf-person novalidate>${field('hpN', 'Name', edit ? p.name : '', '', 80)}${field('hpR', 'Role', edit ? p.role : '', 'For example: Head of Sales', 80)}`
|
|
62
|
+
+ `${field('hpT', 'What they care about', edit ? p.note : '', 'One line', 200)}<p class="czf-err" id="hpM" role="status"></p><button type="submit" hidden></button></form>`;
|
|
63
|
+
} });
|
|
64
|
+
const $ = (s) => body.querySelector(s);
|
|
65
|
+
body.addEventListener('submit', (e) => { e.preventDefault(); save(); });
|
|
66
|
+
setTimeout(() => { const i = $('#hpN'); if (i) i.focus(); }, 0);
|
|
67
|
+
async function save() {
|
|
68
|
+
if (busy) return;
|
|
69
|
+
const name = $('#hpN').value.trim(), m = $('#hpM');
|
|
70
|
+
if (!name) { m.textContent = 'Name the person.'; $('#hpN').focus(); return; }
|
|
71
|
+
busy = true;
|
|
72
|
+
const post = (x) => ctx.pmPost('/api/home-desk/stakeholder', { ws: ctx.ws, initiative: ctx.ini, ...x }).catch(() => null);
|
|
73
|
+
const role = $('#hpR').value.trim(), note = $('#hpT').value.trim();
|
|
74
|
+
const r = await post({ name, role, note });
|
|
75
|
+
if (r && r.ok && edit && name.toLowerCase() !== p.name.toLowerCase()) await post({ name: p.name, remove: true });
|
|
76
|
+
busy = false;
|
|
77
|
+
if (!(r && r.ok)) { m.textContent = (r && r.error) || (edit ? 'Not saved.' : 'Not added.'); return; }
|
|
78
|
+
ctx.toast(edit ? 'Saved.' : 'Added ' + name + '.');
|
|
79
|
+
// back to what opened the form first, then the page reads again (a read while the form shows would draw under its header)
|
|
80
|
+
if (edit) { ctx.VW.back(); openPersonVw({ ...p, name, role, note }, ctx, { keep: true }); } // the stakeholder again, as saved
|
|
81
|
+
else if (ctx.back) ctx.back(); else ctx.VW.close();
|
|
82
|
+
if (ctx.saved) await ctx.saved();
|
|
83
|
+
}
|
|
84
|
+
return body;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* ── the routine ── */
|
|
88
|
+
/** The repeat in words, from the schedule's own fields (lib/schedule-logic.js); never the cron. '' when it names none. */
|
|
89
|
+
export function repeatsOf(s) {
|
|
90
|
+
const t = /^\d{1,2}:\d{2}$/.test(String(s.time || '')) ? String(s.time).padStart(5, '0') : '';
|
|
91
|
+
const at = t ? ' at ' + t : '';
|
|
92
|
+
const day = DAYS[s.day] || 'Monday';
|
|
93
|
+
if (s.cadence === 'daily') return 'Every day' + at;
|
|
94
|
+
if (s.cadence === 'weekly') return 'Every ' + day + at;
|
|
95
|
+
if (s.cadence === 'bi-weekly') return 'Every other ' + day + at;
|
|
96
|
+
if (s.cadence === 'monthly') return 'On day ' + (s.dayOfMonth || 1) + ' of each month' + at;
|
|
97
|
+
if (s.cadence === 'once') return 'Once' + (s.date ? ', on ' + dayMon(new Date(s.date + 'T00:00:00')) : '') + at;
|
|
98
|
+
const w = String(s.every || s.when || '');
|
|
99
|
+
return /[*/]|^\s*\d+(\s+\S+){4}\s*$/.test(w) ? '' : words(w); // a cron-like string is not words
|
|
100
|
+
}
|
|
101
|
+
/** "Next run Monday 09:00" (today, tomorrow and this week by the day's name; later by the date), "Off", or "Not scheduled". */
|
|
102
|
+
export function nextLine(s, now = Date.now()) {
|
|
103
|
+
if (s.enabled === false) return 'Off';
|
|
104
|
+
const n = s.next ? new Date(s.next) : null;
|
|
105
|
+
if (!n || isNaN(n)) return 'Not scheduled';
|
|
106
|
+
const a = new Date(now); a.setHours(0, 0, 0, 0);
|
|
107
|
+
const b = new Date(n); b.setHours(0, 0, 0, 0);
|
|
108
|
+
const d = Math.round((b - a) / 864e5);
|
|
109
|
+
return 'Next run ' + (d === 0 ? 'today' : d === 1 ? 'tomorrow' : d > 1 && d < 7 ? WEEK[n.getDay()] : WEEK[n.getDay()] + ' ' + dayMon(n)) + ' ' + hm(n);
|
|
110
|
+
}
|
|
111
|
+
const lastOf = (s) => {
|
|
112
|
+
if (!s.lastRun || isNaN(new Date(s.lastRun))) return '';
|
|
113
|
+
const d = new Date(s.lastRun), st = { ok: 'finished', fail: 'did not finish', started: 'started' }[s.lastStatus] || '';
|
|
114
|
+
return WEEK[d.getDay()].slice(0, 3) + ' ' + dayMon(d) + (st ? ' · ' + st : '');
|
|
115
|
+
};
|
|
116
|
+
export function openRoutineVw(s, o) {
|
|
117
|
+
const name = words(s.name || s.task || s.skill) || 'Routine';
|
|
118
|
+
const what = words(s.task || s.skill);
|
|
119
|
+
const rep = repeatsOf(s), line = nextLine(s, o.now), last = lastOf(s);
|
|
120
|
+
const text = s.enabled === false ? 'It is off: it does not run until it is turned on again.'
|
|
121
|
+
: (rep || 'On its schedule') + (what ? ', it runs ' + what + '.' : '.');
|
|
122
|
+
return o.VW.open({ id: 'routine:' + (s.id || s.name), kind: 'Routine', title: name, sub: 'Routine', icon: I.routine,
|
|
123
|
+
render: (b) => {
|
|
124
|
+
b.innerHTML = o.VW.czSummary({ line, tone: s.enabled === false || !s.next ? '' : 'ok', text })
|
|
125
|
+
// the repeat and what it runs are said in the summary once (say it once); the fold row keeps what the summary does not say
|
|
126
|
+
+ o.VW.czSections([last ? { id: 'last', title: 'Last ran', count: last } : null], { key: 'routine' });
|
|
127
|
+
} });
|
|
128
|
+
}
|
|
@@ -32,7 +32,7 @@ export const ICON = {
|
|
|
32
32
|
merge: 'M5 4v3a5 5 0 0 0 5 5h9M5 20v-3a5 5 0 0 1 5-5M16 9l3 3-3 3',
|
|
33
33
|
stay: 'M5 12l5 5 9-10',
|
|
34
34
|
x: 'M6 6l12 12M18 6L6 18', edit: 'M4 20h4L19 9l-4-4L4 16zM14 6l4 4', ok: 'M5 12.5l4.5 4.5L19 7.5',
|
|
35
|
-
swap: 'M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7', down: 'M7 10l5 5 5-5', jira: '
|
|
35
|
+
swap: 'M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7', down: 'M7 10l5 5 5-5', jira: 'M4 7h16v3a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4z', doc: 'M7 3h7l5 5v13H7zM14 3v5h5', task: 'M5 5h14v14H5z',
|
|
36
36
|
};
|
|
37
37
|
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
38
38
|
/** "3 tasks · 1 ticket · 1 doc": zero is silence. */
|
|
@@ -235,12 +235,12 @@ export function lineOf(r, o = {}) {
|
|
|
235
235
|
const clash = openHold && openHold.kind === 'open' && E && openHold.b > E ? md(openHold.b, t) : '';
|
|
236
236
|
const L = MS.filter((m) => !endTask || m.id !== endTask.id);
|
|
237
237
|
const reach = Math.max(1, Math.round(((D1 - D0) / DAY) * (NEAR / 100)));
|
|
238
|
-
const C = mergeClose(L.map((m) => ({ ...m })), reach).map((c) => ({ x: X(day(c.date)), n: c.n, items: c.items.map((m) => ({ id: m.id, name: m.name, date: md(m.d, t), done: m.done, late: m.late, ago: m.ago })),
|
|
238
|
+
const C = mergeClose(L.map((m) => ({ ...m })), reach).map((c) => ({ x: X(day(c.date)), n: c.n, items: c.items.map((m) => ({ id: m.id, name: m.name, date: md(m.d, t), done: m.done, late: m.late, ago: m.ago, left: !m.done && m.d >= t ? days(t, m.d) : 0 })),
|
|
239
239
|
name: c.n > 1 ? plural(c.n, 'milestone', 'milestones') : c.first.name, date: md(day(c.date), t), done: c.done, late: c.late, dash: !!draft }));
|
|
240
240
|
const ms = C.slice();
|
|
241
241
|
if (E && !draft) {
|
|
242
242
|
const ED = endTask ? endTask.d : E;
|
|
243
|
-
ms.push({ x: X(ED), n: 1, end: true, atEnd: +ED === +E, items: endTask ? [{ id: endTask.id, name: endTask.name, date: md(ED, t), done: endTask.done, late: endTask.late, ago: endTask.ago }] : [],
|
|
243
|
+
ms.push({ x: X(ED), n: 1, end: true, atEnd: +ED === +E, items: endTask ? [{ id: endTask.id, name: endTask.name, date: md(ED, t), done: endTask.done, late: endTask.late, ago: endTask.ago, left: !endTask.done && ED >= t ? days(t, ED) : 0 }] : [],
|
|
244
244
|
name: endTask ? endTask.name : '', date: md(ED, t), done: finished || !!(endTask && endTask.done), late: !finished && (over || !!clash || !!(endTask && endTask.late)) });
|
|
245
245
|
} else if (draft && E) ms.push({ x: X(E), n: 1, end: true, items: [], name: '', date: md(E, t), done: false, late: false, dash: true });
|
|
246
246
|
ms.sort((p, q) => p.x - q.x);
|
package/workspace/server.js
CHANGED
|
@@ -81,6 +81,7 @@ const jevClaims = require('./lib/jev-claims.js'); // D80 — the bridge betwee
|
|
|
81
81
|
const jevCategorize = require('./lib/jev-categorize.js'); // D82 — the bridge between the document categorizer and the one TypeSafe module
|
|
82
82
|
const validateLib = require('./lib/validate.js');
|
|
83
83
|
const pageAgent = require('./lib/page-agent.js'); // page-starts-agent — the fixed prompts a page press may start
|
|
84
|
+
const pmIdle = require('./lib/pm-idle.js'); // batch 18 item 9: how long the PM has been away, for deep work
|
|
84
85
|
const scanRunLib = require('./lib/scan-run.js'); // horizon-scan — the watch list suggest run and the scheduled scans, in the 60-second tick
|
|
85
86
|
const reportFinderLib = require('./lib/report-finder.js'); // report-workspace — the weekly look for the reports the PM already sends
|
|
86
87
|
const refreshLib = require('./lib/refresh.js'); // data-refresh-settings — the sources, their schedules and the refresh log
|
|
@@ -2845,6 +2846,7 @@ const reportFinderTick = () => {
|
|
|
2845
2846
|
// feedback batch 4 item 6 (canvas XmsgB): Claude reviews each program's milestones and files suggestions the PM keeps, changes or drops. ONE headless
|
|
2846
2847
|
// run at a time for the machine (lib/milestone-review.js): Check now at once; new programs, joins and leaves, a moved ◆ date, a milestone's date and
|
|
2847
2848
|
// Monday 09:00 inside the working hours. Its only write is `pmos program suggest`; the charter changes only on the PM's press. PMOS_MS_REVIEW=off.
|
|
2849
|
+
const deepOpenNow = (now) => require('./lib/driver-run.js').deepOpen(proSettings(), now, (n, q) => proactiveLib.inQuietHours(n, q));
|
|
2848
2850
|
const msReviewCtx = () => ({ getWs, stateDirFor, workspaceList: () => [...workspaces.values()] });
|
|
2849
2851
|
const msReviewer = require('./lib/milestone-review.js').create({
|
|
2850
2852
|
programs: () => require('./lib/routes-programs.js').all(msReviewCtx()),
|
|
@@ -2889,7 +2891,7 @@ const proposalRuns = require('./lib/proposal-runs.js').create({
|
|
|
2889
2891
|
},
|
|
2890
2892
|
rowOf: (w, id) => { const r = require('./lib/routes-boards.js').initiativeWorkflow(proposalCtx(), w, id); if (!r.ok) return null;
|
|
2891
2893
|
return { title: r.row.title || id, intent: r.row.intent || r.row.why || '', stage: r.row.stage || '', stages: (r.row.wfStages || []).map((s) => ({ key: s.key, name: s.name })) }; },
|
|
2892
|
-
open:
|
|
2894
|
+
open: deepOpenNow, // batch 18 item 9: deep work runs at night or when the PM is idle (lib/driver-run.js deepOpen)
|
|
2893
2895
|
headlessOff: () => headlessLib.switchedOff(process.env),
|
|
2894
2896
|
env: process.env,
|
|
2895
2897
|
promptFor: (skillId) => { const h = homeWorkspace(); const t = taskById(skillId, h ? h.root : SELF_ROOT); return t && t.prompt ? t.prompt : null; },
|
|
@@ -2929,7 +2931,7 @@ const metricDraftRuns = require('./lib/metric-draft-runs.js').create({
|
|
|
2929
2931
|
if (scope === 'initiative') { const g = metricDraftInis(w).find((x) => x.id === id); for (const a of (g && g.artifacts) || []) if (!a.shared) out.push(a.role + ': ' + a.path); }
|
|
2930
2932
|
return out;
|
|
2931
2933
|
},
|
|
2932
|
-
open:
|
|
2934
|
+
open: deepOpenNow, // batch 18 item 9: deep work runs at night or when the PM is idle (lib/driver-run.js deepOpen)
|
|
2933
2935
|
headlessOff: () => headlessLib.switchedOff(process.env),
|
|
2934
2936
|
env: process.env,
|
|
2935
2937
|
promptFor: (skillId) => { const h = homeWorkspace(); const t = taskById(skillId, h ? h.root : SELF_ROOT); return t && t.prompt ? t.prompt : null; },
|
|
@@ -2953,7 +2955,7 @@ const impactRuns = require('./lib/impact-runs.js').create({
|
|
|
2953
2955
|
out.push('Stored reads: run `pmos source status`, then `pmos source show <source>` for slack, mail, jira, calendar and wispr');
|
|
2954
2956
|
return out;
|
|
2955
2957
|
},
|
|
2956
|
-
open:
|
|
2958
|
+
open: deepOpenNow, // batch 18 item 9: deep work runs at night or when the PM is idle (lib/driver-run.js deepOpen)
|
|
2957
2959
|
headlessOff: () => headlessLib.switchedOff(process.env),
|
|
2958
2960
|
env: process.env,
|
|
2959
2961
|
promptFor: (skillId) => { const h = homeWorkspace(); const t = taskById(skillId, h ? h.root : SELF_ROOT); return t && t.prompt ? t.prompt : null; },
|
|
@@ -2981,7 +2983,7 @@ const metricReadRuns = require('./lib/metric-read-runs.js').create({
|
|
|
2981
2983
|
return (rids || []).map((id) => S && S.rows.get(id)).filter((r) => r && r.recipe).map((r) => ({ rid: r.id, title: (r.metric && r.metric.name) || r.text, unit: (r.metric && r.metric.unit) || '', recipe: r.recipe }));
|
|
2982
2984
|
},
|
|
2983
2985
|
afterRead: (w, rids, now) => require('./lib/routes-goal-status.js').afterRead({ getWs, stateDirFor, workspaceList: () => [...workspaces.values()], runtimeDir: STATE, tellGoalAlert: goalAlertTell }, w, rids, now),
|
|
2984
|
-
open:
|
|
2986
|
+
open: deepOpenNow, // batch 18 item 9: deep work runs at night or when the PM is idle (lib/driver-run.js deepOpen)
|
|
2985
2987
|
headlessOff: () => headlessLib.switchedOff(process.env),
|
|
2986
2988
|
env: process.env,
|
|
2987
2989
|
promptFor: (skillId) => { const h = homeWorkspace(); const t = taskById(skillId, h ? h.root : SELF_ROOT); return t && t.prompt ? t.prompt : null; },
|
|
@@ -3000,7 +3002,7 @@ const coreDocsTick = () => {
|
|
|
3000
3002
|
try {
|
|
3001
3003
|
m.tick({ getWs, stateDirFor, workspaceList: () => [...workspaces.values()], runtimeDir: STATE, selfRoot: EMBEDDED_SELF ? SELF_ROOT : null, initiativeIndex,
|
|
3002
3004
|
spawnSession: orchSpawn.spawn, stopSession: (id) => { const x = sessions.get(String(id || '')); if (x && x.child) stopHeadless(x); }, invalidateNeedsAgg,
|
|
3003
|
-
proSettings, inQuiet: (now, quiet) => proactiveLib.inQuietHours(now, quiet), isLead: (w) => isPlanNeedsTree(w) }, Number.isFinite(t) ? { now: t } : {});
|
|
3005
|
+
proSettings, inQuiet: (now, quiet) => proactiveLib.inQuietHours(now, quiet), deepOpen: (st, now) => deepOpenNow(now), isLead: (w) => isPlanNeedsTree(w) }, Number.isFinite(t) ? { now: t } : {});
|
|
3004
3006
|
} catch (e) { warnWriteFail('core documents tick', e); }
|
|
3005
3007
|
};
|
|
3006
3008
|
/** One needs-you item, so it shows in the bell. */
|
|
@@ -10449,6 +10451,8 @@ function writeChangeContext(dir) {
|
|
|
10449
10451
|
// remote flag off there is no non-loopback listener, so this is transparent for local dev. Headers
|
|
10450
10452
|
// and the token are never logged (D08).
|
|
10451
10453
|
function httpGuard(req, res) {
|
|
10454
|
+
// batch 18 item 9: a page press (it carries the launch nonce, which no agent session has) is the PM at work; deep work waits for them to step away
|
|
10455
|
+
if (req.method !== 'GET' && req.method !== 'HEAD' && pmGuard.launchNonce() && req.headers[pmGuard.NONCE_HEADER] === pmGuard.launchNonce()) pmIdle.touch();
|
|
10452
10456
|
// Origin/Host allowlist FIRST (D64 A1): reject a cross-site / DNS-rebinding request before the
|
|
10453
10457
|
// token exemption for loopback can be reached. Header values are never logged (D08).
|
|
10454
10458
|
if (!remoteAccess.checkHostOrigin({ origin: req.headers.origin, host: req.headers.host, binds: BIND.binds, publicHost: publicHost() })) {
|
|
@@ -10609,7 +10613,7 @@ wss.on('connection', (ws) => {
|
|
|
10609
10613
|
} else if (m.t === 'detach') {
|
|
10610
10614
|
const s = sessions.get(m.id); if (s) s.clients.delete(ws); ws.attached.delete(m.id);
|
|
10611
10615
|
} else if (m.t === 'input') {
|
|
10612
|
-
const s = sessions.get(m.id); if (s && s.pty) { s.pty.write(m.data); if (typeof m.data === 'string' && !/^\x1b/.test(m.data)) touchSession(s); } // a key the PM typed, not the terminal's own reply to a query
|
|
10616
|
+
const s = sessions.get(m.id); if (s && s.pty) { s.pty.write(m.data); if (typeof m.data === 'string' && !/^\x1b/.test(m.data)) { touchSession(s); pmIdle.touch(); } } // a key the PM typed, not the terminal's own reply to a query
|
|
10613
10617
|
} else if (m.t === 'resize') {
|
|
10614
10618
|
const s = sessions.get(m.id);
|
|
10615
10619
|
if (s && s.pty) {
|
|
@@ -25,7 +25,10 @@ Rules that always hold:
|
|
|
25
25
|
|
|
26
26
|
Procedure:
|
|
27
27
|
1. Orient. Run `pmos driver status initiative <id>`. Read the initiative record (`planning/initiatives/<id>.md`, or `pmos/state/initiatives/<id>.md`) and every file it names: PRD, brief, requirement notes. Run `pmos initiative list` to see the other open initiatives.
|
|
28
|
-
2. Check first for a prior rejection and a duplicate. Search `planning/out-of-scope/` for the idea (Grep on its key words). Compare the title and the intent with the other open initiatives.
|
|
28
|
+
2. Check first for a prior rejection and a duplicate. Search `planning/out-of-scope/` for the idea (Grep on its key words). Compare the title and the intent with the other open initiatives.
|
|
29
|
+
- A prior rejection: file a `note` proposal first that names the file, quotes what it says in one line, and says why this one is the same or different.
|
|
30
|
+
- Another open initiative that overlaps: file `--what overlap` with a JSON file, never a `note`: `{"with": "<the other initiative's id>", "parts": <how many parts of this plan overlap>, "of": <how many parts this plan has>, "items": ["<one part that overlaps, in plain words>"], "sure": "high|medium|low", "sureWhy": "<one line: what you read that makes you that sure>", "first": "this|other", "firstWhy": "<one line: why that one goes first>", "text": "<one sentence: what overlaps and what is separate>"}`. Give only the fields you know: leave out parts and of when the plans have no parts you can count. Never file an overlap with an initiative the prompt says the PM marked as not an overlap.
|
|
31
|
+
Then stop unless the match is weak.
|
|
29
32
|
3. Find the stage category in the prompt. When the prompt names core documents of this stage that are due or stale, do step 8 first. For Plan, Do and Learn, go to step 5. For Discover, do step 4.
|
|
30
33
|
4. Discover, in this order. Skip any step already kept.
|
|
31
34
|
a. Problem statement. One paragraph: who has the problem, what it is, what it costs them. File `--what problem` with `--data "<the paragraph>"`. Give at least one source when you have one.
|
|
@@ -89,7 +89,7 @@ const shot = (p, name) => (SHOTS ? p.screenshot({ path: path.join(SHOTS, name) }
|
|
|
89
89
|
if (!(await p.evaluate(() => !!document.querySelector('#ibBody .sm-dot')))) return finish(1);
|
|
90
90
|
const key = await p.evaluate(() => { const d = document.querySelector('#ibBody .sm-dot'); const b = d && d.closest('[data-key]'); return b ? b.dataset.key : null; });
|
|
91
91
|
await p.click(`#ibBody [data-key="${key}"]`);
|
|
92
|
-
const card = await until(() => p.evaluate(() => { const c = document.querySelector('#czViewer .sm-card'); return c ? { title: c.querySelector('.sm-h b').textContent, btns: [...c.querySelectorAll('[data-sm]')].map((b) => b.getAttribute('aria-label')), after: !!(c.previousElementSibling && c.previousElementSibling.classList.contains('iv-
|
|
92
|
+
const card = await until(() => p.evaluate(() => { const c = document.querySelector('#czViewer .sm-card'); return c ? { title: c.querySelector('.sm-h b').textContent, btns: [...c.querySelectorAll('[data-sm]')].map((b) => b.getAttribute('aria-label')), after: !!c.closest('.iv-cl') && !!(c.previousElementSibling && c.previousElementSibling.classList.contains('iv-card')) } : null; }));
|
|
93
93
|
ok('B the card under the summary: the spark title and ✕ Not now, ✎ Change it first, ✓ Split as suggested', card && /^Split off .+\?$/.test(card.title) && card.btns.join('|') === 'Not now|Change it first|Split as suggested' && card.after, JSON.stringify(card));
|
|
94
94
|
await shot(p, 'board-suggest.png');
|
|
95
95
|
await p.click('#czViewer [data-sm="edit"]');
|