create-pmos 0.342.0 → 0.343.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 +13 -13
- 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/changelog.json +12 -0
- package/workspace/guide/briefing-premium.md +1 -0
- package/workspace/lib/chat-file-locate.js +49 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/chat-md.js +19 -2
- package/workspace/public/pm/premium-shell.js +9 -1
- package/workspace/public/pm/premium-vw-doc.css +3 -0
- package/workspace/public/pm/premium-vw-file.js +72 -0
- package/workspace/public/pm/premium.css +8 -0
- package/workspace/server.js +10 -0
- package/workspace/test-files.json +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.343.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,18 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.343.0",
|
|
37
|
+
"at": "2026-10-20T05:20:19.894Z",
|
|
38
|
+
"f": 2,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 938,
|
|
42
|
+
"t": "A file Claude names in a premium chat panel opens beside the conversation",
|
|
43
|
+
"s": "A file path in Claude's words is underlined, and pressing it opens the file read-only as a viewer tab beside the conversation."
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
35
47
|
{
|
|
36
48
|
"v": "0.342.0",
|
|
37
49
|
"at": "2026-10-20T04:02:58.586Z",
|
|
@@ -294,18 +306,6 @@
|
|
|
294
306
|
"s": "Present opens the presenter view from the prototype's conversation shell."
|
|
295
307
|
}
|
|
296
308
|
]
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"v": "0.323.0",
|
|
300
|
-
"at": "2026-10-19T16:13:33.275Z",
|
|
301
|
-
"f": 2,
|
|
302
|
-
"prs": [
|
|
303
|
-
{
|
|
304
|
-
"n": 907,
|
|
305
|
-
"t": "The full calendar in the premium viewer, Day, Week and Month",
|
|
306
|
-
"s": "A button in the Calendar card's title row opens the calendar in the dialog, with Day, Week and Month, the arrows and Today."
|
|
307
|
-
}
|
|
308
|
-
]
|
|
309
309
|
}
|
|
310
310
|
]
|
|
311
311
|
}
|
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-20T05:20:17Z"}
|
|
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-20T05:20:17Z"}
|
|
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-20T05:20:17Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.343.0",
|
|
4
|
+
"at": "2026-10-20T05:20:19.894Z",
|
|
5
|
+
"f": 2,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 938,
|
|
9
|
+
"t": "A file Claude names in a premium chat panel opens beside the conversation",
|
|
10
|
+
"s": "A file path in Claude's words is underlined, and pressing it opens the file read-only as a viewer tab beside the conversation."
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
2
14
|
{
|
|
3
15
|
"v": "0.342.0",
|
|
4
16
|
"at": "2026-10-20T04:02:58.586Z",
|
|
@@ -375,6 +375,7 @@ The conversation beside every premium dialog is a real Claude Code session. Anyt
|
|
|
375
375
|
- **What it may do** is set by your own Claude Code settings. Claude can change files and run commands. When your settings say to ask first, the question shows in the panel with its options; press one to answer.
|
|
376
376
|
- **Stop** shows while Claude works. It presses Esc in the session.
|
|
377
377
|
- **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.
|
|
378
|
+
- **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 and other text files as code. 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.
|
|
378
379
|
- **The session** is also listed in **Agent sessions** and in the console, where you can open its terminal. When it has ended, your next message starts a new one.
|
|
379
380
|
- Answers from the older read-only agent stay above the session, marked "Earlier read-only answer".
|
|
380
381
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* chat-file-locate.js — which served workspace holds a file path Claude wrote in a premium chat panel (PM, 2026-10-20: "Why can't I click the file
|
|
3
|
+
* and see it on the right panel?"). The panel shows the file read-only in the viewer through GET /api/doc, which already guards every read to one
|
|
4
|
+
* workspace's root. This module only answers "which workspace, and which path inside it", so the guard stays the one /api/doc applies.
|
|
5
|
+
*
|
|
6
|
+
* locate({ path, roots, base, home }) -> { ok: true, ws, rel, abs, size, mtime } | { ok: false, reason, why }
|
|
7
|
+
* path what Claude wrote: absolute, ~/…, or relative to the session's folder. A trailing :line or :line:col is dropped.
|
|
8
|
+
* roots [{ id, root }] the workspaces the server serves. Nothing outside them is read.
|
|
9
|
+
* base the session's own workspace id: a relative path resolves against its root.
|
|
10
|
+
* home the user's home folder, for ~/.
|
|
11
|
+
* reason: 'outside' (no served workspace holds the path), 'missing' (no such file), 'not-file' (a folder), 'bad' (no path).
|
|
12
|
+
* Both the path and each root are resolved to their real paths, so a symlink inside a workspace cannot lead out of it. */
|
|
13
|
+
const fs = require('fs');
|
|
14
|
+
const path = require('path');
|
|
15
|
+
|
|
16
|
+
const inside = (root, p) => p === root || p.startsWith(root.endsWith(path.sep) ? root : root + path.sep);
|
|
17
|
+
const real = (p) => { try { return fs.realpathSync(p); } catch { return null; } };
|
|
18
|
+
|
|
19
|
+
/** What Claude wrote, as a path: quotes, a trailing :12 or :12:3 and surrounding punctuation dropped. Pure. */
|
|
20
|
+
function cleanPath(p) {
|
|
21
|
+
let s = String(p == null ? '' : p).trim().replace(/^['"`<(]+|['"`>),.;]+$/g, '');
|
|
22
|
+
s = s.replace(/:(\d+)(:\d+)?$/, '');
|
|
23
|
+
return s;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function locate({ path: raw, roots = [], base = null, home = null } = {}) {
|
|
27
|
+
const p = cleanPath(raw);
|
|
28
|
+
if (!p || p.length > 4096 || p.includes('\0')) return { ok: false, reason: 'bad', why: 'There is no file path to open.' };
|
|
29
|
+
const list = roots.filter((r) => r && r.id && r.root).map((r) => ({ id: r.id, root: path.resolve(r.root), real: real(r.root) || path.resolve(r.root) }));
|
|
30
|
+
let abs;
|
|
31
|
+
if (p === '~' || p.startsWith('~/')) abs = home ? path.join(home, p.slice(2)) : null;
|
|
32
|
+
else if (path.isAbsolute(p)) abs = path.resolve(p);
|
|
33
|
+
else { const b = list.find((r) => r.id === base) || list[0]; abs = b ? path.resolve(b.root, p) : null; }
|
|
34
|
+
const outside = { ok: false, reason: 'outside', why: 'This file is not in a workspace PMOS serves, so it is not shown here.' };
|
|
35
|
+
if (!abs) return outside;
|
|
36
|
+
// the deepest workspace that holds the path as written (a worktree inside its repository wins over the repository)
|
|
37
|
+
const holders = list.filter((r) => inside(r.root, abs) || inside(r.real, abs)).sort((a, b) => b.root.length - a.root.length);
|
|
38
|
+
if (!holders.length) return outside;
|
|
39
|
+
const r = real(abs);
|
|
40
|
+
if (!r) return { ok: false, reason: 'missing', why: 'There is no such file. It may have been moved or not written yet.' };
|
|
41
|
+
const w = holders.find((h) => inside(h.real, r));
|
|
42
|
+
if (!w) return outside; // a symlink that leads out of the workspace
|
|
43
|
+
let st; try { st = fs.statSync(r); } catch { return { ok: false, reason: 'missing', why: 'The file could not be read.' }; }
|
|
44
|
+
if (!st.isFile()) return { ok: false, reason: 'not-file', why: 'This is a folder, not a file.' };
|
|
45
|
+
const rel = path.relative(w.real, r).split(path.sep).join('/');
|
|
46
|
+
return { ok: true, ws: w.id, rel, abs: path.join(w.root, rel), name: path.basename(r), size: st.size, mtime: st.mtimeMs };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
module.exports = { locate, cleanPath };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.343.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.343.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -4,13 +4,30 @@
|
|
|
4
4
|
* http(s). The PM's own turns lose the <pasted_content> wrapper Claude Code puts around a paste, and keep their line breaks. */
|
|
5
5
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/* A file path Claude wrote (PM, 2026-10-20: "Why can't I click the file and see it on the right panel?"): a `code` span, a [name](path) link or a bare
|
|
8
|
+
* /abs, ~/ or ./ path that names a file becomes a press that opens it read-only in the viewer beside the conversation. The server decides whether the
|
|
9
|
+
* file is in a served workspace (GET /api/doc/locate); here it only has to look like a file. A path with a folder needs an extension; a bare name needs
|
|
10
|
+
* a document's extension, so `res.json` and `a.b` stay code. */
|
|
11
|
+
const DOC_EXT = /\.(md|markdown|mdx|txt|csv|ya?ml|toml|skill)$/i;
|
|
12
|
+
/** True when the (escaped) text reads as a file path. Pure. */
|
|
13
|
+
export function looksFile(t) {
|
|
14
|
+
const s = String(t || '').replace(/:\d+(:\d+)?$/, '');
|
|
15
|
+
if (!s || s.length > 1024 || /^[a-z][\w+.-]*:/i.test(s) || /[\s<>"`*]|&(?!amp;)/.test(s)) return false;
|
|
16
|
+
if (!/^(~\/|\.{1,2}\/|\/)?[\w.@+-]+(\/[\w.@+-]+)*$/.test(s)) return false;
|
|
17
|
+
if (!/\.[A-Za-z0-9]{1,10}$/.test(s)) return false;
|
|
18
|
+
return s.includes('/') || DOC_EXT.test(s);
|
|
19
|
+
}
|
|
20
|
+
const fileBtn = (p, label) => `<button type="button" class="fpath" data-file="${p}" title="Open ${p} beside the conversation">${label}</button>`;
|
|
21
|
+
|
|
22
|
+
/** One line's inline marks, on text that is already escaped: `code`, [links](https://…), bare URLs, file paths, **bold**, *italic*, ~~struck~~. */
|
|
8
23
|
function inline(t) {
|
|
9
24
|
const keep = [];
|
|
10
25
|
const hold = (h) => '\u0000' + (keep.push(h) - 1) + '\u0000';
|
|
11
|
-
let s = t.replace(/`([^`]+)`/g, (_, c) => hold(`<code>${c}</code>`));
|
|
26
|
+
let s = t.replace(/`([^`]+)`/g, (_, c) => hold(looksFile(c.trim()) ? fileBtn(c.trim(), `<code>${c}</code>`) : `<code>${c}</code>`));
|
|
12
27
|
s = s.replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g, (_, txt, u) => hold(`<a href="${u}" target="_blank" rel="noopener noreferrer">${txt}</a>`));
|
|
28
|
+
s = s.replace(/\[([^\]]+)\]\(([^\s)]+)\)/g, (m, txt, u) => (looksFile(u) ? hold(fileBtn(u, txt)) : m));
|
|
13
29
|
s = s.replace(/(^|[\s(])(https?:\/\/[^\s<]+[^\s<.,;:!?)])/g, (_, pre, u) => pre + hold(`<a href="${u}" target="_blank" rel="noopener noreferrer">${u}</a>`));
|
|
30
|
+
s = s.replace(/(^|[\s(])((?:~|\.{1,2})?\/[^\s<()]*[^\s<().,;:!?])/g, (m, pre, u) => (looksFile(u) ? pre + hold(fileBtn(u, u)) : m));
|
|
14
31
|
s = s.replace(/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g, '<strong>$2</strong>')
|
|
15
32
|
.replace(/(^|[^*\w])\*(?=\S)([^*]*?\S)\*(?!\*)/g, '$1<em>$2</em>')
|
|
16
33
|
.replace(/~~(?=\S)([\s\S]*?\S)~~/g, '<del>$1</del>');
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { pmGet, pmPost } from './http.js';
|
|
3
3
|
import { recChipView, STOP_LINE } from './premium-meeting.js';
|
|
4
4
|
import { vwReset } from './premium-viewer.js';
|
|
5
|
+
import { openChatFile } from './premium-vw-file.js';
|
|
5
6
|
import { chipActs, openLive, openFocus, mountRecord, HL_LINE } from './premium-vw-rec.js';
|
|
6
7
|
import { lineItems, behindOf, refreshTargets, whenRead } from './freshness-words.js';
|
|
7
8
|
import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, slashMatches } from './goal-chat.js';
|
|
@@ -269,7 +270,7 @@ export function drawThread(th, key, conv) {
|
|
|
269
270
|
let t = $('#thr', box); if (!t) { box.insertAdjacentHTML('beforeend', '<div id="thr"></div>'); t = $('#thr', box); }
|
|
270
271
|
const b = $('#dBody'), atEnd = b.scrollHeight - b.scrollTop - b.clientHeight < 80;
|
|
271
272
|
t.innerHTML = threadHtml(th) + sessionHtml(conv, th.goal);
|
|
272
|
-
S.goal = th.goal || null; S.draft = readyDraft(conv);
|
|
273
|
+
S.goal = th.goal || null; S.draft = readyDraft(conv); S.session = th.session || null;
|
|
273
274
|
const go = $('#askGo'); if (go) go.disabled = !!th.working; // an earlier read-only run still answering
|
|
274
275
|
const n = $('#askNote'); if (n) n.textContent = th.working ? 'The agent is answering. You can write again when it has.' : conv && conv.ask ? 'Claude is waiting for your answer above.' : CHAT_NOTE;
|
|
275
276
|
if (atEnd) b.scrollTop = b.scrollHeight;
|
|
@@ -299,6 +300,13 @@ $('#dBody').addEventListener('click', async (e) => {
|
|
|
299
300
|
if (!r || !r.ok) $('#askNote').textContent = (r && r.error) || 'The key did not reach the session.';
|
|
300
301
|
setTimeout(() => loadThread(S.key), 500);
|
|
301
302
|
});
|
|
303
|
+
/* a file path in Claude's words opens the file read-only as a viewer tab beside the conversation; on a phone the Detail side shows it */
|
|
304
|
+
$('#dBody').addEventListener('click', (e) => {
|
|
305
|
+
const f = e.target.closest('[data-file]'); if (!f) return;
|
|
306
|
+
e.preventDefault();
|
|
307
|
+
openChatFile(f.dataset.file, { session: S.session || null, ws: new URLSearchParams(location.search).get('ws') });
|
|
308
|
+
if (innerWidth < 1000) setTab('out');
|
|
309
|
+
});
|
|
302
310
|
/* /goal (slice 2): a chip sends its answer; Start and Cancel are the PM's presses on the goal card; Change something hands the box back. */
|
|
303
311
|
async function sendText(key, text) {
|
|
304
312
|
const go = $('#askGo'); if (go) go.disabled = true; $('#askNote').textContent = 'Sending.';
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
.vwdoc .gap{flex:1}
|
|
9
9
|
.vwmut{color:var(--ink-3);font-size:var(--fs-2);margin:0}
|
|
10
10
|
.vwline{margin:0 0 10px}
|
|
11
|
+
.vwfnone{margin:8px 0;padding:22px 20px;border:1px dashed var(--hair);border-radius:8px;display:grid;gap:6px;color:var(--ink-2);font-size:var(--fs-3)}
|
|
12
|
+
.vwfnone b{font-weight:500;color:var(--ink)}
|
|
13
|
+
.vwfnone code{font:400 var(--fs-1) var(--mono);color:var(--ink-3);overflow-wrap:anywhere}
|
|
11
14
|
.vwempty{color:var(--ink-3);font-size:var(--fs-3);padding:24px 4px}
|
|
12
15
|
.vwrow{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:8px}
|
|
13
16
|
.vwrow .vwmut{flex:1;min-width:160px}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* pm/premium-vw-file.js — a file Claude named in a chat panel, read-only in the viewer beside the conversation (PM, 2026-10-20: "Why can't I click the file
|
|
2
|
+
* and see it on the right panel?"). A press on a path in Claude's words (chat-md.js draws it as button.fpath) opens the file as a tab: markdown as a page,
|
|
3
|
+
* any other text file as code. GET /api/doc/locate says which served workspace holds the path and GET /api/doc reads it there, so a path outside every
|
|
4
|
+
* workspace PMOS serves is never read: its tab says so quietly. While the tab is open the file is checked every few seconds and drawn again when it
|
|
5
|
+
* changed, so a file Claude is still writing stays current. Nothing here writes.
|
|
6
|
+
* openChatFile(path, { session, ws }) -> the tab's pane */
|
|
7
|
+
import { vwOpen, vwStyle } from './premium-viewer.js';
|
|
8
|
+
import { bodyHtml, pageHead, splitDoc, readMinutes } from './premium-vw-doc-model.js';
|
|
9
|
+
|
|
10
|
+
const CHECK_MS = 2500;
|
|
11
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
12
|
+
const base = (p) => String(p || '').replace(/:\d+(:\d+)?$/, '').split('/').filter(Boolean).pop() || 'File';
|
|
13
|
+
const OPEN = new Map(); // tab id -> state
|
|
14
|
+
async function getJson(url) { try { const r = await fetch(url, { credentials: 'same-origin' }); return await r.json(); } catch { return null; } }
|
|
15
|
+
async function getText(url) { try { const r = await fetch(url, { credentials: 'same-origin' }); return { ok: r.ok, text: await r.text(), kind: r.headers.get('X-Doc-Kind') || 'text' }; } catch { return { ok: false, text: 'The workspace server did not answer.' }; } }
|
|
16
|
+
|
|
17
|
+
/** The page for one file as HTML. Pure, for Node: f is { name, rel, abs, kind, text, err, why, reason }. */
|
|
18
|
+
export function fileHtml(f) {
|
|
19
|
+
if (!f || f.loading) return '<div class="vwdoc"><p class="vwempty" role="status">Reading the file.</p></div>';
|
|
20
|
+
if (f.reason) {
|
|
21
|
+
const head = f.reason === 'outside' ? 'Not in a workspace' : f.reason === 'missing' ? 'No such file' : 'Not opened here';
|
|
22
|
+
return `<div class="vwdoc"><div class="vwfnone" role="status"><b>${esc(head)}</b><p class="vwmut">${esc(f.why || '')}</p><code>${esc(f.path)}</code></div></div>`;
|
|
23
|
+
}
|
|
24
|
+
if (f.err) return `<div class="vwdoc"><div class="vwfnone" role="status"><b>The file could not be shown</b><p class="vwmut">${esc(f.err)}</p><code>${esc(f.abs || f.path)}</code></div></div>`;
|
|
25
|
+
const foot = `<footer class="cff"><span>Read-only · ${readMinutes(f.text)} min read</span><span class="gap"></span><code>${esc(f.abs || f.rel)}</code></footer>`;
|
|
26
|
+
if (f.kind === 'markdown') {
|
|
27
|
+
const h = pageHead(f.text), sd = splitDoc(f.text);
|
|
28
|
+
const body = bodyHtml([sd.pre, ...sd.sections.map((s, n) => (n === 0 && h.h1 ? s.body : s.head + '\n' + s.body))].join('\n')).html;
|
|
29
|
+
return `<div class="vwdoc"><article class="cf vwfile"><header class="cfh"><h1 class="cft">${esc(h.title || f.name)}</h1>`
|
|
30
|
+
+ (h.labels.length ? `<div class="cflb">${h.labels.map((l) => `<span>${esc(l)}</span>`).join('')}</div>` : '')
|
|
31
|
+
+ `</header><div class="cfb">${body || '<p class="vwmut">The file has no text yet.</p>'}</div>${foot}</article></div>`;
|
|
32
|
+
}
|
|
33
|
+
const ext = (/\.([A-Za-z0-9]+)$/.exec(f.name || '') || [])[1] || 'text';
|
|
34
|
+
return `<div class="vwdoc"><article class="cf vwfile"><header class="cfh"><h1 class="cft">${esc(f.name)}</h1></header>`
|
|
35
|
+
+ `<div class="cfb"><div class="cb" data-lang="${esc(ext)}"><div class="cbh"><span>${esc(ext)}</span></div><pre>${esc(f.text)}</pre></div></div>${foot}</article></div>`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function openChatFile(p, ctx = {}) {
|
|
39
|
+
vwStyle('doc');
|
|
40
|
+
const q = (o) => Object.entries(o).filter(([, v]) => v).map(([k, v]) => k + '=' + encodeURIComponent(v)).join('&');
|
|
41
|
+
const where = () => '/api/doc/locate?' + q({ path: p, session: ctx.session, ws: ctx.ws });
|
|
42
|
+
const id = 'file:' + p;
|
|
43
|
+
let st = OPEN.get(id);
|
|
44
|
+
if (!st) { st = { f: { loading: true, path: p }, sig: '', timer: null }; OPEN.set(id, st); }
|
|
45
|
+
const pane = vwOpen({ id, title: base(p), icon: 'doc', render: (el) => { el.innerHTML = fileHtml(st.f); } });
|
|
46
|
+
const draw = () => {
|
|
47
|
+
const el = document.querySelector(`#dOut .obody.vw[data-vw="${CSS.escape(id)}"]`);
|
|
48
|
+
if (!el) return false;
|
|
49
|
+
const y = el.scrollTop; el.innerHTML = fileHtml(st.f); el.scrollTop = y;
|
|
50
|
+
return true;
|
|
51
|
+
};
|
|
52
|
+
async function read() {
|
|
53
|
+
const loc = await getJson(where());
|
|
54
|
+
if (!loc) { if (st.f.loading) { st.f = { path: p, err: 'The workspace server did not answer.' }; return true; } return false; } // a missed check keeps what is drawn
|
|
55
|
+
if (!loc.ok) { const sig = 'x:' + loc.reason; if (sig === st.sig) return false; st.sig = sig; st.f = { path: p, reason: loc.reason, why: loc.why }; return true; }
|
|
56
|
+
const sig = loc.ws + '/' + loc.rel + '@' + loc.mtime + ':' + loc.size;
|
|
57
|
+
if (sig === st.sig) return false;
|
|
58
|
+
const got = await getText('/api/doc?' + q({ ws: loc.ws, path: loc.rel }));
|
|
59
|
+
st.sig = sig;
|
|
60
|
+
st.f = got.ok ? { path: p, name: loc.name, rel: loc.rel, abs: loc.abs, kind: got.kind, text: got.text } : { path: p, abs: loc.abs, err: got.text };
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
clearTimeout(st.timer);
|
|
64
|
+
const tick = async () => {
|
|
65
|
+
const changed = await read();
|
|
66
|
+
if (!document.querySelector(`#dOut .obody.vw[data-vw="${CSS.escape(id)}"]`)) { OPEN.delete(id); return; } // the tab or the dialog closed: stop checking
|
|
67
|
+
if (changed) draw();
|
|
68
|
+
st.timer = setTimeout(tick, CHECK_MS);
|
|
69
|
+
};
|
|
70
|
+
st.sig = ''; st.f = { loading: true, path: p }; tick();
|
|
71
|
+
return pane;
|
|
72
|
+
}
|
|
@@ -356,6 +356,10 @@ a.round{color:inherit;text-decoration:none}
|
|
|
356
356
|
.p-out{background:transparent;border-radius:0}
|
|
357
357
|
.otop{padding:0 0 6px;background:transparent}
|
|
358
358
|
.otop .ol{display:none}
|
|
359
|
+
/* a phone: the dialog's panes scroll under its title with no edge of their own, so text slid up to the subtitle and read as overlapping it (PM, 2026-10-20).
|
|
360
|
+
The top of each scrolling pane now fades, and the viewer's tab strip, which stays at the top, carries the dialog's own surface. */
|
|
361
|
+
.dlg .dgrid .pane{padding-top:12px;-webkit-mask-image:linear-gradient(to bottom,transparent 0,var(--ink) 14px);mask-image:linear-gradient(to bottom,transparent 0,var(--ink) 14px)}
|
|
362
|
+
.otop:has(.vtabs:not([hidden])){top:0;padding-top:12px;margin-top:-12px;background:var(--card-solid)}
|
|
359
363
|
.obody{padding:0}
|
|
360
364
|
.paper.doc{padding:2px 0 28px;border:0;box-shadow:none;background:transparent;border-radius:0}
|
|
361
365
|
.doc .dpath{display:none}}
|
|
@@ -2183,6 +2187,10 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
|
|
|
2183
2187
|
.md pre{margin:0 0 12px;background:var(--well);border-radius:12px;padding:12px 14px;overflow-x:auto;max-width:100%}
|
|
2184
2188
|
.md pre code{display:block;background:none;padding:0;font-size:var(--fs-2);line-height:1.6;white-space:pre;overflow-wrap:normal}
|
|
2185
2189
|
.md a{color:var(--ember-ink);text-decoration:underline;text-underline-offset:2px}
|
|
2190
|
+
.md .fpath{display:inline;padding:0;margin:0;border:0;background:none;font:inherit;color:var(--ember-ink);text-align:left;cursor:pointer;text-decoration:underline;text-underline-offset:2px;text-decoration-color:color-mix(in oklab,var(--ember-ink) 45%,transparent);overflow-wrap:anywhere}
|
|
2191
|
+
.md .fpath code{color:inherit;overflow-wrap:anywhere}
|
|
2192
|
+
.md .fpath:focus-visible{outline:2px solid var(--ember);outline-offset:2px;border-radius:4px}
|
|
2193
|
+
@media (hover:hover){.md .fpath:hover{text-decoration-color:currentColor}}
|
|
2186
2194
|
.md blockquote{margin:0 0 10px;padding:2px 0 2px 12px;border-left:2px solid var(--hair);color:var(--ink-2)}
|
|
2187
2195
|
.md hr{border:0;border-top:1px solid var(--hair);margin:14px 0}
|
|
2188
2196
|
.mdtab{margin:0 0 12px;overflow-x:auto;border:1px solid var(--hair);border-radius:12px}
|
package/workspace/server.js
CHANGED
|
@@ -31,6 +31,7 @@ if (SET_GIT_OPTIONAL_LOCKS) process.env.GIT_OPTIONAL_LOCKS = '0';
|
|
|
31
31
|
const http = require('http');
|
|
32
32
|
const fs = require('fs');
|
|
33
33
|
const os = require('os');
|
|
34
|
+
const chatFileLocate = require('./lib/chat-file-locate.js');
|
|
34
35
|
const path = require('path');
|
|
35
36
|
const crypto = require('crypto');
|
|
36
37
|
const { execFile, spawnSync, spawn } = require('child_process');
|
|
@@ -7329,6 +7330,15 @@ async function handleRequest(req, res) {
|
|
|
7329
7330
|
});
|
|
7330
7331
|
return json(res, { ok: true, pages });
|
|
7331
7332
|
}
|
|
7333
|
+
if (p === '/api/doc/locate' && req.method === 'GET') {
|
|
7334
|
+
// A file path Claude wrote in a premium chat panel: which served workspace holds it (lib/chat-file-locate.js). The panel then reads it read-only
|
|
7335
|
+
// through GET /api/doc. A path in no served workspace answers `outside`, and nothing is read.
|
|
7336
|
+
// a relative path is the session's own: it resolves against the folder the chat's session runs in, else the page's workspace
|
|
7337
|
+
const sess = sessions.get(url.searchParams.get('session') || '');
|
|
7338
|
+
const base = (sess && workspaces.get(sess.ws)) || getWs(url.searchParams.get('ws'));
|
|
7339
|
+
const r = chatFileLocate.locate({ path: url.searchParams.get('path') || '', roots: [...workspaces.values()].map((w) => ({ id: w.id, root: w.root })), base: base ? base.id : null, home: os.homedir() });
|
|
7340
|
+
return json(res, r);
|
|
7341
|
+
}
|
|
7332
7342
|
if (p === '/api/doc') {
|
|
7333
7343
|
const w = getWs(url.searchParams.get('ws'));
|
|
7334
7344
|
// `ref` — a file that exists only on an initiative's own branch (status-clarity R5). Read through git, never the
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"briefing-premium-agent.test.js",
|
|
41
41
|
"goal-chat.test.js",
|
|
42
42
|
"chat-md.test.js",
|
|
43
|
+
"chat-file-locate.test.js",
|
|
43
44
|
"briefing-premium-work.test.js",
|
|
44
45
|
"briefing-premium-board.test.js",
|
|
45
46
|
"briefing-premium-insights.test.js",
|
|
@@ -214,6 +215,7 @@
|
|
|
214
215
|
"briefing-premium-agent.test.js": 1,
|
|
215
216
|
"goal-chat.test.js": 1,
|
|
216
217
|
"chat-md.test.js": 1,
|
|
218
|
+
"chat-file-locate.test.js": 1,
|
|
217
219
|
"briefing-premium-work.test.js": 1,
|
|
218
220
|
"briefing-premium-board.test.js": 1,
|
|
219
221
|
"briefing-premium-insights.test.js": 1,
|