create-pmos 0.379.0 → 0.380.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.379.0",
3
+ "version": "0.380.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -32,6 +32,18 @@
32
32
  "audit"
33
33
  ],
34
34
  "pmosChanges": [
35
+ {
36
+ "v": "0.380.0",
37
+ "at": "2026-10-21T09:18:41.886Z",
38
+ "f": 2,
39
+ "prs": [
40
+ {
41
+ "n": 989,
42
+ "t": "The /goal card opens in the viewer as a Goal tab",
43
+ "s": "The /goal card opens in the viewer as a Goal tab"
44
+ }
45
+ ]
46
+ },
35
47
  {
36
48
  "v": "0.379.0",
37
49
  "at": "2026-10-21T08:59:34.421Z",
@@ -309,18 +321,6 @@
309
321
  "s": "PMOS reads the pane after it presses Enter."
310
322
  }
311
323
  ]
312
- },
313
- {
314
- "v": "0.360.0",
315
- "at": "2026-10-20T13:51:06.028Z",
316
- "f": 2,
317
- "prs": [
318
- {
319
- "n": 959,
320
- "t": "The Work queue has no Agents tab; agent state is a chip on the row and drafts wait in the bell",
321
- "s": "There is no Agents tab."
322
- }
323
- ]
324
324
  }
325
325
  ]
326
326
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@6bbfa917
1
+ kernel-source: pmos@61c8ea33
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-21T08:59:30Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-21T09:18:37Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-10-21T08:59:30Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-21T09:18:37Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-10-21T08:59:30Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-21T09:18:37Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,16 @@
1
1
  [
2
+ {
3
+ "v": "0.380.0",
4
+ "at": "2026-10-21T09:18:41.886Z",
5
+ "f": 2,
6
+ "prs": [
7
+ {
8
+ "n": 989,
9
+ "t": "The /goal card opens in the viewer as a Goal tab",
10
+ "s": "The /goal card opens in the viewer as a Goal tab"
11
+ }
12
+ ]
13
+ },
2
14
  {
3
15
  "v": "0.379.0",
4
16
  "at": "2026-10-21T08:59:34.421Z",
@@ -461,12 +461,14 @@ Type `/` in the box to see the commands: `/goal`, `/compact` and `/clear`. Use t
461
461
 
462
462
  - **`/goal <what you want>`** asks Claude to make the goal SMART before any work. Claude reads the records first, then asks only what it could not find out: at most 5 questions, one at a time, about how you will know it is done, by when, whether it can be done here, and what it serves.
463
463
  - **Each question** shows its answers as buttons, with the recommended one marked. Press one, or answer in your own words. **Start with defaults** stops the questions; a value you did not give is marked "assumed".
464
- - **The goal card** shows the goal, its done points, what Claude may do, what it serves, the deadline and the round limit. Nothing runs until you press **Start**. **Change something** lets you say what to change; **Cancel** drops the goal.
464
+ - **The goal card** is in the viewer, in a **Goal** tab, like Notes. The conversation shows only a small Goal chip with the goal's state; press it to open the tab. On a phone the tab covers the page, and **Back** returns to the conversation.
465
+ - **The card** shows the goal, its done points, what Claude may do, what it serves, the deadline and the round limit. Nothing runs until you press **Start** (under Claude's message or in the Goal tab). **Change something** lets you say what to change; **Cancel** drops the goal.
465
466
  - **Start** tells Claude to work on the goal until every done point is met. Merging follows your standing rule (merge once required CI is green). Claude asks before anything that is sent to other people.
466
467
 
467
- - **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.
468
+ - **While it works**, the Goal tab shows the round, each done point met or open, and the deadline. The points are Claude's own report, so the card says "unverified". Each time Claude would stop with a point still open, it is told to keep going.
468
469
  - **It stops by itself** when Claude reports every point met (Done), when it needs you (Needs you: answer it in the box and it goes on), at the deadline, after the round limit (12 unless the goal says fewer), or after 3 rounds that met no new point. The card says which.
469
- - **Stop the goal** presses Esc in the session and ends the goal.
470
+ - **When the goal changes** (it starts, a point is met, it stops, it needs you, it is done), the Goal tab opens by itself on a desktop. On a phone a bar over the box offers it, so the conversation stays in view.
471
+ - **Stop the goal** is in the Goal tab. It presses Esc in the session and ends the goal.
470
472
  - **In the bell**, a goal that is done, stopped or needs you is an item. Pressing it opens the goal's own conversation. The item goes when you write in that conversation, or after a week.
471
473
 
472
474
  Start, Cancel and Stop need the page's launch nonce too. The goal and each round are kept in `goal-runs.jsonl` in the state folder.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.379.0",
3
+ "version": "0.380.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.379.0",
9
+ "version": "0.380.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.379.0",
3
+ "version": "0.380.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,126 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* premium-chat-goal-view-test.js — the /goal card lives in the viewer, not in the conversation (initiative premium-chat-session, goal in the viewer).
4
+ * A real server on a scratch repository (c3-scan-fixture.js); the thread and the session's conversation are routed, so the goal's state is set here.
5
+ * G1 at 1280 a stopped goal draws no card in the conversation, only a small Goal chip; the chip opens a Goal tab with the card
6
+ * G2 a goal that changes state opens the Goal tab by itself on a desktop, and the open tab follows the next change
7
+ * G3 a ready goal: the conversation shows only the chip; the plan, SMART and Start / Change / Cancel are in the Goal tab
8
+ * G4 Stop the goal is in the Goal tab and reaches the server
9
+ * G5 at 390 the chip covers the page with the Goal tab and Back; a change offers the goal in the bar over the box
10
+ * Set GOAL_VIEW_SHOTS=<dir> to save the page at 1280 and 390, light and dark. */
11
+ const { findBrowser } = require('./lib/find-browser');
12
+ require('./test-run').configure({ name: 'premium-chat-goal-view' });
13
+ const Fx = require('./c3-scan-fixture.js');
14
+
15
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
16
+ const until = async (fn, ms = 8000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
17
+ const results = [];
18
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
19
+ let F = null, browser = null;
20
+ const finish = async (code) => {
21
+ if (browser) await browser.close().catch(() => {});
22
+ if (F) F.stop();
23
+ const bad = results.filter((x) => !x.cond).length;
24
+ console.log(`\n${results.length - bad}/${results.length} premium-chat-goal-view assertions passed`);
25
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
26
+ };
27
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
28
+
29
+ const DRAFT = {
30
+ goal: 'Enrich the Lightbox password sign-up and login reports with drop reasons, per-step durations and segments, for yesterday',
31
+ done: ['Tables for durations, anomalies and segments exist for yesterday', 'Each drop has a reason label inferred from the events', 'Totals match GA4 Explore counts for yesterday'],
32
+ may: 'Read BigQuery and write to the reports folder', serves: 'q4:o1:kr2', by: '2026-10-22 17:00', limit: 12, assumed: ['by'],
33
+ };
34
+ const READY = 'The goal is clear. Press Start when it reads right.\n\n```pmos-goal\n' + JSON.stringify({ step: 'ready', draft: DRAFT }) + '\n```';
35
+ const goalOf = (state, extra = {}) => ({ id: 'g1', state, draft: DRAFT, met: [], rounds: 2, ...extra });
36
+
37
+ /* the page's own state */
38
+ const look = () => {
39
+ const g = document.querySelector('#dlg'), out = document.querySelector('#dOut').getBoundingClientRect(), gp = document.querySelector('#dOut .obody.vw[data-vw="goal"]');
40
+ const peek = document.querySelector('#ctxPeek');
41
+ return { shut: g.classList.contains('vw-shut'), layer: g.classList.contains('vw-layer'), out: Math.round(out.width), outH: Math.round(out.height), vh: innerHeight,
42
+ cardInChat: !!document.querySelector('#dBody .gcard'), chip: (document.querySelector('#dBody [data-goal-open]') || {}).textContent || null,
43
+ smart: !!document.querySelector('#dBody .smart'), start: !!document.querySelector('#dBody [data-goal="start"]'),
44
+ tabs: [...document.querySelectorAll('#vTabs .vtab')].map((t) => t.textContent.trim()), on: (document.querySelector('#vTabs .vtab[aria-selected="true"]') || {}).textContent || null,
45
+ pane: gp && !gp.hidden ? gp.textContent.replace(/\s+/g, ' ').trim() : null, stop: !!document.querySelector('#dOut [data-goal="stop"]'),
46
+ peek: peek && !peek.hidden ? peek.textContent.trim() : null, back: !!document.querySelector('#vBack') && getComputedStyle(document.querySelector('#vBack')).display !== 'none',
47
+ railOff: getComputedStyle(document.querySelector('.rail')).opacity === '0', wide: document.documentElement.scrollWidth > innerWidth + 1 };
48
+ };
49
+
50
+ (async () => {
51
+ const exe = findBrowser();
52
+ if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
53
+ let chromium;
54
+ try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
55
+ F = await Fx.start({ name: 'premium-chat-goal-view' });
56
+ browser = await chromium.launch({ executablePath: exe, headless: true, args: ['--no-sandbox'] });
57
+ const shots = process.env.GOAL_VIEW_SHOTS;
58
+ const chat = `${F.BASE}/premium-chat.html?ws=${encodeURIComponent(F.ws)}`;
59
+ const open = async (width, scheme, first) => {
60
+ const st = { goal: first.goal, messages: first.messages, posts: [] };
61
+ const ctx = await browser.newContext({ viewport: { width, height: width < 1000 ? 844 : 800 }, colorScheme: scheme, hasTouch: width < 1000 });
62
+ const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
63
+ await p.route('**/api/briefing-premium/thread?**', (r) => r.fulfill({ json: { ok: true, turns: [], session: 's-goal', goal: st.goal } }));
64
+ await p.route('**/api/sessions/conversation?**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'pm', messages: st.messages } }));
65
+ await p.route('**/api/briefing-premium/goal**', (r) => { st.posts.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ json: { ok: true } }); });
66
+ await p.goto(chat);
67
+ await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream #thr')));
68
+ await sleep(400);
69
+ return { p, ctx, errs, st };
70
+ };
71
+ const working = [{ role: 'user', text: '[PMOS /goal start] Start the goal' }, { role: 'tool', tools: { execute_sql_readonly: 1, get_query_results: 1 }, calls: [] }, { role: 'assistant', text: 'Round two: the duration table is written; the reason labels are next.' }];
72
+
73
+ { const { p, ctx, errs, st } = await open(1280, 'light', { goal: goalOf('stopped', { reason: 'pm' }), messages: working });
74
+ const s0 = await p.evaluate(look);
75
+ ok('G1 at 1280 a stopped goal draws no card in the conversation, only a small Goal chip', !s0.cardInChat && /Stopped/.test(s0.chip || '') && /0 of 3/.test(s0.chip || ''), JSON.stringify(s0));
76
+ ok('G1 opening the chat with a goal opens nothing by itself', s0.shut && s0.tabs.length === 0, JSON.stringify(s0));
77
+ if (shots) await p.screenshot({ path: `${shots}/chip-1280-light.png` });
78
+ await p.click('#dBody [data-goal-open]');
79
+ const s1 = await until(async () => { const v = await p.evaluate(look); return !v.shut && v.pane ? v : null; }) || await p.evaluate(look);
80
+ ok('G1 the chip opens a Goal tab with the goal, its done points and why it stopped', /Goal/.test(s1.on || '') && /Stopped/.test(s1.pane || '') && /0 of 3 done points met/.test(s1.pane || '') && /Totals match GA4/.test(s1.pane || '') && /You stopped it/.test(s1.pane || ''), JSON.stringify(s1));
81
+ await p.click('#vTabs [data-vx]'); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('vw-shut')));
82
+ st.goal = goalOf('started', { met: [DRAFT.done[0]] });
83
+ const s2 = await until(async () => { const v = await p.evaluate(look); return v.pane && /round 3/.test(v.pane) ? v : null; }) || await p.evaluate(look);
84
+ ok('G2 a goal that changes state opens the Goal tab by itself', !s2.shut && /Goal/.test(s2.on || '') && /1 of 3 done points met/.test(s2.pane || ''), JSON.stringify(s2));
85
+ ok('G4 Stop the goal is in the Goal tab, not in the conversation', s2.stop && !(await p.evaluate(() => !!document.querySelector('#dBody [data-goal="stop"]'))), JSON.stringify(s2));
86
+ if (shots) await p.screenshot({ path: `${shots}/goal-1280-light.png` });
87
+ await p.click('#dOut [data-goal="stop"]');
88
+ const posted = await until(() => st.posts.find((x) => x.act === 'stop'));
89
+ ok('G4 Stop reaches the server for this goal', posted && posted.id === 'g1', JSON.stringify(st.posts));
90
+ st.goal = goalOf('done', { met: DRAFT.done });
91
+ const s3 = await until(async () => { const v = await p.evaluate(look); return v.pane && /Done, as Claude reports it/.test(v.pane) ? v : null; }) || await p.evaluate(look);
92
+ ok('G2 the open Goal tab follows the next change', /3 of 3 done points met/.test(s3.pane || '') && !s3.stop, JSON.stringify(s3));
93
+ ok('F1 no page error and no sideways scroll', !errs.length && !s3.wide, errs.join(' | '));
94
+ await ctx.close(); }
95
+
96
+ { const { p, ctx, errs, st } = await open(1280, 'dark', { goal: goalOf('grilling'), messages: [{ role: 'user', text: '[PMOS /goal] The PM set a goal: Enrich the Lightbox reports\n' }, { role: 'assistant', text: READY }] });
97
+ const s0 = await p.evaluate(look);
98
+ ok('G3 a ready goal is one chip in the conversation: no card, no SMART row, no buttons', !s0.smart && !s0.start && !s0.cardInChat && /Not started/.test(s0.chip || ''), JSON.stringify(s0));
99
+ await p.click('#dBody [data-goal-open]');
100
+ const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane ? v : null; }) || await p.evaluate(look);
101
+ ok('G3 the Goal tab shows the plan: done when, may, serves, by', /Done when/.test(s1.pane || '') && /It may/.test(s1.pane || '') && /Serves/.test(s1.pane || '') && /Not started/.test(s1.pane || ''), JSON.stringify(s1));
102
+ await p.click('#dOut [data-goal="start"]');
103
+ const sent = await until(() => st.posts.find((x) => x.act === 'start'));
104
+ ok('G3 Start in the Goal tab sends the ready draft for this goal', sent && sent.id === 'g1' && sent.draft && sent.draft.goal === DRAFT.goal, JSON.stringify(st.posts));
105
+ if (shots) await p.screenshot({ path: `${shots}/ready-1280-dark.png` });
106
+ ok('F1 (dark) no page error and no sideways scroll', !errs.length && !s1.wide, errs.join(' | '));
107
+ await ctx.close(); }
108
+
109
+ for (const scheme of ['light', 'dark']) {
110
+ const { p, ctx, errs, st } = await open(390, scheme, { goal: goalOf('started', { met: [DRAFT.done[0]] }), messages: working });
111
+ const s0 = await p.evaluate(look);
112
+ ok(`G5 (${scheme}) at 390 the conversation shows the chip, not the card`, !s0.cardInChat && /Working/.test(s0.chip || '') && !s0.layer, JSON.stringify(s0));
113
+ if (shots) await p.screenshot({ path: `${shots}/chip-390-${scheme}.png` });
114
+ await p.click('#dBody [data-goal-open]');
115
+ const s1 = await until(async () => { const v = await p.evaluate(look); return v.layer && v.pane && v.outH >= v.vh - 2 && v.railOff ? v : null; }) || await p.evaluate(look);
116
+ ok(`G5 (${scheme}) the chip covers the page with the Goal tab and Back`, s1.layer && s1.back && /1 of 3 done points met/.test(s1.pane || '') && s1.outH >= s1.vh - 2, JSON.stringify(s1));
117
+ if (shots) await p.screenshot({ path: `${shots}/goal-390-${scheme}.png` });
118
+ await p.click('#vBack'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('vw-layer')));
119
+ st.goal = goalOf('waiting', { met: [DRAFT.done[0]] });
120
+ const s2 = await until(async () => { const v = await p.evaluate(look); return v.peek ? v : null; }) || await p.evaluate(look);
121
+ ok(`G5 (${scheme}) a change offers the goal in the bar over the box, without covering the conversation`, /Needs you/.test(s2.peek || '') && !s2.layer, JSON.stringify(s2));
122
+ ok(`F1 (${scheme}) no page error and no sideways scroll at 390`, !errs.length && !s2.wide, errs.join(' | '));
123
+ await ctx.close();
124
+ }
125
+ return finish();
126
+ })();
@@ -62,9 +62,8 @@ export function goalBlockHtml(block, { live = false, state = 'grilling' } = {})
62
62
  return `${smartHtml(d)}<p class="tt"><b>${esc(block.question || '')}</b></p>${chips}`;
63
63
  }
64
64
  if (block.step === 'ready') {
65
- const ok = !!(d.goal && Array.isArray(d.done) && d.done.length);
66
- const btns = live && ok ? '<div class="chatopts"><button type="button" class="cta" data-goal="start">Start</button><button type="button" class="cta alt" data-goal="change">Change something</button><button type="button" class="cta alt" data-goal="cancel">Cancel</button></div>' : '';
67
- return `${smartHtml(d)}${goalCard(d, state)}${btns}`;
65
+ // the plan, SMART and Start / Change / Cancel are in the viewer's Goal tab (goalViewHtml); once started, the progress chip at the end stands for it
66
+ return !state || state === 'grilling' || state === 'cancelled' ? goalChipHtml({ draft: d, state }) : '';
68
67
  }
69
68
  if (block.step === 'progress') {
70
69
  const met = Array.isArray(block.met) ? block.met.length : 0, open = Array.isArray(block.open) ? block.open.length : 0;
@@ -75,6 +74,36 @@ export function goalBlockHtml(block, { live = false, state = 'grilling' } = {})
75
74
  }
76
75
 
77
76
  const WHY = { deadline: 'The deadline has passed.', limit: 'It used all its rounds.', 'no-progress': 'Three rounds in a row met no new done point.', pm: 'You stopped it.' };
77
+ const GICO = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8"/></svg>';
78
+ /** What the chip under the goal says: its state, then the done points met once it has started. */
79
+ function goalLine(goal) {
80
+ const d = goal.draft || {}, all = Array.isArray(d.done) ? d.done.length : 0, met = Array.isArray(goal.met) ? goal.met.length : 0;
81
+ const word = { started: 'Working', done: 'Done', waiting: 'Needs you', stopped: 'Stopped', cancelled: 'Cancelled' }[goal.state] || 'Not started';
82
+ return ['started', 'done', 'waiting', 'stopped'].includes(goal.state) ? `${word} · ${met} of ${all} done points` : word + (all ? ` · ${all} done points` : '');
83
+ }
84
+ /** The goal in the conversation is one small chip (goal in the viewer, Wawan 2026-10-21): the plan and its progress open in the viewer's Goal tab.
85
+ * goal: { draft, state, met? }. */
86
+ export function goalChipHtml(goal) {
87
+ if (!goal || !goal.draft) return '';
88
+ return `<div class="ctxc"><button type="button" class="ctxchip lead" data-goal-open title="Open the goal in the viewer">${GICO}<span><b>${esc(goal.draft.goal || 'Goal')}</b><em>Goal · ${esc(goalLine(goal))}</em></span></button></div>`;
89
+ }
90
+ /** The viewer's Goal tab. goal: the GET /thread goal record; draft: the newest ready draft in the conversation; live: Start can be pressed.
91
+ * A goal that has started shows its progress with Stop; one still being grilled shows the plan, with Start, Change and Cancel while live. */
92
+ export function goalViewHtml(goal, draft, { live = false } = {}) {
93
+ const gp = goalProgressHtml(goal);
94
+ if (gp) return `<div class="vwdoc vwgoal">${gp}</div>`;
95
+ if (!draft) return '';
96
+ const ok = !!(draft.goal && Array.isArray(draft.done) && draft.done.length);
97
+ const btns = live && ok ? '<div class="chatopts"><button type="button" class="cta" data-goal="start">Start</button><button type="button" class="cta alt" data-goal="change">Change something</button><button type="button" class="cta alt" data-goal="cancel">Cancel</button></div>' : '';
98
+ return `<div class="vwdoc vwgoal">${smartHtml(draft)}${goalCard(draft, goal && goal.state)}${btns}</div>`;
99
+ }
100
+ /** What the chip and the peek bar say about the goal now, and a key that changes when its state or progress does. */
101
+ export function goalNow(goal, draft) {
102
+ const g = goal && goal.draft ? goal : draft ? { draft, state: goal ? goal.state : 'grilling' } : null;
103
+ if (!g) return null;
104
+ return { title: g.draft.goal || 'Goal', sub: 'Goal · ' + goalLine(g), sig: [goal && goal.id, g.state, (goal && goal.met || []).length, goal && goal.rounds, draft ? JSON.stringify(draft) : ''].join('|') };
105
+ }
106
+
78
107
  /** The working goal's card (slice 3, PRD U4, U5): its state, the round, each done point met or open, and Stop while it works.
79
108
  * goal: the GET /thread goal record. The done check is Claude's own report, so it says "unverified". */
80
109
  export function goalProgressHtml(goal) {
@@ -1,13 +1,13 @@
1
1
  /* pm/premium-shell.js — what the premium Briefing and My work pages share: the theme, the toast, the standard dialog and the read-only agent's conversation (initiatives briefing-premium and my-work-premium). */
2
2
  import { pmGet, pmPost } from './http.js';
3
3
  import { recChipView, STOP_LINE } from './premium-meeting.js';
4
- import { vwReset, vwOn, vwCount } from './premium-viewer.js';
4
+ import { vwReset, vwOn, vwCount, vwOpen, vwStyle } from './premium-viewer.js';
5
5
  import { openChatFile, openWebLink } from './premium-vw-file.js';
6
6
  import { turnsOf } from './chat-context.js';
7
7
  import { chipsHtml, itemOf, openCtx } from './premium-vw-ctx.js';
8
8
  import { chipActs, openLive, openFocus, mountRecord, HL_LINE } from './premium-vw-rec.js';
9
9
  import { lineItems, behindOf, whenRead } from './freshness-words.js';
10
- import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, slashMatches } from './goal-chat.js';
10
+ import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, goalChipHtml, goalViewHtml, goalNow, slashMatches } from './goal-chat.js';
11
11
  import { mdHtml, userHtml, toolLine, webKind } from './chat-md.js';
12
12
  import { mountNotes, openNotes, flushNotes, syncNotes } from './premium-notes.js';
13
13
  import { attachMarkup, attachRowMarkup, mountAttach, attachNames, clearAttach, syncAttach, dropFiles, splitFiles, filesHtml, openAttachment } from './premium-attach.js';
@@ -414,7 +414,7 @@ export function sessionHtml(c, goal = null) {
414
414
  const live = i === last && waiting && !!goal && goal.state === 'grilling';
415
415
  return turnAgent(`<p class="agtag">Claude</p>${g.text ? mdHtml(g.text) : ''}${goalBlockHtml(g.block, { live, state: goal && goal.state })}${chipsHtml(ctx.get(i))}`);
416
416
  });
417
- const gp = goalProgressHtml(goal); if (gp) out.push(gp);
417
+ if (goalProgressHtml(goal)) out.push(goalChipHtml(goal)); // the goal itself is in the viewer's Goal tab (goalView below)
418
418
  // item-chat-history: an ended session keeps its conversation on the item; the next message picks it up
419
419
  if (c.state === 'ended') out.push(turnAgent('<p class="tt" role="status">This session has ended. Your conversation is kept here, and your next message picks it up.</p>'));
420
420
  else 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>`));
@@ -440,6 +440,7 @@ export function drawThread(th, key, conv) {
440
440
  putHtml(t, threadHtml(th) + sessionHtml(conv, th.goal));
441
441
  ctxAuto(key, conv);
442
442
  S.goal = th.goal || null; S.draft = readyDraft(conv); S.session = th.session || null;
443
+ goalView(key, conv);
443
444
  const go = $('#askGo'); if (go) go.disabled = !!th.working; // an earlier read-only run still answering
444
445
  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;
445
446
  if (atEnd) b.scrollTop = b.scrollHeight;
@@ -480,7 +481,7 @@ function ctxPeek(it) {
480
481
  const f = $('#askF'); if (!f) return;
481
482
  if (!b) { f.insertAdjacentHTML('beforebegin', '<button type="button" class="ctxpeek" id="ctxPeek" hidden></button>'); b = $('#ctxPeek'); }
482
483
  b.innerHTML = `<span>${esc(it.sub)} · <b>${esc(it.title)}</b></span><em>View</em>`; b.hidden = false;
483
- b.onclick = () => { ctxPeek(null); openCtx(it, ctxWhere()); };
484
+ b.onclick = () => { ctxPeek(null); if (it.kind === 'goal') openGoal(); else openCtx(it, ctxWhere()); };
484
485
  CTX.peekTimer = setTimeout(() => ctxPeek(null), 15000);
485
486
  }
486
487
  $('#dBody').addEventListener('click', (e) => {
@@ -488,6 +489,32 @@ $('#dBody').addEventListener('click', (e) => {
488
489
  e.preventDefault(); openCtx(itemOf(b), ctxWhere());
489
490
  if (innerWidth < 1000 && !chatPage()) setTab('out');
490
491
  });
492
+ /* The /goal card lives in the viewer as a Goal tab, like Notes (Wawan 2026-10-21); the conversation keeps a small chip that opens it.
493
+ * An open tab follows every change. A change of the goal's state or progress while the chat is open opens the tab by itself on a desktop
494
+ * and offers it in the bar over the box on a phone; a goal that was already there when the chat opened opens nothing. */
495
+ const GV = { key: null, sig: null };
496
+ const goalLive = (conv) => !!S.goal && S.goal.state === 'grilling' && !!conv && !conv.ask && conv.turn !== 'agent' && conv.turn !== 'tool';
497
+ const goalPane = () => document.querySelector('#dOut .obody.vw[data-vw="goal"]');
498
+ function openGoal() {
499
+ const html = goalViewHtml(S.goal, S.draft, { live: goalLive(S.conv) }); if (!html) return null;
500
+ vwStyle('doc');
501
+ return vwOpen({ id: 'goal', title: 'Goal', icon: 'goal', render: (el) => { el.innerHTML = goalViewHtml(S.goal, S.draft, { live: goalLive(S.conv) }); } });
502
+ }
503
+ function goalView(key, conv) {
504
+ S.conv = conv;
505
+ const now = goalNow(S.goal, S.draft);
506
+ const p = goalPane();
507
+ if (p) { const h = goalViewHtml(S.goal, S.draft, { live: goalLive(conv) }); if (p.__h !== h) { p.__h = h; p.innerHTML = h; } }
508
+ const first = GV.key !== key; GV.key = key;
509
+ const sig = now ? now.sig : null, was = GV.sig; GV.sig = sig;
510
+ if (first || !now || sig === was) return;
511
+ if (desk()) openGoal(); else ctxPeek({ kind: 'goal', title: now.title, sub: now.sub });
512
+ }
513
+ $('#dBody').addEventListener('click', (e) => {
514
+ if (!e.target.closest('[data-goal-open]')) return;
515
+ e.preventDefault(); openGoal();
516
+ if (innerWidth < 1000 && !chatPage()) setTab('out');
517
+ });
491
518
  /** The draft of the newest ready goal block in the conversation, which Start sends as the confirmed goal. */
492
519
  function readyDraft(conv) {
493
520
  const ms = (conv && conv.messages) || [];
@@ -541,7 +568,7 @@ async function sendText(key, text, files) {
541
568
  loadThread(key);
542
569
  return true;
543
570
  }
544
- $('#dBody').addEventListener('click', async (e) => {
571
+ async function onGoalPress(e) {
545
572
  const say = e.target.closest('[data-chat-say]'), gb = e.target.closest('[data-goal]'), mi = e.target.closest('[data-slash]');
546
573
  if (mi) { pickSlash(mi.dataset.slash); return; }
547
574
  if (!S.key || (!say && !gb)) return;
@@ -553,7 +580,9 @@ $('#dBody').addEventListener('click', async (e) => {
553
580
  const r = await chatPost('goal', { key: S.key, id: S.goal.id, act, draft: S.draft });
554
581
  $('#askNote').textContent = r && r.ok ? ({ start: 'Claude is starting on the goal.', cancel: 'The goal is cancelled.', stop: 'The goal is stopped.' }[act]) : (r && r.error) || 'The press did not reach the session.';
555
582
  loadThread(S.key);
556
- });
583
+ }
584
+ $('#dBody').addEventListener('click', onGoalPress);
585
+ $('#dOut').addEventListener('click', (e) => { if (e.target.closest('.vwgoal [data-goal]')) onGoalPress(e); }); // Start, Change, Cancel and Stop in the Goal tab
557
586
  /* the `/` menu (G1): opens on a leading `/`, arrows move, Enter or Tab picks, Esc shuts it */
558
587
  let slashAt = 0;
559
588
  function drawSlash() {
@@ -13,6 +13,7 @@ const MAX = 4;
13
13
  const IC = {
14
14
  doc: 'M6 3h9l4 4v14H6zM14 3v5h5M9 12h7M9 16h5', cal: 'M3.5 5h17v15h-17zM3.5 10h17M8 3v4M16 3v4', notes: 'M6 3h9l4 4v14H6zM14 3v5h5M9 12h7M9 16h5',
15
15
  tk: 'M4 4h16v16H4zM8.5 12.5l2.5 2.5 4.5-5', list: 'M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01', mic: 'M9 3h6v11H9zM5 11a7 7 0 0 0 14 0M12 18v3',
16
+ goal: 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8',
16
17
  };
17
18
  const svg = (k) => `<svg class="i" viewBox="0 0 24 24"><path d="${IC[k] || IC.doc}"/></svg>`;
18
19
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
@@ -2287,6 +2287,7 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
2287
2287
  .gpts i{width:10px;height:10px;border-radius:50%;box-shadow:inset 0 0 0 1.5px var(--ink-3)}
2288
2288
  .gpts li.m i{background:var(--ok);box-shadow:none}
2289
2289
  .gpts em{font-style:normal;color:var(--ink-3);font-size:var(--t-micro)}
2290
+ .vwgoal{padding-top:6px}.vwgoal .gcard{margin-top:0}.vwgoal .cta.alt{background:var(--well)} /* the Goal tab in the viewer (goal in the viewer, 2026-10-21) */
2290
2291
  /* 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 */
2291
2292
  .md{font-size:var(--fs-3);line-height:1.6;color:var(--ink);max-width:64ch;overflow-wrap:anywhere}
2292
2293
  .md>:first-child{margin-top:0}.md>:last-child{margin-bottom:0}
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "The /goal card lives in the Chat viewer as a Goal tab: a small chip in the conversation opens it, a state change opens or updates it, Stop is in the tab, phone layer with Back. Real server, 390 and 1280 wide.",
3
+ "seconds": {
4
+ "premium-chat-goal-view-test.js": 40
5
+ },
6
+ "panels": [
7
+ "premium-chat-goal-view-test.js"
8
+ ]
9
+ }