create-pmos 0.366.0 → 0.368.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 +30 -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-work-test.js +11 -4
- package/workspace/changelog.json +29 -0
- package/workspace/guide/briefing-premium.md +4 -2
- package/workspace/lib/first-input.js +19 -1
- package/workspace/lib/harness-health.js +10 -1
- package/workspace/lib/refresh-run.js +13 -6
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-phone-room-test.js +102 -0
- package/workspace/premium-work-depth-test.js +16 -14
- package/workspace/public/pm/premium-shell.js +22 -3
- package/workspace/public/pm/premium-work.js +27 -12
- package/workspace/public/pm/premium.css +33 -2
- package/workspace/public/premium-work.html +2 -2
- package/workspace/server.js +19 -2
- package/workspace/test-lists/premium-phone-room.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.368.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,35 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.368.0",
|
|
37
|
+
"at": "2026-10-21T02:13:10.598Z",
|
|
38
|
+
"f": 2,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 976,
|
|
42
|
+
"t": "The phone conversation gets the screen when it scrolls",
|
|
43
|
+
"s": "The phone conversation gets the screen when it scrolls"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"v": "0.367.0",
|
|
49
|
+
"at": "2026-10-21T02:01:19.184Z",
|
|
50
|
+
"f": 2,
|
|
51
|
+
"prs": [
|
|
52
|
+
{
|
|
53
|
+
"n": 969,
|
|
54
|
+
"t": "My work's first screen has one solid button (calmer first screen 1/5)",
|
|
55
|
+
"s": "My work's first screen has one solid button (calmer first screen 1/5)"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"n": 968,
|
|
59
|
+
"t": "A prompt waits for Claude Code's input box; one brief ends one run with its real count",
|
|
60
|
+
"s": "A Claude Code prompt is typed only once the agent is ready."
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
35
64
|
{
|
|
36
65
|
"v": "0.366.0",
|
|
37
66
|
"at": "2026-10-21T01:38:19.286Z",
|
|
@@ -287,35 +316,6 @@
|
|
|
287
316
|
"s": "It follows the approved simple-UI mockup (#3)."
|
|
288
317
|
}
|
|
289
318
|
]
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
"v": "0.348.0",
|
|
293
|
-
"at": "2026-10-20T06:24:40.333Z",
|
|
294
|
-
"f": 2,
|
|
295
|
-
"prs": [
|
|
296
|
-
{
|
|
297
|
-
"n": 948,
|
|
298
|
-
"t": "The Agent proposals dialog shows one card per proposal and one bottom bar",
|
|
299
|
-
"s": "Each proposal is one card with what it is, its target and the draft in two lines, plus Read more for the why and the sources."
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
"n": 950,
|
|
303
|
-
"t": "Premium explanations fold behind one info button",
|
|
304
|
-
"s": "Each of those sits behind one ⓘ, with the words unchanged."
|
|
305
|
-
}
|
|
306
|
-
]
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
"v": "0.347.0",
|
|
310
|
-
"at": "2026-10-20T06:13:15.916Z",
|
|
311
|
-
"f": 2,
|
|
312
|
-
"prs": [
|
|
313
|
-
{
|
|
314
|
-
"n": 945,
|
|
315
|
-
"t": "Background runs yield to working chat and /goal sessions; no new draft while one waits",
|
|
316
|
-
"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."
|
|
317
|
-
}
|
|
318
|
-
]
|
|
319
319
|
}
|
|
320
320
|
]
|
|
321
321
|
}
|
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:13:06Z"}
|
|
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:13:06Z"}
|
|
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:13:06Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -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 */
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.368.0",
|
|
4
|
+
"at": "2026-10-21T02:13:10.598Z",
|
|
5
|
+
"f": 2,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 976,
|
|
9
|
+
"t": "The phone conversation gets the screen when it scrolls",
|
|
10
|
+
"s": "The phone conversation gets the screen when it scrolls"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"v": "0.367.0",
|
|
16
|
+
"at": "2026-10-21T02:01:19.184Z",
|
|
17
|
+
"f": 2,
|
|
18
|
+
"prs": [
|
|
19
|
+
{
|
|
20
|
+
"n": 969,
|
|
21
|
+
"t": "My work's first screen has one solid button (calmer first screen 1/5)",
|
|
22
|
+
"s": "My work's first screen has one solid button (calmer first screen 1/5)"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"n": 968,
|
|
26
|
+
"t": "A prompt waits for Claude Code's input box; one brief ends one run with its real count",
|
|
27
|
+
"s": "A Claude Code prompt is typed only once the agent is ready."
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
2
31
|
{
|
|
3
32
|
"v": "0.366.0",
|
|
4
33
|
"at": "2026-10-21T01:38:19.286Z",
|
|
@@ -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.
|
|
@@ -380,6 +380,8 @@ The premium Briefing is the default page: `/` and `/index.html` open it. The con
|
|
|
380
380
|
|
|
381
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
382
|
|
|
383
|
+
**More room for the conversation.** On a phone or tablet, when you scroll a long conversation down, the head keeps only the title and the tools. On the Chat page the bar at the bottom also moves away, and the conversation takes its place. Scroll up a little, or press the title, to see them again. While you type on the Chat page the bar stays away, and the page fits the space above the keyboard.
|
|
384
|
+
|
|
383
385
|
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.
|
|
384
386
|
|
|
385
387
|
**ⓘ 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.
|
|
@@ -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,7 +4,7 @@
|
|
|
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
|
|
@@ -27,6 +27,7 @@ const PRUNE_EVERY_MS = 24 * 3600 * 1000;
|
|
|
27
27
|
const LOST_MS = 6 * 3600 * 1000; // a run with no live session and no end after this long is written as interrupted
|
|
28
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
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)
|
|
30
31
|
|
|
31
32
|
function create(host) {
|
|
32
33
|
const now = () => (host.now ? host.now() : Date.now());
|
|
@@ -125,9 +126,14 @@ function create(host) {
|
|
|
125
126
|
const src = R.BY_ID.get(id);
|
|
126
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); } }
|
|
127
128
|
const next = { ...st, open: rest, last_end: t, last_result: result };
|
|
128
|
-
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; }
|
|
129
134
|
const scheduled = ['schedule', 'catch-up', 'retry'].includes(o.trigger);
|
|
130
|
-
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; }
|
|
131
137
|
else if (result === 'failed' && o.trigger === 'retry') next.retry_at = null;
|
|
132
138
|
state[id] = next;
|
|
133
139
|
R.writeState(dir, state);
|
|
@@ -136,10 +142,11 @@ function create(host) {
|
|
|
136
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); }
|
|
137
143
|
}
|
|
138
144
|
}
|
|
139
|
-
/** 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. */
|
|
140
147
|
function briefDone(got) {
|
|
141
|
-
const state = R.readState(dir); const
|
|
142
|
-
|
|
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' });
|
|
143
150
|
}
|
|
144
151
|
/** A run with no session: one start line and one end line (signals, the repository rebuild, Git sync). */
|
|
145
152
|
function codeRun(id, { result = 'done', got = null, error = null, took_ms = null, trigger = 'change', ws = null } = {}) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.368.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.368.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* premium-phone-room-test.js — more room for the conversation on a phone (Wawan, 2026-10-21: "the scrollable area is still too small because of
|
|
4
|
+
* the persistent menu on the bottom and top"). A real server on a scratch repository (c3-scan-fixture.js); the conversation is filled in the page.
|
|
5
|
+
* P1 the Chat page at rest · P2 a scroll with no hand changes nothing · P3 scrolling down hides the switch and the rail · P4 scrolling up
|
|
6
|
+
* brings them back · P5 a press on the title brings them back · P6 typing moves the rail away · P7 a chat dialog shrinks its head, the rail
|
|
7
|
+
* class stays off · P8 a desktop is unchanged
|
|
8
|
+
* Set PHONE_ROOM_SHOTS=<dir> to save the Chat page at 390 wide, light and dark, scrolled and typing. */
|
|
9
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
10
|
+
require('./test-run').configure({ name: 'premium-phone-room' });
|
|
11
|
+
const Fx = require('./c3-scan-fixture.js');
|
|
12
|
+
|
|
13
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
14
|
+
const until = async (fn, ms = 8000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
15
|
+
const results = [];
|
|
16
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
|
|
17
|
+
let F = null, browser = null;
|
|
18
|
+
const finish = async (code) => {
|
|
19
|
+
if (browser) await browser.close().catch(() => {});
|
|
20
|
+
if (F) F.stop();
|
|
21
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
22
|
+
console.log(`\n${results.length - bad}/${results.length} premium-phone-room assertions passed`);
|
|
23
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
24
|
+
};
|
|
25
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
26
|
+
|
|
27
|
+
/* the page's own state: the head, the rail and how much of the screen the conversation gets */
|
|
28
|
+
const look = () => {
|
|
29
|
+
const g = document.querySelector('#dlg'), rail = document.querySelector('.rail').getBoundingClientRect(), body = document.querySelector('#dBody').getBoundingClientRect(), ask = document.querySelector('#askF').getBoundingClientRect();
|
|
30
|
+
return { shrunk: g.classList.contains('shrunk'), railoff: document.body.classList.contains('railoff'), typing: document.body.classList.contains('typing'), tabs: getComputedStyle(document.querySelector('#dTabs')).display !== 'none', railTop: Math.round(rail.top), dlgH: Math.round(g.getBoundingClientRect().height), room: Math.round(ask.top - body.top), vh: innerHeight };
|
|
31
|
+
};
|
|
32
|
+
const fill = () => { const s = document.querySelector('#dBody .stream'); let h = ''; for (let i = 0; i < 14; i++) h += `<div class="turn"><p>${'A line of the conversation about the sign-up drop reasons and the counts. '.repeat(3)}</p></div>`; s.insertAdjacentHTML('beforeend', h); };
|
|
33
|
+
/* a hand scroll: a wheel, then the move; dy > 0 is down */
|
|
34
|
+
const hand = (dy) => { const b = document.querySelector('#dBody'); b.dispatchEvent(new WheelEvent('wheel', { deltaY: dy })); b.scrollTop += dy; };
|
|
35
|
+
const bare = (y) => { document.querySelector('#dBody').scrollTop = y; };
|
|
36
|
+
|
|
37
|
+
(async () => {
|
|
38
|
+
const exe = findBrowser();
|
|
39
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
40
|
+
let chromium;
|
|
41
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
42
|
+
F = await Fx.start({ name: 'premium-phone-room' });
|
|
43
|
+
browser = await chromium.launch({ executablePath: exe, headless: true, args: ['--no-sandbox'] });
|
|
44
|
+
const shots = process.env.PHONE_ROOM_SHOTS;
|
|
45
|
+
const chat = `${F.BASE}/premium-chat.html?ws=${encodeURIComponent(F.ws)}`;
|
|
46
|
+
const open = async (width, scheme = 'light', height = 844) => {
|
|
47
|
+
const ctx = await browser.newContext({ viewport: { width, height }, colorScheme: scheme, hasTouch: true });
|
|
48
|
+
const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
|
|
49
|
+
await p.goto(chat); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && document.querySelector('#dGrid').dataset.tab === 'chat'));
|
|
50
|
+
await p.evaluate(fill); await sleep(200);
|
|
51
|
+
return { p, ctx, errs };
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
{ const { p, ctx, errs } = await open(390);
|
|
55
|
+
const s0 = await p.evaluate(look);
|
|
56
|
+
ok('P1 the Chat page at rest shows the switch and the rail above the screen foot', s0.tabs && !s0.shrunk && !s0.railoff && s0.railTop < s0.vh, JSON.stringify(s0));
|
|
57
|
+
await p.evaluate(bare, 600); await sleep(600);
|
|
58
|
+
const s1 = await p.evaluate(look);
|
|
59
|
+
ok('P2 a scroll no hand made (a new turn scrolling to the end) hides nothing', s1.tabs && !s1.shrunk && !s1.railoff, JSON.stringify(s1));
|
|
60
|
+
await sleep(900); await p.evaluate(hand, 200);
|
|
61
|
+
const s2 = await until(async () => { const v = await p.evaluate(look); return v.shrunk && v.railoff && v.railTop >= v.vh && v.dlgH >= v.vh - 2 ? v : null; }) || await p.evaluate(look);
|
|
62
|
+
ok('P3 scrolling the conversation down hides the switch, moves the rail off the screen and gives the page its place', s2.shrunk && !s2.tabs && s2.railoff && s2.railTop >= s2.vh && s2.dlgH >= s2.vh - 2, JSON.stringify(s2));
|
|
63
|
+
ok('P3b the conversation gets at least 680 px of the 844 px screen (516 px before)', s2.room >= 680, JSON.stringify(s2));
|
|
64
|
+
if (shots) await p.screenshot({ path: `${shots}/chat-scrolled-390-light.png` });
|
|
65
|
+
await sleep(600); await p.evaluate(hand, -80);
|
|
66
|
+
const s3 = await until(async () => { const v = await p.evaluate(look); return !v.shrunk && !v.railoff && v.tabs && v.railTop < v.vh ? v : null; }) || await p.evaluate(look);
|
|
67
|
+
ok('P4 scrolling up a little brings the switch and the rail back', !s3.shrunk && !s3.railoff && s3.tabs && s3.railTop < s3.vh, JSON.stringify(s3));
|
|
68
|
+
await sleep(600); await p.evaluate(hand, 200); await until(() => p.evaluate(() => document.body.classList.contains('railoff')));
|
|
69
|
+
await sleep(500); await p.click('#dTitle');
|
|
70
|
+
const s4 = await until(async () => { const v = await p.evaluate(look); return !v.shrunk && !v.railoff ? v : null; }) || await p.evaluate(look);
|
|
71
|
+
ok('P5 a press on the title brings them back', !s4.shrunk && !s4.railoff && s4.tabs, JSON.stringify(s4));
|
|
72
|
+
await p.focus('#askIn');
|
|
73
|
+
const s5 = await until(async () => { const v = await p.evaluate(look); return v.typing && v.railTop >= v.vh ? v : null; }) || await p.evaluate(look);
|
|
74
|
+
ok('P6 typing in the message box moves the rail away', s5.typing && s5.railTop >= s5.vh, JSON.stringify(s5));
|
|
75
|
+
await p.evaluate(() => document.querySelector('#askIn').blur());
|
|
76
|
+
const s6 = await until(async () => { const v = await p.evaluate(look); return !v.typing && v.railTop < v.vh ? v : null; }) || await p.evaluate(look);
|
|
77
|
+
ok('P6b leaving the box brings the rail back', !s6.typing && s6.railTop < s6.vh, JSON.stringify(s6));
|
|
78
|
+
ok('P6c no page error', errs.length === 0, errs.join(' | '));
|
|
79
|
+
await ctx.close(); }
|
|
80
|
+
|
|
81
|
+
if (shots) for (const scheme of ['light', 'dark']) {
|
|
82
|
+
const { p, ctx } = await open(390, scheme, 844 - 336);
|
|
83
|
+
await p.focus('#askIn'); await sleep(700); await p.screenshot({ path: `${shots}/chat-typing-390-${scheme}.png` });
|
|
84
|
+
await ctx.close();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
{ const ctx = await browser.newContext({ viewport: { width: 390, height: 844 }, hasTouch: true }); const p = await ctx.newPage();
|
|
88
|
+
await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(F.ws)}`); await until(() => p.evaluate(() => !!document.querySelector('.rail')));
|
|
89
|
+
await p.evaluate(async () => { const m = await import('/pm/premium-shell.js'); m.openDlg({ eye: 'Goal', title: 'Check the sign-up funnel', sub: 'Working · round 1 of 12', html: '<p>detail</p>', say: 'Hello', noteKey: 'work:x' }); m.setTab('chat'); });
|
|
90
|
+
await p.evaluate(fill); await sleep(700); await p.evaluate(hand, 200);
|
|
91
|
+
const d = await until(async () => { const v = await p.evaluate(look); return v.shrunk ? v : null; }) || await p.evaluate(look);
|
|
92
|
+
ok('P7 a chat dialog on another page shrinks its head when the conversation scrolls down, and leaves the page\'s rail alone', d.shrunk && !d.tabs && !d.railoff, JSON.stringify(d));
|
|
93
|
+
await ctx.close(); }
|
|
94
|
+
|
|
95
|
+
{ const { p, ctx } = await open(1280);
|
|
96
|
+
await sleep(700); await p.evaluate(hand, 200); await sleep(600);
|
|
97
|
+
const w = await p.evaluate(look);
|
|
98
|
+
ok('P8 on a desktop scrolling the conversation hides nothing', !w.shrunk && !w.railoff, JSON.stringify(w));
|
|
99
|
+
await ctx.close(); }
|
|
100
|
+
|
|
101
|
+
return finish();
|
|
102
|
+
})();
|
|
@@ -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));
|
|
@@ -245,7 +245,7 @@ export function openDlg(o) {
|
|
|
245
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
|
|
246
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>`;
|
|
247
247
|
mountPad({ key: S.key, ws: new URLSearchParams(location.search).get('ws'), input: $('#askIn') });
|
|
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
|
|
248
|
+
$('#dlg').classList.toggle('cmp', o.compact !== false); $('#dlg').classList.remove('shrunk', 'tfull'); document.body.classList.remove('railoff'); // compact (every dialog unless it says compact: false): a short head on a phone that shrinks as the detail scrolls
|
|
249
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
|
|
250
250
|
$('#veil').classList.add('on'); $('#dlg').classList.add('on');
|
|
251
251
|
$$('#dGrid .pane').forEach((p) => { p.scrollTop = 0; });
|
|
@@ -253,7 +253,7 @@ export function openDlg(o) {
|
|
|
253
253
|
setTimeout(() => $('#dlg').focus(), 60);
|
|
254
254
|
}
|
|
255
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')
|
|
256
|
+
$('#dTitle').addEventListener('click', () => { const g = $('#dlg'); if (!g.classList.contains('cmp') || innerWidth >= 1000) return; if (g.classList.contains('shrunk')) { roomOff(); return; } g.classList.toggle('tfull'); });
|
|
257
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.
|
|
258
258
|
* It shrinks only when the detail is much taller than its pane, so the smaller head cannot end the scroll and grow back. */
|
|
259
259
|
$('#dOut').addEventListener('scroll', () => {
|
|
@@ -261,6 +261,25 @@ $('#dOut').addEventListener('scroll', () => {
|
|
|
261
261
|
if (p.scrollTop > 48 && p.scrollHeight - p.clientHeight > 200) g.classList.add('shrunk');
|
|
262
262
|
else if (p.scrollTop < 8) g.classList.remove('shrunk');
|
|
263
263
|
}, { passive: true });
|
|
264
|
+
/* More room on a phone (premium-phone-room): while the PM reads a long conversation, scrolling it down hides the head's sub line and the
|
|
265
|
+
* Detail / Conversation switch, and on the Chat page the rail too. Scrolling it up a little, or a press on the title, brings them back.
|
|
266
|
+
* Only a finger or a wheel counts, so a new turn that scrolls the conversation to its end does not hide them. Nothing is removed. */
|
|
267
|
+
const ROOM = { y: 0, until: 0, hand: 0 };
|
|
268
|
+
function roomOn() { const g = $('#dlg'); g.classList.add('shrunk'); if (chatPage()) document.body.classList.add('railoff'); ROOM.until = Date.now() + 450; }
|
|
269
|
+
function roomOff() { $('#dlg').classList.remove('shrunk'); document.body.classList.remove('railoff'); ROOM.until = Date.now() + 450; }
|
|
270
|
+
['touchmove', 'wheel'].forEach((t) => $('#dBody').addEventListener(t, () => { ROOM.hand = Date.now(); }, { passive: true }));
|
|
271
|
+
$('#dBody').addEventListener('scroll', () => {
|
|
272
|
+
const g = $('#dlg'), b = $('#dBody'), y = b.scrollTop, dy = y - ROOM.y;
|
|
273
|
+
if (!g.classList.contains('cmp') || innerWidth >= 1000 || $('#dGrid').dataset.tab !== 'chat') { ROOM.y = y; return; }
|
|
274
|
+
if (Date.now() < ROOM.until || Date.now() - ROOM.hand > 800) { ROOM.y = y; return; } // the head just changed size, or no hand moved it
|
|
275
|
+
if (dy > 24 && b.scrollHeight - b.clientHeight > 200) { roomOn(); ROOM.y = y; }
|
|
276
|
+
else if (dy < -24 || y < 8) { roomOff(); ROOM.y = y; }
|
|
277
|
+
}, { passive: true });
|
|
278
|
+
/* Typing on the Chat page on a phone: the rail steps aside so the keyboard, the message box and the conversation share the screen. */
|
|
279
|
+
$('#dBody').addEventListener('focusin', (e) => { if (chatPage() && innerWidth < 1000 && e.target.id === 'askIn') document.body.classList.add('typing'); });
|
|
280
|
+
$('#dBody').addEventListener('focusout', (e) => { if (e.target.id === 'askIn') document.body.classList.remove('typing'); });
|
|
281
|
+
/* The on-screen keyboard: the Chat page is as tall as what is left of the screen above it (visualViewport), not the whole screen. */
|
|
282
|
+
if (window.visualViewport) { const vv = window.visualViewport, fit = () => { if (chatPage()) document.documentElement.style.setProperty('--vvh', Math.round(vv.height) + 'px'); }; vv.addEventListener('resize', fit); fit(); }
|
|
264
283
|
export function closeDlg() {
|
|
265
284
|
if (chatPage()) return;
|
|
266
285
|
clearTimeout(threadTimer); S.key = null; flushPad(); railOnClose();
|
|
@@ -271,7 +290,7 @@ export function closeDlg() {
|
|
|
271
290
|
if (lastFocus) { try { lastFocus.focus(); } catch { /* gone */ } }
|
|
272
291
|
}
|
|
273
292
|
export function pillOf(s) { const o = $('button[aria-pressed="true"]', s), p = $('.pill', s); requestAnimationFrame(() => { if (!o || !p) return; p.style.left = o.offsetLeft + 'px'; p.style.width = o.offsetWidth + 'px'; }); }
|
|
274
|
-
export function setTab(t) { $('#dGrid').dataset.tab = t; $$('#dTabs button').forEach((b) => b.setAttribute('aria-pressed', b.dataset.t === t)); pillOf($('#dTabs .seg')); }
|
|
293
|
+
export function setTab(t) { if ($('#dGrid').dataset.tab !== t) roomOff(); $('#dGrid').dataset.tab = t; $$('#dTabs button').forEach((b) => b.setAttribute('aria-pressed', b.dataset.t === t)); pillOf($('#dTabs .seg')); }
|
|
275
294
|
export function setMode(m) {
|
|
276
295
|
$('#dlg').dataset.mode = m;
|
|
277
296
|
const b = $('#dPane'), on = m === 'split';
|
|
@@ -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)}
|
|
@@ -2554,3 +2574,14 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
|
|
|
2554
2574
|
.chatpg #dClose,.chatpg #dExpand,.chatpg .dlg .grab{display:none}
|
|
2555
2575
|
@media (min-width:1000px){.chatpg .dlg.on{left:128px;top:16px;transform:none;width:calc(100% - 144px);height:calc(100% - 32px);max-height:none!important;border-radius:28px;padding:26px 34px 18px}}
|
|
2556
2576
|
@media (max-width:999px){.chatpg .dlg.on{left:0;top:0;transform:none;width:100%;height:calc(100% - 118px - env(safe-area-inset-bottom,0px));max-height:none!important;border-radius:0 0 28px 28px;padding:16px 18px 14px}}
|
|
2577
|
+
|
|
2578
|
+
/* ── premium-phone-room: on a phone the Chat page gives the conversation the screen. Scrolling the conversation down, or typing, moves the rail
|
|
2579
|
+
off the bottom and the page grows into its place; scrolling up brings the rail back. The page is as tall as what the keyboard leaves (--vvh). ── */
|
|
2580
|
+
@media (max-width:999px){
|
|
2581
|
+
.chatpg .rail{transition:transform .45s var(--spring),opacity .3s}
|
|
2582
|
+
.chatpg.railoff .rail,.chatpg.typing .rail{transform:translate(-50%,calc(100% + 40px));opacity:0;pointer-events:none}
|
|
2583
|
+
.chatpg .dlg.on{height:calc(var(--vvh,100%) - 118px - env(safe-area-inset-bottom,0px))}
|
|
2584
|
+
.chatpg.railoff .dlg.on{height:var(--vvh,100%);padding-bottom:calc(14px + env(safe-area-inset-bottom,0px))}
|
|
2585
|
+
.chatpg.typing .dlg.on{height:var(--vvh,100%)}
|
|
2586
|
+
}
|
|
2587
|
+
@media (max-width:999px) and (prefers-reduced-motion:reduce){.chatpg .rail{transition:none}}
|
|
@@ -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') {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "More room for the conversation on a phone: on the Chat page scrolling down hides the head's switch and the rail, scrolling up or the title brings them back, typing moves the rail away. Real server, 390 and 1280 wide.",
|
|
3
|
+
"seconds": {
|
|
4
|
+
"premium-phone-room-test.js": 40
|
|
5
|
+
},
|
|
6
|
+
"panels": [
|
|
7
|
+
"premium-phone-room-test.js"
|
|
8
|
+
]
|
|
9
|
+
}
|