create-pmos 0.339.0 → 0.341.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.339.0",
3
+ "version": "0.341.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.341.0",
37
+ "at": "2026-10-20T03:46:04.473Z",
38
+ "f": 2,
39
+ "prs": [
40
+ {
41
+ "n": 936,
42
+ "t": "The premium chat panel draws Claude's markdown, hides paste tags and quiets tool lines",
43
+ "s": "Claude's turns render as markdown, the way Claude Code shows them."
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "v": "0.340.0",
49
+ "at": "2026-10-20T03:15:05.728Z",
50
+ "f": 2,
51
+ "prs": [
52
+ {
53
+ "n": 935,
54
+ "t": "A Briefing row when a /goal ends or needs the PM",
55
+ "s": "Each such goal adds one row to the Briefing list, built in the existing row pattern."
56
+ }
57
+ ]
58
+ },
35
59
  {
36
60
  "v": "0.339.0",
37
61
  "at": "2026-10-20T03:01:53.405Z",
@@ -282,30 +306,6 @@
282
306
  "s": "A Jira task opens its ticket in a second viewer tab."
283
307
  }
284
308
  ]
285
- },
286
- {
287
- "v": "0.321.0",
288
- "at": "2026-10-19T15:28:55.229Z",
289
- "f": 2,
290
- "prs": [
291
- {
292
- "n": 903,
293
- "t": "One markdown document page in the premium viewer, with agent edits and one Keep",
294
- "s": "Any markdown file (a PRD, a new doc, a report cycle) opens as one page in a viewer tab beside the dialog: title, byline from the edit log, a properties table from the front matter, then panels, tables, task lists…"
295
- }
296
- ]
297
- },
298
- {
299
- "v": "0.320.0",
300
- "at": "2026-10-19T15:12:24.143Z",
301
- "f": 2,
302
- "prs": [
303
- {
304
- "n": 899,
305
- "t": "Premium dialog viewer with tabs",
306
- "s": "The right pane can open other items as tabs beside its own detail, with at most 4 extra tabs."
307
- }
308
- ]
309
309
  }
310
310
  ]
311
311
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@85ad48db
1
+ kernel-source: pmos@94809dff
2
2
  assembled: 2026-10-20
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-20T03:01:50Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-20T03:46:01Z"}
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-20T03:01:50Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-20T03:46:01Z"}
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-20T03:01:50Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-20T03:46:01Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,28 @@
1
1
  [
2
+ {
3
+ "v": "0.341.0",
4
+ "at": "2026-10-20T03:46:04.473Z",
5
+ "f": 2,
6
+ "prs": [
7
+ {
8
+ "n": 936,
9
+ "t": "The premium chat panel draws Claude's markdown, hides paste tags and quiets tool lines",
10
+ "s": "Claude's turns render as markdown, the way Claude Code shows them."
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ "v": "0.340.0",
16
+ "at": "2026-10-20T03:15:05.728Z",
17
+ "f": 2,
18
+ "prs": [
19
+ {
20
+ "n": 935,
21
+ "t": "A Briefing row when a /goal ends or needs the PM",
22
+ "s": "Each such goal adds one row to the Briefing list, built in the existing row pattern."
23
+ }
24
+ ]
25
+ },
2
26
  {
3
27
  "v": "0.339.0",
4
28
  "at": "2026-10-20T03:01:53.405Z",
@@ -374,7 +374,7 @@ The conversation beside every premium dialog is a real Claude Code session. Anyt
374
374
  - **Later messages** in the same dialog go to the same session. Write `/compact`, `/clear` or any other slash command, and Claude Code runs it.
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
- - **The conversation** is Claude Code's own record, word for word. A run of tool calls shows as one line, for example "Used Read ×2, Edit".
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
378
  - **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
379
  - Answers from the older read-only agent stay above the session, marked "Earlier read-only answer".
380
380
 
@@ -392,5 +392,6 @@ Type `/` in the box to see the commands: `/goal`, `/compact` and `/clear`. Use t
392
392
  - **While it works**, a goal card under the conversation 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.
393
393
  - **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.
394
394
  - **Stop the goal** presses Esc in the session and ends the goal.
395
+ - **In the Briefing**, a goal that is done, stopped or needs you is a row at the top of the list. Pressing it opens the goal's own conversation. The row goes when you write in that conversation, or after a week.
395
396
 
396
397
  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.
@@ -181,7 +181,7 @@ function chat({ runtimeDir, key, text, model, sessions, wsId, now = new Date() }
181
181
  const extra = goal ? { goal } : {};
182
182
  if (alive) {
183
183
  if (!sessions.type(live, msg)) return fail(409, 'The message did not reach the session. Open it in Agent sessions.');
184
- if (!goal) Goal.resume({ runtimeDir, key, now }); // slice 3: the PM's answer to a goal that needs them sets it going again
184
+ if (!goal) Goal.resume({ runtimeDir, key, now }); // slice 3: the PM's answer to a goal that needs them sets it going again; a finished one is seen
185
185
  return { status: 200, body: { ok: true, session: live, started: false, ...extra } };
186
186
  }
187
187
  let s;
@@ -74,6 +74,7 @@ function goalOf(runtimeDir, key) {
74
74
  else if (e.event === 'started') g = { ...g, state: 'started', draft: e.draft, startedAt: e.at, rounds: 0, met: [], open: (e.draft && e.draft.done) || [], at: e.at };
75
75
  else if (e.event === 'cancelled') g = { ...g, state: 'cancelled', at: e.at };
76
76
  else if (e.event === 'round') g = { ...g, rounds: e.n, met: e.met || [], open: e.open || [], at: e.at };
77
+ else if (e.event === 'seen') g = { ...g, seen: true };
77
78
  else if (e.event === 'resumed') g = { ...g, state: 'started', reason: undefined, at: e.at };
78
79
  else if (['done', 'stopped', 'waiting'].includes(e.event)) g = { ...g, state: e.event, ...(e.reason ? { reason: e.reason } : {}), met: e.met || g.met, open: e.open || g.open, at: e.at };
79
80
  }
@@ -126,12 +127,59 @@ function onStop({ runtimeDir, key, message, now = new Date() }) {
126
127
  append(runtimeDir, { event: 'round', n, ...base });
127
128
  return { decision: 'block', reason: '[PMOS /goal round ' + n + '] The goal is not done yet: ' + met.length + ' of ' + all.length + ' done points met. Keep working on: ' + (open.length ? open.join('; ') : 'the open points') + '. This is round ' + n + ' of ' + (d.limit || LIMIT) + '. If you need the PM, ask and end with a pmos-goal progress block whose state is needs-you. End each message with the progress block.' };
128
129
  }
129
- /** The PM answered a goal that waits on them (U3): it is working again. A goal in any other state is left as it is. */
130
+ /** The PM wrote in the goal's conversation. A goal that waits on them is working again (U3); a finished or stopped goal is seen,
131
+ * so its Briefing row goes (U7). A goal in any other state is left as it is. */
130
132
  function resume({ runtimeDir, key, now = new Date() }) {
131
133
  const g = goalOf(runtimeDir, key);
132
- if (!g || g.state !== 'waiting') return false;
133
- append(runtimeDir, { event: 'resumed', id: g.id, key, at: now.toISOString() });
134
- return true;
134
+ if (!g) return false;
135
+ if (g.state === 'waiting') { append(runtimeDir, { event: 'resumed', id: g.id, key, at: now.toISOString() }); return true; }
136
+ if ((g.state === 'done' || g.state === 'stopped') && !g.seen) append(runtimeDir, { event: 'seen', id: g.id, key, at: now.toISOString() });
137
+ return false;
138
+ }
139
+
140
+ /* ── U7: the Briefing row of a goal that is done, stopped or needs the PM ────────────────────────────────────────────────
141
+ * One row per conversation (key goal:<conversation key>); chatKey names the conversation, so pressing the row opens it and its goal card.
142
+ * A row goes when the PM writes in the conversation, starts a new /goal there, or after ROW_DAYS. */
143
+ const ROW_DAYS = 7;
144
+ const ROW_TITLE = { done: 'Check the goal Claude finished', waiting: 'Claude needs you on a goal', stopped: 'A goal stopped before it was done' };
145
+ function briefingRows(runtimeDir, now = Date.now()) {
146
+ let t; try { t = fs.readFileSync(path.join(runtimeDir, RUNS), 'utf8'); } catch { return []; }
147
+ const keys = new Set();
148
+ for (const l of t.split('\n')) { if (!l.trim()) continue; try { const e = JSON.parse(l); if (e && typeof e.key === 'string') keys.add(e.key); } catch { /* skip */ } }
149
+ const out = [];
150
+ for (const key of keys) {
151
+ const g = goalOf(runtimeDir, key);
152
+ if (!g || !g.draft || !ROW_TITLE[g.state] || g.seen) continue;
153
+ const at = Date.parse(g.at || '');
154
+ if (Number.isFinite(at) && now - at > ROW_DAYS * 86400000) continue;
155
+ const all = g.draft.done || [], met = (g.met || []).length;
156
+ const why = g.state === 'stopped' ? (REASON[g.reason] || 'It stopped.') : g.state === 'waiting' ? 'Claude asked you something in the conversation.' : 'Claude reports every done point met. It checked its own work.';
157
+ out.push({
158
+ kind: 'goal', key: 'goal:' + key, chatKey: key, title: ROW_TITLE[g.state], subject: clip(g.draft.goal, 90),
159
+ prepared: met + ' of ' + all.length + ' done points met, as Claude reports it. ' + why,
160
+ skip: g.state === 'waiting' ? 'If you skip: the goal waits and nothing more is done on it.' : 'If you skip: nobody checks the work before it is relied on.',
161
+ at,
162
+ dialog: {
163
+ eye: 'Goal', logTitle: 'Read from the goal record', log: ['Read goal-runs.jsonl in the state folder', 'Kept the latest state of this goal', 'Changed nothing'],
164
+ say: clip(g.draft.goal, 200) + ': ' + why, head: 'The goal',
165
+ facts: [['State', ROW_TITLE[g.state]], ['Done points', met + ' of ' + all.length + ' met, unverified'], ['By', g.draft.by], ['Rounds', String(g.rounds || 0)]].filter((x) => x[1]),
166
+ opts: [], sel: null, nodef: 'The goal card is in the conversation beside this. Write there to answer Claude or to go on.',
167
+ pane: { label: 'Goal', file: 'goal-runs.jsonl', h: clip(g.draft.goal, 90), intro: why, rows: all.map((x) => [(g.met || []).includes(x) ? 'Met' : 'Open', x]), paras: [] },
168
+ },
169
+ });
170
+ }
171
+ // the newest first, those that wait on the PM before the rest
172
+ return out.sort((a, b) => ((a.title === ROW_TITLE.waiting ? 0 : 1) - (b.title === ROW_TITLE.waiting ? 0 : 1)) || (b.at - a.at)).map(({ at, ...r }) => r);
173
+ }
174
+ /** The Briefing model with the goal rows first (U7). The rows already on the list follow; the count and the dock count them too. */
175
+ function withGoalRows(model, rows) {
176
+ if (!model || !model.list || !rows.length) return model;
177
+ const have = new Set((model.list.rows || []).map((r) => r.key));
178
+ const add = rows.filter((r) => !have.has(r.key));
179
+ if (!add.length) return model;
180
+ const list = add.concat(model.list.rows || []).map((r, k) => Object.assign({}, r, { n: k + 1, first: k === 0 }));
181
+ const count = (model.list.count || 0) + add.length;
182
+ return { ...model, list: { ...model.list, rows: list, count }, dock: model.dock && model.dock.needs != null ? { ...model.dock, needs: count, label: count === 1 ? 'needs you' : 'need you', next: list[0].title } : model.dock };
135
183
  }
136
184
  /** The Claude Code --settings for a chat session: one Stop hook that posts to this workspace with the session's token. */
137
185
  function hookSettings(port, host = '127.0.0.1') {
@@ -170,4 +218,4 @@ function decide({ runtimeDir, key, id, act, draft, session, sessions, now = new
170
218
  return { status: 200, body: { ok: true, id, state: act === 'start' ? 'started' : 'cancelled' } };
171
219
  }
172
220
 
173
- module.exports = { parseCommand, grillPrompt, startMessage, cancelMessage, cleanDraft, goalOf, begin, decide, onStop, resume, blockOf, keyOfSession, hookSettings, MARK, RUNS, LIMIT, NO_PROGRESS, REASON };
221
+ module.exports = { parseCommand, grillPrompt, startMessage, cancelMessage, cleanDraft, goalOf, begin, decide, onStop, resume, briefingRows, withGoalRows, blockOf, keyOfSession, hookSettings, MARK, RUNS, LIMIT, NO_PROGRESS, REASON };
@@ -140,6 +140,7 @@ module.exports = {
140
140
  const sources = await Src.readSources(ctx, Date.now()).catch(() => null);
141
141
  const agent = Drafts.readDrafts(sel.available);
142
142
  const r = await Prod.modelOfMany({ available: sel.available, engine: enginePath(), runtimeDir: ctx.runtimeDir, sources, agent });
143
+ if (r.model && ctx.runtimeDir) r.model = Goal.withGoalRows(r.model, Goal.briefingRows(ctx.runtimeDir)); // premium-chat-session U7: goals read live, not cached
143
144
  ctx.json(res, r.state === 'error' ? { ok: false, ...r } : { ok: true, ...r }, r.state === 'ready' ? 200 : r.state === 'reading' ? 202 : 500);
144
145
  return true;
145
146
  }
@@ -147,6 +148,7 @@ module.exports = {
147
148
  try { const w = ctx.getWs && ctx.getWs(url.searchParams.get('ws') || null); root = w && w.root; } catch { root = null; }
148
149
  root = root || path.resolve(__dirname, '..', '..');
149
150
  const r = await BP.modelOf({ root, engine: enginePath(), runtimeDir: ctx.runtimeDir });
151
+ if (r.model && ctx.runtimeDir) r.model = Goal.withGoalRows(r.model, Goal.briefingRows(ctx.runtimeDir));
150
152
  // 200 with the model, 202 while the first read goes on, 500 with the reason when a read failed
151
153
  ctx.json(res, r.state === 'error' ? { ok: false, ...r } : { ok: true, ...r }, r.state === 'ready' ? 200 : r.state === 'reading' ? 202 : 500);
152
154
  return true;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.339.0",
3
+ "version": "0.341.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.339.0",
9
+ "version": "0.341.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.339.0",
3
+ "version": "0.341.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",
@@ -0,0 +1,108 @@
1
+ /* chat-md — the premium chat panel's words as Claude Code shows them (PM, 2026-10-20: "Format the chat nicely"). Pure: no DOM, so Node tests it.
2
+ * Claude's turns are markdown: headings, **bold**, lists, `code`, fences, links, tables and quotes are drawn, not printed as their marks.
3
+ * Everything is escaped first and the marks are read from the escaped text, so no HTML in a message reaches the page. Links open only
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
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
6
+
7
+ /** One line's inline marks, on text that is already escaped: `code`, [links](https://…), bare URLs, **bold**, *italic*, ~~struck~~. */
8
+ function inline(t) {
9
+ const keep = [];
10
+ const hold = (h) => '\u0000' + (keep.push(h) - 1) + '\u0000';
11
+ let s = t.replace(/`([^`]+)`/g, (_, c) => hold(`<code>${c}</code>`));
12
+ s = s.replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g, (_, txt, u) => hold(`<a href="${u}" target="_blank" rel="noopener noreferrer">${txt}</a>`));
13
+ s = s.replace(/(^|[\s(])(https?:\/\/[^\s<]+[^\s<.,;:!?)])/g, (_, pre, u) => pre + hold(`<a href="${u}" target="_blank" rel="noopener noreferrer">${u}</a>`));
14
+ s = s.replace(/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g, '<strong>$2</strong>')
15
+ .replace(/(^|[^*\w])\*(?=\S)([^*]*?\S)\*(?!\*)/g, '$1<em>$2</em>')
16
+ .replace(/~~(?=\S)([\s\S]*?\S)~~/g, '<del>$1</del>');
17
+ return s.replace(/\u0000(\d+)\u0000/g, (_, i) => keep[+i]);
18
+ }
19
+ const cells = (l) => l.trim().replace(/^\|/, '').replace(/\|$/, '').split('|').map((c) => c.trim());
20
+ const isRule = (l) => l.includes('|') && /^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/.test(l);
21
+ const LI = /^(\s*)([-*+]|\d+[.)])\s+(.*)$/;
22
+
23
+ /** A list's items ({ ind, ord, html }) as nested <ul>/<ol>: a deeper item opens a list inside the item above it. */
24
+ function listHtml(items) {
25
+ let k = 0;
26
+ const level = (ind) => {
27
+ const ord = items[k].ord; let h = '';
28
+ while (k < items.length && items[k].ind >= ind) {
29
+ if (items[k].ind > ind) { h = h.replace(/<\/li>$/, '') + level(items[k].ind) + '</li>'; continue; }
30
+ if (items[k].ord !== ord) break;
31
+ h += items[k++].html + '</li>';
32
+ }
33
+ return (ord ? '<ol>' : '<ul>') + h + (ord ? '</ol>' : '</ul>');
34
+ };
35
+ let out = '';
36
+ while (k < items.length) out += level(items[k].ind);
37
+ return out;
38
+ }
39
+
40
+ /** Escaped lines as blocks. */
41
+ function blocks(lines) {
42
+ const out = [];
43
+ let para = [];
44
+ const flush = () => { if (para.length) { out.push(`<p>${para.map(inline).join('<br>')}</p>`); para = []; } };
45
+ for (let i = 0; i < lines.length; i++) {
46
+ const l = lines[i];
47
+ const fence = /^\s*(`{3,}|~{3,})\s*([\w+-]*)/.exec(l);
48
+ if (fence) {
49
+ flush();
50
+ const body = [];
51
+ for (i++; i < lines.length && !lines[i].trim().startsWith(fence[1]); i++) body.push(lines[i]);
52
+ out.push(`<pre${fence[2] ? ` data-lang="${fence[2]}"` : ''}><code>${body.join('\n')}</code></pre>`);
53
+ continue;
54
+ }
55
+ if (!l.trim()) { flush(); continue; }
56
+ const h = /^\s*(#{1,6})\s+(.*?)\s*#*\s*$/.exec(l);
57
+ if (h) { flush(); out.push(`<h${h[1].length > 3 ? 6 : h[1].length + 3}>${inline(h[2])}</h${h[1].length > 3 ? 6 : h[1].length + 3}>`); continue; }
58
+ if (/^\s*([-*_])(\s*\1){2,}\s*$/.test(l)) { flush(); out.push('<hr>'); continue; }
59
+ if (l.includes('|') && i + 1 < lines.length && isRule(lines[i + 1])) {
60
+ flush();
61
+ const head = cells(l), rows = [];
62
+ for (i += 2; i < lines.length && lines[i].includes('|') && lines[i].trim(); i++) rows.push(cells(lines[i]));
63
+ i--;
64
+ out.push(`<div class="mdtab"><table><thead><tr>${head.map((c) => `<th>${inline(c)}</th>`).join('')}</tr></thead><tbody>${rows.map((r) => `<tr>${head.map((_, c) => `<td>${inline(r[c] || '')}</td>`).join('')}</tr>`).join('')}</tbody></table></div>`);
65
+ continue;
66
+ }
67
+ if (/^\s*&gt;/.test(l)) {
68
+ flush();
69
+ const q = [];
70
+ for (; i < lines.length && /^\s*&gt;/.test(lines[i]); i++) q.push(lines[i].replace(/^\s*&gt;\s?/, ''));
71
+ i--;
72
+ out.push(`<blockquote>${blocks(q)}</blockquote>`);
73
+ continue;
74
+ }
75
+ if (LI.test(l)) {
76
+ flush();
77
+ const items = [];
78
+ for (; i < lines.length; i++) {
79
+ const m = LI.exec(lines[i]);
80
+ if (m) {
81
+ const task = /^\[([ xX])\]\s+(.*)$/.exec(m[3]);
82
+ items.push({ ind: m[1].replace(/\t/g, ' ').length, ord: /\d/.test(m[2]), html: task ? `<li class="task"><i class="${task[1] === ' ' ? 'n' : 'y'}" aria-hidden="true"></i>${inline(task[2])}` : `<li>${inline(m[3])}` });
83
+ } else if (lines[i].trim() && /^\s{2,}/.test(lines[i])) items[items.length - 1].html += '<br>' + inline(lines[i].trim()); // an indented line goes on with the item
84
+ else if (!lines[i].trim() && i + 1 < lines.length && LI.test(lines[i + 1])) continue; // a blank line between items keeps one list
85
+ else break;
86
+ }
87
+ i--;
88
+ out.push(listHtml(items));
89
+ continue;
90
+ }
91
+ para.push(l.trim());
92
+ }
93
+ flush();
94
+ return out.join('');
95
+ }
96
+
97
+ /** Claude's markdown as HTML for the panel, in one <div class="md">. */
98
+ export const mdHtml = (text) => `<div class="md">${blocks(esc(String(text == null ? '' : text).replace(/\r\n?/g, '\n')).split('\n'))}</div>`;
99
+
100
+ /** The PM's turn without Claude Code's paste wrapper tags; the pasted words stay. */
101
+ export const cleanUser = (text) => String(text == null ? '' : text).replace(/<\/?pasted_content\b[^>]*>/gi, '').replace(/\n{3,}/g, '\n\n').trim();
102
+ /** The PM's turn as bubble HTML: escaped, line breaks kept. */
103
+ export const userHtml = (text) => esc(cleanUser(text)).replace(/\n/g, '<br>');
104
+
105
+ /** A tool's short name: `mcp__claude_ai_Slack__slack_read_thread` and `claude_ai_Slack/slack_read_thread` both read `slack_read_thread`. */
106
+ export const toolName = (n) => String(n || '').split(/__|\//).filter(Boolean).pop() || String(n || '');
107
+ /** "Used Read ×2, slack_read_thread" for a run of tool calls. */
108
+ export const toolLine = (tools) => 'Used ' + Object.entries(tools || {}).map(([n, k]) => (k > 1 ? toolName(n) + ' ×' + k : toolName(n))).join(', ');
@@ -5,6 +5,7 @@ import { vwReset } from './premium-viewer.js';
5
5
  import { chipActs, openLive, openFocus, mountRecord, HL_LINE } from './premium-vw-rec.js';
6
6
  import { lineItems, behindOf, refreshTargets, whenRead } from './freshness-words.js';
7
7
  import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, slashMatches } from './goal-chat.js';
8
+ import { mdHtml, userHtml, toolLine } from './chat-md.js';
8
9
  export const $ = (s, r = document) => r.querySelector(s);
9
10
  export const $$ = (s, r = document) => [...r.querySelectorAll(s)];
10
11
  export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
@@ -233,15 +234,14 @@ export const turnU = (t) => `<div class="turn u"><div class="ub">${esc(t)}</div>
233
234
  * own transcript (GET /api/sessions/conversation), as the console's session conversation reads them. Earlier read-only answers stay above. */
234
235
  const CHAT_NOTE = 'This is a Claude Code session. It can change files and run commands, and asks first where your Claude Code settings say so.';
235
236
  const turnAgent = (h) => `<div class="turn a"><i class="av">${AI}</i><div class="tc">${h}</div></div>`;
236
- const paras = (t) => String(t).split(/\n{2,}/).map((x) => `<p class="tt">${esc(x.trim()).replace(/\n/g, '<br>')}</p>`).join('');
237
+ const turnUser = (t) => `<div class="turn u"><div class="ub">${userHtml(t)}</div></div>`; // the PM's words, paste tags gone, line breaks kept
237
238
  export function threadHtml(th) {
238
- return (th.turns || []).map((t) => turnU(t.q) + (t.state === 'answered'
239
- ? turnAgent(`<p class="agtag">Earlier read-only answer</p>${paras(t.a)}`)
239
+ return (th.turns || []).map((t) => turnUser(t.q) + (t.state === 'answered'
240
+ ? turnAgent(`<p class="agtag">Earlier read-only answer</p>${mdHtml(t.a)}`)
240
241
  : t.state === 'failed' ? turnAgent(`<p class="tt err" role="alert">The agent did not answer. ${esc(t.error || '')}</p>`)
241
242
  : turnAgent(`<p class="tt" role="status">The agent is reading the records. Nothing is promised about how long this takes.</p>`))).join('');
242
243
  }
243
- /** "Used Read ×2, Edit" for a run of tool calls, as the console's conversation says it. */
244
- export const toolLine = (tools) => 'Used ' + Object.entries(tools || {}).map(([n, k]) => (k > 1 ? n + ' ×' + k : n)).join(', ');
244
+ export { toolLine }; // "Used Read ×2, slack_read_thread": chat-md.js shortens a connector tool's long name
245
245
  /** The session's part of the panel: its turns, the permission question with its options, and Stop while Claude works. Pure, for Node. */
246
246
  /** goal: the key's /goal record (GET /thread), so the newest grilling message can be pressed (slice 2, PRD G4, G5). */
247
247
  export function sessionHtml(c, goal = null) {
@@ -251,11 +251,11 @@ export function sessionHtml(c, goal = null) {
251
251
  const msgs = c.messages || [], last = msgs.length - 1;
252
252
  const waiting = !c.ask && c.turn !== 'agent' && c.turn !== 'tool';
253
253
  const out = msgs.map((m, i) => {
254
- if (m.role === 'user') return turnU(shownUser(m.text));
254
+ if (m.role === 'user') return turnUser(shownUser(m.text));
255
255
  if (m.role !== 'assistant') return `<p class="toolline" title="${esc((m.calls || []).map((x) => x.tool + (x.target ? ' ' + x.target : '')).join('\n'))}">${esc(toolLine(m.tools))}</p>`;
256
256
  const g = splitGoal(m.text);
257
257
  const live = i === last && waiting && !!goal && goal.state === 'grilling';
258
- return turnAgent(`<p class="agtag">Claude</p>${g.text ? paras(g.text) : ''}${goalBlockHtml(g.block, { live, state: goal && goal.state })}`);
258
+ return turnAgent(`<p class="agtag">Claude</p>${g.text ? mdHtml(g.text) : ''}${goalBlockHtml(g.block, { live, state: goal && goal.state })}`);
259
259
  });
260
260
  const gp = goalProgressHtml(goal); if (gp) out.push(gp);
261
261
  if (c.ask) out.push(turnAgent(`<p class="agtag">Claude asks before it goes on</p><p class="tt">${esc(c.ask.question)}</p><div class="chatopts">${(c.ask.options || []).map((o) => `<button type="button" class="cta alt" data-chat-press="${esc(o.n)}">${esc(o.label)}</button>`).join('')}</div>`));
@@ -2163,3 +2163,34 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
2163
2163
  .gpts i{width:10px;height:10px;border-radius:50%;box-shadow:inset 0 0 0 1.5px var(--ink-3)}
2164
2164
  .gpts li.m i{background:var(--ok);box-shadow:none}
2165
2165
  .gpts em{font-style:normal;color:var(--ink-3);font-size:var(--t-micro)}
2166
+ /* the chat panel's words drawn as Claude Code draws them (chat-md.js): markdown with room to read, the PM's paste without its tags, quiet tool lines */
2167
+ .md{font-size:var(--fs-3);line-height:1.6;color:var(--ink);max-width:64ch;overflow-wrap:anywhere}
2168
+ .md>:first-child{margin-top:0}.md>:last-child{margin-bottom:0}
2169
+ .md p{margin:0 0 10px}
2170
+ .md h4,.md h5,.md h6{margin:18px 0 6px;line-height:1.35;font-weight:600}
2171
+ .md h4{font-size:var(--fs-4)}.md h5{font-size:var(--fs-3)}
2172
+ .md h6{font:600 var(--fs-2) var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--ink-2)}
2173
+ .md strong{font-weight:600}
2174
+ .md ul,.md ol{margin:0 0 10px;padding-left:20px}
2175
+ .md li{margin:0 0 5px;padding-left:2px}
2176
+ .md li>ul,.md li>ol{margin:5px 0 0}
2177
+ .md li::marker{color:var(--ink-3)}
2178
+ .md ol>li::marker{font:500 var(--fs-2) var(--mono)}
2179
+ .md li.task{list-style:none;margin-left:-20px;display:flex;gap:8px;align-items:baseline}
2180
+ .md li.task i{flex:none;width:12px;height:12px;border-radius:4px;box-shadow:inset 0 0 0 1.5px var(--ink-3);transform:translateY(1px)}
2181
+ .md li.task i.y{background:var(--ok);box-shadow:none}
2182
+ .md code{font:400 .9em var(--mono);background:var(--well);padding:1px 5px;border-radius:6px}
2183
+ .md pre{margin:0 0 12px;background:var(--well);border-radius:12px;padding:12px 14px;overflow-x:auto;max-width:100%}
2184
+ .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
+ .md a{color:var(--ember-ink);text-decoration:underline;text-underline-offset:2px}
2186
+ .md blockquote{margin:0 0 10px;padding:2px 0 2px 12px;border-left:2px solid var(--hair);color:var(--ink-2)}
2187
+ .md hr{border:0;border-top:1px solid var(--hair);margin:14px 0}
2188
+ .mdtab{margin:0 0 12px;overflow-x:auto;border:1px solid var(--hair);border-radius:12px}
2189
+ .mdtab table{border-collapse:collapse;width:100%;font-size:var(--fs-2)}
2190
+ .mdtab th,.mdtab td{padding:7px 10px;text-align:left;vertical-align:top;border-bottom:1px solid var(--hair);overflow-wrap:normal}
2191
+ .mdtab th{font-weight:600;background:var(--well)}
2192
+ .mdtab tr:last-child td{border-bottom:0}
2193
+ .agtag+.md{margin-top:2px}
2194
+ .ub{white-space:normal}
2195
+ .toolline{display:block;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font:400 var(--fs-1) var(--mono);color:var(--ink-3);opacity:.85}
2196
+ .toolline::before{content:"";display:inline-block;vertical-align:middle;margin:0 8px 2px 0;width:6px;height:6px;border-radius:50%;background:var(--ink-3);opacity:.6}
@@ -228,9 +228,9 @@ function openRow(r) {
228
228
  if (!r) return;
229
229
  if (!r.dialog) r = { ...r, dialog: r.src ? consoleDialog(r) : plainDialog(r) };
230
230
  openR = r; const d = r.dialog;
231
- openDlg({ eye: d.eye + ' · real data', title: d.title || r.title, sub: d.sub || r.subject, say: d.say, stream: turnA(logHtml(d)) + turnA(ptx(d.say)) + cardHtml(r), noteKey: r.key, pane: paneHtml(r), label: d.pane.label });
231
+ openDlg({ eye: d.eye + ' · real data', title: d.title || r.title, sub: d.sub || r.subject, say: d.say, stream: turnA(logHtml(d)) + turnA(ptx(d.say)) + cardHtml(r), noteKey: r.chatKey || r.key, pane: paneHtml(r), label: d.pane.label }); // a goal row (premium-chat-session U7) opens its own conversation
232
232
  ctaState(r);
233
- if (r.dialog.noAsk) { $('#askF').hidden = true; $('#askNote').hidden = true; } else loadThread(r.key); // the read-only agent answers about the model's rows only
233
+ if (r.dialog.noAsk) { $('#askF').hidden = true; $('#askNote').hidden = true; } else loadThread(r.chatKey || r.key); // the read-only agent answers about the model's rows only
234
234
  setTimeout(() => { const b = $('#dBody'); b.scrollTop = b.scrollHeight; }, 120);
235
235
  }
236
236
  function showErr(msg) { const e = $('#cardErr'); if (!e) { toast(msg); return; } e.textContent = msg; e.hidden = false; }
@@ -39,6 +39,7 @@
39
39
  "briefing-premium-writes.test.js",
40
40
  "briefing-premium-agent.test.js",
41
41
  "goal-chat.test.js",
42
+ "chat-md.test.js",
42
43
  "briefing-premium-work.test.js",
43
44
  "briefing-premium-board.test.js",
44
45
  "briefing-premium-insights.test.js",
@@ -212,6 +213,7 @@
212
213
  "briefing-premium-writes.test.js": 1,
213
214
  "briefing-premium-agent.test.js": 1,
214
215
  "goal-chat.test.js": 1,
216
+ "chat-md.test.js": 1,
215
217
  "briefing-premium-work.test.js": 1,
216
218
  "briefing-premium-board.test.js": 1,
217
219
  "briefing-premium-insights.test.js": 1,