create-pmos 0.365.0 → 0.367.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 +35 -30
- 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/briefing-premium-adddoc-test.js +1 -0
- package/workspace/briefing-premium-work-test.js +16 -4
- package/workspace/changelog.json +34 -0
- package/workspace/guide/briefing-premium.md +4 -2
- package/workspace/guide/data-freshness.md +10 -0
- package/workspace/lib/first-input.js +19 -1
- package/workspace/lib/harness-health.js +10 -1
- package/workspace/lib/refresh-run.js +71 -7
- package/workspace/lib/routes-sources.js +17 -4
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-briefing-depth-test.js +6 -5
- package/workspace/premium-work-depth-test.js +16 -14
- package/workspace/public/pm/premium-board.js +1 -1
- package/workspace/public/pm/premium-shell.js +46 -9
- package/workspace/public/pm/premium-work.js +27 -12
- package/workspace/public/pm/premium.css +31 -6
- package/workspace/public/pm/premium.js +11 -2
- package/workspace/public/premium-work.html +2 -2
- package/workspace/server.js +20 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.367.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": {
|
|
@@ -32,6 +32,40 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.367.0",
|
|
37
|
+
"at": "2026-10-21T02:01:19.184Z",
|
|
38
|
+
"f": 2,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 969,
|
|
42
|
+
"t": "My work's first screen has one solid button (calmer first screen 1/5)",
|
|
43
|
+
"s": "My work's first screen has one solid button (calmer first screen 1/5)"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"n": 968,
|
|
47
|
+
"t": "A prompt waits for Claude Code's input box; one brief ends one run with its real count",
|
|
48
|
+
"s": "A Claude Code prompt is typed only once the agent is ready."
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"v": "0.366.0",
|
|
54
|
+
"at": "2026-10-21T01:38:19.286Z",
|
|
55
|
+
"f": 2,
|
|
56
|
+
"prs": [
|
|
57
|
+
{
|
|
58
|
+
"n": 971,
|
|
59
|
+
"t": "Every premium dialog has the short head on a phone",
|
|
60
|
+
"s": "Every premium dialog has the short head on a phone"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"n": 973,
|
|
64
|
+
"t": "Refresh all reads the sources first, then writes the Briefing (briefing-source-flow, slice 3)",
|
|
65
|
+
"s": "Refresh all is one ordered run on the server, following Wawan's rule (2026-10-21): derived content is rebuilt only after its sources are fresh."
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
35
69
|
{
|
|
36
70
|
"v": "0.365.0",
|
|
37
71
|
"at": "2026-10-21T01:17:24.947Z",
|
|
@@ -287,35 +321,6 @@
|
|
|
287
321
|
"s": "Each of those sits behind one ⓘ, with the words unchanged."
|
|
288
322
|
}
|
|
289
323
|
]
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
"v": "0.347.0",
|
|
293
|
-
"at": "2026-10-20T06:13:15.916Z",
|
|
294
|
-
"f": 2,
|
|
295
|
-
"prs": [
|
|
296
|
-
{
|
|
297
|
-
"n": 945,
|
|
298
|
-
"t": "Background runs yield to working chat and /goal sessions; no new draft while one waits",
|
|
299
|
-
"s": "A chat or /goal session that is working counts toward the governor's parallel cap (3 while working, 8 while away), so background runs wait for it."
|
|
300
|
-
}
|
|
301
|
-
]
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
"v": "0.346.0",
|
|
305
|
-
"at": "2026-10-20T05:59:24.111Z",
|
|
306
|
-
"f": 2,
|
|
307
|
-
"prs": [
|
|
308
|
-
{
|
|
309
|
-
"n": 942,
|
|
310
|
-
"t": "Artifact, Google Doc and Confluence links in a premium chat panel open beside the conversation",
|
|
311
|
-
"s": "A Google Doc or Confluence link, in Claude's words or in a page the viewer shows, opens as a tab beside the conversation."
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
"n": 943,
|
|
315
|
-
"t": "Text fields no longer zoom the premium pages on a phone",
|
|
316
|
-
"s": "On a touch screen every premium text field (input, textarea, select) uses 16 px type, so focus does not zoom the page."
|
|
317
|
-
}
|
|
318
|
-
]
|
|
319
324
|
}
|
|
320
325
|
]
|
|
321
326
|
}
|
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-21T02:01:16Z"}
|
|
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-21T02:01:16Z"}
|
|
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-21T02:01:16Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -161,6 +161,7 @@ const PAGES = {
|
|
|
161
161
|
if (!a[n] || !c[n]) { diffs.push(n + ' missing'); continue; }
|
|
162
162
|
for (const k of Object.keys(a[n])) {
|
|
163
163
|
if (k === 'cw' || k === 'sh' || ((n === 'ttl' || n === 'pane' || n === 'paper') && (k === 'width' || k === 'height'))) continue; // the dialog's columns size to the conversation beside the form, which differs
|
|
164
|
+
if (w < 1000 && n === 'ttl' && (k === 'fontSize' || k === 'letterSpacing' || k === 'lineHeight')) continue; // on a phone every dialog has the compact head's smaller title (Wawan, 2026-10-20), which the mockup predates
|
|
164
165
|
const geom = k === 'width' || k === 'height';
|
|
165
166
|
if (geom ? Math.abs(a[n][k] - c[n][k]) > 14 : a[n][k] !== c[n][k]) diffs.push(`${n}.${k} ${a[n][k]} | ${c[n][k]}`);
|
|
166
167
|
}
|
|
@@ -20,7 +20,7 @@ const BASE = T.BASE;
|
|
|
20
20
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
21
21
|
const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
22
22
|
/* the Work queue shows one tab at a time: bring up the tab that holds a row before pressing it (each press redraws the tab row, so the button is found again) */
|
|
23
|
-
const showKey = (pg, key) => pg.evaluate((key) => { const has = () => document.querySelector(`#qBody .wrow[data-key="${key}"], #waitBody .wrow[data-key="${key}"]`); if (has()) return true; for (const k of [...document.querySelectorAll('#qTabs .qtb')].map((b) => b.dataset.tab)) { document.querySelector(`#qTabs [data-tab="${k}"]`).click(); if (has()) return true; } return false; }, key);
|
|
23
|
+
const showKey = (pg, key) => pg.evaluate((key) => { const has = () => document.querySelector(`#qBody .wrow[data-key="${key}"], #waitBody .wrow[data-key="${key}"]`); if (has()) return true; for (const k of [...document.querySelectorAll('#qTabs .qtb, #qMenu .qtb')].map((b) => b.dataset.tab)) { document.querySelector(`#qTabs [data-tab="${k}"], #qMenu [data-tab="${k}"]`).click(); if (has()) return true; } return false; }, key);
|
|
24
24
|
const results = [];
|
|
25
25
|
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
|
|
26
26
|
/* the dialog's fields (premium-simple-ui): a field opens its panel; When holds Today, Not yet, Not before and Someday */
|
|
@@ -93,10 +93,14 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
93
93
|
ok('M10 the header says what is real and that Jira and Slack appear only when read', /^Real data · as of 18:05/.test(await txt('#snap')) && /only when an agent session has read them/.test(await txt('#snap')));
|
|
94
94
|
|
|
95
95
|
/* M4 the Work queue: one card, a tab for each place a thing waits */
|
|
96
|
-
const qtab = (k) => p.click(`#qTabs [data-tab="${k}"]`);
|
|
97
|
-
const q = await p.evaluate(() => ({ tabs: [...document.querySelectorAll('#qTabs .qtb')].map((b) => b.textContent), sel: [...document.querySelectorAll('#qTabs [aria-selected="true"]')].map((b) => b.dataset.tab), tops: new Set([...document.querySelectorAll('#qTabs .qtb')].map((b) => Math.round(b.getBoundingClientRect().top))).size, cap: document.querySelector('#qCap').textContent, first: [...document.querySelectorAll('.tgf')].map((x) => x.closest('.wrow').dataset.key), titles: [...document.querySelectorAll('#qBody .wtit')].map((x) => x.textContent.replace('Do this first', '')), chips: [...document.querySelectorAll('#qBody .due')].map((x) => x.textContent), od: [...document.querySelectorAll('#qBody .due.od')].length, ck: [...document.querySelectorAll('#qBody .wck')].map((b) => Math.round(b.getBoundingClientRect().height)), cols: getComputedStyle(document.querySelector('#qBody')).gridTemplateColumns.split(' ').length, old: ['#plate', '#agCard', '#trayCard'].filter((x) => document.querySelector(x)), title: document.querySelector('#hQueue').textContent }));
|
|
96
|
+
const qtab = async (k) => { if (!(await p.locator(`#qTabs [data-tab="${k}"]`).count())) await p.click('#qMore'); await p.click(`#qTabs [data-tab="${k}"], #qMenu [data-tab="${k}"]`); };
|
|
97
|
+
const q = await p.evaluate(() => ({ tabs: [...document.querySelectorAll('#qTabs .qtb')].map((b) => b.textContent), rest: [...document.querySelectorAll('#qMenu .qtb')].map((b) => b.textContent), menuShut: document.querySelector('#qMenu').hidden && document.querySelector('#qMore').getAttribute('aria-expanded') === 'false', sel: [...document.querySelectorAll('#qTabs [aria-selected="true"]')].map((b) => b.dataset.tab), tops: new Set([...document.querySelectorAll('#qTabs .qtb')].map((b) => Math.round(b.getBoundingClientRect().top))).size, cap: document.querySelector('#qCap').textContent, first: [...document.querySelectorAll('.tgf')].map((x) => x.closest('.wrow').dataset.key), titles: [...document.querySelectorAll('#qBody .wtit')].map((x) => x.textContent.replace('Do this first', '')), chips: [...document.querySelectorAll('#qBody .due')].map((x) => x.textContent), od: [...document.querySelectorAll('#qBody .due.od')].length, ck: [...document.querySelectorAll('#qBody .wck')].map((b) => Math.round(b.getBoundingClientRect().height)), cols: getComputedStyle(document.querySelector('#qBody')).gridTemplateColumns.split(' ').length, old: ['#plate', '#agCard', '#trayCard'].filter((x) => document.querySelector(x)), title: document.querySelector('#hQueue').textContent }));
|
|
98
98
|
ok('M4 one Work queue card replaces On your plate, With agents and the tray', q.title === 'Work queue' && q.old.length === 0, JSON.stringify(q));
|
|
99
|
-
ok('M4
|
|
99
|
+
ok('M4 Today and Inbox sit in one pill row with their counts; Upcoming, Someday, Kept and Done wait under a shut More (no Agents tab); the card opens on Today', q.tabs.join() === 'Today3,Inbox4' && q.rest.join() === 'Upcoming2,Someday1,Kept0,Done0' && q.menuShut && q.sel.join() === 'today' && q.tops === 1, JSON.stringify(q));
|
|
100
|
+
await p.click('#qMore'); await p.click('#qMenu [data-tab="someday"]');
|
|
101
|
+
const mo = await p.evaluate(() => ({ row: [...document.querySelectorAll('#qTabs .qtb')].map((b) => b.dataset.tab), sel: document.querySelector('#qTabs [aria-selected="true"]').dataset.tab, shut: document.querySelector('#qMenu').hidden, n: document.querySelectorAll('#qBody .wrow').length }));
|
|
102
|
+
ok('M4 a tab picked under More takes its place in the row, is chosen, and the menu shuts', mo.row.join() === 'today,inbox,someday' && mo.sel === 'someday' && mo.shut && mo.n === 1, JSON.stringify(mo));
|
|
103
|
+
await qtab('today');
|
|
100
104
|
ok('M4 Today holds its rows in two columns, with a due chip only where a date was set; the overdue one says so', q.cols === 2 && q.titles.length === 3 && q.titles[0] === 'Sign off the fit-out contractor shortlist' && q.chips.join() === 'Overdue · 15 Oct,Today' && q.od === 1, JSON.stringify(q));
|
|
101
105
|
ok('M4 "Do this first" tags the overdue item only, and a check circle is 44 px', q.first.length === 1 && q.first[0] === 'work:wbs:alpha:4.2' && q.ck.length === 3 && q.ck.every((h) => h >= 44), JSON.stringify([q.first, q.ck]));
|
|
102
106
|
const dec = await p.evaluate(() => { const b = document.querySelector('#qBody .wrow[data-key="work:wbs:alpha:4.2"] .wck'); const r = b.closest('.wrow'); return { dec: b.classList.contains('dec'), eye: !!b.querySelector('circle'), label: b.getAttribute('aria-label'), first: r.classList.contains('first'), tagBlock: getComputedStyle(r.querySelector('.tgf')).display, bar: getComputedStyle(r).boxShadow !== 'none', others: [...document.querySelectorAll('#qBody .wck')].filter((x) => x !== b).every((x) => !x.classList.contains('dec')) }; });
|
|
@@ -136,6 +140,9 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
136
140
|
await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on'))); A.setModel(mk());
|
|
137
141
|
const n0 = A.posts.length; await p.fill('#capIn', ' '); await p.press('#capIn', 'Enter'); await sleep(200);
|
|
138
142
|
ok('M3 an empty line is not posted', A.posts.length === n0 && /Write one line/.test(await txt('#capHint')));
|
|
143
|
+
ok('M3 a message about a press stays on screen after the box loses focus', await p.evaluate(() => { document.activeElement.blur(); return getComputedStyle(document.querySelector('#capHint')).display !== 'none'; }));
|
|
144
|
+
{ const R2 = await open({ w: 390, h: 844 }); const hid = await R2.page.evaluate(() => getComputedStyle(document.querySelector('#capHint')).display); await R2.page.focus('#capIn'); const shown = await R2.page.evaluate(() => getComputedStyle(document.querySelector('#capHint')).display);
|
|
145
|
+
ok('M3 the hint under the add box is hidden on load and shows while the box has focus (premium-calmer-first-screen)', hid === 'none' && shown !== 'none', JSON.stringify([hid, shown])); await R2.ctx.close(); }
|
|
139
146
|
await qtab('today'); // a line with no date opened the queue on Inbox
|
|
140
147
|
|
|
141
148
|
/* M8 presses from a check circle, and from the dialog */
|
|
@@ -237,6 +244,11 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
237
244
|
const geo = () => q.evaluate(() => { const r = document.querySelector('#dlg').getBoundingClientRect(); return { l: Math.round(r.left), w: Math.round(r.width), vw: innerWidth }; });
|
|
238
245
|
const g1 = await geo();
|
|
239
246
|
ok(`M12 at 390 px (${theme}) the dialog opens on Detail at the full width of the screen`, g1.l === 0 && g1.w === g1.vw, JSON.stringify(g1));
|
|
247
|
+
/* the compact head (Wawan's phone, 2026-10-20): every dialog opens with a short head, so the detail gets most of the screen; a press on the title shows it whole */
|
|
248
|
+
const hd = () => q.evaluate(() => { const t = document.querySelector('#dTitle'), lh = parseFloat(getComputedStyle(t).lineHeight); return { cmp: document.querySelector('#dlg').classList.contains('cmp'), eye: getComputedStyle(document.querySelector('#dEye')).display, lines: Math.round(t.getBoundingClientRect().height / lh), top: Math.round(document.querySelector('#dOut').getBoundingClientRect().top), full: document.querySelector('#dlg').classList.contains('tfull') }; });
|
|
249
|
+
const h1 = await hd(); await q.click('#dTitle'); const h2 = await hd(); await q.click('#dTitle'); const h3 = await hd();
|
|
250
|
+
ok(`M12 at 390 px (${theme}) the item dialog has the compact head: no eyebrow, a title of two lines at most, the detail starting in the top third`, h1.cmp && h1.eye === 'none' && h1.lines <= 2 && h1.top < 844 / 3, JSON.stringify(h1));
|
|
251
|
+
ok(`M12 at 390 px (${theme}) a press on the title shows the whole head, and a second press clamps it again`, h2.full && h2.eye !== 'none' && !h3.full && h3.eye === 'none', JSON.stringify([h2, h3]));
|
|
240
252
|
await q.click('#dTabs [data-t="chat"]'); await sleep(900);
|
|
241
253
|
const g2 = await geo();
|
|
242
254
|
ok(`M12 at 390 px (${theme}) with the conversation brought in it is still full width`, g2.l === 0 && g2.w === g2.vw && await q.evaluate(() => document.querySelector('#dTabs [data-t="chat"]').getAttribute('aria-pressed') === 'true' && getComputedStyle(document.querySelector('#dBody')).display !== 'none' && getComputedStyle(document.querySelector('#dOut')).display === 'none'), JSON.stringify(g2));
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.367.0",
|
|
4
|
+
"at": "2026-10-21T02:01:19.184Z",
|
|
5
|
+
"f": 2,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 969,
|
|
9
|
+
"t": "My work's first screen has one solid button (calmer first screen 1/5)",
|
|
10
|
+
"s": "My work's first screen has one solid button (calmer first screen 1/5)"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"n": 968,
|
|
14
|
+
"t": "A prompt waits for Claude Code's input box; one brief ends one run with its real count",
|
|
15
|
+
"s": "A Claude Code prompt is typed only once the agent is ready."
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"v": "0.366.0",
|
|
21
|
+
"at": "2026-10-21T01:38:19.286Z",
|
|
22
|
+
"f": 2,
|
|
23
|
+
"prs": [
|
|
24
|
+
{
|
|
25
|
+
"n": 971,
|
|
26
|
+
"t": "Every premium dialog has the short head on a phone",
|
|
27
|
+
"s": "Every premium dialog has the short head on a phone"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"n": 973,
|
|
31
|
+
"t": "Refresh all reads the sources first, then writes the Briefing (briefing-source-flow, slice 3)",
|
|
32
|
+
"s": "Refresh all is one ordered run on the server, following Wawan's rule (2026-10-21): derived content is rebuilt only after its sources are fresh."
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
2
36
|
{
|
|
3
37
|
"v": "0.365.0",
|
|
4
38
|
"at": "2026-10-21T01:17:24.947Z",
|
|
@@ -269,7 +269,7 @@ My work is the second place on the rail, at `/premium-work.html`. It reads the l
|
|
|
269
269
|
|
|
270
270
|
**Decide.** An inbox row shows a **Decide** button that opens the item, where you give it a day, put it in Someday or drop it.
|
|
271
271
|
|
|
272
|
-
**Work queue.** One full-width card holds everything you sort, as tabs
|
|
272
|
+
**Work queue.** One full-width card holds everything you sort, as tabs: **Today** and **Inbox** in the row, and **Upcoming**, **Someday**, **Kept** and **Done** under **More**. Each tab shows its count, and the card opens on Today (or on the first tab that has something). A tab you pick under More takes its place in the row while it is chosen. Rows sit in two columns, one column on a narrow screen. The left and right arrow keys move between tabs. **Inbox** shows what is new from Jira and Slack first, then what you added. **Kept** gathers items you pressed Keep on, and **Done** shows what you added and marked done in the last 7 days. An item shows in one place tab only. Kept is a mark on an item, not a place, so a kept item also shows where it was placed. The card replaces the earlier On your plate, With agents and tray cards.
|
|
273
273
|
|
|
274
274
|
**The item dialog.** The conversation gets the whole body. Two controls sit beside the Detail / Conversation switch, on both tabs: **Edit ▾** and **Done**. On a wide screen the row also shows where the item is. **Edit ▾** opens a sheet with one labelled field for each choice. Each field shows its value from the record and opens when you press it: **When** (Today, Later today, Tomorrow, Next week, Not before a date, Someday), **Waiting on**, **Who does it** (the steps) and **Priority · Due** (the edit panel). **Keep it** and **Drop it** are at the bottom of the sheet. The sheet closes when you press Edit again, press outside it, or press Escape. **Waiting on** is not shown when the item cannot wait and waits on nobody. An agent that only can draft is a field in the sheet. An agent that is working, has a draft, or stopped stays in the conversation, because it needs you. Every action stays reachable.
|
|
275
275
|
|
|
@@ -292,7 +292,7 @@ My work is the second place on the rail, at `/premium-work.html`. It reads the l
|
|
|
292
292
|
- **Not before a date** (in When) hides the item until a day: Tomorrow, Monday, In a week, or a date you pick. **Clear the date** brings it back.
|
|
293
293
|
- **Someday** (in When) sends the item to Someday. On an item already there, **Bring back from Someday** brings it back.
|
|
294
294
|
- **The agent on an item** appears at the top of the dialog when the item has one. A *suggestion* is a field, **The agent**, that opens to show what the agent will do (you can change the words) and **Let the agent draft this**. A *queued or working* agent shows its state and **Stop**. A *ready* draft is labelled the agent's and unchecked. **Post it to Jira** (or Slack, email and so on, from where the item came) first asks, names the place, shows exactly the text and posts nothing until you press **Post it now**. **Edit the draft** lets you change the text, and the post sends your text. **Send it back with a note** needs a note. **Mark it done** posts nothing. A failed run says why and offers **Try again** and **Stop**. An item you added has no place to post to, so it has no Post.
|
|
295
|
-
- **Focus**
|
|
295
|
+
- **Focus** is a chip in the Work queue's head that says how many things PMOS suggests for today (at most three), grouped by the job they serve. The rows of the first suggestion carry a quiet "Suggested focus" tag. Press **Focus** to see them with Accept, Not today and Clear, and your jobs with their open counts, and **Add a job** takes one line (`when …, I want …, so …`). An accepted group tags its Today rows with Focus. The hint under the add line shows while you type there. On a phone, a row's agent hint is a ✦ at the row's end; the row's dialog has the full hint. Focus starts empty each day. Editing and deleting a job stay in the console.
|
|
296
296
|
- **Keys and swipe** work on the rows of the Work queue. J and K move between rows. The right arrow, or a drag to the right past 90 px, does Done on a Today row and In Today elsewhere; the left arrow, or a drag to the left, does Tomorrow on a Today row and Someday elsewhere. A Today row whose draft is ready offers Review on the right. A row in Waiting has none. Each one offers Undo, and under reduced motion the row does not slide.
|
|
297
297
|
|
|
298
298
|
Not drawn, because no record backs them: answers and ideas an agent files by itself, "fold the laundry", the "Next day" demo control, shelf life and "composts soon", the week bars and the capacity figure, and the mockup's suggested place on an inbox item.
|
|
@@ -378,6 +378,8 @@ The premium Briefing is the default page: `/` and `/index.html` open it. The con
|
|
|
378
378
|
|
|
379
379
|
## The dialog on a phone and the document sheet's views
|
|
380
380
|
|
|
381
|
+
**The short head.** On a phone or tablet every dialog has a short head: no category line, a title of two lines at most and a sub line of one line. The **Sessions** chip shows only its dot and count. Press the title to see the whole title, the category line and the whole sub line; press it again to make the head short. When you scroll the detail, the head keeps only the title and the tools, so the detail gets most of the screen. Scroll back to the top to see the sub line and the Detail and Conversation switch again.
|
|
382
|
+
|
|
381
383
|
On a phone or tablet (under 1000 px) every dialog opens on **Detail**. On a touch screen every text field, the reply box included, uses 16 px type, so typing in one does not zoom the page. A card's label and value rows (for example **Blocked at** and **Initiative** in "The way through") stay as two columns, one row per label. A **Detail / Conversation** switch sits under the title, and **Open it** at the foot of Detail brings the conversation when an action waits there. The header holds only **Close**. A document sheet picks its view (**Read**, **Edit**, **Proposals**, **Edit log**, **Health**, **Relations**) from one button with a menu.
|
|
382
384
|
|
|
383
385
|
**ⓘ explanations.** The text that says what a page or card reads and records sits behind one ⓘ button, with the same words. Each premium page (Briefing, My work, Board, Initiative, Insights) ends with **ⓘ About this page**. The Board's **Metrics** card and the Insights **Board measures** card show only their need-a-look count, for example "2 of 4 need a look.", with an ⓘ next to the heading. If the measures cannot be read, the reason stays in view. On Insights, the Ask line and the chart count have their own ⓘ. Press ⓘ again to fold the text away.
|
|
@@ -49,6 +49,16 @@ The Briefing uses your tools as sources: Mail, Slack, Wispr Flow, Jira mentions,
|
|
|
49
49
|
|
|
50
50
|
The Sources list shows them as one row, **Your tools**. Its time is the oldest read among the tools that are on, so the row is never fresher than its oldest tool. The row is old after 8 hours. A tool that is on and was never read keeps the row at **not read yet**, and the row names the tools that were not reached and why. **Refresh** on the row starts the skill.
|
|
51
51
|
|
|
52
|
+
## Refresh all: the sources first, then the Briefing
|
|
53
|
+
|
|
54
|
+
**Refresh all** in Sources is one run, in a fixed order:
|
|
55
|
+
|
|
56
|
+
1. It reads every source that is on in Settings › Data refresh: Calendar, Jira, work assigned to you, tracker files and Your tools. It also rebuilds the repository and initiative facts on this machine.
|
|
57
|
+
2. When all of them have ended, it writes the Briefing again from those reads. A source that failed keeps its last read, and the Briefing uses that read. The Briefing waits at most 30 minutes for a source.
|
|
58
|
+
3. When the Briefing is saved, the Briefing page reads it again.
|
|
59
|
+
|
|
60
|
+
Sources says which step the run is on. Only one run goes at a time: a second press, or a press in another tab, joins the run that is going. If the Briefing is being written when you press, it is written once more after the new reads. A run that has not ended after 3 hours is over, and the next press starts a new one. **Refresh** on one row still reads only that source.
|
|
61
|
+
|
|
52
62
|
The skill saves its reads with this command:
|
|
53
63
|
|
|
54
64
|
- `pmos source save --file <reads.json>` saves one record per tool. A record that is off or not reached says so. A field past its limit refuses the whole file, and nothing is saved.
|
|
@@ -21,6 +21,12 @@
|
|
|
21
21
|
* each of CHECK_MS. When it still holds the prompt, Enter is pressed again. When it still does after the last check, the
|
|
22
22
|
* delivery ends as 'unsent' so the caller can say so instead of leaving the session idle. Without `screen` (a plain shell, a
|
|
23
23
|
* test) the plan is as before.
|
|
24
|
+
*
|
|
25
|
+
* THE GATE (2026-10-21, the microsites brief). Typed before Claude Code had drawn its box, only the first 178 characters of the
|
|
26
|
+
* prompt reached it (one tmux send-keys chunk), so pressing Enter again would have sent half a prompt. When the caller passes
|
|
27
|
+
* `wait` (true while the agent is not ready for typing yet), the prompt is not typed while it is true, until MAX_MS. The server
|
|
28
|
+
* answers it from the pane's foreground command: the login shell that starts the agent, or Claude Code with no input box drawn
|
|
29
|
+
* yet, means wait. Any other program (a test's stand-in agent) is typed into as before.
|
|
24
30
|
* The clock and the timers are injected, so the plan is tested without waiting. No I/O of its own: it writes only through
|
|
25
31
|
* `write` and reads only through `screen`.
|
|
26
32
|
*/
|
|
@@ -32,6 +38,7 @@ const MAX_MS = 20000;
|
|
|
32
38
|
const POLL_MS = 200;
|
|
33
39
|
const SUBMIT_MS = 500;
|
|
34
40
|
const RETRY_MS = 1500;
|
|
41
|
+
const GATE_EVERY_MS = 1000; // how often `wait` is asked while the prompt waits for the agent
|
|
35
42
|
const CHECK_MS = Object.freeze([4000, 12000]); // after the Enter: read the input box at these delays, Enter again if it still holds the prompt
|
|
36
43
|
const PASTE_ON = '\x1b[?2004h';
|
|
37
44
|
const PASTE_OFF = '\x1b[?2004l';
|
|
@@ -86,6 +93,8 @@ function deliver(s, input, o = {}) {
|
|
|
86
93
|
const done = typeof o.onDone === 'function' ? o.onDone : () => {};
|
|
87
94
|
const screenFn = typeof o.screen === 'function' ? o.screen : null;
|
|
88
95
|
const screen = () => { try { return String(screenFn() || ''); } catch { return ''; } };
|
|
96
|
+
const waitFn = typeof o.wait === 'function' ? o.wait : null;
|
|
97
|
+
let gateAt = -Infinity; let gated = !!waitFn;
|
|
89
98
|
const { text, enter } = splitInput(input);
|
|
90
99
|
if (!s || (!text && !enter)) { done('nothing'); return; }
|
|
91
100
|
const t0 = now();
|
|
@@ -107,7 +116,16 @@ function deliver(s, input, o = {}) {
|
|
|
107
116
|
const tick = () => {
|
|
108
117
|
if (!alive()) { done('gone'); return; }
|
|
109
118
|
if (!firstOut && (s.lastOutputAt || 0) > base) firstOut = s.lastOutputAt;
|
|
110
|
-
|
|
119
|
+
const t = now();
|
|
120
|
+
if (!ready({ now: t, t0, lastOutputAt: s.lastOutputAt || 0, firstOut })) { later(tick, POLL_MS); return; }
|
|
121
|
+
// the gate is read at most once a second (it is a tmux spawn) and never past MAX_MS
|
|
122
|
+
if (gated && t - t0 < MAX_MS) {
|
|
123
|
+
if (t - gateAt < GATE_EVERY_MS) { later(tick, POLL_MS); return; }
|
|
124
|
+
gateAt = t;
|
|
125
|
+
let w = false; try { w = !!waitFn(); } catch { w = false; }
|
|
126
|
+
if (w) { later(tick, POLL_MS); return; }
|
|
127
|
+
gated = false;
|
|
128
|
+
}
|
|
111
129
|
const paste = pasteOn(s.buf);
|
|
112
130
|
if (text) write(paste ? '\x1b[200~' + text + '\x1b[201~' : text);
|
|
113
131
|
if (!enter) { done('typed'); return; }
|
|
@@ -28,6 +28,7 @@ const TICK_LATE_MS = 5 * MIN; // the background tick runs every minute
|
|
|
28
28
|
const BRIEF_LATE_MS = 45 * MIN; // a brief takes a few minutes; 45 leaves room for the sources it refreshes first (at most 30)
|
|
29
29
|
const MISSED_MS = 60 * MIN; // a source slot with no run an hour on was missed
|
|
30
30
|
const RANK = { ok: 0, warn: 1, bad: 2 };
|
|
31
|
+
const SIGNED_OUT = /signed out|failed to authenticate/i; // lib/headless.js SIGNED_OUT_WHY, or the CLI's own line
|
|
31
32
|
|
|
32
33
|
const pad = (n) => String(n).padStart(2, '0');
|
|
33
34
|
const hm = (ms) => { const d = new Date(ms); return pad(d.getHours()) + ':' + pad(d.getMinutes()); };
|
|
@@ -62,11 +63,14 @@ function of({ now, settings, state = {}, log, briefAt = 0, sessions = [], lastTi
|
|
|
62
63
|
add('bad', 'brief', why);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
// each skill source: a failed last run, or a slot that passed with no run
|
|
66
|
+
// each skill source: a failed last run, or a slot that passed with no run. Sources that failed because Claude is signed out
|
|
67
|
+
// are one issue with one action, not one red line each.
|
|
68
|
+
const signedOut = [];
|
|
66
69
|
for (const src of R.SOURCES.filter((x) => x.run === 'skill' && x.id !== 'brief')) {
|
|
67
70
|
const x = set.sources[src.id]; if (!x || !x.on) continue;
|
|
68
71
|
const last = runs(src.id)[0];
|
|
69
72
|
if (last && last.end_at && ['failed', 'interrupted'].includes(last.result) && !(state[src.id] || {}).retry_at) {
|
|
73
|
+
if (SIGNED_OUT.test(last.error || '')) { signedOut.push({ label: src.label, at: ms(last.end_at) }); continue; }
|
|
70
74
|
add('bad', 'failed:' + src.id, `${src.label} ${last.result === 'interrupted' ? 'was stopped' : 'failed'} at ${hm(ms(last.end_at))}${last.error ? ': ' + clip(last.error, 90) : '.'}`);
|
|
71
75
|
continue;
|
|
72
76
|
}
|
|
@@ -77,6 +81,11 @@ function of({ now, settings, state = {}, log, briefAt = 0, sessions = [], lastTi
|
|
|
77
81
|
if (ran < slot && !Object.keys(st.open || {}).length) add('warn', 'missed:' + src.id, `${src.label} missed its ${hm(slot)} read.`);
|
|
78
82
|
}
|
|
79
83
|
|
|
84
|
+
if (signedOut.length) {
|
|
85
|
+
const names = signedOut.map((x) => x.label);
|
|
86
|
+
const list = names.length === 1 ? names[0] : names.slice(0, -1).join(', ') + ' and ' + names[names.length - 1];
|
|
87
|
+
add('bad', 'signedout', `Claude could not sign in at ${hm(Math.max(...signedOut.map((x) => x.at)))}, so ${list} did not refresh. Press Refresh all. If it fails again, open Terminal, run claude and type /login.`);
|
|
88
|
+
}
|
|
80
89
|
const sync = runs('sync')[0];
|
|
81
90
|
if (set.sources.sync && set.sources.sync.on && sync && sync.result === 'failed') {
|
|
82
91
|
const gone = /repository '(?:https?:\/\/[^/]+\/)?([^']+?)(?:\.git)?\/?' not found/.exec(sync.error || '');
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* const run = create(host)
|
|
5
5
|
* run.tick(now) each minute: start the skill sources that are due, write skip lines, end lost runs, prune once a day
|
|
6
6
|
* run.started(session) · run.ended(session) every background session passes here; one with a refresh origin is logged (start, end)
|
|
7
|
-
* run.briefDone(got) a morning brief arrived:
|
|
7
|
+
* run.briefDone(got) a morning brief arrived: the first open brief run is done (the brief session stays open after it submits)
|
|
8
8
|
* run.codeRun(id, { result, got, error, took_ms, trigger }) one line pair for a run with no session (signals, repository, Git sync)
|
|
9
9
|
* run.jobGate(id, now) may job `id` run its tick now (off, or an input still running)
|
|
10
10
|
* run.runNow(id, { ws, withInputs }) Refresh now; with inputs, the old ones first and this one once they end
|
|
11
|
+
* run.refreshAll(ws) · run.allState() Refresh all (briefing-source-flow, slice 3): read every source that is on, then write the
|
|
12
|
+
* Briefing from those reads. One run at a time: a second press joins the run that is going.
|
|
11
13
|
* run.rows(ws) · run.setSource(id, patch) · run.setRules(patch) · run.ensureOn(id, ws) · run.settings() · run.log()
|
|
12
14
|
*
|
|
13
15
|
* lib/refresh.js decides; this file holds the state between minutes and calls the host. The host is server.js:
|
|
@@ -17,10 +19,15 @@
|
|
|
17
19
|
* setDayCheckEvery(every), setRepoWatch(on), warn(what, e) }
|
|
18
20
|
* Nothing here calls out of this machine: a skill source's run is the PM's own agent session, with the PM's connections.
|
|
19
21
|
*/
|
|
22
|
+
const fs = require('fs');
|
|
23
|
+
const path = require('path');
|
|
20
24
|
const R = require('./refresh.js');
|
|
21
25
|
|
|
22
26
|
const PRUNE_EVERY_MS = 24 * 3600 * 1000;
|
|
23
27
|
const LOST_MS = 6 * 3600 * 1000; // a run with no live session and no end after this long is written as interrupted
|
|
28
|
+
const ALL_MS = 3 * 3600 * 1000; // a Refresh all that has not ended after this long is over: a new press starts a new one
|
|
29
|
+
const DERIVED = Object.freeze(['brief']); // what Refresh all writes again after the sources, in this order
|
|
30
|
+
const AUTH_RETRY_MS = 2 * 60 * 1000; // a run that failed on Claude's sign-in is tried once more after this (the token is usually refreshed by then)
|
|
24
31
|
|
|
25
32
|
function create(host) {
|
|
26
33
|
const now = () => (host.now ? host.now() : Date.now());
|
|
@@ -119,9 +126,14 @@ function create(host) {
|
|
|
119
126
|
const src = R.BY_ID.get(id);
|
|
120
127
|
if (result === 'done' && src && src.copy) { try { copy = R.keepCopy(dir, id, host.copyPaths(id, s.ws), t); } catch (e) { warn('refresh copy', e); } }
|
|
121
128
|
const next = { ...st, open: rest, last_end: t, last_result: result };
|
|
122
|
-
if (result === 'done') { next.retry_at = null; next.retried = false; }
|
|
129
|
+
if (result === 'done') { next.retry_at = null; next.retried = false; next.auth_retried = false; }
|
|
130
|
+
// harness-health: a failed sign-in is often a token being refreshed by another run at the same moment (2026-10-21 08:34,
|
|
131
|
+
// four runs of Refresh all failed in 2 s, and Claude was signed in a minute later). Try once more, whatever started it.
|
|
132
|
+
const authFail = result === 'failed' && !!(s.outcome && s.outcome.auth);
|
|
133
|
+
if (authFail && src && src.run === 'skill' && !st.auth_retried) { next.retry_at = t + AUTH_RETRY_MS; next.auth_retried = true; }
|
|
123
134
|
const scheduled = ['schedule', 'catch-up', 'retry'].includes(o.trigger);
|
|
124
|
-
if (
|
|
135
|
+
if (next.auth_retried && authFail && !st.auth_retried) { /* the sign-in retry above */ }
|
|
136
|
+
else if (result === 'failed' && scheduled && src && src.run === 'skill' && rules.retry !== 'no' && !st.retried) { next.retry_at = t + Number(rules.retry) * 60000; next.retried = true; }
|
|
125
137
|
else if (result === 'failed' && o.trigger === 'retry') next.retry_at = null;
|
|
126
138
|
state[id] = next;
|
|
127
139
|
R.writeState(dir, state);
|
|
@@ -130,10 +142,11 @@ function create(host) {
|
|
|
130
142
|
try { host.tell({ source: id, label: src ? src.label : id, error: error || 'it failed', ws: s.ws || null }); } catch (e) { warn('refresh failure note', e); }
|
|
131
143
|
}
|
|
132
144
|
}
|
|
133
|
-
/** The morning brief arrived:
|
|
145
|
+
/** The morning brief arrived: ONE open brief run is done, the one that started first (one brief is one run). Two open runs used to
|
|
146
|
+
* both end as done on one brief (2026-10-21), so the log said two briefs arrived when one did. */
|
|
134
147
|
function briefDone(got) {
|
|
135
|
-
const state = R.readState(dir); const
|
|
136
|
-
|
|
148
|
+
const state = R.readState(dir); const open = Object.entries(openOf(state.brief)).sort((a, b) => (a[1].at || 0) - (b[1].at || 0));
|
|
149
|
+
if (open.length) ended({ id: open[0][0], ws: null }, { result: 'done', got: got || 'Briefing saved' });
|
|
137
150
|
}
|
|
138
151
|
/** A run with no session: one start line and one end line (signals, the repository rebuild, Git sync). */
|
|
139
152
|
function codeRun(id, { result = 'done', got = null, error = null, took_ms = null, trigger = 'change', ws = null } = {}) {
|
|
@@ -295,6 +308,57 @@ function create(host) {
|
|
|
295
308
|
return !was;
|
|
296
309
|
}
|
|
297
310
|
|
|
311
|
+
/* ── Refresh all (briefing-source-flow, slice 3) ──
|
|
312
|
+
* The PM's rule (2026-10-21): derived content reads only stored source reads, and is rebuilt after they are fresh. So Refresh all
|
|
313
|
+
* starts every source that is on (the step "read"), then marks the Briefing pressed: the tick starts it once none of its inputs runs
|
|
314
|
+
* or waits (decide → gateInputs, at most WAIT_MS). The run is kept in refresh-all.json, so a second press, a second tab and a
|
|
315
|
+
* restarted page see the same run. */
|
|
316
|
+
const allFile = () => path.join(dir, 'refresh-all.json');
|
|
317
|
+
const readAll = () => { try { const x = JSON.parse(fs.readFileSync(allFile(), 'utf8')); return x && typeof x === 'object' && Number.isFinite(x.started_at) ? x : null; } catch { return null; } };
|
|
318
|
+
function writeAll(x) { fs.mkdirSync(dir, { recursive: true }); const tmp = `${allFile()}.${process.pid}.tmp`; fs.writeFileSync(tmp, JSON.stringify(x) + '\n'); fs.renameSync(tmp, allFile()); }
|
|
319
|
+
/** The last Refresh all and where it is: { started_at, reads, derived, steps: [{ id, label, step, state }], phase, done } | null. */
|
|
320
|
+
function allState(t = now()) {
|
|
321
|
+
const a = readAll(); if (!a) return null;
|
|
322
|
+
const set = settings(); const f = log(); const rws = new Map(rowsFor(a.ws, set, t).map((r) => [r.id, r]));
|
|
323
|
+
const since = a.started_at - 1000;
|
|
324
|
+
const stateOf = (id) => {
|
|
325
|
+
const r = rws.get(id); if (r && (r.state === 'running' || r.state === 'waiting')) return r.state;
|
|
326
|
+
const l = f.lastRun(id);
|
|
327
|
+
const at = l ? Date.parse(l.end_at || l.start_at) || 0 : 0;
|
|
328
|
+
if (!l || at < since) return 'not-run';
|
|
329
|
+
if (!l.end_at) return 'running';
|
|
330
|
+
return l.result === 'done' ? 'done' : 'failed';
|
|
331
|
+
};
|
|
332
|
+
const steps = [...a.reads.map((id) => ({ id, step: 'read' })), ...a.derived.map((id) => ({ id, step: 'derived' }))]
|
|
333
|
+
.map((x) => ({ ...x, label: (R.BY_ID.get(x.id) || { label: x.id }).label, state: stateOf(x.id) }));
|
|
334
|
+
const busy = (x) => x.state === 'running' || x.state === 'waiting';
|
|
335
|
+
const over = t - a.started_at > ALL_MS;
|
|
336
|
+
const phase = over ? 'done' : steps.some((x) => x.step === 'read' && busy(x)) ? 'read' : steps.some((x) => x.step === 'derived' && busy(x)) ? 'derived' : 'done';
|
|
337
|
+
return { started_at: new Date(a.started_at).toISOString(), reads: a.reads.slice(), derived: a.derived.slice(), steps, phase, done: phase === 'done', ...(over ? { note: 'stopped waiting after 3 hours' } : {}) };
|
|
338
|
+
}
|
|
339
|
+
function refreshAll(ws) {
|
|
340
|
+
const t = now();
|
|
341
|
+
const cur = allState(t);
|
|
342
|
+
if (cur && !cur.done) return { ok: true, joined: true, all: cur };
|
|
343
|
+
const set = settings();
|
|
344
|
+
const reads = R.SOURCES.filter((x) => x.run === 'skill' && x.group === 'tools' && set.sources[x.id] && set.sources[x.id].on).map((x) => x.id);
|
|
345
|
+
writeAll({ started_at: t, ws: ws || null, reads, derived: DERIVED.slice() });
|
|
346
|
+
const started = []; const already = []; const failed = [];
|
|
347
|
+
for (const id of reads) {
|
|
348
|
+
if (running(R.readState(dir)[id])) { already.push(id); continue; }
|
|
349
|
+
const r = start(R.BY_ID.get(id), (set.sources[id] && set.sources[id].ws) || ws || host.homeWs(), { trigger: 'pressed', note: 'Refresh all' });
|
|
350
|
+
(r.ok ? started : failed).push(id);
|
|
351
|
+
}
|
|
352
|
+
for (const id of DERIVED) {
|
|
353
|
+
const st = R.readState(dir);
|
|
354
|
+
// A Briefing that is being written now read the sources before this press: it is written once more after them.
|
|
355
|
+
if (running(st[id])) { st[id] = { ...st[id], pending: { trigger: 'pressed', at: t, ws: ws || null } }; R.writeState(dir, st); continue; }
|
|
356
|
+
const r = runNow(id, { ws });
|
|
357
|
+
if (!r.ok) failed.push(id);
|
|
358
|
+
}
|
|
359
|
+
return { ok: true, joined: false, started, already, failed, all: allState(now()) };
|
|
360
|
+
}
|
|
361
|
+
|
|
298
362
|
/* ── rows ── */
|
|
299
363
|
const FRESH_OF = { 'my-work': 'my-work', calendar: 'calendar', jira: 'jira', tracker: 'tracker', tools: 'tools', initiatives: 'initiatives' };
|
|
300
364
|
function rowsFor(ws, set, t) {
|
|
@@ -316,7 +380,7 @@ function create(host) {
|
|
|
316
380
|
last_run: l ? l.start_at : null, last_status: l ? (l.result === 'failed' ? 'fail' : l.result === 'done' ? 'ok' : 'started') : st.last_result || null };
|
|
317
381
|
}
|
|
318
382
|
|
|
319
|
-
return { tick, started, ended, briefDone, codeRun, jobGate, runNow, setSource, setRules, ensureOn, rows, settings, log, scheduleOfSkill, managedSkill: (skill) => R.SKILL_OF.get(skill) || null };
|
|
383
|
+
return { tick, started, ended, briefDone, codeRun, jobGate, runNow, refreshAll, allState, setSource, setRules, ensureOn, rows, settings, log, scheduleOfSkill, managedSkill: (skill) => R.SKILL_OF.get(skill) || null };
|
|
320
384
|
}
|
|
321
385
|
|
|
322
386
|
module.exports = { create };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/* routes-sources.js — how old each source of a workspace is, and Refresh now (workspace-data-freshness R6, R7).
|
|
3
3
|
*
|
|
4
|
-
* GET /api/sources?ws=<id> → { ok, ws, version, sources: [row], health } lib/freshness.js sources(); health is
|
|
5
|
-
* lib/harness-health.js of(): { level, line, issues } or null
|
|
4
|
+
* GET /api/sources?ws=<id> → { ok, ws, version, sources: [row], health, all } lib/freshness.js sources(); health is
|
|
5
|
+
* lib/harness-health.js of(): { level, line, issues } or null; all is the last Refresh all
|
|
6
|
+
* (lib/refresh-run.js allState) or null
|
|
6
7
|
* POST /api/sources/refresh { ws, source } → { ok, source, started: 'rebuild'|'session', session? }
|
|
8
|
+
* POST /api/sources/refresh-all { ws } → { ok, joined, started, already, failed, all } every source that is on, then the
|
|
9
|
+
* Briefing from those reads (briefing-source-flow, slice 3); a press while one runs joins it
|
|
7
10
|
* POST /api/sources/watch { ws, on } → { ok, watch } the change detector on or off for this repository
|
|
8
11
|
*
|
|
9
12
|
* Both POSTs pass pm-guard requirePagePress: the PM's press from the page. An agent session cannot start a refresh or
|
|
@@ -30,10 +33,11 @@ async function handle(req, res, url, ctx) {
|
|
|
30
33
|
if (!w) { ctx.json(res, { ok: false, error: 'no such workspace' }, 404); return true; }
|
|
31
34
|
const sources = F.sources({ id: w.id, root: w.root, repoStateDir: repoStateDir(ctx, w) });
|
|
32
35
|
let health = null; try { health = ctx.health ? ctx.health() : null; } catch { health = null; }
|
|
33
|
-
|
|
36
|
+
let all = null; try { all = ctx.refreshAllState ? ctx.refreshAllState() : null; } catch { all = null; }
|
|
37
|
+
ctx.json(res, { ok: true, ws: w.id, version: F.versions()[w.id] || 0, sources, health, all });
|
|
34
38
|
return true;
|
|
35
39
|
}
|
|
36
|
-
if (p !== '/api/sources/refresh' && p !== '/api/sources/watch') return false;
|
|
40
|
+
if (p !== '/api/sources/refresh' && p !== '/api/sources/watch' && p !== '/api/sources/refresh-all') return false;
|
|
37
41
|
if (req.method !== 'POST') { ctx.json(res, { ok: false, error: 'POST only' }, 405); return true; }
|
|
38
42
|
const got = await ctx.readJson(req);
|
|
39
43
|
if (!got.ok) { ctx.json(res, { ok: false, error: 'the body is not JSON' }, 400); return true; }
|
|
@@ -50,6 +54,15 @@ async function handle(req, res, url, ctx) {
|
|
|
50
54
|
return true;
|
|
51
55
|
}
|
|
52
56
|
|
|
57
|
+
if (p === '/api/sources/refresh-all') {
|
|
58
|
+
if (!ctx.refreshAll) { ctx.json(res, { ok: false, error: 'Refresh all is not available on this server' }, 409); return true; }
|
|
59
|
+
let r;
|
|
60
|
+
try { r = ctx.refreshAll(w.id); } catch (e) { r = { ok: false, error: String((e && e.message) || e).slice(0, 200) }; }
|
|
61
|
+
if (r && r.ok && !r.joined) ctx.factsRefresh(w.root); // the repository and initiatives are rebuilt on this machine, as their Refresh does
|
|
62
|
+
ctx.json(res, r && r.ok ? r : { ok: false, error: (r && r.error) || 'Refresh all could not start' }, r && r.ok ? 200 : 500);
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
|
|
53
66
|
const src = freshness.SOURCES.find((s) => s.id === body.source);
|
|
54
67
|
if (!src) { ctx.json(res, { ok: false, error: 'source must be one of ' + freshness.SOURCES.map((s) => s.id).join(', ') }, 400); return true; }
|
|
55
68
|
if (!src.skill) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.367.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.367.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -89,6 +89,7 @@ const GANTT = [
|
|
|
89
89
|
});
|
|
90
90
|
await p.route('**/api/scan/now', (r) => json(r, { ok: true, scan: 'scan-00000000ff' }));
|
|
91
91
|
await p.route('**/api/sources/refresh', (r) => json(r, { ok: true, started: 'session' }));
|
|
92
|
+
await p.route('**/api/sources/refresh-all', (r) => json(r, { ok: true, joined: false, started: ['calendar'], already: [], failed: [], all: { started_at: new Date().toISOString(), reads: ['calendar'], derived: ['brief'], phase: 'read', done: false, steps: [{ id: 'calendar', label: 'Calendar', step: 'read', state: 'running' }, { id: 'brief', label: 'Morning briefing', step: 'derived', state: 'waiting' }] } }));
|
|
92
93
|
await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(ws)}`);
|
|
93
94
|
await until(() => p.evaluate(() => !!document.querySelector('#aroundCard')));
|
|
94
95
|
const rows = () => p.evaluate(() => Object.fromEntries([...document.querySelectorAll('#aroundBody [data-bd]')].map((b) => [b.dataset.bd, { t: b.querySelector('.wtit').textContent, s: (b.querySelector('.ws') || {}).textContent || '', m: (b.querySelector('.wm') || {}).textContent || '' }])));
|
|
@@ -251,9 +252,9 @@ const GANTT = [
|
|
|
251
252
|
if (all === false) {
|
|
252
253
|
const n1 = posts.filter((x) => x.path === '/api/sources/refresh').length;
|
|
253
254
|
await click('#oMain [data-bda="sfall"]');
|
|
254
|
-
await until(() => posts.
|
|
255
|
-
const made = posts.filter((x) => x.path === '/api/sources/refresh')
|
|
256
|
-
ok('F4 Refresh all posts one
|
|
255
|
+
await until(() => posts.some((x) => x.path === '/api/sources/refresh-all'));
|
|
256
|
+
const made = posts.filter((x) => x.path === '/api/sources/refresh-all');
|
|
257
|
+
ok('F4 Refresh all posts one ordered run (the sources, then the Briefing), and no refresh of each source', made.length === 1 && made[0].body.ws === ws && posts.filter((x) => x.path === '/api/sources/refresh').length === n1, JSON.stringify(made));
|
|
257
258
|
} else ok('F4 Refresh all is off when there is nothing to read', true);
|
|
258
259
|
await close();
|
|
259
260
|
|
|
@@ -313,10 +314,10 @@ const GANTT = [
|
|
|
313
314
|
repReply = null;
|
|
314
315
|
|
|
315
316
|
/* W: the POST allow-list */
|
|
316
|
-
const allowed = new Set(['/api/mentions/read', '/api/pm-items/add', '/api/driver/keep', '/api/driver/return', '/api/driver/drop', '/api/scan/proposal', '/api/scan/now', '/api/scan/stop', '/api/sources/refresh', '/api/report-setups/setup', '/api/report-setups/dismiss']);
|
|
317
|
+
const allowed = new Set(['/api/mentions/read', '/api/pm-items/add', '/api/driver/keep', '/api/driver/return', '/api/driver/drop', '/api/scan/proposal', '/api/scan/now', '/api/scan/stop', '/api/sources/refresh', '/api/sources/refresh-all', '/api/report-setups/setup', '/api/report-setups/dismiss']);
|
|
317
318
|
const strays = posts.filter((x) => !allowed.has(x.path));
|
|
318
319
|
ok('W1 every POST is one of the existing routes in the PRD', posts.length > 0 && strays.length === 0, JSON.stringify(strays));
|
|
319
|
-
const fields = { '/api/driver/keep': ['ws', 'proposal'], '/api/driver/return': ['ws', 'proposal', 'note'], '/api/driver/drop': ['ws', 'proposal'], '/api/mentions/read': ['id', 'read'], '/api/pm-items/add': ['line'], '/api/scan/proposal': ['ws', 'id', 'action', 'why'], '/api/scan/now': ['ws'], '/api/sources/refresh': ['ws', 'source'], '/api/report-setups/setup': ['ws', 'finding'], '/api/report-setups/dismiss': ['ws', 'finding', 'name'] };
|
|
320
|
+
const fields = { '/api/driver/keep': ['ws', 'proposal'], '/api/driver/return': ['ws', 'proposal', 'note'], '/api/driver/drop': ['ws', 'proposal'], '/api/mentions/read': ['id', 'read'], '/api/pm-items/add': ['line'], '/api/scan/proposal': ['ws', 'id', 'action', 'why'], '/api/scan/now': ['ws'], '/api/sources/refresh': ['ws', 'source'], '/api/sources/refresh-all': ['ws'], '/api/report-setups/setup': ['ws', 'finding'], '/api/report-setups/dismiss': ['ws', 'finding', 'name'] };
|
|
320
321
|
const extra = posts.filter((x) => fields[x.path] && Object.keys(x.body || {}).some((k) => !fields[x.path].includes(k)));
|
|
321
322
|
ok('W2 no POST carries a field the route was not told', extra.length === 0, JSON.stringify(extra));
|
|
322
323
|
ok('W3 every GET the card made is a console route in the PRD', gets.filter((g) => !['/api/briefing-premium', '/api/brief-page', '/api/driver/open', '/api/calendar-views', '/api/scan/portfolio', '/api/report-setups', '/api/sources', '/api/pm-items', '/api/workspaces', '/api/products', '/api/state'].includes(g) && /around|depth|bd-/.test(g)).length === 0);
|
|
@@ -70,10 +70,10 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
70
70
|
const dlgOn = (p) => until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
|
|
71
71
|
const dlgOff = (p) => until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
72
72
|
/* the Work queue shows one tab at a time: bring up the tab that holds a row before pressing it (each press redraws the tab row, so the button is found again) */
|
|
73
|
-
const showKey = (p, key) => p.evaluate((key) => { const has = () => document.querySelector(`#qBody .wrow[data-key="${key}"], #waitBody .wrow[data-key="${key}"]`); if (has()) return true; for (const k of [...document.querySelectorAll('#qTabs .qtb')].map((b) => b.dataset.tab)) { document.querySelector(`#qTabs [data-tab="${k}"]`).click(); if (has()) return true; } return false; }, key);
|
|
73
|
+
const showKey = (p, key) => p.evaluate((key) => { const has = () => document.querySelector(`#qBody .wrow[data-key="${key}"], #waitBody .wrow[data-key="${key}"]`); if (has()) return true; for (const k of [...document.querySelectorAll('#qTabs .qtb, #qMenu .qtb')].map((b) => b.dataset.tab)) { document.querySelector(`#qTabs [data-tab="${k}"], #qMenu [data-tab="${k}"]`).click(); if (has()) return true; } return false; }, key);
|
|
74
|
+
const qTab = async (p, k) => { if (!(await p.locator(`#qTabs [data-tab="${k}"]`).count())) await p.click('#qMore'); await p.click(`#qTabs [data-tab="${k}"], #qMenu [data-tab="${k}"]`); };
|
|
74
75
|
/* Escape closes the fields sheet first, then the dialog */
|
|
75
76
|
const escAll = async (p) => { await p.keyboard.press('Escape'); if (await p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))) { await sleep(100); await p.keyboard.press('Escape'); } await dlgOff(p); };
|
|
76
|
-
const qTab = (p, k) => p.click(`#qTabs [data-tab="${k}"]`);
|
|
77
77
|
const openKey = async (p, key) => { await showKey(p, key); await p.locator(`.wrow[data-key="${key}"] .wrh`).first().click(); await dlgOn(p); await sleep(700); };
|
|
78
78
|
const undoOf = async (p, direct) => { await until(() => p.evaluate(() => /Undo/.test(document.querySelector('#toast').textContent))); if (direct) { /* the Undo window is 8 s; on a loaded runner the real-server steps before this can outlast it, so press the button itself rather than race the toast's fade */ await p.evaluate(() => document.querySelector('#toast .undo').click()); } else await p.locator('#toast .undo').click(); await sleep(250); };
|
|
79
79
|
|
|
@@ -84,15 +84,16 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
84
84
|
const txt = (s) => p.evaluate((q) => (document.querySelector(q) || {}).textContent || '', s);
|
|
85
85
|
const wait = async (fn) => until(fn, 5000);
|
|
86
86
|
|
|
87
|
-
/* W6 the
|
|
88
|
-
const bar = await
|
|
89
|
-
ok('W6 the Focus
|
|
90
|
-
|
|
87
|
+
/* W6 Focus: one quiet chip in the Work queue head; Accept and Not today are in its dialog (premium-calmer-first-screen) */
|
|
88
|
+
const bar = await p.evaluate(() => { const b = document.querySelector('#xFocus .xfq'); return { say: b.getAttribute('aria-label'), text: b.textContent, inHead: !!b.closest('#queue .ch'), solid: [...document.querySelectorAll('#xFocus .cta')].length, tag: [...document.querySelectorAll('#qBody .xfc.sug')].map((x) => x.closest('.wrow').dataset.key) }; });
|
|
89
|
+
ok('W6 the Focus chip names the first suggestion and why, from the record, and sits in the Work queue head with no Accept on the page', /to walk in with a decision ready/.test(bar.say) && /Suggested · /.test(bar.say) && /1 due today/.test(bar.say) && /^Focus1 suggested$/.test(bar.text) && bar.inHead && bar.solid === 0, JSON.stringify(bar));
|
|
90
|
+
ok('W6 the suggested item\'s row carries a quiet "Suggested focus" tag', bar.tag.join() === 'work:item-bbbbbbbbbbb2', JSON.stringify(bar));
|
|
91
|
+
await p.locator('#xFocus [data-xf="more"]').click(); await dlgOn(p); await sleep(600);
|
|
92
|
+
await p.locator('[data-fx="acc"][data-k="job:job-1"]').click();
|
|
91
93
|
ok('W6 Accept posts the suggestion to focus/accept with its own fields', await wait(() => A.last() && A.last().path === '/api/pm-items/focus/accept'
|
|
92
94
|
&& JSON.stringify(Object.keys(A.last().body).sort()) === JSON.stringify(['item_ids', 'job', 'key', 'title', 'why']) && A.last().body.key === 'job:job-1' && A.last().body.item_ids.join() === 'item-bbbbbbbbbbb2' && A.last().body.job === 'job-1'), JSON.stringify(A.last()));
|
|
93
95
|
await undoOf(p);
|
|
94
96
|
ok('W9 Undo of Accept posts focus/clear for that key', A.last().path === '/api/pm-items/focus/clear' && A.last().body.key === 'job:job-1' && Object.keys(A.last().body).join() === 'key', JSON.stringify(A.last()));
|
|
95
|
-
await p.locator('#xFocus [data-xf="more"]').click(); await dlgOn(p); await sleep(600);
|
|
96
97
|
const fd = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, text: document.querySelector('#oMain').textContent, ask: document.querySelector('#askF').hidden, add: document.querySelector('[data-fx="jadd"]').disabled }));
|
|
97
98
|
ok('W6 See all lists the suggestion with the item it covers, and the PM\'s jobs with open counts', fd.title === 'Focus and jobs' && /to walk in with a decision ready/.test(fd.text) && /Prepare for the Design review/.test(fd.text) && /When a design review is on the calendar, I want to walk in with a decision ready, so the review ends with a disposition\./.test(fd.text) && /1 open item/.test(fd.text) && fd.ask, JSON.stringify(fd));
|
|
98
99
|
ok('W6 Add the job stays off until the line has when, I want and so', fd.add && await p.evaluate(async () => { const i = document.querySelector('#xjIn'); i.value = 'when a launch slips'; i.dispatchEvent(new Event('input', { bubbles: true })); return document.querySelector('[data-fx="jadd"]').disabled; }));
|
|
@@ -106,7 +107,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
106
107
|
ok('W6 Not today posts focus/dismiss with the key', await wait(() => A.last().path === '/api/pm-items/focus/dismiss' && A.last().body.key === 'job:job-1' && Object.keys(A.last().body).join() === 'key'), JSON.stringify(A.last()));
|
|
107
108
|
await escAll(p);
|
|
108
109
|
{ const m = mk((v) => { v.focus = { suggestions: [], accepted: [{ key: 'job:job-1', title: 'to walk in with a decision ready', why: '1 due today', item_ids: ['item-bbbbbbbbbbb2'], job: 'job-1' }], dismissed: [] }; });
|
|
109
|
-
const R = await open({ model: m }); const t = await R.page.evaluate(() => ({ bar: document.querySelector('#xFocus').
|
|
110
|
+
const R = await open({ model: m }); const t = await R.page.evaluate(() => ({ bar: document.querySelector('#xFocus .xfq').getAttribute('aria-label'), tag: [...document.querySelectorAll('.xfc')].map((x) => x.closest('.wrow').dataset.key) }));
|
|
110
111
|
ok('W6 an accepted group is named on the bar and tags its Today row with Focus', /Your focus today/.test(t.bar) && t.tag.join() === 'work:item-bbbbbbbbbbb2', JSON.stringify(t));
|
|
111
112
|
await R.page.locator('#xFocus [data-xf="more"]').click(); await dlgOn(R.page); await sleep(500);
|
|
112
113
|
await R.page.click('[data-fx="clr"]');
|
|
@@ -326,9 +327,9 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
326
327
|
ok(`W12 at 390 px (${theme}) the agent block has no sideways scroll and its buttons are 44 px`, !ag.over && ag.small.length === 0, JSON.stringify(ag));
|
|
327
328
|
await R.ctx.close();
|
|
328
329
|
}
|
|
329
|
-
{ const R = await open(), q3 = R.page; await q3.locator('#xFocus [data-xf="
|
|
330
|
+
{ const R = await open(), q3 = R.page; await q3.locator('#xFocus [data-xf="more"]').focus();
|
|
330
331
|
const ring = await q3.evaluate(() => { const cs = getComputedStyle(document.activeElement); return cs.outlineStyle !== 'none' || cs.boxShadow !== 'none'; });
|
|
331
|
-
ok('W12 the Focus
|
|
332
|
+
ok('W12 the Focus chip shows a focus ring', ring); await R.ctx.close(); }
|
|
332
333
|
|
|
333
334
|
/* the real routes over a scratch state folder */
|
|
334
335
|
{
|
|
@@ -336,7 +337,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
336
337
|
pg.on('pageerror', (e) => errs.push(String(e)));
|
|
337
338
|
const get = (u) => fetch(BASE + u).then((r) => r.json());
|
|
338
339
|
await pg.goto(BASE + '/premium-work.html');
|
|
339
|
-
ok('E1 on an empty scratch state the page says the list is empty and Focus has nothing to suggest', await until(() => pg.evaluate(() => document.querySelector('#brief').textContent === 'Your list is empty.' && /Nothing to suggest/.test(document.querySelector('#xFocus').
|
|
340
|
+
ok('E1 on an empty scratch state the page says the list is empty and Focus has nothing to suggest', await until(() => pg.evaluate(() => document.querySelector('#brief').textContent === 'Your list is empty.' && /Nothing to suggest/.test(document.querySelector('#xFocus .xfq').getAttribute('aria-label'))), 20000));
|
|
340
341
|
await pg.fill('#capIn', 'Reply to Rina about SSO !p1'); await pg.press('#capIn', 'Enter');
|
|
341
342
|
await dlgOn(pg); await sleep(700);
|
|
342
343
|
await more(pg); await pg.click('[data-p="xt"][data-k="edit"]'); await pg.fill('#xeT', 'Reply to Rina about SSO beta'); await pg.fill('#xeD', '2026-10-30'); await pg.click('[data-p="xpri"][data-v="P2"]'); await pg.click('[data-p="xsave"]');
|
|
@@ -367,9 +368,10 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
367
368
|
await undoOf(pg, true); await sleep(300);
|
|
368
369
|
ok('E9 Undo brings it back (unpark)', !(await get('/api/pm-items')).work.someday.some((i) => i.id === it.id));
|
|
369
370
|
await pg.locator('#qBody .wrh').first().click(); await dlgOn(pg); await sleep(700); await more(pg); await pg.click('[data-p="flag"]'); await dlgOff(pg);
|
|
370
|
-
ok('E10 once the item is in Today, Focus suggests it and the bar says why', await until(() => pg.evaluate(() => /Suggested · /.test(document.querySelector('#xFocus').
|
|
371
|
-
await pg.click('#xFocus [data-xf="
|
|
372
|
-
|
|
371
|
+
ok('E10 once the item is in Today, Focus suggests it and the bar says why', await until(() => pg.evaluate(() => /Suggested · /.test(document.querySelector('#xFocus .xfq').getAttribute('aria-label'))), 8000));
|
|
372
|
+
await pg.click('#xFocus [data-xf="more"]'); await dlgOn(pg); await sleep(500);
|
|
373
|
+
await pg.locator('[data-fx="acc"]').first().click();
|
|
374
|
+
ok('E11 Accept writes the group to today\'s Focus, and the Today row carries the Focus tag', await until(async () => (await get('/api/pm-items')).focus.accepted.length === 1, 8000) && (await escAll(pg), await qTab(pg, 'today'), await until(() => pg.evaluate(() => !!document.querySelector('#qBody .xfc:not(.sug)')), 8000)));
|
|
373
375
|
await pg.click('#xFocus [data-xf="more"]'); await dlgOn(pg); await sleep(500);
|
|
374
376
|
await pg.fill('#xjIn', 'when a launch slips, I want the owner named, so the date holds'); await pg.click('[data-fx="jadd"]');
|
|
375
377
|
ok('E12 Add a job writes it, and the dialog lists it with its open count', await until(async () => (await get('/api/pm-items')).jobs.length === 1, 8000) && await until(() => pg.evaluate(() => /the owner named/.test(document.querySelector('#oMain').textContent) && /0 open items/.test(document.querySelector('#oMain').textContent)), 8000));
|
|
@@ -200,7 +200,7 @@ function paneHtml(r) {
|
|
|
200
200
|
function openRow(r) {
|
|
201
201
|
if (!r) return;
|
|
202
202
|
const d = r.dialog;
|
|
203
|
-
openDlg({ eye: d.eye + ' · real data', title: r.title, sub: r.sub + (r.statusLabel ? ' · ' + r.statusLabel : ''), say: d.say, stream: turnA(logHtml(d)) + turnA(ptx(d.say)) + cardHtml(r), noteKey: r.key, pane: paneHtml(r), label: d.pane.label
|
|
203
|
+
openDlg({ eye: d.eye + ' · real data', title: r.title, sub: r.sub + (r.statusLabel ? ' · ' + r.statusLabel : ''), say: d.say, stream: turnA(logHtml(d)) + turnA(ptx(d.say)) + cardHtml(r), noteKey: r.key, pane: paneHtml(r), label: d.pane.label }); // every dialog has the short phone head (premium-shell openDlg), so the sprint board gets the height
|
|
204
204
|
const vb = $('#oMain [data-vwopen]'); if (vb) vb.onclick = () => openWorkItem({ kind: 'initiative', id: r.id, title: r.title, ws: M.board.ws, board: M.board.id }); // its record, checks, tasks and links as a viewer tab (premium-viewer S7)
|
|
205
205
|
loadThread(r.key);
|
|
206
206
|
if (r.key === 'board:sprint') openSprint({ ws: M.board.ws, board: M.board.id, name: r.title }); // the sprint as a board by status, beside its facts (premium-viewer S5)
|
|
@@ -4,7 +4,7 @@ import { recChipView, STOP_LINE } from './premium-meeting.js';
|
|
|
4
4
|
import { vwReset } from './premium-viewer.js';
|
|
5
5
|
import { openChatFile, openWebLink } from './premium-vw-file.js';
|
|
6
6
|
import { chipActs, openLive, openFocus, mountRecord, HL_LINE } from './premium-vw-rec.js';
|
|
7
|
-
import { lineItems, behindOf,
|
|
7
|
+
import { lineItems, behindOf, whenRead } from './freshness-words.js';
|
|
8
8
|
import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, slashMatches } from './goal-chat.js';
|
|
9
9
|
import { mdHtml, userHtml, toolLine, webKind } from './chat-md.js';
|
|
10
10
|
import { padMarkup, padChipMarkup, mountPad, flushPad } from './premium-pad.js';
|
|
@@ -92,10 +92,33 @@ const SSTATE = { fresh: 'Recent', stale: 'Old', never: 'Never read', building: '
|
|
|
92
92
|
const wsQ = () => { const w = new URLSearchParams(location.search).get('ws'); return w ? '?ws=' + encodeURIComponent(w) : ''; };
|
|
93
93
|
async function tbReadSrc() {
|
|
94
94
|
const r = await pmGet('/api/sources' + wsQ());
|
|
95
|
+
const was = TB.src && TB.src.all;
|
|
95
96
|
TB.src = r && r.ok && Array.isArray(r.sources) ? r : { ok: false, sources: [] };
|
|
96
|
-
tbDot();
|
|
97
|
+
tbDot(); allWatch(was);
|
|
97
98
|
return TB.src;
|
|
98
99
|
}
|
|
100
|
+
/* ── Refresh all (briefing-source-flow, slice 3): one run, in order. The server reads every source that is on, then writes the Briefing
|
|
101
|
+
* from those reads; this side says which step it is on, re-reads while it runs, and tells the page when it ended (event pm:refreshed). ── */
|
|
102
|
+
let AWATCH = null;
|
|
103
|
+
const allOn = () => !!(TB.src && TB.src.ok && TB.src.all && !TB.src.all.done);
|
|
104
|
+
export function allText(a) {
|
|
105
|
+
if (!a) return '';
|
|
106
|
+
const S = a.steps || [], reads = S.filter((x) => x.step === 'read'), der = S.filter((x) => x.step === 'derived');
|
|
107
|
+
const left = reads.filter((x) => x.state === 'running' || x.state === 'waiting');
|
|
108
|
+
const bad = S.filter((x) => x.state === 'failed').map((x) => x.label);
|
|
109
|
+
if (a.phase === 'read') return 'Step 1 of 2: reading ' + left.map((x) => x.label).join(', ') + '. The Briefing is written after them.';
|
|
110
|
+
if (a.phase === 'derived') return 'Step 2 of 2: writing the Briefing from the reads' + (bad.length ? ' (' + bad.join(', ') + ' failed, so its last read is used)' : '') + '.';
|
|
111
|
+
const t = new Date(a.started_at);
|
|
112
|
+
const briefOk = der.length && der.every((x) => x.state === 'done');
|
|
113
|
+
return 'Refresh all from ' + String(t.getHours()).padStart(2, '0') + ':' + String(t.getMinutes()).padStart(2, '0') + ' ended: ' + (briefOk ? 'the sources were read and the Briefing was written again' : 'the Briefing was not written again') + '.' + (bad.length ? ' Failed: ' + bad.join(', ') + '.' : '') + (a.note ? ' It ' + a.note + '.' : '');
|
|
114
|
+
}
|
|
115
|
+
function allWatch(was) {
|
|
116
|
+
clearTimeout(AWATCH);
|
|
117
|
+
if (allOn()) { AWATCH = setTimeout(() => { if (!document.hidden) tbReadSrc().then(() => { if ($('#srcRows')) srcDraw(); }); else allWatch(TB.src.all); }, 15000); return; }
|
|
118
|
+
// it ended since the last read: the page reads its own data again
|
|
119
|
+
if (was && !was.done && TB.src && TB.src.all && TB.src.all.done) { TB.msg = allText(TB.src.all); window.dispatchEvent(new CustomEvent('pm:refreshed', { detail: TB.src.all })); }
|
|
120
|
+
}
|
|
121
|
+
let srcDraw = () => {};
|
|
99
122
|
function tbDot() {
|
|
100
123
|
const d = $('#srcDot'), c = $('#srcChip'); if (!d || !c) return;
|
|
101
124
|
const behind = TB.src && TB.src.ok ? behindOf(lineItems(TB.src.sources)) : [];
|
|
@@ -127,31 +150,43 @@ export async function openSources() {
|
|
|
127
150
|
// the frame is drawn once; a re-read redraws only the rows, the button and the message, so the page's own part (the Briefing's picker) is left alone
|
|
128
151
|
const rowsHtml = () => { const s = TB.src; return !s ? '<p class="note">Reading the sources.</p>' : !s.ok ? '<p class="note err" role="alert">The sources could not be read.</p>' : s.sources.map(srcRow).join(''); };
|
|
129
152
|
const draw = () => {
|
|
130
|
-
if (
|
|
153
|
+
if (allOn()) TB.msg = allText(TB.src.all);
|
|
154
|
+
const allLabel = allOn() ? 'Refreshing' : 'Refresh all';
|
|
155
|
+
if ($('#srcRows')) { $('#srcRows').innerHTML = rowsHtml(); $('#srcHealth').innerHTML = healthHtml(); $('#srcAll').disabled = TB.busy || allOn(); $('#srcAll').textContent = allLabel; $('#srcM').textContent = TB.msg; return; }
|
|
131
156
|
park();
|
|
132
157
|
$('#oMain').innerHTML = `<article class="paper doc"><div class="addf">
|
|
133
158
|
<div id="srcHealth">${healthHtml()}</div>
|
|
134
|
-
<div class="srctop"><p class="note" style="margin:0">Each source is read on its own schedule, not live.
|
|
159
|
+
<div class="srctop"><p class="note" style="margin:0">Each source is read on its own schedule, not live. Refresh all reads every source, then writes the Briefing from those reads.</p><button type="button" class="cta" id="srcAll"${TB.busy || allOn() ? ' disabled' : ''}>${allLabel}</button></div>
|
|
135
160
|
<div>${TB.extra ? '<span class="label">Sources</span>' : ''}<div id="srcRows">${rowsHtml()}</div></div>
|
|
136
161
|
${TB.extra ? TB.extra.html() : ''}
|
|
137
162
|
<p class="note" id="srcM" role="status" style="margin:0;min-height:1.2em">${esc(TB.msg)}</p></div></article>`;
|
|
138
163
|
if (TB.extra && TB.extra.mount) TB.extra.mount();
|
|
139
164
|
};
|
|
140
165
|
const say = 'When each source was last read. Each one is read on its own schedule, so the rows say their own times.';
|
|
141
|
-
TB.msg = '';
|
|
166
|
+
TB.msg = ''; srcDraw = draw;
|
|
142
167
|
openDlg({ eye: 'Sources', title: 'Sources', say, stream: turnA(ptx(say)), noteKey: null, pane: '<article class="paper doc"></article>', label: 'Sources' });
|
|
143
168
|
$('#askF').hidden = true; setMode('detail');
|
|
144
169
|
const poll = (n) => { clearTimeout(SPOLL); if (!n || !TB.src || !TB.src.ok || !TB.src.sources.some((x) => x.state === 'building')) return; SPOLL = setTimeout(async () => { if ($('#dTitle').textContent !== 'Sources' || !$('#dlg').classList.contains('on')) return; await tbReadSrc(); draw(); poll(n - 1); }, 3000); };
|
|
145
170
|
$('#oMain').onclick = async (e) => {
|
|
146
171
|
const one = e.target.closest('[data-sref]'), all = e.target.closest('#srcAll');
|
|
147
172
|
if ((!one && !all) || TB.busy || !TB.src || !TB.src.ok) return;
|
|
148
|
-
|
|
173
|
+
if (all) {
|
|
174
|
+
// one ordered run on the server: the sources, then the Briefing from them (a press while it runs joins it)
|
|
175
|
+
TB.busy = true; TB.msg = 'Starting.'; draw();
|
|
176
|
+
const r = await pmPost('/api/sources/refresh-all', { ws: TB.src.ws || '' }).catch(() => null);
|
|
177
|
+
let extra = null; if (r && r.ok && !r.joined && TB.extra && TB.extra.refresh) extra = await TB.extra.refresh();
|
|
178
|
+
TB.busy = false;
|
|
179
|
+
TB.msg = !r || !r.ok ? 'Refresh all did not start: ' + ((r && r.error) || 'the server did not answer') + '.'
|
|
180
|
+
: (r.failed && r.failed.length ? r.failed.length + ' did not start. ' : '') + allText(r.all) + (extra ? ' ' + extra : '');
|
|
181
|
+
await tbReadSrc(); draw(); poll(8);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const ids = [one.dataset.sref];
|
|
149
185
|
TB.busy = true; TB.msg = 'Starting.'; draw();
|
|
150
186
|
const got = await Promise.all(ids.map((id) => pmPost('/api/sources/refresh', { ws: TB.src.ws || '', source: id }).catch(() => null)));
|
|
151
|
-
let extra = null; if (all && TB.extra && TB.extra.refresh) extra = await TB.extra.refresh();
|
|
152
187
|
const bad = got.filter((r) => !r || !r.ok).length;
|
|
153
188
|
TB.busy = false;
|
|
154
|
-
TB.msg =
|
|
189
|
+
TB.msg = bad ? 'It did not start.' : 'Reading it again.';
|
|
155
190
|
await tbReadSrc(); draw(); poll(8);
|
|
156
191
|
};
|
|
157
192
|
draw();
|
|
@@ -210,13 +245,15 @@ export function openDlg(o) {
|
|
|
210
245
|
$('#oMain').innerHTML = o.pane || `<article class="paper doc">${o.html}</article>`; $('#oLab').textContent = o.label || 'Detail'; vwReset(); // extra viewer tabs belong to the dialog that opened them
|
|
211
246
|
$('#dBody').innerHTML = `<div class="stream" role="log">${o.stream || turnA(ptx(o.say))}</div><form class="askbar" id="askF"><div class="slashm" id="slashM" role="listbox" aria-label="Commands" hidden></div>${padMarkup()}<textarea id="askIn" rows="1" placeholder="Message Claude, or type /" maxlength="8000" autocomplete="off" enterkeyhint="send" aria-label="A message for Claude" aria-controls="slashM"></textarea><button type="submit" data-act="ask" id="askGo" aria-label="Send to Claude" title="Send to Claude"><svg class="i" viewBox="0 0 24 24"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></form><div class="askfoot"><p class="fine2" id="askNote">${CHAT_NOTE}</p>${padChipMarkup()}</div>`;
|
|
212
247
|
mountPad({ key: S.key, ws: new URLSearchParams(location.search).get('ws'), input: $('#askIn') });
|
|
213
|
-
$('#dlg').classList.toggle('cmp',
|
|
248
|
+
$('#dlg').classList.toggle('cmp', o.compact !== false); $('#dlg').classList.remove('shrunk', 'tfull'); // compact (every dialog unless it says compact: false): a short head on a phone that shrinks as the detail scrolls
|
|
214
249
|
$('#dlg').classList.remove('full'); setMode('split'); setTab('out'); // on a phone the dialog opens on the Detail tab and the Detail / Conversation switch brings the conversation, as the mockup draws it
|
|
215
250
|
$('#veil').classList.add('on'); $('#dlg').classList.add('on');
|
|
216
251
|
$$('#dGrid .pane').forEach((p) => { p.scrollTop = 0; });
|
|
217
252
|
railOnOpen(o);
|
|
218
253
|
setTimeout(() => $('#dlg').focus(), 60);
|
|
219
254
|
}
|
|
255
|
+
/* The compact head clamps a long title; a press on it shows the whole title and sub line, a second press clamps them again. */
|
|
256
|
+
$('#dTitle').addEventListener('click', () => { const g = $('#dlg'); if (g.classList.contains('cmp') && innerWidth < 1000) g.classList.toggle('tfull'); });
|
|
220
257
|
/* A compact dialog on a phone: once the detail scrolls, the head keeps only the title and the tools, so the detail gets the screen.
|
|
221
258
|
* It shrinks only when the detail is much taller than its pane, so the smaller head cannot end the scroll and grow back. */
|
|
222
259
|
$('#dOut').addEventListener('scroll', () => {
|
|
@@ -51,11 +51,13 @@ function rowHtml(r, o = {}) {
|
|
|
51
51
|
else lead = `<button class="wck" data-ck="${esc(r.id)}" aria-pressed="false" aria-label="Mark done: ${esc(r.title)}">${CHECK}</button>`;
|
|
52
52
|
const meta = r.chip ? `<span class="wm"><span class="due${r.overdue ? ' od' : ''}">${esc(r.chip)}</span></span>` : '';
|
|
53
53
|
const ag = AG_CHIP[r.agent], chip = ag ? `<em class="wag ${ag[0]}"><i></i>${ag[1]}</em>` : '';
|
|
54
|
-
const sug = !sm && r.sug ? `<span class="wsg">${ICO('<path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/>')}<span><b>${esc(r.sug.b)}</b> ${esc(r.sug.t)}</span></span>` : '';
|
|
55
|
-
|
|
54
|
+
const sug = !sm && r.sug ? `<span class="wsg" title="${esc(r.sug.b + ' ' + r.sug.t)}">${ICO('<path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/>')}<span><b>${esc(r.sug.b)}</b> ${esc(r.sug.t)}</span></span>` : '';
|
|
55
|
+
const fs = !sm && !r.focus && focusIds().has(r.id) ? '<em class="xfc sug">Suggested focus</em>' : '';
|
|
56
|
+
return `<div class="wrw"><div class="wrow${sm ? ' sm' : ''}${inbox ? ' inb' : ''}${o.first ? ' first' : ''}" data-key="${esc(r.key)}">${lead}<button class="wrh" aria-haspopup="dialog"${desc}><span class="wtx"><span class="wtit">${esc(r.title)}${o.first ? '<em class="tgf">Do this first</em>' : ''}${r.focus ? '<em class="xfc">Focus</em>' : ''}${fs}</span><span class="ws">${chip}${esc(r.sub)}</span>${sug}</span>${meta}</button></div></div>`;
|
|
56
57
|
}
|
|
57
58
|
/* One card, one tab for each place a thing waits. A tab draws its groups in two columns. An item an agent works on stays in its own tab with a chip (PM, 2026-10-20). */
|
|
58
59
|
let qTab = null;
|
|
60
|
+
const Q_ROW = ['today', 'inbox']; // the tabs always in the row; Upcoming, Someday, Kept and Done wait under More (premium-calmer-first-screen)
|
|
59
61
|
const AG_CHIP = { ready: ['ready', 'Draft ready'], queued: ['run', 'Agent working'], working: ['run', 'Agent working'], sending: ['run', 'Agent working'], failed: ['fail', 'Agent stopped'] };
|
|
60
62
|
const Q_EMPTY = { today: 'Nothing is placed for today.', inbox: 'Nothing waits to be sorted. Add a line above and it lands here first.', upcoming: 'Nothing has a later date.', someday: 'Nothing is parked.', kept: 'Nothing kept yet.', done: 'Nothing done this week.' };
|
|
61
63
|
function groupHtml(g, tab) {
|
|
@@ -67,7 +69,11 @@ function drawQueue() {
|
|
|
67
69
|
if (!qTab || !tabs.some((t) => t.key === qTab)) qTab = Q.start;
|
|
68
70
|
const cur = tabs.find((t) => t.key === qTab);
|
|
69
71
|
$('#qCap').innerHTML = `<b>${Q.n}</b> to clear` + Q.cap.map((c) => ' · ' + esc(c)).join('');
|
|
70
|
-
|
|
72
|
+
const tb = (t) => `<button type="button" role="tab" class="qtb" id="qt-${t.key}" data-tab="${t.key}" aria-selected="${t.key === qTab}" aria-controls="qBody" tabindex="${t.key === qTab ? 0 : -1}">${esc(t.label)}<em>${t.n}</em></button>`;
|
|
73
|
+
const inRow = (t) => Q_ROW.includes(t.key) || t.key === qTab, rest = tabs.filter((t) => !inRow(t));
|
|
74
|
+
$('#qTabs').innerHTML = tabs.filter(inRow).map(tb).join('');
|
|
75
|
+
$('#qMore').hidden = !rest.length; $('#qMore').setAttribute('aria-expanded', 'false');
|
|
76
|
+
$('#qMenu').hidden = true; $('#qMenu').innerHTML = rest.map(tb).join('');
|
|
71
77
|
$('#qBody').setAttribute('aria-labelledby', 'qt-' + qTab);
|
|
72
78
|
let h = '';
|
|
73
79
|
if (!cur.n) h = `<p class="empty3${qTab === 'inbox' ? '' : ' plain'}">${qTab === 'inbox' ? CHECK : ''}${Q_EMPTY[qTab]}</p>`;
|
|
@@ -81,7 +87,12 @@ function drawQueue() {
|
|
|
81
87
|
const sel = $('#qTabs [aria-selected="true"]'), bar = $('#qTabs'); // one row that scrolls sideways on a phone: keep the chosen tab in view
|
|
82
88
|
if (sel && bar.scrollWidth > bar.clientWidth) bar.scrollLeft = Math.max(0, sel.offsetLeft - (bar.clientWidth - sel.offsetWidth) / 2);
|
|
83
89
|
}
|
|
84
|
-
|
|
90
|
+
const pickTab = (e) => { const b = e.target.closest('[data-tab]'); if (!b) return; qTab = b.dataset.tab; drawQueue(); const n = $(`#qTabs [data-tab="${qTab}"]`); if (n) n.focus(); };
|
|
91
|
+
$('#qTabs').addEventListener('click', pickTab);
|
|
92
|
+
$('#qMenu').addEventListener('click', pickTab);
|
|
93
|
+
$('#qMore').addEventListener('click', () => { const m = $('#qMenu'), on = m.hidden; m.hidden = !on; $('#qMore').setAttribute('aria-expanded', String(on)); if (on) { const f = m.querySelector('.qtb'); if (f) f.focus(); } });
|
|
94
|
+
document.addEventListener('click', (e) => { if (!e.target.closest('#qMenu, #qMore') && !$('#qMenu').hidden) { $('#qMenu').hidden = true; $('#qMore').setAttribute('aria-expanded', 'false'); } });
|
|
95
|
+
$('#qMenu').addEventListener('keydown', (e) => { if (e.key === 'Escape') { $('#qMenu').hidden = true; $('#qMore').setAttribute('aria-expanded', 'false'); $('#qMore').focus(); } });
|
|
85
96
|
$('#qTabs').addEventListener('keydown', (e) => {
|
|
86
97
|
if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft' && e.key !== 'Home' && e.key !== 'End') return;
|
|
87
98
|
e.preventDefault();
|
|
@@ -486,14 +497,14 @@ new MutationObserver(() => { if ($('#card') && (!dlgOpen() || dlgKind !== 'item'
|
|
|
486
497
|
.observe($('#dlg'), { attributes: true, attributeFilter: ['class'], childList: true, subtree: true, characterData: true });
|
|
487
498
|
|
|
488
499
|
/* ── Focus and jobs: the bar under the add line, and its dialog ─────────────────────────────────────────────────────────────── */
|
|
500
|
+
/* the item ids of the first suggestion: their rows carry a quiet "Suggested focus" tag */
|
|
501
|
+
const focusIds = () => new Set(((M && M.focus && M.focus.suggestions[0]) || {}).item_ids || []);
|
|
489
502
|
const fBody = (f) => ({ key: f.key, title: f.title, why: f.why, item_ids: f.item_ids, job: f.job || null });
|
|
490
503
|
function drawFocus() {
|
|
491
|
-
let h = $('#xFocus');
|
|
492
|
-
if (!h) { $('#tx').insertAdjacentHTML('afterend', '<div id="xFocus" class="xfo" role="group" aria-label="Focus today"></div>'); h = $('#xFocus'); }
|
|
493
504
|
const F = M.focus, nx = F.suggestions[0], acc = F.accepted;
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
505
|
+
const say = nx ? `Suggested · ${nx.title} · ${nx.why}` : acc.length ? 'Your focus today · ' + acc.map((a) => a.title).join(' · ') : 'Nothing to suggest · Nothing more to suggest today';
|
|
506
|
+
const n = nx ? F.suggestions.length + ' suggested' : acc.length ? acc.length + ' in focus' : '';
|
|
507
|
+
$('#xFocus').innerHTML = `<button type="button" class="xfq${nx ? ' on' : ''}" data-xf="more" aria-haspopup="dialog" title="${esc(say)}" aria-label="Focus and jobs. ${esc(say)}">Focus${n ? `<em>${esc(n)}</em>` : ''}</button>`;
|
|
497
508
|
}
|
|
498
509
|
const titleOfKey = (k) => {
|
|
499
510
|
const m = /^(job|item):(.+)$/.exec(k || '');
|
|
@@ -644,19 +655,23 @@ for (const box of ['#qBody']) {
|
|
|
644
655
|
}
|
|
645
656
|
|
|
646
657
|
/* ── add: one line, read by the Work page's own parser ─────────────────────────────────────────────────────── */
|
|
658
|
+
/* the hint under the add box shows while the box has focus; a message about a press stays until the next keystroke (premium-calmer-first-screen) */
|
|
659
|
+
const CAP_HINT = $('#capHint').textContent;
|
|
660
|
+
const sayCap = (t) => { $('#capHint').textContent = t; $('#tx').classList.add('said'); };
|
|
661
|
+
$('#capIn').addEventListener('input', () => { if ($('#tx').classList.contains('said')) { $('#tx').classList.remove('said'); $('#capHint').textContent = CAP_HINT; } });
|
|
647
662
|
$('#cap').addEventListener('submit', async (e) => {
|
|
648
663
|
e.preventDefault();
|
|
649
664
|
const inp = $('#capIn'), line = inp.value.trim();
|
|
650
|
-
if (!line) {
|
|
665
|
+
if (!line) { sayCap('Write one line to add.'); return; }
|
|
651
666
|
const go = $('.capb'); go.disabled = true;
|
|
652
667
|
const res = await pmPost('/api/pm-items/add', { line });
|
|
653
668
|
go.disabled = false;
|
|
654
|
-
if (!res || res.ok !== true) {
|
|
669
|
+
if (!res || res.ok !== true) { sayCap((res && res.error) || 'It was not added.'); return; }
|
|
655
670
|
inp.value = '';
|
|
656
671
|
const it = res.item || {};
|
|
657
672
|
if (!it.due) qTab = 'inbox'; // a line with no date waits in the inbox, so the queue opens there
|
|
658
673
|
const bits = [it.due ? 'due ' + it.due : null, it.priority].filter(Boolean);
|
|
659
|
-
|
|
674
|
+
sayCap('Added: ' + (it.title || line) + (bits.length ? ' (' + bits.join(', ') + ')' : '') + '. It is in your inbox until you place it.');
|
|
660
675
|
await load();
|
|
661
676
|
const fresh = it.id ? rowOf('work:' + it.id) : null; // a new item opens at once, so it can be placed
|
|
662
677
|
if (fresh) openRow(fresh);
|
|
@@ -547,8 +547,6 @@ button.pst{border:0;font:inherit;color:inherit;text-align:left;cursor:pointer}bu
|
|
|
547
547
|
.nud{font-size:var(--fs-2);font-weight:600;color:var(--ember-ink)}
|
|
548
548
|
.nud.ok{color:var(--ok)}
|
|
549
549
|
/* ── My work depth (initiative premium-work-depth): Focus, the tool row, its panels, the agent block, swipe ─────────────── */
|
|
550
|
-
.xfo{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:20px 0 4px;padding:12px 14px;border-radius:var(--r-in);background:var(--well)}
|
|
551
|
-
.xfo .label{flex:0 0 auto}
|
|
552
550
|
.xfot{flex:1 1 180px;min-width:0}.xfot b{display:block;font-size:var(--fs-3);font-weight:600;line-height:1.3;overflow-wrap:anywhere}.xfot small{display:block;font-size:var(--fs-2);color:var(--ink-3);margin-top:2px}
|
|
553
551
|
.xfob{display:flex;gap:8px;flex-wrap:wrap}
|
|
554
552
|
.xfo .cta,.xacts .cta,.xpan .cta,.agblk .cta{min-height:44px;height:auto;padding:0 18px}
|
|
@@ -2047,6 +2045,28 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
|
|
|
2047
2045
|
.qtb[aria-selected="true"]{background:var(--solid);color:var(--on-solid)}
|
|
2048
2046
|
.qtb:focus-visible{outline:2px solid var(--ember);outline-offset:2px}
|
|
2049
2047
|
.qtabs::-webkit-scrollbar{display:none}
|
|
2048
|
+
/* calmer first screen (premium-calmer-first-screen): the add hint shows on focus, Focus is a chip in the Work queue head, the tabs past Inbox wait under More, the agent hint is one line (a ✦ on a phone) */
|
|
2049
|
+
.tx .hint{display:none}
|
|
2050
|
+
.cap:focus-within+.tx .hint,.tx.said .hint{display:inline}
|
|
2051
|
+
.xfo{display:flex;margin-left:auto;flex:0 0 auto}
|
|
2052
|
+
.ch small:not(:empty)+.xfo{margin-left:12px}
|
|
2053
|
+
.xfq{display:inline-flex;align-items:center;gap:6px;min-height:36px;padding:0 14px;border-radius:var(--r-chip);background:var(--well);font-size:var(--fs-2);font-weight:600;color:var(--ink-2);white-space:nowrap}
|
|
2054
|
+
.xfq em{font-style:normal;font-weight:500;color:var(--ink-3)}
|
|
2055
|
+
.xfq.on{color:var(--ink)}.xfq.on em{color:var(--ember-ink)}
|
|
2056
|
+
.xfq:hover{color:var(--ink)}
|
|
2057
|
+
.xfc.sug{color:var(--ember-ink);background:color-mix(in oklab,var(--ember) 14%,transparent)}
|
|
2058
|
+
.qbar{position:relative;display:inline-flex;align-items:center;gap:6px;max-width:100%}
|
|
2059
|
+
.qbar .qtabs{min-width:0}
|
|
2060
|
+
.qmore{display:inline-flex;align-items:center;gap:4px;height:44px;padding:0 12px;border-radius:var(--r-chip);font-size:var(--t-small);font-weight:600;color:var(--ink-2);white-space:nowrap;flex:0 0 auto;margin:14px 0 6px}
|
|
2061
|
+
.qmore svg{width:16px;height:16px}.qmore:hover,.qmore[aria-expanded="true"]{color:var(--ink);background:var(--well)}
|
|
2062
|
+
.qmore[hidden],.qmenu[hidden]{display:none}
|
|
2063
|
+
.qmenu{position:absolute;right:0;top:calc(100% - 2px);z-index:30;display:grid;gap:2px;min-width:200px;padding:6px;border-radius:16px;background:var(--card);box-shadow:var(--card-shadow)}
|
|
2064
|
+
.qmenu .qtb{display:flex;justify-content:space-between;text-align:left;min-height:44px;height:auto}
|
|
2065
|
+
.qmenu .qtb[aria-selected="true"]{background:var(--well);color:var(--ink)}
|
|
2066
|
+
.wsg{grid-template-columns:16px minmax(0,1fr)}.wsg>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
2067
|
+
@media (max-width:700px){.qbar{display:flex}.qmenu{right:auto;left:0}.qbar .qtabs{width:auto;flex:0 1 auto;-webkit-mask-image:none;mask-image:none}
|
|
2068
|
+
.wrh{position:relative;padding-right:24px;grid-template-columns:minmax(0,1fr);gap:6px}.wrh .wm{justify-self:start}.wsg{position:absolute;right:0;top:15px;margin:0;display:block}.wsg>span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
|
|
2069
|
+
.xfq{min-height:44px}.ch small:not(:empty)+.xfo{margin-left:auto}}
|
|
2050
2070
|
/* the agent's state on a row, in the tab where the item waits (PM, 2026-10-20: no Agents tab) */
|
|
2051
2071
|
.wag{display:inline-flex;align-items:center;gap:5px;font:600 var(--fs-1) var(--sans);font-style:normal;color:var(--ink-2);background:var(--well);padding:1px 9px 1px 7px;border-radius:999px;margin-right:8px;vertical-align:1px;white-space:nowrap}
|
|
2052
2072
|
.wag i{width:7px;height:7px;border-radius:50%;background:var(--ink-3)}
|
|
@@ -2517,14 +2537,19 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
|
|
|
2517
2537
|
.isheet .fbar{padding-top:10px}
|
|
2518
2538
|
.ibar #cardErr{margin:0;text-align:right}
|
|
2519
2539
|
@media (max-width:699px){.ichip .isum{display:none}.ichip{padding:0 12px}.ibar .fdone{padding:0 14px}.dlg.itm #dTabs .seg button{padding:0 11px}.isheet{left:0;width:auto}}
|
|
2520
|
-
/* a compact dialog (
|
|
2540
|
+
/* a compact dialog (every dialog unless it opts out) on a phone: a short head (title up to two lines, sub on one), and once the detail scrolls only the title and the tools stay (PM, 2026-10-20) */
|
|
2521
2541
|
@media (max-width:999px){.dlg.cmp #dEye{display:none}
|
|
2522
2542
|
.dlg.cmp .dhead{align-items:center}
|
|
2523
|
-
.dlg.cmp #dTitle{margin-top:0;font-size:var(--fs-4);
|
|
2524
|
-
.dlg.cmp .dsub{margin-top:2px;font-size:var(--fs-2);line-height:1.35}
|
|
2543
|
+
.dlg.cmp #dTitle{margin-top:0;font-size:var(--fs-4);display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;text-wrap:pretty}
|
|
2544
|
+
.dlg.cmp .dsub{margin-top:2px;font-size:var(--fs-2);line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2545
|
+
.dlg.cmp.tfull #dTitle{-webkit-line-clamp:unset;line-clamp:none}
|
|
2546
|
+
.dlg.cmp.tfull .dsub{white-space:normal}
|
|
2547
|
+
.dlg.cmp.tfull #dEye{display:block}
|
|
2525
2548
|
.dlg.cmp .dtabs{margin-top:10px}
|
|
2526
2549
|
.dlg.cmp .dgrid{margin-top:8px}
|
|
2527
|
-
.dlg.cmp.shrunk
|
|
2550
|
+
.dlg.cmp.shrunk #dTitle{-webkit-line-clamp:1;line-clamp:1}
|
|
2551
|
+
.dlg.cmp.shrunk .dsub,.dlg.cmp.shrunk:not(.itm) .dtabs{display:none}
|
|
2552
|
+
.dlg.cmp .stease>span{display:none}.dlg.cmp .stease{padding:0 12px}
|
|
2528
2553
|
.dlg.cmp.shrunk .dgrid{margin-top:4px}}
|
|
2529
2554
|
|
|
2530
2555
|
/* ── premium-chat-rail: Chat is the rail's middle place, a solid round button bigger than the others. On a phone it rises above the bar. ── */
|
|
@@ -12,7 +12,7 @@ import { lineItems, behindOf, refreshTargets, whenRead } from './freshness-words
|
|
|
12
12
|
import { consoleReads, briefOf, needsListOf } from './premium-brief.js';
|
|
13
13
|
import { mountDocSheet } from './premium-doc-sheet.js';
|
|
14
14
|
import { momentOf, inText } from './c3-phone-model.js';
|
|
15
|
-
import { $, $$, esc, store, THEME_KEY, RM, AI, S, theme, toast, kv, H, openDlg, closeDlg, setTab, setMode, setFull, CHECK, CHEV, ptx, turnA, turnU, H1, H2, P1, UL, logHtml, loadThread, onScroll, wireRail, pvFeed, setPageGaps, sourcesHook, chatAbout, pvOpenBell, ibState } from './premium-shell.js';
|
|
15
|
+
import { $, $$, esc, store, THEME_KEY, RM, AI, S, theme, toast, kv, H, openDlg, closeDlg, setTab, setMode, setFull, CHECK, CHEV, ptx, turnA, turnU, H1, H2, P1, UL, logHtml, loadThread, onScroll, wireRail, pvFeed, setPageGaps, sourcesHook, allText, chatAbout, pvOpenBell, ibState } from './premium-shell.js';
|
|
16
16
|
const ICON = {
|
|
17
17
|
meeting: '<rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/>',
|
|
18
18
|
merge: '<circle cx="6" cy="6" r="2"/><circle cx="6" cy="18" r="2"/><circle cx="18" cy="9" r="2"/><path d="M6 8v8M18 11c0 4-6 3-12 5"/>',
|
|
@@ -913,7 +913,7 @@ function srcHtml() {
|
|
|
913
913
|
const sch = s.schedule ? [s.schedule.cadence, s.schedule.day, s.schedule.time].filter(Boolean).join(' ') : s.skill ? 'no schedule' : 'on every change';
|
|
914
914
|
return `<div class="bd-src"><span><b>${esc(s.label)}</b><small><span class="bd-st ${esc(s.state)}">${esc(SSTATE[s.state] || s.state)}</span> · ${esc(when)} · ${esc(sch)}${s.stale_after_ms ? ' · old after ' + esc(limitWord(s.stale_after_ms)) : ''}</small><small>${s.skill ? 'Refresh starts the ' + esc(s.skill) + ' skill in an agent session, with your own connection.' : 'Refresh rebuilds the facts on this machine.'}</small>${SNOTE[s.id] ? `<small role="status">${esc(SNOTE[s.id])}</small>` : ''}</span>${bdBtn('Refresh', 'sfone', s.id, true, (s.state === 'off' || s.state === 'building' ? ' disabled' : '') + ` aria-label="Refresh ${esc(s.label)}"`)}</div>`;
|
|
915
915
|
};
|
|
916
|
-
return `<div class="bd-top"><p>Sources are read on a schedule, not live. ${b.length ? pl(b.length, 'source needs', 'sources need') + ' a new read.' : 'None is old.'}</p>${bdBtn('Refresh all', 'sfall', '', false, many.length ? '' : ' disabled')}</div>${a.sources.map(row).join('')}<p class="note">Refresh all reads every source
|
|
916
|
+
return `<div class="bd-top"><p>Sources are read on a schedule, not live. ${b.length ? pl(b.length, 'source needs', 'sources need') + ' a new read.' : 'None is old.'}</p>${bdBtn('Refresh all', 'sfall', '', false, many.length ? '' : ' disabled')}</div>${a.sources.map(row).join('')}<p class="note">Refresh all reads every source, then writes the Briefing from those reads. The server calls nothing outside this machine: an outside source is read by a skill, with your own connection.</p>`;
|
|
917
917
|
}
|
|
918
918
|
let FPOLL = null;
|
|
919
919
|
function srcPoll(redraw, n) {
|
|
@@ -925,6 +925,14 @@ async function srcPress(e, redraw) {
|
|
|
925
925
|
const b = e.target.closest('[data-bda]'); if (!b || BUSY) return;
|
|
926
926
|
const act = b.dataset.bda, ids = act === 'sfall' ? refreshTargets(A.src.sources) : [b.dataset.id];
|
|
927
927
|
BUSY = 'src'; b.disabled = true;
|
|
928
|
+
if (act === 'sfall') {
|
|
929
|
+
// briefing-source-flow slice 3: the same ordered run as the Sources popup: every source, then the Briefing from those reads
|
|
930
|
+
const r = await pmPost('/api/sources/refresh-all', { ws: A.src.ws || wsParam() || '' });
|
|
931
|
+
BUSY = '';
|
|
932
|
+
toast(!r || !r.ok ? 'Refresh all did not start: ' + ((r && r.error) || 'the server did not answer') + '.' : r.joined ? 'Refresh all is already running. ' + allText(r.all) : allText(r.all));
|
|
933
|
+
await readAll(['src']); redraw('[data-bda="sfall"]'); srcPoll(redraw, 8);
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
928
936
|
const got = await Promise.all(ids.map(async (id) => [id, await pmPost('/api/sources/refresh', { ws: A.src.ws || wsParam() || '', source: id })]));
|
|
929
937
|
BUSY = '';
|
|
930
938
|
let bad = 0;
|
|
@@ -1091,6 +1099,7 @@ async function refreshRepos() {
|
|
|
1091
1099
|
let RTIMER = null;
|
|
1092
1100
|
$('#pkw').dataset.park = 'pkPark';
|
|
1093
1101
|
sourcesHook({ html: sourcesHtml, mount: () => { const slot = $('#pkSlot'), w = $('#pkw'); if (slot && w) slot.appendChild(w); }, refresh: refreshRepos });
|
|
1102
|
+
window.addEventListener('pm:refreshed', () => load()); // Refresh all ended: the Briefing it wrote is read again (briefing-source-flow, slice 3)
|
|
1094
1103
|
chatAbout('src:this-page', 'the Briefing');
|
|
1095
1104
|
$('#brief').textContent = 'Reading the repository.';
|
|
1096
1105
|
load();
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
</form>
|
|
48
48
|
<div class="tx rise" style="--d:4" id="tx"><span class="hint" id="capHint" aria-live="polite">One line. The date and priority are read from it, for example "Reply to Rina about SSO by Friday".</span></div>
|
|
49
49
|
<section class="card rise" style="--d:5;margin-top:24px" id="queue" aria-labelledby="hQueue">
|
|
50
|
-
<div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><rect x="4" y="4" width="16" height="16" rx="3"/><path d="M8 9h8M8 13h8M8 17h5"/></svg></span><h2 id="hQueue">Work queue</h2><small id="qCap"></small></div>
|
|
51
|
-
<div class="qtabs" id="qTabs" role="tablist" aria-label="Work queue"></div>
|
|
50
|
+
<div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><rect x="4" y="4" width="16" height="16" rx="3"/><path d="M8 9h8M8 13h8M8 17h5"/></svg></span><h2 id="hQueue">Work queue</h2><small id="qCap"></small><span id="xFocus" class="xfo" role="group" aria-label="Focus today"></span></div>
|
|
51
|
+
<div class="qbar"><div class="qtabs" id="qTabs" role="tablist" aria-label="Work queue"></div><button type="button" class="qmore" id="qMore" aria-haspopup="true" aria-expanded="false" aria-controls="qMenu">More<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="m7 10 5 5 5-5"/></svg></button><div class="qmenu glass" id="qMenu" role="tablist" aria-label="More of the Work queue" hidden></div></div>
|
|
52
52
|
<div class="tgrid" id="qBody" role="tabpanel" aria-labelledby="hQueue"></div>
|
|
53
53
|
<p class="note" id="qNote" style="margin-top:14px"></p>
|
|
54
54
|
</section>
|
package/workspace/server.js
CHANGED
|
@@ -3182,9 +3182,26 @@ function paneScreen(s) {
|
|
|
3182
3182
|
/** Type `input` into session `s` (lib/first-input.js). A Claude Code pane is also read: the prompt is typed once its input box is
|
|
3183
3183
|
* drawn, and Enter is pressed again while the box still holds the prompt (harness-health: the 2026-10-21 morning briefs sat
|
|
3184
3184
|
* unsent). A prompt that is still not sent is written on the session, so the list and the health line say so. */
|
|
3185
|
+
// The pane's foreground command (tmux #{pane_current_command}), or ''.
|
|
3186
|
+
function paneCommand(s) {
|
|
3187
|
+
if (!s || !s.tmux || !TMUX) return '';
|
|
3188
|
+
const r = tmuxCtl(['display-message', '-p', '-t', s.tmux, '#{pane_current_command}']);
|
|
3189
|
+
return r.status === 0 && r.stdout ? String(r.stdout).trim() : '';
|
|
3190
|
+
}
|
|
3191
|
+
/** Is the pane not ready for a prompt yet? The login shell still starting the agent, or Claude Code (its process is named
|
|
3192
|
+
* claude or its version, such as 2.1.305) with no input box on the screen yet. Any other program is typed into at once: a
|
|
3193
|
+
* `node` process is not taken for Claude Code, because the suites' stand-in agents are node scripts named claude. */
|
|
3194
|
+
const LOGIN_SHELLS = new Set(['zsh', '-zsh', 'bash', '-bash', 'fish', 'login']);
|
|
3195
|
+
function paneNotReady(s) {
|
|
3196
|
+
const cmd = paneCommand(s);
|
|
3197
|
+
if (!cmd) return false;
|
|
3198
|
+
if (LOGIN_SHELLS.has(cmd)) return true;
|
|
3199
|
+
if (/^(claude|\d+\.\d+\.\d+)$/i.test(cmd)) return firstInput.boxText(paneScreen(s)) === null;
|
|
3200
|
+
return false;
|
|
3201
|
+
}
|
|
3185
3202
|
function deliverInput(s, input) {
|
|
3186
3203
|
const screen = s && s.agent === 'claude' && s.tmux && TMUX ? () => paneScreen(s) : null;
|
|
3187
|
-
firstInput.deliver(s, input, { screen, onDone: (why) => {
|
|
3204
|
+
firstInput.deliver(s, input, { screen, wait: screen ? () => paneNotReady(s) : null, onDone: (why) => {
|
|
3188
3205
|
if (why === 'resubmitted' || why === 'unsent') { try { s.firstInput = { result: why, at: Date.now() }; } catch { /* nothing to keep */ } }
|
|
3189
3206
|
if (why === 'unsent') { s.note = 'its prompt was typed but not sent'; try { pushSessions(); } catch { /* the next list shows it */ } }
|
|
3190
3207
|
} });
|
|
@@ -9245,7 +9262,7 @@ async function handleRequest(req, res) {
|
|
|
9245
9262
|
// closes the check that sent it (G22).
|
|
9246
9263
|
try { dayAfterBrief(out.date, merged); } catch (e) { warnWriteFail('day run after the brief', e); }
|
|
9247
9264
|
// data-refresh-settings: a full brief ends the morning brief's refresh run (its session stays open after it submits).
|
|
9248
|
-
if (body.merge !== true) { try { refreshRun.briefDone(`${(out.
|
|
9265
|
+
if (body.merge !== true) { try { refreshRun.briefDone(`${(out.priorities || []).length + (out.worth_asking || []).length} items`); } catch (e) { warnWriteFail('refresh log (brief)', e); } }
|
|
9249
9266
|
return json(res, { ok: true, brief: out, ...(merged ? { merged } : {}), ...(remembered ? { remembered } : {}), ...(memoryError ? { memory_error: memoryError } : {}) });
|
|
9250
9267
|
}
|
|
9251
9268
|
if (req.method === 'GET') {
|
|
@@ -9699,6 +9716,7 @@ async function handleRequest(req, res) {
|
|
|
9699
9716
|
},
|
|
9700
9717
|
// workspace-data-freshness: the source table, the facts rebuild and Refresh now's skill sessions
|
|
9701
9718
|
freshness, factsRefresh: (root) => factsAsync.refresh(root, { force: true }), startSkill: startSkillSession, health: () => harnessHealth(),
|
|
9719
|
+
refreshAll: (wsId) => refreshRun.refreshAll(wsId), refreshAllState: () => refreshRun.allState(),
|
|
9702
9720
|
// c3-initiative-boards: the PMOS checkout this server is embedded in, whose default board keeps its derived ladder
|
|
9703
9721
|
selfRoot: EMBEDDED_SELF ? SELF_ROOT : null,
|
|
9704
9722
|
// horizon-scan-portfolio: Scan now, Stop and an approved research proposal start and end runs in the scanner; scanClock fixes its clock in the suites
|