create-pmos 0.275.0 → 0.276.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 +1 -1
- 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/guide/briefing-premium.md +9 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-phone-card-test.js +178 -0
- package/workspace/public/pm/premium.css +18 -0
- package/workspace/public/pm/premium.js +95 -1
- package/workspace/test-lists/premium-phone-card.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.276.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-18T17:05:55Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-18T17:05:55Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-18T17:05:55Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -118,6 +118,14 @@ Under Today, the **Around you** card holds what the agents and the outside world
|
|
|
118
118
|
|
|
119
119
|
With one product picked, the dialogs show its data. With several, each product's part has its own heading, and the counts are not added across products. The agent mode, the scan's watch list and setting and the report documents stay in the console.
|
|
120
120
|
|
|
121
|
+
## The phone card
|
|
122
|
+
|
|
123
|
+
On a phone (640 pixels wide or narrower) the Briefing opens with one card above "What you need to do". It says what the day is doing now, and it changes with the clock. It has eight moments: a meeting under way, a meeting about to start, a meeting that just ended, a free stretch, the morning, working hours, the evening recap and the night. The card is chosen again every minute and when you return to the page. On a wider screen the card does not show, and the page does not read the day for it.
|
|
124
|
+
|
|
125
|
+
- **Open the meeting** opens the same dialog as a row in Today. If the calendar PMOS holds does not list the meeting, the card says so and opens nothing.
|
|
126
|
+
- **Done** marks one of your own items as done, and shows **Undo** on the same line. A refused press shows the reason. The card never says "Done" when the record was not written.
|
|
127
|
+
- The card does not ask to record a meeting, and it does not say that notes exist unless the meeting holds them. If a read fails, the card names it.
|
|
128
|
+
|
|
121
129
|
## The dock
|
|
122
130
|
|
|
123
131
|
When you scroll past the hero, the hero folds into a bar at the top. The bar shows how many rows need you and the next item in Today.
|
|
@@ -145,6 +153,7 @@ Each button writes one record, through a check that only a real press from this
|
|
|
145
153
|
| Make it a task, Mark read, Mark unread (a mention) | One Work item, or a read mark | the Work list, `mentions/read.jsonl` |
|
|
146
154
|
| Approve, Dismiss, Undo, Scan now, Stop (the horizon scan) | The scan's own records | `scan.jsonl` in the state folder |
|
|
147
155
|
| Refresh, Refresh all (data freshness) | A new read of the source | the source's own store |
|
|
156
|
+
| Done, Undo (the phone card) | The item is marked done, or reopened | the Work list |
|
|
148
157
|
| Not yet: Later today, Tomorrow, Next week | A put-off record. The row leaves the list until then and the page names it. It does not count as done. | `briefing-premium-deferred.jsonl` in the state folder |
|
|
149
158
|
|
|
150
159
|
Later today means three hours from now. Tomorrow and Next week mean 09:00, tomorrow and next Monday.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.276.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.276.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* premium-phone-card-test.js — the phone moment card on the premium Briefing (initiative premium-phone-card;
|
|
4
|
+
* planning/prd/premium-phone-card-prd.md R1 to R5). A real server on a scratch repository (c3-scan-fixture.js). The real page runs at 390 wide
|
|
5
|
+
* with the clock set to each moment of the day; /api/brief-page, /api/phone-day and the week of the calendar are answered in the browser,
|
|
6
|
+
* because they need a clock and a day of meetings. Done and Reopen press the real routes on real items.
|
|
7
|
+
* M the eight moments · O Open the meeting · D Done and Undo · X a refused press · E a read that fails · W desktop width and the POST allow-list · L floors
|
|
8
|
+
* Set PHONE_CARD_SHOTS=<dir> to save screenshots of each moment at 390 wide, light and dark. */
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
12
|
+
require('./test-run').configure({ name: 'premium-phone-card' });
|
|
13
|
+
const Fx = require('./c3-scan-fixture.js');
|
|
14
|
+
|
|
15
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
16
|
+
const until = async (fn, ms = 15000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
17
|
+
const results = [];
|
|
18
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
|
|
19
|
+
let F = null, browser = null;
|
|
20
|
+
const finish = async (code) => {
|
|
21
|
+
if (browser) await browser.close().catch(() => {});
|
|
22
|
+
if (F) F.stop();
|
|
23
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
24
|
+
console.log(`\n${results.length - bad}/${results.length} premium-phone-card assertions passed`);
|
|
25
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
26
|
+
};
|
|
27
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
28
|
+
|
|
29
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
30
|
+
const base = new Date(); base.setHours(0, 0, 0, 0);
|
|
31
|
+
const DATE = `${base.getFullYear()}-${pad(base.getMonth() + 1)}-${pad(base.getDate())}`;
|
|
32
|
+
const at = (h, m = 0, d = 0) => new Date(base.getFullYear(), base.getMonth(), base.getDate() + d, h, m, 0, 0);
|
|
33
|
+
const MT = (id, title, h1, m1, h2, m2, people = ['Dana Hartono', 'Priya Sen']) => ({ id, title, start: at(h1, m1).toISOString(), end: at(h2, m2).toISOString(), minutes: (h2 * 60 + m2) - (h1 * 60 + m1), people, initiative: 'Partner API onboarding', prepared: [{ kind: 'note', text: 'Last time you agreed to share the sandbox dates.' }], before: [], state: 'upcoming' });
|
|
34
|
+
const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
|
|
35
|
+
|
|
36
|
+
(async () => {
|
|
37
|
+
const exe = findBrowser();
|
|
38
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
39
|
+
let chromium;
|
|
40
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
41
|
+
F = await Fx.start({ name: 'premium-phone-card' });
|
|
42
|
+
const ws = F.ws;
|
|
43
|
+
const i1 = (await F.post('/api/pm-items/add', { line: 'Send the partner onboarding list to Lina' })).body.item;
|
|
44
|
+
const i2 = (await F.post('/api/pm-items/add', { line: 'Confirm the rate-limit quota' })).body.item;
|
|
45
|
+
browser = await chromium.launch({ executablePath: exe, headless: true, args: ['--no-sandbox'] });
|
|
46
|
+
|
|
47
|
+
const shotDir = process.env.PHONE_CARD_SHOTS;
|
|
48
|
+
/* one page per scene: a clock, a day of meetings and a list of the PM's own items */
|
|
49
|
+
async function scene({ time, today = [], needs = [], width = 390, scheme = 'light', pageFail = false, dayFail = false, week = null, name }) {
|
|
50
|
+
const ctx = await browser.newContext({ viewport: { width, height: 844 }, colorScheme: scheme });
|
|
51
|
+
const p = await ctx.newPage(), posts = [], gets = [], errs = [];
|
|
52
|
+
p.on('pageerror', (e) => errs.push(String(e)));
|
|
53
|
+
p.on('request', (r) => { const u = new URL(r.url()); if (r.method() === 'POST') posts.push({ path: u.pathname, body: (() => { try { return JSON.parse(r.postData() || 'null'); } catch { return null; } })() }); else if (u.pathname.startsWith('/api/')) gets.push(u.pathname); });
|
|
54
|
+
await p.clock.install({ time });
|
|
55
|
+
await p.route('**/api/brief-page*', (r) => (pageFail ? json(r, { ok: false, error: 'the brief could not be read' }, 500) : json(r, { ok: true, date: DATE, today, needs, mentions: [] })));
|
|
56
|
+
await p.route('**/api/phone-day*', (r) => (dayFail ? json(r, { ok: false, error: 'the day could not be read' }, 500) : json(r, { ok: true, finished: [{ id: 'f1', title: 'Draft of the sandbox note', summary: 'Two paragraphs, ready for you to read.', status: 'review' }], recap: { meetings: 2, decided: 1, done: 3, finished: 1, moved: [{ kind: 'done', text: 'Sandbox dates agreed', sub: 'Partner API onboarding' }] }, tomorrow: { label: 'Tuesday', meetings: [{ id: 'm9', title: 'Quota review', start: at(10, 0, 1).toISOString(), people: ['Priya Sen'] }] } })));
|
|
57
|
+
await p.route('**/api/calendar-views*', (r) => {
|
|
58
|
+
const u = new URL(r.request().url());
|
|
59
|
+
if (u.searchParams.get('view') === 'week' && week) return json(r, week);
|
|
60
|
+
return json(r, { ok: true, view: u.searchParams.get('view') || 'quarter', cells: [], gantt: [], no_plan: 0, strategy: [], today: DATE });
|
|
61
|
+
});
|
|
62
|
+
await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(ws)}`);
|
|
63
|
+
p.__posts = posts; p.__gets = gets; p.__errs = errs; p.__ctx = ctx;
|
|
64
|
+
if (shotDir && name) p.__shot = async (suffix) => { await sleep(700); fs.mkdirSync(shotDir, { recursive: true }); await p.screenshot({ path: path.join(shotDir, `${name}-${suffix}.png`) }); };
|
|
65
|
+
return p;
|
|
66
|
+
}
|
|
67
|
+
const card = (p) => p.evaluate(() => { const c = document.querySelector('#phoneCard'); return c && !c.hidden && getComputedStyle(c).display !== 'none' ? { kind: c.dataset.moment || '', text: c.textContent.replace(/\s+/g, ' ').trim() } : null; });
|
|
68
|
+
const wait = async (p, re) => until(async () => { const c = await card(p); return c && re.test(c.text) ? c : null; });
|
|
69
|
+
const A = MT('mA', 'Partner sync', 10, 0, 11, 0);
|
|
70
|
+
|
|
71
|
+
/* M: the eight moments */
|
|
72
|
+
let p = await scene({ time: at(10, 20), today: [A, MT('mB', 'Quota review', 14, 0, 15, 0)], name: 'meeting' });
|
|
73
|
+
let c = await wait(p, /Under way/);
|
|
74
|
+
ok('M1 a meeting under way: says when it ends and names it', c && c.kind === 'meeting' && /Under way · ends in 40 min/.test(c.text) && /Partner sync/.test(c.text) && /Dana, Priya/.test(c.text), c && c.text);
|
|
75
|
+
if (p.__shot) await p.__shot('light');
|
|
76
|
+
await p.__ctx.close();
|
|
77
|
+
|
|
78
|
+
p = await scene({ time: at(9, 45), today: [A], name: 'before' });
|
|
79
|
+
c = await wait(p, /Starts/);
|
|
80
|
+
ok('M2 a meeting near: says when it starts and what is prepared', c && c.kind === 'before' && /Starts in 15 min · 10:00/.test(c.text) && /sandbox dates/.test(c.text), c && c.text);
|
|
81
|
+
if (p.__shot) await p.__shot('light');
|
|
82
|
+
await p.__ctx.close();
|
|
83
|
+
|
|
84
|
+
p = await scene({ time: at(11, 10), today: [A, MT('mB', 'Quota review', 14, 0, 15, 0)], name: 'after' });
|
|
85
|
+
c = await wait(p, /Just ended/);
|
|
86
|
+
ok('M3 a meeting just ended: names it and does not claim notes exist', c && c.kind === 'after' && /Partner sync/.test(c.text) && /if there are any/.test(c.text) && !/record/i.test(c.text), c && c.text);
|
|
87
|
+
await p.__ctx.close();
|
|
88
|
+
|
|
89
|
+
p = await scene({ time: at(11, 40), today: [A, MT('mB', 'Quota review', 14, 0, 15, 0)], needs: [{ key: 'k1', kind: 'overdue', id: i1.id, headline: i1.text || 'Send the partner onboarding list to Lina', days_late: 2 }], name: 'gap' });
|
|
90
|
+
c = await wait(p, /free|Free|until/);
|
|
91
|
+
ok('M4 a free stretch: names the next meeting and the item that fits', c && c.kind === 'gap' && /Quota review/.test(c.text) && /Lina/.test(c.text), c && c.text);
|
|
92
|
+
await p.__ctx.close();
|
|
93
|
+
|
|
94
|
+
p = await scene({ time: at(8, 0), today: [MT('mB', 'Quota review', 13, 0, 14, 0)], needs: [{ key: 'k1', kind: 'due-today', id: i1.id, headline: 'Send the partner onboarding list to Lina' }], name: 'morning' });
|
|
95
|
+
c = await wait(p, /this morning/);
|
|
96
|
+
ok('M5 the morning: counts what waits and names the first meeting', c && c.kind === 'morning' && /One thing this morning/.test(c.text) && /First up: Quota review at 13:00/.test(c.text), c && c.text);
|
|
97
|
+
await p.__ctx.close();
|
|
98
|
+
|
|
99
|
+
p = await scene({ time: at(14, 30), today: [MT('mB', 'Quota review', 16, 0, 17, 0)], name: 'work' });
|
|
100
|
+
c = await wait(p, /Finished for you/);
|
|
101
|
+
ok('M6 working hours: says what the agent finished, from phone-day, and that approving waits for the computer', c && c.kind === 'work' && /Draft of the sandbox note/.test(c.text) && /Waits for you/.test(c.text) && /waits for your computer/.test(c.text), c && c.text);
|
|
102
|
+
await p.__ctx.close();
|
|
103
|
+
|
|
104
|
+
p = await scene({ time: at(18, 0), today: [A], needs: [{ key: 'k1', kind: 'overdue', id: i1.id, headline: 'Send the partner onboarding list to Lina', days_late: 1 }], name: 'recap' });
|
|
105
|
+
c = await wait(p, /How today went/);
|
|
106
|
+
ok('M7 the evening: the recap counts come from phone-day', c && c.kind === 'recap' && /2\s*meetings/.test(c.text) && /3\s*done by you/.test(c.text) && /Sandbox dates agreed/.test(c.text) && /Still open · 1/.test(c.text), c && c.text);
|
|
107
|
+
await p.__ctx.close();
|
|
108
|
+
|
|
109
|
+
p = await scene({ time: at(21, 0), today: [A], name: 'night' });
|
|
110
|
+
c = await wait(p, /Tomorrow, Tuesday/);
|
|
111
|
+
ok('M8 the night: tomorrow at a glance, with its meetings', c && c.kind === 'night' && /Quota review/.test(c.text) && /10:00/.test(c.text), c && c.text);
|
|
112
|
+
await p.__ctx.close();
|
|
113
|
+
|
|
114
|
+
/* O: Open the meeting */
|
|
115
|
+
const hit = { ok: true, range: { start: DATE, end: DATE }, cells: [{ key: DATE, end: DATE, events: [{ id: 'ev1', title: A.title, at: A.start, end: A.end, attendees: A.people }] }], context: {} };
|
|
116
|
+
p = await scene({ time: at(10, 20), today: [A], week: hit });
|
|
117
|
+
await wait(p, /Under way/);
|
|
118
|
+
await p.click('#phoneCard [data-pha="phopen"]');
|
|
119
|
+
ok('O1 Open the meeting opens the meeting dialog when the calendar lists it', await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))));
|
|
120
|
+
await p.__ctx.close();
|
|
121
|
+
p = await scene({ time: at(10, 20), today: [A], week: { ok: true, range: { start: DATE, end: DATE }, cells: [], context: {} } });
|
|
122
|
+
await wait(p, /Under way/);
|
|
123
|
+
await p.click('#phoneCard [data-pha="phopen"]');
|
|
124
|
+
ok('O2 when the calendar does not list it, the page says so and opens nothing', await until(() => p.evaluate(() => /could not be opened/.test(document.body.innerText))) && !(await p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))));
|
|
125
|
+
await p.__ctx.close();
|
|
126
|
+
|
|
127
|
+
/* D: Done and Undo, on a real item */
|
|
128
|
+
const own = (it, k = 'k1') => ({ key: k, kind: 'overdue', id: it.id, headline: 'Confirm the rate-limit quota', days_late: 3 });
|
|
129
|
+
p = await scene({ time: at(8, 0), today: [], needs: [own(i2)] });
|
|
130
|
+
await wait(p, /Confirm the rate-limit quota/);
|
|
131
|
+
await p.click(`#phoneCard .phfit[data-id="${i2.id}"] [data-pha="phdone"]`);
|
|
132
|
+
ok('D1 Done posts one done for that item and the card says Done.', await until(() => p.evaluate(() => /Done\./.test(document.querySelector('#phoneCard').textContent))) && p.__posts.filter((x) => x.path === '/api/pm-items/done').length === 1 && p.__posts.find((x) => x.path === '/api/pm-items/done').body.id === i2.id, JSON.stringify(p.__posts));
|
|
133
|
+
const st1 = await F.get('/api/pm-items'); const row1 = JSON.stringify(st1.body).includes(i2.id);
|
|
134
|
+
ok('D2 the item is recorded as done by the real route', row1 && /done/i.test(JSON.stringify((st1.body.items || []).find((x) => x.id === i2.id) || {})), JSON.stringify(st1.body).slice(0, 300));
|
|
135
|
+
await p.click(`#phoneCard .phfit[data-id="${i2.id}"] [data-pha="phundo"]`);
|
|
136
|
+
ok('D3 Undo posts a reopen and the Done button is back', await until(() => p.evaluate((id) => !!document.querySelector(`#phoneCard .phfit[data-id="${id}"] [data-pha="phdone"]`), i2.id)) && p.__posts.some((x) => x.path === '/api/pm-items/reopen' && x.body.id === i2.id), JSON.stringify(p.__posts));
|
|
137
|
+
await p.__ctx.close();
|
|
138
|
+
|
|
139
|
+
/* X: a refused press */
|
|
140
|
+
p = await scene({ time: at(8, 0), today: [], needs: [{ key: 'kx', kind: 'overdue', id: 'zz-no-such-item', headline: 'An item the file does not hold', days_late: 1 }] });
|
|
141
|
+
await wait(p, /An item the file does not hold/);
|
|
142
|
+
await p.click('#phoneCard [data-pha="phdone"]');
|
|
143
|
+
ok('X1 a refused Done shows the reason and does not say Done', await until(() => p.evaluate(() => /That did not go through/.test(document.querySelector('#phoneCard').textContent))) && !/Done\./.test(await p.evaluate(() => document.querySelector('#phoneCard').textContent)));
|
|
144
|
+
await p.__ctx.close();
|
|
145
|
+
|
|
146
|
+
/* E: a read that fails is named in the card */
|
|
147
|
+
p = await scene({ time: at(10, 20), pageFail: true });
|
|
148
|
+
ok('E1 a failed brief read is named in the card', !!(await wait(p, /could not be read/)));
|
|
149
|
+
await p.__ctx.close();
|
|
150
|
+
p = await scene({ time: at(18, 0), today: [A], dayFail: true });
|
|
151
|
+
c = await wait(p, /Today could not be read/);
|
|
152
|
+
ok('E2 a failed phone-day read is named in the recap, and the open items still show', c && /Still open/.test(c.text), c && c.text);
|
|
153
|
+
await p.__ctx.close();
|
|
154
|
+
|
|
155
|
+
/* W: desktop width and the POST allow-list */
|
|
156
|
+
p = await scene({ time: at(18, 0), today: [A], width: 1280 });
|
|
157
|
+
await sleep(1500);
|
|
158
|
+
ok('W1 at 1280 wide the card is not shown', (await card(p)) === null);
|
|
159
|
+
ok('W2 at 1280 wide nothing asks for phone-day', !p.__gets.includes('/api/phone-day'), p.__gets.join());
|
|
160
|
+
ok('W3 nothing is written on load', p.__posts.length === 0, JSON.stringify(p.__posts));
|
|
161
|
+
await p.__ctx.close();
|
|
162
|
+
|
|
163
|
+
/* L: floors at 390, light and dark */
|
|
164
|
+
for (const scheme of ['light', 'dark']) {
|
|
165
|
+
p = await scene({ time: at(9, 45), today: [A], needs: [own(i2)], scheme, name: 'floors' });
|
|
166
|
+
await wait(p, /Starts/);
|
|
167
|
+
const f = await p.evaluate(() => {
|
|
168
|
+
const c = document.querySelector('#phoneCard'), bs = [...c.querySelectorAll('button')];
|
|
169
|
+
return { over: document.documentElement.scrollWidth > innerWidth + 1, small: bs.filter((b) => b.getBoundingClientRect().height < 43.5).length, buttons: bs.length, colour: getComputedStyle(c.querySelector('.phbig')).color, bg: getComputedStyle(c).backgroundColor, edge: getComputedStyle(c).boxShadow };
|
|
170
|
+
});
|
|
171
|
+
ok(`L1 ${scheme}: no sideways scroll at 390 and every button is 44 px tall`, !f.over && f.small === 0 && f.buttons >= 1, JSON.stringify(f));
|
|
172
|
+
ok(`L2 ${scheme}: the card has the ember edge and readable text`, /inset/.test(f.edge) && f.colour !== f.bg, JSON.stringify(f));
|
|
173
|
+
ok(`L3 ${scheme}: the page raised no error`, p.__errs.length === 0, p.__errs.join());
|
|
174
|
+
if (p.__shot) await p.__shot(scheme);
|
|
175
|
+
await p.__ctx.close();
|
|
176
|
+
}
|
|
177
|
+
return finish();
|
|
178
|
+
})().catch((e) => { console.error(e); finish(1); });
|
|
@@ -1631,3 +1631,21 @@ button.m3-stc{min-height:44px;margin:-7px 0}button.m3-stc:hover{background:var(-
|
|
|
1631
1631
|
.bd-src b{display:block;font-weight:650}.bd-src small{display:block;margin-top:2px;font-size:var(--t-small);color:var(--ink-3)}
|
|
1632
1632
|
.bd-st{font-weight:650}.bd-st.stale,.bd-st.failed{color:var(--ember-ink)}.bd-st.never{color:var(--bad)}
|
|
1633
1633
|
@media (max-width:700px){.bd-acts .cta{flex:1 1 auto;justify-content:center}.bd-src{grid-template-columns:minmax(0,1fr)}}
|
|
1634
|
+
|
|
1635
|
+
/* ── Briefing: the phone moment card (premium-phone-card) — shown at 640px and below only ── */
|
|
1636
|
+
#phoneCard{display:none}
|
|
1637
|
+
@media (max-width:640px){
|
|
1638
|
+
#phoneCard:not([hidden]){display:block}
|
|
1639
|
+
.phm{margin-top:24px;box-shadow:inset 3px 0 0 var(--ember),var(--card-shadow)}
|
|
1640
|
+
.phbig{display:block;margin:6px 0 4px;font-size:var(--t-lead,20px);font-weight:700;line-height:1.25;color:var(--ink);overflow-wrap:anywhere}
|
|
1641
|
+
.phtt{display:block;font-size:var(--t-body);font-weight:650;line-height:1.35;color:var(--ink);overflow-wrap:anywhere}
|
|
1642
|
+
.phl{margin:2px 0 8px;font-size:var(--t-small);color:var(--ink-2);overflow-wrap:anywhere}
|
|
1643
|
+
.phs{margin:4px 0;font-size:var(--t-small);line-height:1.5;color:var(--ink-3);overflow-wrap:anywhere}
|
|
1644
|
+
.phacts{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
|
|
1645
|
+
.phacts .cta{height:44px;min-width:44px;padding:0 18px;margin:0;flex:1 1 auto;justify-content:center}
|
|
1646
|
+
.phfit{margin-top:12px;padding-top:12px;border-top:1px solid var(--hair)}
|
|
1647
|
+
.phstats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:10px 0 4px}
|
|
1648
|
+
.phstats div{display:grid;gap:2px;padding:10px;border-radius:12px;background:var(--well)}
|
|
1649
|
+
.phstats b{font-size:var(--t-lead,20px);font-weight:700;color:var(--ink)}
|
|
1650
|
+
.phstats span{font-size:var(--t-small);color:var(--ink-3)}
|
|
1651
|
+
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { pmPost, pmGet } from './http.js';
|
|
6
6
|
import { mountMeeting } from './premium-meeting.js';
|
|
7
7
|
import { lineItems, behindOf, refreshTargets, whenRead } from './freshness-words.js';
|
|
8
|
+
import { momentOf, inText } from './c3-phone-model.js';
|
|
8
9
|
import { $, $$, esc, store, THEME_KEY, RM, AI, S, theme, toast, kv, H, openDlg, closeDlg, setTab, setMode, CHECK, CHEV, ptx, turnA, turnU, H1, H2, P1, UL, logHtml, loadThread, onScroll, wireRail, pvFeed } from './premium-shell.js';
|
|
9
10
|
const ICON = {
|
|
10
11
|
meeting: '<rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/>',
|
|
@@ -304,8 +305,10 @@ async function readProps(P) {
|
|
|
304
305
|
if (!items.length && errs.length) return { ok: false, error: errs[0] };
|
|
305
306
|
return { ok: true, items, errs };
|
|
306
307
|
}
|
|
308
|
+
const briefPage = (force) => (BP && !force && Date.now() - BP.at < 30000 ? BP.p : (BP = { at: Date.now(), p: getj('/api/brief-page') }).p); // one read of the day for the Around you card and the phone card
|
|
309
|
+
let BP = null;
|
|
307
310
|
async function readMen() {
|
|
308
|
-
const r = await
|
|
311
|
+
const r = await briefPage();
|
|
309
312
|
return r.ok ? { ok: true, list: Array.isArray(r.mentions) ? r.mentions : null } : r;
|
|
310
313
|
}
|
|
311
314
|
const PST = { 'on time': ['ok', 'On time'], 'at risk': ['warn', 'At risk'], delayed: ['bad', 'Delayed'], overdue: ['bad', 'Overdue'], 'no plan': ['', 'No plan'] };
|
|
@@ -684,6 +687,97 @@ function mountAround() {
|
|
|
684
687
|
}
|
|
685
688
|
mountAround();
|
|
686
689
|
|
|
690
|
+
/* ── the phone moment card: what the day is doing now, above What you need to do, at 640 px and narrower ───────────────────────────────
|
|
691
|
+
* The moment is chosen by momentOf (c3-phone-model.js) from the brief-page day and a clock. Every line below comes from /api/brief-page or /api/phone-day. */
|
|
692
|
+
const PH = { page: null, day: null, dayAt: 0, dec: new Map(), err: {} };
|
|
693
|
+
const phoneOn = () => matchMedia('(max-width:640px)').matches;
|
|
694
|
+
const pHm = (iso) => { const d = new Date(iso); return STAMP(d.getHours()) + ':' + STAMP(d.getMinutes()); };
|
|
695
|
+
const pWho = (m) => (m.people && m.people.length ? m.people.map(first).join(', ') : '');
|
|
696
|
+
const pOwn = () => ((PH.page && PH.page.ok && PH.page.needs) || []).filter((n) => n && n.id && (n.kind === 'overdue' || n.kind === 'due-today'))
|
|
697
|
+
.map((n) => ({ id: n.id, headline: n.headline, label: n.kind === 'overdue' ? (n.days_late === 1 ? '1 day late' : n.days_late + ' days late') : 'Due today', kind: n.kind, looks: !!(n.evidence && n.evidence.text) }));
|
|
698
|
+
const pBtn = (label, act, id, alt) => `<button type="button" class="cta${alt ? ' alt' : ''}" data-pha="${act}"${id != null ? ` data-id="${esc(id)}"` : ''}>${esc(label)}</button>`;
|
|
699
|
+
const pItem = (n) => {
|
|
700
|
+
const d = PH.dec.has(n.id);
|
|
701
|
+
const act = d ? `<p class="bd-done" role="status">${CHECK}<span>Done.</span></p><div class="phacts">${pBtn('Undo', 'phundo', n.id, true)}</div>` : `<div class="phacts">${pBtn(n.looks ? 'Confirm done' : 'Done', 'phdone', n.id)}</div>`;
|
|
702
|
+
return `<div class="phfit" data-id="${esc(n.id)}"><span class="label">${esc(n.label)}</span><b class="phtt">${esc(n.headline)}</b>${act}${PH.err[n.id] ? `<p class="nodef err" role="alert">${esc(PH.err[n.id])}</p>` : ''}</div>`;
|
|
703
|
+
};
|
|
704
|
+
const pItems = (list) => list.concat([...PH.dec.values()].filter((x) => !list.some((y) => y.id === x.id))).map(pItem).join('');
|
|
705
|
+
const pOpen = (m) => pBtn('Open the meeting', 'phopen', m.id, true);
|
|
706
|
+
const pBig = (t) => `<b class="phbig">${esc(t)}</b>`;
|
|
707
|
+
const pL = (t) => `<p class="phl">${esc(t)}</p>`, pS = (t) => `<p class="phs">${esc(t)}</p>`;
|
|
708
|
+
const pDayErr = () => (PH.day && PH.day.ok === false ? pS('Today could not be read: ' + PH.day.error + '.') : !PH.day ? pS('Reading your day.') : '');
|
|
709
|
+
const pNum = (n, one, many) => (n === 1 ? '1 ' + one : (n || 0) + ' ' + many);
|
|
710
|
+
function phMoment(mo) {
|
|
711
|
+
const m = mo.meeting, own = pOwn(), day = PH.day && PH.day.ok !== false ? PH.day : null, fin = day ? day.finished || [] : [];
|
|
712
|
+
const wait = own.length ? pNum(own.length, 'item of yours waits', 'items of yours wait') + '.' : 'Nothing of yours is due.';
|
|
713
|
+
const finRows = (n) => fin.slice(0, n).map((t) => `<div class="phfit"><span class="label">${t.status === 'review' ? 'Waits for you' : t.status === 'sent' ? 'Sent' : 'Finished'}</span><b class="phtt">${esc(t.title)}</b><p class="phs">${esc(t.summary)}</p></div>`).join('');
|
|
714
|
+
if (mo.kind === 'meeting') return `<span class="label">Under way · ends ${esc(inText(mo.minutes))}</span>${pBig(m.title)}${pWho(m) ? pL(pWho(m)) : ''}<div class="phacts">${pOpen(m)}</div>`;
|
|
715
|
+
if (mo.kind === 'before') {
|
|
716
|
+
const prep = (m.prepared || []).slice(0, 3).map((x) => `<p class="phs">${esc(x.text)}</p>`).join('') || pS('Nothing is prepared for it.');
|
|
717
|
+
const bf = (m.before || []).filter((x) => x && x.id && !x.done).map((x) => ({ id: x.id, headline: x.title, label: 'Before you go', kind: 'before' }));
|
|
718
|
+
return `<span class="label">Starts ${esc(inText(mo.minutes))} · ${pHm(m.start)}</span>${pBig(m.title)}${[pWho(m), m.initiative].filter(Boolean).length ? pL([pWho(m), m.initiative].filter(Boolean).join(' · ')) : ''}${prep}${pItems(bf)}<div class="phacts">${pOpen(m)}</div>`;
|
|
719
|
+
}
|
|
720
|
+
if (mo.kind === 'after') return `<span class="label">Just ended · ${pHm(m.end || m.start)}</span>${pBig(m.title)}${pS('The notes of this meeting, if there are any, are in the meeting.')}<div class="phacts">${pOpen(m)}</div>`;
|
|
721
|
+
if (mo.kind === 'gap') return `<span class="label">Until ${esc(mo.next.title)} at ${pHm(mo.next.start)}</span>${pBig(mo.minutes + ' free minutes')}${mo.fits.length ? pItems(mo.fits.map((n) => own.find((o) => o.id === n.id)).filter(Boolean)) : pL('Nothing of yours is due. A good moment to prepare the next meeting.')}`;
|
|
722
|
+
if (mo.kind === 'morning') {
|
|
723
|
+
const top = own.slice(0, 3);
|
|
724
|
+
return `<span class="label">Your morning</span>${pBig(top.length ? ['', 'One thing', 'Two things', 'Three things'][top.length] + ' this morning' : 'Nothing pressing this morning')}${pItems(top)}${pS(wait)}${mo.next ? `<div class="phfit"><b class="phtt">First up: ${esc(mo.next.title)} at ${pHm(mo.next.start)}</b><p class="phs">${esc(inText((Date.parse(mo.next.start) - Date.now()) / 60000).replace(/^in/, 'In'))}${pWho(mo.next) ? ' · ' + esc(pWho(mo.next)) : ''}</p><div class="phacts">${pOpen(mo.next)}</div></div>` : pS('No meetings today.')}`;
|
|
725
|
+
}
|
|
726
|
+
if (mo.kind === 'work') return `<span class="label">${mo.next ? 'Next: ' + esc(mo.next.title) + ' at ' + pHm(mo.next.start) : 'No more meetings today'}</span>${pBig(fin.length ? 'Finished for you' : 'Nothing new from the agent')}${fin.length ? finRows(2) + pS('Approving a draft waits for your computer.') : pDayErr() || pS('When the agent finishes a draft today, it shows here.')}${mo.fits.length ? pItems(mo.fits.map((n) => own.find((o) => o.id === n.id)).filter(Boolean)) : ''}${mo.next ? `<div class="phacts">${pOpen(mo.next)}</div>` : ''}`;
|
|
727
|
+
if (mo.kind === 'recap') {
|
|
728
|
+
const r = day && day.recap, one = own[0];
|
|
729
|
+
return `<span class="label">Evening recap</span>${pBig('How today went')}${r ? `<div class="phstats"><div><b>${r.meetings || 0}</b><span>meetings</span></div><div><b>${r.decided || 0}</b><span>decided in meetings</span></div><div><b>${r.done || 0}</b><span>done by you</span></div></div>${(r.moved || []).length ? `<div class="phfit"><b class="phtt">What moved</b>${r.moved.map((x) => `<p class="phs">${esc(x.text)}${x.sub ? ' · ' + esc(x.sub) : ''}</p>`).join('')}</div>` : ''}` : pDayErr()}<div class="phfit"><b class="phtt">Still open · ${own.length}</b>${own.slice(0, 3).map((x) => pS(x.headline)).join('')}${pS(own.length ? "They come first on tomorrow's Briefing." : 'Nothing of yours is still open.')}</div>${one ? `<div class="phfit"><span class="label">One thing tonight, if you have a minute</span>${pItems([one])}</div>` : ''}`;
|
|
730
|
+
}
|
|
731
|
+
const r = day && day.recap, tm = day && day.tomorrow;
|
|
732
|
+
return `<span class="label">End of day</span>${pBig(tm ? 'Tomorrow, ' + tm.label : 'Tomorrow, at a glance')}${r ? pL('Today: ' + [pNum(r.meetings, 'meeting', 'meetings'), pNum(r.decided, 'decision', 'decisions'), pNum(r.done, 'item done', 'items done')].join(', ') + '.') : ''}${tm ? `<div class="phfit"><b class="phtt">${tm.meetings.length ? pNum(tm.meetings.length, 'meeting', 'meetings') : 'No meetings'}</b>${tm.meetings.slice(0, 5).map((x) => `<p class="phs">${pHm(x.start)} · ${esc(x.title)}${pWho(x) ? ' · ' + esc(pWho(x)) : ''}</p>`).join('')}</div>` : pDayErr()}${pS(own.length ? pNum(own.length, 'item carries', 'items carry') + " over. They open first on tomorrow's Briefing." : 'Nothing carries over.')}`;
|
|
733
|
+
}
|
|
734
|
+
function drawPhone(focus) {
|
|
735
|
+
const c = $('#phoneCard'); if (!c) return;
|
|
736
|
+
c.hidden = !phoneOn(); if (c.hidden) return;
|
|
737
|
+
if (!PH.page) c.innerHTML = '<span class="label">Now</span><p class="phl">Reading your day.</p>';
|
|
738
|
+
else if (!PH.page.ok) c.innerHTML = `<span class="label">Now</span><p class="nodef err" role="alert">Your day ${esc(said(PH.page))}</p>`;
|
|
739
|
+
else { const mo = momentOf({ today: PH.page.today || [], needs: pOwn(), now: new Date() }); c.dataset.moment = mo.kind; c.innerHTML = phMoment(mo); }
|
|
740
|
+
if (focus) { const f = $(focus, c); if (f) f.focus(); }
|
|
741
|
+
}
|
|
742
|
+
async function readPhone(force) {
|
|
743
|
+
if (!phoneOn()) { drawPhone(); return; }
|
|
744
|
+
PH.page = await briefPage(force);
|
|
745
|
+
const mo = PH.page.ok ? momentOf({ today: PH.page.today || [], needs: pOwn(), now: new Date() }) : null;
|
|
746
|
+
if (mo && ['work', 'recap', 'night'].includes(mo.kind) && (force || !PH.day || Date.now() - PH.dayAt > 300000)) { PH.day = await getj('/api/phone-day'); PH.dayAt = Date.now(); }
|
|
747
|
+
drawPhone();
|
|
748
|
+
}
|
|
749
|
+
async function phonePress(e) {
|
|
750
|
+
const b = e.target.closest('[data-pha]'); if (!b || BUSY) return;
|
|
751
|
+
const act = b.dataset.pha, id = b.dataset.id;
|
|
752
|
+
if (act === 'phopen') {
|
|
753
|
+
const m = ((PH.page && PH.page.today) || []).find((x) => x.id === id); if (!m) return;
|
|
754
|
+
if (!(await week.openToday({ at: Date.parse(m.start), title: m.title }))) toast('The calendar PMOS holds does not list that meeting, so it could not be opened.');
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
const n = pOwn().find((x) => x.id === id) || (PH.dec.get(id)) || (((PH.page && PH.page.today) || []).flatMap((x) => x.before || []).map((x) => ({ id: x.id, headline: x.title, label: 'Before you go', kind: 'before' })).find((x) => x.id === id));
|
|
758
|
+
if (!n) return;
|
|
759
|
+
BUSY = id; b.disabled = true; delete PH.err[id];
|
|
760
|
+
const r = await pmPost(act === 'phdone' ? '/api/pm-items/done' : '/api/pm-items/reopen', { id });
|
|
761
|
+
BUSY = '';
|
|
762
|
+
if (!r || r.ok === false) { PH.err[id] = 'That did not go through' + (r && r.error ? ': ' + r.error : '.'); drawPhone(`.phfit[data-id="${CSS.escape(id)}"] button`); return; }
|
|
763
|
+
if (act === 'phdone') { PH.dec.set(id, n); toast('Done: ' + n.headline); } else { PH.dec.delete(id); toast('Reopened: ' + n.headline); }
|
|
764
|
+
drawPhone(`.phfit[data-id="${CSS.escape(id)}"] button`);
|
|
765
|
+
await readPhone(true); drawPhone(`.phfit[data-id="${CSS.escape(id)}"] button`);
|
|
766
|
+
}
|
|
767
|
+
function mountPhone() {
|
|
768
|
+
const anchor = $('#hMoves') && $('#hMoves').closest('.cols2'); if (!anchor) return;
|
|
769
|
+
const s = document.createElement('section');
|
|
770
|
+
s.className = 'card rise phm'; s.id = 'phoneCard'; s.hidden = true; s.setAttribute('aria-label', 'Now'); s.style.setProperty('--d', '5');
|
|
771
|
+
anchor.insertAdjacentElement('beforebegin', s);
|
|
772
|
+
s.addEventListener('click', phonePress);
|
|
773
|
+
const mq = matchMedia('(max-width:640px)'), again = () => { if (!document.hidden) readPhone(); };
|
|
774
|
+
(mq.addEventListener ? mq.addEventListener('change', again) : mq.addListener(again));
|
|
775
|
+
document.addEventListener('visibilitychange', again);
|
|
776
|
+
setInterval(() => { if (!document.hidden && phoneOn()) { PH.page && PH.page.ok ? drawPhone() : null; readPhone(true); } }, 60000);
|
|
777
|
+
readPhone();
|
|
778
|
+
}
|
|
779
|
+
mountPhone();
|
|
780
|
+
|
|
687
781
|
/* ── load ───────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
688
782
|
let readTimer = null, AROUND = false;
|
|
689
783
|
const ago = (ms) => { const m = Math.round(ms / 60000); return m < 1 ? 'just now' : m < 90 ? m + ' min ago' : Math.round(m / 60) + ' h ago'; };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Initiative premium-phone-card: the phone moment card on the premium Briefing at 640px and below, against the real server with the clock set per moment; Done and Reopen press the real routes.",
|
|
3
|
+
"seconds": {
|
|
4
|
+
"premium-phone-card-test.js": 90
|
|
5
|
+
},
|
|
6
|
+
"panels": [
|
|
7
|
+
"premium-phone-card-test.js"
|
|
8
|
+
]
|
|
9
|
+
}
|