create-pmos 0.338.0 → 0.339.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.338.0",
3
+ "version": "0.339.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.339.0",
37
+ "at": "2026-10-20T03:01:53.405Z",
38
+ "f": 2,
39
+ "prs": [
40
+ {
41
+ "n": 934,
42
+ "t": "A started /goal keeps working until it is done",
43
+ "s": "Every chat panel session starts with a Claude Code Stop hook."
44
+ }
45
+ ]
46
+ },
35
47
  {
36
48
  "v": "0.338.0",
37
49
  "at": "2026-10-20T02:42:22.826Z",
@@ -294,18 +306,6 @@
294
306
  "s": "The right pane can open other items as tabs beside its own detail, with at most 4 extra tabs."
295
307
  }
296
308
  ]
297
- },
298
- {
299
- "v": "0.319.0",
300
- "at": "2026-10-19T14:50:54.311Z",
301
- "f": 2,
302
- "prs": [
303
- {
304
- "n": 897,
305
- "t": "My work has no Calendar card; the Briefing holds the calendar",
306
- "s": "My work has no calendar."
307
- }
308
- ]
309
309
  }
310
310
  ]
311
311
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@4bd533cc
1
+ kernel-source: pmos@85ad48db
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-20T02:42:19Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-20T03:01:50Z"}
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-20T02:42:19Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-20T03:01:50Z"}
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-20T02:42:19Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-20T03:01:50Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,16 @@
1
1
  [
2
+ {
3
+ "v": "0.339.0",
4
+ "at": "2026-10-20T03:01:53.405Z",
5
+ "f": 2,
6
+ "prs": [
7
+ {
8
+ "n": 934,
9
+ "t": "A started /goal keeps working until it is done",
10
+ "s": "Every chat panel session starts with a Claude Code Stop hook."
11
+ }
12
+ ]
13
+ },
2
14
  {
3
15
  "v": "0.338.0",
4
16
  "at": "2026-10-20T02:42:22.826Z",
@@ -389,4 +389,8 @@ Type `/` in the box to see the commands: `/goal`, `/compact` and `/clear`. Use t
389
389
  - **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.
390
390
  - **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.
391
391
 
392
- Start and Cancel need the page's launch nonce too. The goal is kept in `goal-runs.jsonl` in the state folder.
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
+ - **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
+ - **Stop the goal** presses Esc in the session and ends the goal.
395
+
396
+ 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,6 +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
185
  return { status: 200, body: { ok: true, session: live, started: false, ...extra } };
185
186
  }
186
187
  let s;
@@ -70,11 +70,74 @@ function goalOf(runtimeDir, key) {
70
70
  if (!l.trim()) continue; let e; try { e = JSON.parse(l); } catch { continue; }
71
71
  if (!e || e.key !== key) continue;
72
72
  if (e.event === 'grilling') g = { id: e.id, state: 'grilling', text: e.text, at: e.at };
73
- else if (g && e.id === g.id && (e.event === 'started' || e.event === 'cancelled')) g = { ...g, state: e.event, ...(e.draft ? { draft: e.draft } : {}), at: e.at };
73
+ else if (!g || e.id !== g.id) continue;
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
+ else if (e.event === 'cancelled') g = { ...g, state: 'cancelled', at: e.at };
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 === 'resumed') g = { ...g, state: 'started', reason: undefined, at: e.at };
78
+ 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 };
74
79
  }
75
80
  return g;
76
81
  }
77
82
 
83
+ /* ── slice 3: until achieved (PRD U1–U7) ───────────────────────────────────────────────────────────────────────────────
84
+ * Claude Code's Stop hook posts here each time Claude would end its turn in a chat session. While the key's goal is started
85
+ * and not done, the answer blocks the stop and tells Claude what is still open; it lets Claude stop when Claude reports the
86
+ * goal done or needs the PM, at the deadline, after the round limit, or after NO_PROGRESS rounds that met no new point.
87
+ * The done check is Claude's own report (a pmos-goal progress block), so the page calls it unverified. */
88
+ const NO_PROGRESS = 3;
89
+ const REASON = { 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.' };
90
+ /** The last fenced pmos-goal block in a message, parsed, or null. */
91
+ function blockOf(text) {
92
+ const re = /```pmos-goal[^\n]*\n([\s\S]*?)```/g;
93
+ let m, last = null; while ((m = re.exec(String(text || '')))) last = m;
94
+ if (!last) return null;
95
+ try { const b = JSON.parse(last[1]); return b && typeof b === 'object' ? b : null; } catch { return null; }
96
+ }
97
+ const strs = (a) => (Array.isArray(a) ? a.map((x) => clip(x, 200)).filter(Boolean).slice(0, 8) : null);
98
+ /** The chat key a session belongs to (premium-chat-sessions.jsonl, the last line that names it), or null. */
99
+ function keyOfSession(runtimeDir, session, chatsFile) {
100
+ let t; try { t = fs.readFileSync(path.join(runtimeDir, chatsFile), 'utf8'); } catch { return null; }
101
+ let key = null;
102
+ for (const l of t.split('\n')) { if (!l.trim()) continue; let e; try { e = JSON.parse(l); } catch { continue; } if (e && e.session === session && typeof e.key === 'string') key = e.key; }
103
+ return key;
104
+ }
105
+ const roundsOf = (runtimeDir, id) => {
106
+ let t; try { t = fs.readFileSync(path.join(runtimeDir, RUNS), 'utf8'); } catch { return []; }
107
+ return t.split('\n').filter((l) => l.trim()).map((l) => { try { return JSON.parse(l); } catch { return null; } }).filter((e) => e && e.id === id && e.event === 'round');
108
+ };
109
+ /** The Stop hook's answer for one chat session: {} lets Claude stop; { decision: 'block', reason } keeps it working. */
110
+ function onStop({ runtimeDir, key, message, now = new Date() }) {
111
+ const g = key && goalOf(runtimeDir, key);
112
+ if (!g || g.state !== 'started' || !g.draft) return {};
113
+ const d = g.draft, b = blockOf(message), all = d.done || [];
114
+ const met = (b && b.step === 'progress' && strs(b.met)) || g.met || [];
115
+ const open = (b && b.step === 'progress' && strs(b.open)) || all.filter((x) => !met.includes(x));
116
+ const base = { id: g.id, key, met, open, at: now.toISOString() };
117
+ if (b && b.step === 'progress' && (b.state === 'done' || (open.length === 0 && met.length > 0))) { append(runtimeDir, { event: 'done', ...base }); return {}; }
118
+ if (b && b.step === 'progress' && b.state === 'needs-you') { append(runtimeDir, { event: 'waiting', ...base }); return {}; }
119
+ const due = Date.parse(d.by || '');
120
+ const stop = (reason) => { append(runtimeDir, { event: 'stopped', reason, ...base }); return {}; };
121
+ if (Number.isFinite(due) && now.getTime() > due) return stop('deadline');
122
+ const n = (g.rounds || 0) + 1;
123
+ if (n > (d.limit || LIMIT)) return stop('limit');
124
+ const prev = roundsOf(runtimeDir, g.id);
125
+ if (prev.length >= NO_PROGRESS && prev.slice(-NO_PROGRESS).every((r) => (r.met || []).length >= met.length)) return stop('no-progress');
126
+ append(runtimeDir, { event: 'round', n, ...base });
127
+ 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
+ /** 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
+ function resume({ runtimeDir, key, now = new Date() }) {
131
+ 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;
135
+ }
136
+ /** The Claude Code --settings for a chat session: one Stop hook that posts to this workspace with the session's token. */
137
+ function hookSettings(port, host = '127.0.0.1') {
138
+ return { hooks: { Stop: [{ hooks: [{ type: 'http', url: 'http://' + host + ':' + port + '/api/briefing-premium/goal-stop', headers: { 'x-pmos-session': '$PMOS_SESSION' }, allowedEnvVars: ['PMOS_SESSION'], timeout: 10 }] }] } };
139
+ }
140
+
78
141
  /** chat() hands a `/goal` message here: { error } or { id, prompt } with the grilling line already on record. */
79
142
  function begin({ runtimeDir, key, text, now = new Date() }) {
80
143
  const t = String(text || '').trim();
@@ -89,10 +152,16 @@ const fail = (status, error) => ({ status, body: { ok: false, error } });
89
152
  /** The PM's Start or Cancel on the goal card. sessions: { alive(id), type(id, text) }; session: the key's chat session id. */
90
153
  function decide({ runtimeDir, key, id, act, draft, session, sessions, now = new Date() }) {
91
154
  if (!runtimeDir) return fail(409, 'this workspace has no state folder to keep the goal in');
92
- if (act !== 'start' && act !== 'cancel') return fail(400, 'act must be start or cancel');
155
+ if (!['start', 'cancel', 'stop'].includes(act)) return fail(400, 'act must be start, cancel or stop');
93
156
  const g = goalOf(runtimeDir, key);
94
157
  if (!g || g.id !== id) return fail(404, 'That goal is not the one this conversation is on.');
95
- if (g.state !== 'grilling') return fail(409, g.state === 'started' ? 'This goal has already started.' : 'This goal was cancelled.');
158
+ if (act === 'stop') { // U5: the PM's Stop on a working goal: Esc in the session, and the goal ends
159
+ if (g.state !== 'started') return fail(409, 'This goal is not working.');
160
+ if (session && sessions && sessions.alive(session) && sessions.keys) sessions.keys(session, '\x1b');
161
+ append(runtimeDir, { event: 'stopped', reason: 'pm', id, key, at: now.toISOString() });
162
+ return { status: 200, body: { ok: true, id, state: 'stopped' } };
163
+ }
164
+ if (g.state !== 'grilling') return fail(409, g.state === 'cancelled' ? 'This goal was cancelled.' : 'This goal has already started.');
96
165
  if (!session || !sessions || !sessions.alive(session)) return fail(409, 'No session is running for this conversation. Send /goal again to start one.');
97
166
  let d = null;
98
167
  if (act === 'start') { d = cleanDraft(draft); if (!d) return fail(400, 'The goal needs a sentence and at least one done point before it can start.'); }
@@ -101,4 +170,4 @@ function decide({ runtimeDir, key, id, act, draft, session, sessions, now = new
101
170
  return { status: 200, body: { ok: true, id, state: act === 'start' ? 'started' : 'cancelled' } };
102
171
  }
103
172
 
104
- module.exports = { parseCommand, grillPrompt, startMessage, cancelMessage, cleanDraft, goalOf, begin, decide, MARK, RUNS, LIMIT };
173
+ module.exports = { parseCommand, grillPrompt, startMessage, cancelMessage, cleanDraft, goalOf, begin, decide, onStop, resume, blockOf, keyOfSession, hookSettings, MARK, RUNS, LIMIT, NO_PROGRESS, REASON };
@@ -14,6 +14,7 @@ const guard = require('./pm-guard.js');
14
14
  const Wr = require('./briefing-premium-writes.js');
15
15
  const Ag = require('./briefing-premium-agent.js');
16
16
  const Goal = require('./goal-chat.js');
17
+ const actor = require('./actor.js');
17
18
  const WP = require('./my-work-premium.js');
18
19
  const BoardP = require('./board-premium.js');
19
20
  const InitP = require('./initiative-premium.js');
@@ -107,6 +108,18 @@ async function post(req, res, url, ctx) {
107
108
  module.exports = {
108
109
  prefixes: ['/api/briefing-premium'],
109
110
  handle: async (req, res, url, ctx) => {
111
+ if (url.pathname === '/api/briefing-premium/goal-stop') {
112
+ // premium-chat-session U1: Claude Code's Stop hook for a chat session. The session's own token names it; the answer keeps a started goal going.
113
+ if (req.method !== 'POST') { ctx.json(res, { ok: false, error: 'POST only' }, 405); return true; }
114
+ const got = await ctx.readJson(req);
115
+ const tok = req.headers && req.headers['x-pmos-session'];
116
+ const who = actor.sessionForToken(Array.isArray(tok) ? tok[0] : tok, { sessDir: ctx.sessDir || path.join(ctx.runtimeDir || '', 'sessions') });
117
+ if (!who || !ctx.runtimeDir) { ctx.json(res, { ok: false, error: 'no valid session token' }, 401); return true; }
118
+ const key = Goal.keyOfSession(ctx.runtimeDir, who.session, Ag.CHATS);
119
+ const body = got.ok && got.body && typeof got.body === 'object' ? got.body : {};
120
+ ctx.json(res, key ? Goal.onStop({ runtimeDir: ctx.runtimeDir, key, message: body.last_assistant_message }) : {});
121
+ return true;
122
+ }
110
123
  if (url.pathname.startsWith('/api/briefing-premium/') && POSTS.includes(url.pathname.slice('/api/briefing-premium/'.length))) {
111
124
  if (req.method !== 'POST') { ctx.json(res, { ok: false, error: 'POST only' }, 405); return true; }
112
125
  return post(req, res, url, ctx);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.338.0",
3
+ "version": "0.339.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.338.0",
9
+ "version": "0.339.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.338.0",
3
+ "version": "0.339.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",
@@ -30,6 +30,7 @@ const OPENING = 'The PM is talking to you from the chat panel';
30
30
  export function shownUser(text) {
31
31
  const t = String(text == null ? '' : text);
32
32
  if (t.includes(MARK.start)) return 'Start the goal';
33
+ const r = /\[PMOS \/goal round (\d+)\]/.exec(t); if (r) return 'Keep going: round ' + r[1];
33
34
  if (t.includes(MARK.cancel)) return 'Cancel the goal';
34
35
  const g = t.indexOf(MARK.grill + ' The PM set a goal: ');
35
36
  if (g >= 0) return '/goal ' + t.slice(g + (MARK.grill + ' The PM set a goal: ').length).split('\n')[0];
@@ -46,7 +47,7 @@ export const smartHtml = (d) => `<div class="smart" aria-label="SMART points fil
46
47
  export function goalCard(d, state) {
47
48
  const a = new Set(Array.isArray(d.assumed) ? d.assumed : []);
48
49
  const row = (k, label, v) => (v ? `<dt>${label}</dt><dd${a.has(k) ? ' class="assumed"' : ''}>${v}</dd>` : '');
49
- const pill = state === 'started' ? 'Started' : state === 'cancelled' ? 'Cancelled' : 'Not started';
50
+ const pill = state === 'cancelled' ? 'Cancelled' : state && state !== 'grilling' ? 'Started' : 'Not started';
50
51
  const done = Array.isArray(d.done) && d.done.length ? `<ul>${d.done.map((x) => `<li>${esc(x)}</li>`).join('')}</ul>` : '';
51
52
  return `<div class="gcard"><div class="grow"><b>${esc(d.goal || 'Goal')}</b><span class="gpill">${pill}</span></div><dl class="gkv">${row('done', 'Done when', done)}${row('may', 'It may', esc(d.may))}${row('serves', 'Serves', esc(d.serves))}${row('by', 'By', esc(d.by))}${row('limit', 'Limit', esc((Number.isInteger(d.limit) ? d.limit : 12) + ' rounds of work at most'))}</dl></div>`;
52
53
  }
@@ -72,3 +73,20 @@ export function goalBlockHtml(block, { live = false, state = 'grilling' } = {})
72
73
  }
73
74
  return '';
74
75
  }
76
+
77
+ 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.' };
78
+ /** 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
+ * goal: the GET /thread goal record. The done check is Claude's own report, so it says "unverified". */
80
+ export function goalProgressHtml(goal) {
81
+ if (!goal || !goal.draft || !['started', 'done', 'stopped', 'waiting'].includes(goal.state)) return '';
82
+ const d = goal.draft, all = Array.isArray(d.done) ? d.done : [], met = new Set(goal.met || []);
83
+ const limit = Number.isInteger(d.limit) ? d.limit : 12;
84
+ const pill = goal.state === 'started' ? 'Working · round ' + Math.max(1, (goal.rounds || 0) + 1) + ' of ' + limit
85
+ : goal.state === 'done' ? 'Done, as Claude reports it' : goal.state === 'waiting' ? 'Needs you' : 'Stopped';
86
+ const note = goal.state === 'stopped' ? (WHY[goal.reason] || 'It stopped.') + ' Send a message to go on, or /goal to set a new goal.'
87
+ : goal.state === 'waiting' ? 'Claude needs your answer above. Your reply lets it go on.'
88
+ : goal.state === 'done' ? 'Check the work before you rely on it. Claude checked its own points.' : 'Claude keeps working until every point is met, the deadline, or ' + limit + ' rounds.';
89
+ const pts = all.map((x) => `<li class="${met.has(x) ? 'm' : ''}"><i aria-hidden="true"></i><span>${esc(x)}</span><em>${met.has(x) ? 'met' : 'open'}</em></li>`).join('');
90
+ const stop = goal.state === 'started' ? '<div class="chatopts"><button type="button" class="cta alt" data-goal="stop">Stop the goal</button></div>' : '';
91
+ return `<div class="gcard gprog2" role="status"><div class="grow"><b>${esc(d.goal)}</b><span class="gpill">${esc(pill)}</span></div><p class="gprog">${met.size} of ${all.length} done points met · unverified${d.by ? ' · due ' + esc(d.by) : ''}</p><ul class="gpts">${pts}</ul><p class="gprog">${esc(note)}</p>${stop}</div>`;
92
+ }
@@ -4,7 +4,7 @@ import { recChipView, STOP_LINE } from './premium-meeting.js';
4
4
  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
- import { splitGoal, shownUser, goalBlockHtml, slashMatches } from './goal-chat.js';
7
+ import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, slashMatches } from './goal-chat.js';
8
8
  export const $ = (s, r = document) => r.querySelector(s);
9
9
  export const $$ = (s, r = document) => [...r.querySelectorAll(s)];
10
10
  export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
@@ -257,6 +257,7 @@ export function sessionHtml(c, goal = null) {
257
257
  const live = i === last && waiting && !!goal && goal.state === 'grilling';
258
258
  return turnAgent(`<p class="agtag">Claude</p>${g.text ? paras(g.text) : ''}${goalBlockHtml(g.block, { live, state: goal && goal.state })}`);
259
259
  });
260
+ const gp = goalProgressHtml(goal); if (gp) out.push(gp);
260
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>`));
261
262
  else if (c.turn === 'agent' || c.turn === 'tool') out.push(turnAgent(`<p class="tt" role="status">${c.turn === 'tool' && c.openCall ? 'Running ' + esc(c.openCall) + '.' : 'Claude is working.'} <button type="button" class="cta alt" data-chat-press="esc">Stop</button></p>`));
262
263
  return out.join('');
@@ -319,7 +320,7 @@ $('#dBody').addEventListener('click', async (e) => {
319
320
  if (!S.goal) return;
320
321
  gb.disabled = true;
321
322
  const r = await chatPost('goal', { key: S.key, id: S.goal.id, act, draft: S.draft });
322
- $('#askNote').textContent = r && r.ok ? (act === 'start' ? 'Claude is starting on the goal.' : 'The goal is cancelled.') : (r && r.error) || 'The press did not reach the session.';
323
+ $('#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.';
323
324
  loadThread(S.key);
324
325
  });
325
326
  /* the `/` menu (G1): opens on a leading `/`, arrows move, Enter or Tab picks, Esc shuts it */
@@ -2158,3 +2158,8 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
2158
2158
  .gkv dd.assumed::after{content:" · assumed";color:var(--ember-ink);font-size:var(--t-micro)}
2159
2159
  .gprog{margin:8px 0 0;font-size:var(--t-small);color:var(--ink-2)}
2160
2160
  @media (max-width:520px){.gkv{grid-template-columns:1fr;gap:2px}.gkv dd{margin-bottom:6px}}
2161
+ .gpts{list-style:none;margin:10px 0 0;padding:0;display:grid;gap:6px}
2162
+ .gpts li{display:grid;grid-template-columns:14px 1fr auto;gap:10px;align-items:baseline;font-size:var(--t-small)}
2163
+ .gpts i{width:10px;height:10px;border-radius:50%;box-shadow:inset 0 0 0 1.5px var(--ink-3)}
2164
+ .gpts li.m i{background:var(--ok);box-shadow:none}
2165
+ .gpts em{font-style:normal;color:var(--ink-3);font-size:var(--t-micro)}
@@ -3991,7 +3991,9 @@ function spawnSessionInner({ name, agent, cwd, ws, origin, initialInput, profile
3991
3991
  const argv = [...(mres.state === 'applied' ? mres.args : []), ...fres.args];
3992
3992
  /* PER-SESSION HOOKS (console3 wave D). Off unless PMOS_AGENT_HOOKS=1: then an agent session starts with --settings whose
3993
3993
  * hooks post to this workspace (lib/routes-hooks.js, loopback only; the session token travels in the PMOS_SESSION env). */
3994
- if (process.env.PMOS_AGENT_HOOKS === '1' && agent === 'claude') argv.push('--settings', JSON.stringify(require('./lib/routes-hooks.js').settingsFor(PORT)));
3994
+ // premium-chat-session U1: a chat panel's session gets the /goal Stop hook (lib/goal-chat.js) instead, so a started goal keeps going until done.
3995
+ if (agent === 'claude' && /^chat:/.test(String(tag || ''))) argv.push('--settings', JSON.stringify(require('./lib/goal-chat.js').hookSettings(PORT)));
3996
+ else if (process.env.PMOS_AGENT_HOOKS === '1' && agent === 'claude') argv.push('--settings', JSON.stringify(require('./lib/routes-hooks.js').settingsFor(PORT)));
3995
3997
  const launchArgs = argv;
3996
3998
  if (mres.tier) {
3997
3999
  const mc = modelLib.core();