create-pmos 0.378.0 → 0.380.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -25
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-test.js +1 -1
- package/workspace/changelog.json +24 -0
- package/workspace/guide/briefing-premium.md +18 -11
- package/workspace/lib/chat-files.js +50 -3
- package/workspace/lib/routes-briefing-premium.js +18 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-chat-attach-test.js +2 -3
- package/workspace/premium-chat-goal-view-test.js +126 -0
- package/workspace/premium-chat-notes-test.js +146 -0
- package/workspace/public/pm/goal-chat.js +32 -3
- package/workspace/public/pm/premium-attach.js +17 -6
- package/workspace/public/pm/premium-notes.js +227 -0
- package/workspace/public/pm/premium-shell.js +41 -12
- package/workspace/public/pm/premium-viewer.js +1 -0
- package/workspace/public/pm/premium-vw-notepad.css +41 -0
- package/workspace/public/pm/premium.css +2 -21
- package/workspace/test-lists/premium-chat-goal-view.json +9 -0
- package/workspace/test-lists/premium-chat-notes.json +13 -0
- package/workspace/premium-pad-test.js +0 -125
- package/workspace/public/pm/premium-pad.js +0 -89
- package/workspace/test-lists/premium-pad.json +0 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.380.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,30 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.380.0",
|
|
37
|
+
"at": "2026-10-21T09:18:41.886Z",
|
|
38
|
+
"f": 2,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 989,
|
|
42
|
+
"t": "The /goal card opens in the viewer as a Goal tab",
|
|
43
|
+
"s": "The /goal card opens in the viewer as a Goal tab"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"v": "0.379.0",
|
|
49
|
+
"at": "2026-10-21T08:59:34.421Z",
|
|
50
|
+
"f": 2,
|
|
51
|
+
"prs": [
|
|
52
|
+
{
|
|
53
|
+
"n": 988,
|
|
54
|
+
"t": "Notes replace the Scratchpad in the premium chat",
|
|
55
|
+
"s": "Notes replace the Scratchpad in the premium chat"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
35
59
|
{
|
|
36
60
|
"v": "0.378.0",
|
|
37
61
|
"at": "2026-10-21T07:48:19.057Z",
|
|
@@ -297,30 +321,6 @@
|
|
|
297
321
|
"s": "PMOS reads the pane after it presses Enter."
|
|
298
322
|
}
|
|
299
323
|
]
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
"v": "0.360.0",
|
|
303
|
-
"at": "2026-10-20T13:51:06.028Z",
|
|
304
|
-
"f": 2,
|
|
305
|
-
"prs": [
|
|
306
|
-
{
|
|
307
|
-
"n": 959,
|
|
308
|
-
"t": "The Work queue has no Agents tab; agent state is a chip on the row and drafts wait in the bell",
|
|
309
|
-
"s": "There is no Agents tab."
|
|
310
|
-
}
|
|
311
|
-
]
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
"v": "0.359.0",
|
|
315
|
-
"at": "2026-10-20T13:30:13.743Z",
|
|
316
|
-
"f": 2,
|
|
317
|
-
"prs": [
|
|
318
|
-
{
|
|
319
|
-
"n": 958,
|
|
320
|
-
"t": "The phone rail returns to the bottom after the keyboard closes",
|
|
321
|
-
"s": "When a field loses focus or the keyboard closes, the bar goes back to the bottom of the screen and the dock back to the top."
|
|
322
|
-
}
|
|
323
|
-
]
|
|
324
324
|
}
|
|
325
325
|
]
|
|
326
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-21T09:18:37Z"}
|
|
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-21T09:18:37Z"}
|
|
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-21T09:18:37Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -414,7 +414,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
414
414
|
ok('W3 "Tomorrow" posts the key and the time, and closes the dialog', await until(() => posts.some((x) => x.path === '/api/briefing-premium/put-off' && x.body.key === 'decision:KC5' && x.body.until === 'tomorrow')) && await until(() => pg.evaluate(() => !document.querySelector('#dlg').classList.contains('on'))));
|
|
415
415
|
// slice 3: the read-only agent behind the reply box
|
|
416
416
|
await shut(); await openIdx(3);
|
|
417
|
-
ok('A1 the reply box has one Send to Claude button, 44 px, and no note button', await pg.evaluate(() => { const a = document.querySelector('#askGo'); const h = (e) => e.getBoundingClientRect().height; return !!a && h(a) >= 44 && /Send to Claude/.test(a.title) && !document.querySelector('#noteGo') &&
|
|
417
|
+
ok('A1 the reply box has one Send to Claude button, 44 px, and no note button', await pg.evaluate(() => { const a = document.querySelector('#askGo'); const h = (e) => e.getBoundingClientRect().height; return !!a && h(a) >= 44 && /Send to Claude/.test(a.title) && !document.querySelector('#noteGo') && ![...document.querySelector('#askF').childNodes].filter((n) => n.id !== 'plusM').some((n) => /note/i.test(n.textContent)); })); // the + menu's Notes item opens the notepad, not a note button
|
|
418
418
|
ok('A1b a hidden question box is not drawn (the Mentions dialog has no agent thread)', await pg.evaluate(() => { const f = document.querySelector('#askF'); if (!f) return false; f.hidden = true; const d = getComputedStyle(f).display; f.hidden = false; return d === 'none'; }));
|
|
419
419
|
answer = { status: 200, body: { ok: true, id: 'bq-1', state: 'working' } };
|
|
420
420
|
await pg.fill('#askIn', 'Why is KC5 on my list?');
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.380.0",
|
|
4
|
+
"at": "2026-10-21T09:18:41.886Z",
|
|
5
|
+
"f": 2,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 989,
|
|
9
|
+
"t": "The /goal card opens in the viewer as a Goal tab",
|
|
10
|
+
"s": "The /goal card opens in the viewer as a Goal tab"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"v": "0.379.0",
|
|
16
|
+
"at": "2026-10-21T08:59:34.421Z",
|
|
17
|
+
"f": 2,
|
|
18
|
+
"prs": [
|
|
19
|
+
{
|
|
20
|
+
"n": 988,
|
|
21
|
+
"t": "Notes replace the Scratchpad in the premium chat",
|
|
22
|
+
"s": "Notes replace the Scratchpad in the premium chat"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
2
26
|
{
|
|
3
27
|
"v": "0.378.0",
|
|
4
28
|
"at": "2026-10-21T07:48:19.057Z",
|
|
@@ -427,19 +427,24 @@ The conversation beside every premium dialog is a real Claude Code session. Anyt
|
|
|
427
427
|
|
|
428
428
|
Sending and the option presses need the page's launch nonce, so an agent session cannot type into your chat.
|
|
429
429
|
|
|
430
|
-
###
|
|
430
|
+
### Notes
|
|
431
431
|
|
|
432
|
-
|
|
432
|
+
Notes is a notepad for each conversation. Open it from **+** › **Notes**. It opens in the viewer beside the conversation. On a phone, it opens on the viewer tab.
|
|
433
433
|
|
|
434
|
-
- The
|
|
435
|
-
-
|
|
436
|
-
-
|
|
437
|
-
- To
|
|
438
|
-
-
|
|
434
|
+
- A conversation can have more than one note. The head shows the title of the note (its first line) and how many notes there are. Press the title to see the list and pick a note. **Delete this note** is at the end of the list. It asks first.
|
|
435
|
+
- The **+** button in the head makes a new note.
|
|
436
|
+
- Each note is saved as you type, as a Markdown file on this machine (`chat-files/<conversation>/notes/`). It never goes into a repository. The head says **Saved**.
|
|
437
|
+
- To format, type a start at the beginning of a line and then a space: `#`, `##` or `###` for a heading, `-` for a bullet, `1.` for a numbered list and `[]` for a checkbox. Ctrl+B (Cmd+B on a Mac) makes text bold and Ctrl+I makes it italic. Press a checkbox to tick it.
|
|
438
|
+
- In a checkbox list, Enter makes the next checkbox. Enter on an empty checkbox ends the list.
|
|
439
|
+
- The two buttons at the bottom have icons only. Hold the pointer on a button to see its name.
|
|
440
|
+
- **Add selection to message** (the arrow into a line) puts the words you selected into the message box. With nothing selected, it puts the whole note there. Nothing is sent.
|
|
441
|
+
- **Share with Claude** (the arrow up out of a box) puts the note on your message as a file, like an attachment. Claude reads the note when you send. Your message shows it as a **Note** chip. Press the chip to open the note.
|
|
442
|
+
- The old Scratchpad text of a conversation becomes its first note when you open Notes. Nothing is lost.
|
|
443
|
+
- A dialog with no conversation has no Notes.
|
|
439
444
|
|
|
440
445
|
### Attach files and photos
|
|
441
446
|
|
|
442
|
-
Press **+** at the left of the message box. The menu has three items: **Add files or photos**, **Slash commands** and **
|
|
447
|
+
Press **+** at the left of the message box. The menu has three items: **Add files or photos**, **Slash commands** and **Notes**.
|
|
443
448
|
|
|
444
449
|
- **Add files or photos** opens the file chooser. You can pick more than one file. On a phone, the phone shows its own choices, such as Take Photo and Photo Library.
|
|
445
450
|
- On a computer, you can also drag a file onto the conversation, or paste a screenshot into the message box.
|
|
@@ -456,12 +461,14 @@ Type `/` in the box to see the commands: `/goal`, `/compact` and `/clear`. Use t
|
|
|
456
461
|
|
|
457
462
|
- **`/goal <what you want>`** asks Claude to make the goal SMART before any work. Claude reads the records first, then asks only what it could not find out: at most 5 questions, one at a time, about how you will know it is done, by when, whether it can be done here, and what it serves.
|
|
458
463
|
- **Each question** shows its answers as buttons, with the recommended one marked. Press one, or answer in your own words. **Start with defaults** stops the questions; a value you did not give is marked "assumed".
|
|
459
|
-
- **The goal card**
|
|
464
|
+
- **The goal card** is in the viewer, in a **Goal** tab, like Notes. The conversation shows only a small Goal chip with the goal's state; press it to open the tab. On a phone the tab covers the page, and **Back** returns to the conversation.
|
|
465
|
+
- **The card** shows the goal, its done points, what Claude may do, what it serves, the deadline and the round limit. Nothing runs until you press **Start** (under Claude's message or in the Goal tab). **Change something** lets you say what to change; **Cancel** drops the goal.
|
|
460
466
|
- **Start** tells Claude to work on the goal until every done point is met. Merging follows your standing rule (merge once required CI is green). Claude asks before anything that is sent to other people.
|
|
461
467
|
|
|
462
|
-
- **While it works**,
|
|
468
|
+
- **While it works**, the Goal tab shows the round, each done point met or open, and the deadline. The points are Claude's own report, so the card says "unverified". Each time Claude would stop with a point still open, it is told to keep going.
|
|
463
469
|
- **It stops by itself** when Claude reports every point met (Done), when it needs you (Needs you: answer it in the box and it goes on), at the deadline, after the round limit (12 unless the goal says fewer), or after 3 rounds that met no new point. The card says which.
|
|
464
|
-
- **
|
|
470
|
+
- **When the goal changes** (it starts, a point is met, it stops, it needs you, it is done), the Goal tab opens by itself on a desktop. On a phone a bar over the box offers it, so the conversation stays in view.
|
|
471
|
+
- **Stop the goal** is in the Goal tab. It presses Esc in the session and ends the goal.
|
|
465
472
|
- **In the bell**, a goal that is done, stopped or needs you is an item. Pressing it opens the goal's own conversation. The item goes when you write in that conversation, or after a week.
|
|
466
473
|
|
|
467
474
|
Start, Cancel and Stop need the page's launch nonce too. The goal and each round are kept in `goal-runs.jsonl` in the state folder.
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* withFiles(text, paths) → the message with the closing line that names each file for Claude
|
|
9
9
|
* splitFiles(text) → { text, files: [path] } the same line read back, for the PM's bubble
|
|
10
10
|
* servable(runtimeDir, p) → { ok, file, size, type, inline } | { ok: false, … } GET /api/chat-file?path=
|
|
11
|
+
* listNotes / saveNote / removeNote Notes (premium-chat-notes): Markdown files in the same folder,
|
|
12
|
+
* under notes/, so Share with Claude names one like an attachment
|
|
11
13
|
*
|
|
12
14
|
* The files live in the workspace state folder, never in a repository, so nothing reaches git. The chat sessions start with
|
|
13
15
|
* the chat-files folder as an added directory, so Claude reads an attachment without a permission question. Nothing here
|
|
@@ -39,6 +41,10 @@ function cleanName(name) {
|
|
|
39
41
|
/** The stored name: a time prefix keeps two files of the same name apart and orders the folder. */
|
|
40
42
|
const storedName = (name, now = new Date()) => now.toISOString().replace(/[-:]/g, '').replace(/\..*$/, '') + '-' + cleanName(name);
|
|
41
43
|
const NAME_RE = /^\d{8}T\d{6}-[\w.-]{1,96}$/;
|
|
44
|
+
const NOTES = 'notes', NOTE_RE = /^n[0-9a-z]{6,16}$/, NOTE_MAX = 200000;
|
|
45
|
+
const notesDir = (runtimeDir, key) => path.join(dirOf(runtimeDir, key), NOTES);
|
|
46
|
+
/** A message may name a saved file, or a note as notes/<id>.md. */
|
|
47
|
+
const nameOk = (n) => NAME_RE.test(n) || (n.startsWith(NOTES + '/') && NOTE_RE.test(n.slice(NOTES.length + 1).replace(/\.md$/, '')) && n.endsWith('.md'));
|
|
42
48
|
|
|
43
49
|
function save({ runtimeDir, key, name, buf, now = new Date() }) {
|
|
44
50
|
if (!runtimeDir) return fail(409, 'this workspace has no state folder to keep the file in');
|
|
@@ -66,7 +72,7 @@ function pathsOf({ runtimeDir, key, names }) {
|
|
|
66
72
|
const dir = runtimeDir && key ? dirOf(runtimeDir, key) : null;
|
|
67
73
|
const paths = [];
|
|
68
74
|
for (const n of names) {
|
|
69
|
-
const f = dir &&
|
|
75
|
+
const f = dir && nameOk(String(n || '')) ? path.join(dir, String(n)) : null;
|
|
70
76
|
if (!f || !fs.existsSync(f)) return fail(400, 'A file on this message was not saved: ' + String(n || '').slice(0, 80));
|
|
71
77
|
paths.push(f);
|
|
72
78
|
}
|
|
@@ -89,11 +95,52 @@ function splitFiles(text) {
|
|
|
89
95
|
function servable(runtimeDir, p) {
|
|
90
96
|
if (!runtimeDir) return fail(404, 'no such file');
|
|
91
97
|
const root = path.resolve(rootOf(runtimeDir)), f = path.resolve(String(p || ''));
|
|
92
|
-
|
|
98
|
+
const att = path.dirname(path.dirname(f)) === root && NAME_RE.test(path.basename(f));
|
|
99
|
+
const note = path.basename(path.dirname(f)) === NOTES && path.dirname(path.dirname(path.dirname(f))) === root && NOTE_RE.test(path.basename(f, '.md')) && f.endsWith('.md');
|
|
100
|
+
if (!att && !note) return fail(404, 'no such file');
|
|
93
101
|
let st; try { st = fs.lstatSync(f); } catch { return fail(404, 'no such file'); }
|
|
94
102
|
if (!st.isFile()) return fail(404, 'no such file');
|
|
95
103
|
const type = KINDS[path.extname(f).toLowerCase()] || 'application/octet-stream';
|
|
96
104
|
return { ok: true, file: f, size: st.size, type, inline: INLINE.has(type) };
|
|
97
105
|
}
|
|
98
106
|
|
|
99
|
-
|
|
107
|
+
/** A note's title: its first line that has words, without the heading marks. Pure. */
|
|
108
|
+
function noteTitle(text) {
|
|
109
|
+
const l = String(text || '').split('\n').map((x) => x.replace(/^\s*(#{1,6}\s+|[-*+]\s+(\[[ xX]\]\s+)?|\d+[.)]\s+|>\s*)/, '').replace(/[*_`]/g, '').trim()).find(Boolean);
|
|
110
|
+
return (l || 'Untitled note').slice(0, 80);
|
|
111
|
+
}
|
|
112
|
+
/** The notes of a conversation, oldest first: { id, title, text, path, mtime }. */
|
|
113
|
+
function listNotes({ runtimeDir, key }) {
|
|
114
|
+
if (!runtimeDir || !key) return fail(400, 'key must name a conversation');
|
|
115
|
+
const dir = notesDir(runtimeDir, key);
|
|
116
|
+
let names = []; try { names = fs.readdirSync(dir); } catch { return { ok: true, notes: [] }; }
|
|
117
|
+
const notes = names.filter((n) => n.endsWith('.md') && NOTE_RE.test(n.slice(0, -3))).map((n) => {
|
|
118
|
+
const f = path.join(dir, n); let text = '', mtime = 0;
|
|
119
|
+
try { text = fs.readFileSync(f, 'utf8'); mtime = fs.statSync(f).mtimeMs; } catch { /* gone between the read and the list */ }
|
|
120
|
+
return { id: n.slice(0, -3), title: noteTitle(text), text, path: f, mtime };
|
|
121
|
+
});
|
|
122
|
+
notes.sort((a, b) => (a.id < b.id ? -1 : 1));
|
|
123
|
+
return { ok: true, notes };
|
|
124
|
+
}
|
|
125
|
+
/** Save a note. No id: a new note, named by the time so the list keeps the order they were made in. */
|
|
126
|
+
function saveNote({ runtimeDir, key, id, text, now = Date.now() }) {
|
|
127
|
+
if (!runtimeDir || !key) return fail(400, 'key must name a conversation');
|
|
128
|
+
const t = String(text == null ? '' : text);
|
|
129
|
+
if (t.length > NOTE_MAX) return fail(413, 'A note holds 200,000 characters at most.');
|
|
130
|
+
const dir = notesDir(runtimeDir, key);
|
|
131
|
+
let n = id == null || id === '' ? null : String(id);
|
|
132
|
+
if (n !== null && !NOTE_RE.test(n)) return fail(400, 'no such note');
|
|
133
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
134
|
+
if (n === null) { let k = now; do { n = 'n' + (k++).toString(36); } while (fs.existsSync(path.join(dir, n + '.md'))); }
|
|
135
|
+
const f = path.join(dir, n + '.md');
|
|
136
|
+
fs.writeFileSync(f, t);
|
|
137
|
+
return { ok: true, id: n, title: noteTitle(t), path: f, name: NOTES + '/' + n + '.md' };
|
|
138
|
+
}
|
|
139
|
+
function removeNote({ runtimeDir, key, id }) {
|
|
140
|
+
if (!runtimeDir || !key) return fail(400, 'key must name a conversation');
|
|
141
|
+
if (!NOTE_RE.test(String(id || ''))) return fail(400, 'no such note');
|
|
142
|
+
try { fs.unlinkSync(path.join(notesDir(runtimeDir, key), String(id) + '.md')); } catch { return fail(404, 'no such note'); }
|
|
143
|
+
return { ok: true };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
module.exports = { MAX_BYTES, MAX_FILES, DIR, LEAD, rootOf, dirOf, cleanName, storedName, save, remove, pathsOf, withFiles, splitFiles, servable, noteTitle, listNotes, saveNote, removeNote };
|
|
@@ -122,6 +122,13 @@ function readRaw(req, max) {
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
async function chatFile(req, res, url, ctx) {
|
|
125
|
+
if (url.pathname === '/api/chat-file/notes' && req.method === 'GET') { // premium-chat-notes: the conversation's notes, oldest first
|
|
126
|
+
const key = url.searchParams.get('key') || '';
|
|
127
|
+
if (!Ag.KEY_RE.test(key)) { ctx.json(res, { ok: false, error: 'key must name a row' }, 400); return true; }
|
|
128
|
+
const r = Files.listNotes({ runtimeDir: ctx.runtimeDir, key });
|
|
129
|
+
ctx.json(res, r.ok ? { ok: true, notes: r.notes.map((n) => ({ id: n.id, title: n.title, text: n.text, path: n.path, name: 'notes/' + n.id + '.md' })) } : { ok: false, error: r.error }, r.ok ? 200 : r.status);
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
125
132
|
if (url.pathname === '/api/chat-file' && req.method === 'GET') {
|
|
126
133
|
const f = Files.servable(ctx.runtimeDir, url.searchParams.get('path'));
|
|
127
134
|
if (!f.ok) { ctx.json(res, { ok: false, error: f.error }, f.status); return true; }
|
|
@@ -135,6 +142,17 @@ async function chatFile(req, res, url, ctx) {
|
|
|
135
142
|
if (req.headers && req.headers['x-pmos-session']) { ctx.json(res, { ok: false, error: 'an agent session cannot attach a file to the PM\'s message' }, 403); return true; }
|
|
136
143
|
const g = guard.requirePagePress(req, {});
|
|
137
144
|
if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
|
|
145
|
+
if (url.pathname === '/api/chat-file/notes' || url.pathname === '/api/chat-file/notes/remove') { // premium-chat-notes: save or delete one note
|
|
146
|
+
const got = await ctx.readJson(req);
|
|
147
|
+
if (!got.ok) { ctx.json(res, { ok: false, error: 'body must be JSON' }, 400); return true; }
|
|
148
|
+
const b = got.body || {}, key = String(b.key || '');
|
|
149
|
+
if (!Ag.KEY_RE.test(key)) { ctx.json(res, { ok: false, error: 'key must name a row' }, 400); return true; }
|
|
150
|
+
let r;
|
|
151
|
+
try { r = url.pathname.endsWith('/remove') ? Files.removeNote({ runtimeDir: ctx.runtimeDir, key, id: b.id }) : Files.saveNote({ runtimeDir: ctx.runtimeDir, key, id: b.id, text: b.text }); }
|
|
152
|
+
catch (e) { r = { ok: false, status: 500, error: 'The note could not be saved: ' + String((e && e.message) || e).slice(0, 120) }; }
|
|
153
|
+
ctx.json(res, r.ok ? { ok: true, ...(r.id ? { id: r.id, title: r.title, path: r.path, name: r.name } : {}) } : { ok: false, error: r.error }, r.ok ? 200 : r.status);
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
138
156
|
if (url.pathname === '/api/chat-file/remove') {
|
|
139
157
|
const got = await ctx.readJson(req);
|
|
140
158
|
if (!got.ok) { ctx.json(res, { ok: false, error: 'body must be JSON' }, 400); return true; }
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.380.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.380.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -66,7 +66,7 @@ const filesIn = () => { const d = path.join(T.STATE_DIR, 'chat-files'); const ou
|
|
|
66
66
|
ok('B1 the menu starts closed and no chip row shows', await page.isHidden('#plusM') && await page.isHidden('#attRow'));
|
|
67
67
|
await page.click('#askPlus');
|
|
68
68
|
ok('B1 the + opens a menu of three above the box', await page.isVisible('#plusM') && (await page.$$('#plusM [data-plus]')).length === 3 && await page.evaluate(() => document.querySelector('#plusM').getBoundingClientRect().bottom <= document.querySelector('#askIn').getBoundingClientRect().top + 8));
|
|
69
|
-
ok('B1 the menu names Add files or photos, Slash commands and
|
|
69
|
+
ok('B1 the menu names Add files or photos, Slash commands and Notes', /Add files or photos[\s\S]*Slash commands[\s\S]*Notes/.test(await page.textContent('#plusM')));
|
|
70
70
|
await shot(page, 'menu-1280-light');
|
|
71
71
|
await page.keyboard.press('Escape');
|
|
72
72
|
ok('B1 Escape closes the menu and leaves the dialog open', await page.isHidden('#plusM') && await page.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
|
|
@@ -75,8 +75,7 @@ const filesIn = () => { const d = path.join(T.STATE_DIR, 'chat-files'); const ou
|
|
|
75
75
|
ok('B2 Slash commands puts / in the box and shows the commands', (await page.inputValue('#askIn')) === '/' && await page.isVisible('#slashM'));
|
|
76
76
|
await page.fill('#askIn', ''); await page.evaluate(() => document.querySelector('#askIn').dispatchEvent(new Event('input', { bubbles: true })));
|
|
77
77
|
await page.click('#askPlus'); await page.click('[data-plus="pad"]');
|
|
78
|
-
ok('B2
|
|
79
|
-
await page.click('#sPadT');
|
|
78
|
+
ok('B2 Notes opens the notepad in the viewer', !!(await until(async () => page.isVisible('#ntEd'))));
|
|
80
79
|
/* B3 */
|
|
81
80
|
await page.setInputFiles('#askFile', [{ name: 'Screenshot 1.41.39 PM.png', mimeType: 'image/png', buffer: PNG }, { name: 'Q4 roadmap.pdf', mimeType: 'application/pdf', buffer: Buffer.from('%PDF-1.4 test') }]);
|
|
82
81
|
ok('B3 two picked files show as two chips with their sizes once saved', !!(await until(async () => { const c = await chips(page); return c.length === 2 && c.every((x) => /KB/.test(x.meta)); })), JSON.stringify(await chips(page)));
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* premium-chat-goal-view-test.js — the /goal card lives in the viewer, not in the conversation (initiative premium-chat-session, goal in the viewer).
|
|
4
|
+
* A real server on a scratch repository (c3-scan-fixture.js); the thread and the session's conversation are routed, so the goal's state is set here.
|
|
5
|
+
* G1 at 1280 a stopped goal draws no card in the conversation, only a small Goal chip; the chip opens a Goal tab with the card
|
|
6
|
+
* G2 a goal that changes state opens the Goal tab by itself on a desktop, and the open tab follows the next change
|
|
7
|
+
* G3 a ready goal: the conversation shows only the chip; the plan, SMART and Start / Change / Cancel are in the Goal tab
|
|
8
|
+
* G4 Stop the goal is in the Goal tab and reaches the server
|
|
9
|
+
* G5 at 390 the chip covers the page with the Goal tab and Back; a change offers the goal in the bar over the box
|
|
10
|
+
* Set GOAL_VIEW_SHOTS=<dir> to save the page at 1280 and 390, light and dark. */
|
|
11
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
12
|
+
require('./test-run').configure({ name: 'premium-chat-goal-view' });
|
|
13
|
+
const Fx = require('./c3-scan-fixture.js');
|
|
14
|
+
|
|
15
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
16
|
+
const until = async (fn, ms = 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); } };
|
|
17
|
+
const results = [];
|
|
18
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
|
|
19
|
+
let F = null, browser = null;
|
|
20
|
+
const finish = async (code) => {
|
|
21
|
+
if (browser) await browser.close().catch(() => {});
|
|
22
|
+
if (F) F.stop();
|
|
23
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
24
|
+
console.log(`\n${results.length - bad}/${results.length} premium-chat-goal-view assertions passed`);
|
|
25
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
26
|
+
};
|
|
27
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
28
|
+
|
|
29
|
+
const DRAFT = {
|
|
30
|
+
goal: 'Enrich the Lightbox password sign-up and login reports with drop reasons, per-step durations and segments, for yesterday',
|
|
31
|
+
done: ['Tables for durations, anomalies and segments exist for yesterday', 'Each drop has a reason label inferred from the events', 'Totals match GA4 Explore counts for yesterday'],
|
|
32
|
+
may: 'Read BigQuery and write to the reports folder', serves: 'q4:o1:kr2', by: '2026-10-22 17:00', limit: 12, assumed: ['by'],
|
|
33
|
+
};
|
|
34
|
+
const READY = 'The goal is clear. Press Start when it reads right.\n\n```pmos-goal\n' + JSON.stringify({ step: 'ready', draft: DRAFT }) + '\n```';
|
|
35
|
+
const goalOf = (state, extra = {}) => ({ id: 'g1', state, draft: DRAFT, met: [], rounds: 2, ...extra });
|
|
36
|
+
|
|
37
|
+
/* the page's own state */
|
|
38
|
+
const look = () => {
|
|
39
|
+
const g = document.querySelector('#dlg'), out = document.querySelector('#dOut').getBoundingClientRect(), gp = document.querySelector('#dOut .obody.vw[data-vw="goal"]');
|
|
40
|
+
const peek = document.querySelector('#ctxPeek');
|
|
41
|
+
return { shut: g.classList.contains('vw-shut'), layer: g.classList.contains('vw-layer'), out: Math.round(out.width), outH: Math.round(out.height), vh: innerHeight,
|
|
42
|
+
cardInChat: !!document.querySelector('#dBody .gcard'), chip: (document.querySelector('#dBody [data-goal-open]') || {}).textContent || null,
|
|
43
|
+
smart: !!document.querySelector('#dBody .smart'), start: !!document.querySelector('#dBody [data-goal="start"]'),
|
|
44
|
+
tabs: [...document.querySelectorAll('#vTabs .vtab')].map((t) => t.textContent.trim()), on: (document.querySelector('#vTabs .vtab[aria-selected="true"]') || {}).textContent || null,
|
|
45
|
+
pane: gp && !gp.hidden ? gp.textContent.replace(/\s+/g, ' ').trim() : null, stop: !!document.querySelector('#dOut [data-goal="stop"]'),
|
|
46
|
+
peek: peek && !peek.hidden ? peek.textContent.trim() : null, back: !!document.querySelector('#vBack') && getComputedStyle(document.querySelector('#vBack')).display !== 'none',
|
|
47
|
+
railOff: getComputedStyle(document.querySelector('.rail')).opacity === '0', wide: document.documentElement.scrollWidth > innerWidth + 1 };
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
(async () => {
|
|
51
|
+
const exe = findBrowser();
|
|
52
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
53
|
+
let chromium;
|
|
54
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
55
|
+
F = await Fx.start({ name: 'premium-chat-goal-view' });
|
|
56
|
+
browser = await chromium.launch({ executablePath: exe, headless: true, args: ['--no-sandbox'] });
|
|
57
|
+
const shots = process.env.GOAL_VIEW_SHOTS;
|
|
58
|
+
const chat = `${F.BASE}/premium-chat.html?ws=${encodeURIComponent(F.ws)}`;
|
|
59
|
+
const open = async (width, scheme, first) => {
|
|
60
|
+
const st = { goal: first.goal, messages: first.messages, posts: [] };
|
|
61
|
+
const ctx = await browser.newContext({ viewport: { width, height: width < 1000 ? 844 : 800 }, colorScheme: scheme, hasTouch: width < 1000 });
|
|
62
|
+
const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
|
|
63
|
+
await p.route('**/api/briefing-premium/thread?**', (r) => r.fulfill({ json: { ok: true, turns: [], session: 's-goal', goal: st.goal } }));
|
|
64
|
+
await p.route('**/api/sessions/conversation?**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'pm', messages: st.messages } }));
|
|
65
|
+
await p.route('**/api/briefing-premium/goal**', (r) => { st.posts.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ json: { ok: true } }); });
|
|
66
|
+
await p.goto(chat);
|
|
67
|
+
await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream #thr')));
|
|
68
|
+
await sleep(400);
|
|
69
|
+
return { p, ctx, errs, st };
|
|
70
|
+
};
|
|
71
|
+
const working = [{ role: 'user', text: '[PMOS /goal start] Start the goal' }, { role: 'tool', tools: { execute_sql_readonly: 1, get_query_results: 1 }, calls: [] }, { role: 'assistant', text: 'Round two: the duration table is written; the reason labels are next.' }];
|
|
72
|
+
|
|
73
|
+
{ const { p, ctx, errs, st } = await open(1280, 'light', { goal: goalOf('stopped', { reason: 'pm' }), messages: working });
|
|
74
|
+
const s0 = await p.evaluate(look);
|
|
75
|
+
ok('G1 at 1280 a stopped goal draws no card in the conversation, only a small Goal chip', !s0.cardInChat && /Stopped/.test(s0.chip || '') && /0 of 3/.test(s0.chip || ''), JSON.stringify(s0));
|
|
76
|
+
ok('G1 opening the chat with a goal opens nothing by itself', s0.shut && s0.tabs.length === 0, JSON.stringify(s0));
|
|
77
|
+
if (shots) await p.screenshot({ path: `${shots}/chip-1280-light.png` });
|
|
78
|
+
await p.click('#dBody [data-goal-open]');
|
|
79
|
+
const s1 = await until(async () => { const v = await p.evaluate(look); return !v.shut && v.pane ? v : null; }) || await p.evaluate(look);
|
|
80
|
+
ok('G1 the chip opens a Goal tab with the goal, its done points and why it stopped', /Goal/.test(s1.on || '') && /Stopped/.test(s1.pane || '') && /0 of 3 done points met/.test(s1.pane || '') && /Totals match GA4/.test(s1.pane || '') && /You stopped it/.test(s1.pane || ''), JSON.stringify(s1));
|
|
81
|
+
await p.click('#vTabs [data-vx]'); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('vw-shut')));
|
|
82
|
+
st.goal = goalOf('started', { met: [DRAFT.done[0]] });
|
|
83
|
+
const s2 = await until(async () => { const v = await p.evaluate(look); return v.pane && /round 3/.test(v.pane) ? v : null; }) || await p.evaluate(look);
|
|
84
|
+
ok('G2 a goal that changes state opens the Goal tab by itself', !s2.shut && /Goal/.test(s2.on || '') && /1 of 3 done points met/.test(s2.pane || ''), JSON.stringify(s2));
|
|
85
|
+
ok('G4 Stop the goal is in the Goal tab, not in the conversation', s2.stop && !(await p.evaluate(() => !!document.querySelector('#dBody [data-goal="stop"]'))), JSON.stringify(s2));
|
|
86
|
+
if (shots) await p.screenshot({ path: `${shots}/goal-1280-light.png` });
|
|
87
|
+
await p.click('#dOut [data-goal="stop"]');
|
|
88
|
+
const posted = await until(() => st.posts.find((x) => x.act === 'stop'));
|
|
89
|
+
ok('G4 Stop reaches the server for this goal', posted && posted.id === 'g1', JSON.stringify(st.posts));
|
|
90
|
+
st.goal = goalOf('done', { met: DRAFT.done });
|
|
91
|
+
const s3 = await until(async () => { const v = await p.evaluate(look); return v.pane && /Done, as Claude reports it/.test(v.pane) ? v : null; }) || await p.evaluate(look);
|
|
92
|
+
ok('G2 the open Goal tab follows the next change', /3 of 3 done points met/.test(s3.pane || '') && !s3.stop, JSON.stringify(s3));
|
|
93
|
+
ok('F1 no page error and no sideways scroll', !errs.length && !s3.wide, errs.join(' | '));
|
|
94
|
+
await ctx.close(); }
|
|
95
|
+
|
|
96
|
+
{ const { p, ctx, errs, st } = await open(1280, 'dark', { goal: goalOf('grilling'), messages: [{ role: 'user', text: '[PMOS /goal] The PM set a goal: Enrich the Lightbox reports\n' }, { role: 'assistant', text: READY }] });
|
|
97
|
+
const s0 = await p.evaluate(look);
|
|
98
|
+
ok('G3 a ready goal is one chip in the conversation: no card, no SMART row, no buttons', !s0.smart && !s0.start && !s0.cardInChat && /Not started/.test(s0.chip || ''), JSON.stringify(s0));
|
|
99
|
+
await p.click('#dBody [data-goal-open]');
|
|
100
|
+
const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane ? v : null; }) || await p.evaluate(look);
|
|
101
|
+
ok('G3 the Goal tab shows the plan: done when, may, serves, by', /Done when/.test(s1.pane || '') && /It may/.test(s1.pane || '') && /Serves/.test(s1.pane || '') && /Not started/.test(s1.pane || ''), JSON.stringify(s1));
|
|
102
|
+
await p.click('#dOut [data-goal="start"]');
|
|
103
|
+
const sent = await until(() => st.posts.find((x) => x.act === 'start'));
|
|
104
|
+
ok('G3 Start in the Goal tab sends the ready draft for this goal', sent && sent.id === 'g1' && sent.draft && sent.draft.goal === DRAFT.goal, JSON.stringify(st.posts));
|
|
105
|
+
if (shots) await p.screenshot({ path: `${shots}/ready-1280-dark.png` });
|
|
106
|
+
ok('F1 (dark) no page error and no sideways scroll', !errs.length && !s1.wide, errs.join(' | '));
|
|
107
|
+
await ctx.close(); }
|
|
108
|
+
|
|
109
|
+
for (const scheme of ['light', 'dark']) {
|
|
110
|
+
const { p, ctx, errs, st } = await open(390, scheme, { goal: goalOf('started', { met: [DRAFT.done[0]] }), messages: working });
|
|
111
|
+
const s0 = await p.evaluate(look);
|
|
112
|
+
ok(`G5 (${scheme}) at 390 the conversation shows the chip, not the card`, !s0.cardInChat && /Working/.test(s0.chip || '') && !s0.layer, JSON.stringify(s0));
|
|
113
|
+
if (shots) await p.screenshot({ path: `${shots}/chip-390-${scheme}.png` });
|
|
114
|
+
await p.click('#dBody [data-goal-open]');
|
|
115
|
+
const s1 = await until(async () => { const v = await p.evaluate(look); return v.layer && v.pane && v.outH >= v.vh - 2 && v.railOff ? v : null; }) || await p.evaluate(look);
|
|
116
|
+
ok(`G5 (${scheme}) the chip covers the page with the Goal tab and Back`, s1.layer && s1.back && /1 of 3 done points met/.test(s1.pane || '') && s1.outH >= s1.vh - 2, JSON.stringify(s1));
|
|
117
|
+
if (shots) await p.screenshot({ path: `${shots}/goal-390-${scheme}.png` });
|
|
118
|
+
await p.click('#vBack'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('vw-layer')));
|
|
119
|
+
st.goal = goalOf('waiting', { met: [DRAFT.done[0]] });
|
|
120
|
+
const s2 = await until(async () => { const v = await p.evaluate(look); return v.peek ? v : null; }) || await p.evaluate(look);
|
|
121
|
+
ok(`G5 (${scheme}) a change offers the goal in the bar over the box, without covering the conversation`, /Needs you/.test(s2.peek || '') && !s2.layer, JSON.stringify(s2));
|
|
122
|
+
ok(`F1 (${scheme}) no page error and no sideways scroll at 390`, !errs.length && !s2.wide, errs.join(' | '));
|
|
123
|
+
await ctx.close();
|
|
124
|
+
}
|
|
125
|
+
return finish();
|
|
126
|
+
})();
|