create-pmos 0.375.0 → 0.377.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.375.0",
3
+ "version": "0.377.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.377.0",
37
+ "at": "2026-10-21T07:27:29.956Z",
38
+ "f": 2,
39
+ "prs": [
40
+ {
41
+ "n": 986,
42
+ "t": "Attach files and photos to a premium chat message",
43
+ "s": "Attach files and photos to a premium chat message"
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "v": "0.376.0",
49
+ "at": "2026-10-21T07:00:19.034Z",
50
+ "f": 2,
51
+ "prs": [
52
+ {
53
+ "n": 984,
54
+ "t": "Replay conversation rows hold their words",
55
+ "s": "Replay conversation rows hold their words"
56
+ },
57
+ {
58
+ "n": 985,
59
+ "t": "Chat page viewer stays closed until something opens in it",
60
+ "s": "Chat page viewer stays closed until something opens in it"
61
+ }
62
+ ]
63
+ },
35
64
  {
36
65
  "v": "0.375.0",
37
66
  "at": "2026-10-21T04:39:03.068Z",
@@ -292,35 +321,6 @@
292
321
  "s": "A chat session that prints nothing for the workspace idle limit (60 minutes by default) is ended, unless its goal is started or a permission prompt is waiting."
293
322
  }
294
323
  ]
295
- },
296
- {
297
- "v": "0.357.0",
298
- "at": "2026-10-20T09:57:04.765Z",
299
- "f": 2,
300
- "prs": [
301
- {
302
- "n": 956,
303
- "t": "End sessions from the list; idle shells fold into one line",
304
- "s": "Every row has an End button (×) on hover, on focus and always on touch screens."
305
- }
306
- ]
307
- },
308
- {
309
- "v": "0.356.0",
310
- "at": "2026-10-20T09:37:44.880Z",
311
- "f": 2,
312
- "prs": [
313
- {
314
- "n": 955,
315
- "t": "Full-screen chat is never blank when the viewer is folded",
316
- "s": "The panel always shows something."
317
- },
318
- {
319
- "n": 957,
320
- "t": "A live premium chat stops blinking beside the viewer",
321
- "s": "The conversation stays still."
322
- }
323
- ]
324
324
  }
325
325
  ]
326
326
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@918cccda
1
+ kernel-source: pmos@bae3b91d
2
2
  assembled: 2026-10-21
3
3
  mode: vendor
@@ -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-21T04:39:00Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-21T07:27:27Z"}
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-21T04:39:00Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-21T07:27:27Z"}
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-21T04:39:00Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-21T07:27:27Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -349,6 +349,34 @@ const RECORDER = () => {
349
349
  ok('R12 with no initiative linked, Confirm all says so and writes nothing', await until(() => Rn.page.evaluate(() => /Link the note to an initiative first/.test(document.body.textContent))) && Rn.planPosts.length === 0);
350
350
  await Rn.ctx.close();
351
351
 
352
+ /* R13 a long transcript (Wawan, 2026-10-21): each conversation row is as tall as its words, so no line draws over the next, under All and Key points, wide and on a phone */
353
+ const LONG = 'In active development. Okay. So IDP is one. This one I really, really have less kind of, kind of influence because now you are running it automation. I mean, you are running it yourself anyway, right? So I just receiving the information from you.';
354
+ const LR = { ...RICH, lines: Array.from({ length: 14 }, (_, i) => ({ i, t: 5000 + i * 15000, who: i % 3 ? 'You' : 'Dara', text: (i % 2 ? LONG : 'Short line ' + i) + (i % 4 === 1 ? ' ' + LONG : ''), ...(i % 2 ? { key: { k: 'decision', id: 'd1' } } : {}) })),
355
+ shots: Array.from({ length: 19 }, (_, i) => ({ t: 280000 + i * 1000, w: 10, h: 10, why: 'A slide' })) };
356
+ const shotDir13 = process.env.PMOS_SHOTS || '';
357
+ for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
358
+ const P = await open({ w, h, theme: th, replay: LR });
359
+ await press(P.page, 'replay'); await until(() => P.page.evaluate(() => !!document.querySelector('#rpLines .m3-ln')));
360
+ for (const tab of ['a', 'k']) {
361
+ await P.page.click(`#oMain [data-rp="tab"][data-v="${tab}"]`);
362
+ await P.page.click('#rpLines .m3-ln:nth-child(2)');
363
+ const r = await P.page.evaluate(() => {
364
+ const rows = [...document.querySelectorAll('#rpLines .m3-ln')];
365
+ const bad = [];
366
+ rows.forEach((b, i) => {
367
+ const box = b.getBoundingClientRect(), txt = b.querySelector('span').getBoundingClientRect();
368
+ if (txt.bottom > box.bottom + 0.5) bad.push('row ' + i + ' text spills ' + Math.round(txt.bottom - box.bottom) + ' px');
369
+ if (i && box.top < rows[i - 1].getBoundingClientRect().bottom - 0.5) bad.push('row ' + i + ' overlaps the one above');
370
+ });
371
+ return { n: rows.length, bad };
372
+ });
373
+ ok(`R13 at ${w} px (${th}), ${tab === 'a' ? 'All' : 'Key points'}: every row holds its words and none overlaps the next`, r.n > 0 && !r.bad.length, JSON.stringify(r));
374
+ if (tab === 'a') ok(`R13 at ${w} px (${th}) a long spoken line is shown whole, not cut`, await P.page.evaluate((t) => document.querySelector('#rl1').textContent.includes(t), LONG + ' ' + LONG));
375
+ if (shotDir13) await P.page.screenshot({ path: path.join(shotDir13, `replay-long-${tab}-${w}-${th}.png`) });
376
+ }
377
+ await P.ctx.close();
378
+ }
379
+
352
380
  /* R8 Topic on material */
353
381
  const Tp = await open({ topics: ['Capacity', 'Risks'] });
354
382
  await reveal(Tp.page, '#mmAdd'); await Tp.page.click('#mmAdd'); await until(() => Tp.page.evaluate(() => /Roadmap/.test(document.querySelector('#mmSug').textContent)));
@@ -179,7 +179,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
179
179
  const draw = await xp.evaluate(() => { const i = document.querySelector('.rail .ind'), r = document.querySelector('.rail'), d = document.querySelector('#dlg'); return { ind: getComputedStyle(i).display, rail: +getComputedStyle(r).zIndex, dlg: +getComputedStyle(d).zIndex }; });
180
180
  ok('X1c on the Chat page no grey indicator sits under the Chat button, and the rail is above the dialog so its shadow does not grey the button', draw.ind === 'none' && draw.rail > draw.dlg, JSON.stringify(draw));
181
181
  const lay = await until(() => xp.evaluate(() => { const d = document.querySelector('#dlg'), r = document.querySelector('#sRail'); if (!d.classList.contains('full') || !r || !r.offsetWidth || !document.querySelector('#srlList .srl-r')) return null; const o = { rail: Math.round(r.getBoundingClientRect().width), work: Math.round(document.querySelector('#dBody').getBoundingClientRect().width), out: Math.round(document.querySelector('#dOut').getBoundingClientRect().width) }; return o.out > 300 ? o : null; }), 8000) || (await xp.evaluate(() => ({ rail: document.querySelector('#sRail').getBoundingClientRect().width, work: document.querySelector('#dBody').getBoundingClientRect().width, out: document.querySelector('#dOut').getBoundingClientRect().width, cls: document.querySelector('#dlg').className, mode: document.querySelector('#dlg').dataset.mode, w: document.querySelector('#dlg').getBoundingClientRect().width })));
182
- ok('X2 the Chat page opens the Briefing\'s conversation with three panels: list, conversation, viewer', /Ask about the Briefing/.test(await xp.evaluate(() => document.querySelector('#dTitle').textContent)) && lay && lay.out > 300 && lay.rail > 150 && lay.work > 300 && lay.out > 300, JSON.stringify(lay));
182
+ ok('X2 the Chat page opens the Briefing\'s conversation with the list and the conversation; the viewer is closed until something opens in it (premium-chat-viewer V1)', /Ask about the Briefing/.test(await xp.evaluate(() => document.querySelector('#dTitle').textContent)) && lay && lay.out === 0 && lay.rail > 150 && lay.work > 600 && /vw-shut/.test(lay.cls), JSON.stringify(lay));
183
183
  const grpOf = () => xp.evaluate(() => [...document.querySelectorAll('#srlList .srl-g')].map((g) => g.querySelector('.srl-gh span').textContent + ':' + g.querySelectorAll('.srl-r').length + (g.querySelector('.srl-more') ? '+' + g.querySelector('.srl-more').textContent : '')));
184
184
  const grp = (await until(async () => { const v = await grpOf(); return v.join('|') === 'Yours:1|Started by PMOS:1+1 more working on their own · Show' ? v : null; }, 8000)) || (await grpOf());
185
185
  ok('X3 the list groups by who started each session, exited ones are gone, and PMOS runs that need nothing fold into one line', grp.join('|') === 'Yours:1|Started by PMOS:1+1 more working on their own · Show', grp.join('|'));
@@ -208,18 +208,16 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
208
208
  await xp.click('#srlFold');
209
209
  const folded = await until(() => xp.evaluate(() => { const w = document.querySelector('#sRail').getBoundingClientRect().width; return w > 0 && w < 70 ? Math.round(w) : 0; }), 4000);
210
210
  ok('X12 the list folds to a strip of dots', folded > 0, String(folded));
211
- await xp.click('#vFold');
212
- const vf = await until(() => xp.evaluate(() => { const w = document.querySelector('#dOut').getBoundingClientRect().width; return w > 0 && w < 70 ? Math.round(w) : 0; }), 4000);
213
- ok('X13 the viewer folds and the conversation takes the width', vf > 0 && (await xp.evaluate(() => document.querySelector('#dBody').getBoundingClientRect().width)) > 800, String(vf));
214
- /* premium-fullscreen-blank: the folded viewer is a strip that opens again from anywhere on it, and folding never empties the panel */
215
- const strip = await xp.evaluate(() => { const r = document.querySelector('#dOut').getBoundingClientRect(); return { x: r.left + r.width / 2, y: r.top + r.height * 0.6 }; });
216
- await xp.mouse.click(strip.x, strip.y);
217
- ok('X13b a press anywhere on the folded viewer strip opens the viewer again', !!(await until(() => xp.evaluate(() => document.querySelector('#dOut').getBoundingClientRect().width > 300 && !document.querySelector('#dlg').classList.contains('vw-min')), 4000)));
211
+ await xp.click('#vFold'); // premium-chat-viewer V3: on the Chat page the viewer's button closes it, and the head's Viewer chip opens it again
212
+ const vf = await until(() => xp.evaluate(() => document.querySelector('#dOut').getBoundingClientRect().width === 0 && document.querySelector('#dlg').classList.contains('vw-shut')), 4000);
213
+ ok('X13 the viewer closes and the conversation takes the width', !!vf && (await xp.evaluate(() => document.querySelector('#dBody').getBoundingClientRect().width)) > 800, String(vf));
214
+ await xp.click('#vwPill');
215
+ ok('X13b the head\'s Viewer chip opens the viewer again', !!(await until(() => xp.evaluate(() => document.querySelector('#dOut').getBoundingClientRect().width > 300 && !document.querySelector('#dlg').classList.contains('vw-shut')), 4000)));
218
216
  await xp.click('#vFold');
219
217
  const shell = await xp.evaluate(() => ({ close: !!document.querySelector('#dClose').offsetParent, expand: !!document.querySelector('#dExpand').offsetParent, rail: !document.querySelector('.rail').inert }));
220
218
  await xp.keyboard.press('Escape');
221
219
  ok('X13c the Chat page has no close and no full-screen button, its rail stays live, and Escape keeps it open', !shell.close && !shell.expand && shell.rail && await xp.evaluate(() => document.querySelector('#dlg').classList.contains('on') && document.querySelector('#dlg').classList.contains('full')), JSON.stringify(shell));
222
- await xp.click('#srlFold'); await xp.click('#vFold');
220
+ await xp.click('#srlFold'); // the viewer stays closed: on the Chat page nothing remembers it
223
221
  /* the soft warning: silent at 6 working agents, speaks at 7, at the top of the list */
224
222
  const before = fake.slice();
225
223
  const mk = (n) => Array.from({ length: n }, (_, i) => ({ id: 'w-' + i, name: 'Agent ' + i, agent: 'claude', note: '', cwd: '.', created: new Date().toISOString(), shown: 'working', label: 'working', automatic: false }));
@@ -1,4 +1,33 @@
1
1
  [
2
+ {
3
+ "v": "0.377.0",
4
+ "at": "2026-10-21T07:27:29.956Z",
5
+ "f": 2,
6
+ "prs": [
7
+ {
8
+ "n": 986,
9
+ "t": "Attach files and photos to a premium chat message",
10
+ "s": "Attach files and photos to a premium chat message"
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ "v": "0.376.0",
16
+ "at": "2026-10-21T07:00:19.034Z",
17
+ "f": 2,
18
+ "prs": [
19
+ {
20
+ "n": 984,
21
+ "t": "Replay conversation rows hold their words",
22
+ "s": "Replay conversation rows hold their words"
23
+ },
24
+ {
25
+ "n": 985,
26
+ "t": "Chat page viewer stays closed until something opens in it",
27
+ "s": "Chat page viewer stays closed until something opens in it"
28
+ }
29
+ ]
30
+ },
2
31
  {
3
32
  "v": "0.375.0",
4
33
  "at": "2026-10-21T04:39:03.068Z",
@@ -28,12 +28,12 @@ Every premium page has the same top bar. On the left is where you are. On the ri
28
28
 
29
29
  The first line of **Sources** says whether PMOS's background work is running. When everything is on time it reads like "Background on · brief 06:52 · sources 06:49": the time today's morning brief was saved and the time of the last source read. It turns orange when something is late, such as a source that missed its scheduled read by more than an hour, or Git sync that keeps failing. It turns red when something stopped: no morning brief 45 minutes after its time, a source whose last run failed, a session whose prompt was typed but not sent, or background checks that stopped. The line gives the reason in plain words, and other problems are listed under it. The Sources dot takes the same colour, and a stop is also added to the bell, once a day. When the morning brief is due, it first refreshes Calendar, Jira and My work if they are more than 2 hours old, then builds from them. It waits for them for at most 30 minutes.
30
30
 
31
- **The Chat page** is the chat as a page of its own. On a desktop it has three panels: the session list, the conversation and the viewer. It has no close button; the rail takes you to another place. On a phone it fills the screen above the bar and opens on the conversation; the **Sessions** chip opens the list. A chat dialog elsewhere (a row's Conversation tab) still shows the list when it is full screen. The standing note under the message box ("This is a Claude Code session…") shows only while you write in the box; any other note there, such as Sent, an error or Claude is waiting, always shows.
31
+ **The Chat page** is the chat as a page of its own. On a desktop it has the session list and the conversation; the viewer is closed until something opens in it, such as a file Claude names. Then the viewer opens beside the conversation and the list folds to its strip of icons for as long as the viewer is open. The **×** at the top of the viewer closes it, and the **Viewer** chip in the head, with the number of things it holds, opens it again. When more tabs are open than fit, the last one is a **+N** menu with the rest. It has no close button; the rail takes you to another place. On a phone it fills the screen above the bar and opens on the conversation; the **Sessions** chip opens the list. It has no Detail switch: the viewer opens over the whole screen, and **‹ Chat** (or Escape) takes you back to the conversation. A chat dialog elsewhere (a row's Conversation tab) still shows the list when it is full screen. The standing note under the message box ("This is a Claude Code session…") shows only while you write in the box; any other note there, such as Sent, an error or Claude is waiting, always shows.
32
32
 
33
33
  - **Groups.** **Goals** holds a chat whose goal is started or waiting on you. **Yours** holds the other sessions you started. **Started by PMOS** holds schedules, the day run, the Driver, the Checker, notes, document syncs and other background runs. A PMOS session shows only when it needs you. The rest fold into one line, "N more working on their own · Show".
34
34
  - **Dots.** An orange dot means **Ready**: the session finished its turn and waits for you. A green dot means **Running**. An orange ring means **Maybe blocked**: a call is open and nothing moves, often a permission question. No dot means idle. Ready sessions come first and are bold. Hold the pointer over a row to see its state in words.
35
35
  - **Switch.** Press a row to switch the dialog to that session. A chat opens its own conversation. Any other session shows its conversation from Claude Code's record. You can write to it and answer its permission questions, as in a chat. The viewer shows the session's facts, the question a background run asks with the options it offered, and **Stop**. Stop asks first, and if the session has not exited yet it says so and offers Stop again.
36
- - **Fold.** The button at the top of the list folds it to a strip of icons with dots. The button at the top of the viewer folds the viewer to a strip, so the conversation gets the width; press anywhere on the strip to open the viewer again. PMOS remembers both in this browser. When the conversation is hidden, the viewer always shows, so the panel is never empty.
36
+ - **Fold.** The button at the top of the list folds it to a strip of icons with dots. In a full-screen chat dialog on another page, the button at the top of the viewer folds the viewer to a strip, so the conversation gets the width; press anywhere on the strip, or anything that opens in the viewer, to open it again. PMOS remembers both in this browser. When the conversation is hidden, the viewer always shows, so the panel is never empty.
37
37
  - **End.** Every row has an **End** button (×) on its right: it shows when the pointer is over the row, and always on a touch screen. An idle session ends at once. A session that is Running, Ready or Maybe blocked asks first, in the row, with **End** and **Keep**. Ending stops the process and removes the row; files it already wrote stay. If it has not exited yet, the toast says so and the row stays.
38
38
  - **Idle shells.** A terminal shell with no agent in it and no output for a while folds under **Yours** into one line, "N more idle · Show", with **End all idle**. End all idle ends only those shells, never a goal or a session that needs you. PMOS opens one shell when it starts with no live session; it now checks after your sessions come back, so a restart no longer adds a shell each time.
39
39
  - **When the chat is not full screen,** a chip in the dialog's header shows the loudest dot and, for example, "2 ready". Press it to go full screen with the list. On a phone, it opens the list over the dialog, and a tap on a row switches to that session.
@@ -168,7 +168,7 @@ In **Notes**, each next step has **Make task** when the note is linked to an ini
168
168
 
169
169
  **Focus.** The meeting dialog has **Focus** in its **More** menu. Focus shows the meeting as it is now: the state (starts in, recording, paused, ended), a bar of the stretches by topic, the topic now (or the first topic before the start), the last lines of the talk with who said them, the topics, the material and the counts of decisions, next steps and questions. It reads the meeting every 3 seconds while it is open and stops when you leave it. While the note records, PMOS's companion, a read-only Claude run that sends nothing, may read the last minutes of the talk at most every 40 seconds and writes its own notes. The dialog says this before the first read. **Change** lists the topics. A press records one correction on the meeting through the console's route. If the companion is off, has not answered or has failed, Focus says so and shows only the talk. It shows no topic, line or count that the record does not hold.
170
170
 
171
- **Replay.** When a recording is kept, the Replay part has a **Replay** press. Replay opens wide and hides the conversation panel; **Back to the meeting** puts both back. The header shows the meeting's day, start and end, length, the number of people, and the position as m:ss and as the time of day. The player plays the note's audio, with Back 10 s and 1x, 1.5x or 2x. Under it is a bar of the stretches by topic and, above the bar, one marker for each decision, next step, question and PMOS note that has a time. A ring marks a point that needs you (a question still open, or a next step with no owner). A shaded part of the bar is a gap where the recording was off. The line under the bar shows the topic being talked about and the key points near the playhead. Below are two panels: **On screen**, with the screen shot kept for that time and a strip of all shots, and **Conversation**, with the transcript and PMOS's notes. Its tabs show all lines, only the key-point lines or only PMOS's notes, and a search box narrows the lines. The key points sit in three columns: decisions, questions and next steps. **Confirm all** makes a task of each next step in the note's initiative, under its first stage; when the note has no initiative, it says to link one first. A press on a marker, stretch, key point, line or shot plays from there, and the current line is marked. A key point with no time has no play press. If no audio was kept, the playhead keeps its own clock.
171
+ **Replay.** When a recording is kept, the Replay part has a **Replay** press. Replay opens wide and hides the conversation panel; **Back to the meeting** puts both back. The header shows the meeting's day, start and end, length, the number of people, and the position as m:ss and as the time of day. The player plays the note's audio, with Back 10 s and 1x, 1.5x or 2x. Under it is a bar of the stretches by topic and, above the bar, one marker for each decision, next step, question and PMOS note that has a time. A ring marks a point that needs you (a question still open, or a next step with no owner). A shaded part of the bar is a gap where the recording was off. The line under the bar shows the topic being talked about and the key points near the playhead. Below are two panels: **On screen**, with the screen shot kept for that time and a strip of all shots, and **Conversation**, with the transcript and PMOS's notes. The Conversation panel is as tall as the On screen panel, and its list scrolls. Each line is shown in full, however long it is. Its tabs show all lines, only the key-point lines or only PMOS's notes, and a search box narrows the lines. The key points sit in three columns: decisions, questions and next steps. **Confirm all** makes a task of each next step in the note's initiative, under its first stage; when the note has no initiative, it says to link one first. A press on a marker, stretch, key point, line or shot plays from there, and the current line is marked. A key point with no time has no play press. If no audio was kept, the playhead keeps its own clock.
172
172
 
173
173
  In the **Add material** sheet, a **Topic** choice ties the item to one of the meeting's topics, so Focus can bring it up. It appears only when the meeting has topics.
174
174
 
@@ -418,7 +418,7 @@ The conversation beside every premium dialog is a real Claude Code session. Anyt
418
418
  - **Stop** shows while Claude works. It presses Esc in the session.
419
419
  - **The conversation** is Claude Code's own record, word for word. Claude's answers are formatted as Claude Code formats them: headings, bold, lists, code, tables, quotes and links (links open in a new tab). Your messages keep their line breaks, and a paste shows without the tags Claude Code wraps around it. A run of tool calls shows as one small grey line, for example "Used Read ×2, slack_read_thread". A connector tool shows its short name.
420
420
  - **While a session runs**, the panel reads it again every 2 seconds and changes only when there is something new. The messages already on screen stay still, so nothing blinks beside the viewer.
421
- - **A file Claude names** (a path such as `briefs/drafts/plan.md`, or a link to one) is underlined. Press it to read the file beside the conversation, as a tab in the viewer; on a phone, the Detail side shows it. Markdown shows as a page, an HTML file shows as the page it draws (press **Source** for its code), and other text files show as code. An HTML page runs its own scripts, so its toggles and charts work, but it cannot reach PMOS or the internet: a web font falls back to the system font. It is read-only. While the tab is open it shows the newest version, so a file Claude is still writing stays current. A file outside the workspaces PMOS serves says "Not in a workspace" and is not read.
421
+ - **A file Claude names** (a path such as `briefs/drafts/plan.md`, or a link to one) is underlined. Press it to read the file beside the conversation, as a tab in the viewer; on a phone, the Detail side shows it (on the Chat page, the viewer opens over the conversation). Markdown shows as a page, an HTML file shows as the page it draws (press **Source** for its code), and other text files show as code. An HTML page runs its own scripts, so its toggles and charts work, but it cannot reach PMOS or the internet: a web font falls back to the system font. It is read-only. While the tab is open it shows the newest version, so a file Claude is still writing stays current. A file outside the workspaces PMOS serves says "Not in a workspace" and is not read.
422
422
  - **A link to a Google Doc or a Confluence page** opens beside the conversation too, as the viewer shows a copy: the text PMOS has read, or **Read it now**. **A Claude artifact link** opens a tab with **Open in Claude**: claude.ai does not let another site show an artifact inside it. Other links open in a new browser tab.
423
423
  - **The session** is also listed in **Sessions** and in the console, where you can open its terminal.
424
424
  - **Ending a session ends only its process.** Whether you press End in the session list, or PMOS ends an idle chat, the conversation stays with the row: the panel and the session's own view still show every turn, read from Claude Code's record (in whichever Claude login ran it, such as `~/.claude-personal`). PMOS also keeps a copy in its own state folder (`chat-history/`), so the conversation stays after Claude Code removes old records. Files the session wrote are never touched. Your next message picks up the same conversation.
@@ -436,6 +436,19 @@ Under the message box, **Scratchpad** opens a pad above the box. It keeps notes
436
436
  - To make the pad taller or shorter, drag the grip on its top edge, or select the grip and press the up arrow or the down arrow. Double-click the grip for the default height.
437
437
  - A dialog with no conversation has no pad.
438
438
 
439
+ ### Attach files and photos
440
+
441
+ Press **+** at the left of the message box. The menu has three items: **Add files or photos**, **Slash commands** and **Scratchpad**.
442
+
443
+ - **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.
444
+ - On a computer, you can also drag a file onto the conversation, or paste a screenshot into the message box.
445
+ - Each file shows as a chip above the message box. A photo shows a small picture. The chip says **Saving** until the file is saved, then it shows the size. Press **×** to remove a file before you send.
446
+ - A message can have 10 files at most. Each file can be 20 MB at most. You can send files without words.
447
+ - The files are saved on this machine, in the PMOS state folder (`chat-files/`). They never go into a repository.
448
+ - When you send, the message tells Claude the full path of each file. Claude reads the files itself: photos, screenshots, PDFs and text files. The chat session can read that folder without asking you first.
449
+ - In the conversation, your message shows its files as chips above your words. Press a chip to open the file in the viewer. A photo shows as the picture and a PDF shows as the document. For other files, the viewer gives **Download**.
450
+ - A dialog with no conversation has no **+**.
451
+
439
452
  ### Give Claude a goal with `/goal`
440
453
 
441
454
  Type `/` in the box to see the commands: `/goal`, `/compact` and `/clear`. Use the arrow keys and Enter, or press one.
@@ -0,0 +1,99 @@
1
+ 'use strict';
2
+ /* chat-files.js — files and photos the PM attaches to a premium chat message (initiative premium-chat-attach).
3
+ *
4
+ * dirOf(runtimeDir, key) → <runtimeDir>/chat-files/<hash of key> one folder for each conversation
5
+ * save({ runtimeDir, key, name, buf, now }) → { ok, name, path, size, kind } | { ok: false, status, error }
6
+ * remove({ runtimeDir, key, name }) → { ok } | { ok: false, … } a file not sent yet, from its chip's ×
7
+ * pathsOf({ runtimeDir, key, names }) → { ok, paths } | { ok: false, … } the saved files a message names
8
+ * withFiles(text, paths) → the message with the closing line that names each file for Claude
9
+ * splitFiles(text) → { text, files: [path] } the same line read back, for the PM's bubble
10
+ * servable(runtimeDir, p) → { ok, file, size, type, inline } | { ok: false, … } GET /api/chat-file?path=
11
+ *
12
+ * The files live in the workspace state folder, never in a repository, so nothing reaches git. The chat sessions start with
13
+ * the chat-files folder as an added directory, so Claude reads an attachment without a permission question. Nothing here
14
+ * sends anything anywhere. */
15
+ const fs = require('fs');
16
+ const path = require('path');
17
+ const crypto = require('crypto');
18
+
19
+ const MAX_BYTES = 20 * 1024 * 1024, MAX_FILES = 10;
20
+ const DIR = 'chat-files';
21
+ const LEAD = '[Attached files, read each one: ';
22
+ const KINDS = Object.freeze({
23
+ '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.gif': 'image/gif', '.webp': 'image/webp', '.heic': 'image/heic',
24
+ '.pdf': 'application/pdf',
25
+ });
26
+ const INLINE = new Set(['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'application/pdf']);
27
+
28
+ const fail = (status, error) => ({ ok: false, status, error });
29
+ const rootOf = (runtimeDir) => path.join(runtimeDir, DIR);
30
+ const dirOf = (runtimeDir, key) => path.join(rootOf(runtimeDir), crypto.createHash('sha256').update(String(key)).digest('hex').slice(0, 20));
31
+
32
+ /** A file name safe on every disk and in the message line: letters, digits, dot, dash and underscore; spaces become dashes. Pure. */
33
+ function cleanName(name) {
34
+ const b = String(name == null ? '' : name).split(/[\\/]/).pop().normalize('NFKD').replace(/[^\w.\- ]+/g, '').replace(/\s+/g, '-').replace(/^[.-]+/, '');
35
+ const m = /^(.*?)(\.[A-Za-z0-9]{1,8})?$/.exec(b) || [];
36
+ const stem = (m[1] || '').slice(0, 80) || 'file', ext = (m[2] || '').toLowerCase();
37
+ return stem + ext;
38
+ }
39
+ /** The stored name: a time prefix keeps two files of the same name apart and orders the folder. */
40
+ const storedName = (name, now = new Date()) => now.toISOString().replace(/[-:]/g, '').replace(/\..*$/, '') + '-' + cleanName(name);
41
+ const NAME_RE = /^\d{8}T\d{6}-[\w.-]{1,96}$/;
42
+
43
+ function save({ runtimeDir, key, name, buf, now = new Date() }) {
44
+ if (!runtimeDir) return fail(409, 'this workspace has no state folder to keep the file in');
45
+ if (!key) return fail(400, 'key must name a conversation');
46
+ if (!Buffer.isBuffer(buf) || !buf.length) return fail(400, 'The file is empty.');
47
+ if (buf.length > MAX_BYTES) return fail(413, 'The file is larger than 20 MB.');
48
+ const dir = dirOf(runtimeDir, key), n = storedName(name, now);
49
+ fs.mkdirSync(dir, { recursive: true });
50
+ let f = path.join(dir, n), i = 1;
51
+ while (fs.existsSync(f)) f = path.join(dir, n.replace(/(\.[a-z0-9]+)?$/, (e) => '-' + (i++) + (e || '')));
52
+ fs.writeFileSync(f, buf);
53
+ const base = path.basename(f);
54
+ return { ok: true, name: base, path: f, size: buf.length, kind: KINDS[path.extname(base)] || 'file' };
55
+ }
56
+ function remove({ runtimeDir, key, name }) {
57
+ if (!runtimeDir || !key) return fail(400, 'key must name a conversation');
58
+ if (!NAME_RE.test(String(name || ''))) return fail(400, 'no such file');
59
+ try { fs.unlinkSync(path.join(dirOf(runtimeDir, key), String(name))); } catch { return fail(404, 'no such file'); }
60
+ return { ok: true };
61
+ }
62
+ function pathsOf({ runtimeDir, key, names }) {
63
+ if (names == null) return { ok: true, paths: [] };
64
+ if (!Array.isArray(names)) return fail(400, 'files must be a list of names');
65
+ if (names.length > MAX_FILES) return fail(400, 'At most ' + MAX_FILES + ' files on one message.');
66
+ const dir = runtimeDir && key ? dirOf(runtimeDir, key) : null;
67
+ const paths = [];
68
+ for (const n of names) {
69
+ const f = dir && NAME_RE.test(String(n || '')) ? path.join(dir, String(n)) : null;
70
+ if (!f || !fs.existsSync(f)) return fail(400, 'A file on this message was not saved: ' + String(n || '').slice(0, 80));
71
+ paths.push(f);
72
+ }
73
+ return { ok: true, paths };
74
+ }
75
+ /** The message with one closing line that names each file. Files only: a short ask stands in for the words. Pure. */
76
+ function withFiles(text, paths) {
77
+ const t = String(text == null ? '' : text).trim();
78
+ if (!paths || !paths.length) return t;
79
+ return (t || 'Look at the attached files.') + '\n\n' + LEAD + paths.join(' | ') + ']';
80
+ }
81
+ /** The PM's words and the files the closing line names. Pure; a message with no line comes back as it is. */
82
+ function splitFiles(text) {
83
+ const t = String(text == null ? '' : text);
84
+ const i = t.lastIndexOf(LEAD);
85
+ if (i < 0 || !/\]\s*$/.test(t)) return { text: t, files: [] };
86
+ const files = t.slice(i + LEAD.length).replace(/\]\s*$/, '').split(' | ').map((s) => s.trim()).filter(Boolean);
87
+ return { text: t.slice(0, i).trim(), files };
88
+ }
89
+ function servable(runtimeDir, p) {
90
+ if (!runtimeDir) return fail(404, 'no such file');
91
+ const root = path.resolve(rootOf(runtimeDir)), f = path.resolve(String(p || ''));
92
+ if (path.dirname(path.dirname(f)) !== root || !NAME_RE.test(path.basename(f))) return fail(404, 'no such file');
93
+ let st; try { st = fs.lstatSync(f); } catch { return fail(404, 'no such file'); }
94
+ if (!st.isFile()) return fail(404, 'no such file');
95
+ const type = KINDS[path.extname(f).toLowerCase()] || 'application/octet-stream';
96
+ return { ok: true, file: f, size: st.size, type, inline: INLINE.has(type) };
97
+ }
98
+
99
+ module.exports = { MAX_BYTES, MAX_FILES, DIR, LEAD, rootOf, dirOf, cleanName, storedName, save, remove, pathsOf, withFiles, splitFiles, servable };
@@ -14,6 +14,7 @@ const guard = require('./pm-guard.js');
14
14
  const Wr = require('./briefing-premium-writes.js');
15
15
  const Ag = require('./briefing-premium-agent.js');
16
16
  const Goal = require('./goal-chat.js');
17
+ const Files = require('./chat-files.js');
17
18
  const Inbox = require('./agent-inbox.js');
18
19
  const actor = require('./actor.js');
19
20
  const WP = require('./my-work-premium.js');
@@ -90,7 +91,10 @@ async function post(req, res, url, ctx) {
90
91
  if (act === 'ask') {
91
92
  let wsId; try { const w = merged && sk ? { id: sk.ws } : ctx.getWs && ctx.getWs(url.searchParams.get('ws') || null); wsId = w && w.id; } catch { wsId = undefined; }
92
93
  // premium-chat-session: the panel IS a Claude Code session (one per key). Without the server's session hooks it falls back to the read-only run.
93
- const a = (ctx.chatSessions ? Ag.chat : Ag.ask)({ runtimeDir, key: b.key, text: b.text, sessions: ctx.chatSessions, model: /^work:/.test(String(b.key || '')) ? WP.peekModel() : /^board:/.test(String(b.key || '')) ? BoardP.peekModel() : /^ins:/.test(String(b.key || '')) ? InsP.peekModel() : /^(init|doc):/.test(String(b.key || '')) ? InitP.peekModel() : sk || (/^src:/.test(String(b.key || '')) && !(b.key === 'src:this-page' && url.searchParams.get('ws'))) ? Prod.peekModel() : BP.peekModel(root), spawnSession: ctx.spawnSession, wsId });
94
+ // premium-chat-attach A5: the files a message names must be saved files of its conversation; one closing line names each for Claude
95
+ const att = Files.pathsOf({ runtimeDir, key: b.key, names: b.files });
96
+ if (!att.ok) { ctx.json(res, { ok: false, error: att.error }, att.status); return true; }
97
+ const a = (ctx.chatSessions ? Ag.chat : Ag.ask)({ runtimeDir, key: b.key, text: Files.withFiles(b.text, att.paths), sessions: ctx.chatSessions, model: /^work:/.test(String(b.key || '')) ? WP.peekModel() : /^board:/.test(String(b.key || '')) ? BoardP.peekModel() : /^ins:/.test(String(b.key || '')) ? InsP.peekModel() : /^(init|doc):/.test(String(b.key || '')) ? InitP.peekModel() : sk || (/^src:/.test(String(b.key || '')) && !(b.key === 'src:this-page' && url.searchParams.get('ws'))) ? Prod.peekModel() : BP.peekModel(root), spawnSession: ctx.spawnSession, wsId });
94
98
  ctx.json(res, a.body, a.status);
95
99
  return true;
96
100
  }
@@ -106,10 +110,56 @@ async function post(req, res, url, ctx) {
106
110
  return true;
107
111
  }
108
112
 
113
+ /* premium-chat-attach A4, A7: a file or photo the PM attaches to a chat message. POST takes the raw bytes as a page press and saves them in the
114
+ * conversation's folder; /remove deletes one not sent yet; GET serves a saved one to the PM's bubble and the viewer, an image or PDF inline,
115
+ * anything else as a download, so no attached page ever runs as this app. */
116
+ function readRaw(req, max) {
117
+ return new Promise((resolve) => {
118
+ const parts = []; let n = 0, over = false;
119
+ req.on('data', (c) => { if (over) return; n += c.length; if (n > max) { over = true; parts.length = 0; return; } parts.push(c); });
120
+ req.on('end', () => resolve(over ? { over: true } : { buf: Buffer.concat(parts) }));
121
+ req.on('error', () => resolve({ over: false, buf: null }));
122
+ });
123
+ }
124
+ async function chatFile(req, res, url, ctx) {
125
+ if (url.pathname === '/api/chat-file' && req.method === 'GET') {
126
+ const f = Files.servable(ctx.runtimeDir, url.searchParams.get('path'));
127
+ if (!f.ok) { ctx.json(res, { ok: false, error: f.error }, f.status); return true; }
128
+ const name = path.basename(f.file).replace(/^\d{8}T\d{6}-/, '');
129
+ res.writeHead(200, { 'Content-Type': f.type, 'Content-Length': f.size, 'X-Content-Type-Options': 'nosniff', 'Cache-Control': 'private, max-age=3600',
130
+ 'Content-Disposition': (f.inline ? 'inline' : 'attachment') + '; filename="' + name + '"', ...(f.inline ? {} : { 'Content-Security-Policy': 'sandbox' }) });
131
+ fs.createReadStream(f.file).pipe(res);
132
+ return true;
133
+ }
134
+ if (req.method !== 'POST') { ctx.json(res, { ok: false, error: 'POST only' }, 405); return true; }
135
+ 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
+ const g = guard.requirePagePress(req, {});
137
+ if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
138
+ if (url.pathname === '/api/chat-file/remove') {
139
+ const got = await ctx.readJson(req);
140
+ if (!got.ok) { ctx.json(res, { ok: false, error: 'body must be JSON' }, 400); return true; }
141
+ const key = String((got.body && got.body.key) || '');
142
+ if (!Ag.KEY_RE.test(key)) { ctx.json(res, { ok: false, error: 'key must name a row' }, 400); return true; }
143
+ const r = Files.remove({ runtimeDir: ctx.runtimeDir, key, name: got.body.name });
144
+ ctx.json(res, r.ok ? { ok: true } : { ok: false, error: r.error }, r.ok ? 200 : r.status);
145
+ return true;
146
+ }
147
+ if (url.pathname !== '/api/chat-file') return false;
148
+ const key = url.searchParams.get('key') || '';
149
+ if (!Ag.KEY_RE.test(key)) { ctx.json(res, { ok: false, error: 'key must name a row' }, 400); return true; }
150
+ const raw = await readRaw(req, Files.MAX_BYTES);
151
+ if (raw.over) { ctx.json(res, { ok: false, error: 'The file is larger than 20 MB.' }, 413); return true; }
152
+ let r;
153
+ try { r = Files.save({ runtimeDir: ctx.runtimeDir, key, name: url.searchParams.get('name') || 'file', buf: raw.buf }); } catch (e) { r = { ok: false, status: 500, error: 'The file could not be saved: ' + String((e && e.message) || e).slice(0, 120) }; }
154
+ ctx.json(res, r.ok ? { ok: true, name: r.name, path: r.path, size: r.size, kind: r.kind } : { ok: false, error: r.error }, r.ok ? 200 : r.status);
155
+ return true;
156
+ }
157
+
109
158
  module.exports = {
110
159
  products,
111
- prefixes: ['/api/briefing-premium'],
160
+ prefixes: ['/api/briefing-premium', '/api/chat-file'],
112
161
  handle: async (req, res, url, ctx) => {
162
+ if (url.pathname === '/api/chat-file' || url.pathname.startsWith('/api/chat-file/')) return chatFile(req, res, url, ctx);
113
163
  if (url.pathname === '/api/briefing-premium/goal-stop') {
114
164
  // premium-chat-session U1: Claude Code's Stop hook for a chat session. The session's own token names it; the answer keeps a started goal going.
115
165
  if (req.method !== 'POST') { ctx.json(res, { ok: false, error: 'POST only' }, 405); return true; }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.375.0",
3
+ "version": "0.377.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.375.0",
9
+ "version": "0.377.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.375.0",
3
+ "version": "0.377.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",