create-pmos 0.264.0 → 0.265.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.264.0",
3
+ "version": "0.265.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": {
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@4f2710e
1
+ kernel-source: pmos@847d5bc
2
2
  assembled: 2026-10-18
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-18T08:53:35Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-18T09:12:55Z"}
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-18T08:53:35Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-18T09:12:55Z"}
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-18T08:53:35Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-18T09:12:55Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -95,6 +95,37 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
95
95
  for (let i = A.reqs.length - 1; i >= 0; i--) if (/^POST \/api\/proactive\/settings$/.test(A.reqs[i])) A.reqs.splice(i, 1); // R10 below counts presses on a page where nothing was pressed
96
96
  await p.keyboard.press('Escape'); }
97
97
 
98
+ /* premium-sessions: the running list reads /api/sessions; Stop asks first and the one write is /api/session/remove */
99
+ { const fake = [
100
+ { id: 'sess-1', name: 'Draft the brief', agent: 'claude', note: 'Writing the brief', cwd: 'planning', created: new Date(Date.now() - 14 * 60000).toISOString(), shown: 'working', label: 'Working', automatic: false },
101
+ { id: 'sess-2', name: 'Refresh metrics', agent: 'claude', note: '', cwd: '.', created: new Date(Date.now() - 6 * 60000).toISOString(), shown: 'working', label: 'Working', automatic: true, headless: 'skill' },
102
+ { id: 'sess-3', name: 'Old one', agent: 'claude', note: '', cwd: '.', created: new Date().toISOString(), shown: 'exited', label: 'Exited', automatic: false }];
103
+ let removes = 0, slowOnce = true;
104
+ await p.route('**/api/sessions', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ sessions: fake }) }));
105
+ await p.route('**/api/session/remove', (r) => { removes++; const id = JSON.parse(r.request().postData()).id; if (id === 'sess-2' && slowOnce) { slowOnce = false; return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, removed: false, note: 'asked it to end' }) }); } const i = fake.findIndex((x) => x.id === id); if (i >= 0) fake.splice(i, 1); return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, removed: true }) }); });
106
+ const bt = await p.evaluate(() => { const b = document.querySelector('#sessBtn'); if (!b) return null; const r = b.getBoundingClientRect(); return { w: Math.round(r.width), h: Math.round(r.height) }; });
107
+ ok('X1 the header has an Agent sessions button of at least 44 px', bt && bt.w >= 44 && bt.h >= 44, JSON.stringify(bt));
108
+ await p.click('#sessBtn');
109
+ const rows = await until(() => p.evaluate(() => document.querySelectorAll('#oMain .ssr').length), 8000);
110
+ ok('X2 the list shows the sessions that have not exited, and the title counts them', rows === 2 && (await p.evaluate(() => document.querySelector('#dTitle').textContent)) === '2 running', String(rows));
111
+ const meta = await p.evaluate(() => [...document.querySelectorAll('#oMain .ssr')].map((r) => r.querySelector('.ssm').textContent + '|' + r.querySelector('.ssn').textContent));
112
+ ok('X3 a row carries only record fields: agent, state word, folder, age; a background run and a PMOS start are named', /claude.*Working.*planning.*min ago/.test(meta[0]) && /Background run/.test(meta[1]) && /Started by PMOS/.test(meta[1]) && /No note$/.test(meta[1]), meta.join(' // '));
113
+ await p.click('#oMain [data-stop="sess-1"]');
114
+ const asked = await p.evaluate(() => { const c = document.querySelector('#oMain .ssc'); return c ? c.textContent : ''; });
115
+ ok('X4 Stop asks first and says what it ends, and nothing is sent yet', /Stop “Draft the brief”\?/.test(asked) && /closes its terminal/.test(asked) && removes === 0, asked);
116
+ await p.click('#oMain [data-no="sess-1"]');
117
+ ok('X5 Keep running closes the question and sends nothing', (await p.evaluate(() => !document.querySelector('#oMain .ssc'))) && removes === 0);
118
+ await p.click('#oMain [data-stop="sess-2"]'); await p.click('#oMain [data-yes="sess-2"]');
119
+ const slow = await until(() => p.evaluate(() => { const c = document.querySelector('#oMain .ssc'); return c ? c.textContent : ''; }), 6000);
120
+ ok('X6 a session that has not exited says so and offers Stop again, never "Ended"', /has not exited yet/.test(slow) && !/Ended/.test(await p.evaluate(() => document.querySelector('#oMain').textContent)), slow);
121
+ await p.click('#oMain [data-yes="sess-2"]');
122
+ ok('X7 the second press ends it: the row says Ended and the toast confirms', !!(await until(() => p.evaluate(() => /Ended “Refresh metrics”/.test(document.querySelector('#oMain').textContent) && /Ended “Refresh metrics”/.test(document.querySelector('#toast').textContent)), 6000)));
123
+ ok('X8 the list re-reads and drops it, and the badge follows', !!(await until(() => p.evaluate(() => document.querySelectorAll('#oMain .ssr').length === 1 && document.querySelector('#sessBdg').textContent === '1'), 8000)));
124
+ const bare = await fetch(BASE + '/api/session/remove', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: 'sess-1' }) });
125
+ ok('X9 Stop is a page press: no nonce, no end (403)', bare.status === 403, String(bare.status));
126
+ await p.keyboard.press('Escape'); await p.unroute('**/api/sessions'); await p.unroute('**/api/session/remove');
127
+ for (let i = A.reqs.length - 1; i >= 0; i--) if (/^POST \/api\/session\/remove$/.test(A.reqs[i])) A.reqs.splice(i, 1); }
128
+
98
129
  /* R2 */
99
130
  const hero = await p.evaluate(() => ({ text: document.querySelector('#brief').textContent, k: [...document.querySelectorAll('#brief .k')].map((x) => x.textContent) }));
100
131
  const want = MODEL.hero.map((s) => s.parts.map((x) => x.t).join('')).join(' ');
@@ -15,6 +15,8 @@ Every premium page has an **Open the console** button beside the theme button. I
15
15
 
16
16
  Every premium page has a **Settings** button beside it. It opens one dialog with two sections. **Workspaces** lists the repositories PMOS works in, with Add (a folder path) and Remove; Remove forgets the address and never deletes the folder, and a refusal shows the server's reason. **Connectors** has an On/Off switch for each source the Briefing reads. Each press saves that one record. Every other setting runs on a default and stays in the console; the dialog links to it. Remove needs the page's launch nonce, so an agent session cannot call it.
17
17
 
18
+ Every premium page has an **Agent sessions** button beside the console button, with a count of the sessions running. It opens a dialog that lists each running session and background run with its note, state and start time. **Stop** asks first and says what it ends, then ends the session and closes its terminal. If the session has not exited yet, the row says so and offers Stop again. Terminals, new sessions and run questions stay in the console; the dialog links to it.
19
+
18
20
  ## Products
19
21
 
20
22
  You work across products, and a conversation in email, the calendar or Confluence cannot be tied to one product. So the Briefing reads more than one workspace and merges what needs you into one list.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.264.0",
3
+ "version": "0.265.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.264.0",
9
+ "version": "0.265.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.264.0",
3
+ "version": "0.265.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",
@@ -261,3 +261,62 @@ export async function openSettings() {
261
261
  };
262
262
  await load();
263
263
  }
264
+
265
+ /* ── Agent sessions: the running list with Stop (initiative premium-sessions) ──────────────────────────────────────────────────────────────
266
+ * Reads GET /api/sessions, the list the console dock reads. The one write is POST /api/session/remove, a page press. A session's terminal, a new
267
+ * session and a run's questions stay in the console. Every word on a row is a field of the session record. */
268
+ const sessLive = (s) => s && s.shown !== 'exited';
269
+ const readSessions = async () => { const r = await pmGet('/api/sessions'); return r && Array.isArray(r.sessions) ? r.sessions.filter(sessLive) : null; };
270
+ const sessAgo = (t) => { const ms = Date.now() - new Date(t).getTime(); if (!(ms >= 0)) return ''; const m = Math.max(1, Math.round(ms / 60000)); return 'Started ' + (m < 60 ? m + ' min ago' : Math.floor(m / 60) + ' h ' + (m % 60) + ' min ago'); };
271
+ function sessBadge(n) { const b = $('#sessBdg'); if (!b) return; b.textContent = String(n || ''); b.hidden = !n; const a = $('#sessBtn'); if (a) a.setAttribute('aria-label', 'Agent sessions, ' + (n ? n + ' running' : 'none running')); }
272
+ {
273
+ const b = $('#sessBtn');
274
+ if (b) {
275
+ b.onclick = () => openSessions();
276
+ const poll = async () => { if (document.hidden) return; const l = await readSessions(); if (l) sessBadge(l.length); };
277
+ poll(); setInterval(poll, 15000);
278
+ }
279
+ }
280
+ export async function openSessions() {
281
+ const M = { list: null, ask: null, busy: null, slow: null, done: null, err: '' };
282
+ const draw = () => {
283
+ const l = M.list, n = l ? l.length : 0;
284
+ $('#dTitle').textContent = l === null ? 'Agent sessions' : n ? n + ' running' : 'None running';
285
+ const rows = l === null ? '<p class="note">Reading the sessions.</p>' : n ? `<ul class="ssl">${l.map((x) => {
286
+ if (M.done && M.done.id === x.id) return `<li class="ssr"><p class="ssdone">Ended “${esc(x.name)}”.</p></li>`;
287
+ const busy = M.busy === x.id, ask = M.ask === x.id, slow = M.slow === x.id;
288
+ const what = x.headless ? 'This ends the background run.' : 'This ends the session and closes its terminal.';
289
+ return `<li class="ssr"${busy ? ' aria-busy="true"' : ''}><i class="ssd ${esc(x.shown || '')}" aria-hidden="true"></i>
290
+ <div class="ssb"><h3>${esc(x.name)}</h3><p class="ssn">${esc(x.note || 'No note')}</p>
291
+ <p class="ssm">${[x.headless ? 'Background run' : '', x.agent, x.label, x.cwd, sessAgo(x.created), x.automatic ? 'Started by PMOS' : ''].filter(Boolean).map((t) => `<span>${esc(t)}</span>`).join('')}</p></div>
292
+ <button type="button" class="cta alt" data-stop="${esc(x.id)}" aria-label="Stop ${esc(x.name)}"${ask || busy || slow ? ' disabled' : ''}>${busy ? 'Ending…' : 'Stop'}</button>
293
+ ${ask && !busy ? `<div class="ssc" role="group" aria-label="Confirm stop"><p><b>Stop “${esc(x.name)}”?</b> ${what} Files it already wrote stay where they are.</p><div class="ssx"><button type="button" class="cta bad" data-yes="${esc(x.id)}">Stop</button><button type="button" class="cta alt" data-no="${esc(x.id)}">Keep running</button></div></div>` : ''}
294
+ ${slow ? `<div class="ssc" role="group" aria-label="Still running"><p><b>Asked “${esc(x.name)}” to end.</b> It has not exited yet. Press Stop again to remove it.</p><div class="ssx"><button type="button" class="cta bad" data-yes="${esc(x.id)}">Stop again</button><button type="button" class="cta alt" data-no="${esc(x.id)}">Keep running</button></div></div>` : ''}</li>`;
295
+ }).join('')}</ul>` : '<div class="sse"><b>No agent sessions running.</b><p>New sessions start in the console.</p></div>';
296
+ $('#oMain').innerHTML = `<article class="paper doc"><div class="addf">${rows}
297
+ <p class="note" id="ssM" role="status" style="margin:0;min-height:1.2em">${esc(M.err)}</p>
298
+ <p class="note" style="margin:0">Terminals, new sessions and run questions stay in the console. <a href="/c3.html">Open the console</a>.</p></div></article>`;
299
+ };
300
+ openDlg({ eye: 'Agent sessions · real data', title: 'Agent sessions', say: 'The sessions running now. Stop ends one.', stream: turnA(ptx('The sessions running now, read from the same list the console shows. Stop ends one and says so.')), noteKey: null, pane: '<article class="paper doc"></article>', label: 'Sessions' });
301
+ $('#askF').hidden = true; setMode('detail'); draw();
302
+ const load = async () => { M.list = await readSessions(); if (M.list === null) { M.list = []; M.err = 'The sessions could not be read.'; } else sessBadge(M.list.length); draw(); };
303
+ const focusNext = () => { const b = $('#oMain [data-stop]:not([disabled])') || $('#dTitle'); if (b) b.focus(); };
304
+ $('#oMain').onclick = async (e) => {
305
+ if (M.busy) return;
306
+ const st = e.target.closest('[data-stop]'), yes = e.target.closest('[data-yes]'), no = e.target.closest('[data-no]');
307
+ M.err = '';
308
+ if (st) { M.ask = st.dataset.stop; M.slow = null; draw(); const k = $(`#oMain [data-no="${M.ask}"]`); if (k) k.focus(); }
309
+ else if (no) { const id = no.dataset.no; M.ask = null; M.slow = null; draw(); const b = $(`#oMain [data-stop="${id}"]`); if (b) b.focus(); }
310
+ else if (yes) {
311
+ const id = yes.dataset.yes, x = M.list.find((y) => y.id === id); if (!x) return;
312
+ M.busy = id; M.ask = null; M.slow = null; draw();
313
+ const r = await pmPost('/api/session/remove', { id }); M.busy = null;
314
+ if (r && r.ok && r.removed === false) M.slow = id; // asked to end, not exited yet: say so, never claim an end that did not happen
315
+ else if (r && r.ok) { M.done = x; toast('Ended “' + x.name + '”.'); } else M.err = (r && (r.error || r.reason)) || 'Not stopped.';
316
+ draw();
317
+ if (M.done) setTimeout(async () => { M.done = null; await load(); focusNext(); }, 1600);
318
+ else if (M.slow) { const b = $(`#oMain [data-yes="${id}"]`); if (b) b.focus(); }
319
+ }
320
+ };
321
+ await load();
322
+ }
@@ -1310,3 +1310,26 @@ button.dsn:hover{box-shadow:inset 0 0 0 1.5px rgb(79,109,245)}
1310
1310
  .mtg-link{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:10px 0 8px}
1311
1311
  .mtg-link select{flex:1 1 220px;min-width:0;min-height:44px;border-radius:18px;border:1px solid var(--hair);background:var(--well);padding:0 14px;font:inherit;color:inherit}
1312
1312
  @media (max-width:700px){#todayCard .ch{flex-wrap:wrap;row-gap:8px}}
1313
+
1314
+ /* Agent sessions dialog and its header button (initiative premium-sessions) */
1315
+ .sbtn{position:relative}
1316
+ .sbdg{position:absolute;top:-3px;right:-3px;min-width:22px;height:22px;padding:0 6px;border-radius:999px;background:var(--ember);color:rgb(20,22,31);font:650 12.5px var(--mono);display:grid;place-items:center;pointer-events:none}
1317
+ .sbdg[hidden]{display:none}
1318
+ .ssl{list-style:none;margin:0;padding:0;display:grid;gap:10px}
1319
+ .ssr{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:6px 14px;align-items:start;padding:16px 18px;border-radius:var(--r-in);background:var(--well)}
1320
+ .ssd{width:10px;height:10px;border-radius:50%;margin-top:7px;background:var(--ink-3)}
1321
+ .ssd.working{background:var(--ok)}.ssd.needs,.ssd.blocked{background:var(--ember)}
1322
+ .ssb{min-width:0}.ssb h3{font-size:16px;font-weight:650;letter-spacing:-.01em;overflow-wrap:anywhere}
1323
+ .ssn{color:var(--ink-2);font-size:var(--t-small);margin-top:2px;overflow-wrap:anywhere}
1324
+ .ssm{display:flex;flex-wrap:wrap;gap:2px 14px;margin-top:8px;font:500 12.5px var(--mono);color:var(--ink-3)}
1325
+ .ssr>.cta{height:44px;padding:0 20px}
1326
+ .ssc,.ssdone{grid-column:1/-1}
1327
+ .ssc{border-top:1px solid var(--hair);padding-top:14px;margin-top:8px;font-size:var(--t-small);color:var(--ink-2)}
1328
+ .ssc b{color:var(--ink);font-weight:650}
1329
+ .ssx{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}.ssx .cta{height:44px;padding:0 20px}
1330
+ .cta.bad{background:var(--bad);color:rgb(255,255,255)}
1331
+ @media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .cta.bad{color:rgb(40,12,10)}}
1332
+ :root[data-theme="dark"] .cta.bad{color:rgb(40,12,10)}
1333
+ .ssdone{color:var(--ok);font-weight:650}
1334
+ .sse{padding:34px 20px;text-align:center;border-radius:var(--r-in);background:var(--well)}.sse b{display:block;font-size:17px;font-weight:650}.sse p{color:var(--ink-2);margin-top:6px;font-size:var(--t-small)}
1335
+ @media (max-width:700px){.ssr{grid-template-columns:auto minmax(0,1fr)}.ssr>.cta{grid-column:2}}
@@ -36,6 +36,7 @@
36
36
  <div class="tools tools-top"><span class="snap" id="snap">Reading the board</span>
37
37
  <span class="seg modeseg" id="modeSeg" role="group" aria-label="How an initiative opens"><i class="pill"></i><button data-m="page" aria-pressed="true">Page</button><button data-m="popup" aria-pressed="false">Popup</button></span>
38
38
  <a class="glass round" id="toConsole" href="/c3.html" aria-label="Open the console" title="Open the console"><svg class="i" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="16" rx="3"/><path d="m7 9 3 3-3 3M13 15h4"/></svg></a>
39
+ <button class="glass round sbtn" id="sessBtn" aria-haspopup="dialog" aria-label="Agent sessions" title="Agent sessions"><svg class="i" viewBox="0 0 24 24"><path d="M4 6h16M4 12h10M4 18h6"/><circle cx="18" cy="16" r="3"/></svg><span class="sbdg" id="sessBdg" aria-hidden="true" hidden></span></button>
39
40
  <button class="glass round" id="settingsBtn" aria-label="Settings" title="Settings"><svg class="i" viewBox="0 0 24 24"><circle cx="12" cy="12" r="3"/><path d="M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6 7 7M17 17l1.4 1.4M5.6 18.4 7 17M17 7l1.4-1.4"/></svg></button>
40
41
  <button class="glass round" id="theme" aria-label="Switch light or dark"><svg class="i" viewBox="0 0 24 24"><path d="M20 14.5A8 8 0 0 1 9.5 4 8 8 0 1 0 20 14.5z"/></svg></button></div>
41
42
  </header>
@@ -35,6 +35,7 @@
35
35
  <h1 class="vh" id="iH1">Initiative</h1><div id="crumbHost"></div>
36
36
  <div class="tools tools-top"><span class="snap" id="snap">Reading the initiative</span>
37
37
  <a class="glass round" id="toConsole" href="/c3.html" aria-label="Open the console" title="Open the console"><svg class="i" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="16" rx="3"/><path d="m7 9 3 3-3 3M13 15h4"/></svg></a>
38
+ <button class="glass round sbtn" id="sessBtn" aria-haspopup="dialog" aria-label="Agent sessions" title="Agent sessions"><svg class="i" viewBox="0 0 24 24"><path d="M4 6h16M4 12h10M4 18h6"/><circle cx="18" cy="16" r="3"/></svg><span class="sbdg" id="sessBdg" aria-hidden="true" hidden></span></button>
38
39
  <button class="glass round" id="settingsBtn" aria-label="Settings" title="Settings"><svg class="i" viewBox="0 0 24 24"><circle cx="12" cy="12" r="3"/><path d="M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6 7 7M17 17l1.4 1.4M5.6 18.4 7 17M17 7l1.4-1.4"/></svg></button>
39
40
  <button class="glass round" id="theme" aria-label="Switch light or dark"><svg class="i" viewBox="0 0 24 24"><path d="M20 14.5A8 8 0 0 1 9.5 4 8 8 0 1 0 20 14.5z"/></svg></button></div>
40
41
  </header>
@@ -36,6 +36,7 @@
36
36
  <h1 class="vh">Insights</h1><div id="crumbHost"></div>
37
37
  <div class="tools tools-top"><span class="snap" id="snap">Reading the records</span>
38
38
  <a class="glass round" id="toConsole" href="/c3.html" aria-label="Open the console" title="Open the console"><svg class="i" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="16" rx="3"/><path d="m7 9 3 3-3 3M13 15h4"/></svg></a>
39
+ <button class="glass round sbtn" id="sessBtn" aria-haspopup="dialog" aria-label="Agent sessions" title="Agent sessions"><svg class="i" viewBox="0 0 24 24"><path d="M4 6h16M4 12h10M4 18h6"/><circle cx="18" cy="16" r="3"/></svg><span class="sbdg" id="sessBdg" aria-hidden="true" hidden></span></button>
39
40
  <button class="glass round" id="settingsBtn" aria-label="Settings" title="Settings"><svg class="i" viewBox="0 0 24 24"><circle cx="12" cy="12" r="3"/><path d="M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6 7 7M17 17l1.4 1.4M5.6 18.4 7 17M17 7l1.4-1.4"/></svg></button>
40
41
  <button class="glass round" id="theme" aria-label="Switch light or dark"><svg class="i" viewBox="0 0 24 24"><path d="M20 14.5A8 8 0 0 1 9.5 4 8 8 0 1 0 20 14.5z"/></svg></button></div>
41
42
  </header>
@@ -35,6 +35,7 @@
35
35
  <h1 class="vh">My work</h1><span class="glass name" aria-hidden="true">My work</span>
36
36
  <div class="tools tools-top"><span class="snap" id="snap">Reading your list</span>
37
37
  <a class="glass round" id="toConsole" href="/c3.html" aria-label="Open the console" title="Open the console"><svg class="i" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="16" rx="3"/><path d="m7 9 3 3-3 3M13 15h4"/></svg></a>
38
+ <button class="glass round sbtn" id="sessBtn" aria-haspopup="dialog" aria-label="Agent sessions" title="Agent sessions"><svg class="i" viewBox="0 0 24 24"><path d="M4 6h16M4 12h10M4 18h6"/><circle cx="18" cy="16" r="3"/></svg><span class="sbdg" id="sessBdg" aria-hidden="true" hidden></span></button>
38
39
  <button class="glass round" id="settingsBtn" aria-label="Settings" title="Settings"><svg class="i" viewBox="0 0 24 24"><circle cx="12" cy="12" r="3"/><path d="M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6 7 7M17 17l1.4 1.4M5.6 18.4 7 17M17 7l1.4-1.4"/></svg></button>
39
40
  <button class="glass round" id="theme" aria-label="Switch light or dark"><svg class="i" viewBox="0 0 24 24"><path d="M20 14.5A8 8 0 0 1 9.5 4 8 8 0 1 0 20 14.5z"/></svg></button></div>
40
41
  </header>
@@ -37,6 +37,7 @@
37
37
  <div class="tools tools-top"><span class="snap" id="snap">Reading the repository</span>
38
38
  <span class="pkw" id="pkw" hidden><button class="fchip" id="pick" aria-haspopup="menu" aria-expanded="false" aria-controls="pickMenu">Products<em id="pickN"></em></button><div class="crmenu pkmenu" id="pickMenu" role="menu" hidden></div></span>
39
39
  <a class="glass round" id="toConsole" href="/c3.html" aria-label="Open the console" title="Open the console"><svg class="i" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="16" rx="3"/><path d="m7 9 3 3-3 3M13 15h4"/></svg></a>
40
+ <button class="glass round sbtn" id="sessBtn" aria-haspopup="dialog" aria-label="Agent sessions" title="Agent sessions"><svg class="i" viewBox="0 0 24 24"><path d="M4 6h16M4 12h10M4 18h6"/><circle cx="18" cy="16" r="3"/></svg><span class="sbdg" id="sessBdg" aria-hidden="true" hidden></span></button>
40
41
  <button class="glass round" id="settingsBtn" aria-label="Settings" title="Settings"><svg class="i" viewBox="0 0 24 24"><circle cx="12" cy="12" r="3"/><path d="M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6 7 7M17 17l1.4 1.4M5.6 18.4 7 17M17 7l1.4-1.4"/></svg></button>
41
42
  <button class="glass round" id="theme" aria-label="Switch light or dark"><svg class="i" viewBox="0 0 24 24"><path d="M20 14.5A8 8 0 0 1 9.5 4 8 8 0 1 0 20 14.5z"/></svg></button></div>
42
43
  </header>
@@ -6326,6 +6326,8 @@ async function handleRequest(req, res) {
6326
6326
  if (p === '/api/session/remove' && req.method === 'POST') {
6327
6327
  let body = {};
6328
6328
  try { body = JSON.parse((await readBody(req)) || '{}'); } catch { return json(res, { ok: false, error: 'invalid JSON body' }, 400); }
6329
+ const g = pmGuard.requirePagePress(req, body); // premium-sessions: Stop is a page press, so an agent session gets 403
6330
+ if (!g.ok) return json(res, { ok: false, error: g.error }, g.status);
6329
6331
  const sess = sessions.get(String(body.id || ''));
6330
6332
  if (!sess) {
6331
6333
  // an ended session the server no longer holds (only its record on disk is left) is still listed in Past; removing it deletes that record