create-pmos 0.357.0 → 0.359.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 +25 -25
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-work-test.js +6 -0
- package/workspace/changelog.json +24 -0
- package/workspace/guide/briefing-premium.md +1 -1
- package/workspace/lib/briefing-premium-agent.js +36 -5
- package/workspace/lib/session-origin.js +17 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/premium-shell.js +16 -0
- package/workspace/server.js +21 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.359.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.359.0",
|
|
37
|
+
"at": "2026-10-20T13:30:13.743Z",
|
|
38
|
+
"f": 2,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 958,
|
|
42
|
+
"t": "The phone rail returns to the bottom after the keyboard closes",
|
|
43
|
+
"s": "When a field loses focus or the keyboard closes, the bar goes back to the bottom of the screen and the dock back to the top."
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"v": "0.358.0",
|
|
49
|
+
"at": "2026-10-20T11:00:48.565Z",
|
|
50
|
+
"f": 2,
|
|
51
|
+
"prs": [
|
|
52
|
+
{
|
|
53
|
+
"n": 939,
|
|
54
|
+
"t": "Chat sessions end when idle, resume, and cap at 4 live",
|
|
55
|
+
"s": "A chat session that prints nothing for the workspace idle limit (60 minutes by default) is ended, unless its goal is started or a permission prompt is waiting."
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
35
59
|
{
|
|
36
60
|
"v": "0.357.0",
|
|
37
61
|
"at": "2026-10-20T09:57:04.765Z",
|
|
@@ -267,30 +291,6 @@
|
|
|
267
291
|
"s": "Each such goal adds one row to the Briefing list, built in the existing row pattern."
|
|
268
292
|
}
|
|
269
293
|
]
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
"v": "0.339.0",
|
|
273
|
-
"at": "2026-10-20T03:01:53.405Z",
|
|
274
|
-
"f": 2,
|
|
275
|
-
"prs": [
|
|
276
|
-
{
|
|
277
|
-
"n": 934,
|
|
278
|
-
"t": "A started /goal keeps working until it is done",
|
|
279
|
-
"s": "Every chat panel session starts with a Claude Code Stop hook."
|
|
280
|
-
}
|
|
281
|
-
]
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
"v": "0.338.0",
|
|
285
|
-
"at": "2026-10-20T02:42:22.826Z",
|
|
286
|
-
"f": 2,
|
|
287
|
-
"prs": [
|
|
288
|
-
{
|
|
289
|
-
"n": 933,
|
|
290
|
-
"t": "/goal in the premium chat panel grills the goal into a SMART goal",
|
|
291
|
-
"s": "Typing / opens a short menu with /goal, /compact and /clear."
|
|
292
|
-
}
|
|
293
|
-
]
|
|
294
294
|
}
|
|
295
295
|
]
|
|
296
296
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-20T13:30:11Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-20T13:30:11Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-20T13:30:11Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -245,6 +245,12 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
245
245
|
await q.keyboard.press('Escape'); await sleep(300);
|
|
246
246
|
const pg = await q.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('.wck, .capb, .wrh, #revBtn, .fchip, .qtb')].filter((b) => !b.closest('[hidden]') && b.getBoundingClientRect().height < 44 && b.getBoundingClientRect().height > 0).map((b) => b.className + ':' + Math.round(b.getBoundingClientRect().height)) }));
|
|
247
247
|
ok(`M12 at 390 px (${theme}) the page has no sideways scroll and every control is 44 px`, !pg.over && pg.small.length === 0, JSON.stringify(pg));
|
|
248
|
+
/* the rail after the keyboard (Wawan's phone, 2026-10-20): leaving a field nudges the scroll by a pixel and back, so iOS places the fixed rail at the bottom again */
|
|
249
|
+
await q.evaluate(() => { const y = document.querySelector('#qBody').getBoundingClientRect().top + scrollY - 250; scrollTo(0, y); window.__ys = []; addEventListener('scroll', () => window.__ys.push(scrollY)); });
|
|
250
|
+
await sleep(200); const y0 = await q.evaluate(() => scrollY);
|
|
251
|
+
await q.evaluate(() => { const i = document.querySelector('#capIn'); i.focus({ preventScroll: true }); i.blur(); }); await sleep(600);
|
|
252
|
+
const kb = await q.evaluate(() => { const r = document.querySelector('.rail').getBoundingClientRect(); return { ys: window.__ys, y: scrollY, bottom: Math.round(innerHeight - r.bottom) }; });
|
|
253
|
+
ok(`M12 at 390 px (${theme}) leaving a field settles the fixed layer: a one-pixel scroll and back, and the rail stays 12 px off the bottom`, kb.ys.length >= 2 && kb.y === y0 && kb.bottom === 12, JSON.stringify({ y0, ...kb }));
|
|
248
254
|
await R.ctx.close();
|
|
249
255
|
}
|
|
250
256
|
{
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.359.0",
|
|
4
|
+
"at": "2026-10-20T13:30:13.743Z",
|
|
5
|
+
"f": 2,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 958,
|
|
9
|
+
"t": "The phone rail returns to the bottom after the keyboard closes",
|
|
10
|
+
"s": "When a field loses focus or the keyboard closes, the bar goes back to the bottom of the screen and the dock back to the top."
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"v": "0.358.0",
|
|
16
|
+
"at": "2026-10-20T11:00:48.565Z",
|
|
17
|
+
"f": 2,
|
|
18
|
+
"prs": [
|
|
19
|
+
{
|
|
20
|
+
"n": 939,
|
|
21
|
+
"t": "Chat sessions end when idle, resume, and cap at 4 live",
|
|
22
|
+
"s": "A chat session that prints nothing for the workspace idle limit (60 minutes by default) is ended, unless its goal is started or a permission prompt is waiting."
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
2
26
|
{
|
|
3
27
|
"v": "0.357.0",
|
|
4
28
|
"at": "2026-10-20T09:57:04.765Z",
|
|
@@ -11,7 +11,7 @@ The premium Briefing is a page of its own at `/premium.html`. The console at `/`
|
|
|
11
11
|
|
|
12
12
|
Every premium page uses the console's type: Space Grotesk for text, IBM Plex Mono for times and labels, and the same sizes and weights as the console. A premium page and the console at the same place read at the same size.
|
|
13
13
|
|
|
14
|
-
A rail on the left names four places: Briefing, My work, Board and Insights. Each is a premium page.
|
|
14
|
+
A rail on the left names four places: Briefing, My work, Board and Insights. Each is a premium page. On a phone the rail is a bar at the bottom of the screen. It stays at the bottom after you type in a field and the keyboard closes.
|
|
15
15
|
|
|
16
16
|
Every premium page has the same top bar. On the left is where you are, then a round **Chat** button. On the right are the **Sources** chip, the bell and one **⋯** menu.
|
|
17
17
|
|
|
@@ -172,8 +172,11 @@ function chat({ runtimeDir, key, text, model, sessions, wsId, now = new Date() }
|
|
|
172
172
|
if (!sessions || typeof sessions.spawn !== 'function') return fail(409, 'this workspace cannot start sessions');
|
|
173
173
|
const live = chatSessionOf(runtimeDir, key);
|
|
174
174
|
const alive = !!(live && sessions.alive(live));
|
|
175
|
+
// slice 4 (PRD L2): an ended chat resumes its own Claude Code conversation when the file for it is still there
|
|
176
|
+
const prev = alive ? null : chatRecordOf(runtimeDir, key);
|
|
177
|
+
const resume = !!(prev && prev.claude && typeof sessions.hasConversation === 'function' && sessions.hasConversation(prev.claude));
|
|
175
178
|
const row = alive ? null : rowFor(model, key);
|
|
176
|
-
if (!alive && !row) return fail(404, model ? 'that row is not on the page' : 'the page has not read the repository yet');
|
|
179
|
+
if (!alive && !row && !resume) return fail(404, model ? 'that row is not on the page' : 'the page has not read the repository yet');
|
|
177
180
|
// slice 2 (PRD G2): `/goal <text>` becomes the PMOS grilling prompt, on record before it reaches the session
|
|
178
181
|
let msg = q, goal = null;
|
|
179
182
|
const cmd = Goal.parseCommand(q);
|
|
@@ -184,12 +187,40 @@ function chat({ runtimeDir, key, text, model, sessions, wsId, now = new Date() }
|
|
|
184
187
|
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
188
|
return { status: 200, body: { ok: true, session: live, started: false, ...extra } };
|
|
186
189
|
}
|
|
190
|
+
makeRoom(runtimeDir, sessions); // slice 4 (PRD L3)
|
|
191
|
+
const claude = resume ? prev.claude : crypto.randomUUID();
|
|
192
|
+
const name = 'chat: ' + clip(row ? row.title : prev.name || key, 60);
|
|
187
193
|
let s;
|
|
188
|
-
try { s = sessions.spawn({ name
|
|
194
|
+
try { s = sessions.spawn({ name, agent: 'claude', ws: wsId, origin: 'chat:' + key, chatClaude: { id: claude, resume }, initialInput: (resume ? msg : openingFor(row, msg)) + '\r' }); } catch (e) { s = { state: 'exited', note: String((e && e.message) || e).slice(0, 120) }; }
|
|
189
195
|
if (!s || s.state === 'exited' || !s.id) return fail(409, 'Claude could not start: ' + ((s && s.note) || 'no session'));
|
|
190
196
|
fs.mkdirSync(runtimeDir, { recursive: true });
|
|
191
|
-
fs.appendFileSync(path.join(runtimeDir, CHATS), JSON.stringify({ key, session: s.id, at: now.toISOString() }) + '\n');
|
|
192
|
-
return { status: 200, body: { ok: true, session: s.id, started: true, ...extra } };
|
|
197
|
+
fs.appendFileSync(path.join(runtimeDir, CHATS), JSON.stringify({ key, session: s.id, claude, name, at: now.toISOString() }) + '\n');
|
|
198
|
+
return { status: 200, body: { ok: true, session: s.id, started: true, ...(resume ? { resumed: true } : {}), ...extra } };
|
|
199
|
+
}
|
|
200
|
+
/** The last record for a key in premium-chat-sessions.jsonl ({ key, session, claude, name, at }), or null. */
|
|
201
|
+
function chatRecordOf(runtimeDir, key) {
|
|
202
|
+
let t; try { t = fs.readFileSync(path.join(runtimeDir, CHATS), 'utf8'); } catch { return null; }
|
|
203
|
+
let rec = null;
|
|
204
|
+
for (const l of t.split('\n')) { if (!l.trim()) continue; let e; try { e = JSON.parse(l); } catch { continue; } if (e && e.key === key && typeof e.session === 'string') rec = e; }
|
|
205
|
+
if (rec && !UUID_RE.test(String(rec.claude || ''))) rec = { ...rec, claude: null };
|
|
206
|
+
return rec;
|
|
207
|
+
}
|
|
208
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
209
|
+
const MAX_LIVE = 4;
|
|
210
|
+
/** Which live chat session to end so a new one fits (PRD L3), or null. rows: [{ id, origin, lastOutputAt, busy }];
|
|
211
|
+
* busy = working or waiting on a permission prompt. A session whose goal is started is never picked. */
|
|
212
|
+
function pickToEnd(rows, goalStarted, max = MAX_LIVE) {
|
|
213
|
+
const live = (Array.isArray(rows) ? rows : []).filter((r) => r && /^chat:/.test(String(r.origin || '')));
|
|
214
|
+
if (live.length < max) return null;
|
|
215
|
+
const free = live.filter((r) => !r.busy && !goalStarted(String(r.origin).slice(5)));
|
|
216
|
+
free.sort((a, b) => (Number(a.lastOutputAt) || 0) - (Number(b.lastOutputAt) || 0));
|
|
217
|
+
return free.length ? free[0].id : null;
|
|
218
|
+
}
|
|
219
|
+
function makeRoom(runtimeDir, sessions) {
|
|
220
|
+
if (typeof sessions.list !== 'function' || typeof sessions.end !== 'function') return null;
|
|
221
|
+
const id = pickToEnd(sessions.list(), (key) => { const g = Goal.goalOf(runtimeDir, key); return !!(g && g.state === 'started'); });
|
|
222
|
+
if (id) sessions.end(id);
|
|
223
|
+
return id;
|
|
193
224
|
}
|
|
194
225
|
/** A permission option ('1'…'9') or Stop ('esc'), typed into the key's live session with no Enter. */
|
|
195
226
|
function press({ runtimeDir, key, what, sessions }) {
|
|
@@ -202,4 +233,4 @@ function press({ runtimeDir, key, what, sessions }) {
|
|
|
202
233
|
return { status: 200, body: { ok: true, session: live } };
|
|
203
234
|
}
|
|
204
235
|
|
|
205
|
-
module.exports = { ask, chat, press, chatSessionOf, openingFor, threadOf, promptFor, rowFor, settle, KEY_RE, THREADS, CHATS };
|
|
236
|
+
module.exports = { ask, chat, press, chatSessionOf, chatRecordOf, pickToEnd, MAX_LIVE, openingFor, threadOf, promptFor, rowFor, settle, KEY_RE, THREADS, CHATS };
|
|
@@ -93,4 +93,20 @@ function decide(s, policy, now) {
|
|
|
93
93
|
return 'end';
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
/**
|
|
97
|
+
* premium-chat-session L1: 'end' for a live chat panel session (origin `chat:`) idle past the policy's limit, or null.
|
|
98
|
+
* A chat is the PM's own, so decide() never ends it; this one rule does, because its next message resumes the same
|
|
99
|
+
* conversation (lib/briefing-premium-agent.js). Kept while its goal is started (goalStarted) or a permission prompt waits.
|
|
100
|
+
*/
|
|
101
|
+
function decideChat(s, policy, now, goalStarted) {
|
|
102
|
+
if (!s || !/^chat:/.test(String(s.origin || '')) || s.state === 'exited' || s.autoDelete === 'never') return null;
|
|
103
|
+
const last = Number(s.lastOutputAt) || 0;
|
|
104
|
+
if (!last || !policy || !policy.idleMinutes) return null;
|
|
105
|
+
if (now - last < policy.idleMinutes * 60 * 1000) return null;
|
|
106
|
+
if (goalStarted) return null;
|
|
107
|
+
const shown = typeof s.shown === 'function' ? s.shown() : s.shown;
|
|
108
|
+
if (shown === 'blocked') return null;
|
|
109
|
+
return 'end';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
module.exports = { decideChat, isAutomatic, normalizePolicy, decide, endedCleanly, DEFAULT_POLICY, FINISH_GRACE_MS, FAILED_KEEP_MS, MANUAL_EXACT, MANUAL_PREFIX };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.359.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.359.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -426,6 +426,22 @@ export function onScroll() {
|
|
|
426
426
|
});
|
|
427
427
|
}
|
|
428
428
|
addEventListener('scroll', onScroll, { passive: true }); addEventListener('resize', onScroll);
|
|
429
|
+
/* ── the fixed layer after the phone keyboard (Wawan's phone, 2026-10-20): when the soft keyboard closes, iOS Safari can leave the fixed
|
|
430
|
+
* layer raised by the keyboard's height until the next scroll, so the rail floats over the middle of a card and the dock leaves the top.
|
|
431
|
+
* A one-pixel scroll and back makes WebKit place the layer again; anywhere else it is a no-op. ── */
|
|
432
|
+
const EDITABLE = 'input,textarea,select,[contenteditable="true"],[contenteditable=""]';
|
|
433
|
+
export function settleFixed() {
|
|
434
|
+
const y = scrollY, d = y > 0 ? -1 : 1;
|
|
435
|
+
scrollTo(scrollX, y + d); scrollTo(scrollX, y);
|
|
436
|
+
}
|
|
437
|
+
document.addEventListener('focusout', (e) => {
|
|
438
|
+
if (!(e.target instanceof Element) || !e.target.matches(EDITABLE)) return;
|
|
439
|
+
setTimeout(settleFixed, 60); setTimeout(settleFixed, 400); // the keyboard closes over ~300ms; settle as it starts and once it is gone
|
|
440
|
+
});
|
|
441
|
+
if (window.visualViewport) {
|
|
442
|
+
let kb = false;
|
|
443
|
+
visualViewport.addEventListener('resize', () => { const shut = visualViewport.height >= innerHeight - 1; if (kb && shut) settleFixed(); kb = !shut; });
|
|
444
|
+
}
|
|
429
445
|
|
|
430
446
|
/* ── the rail: Briefing, My work, Board and Insights are premium pages ── */
|
|
431
447
|
const GO = { brief: '/premium.html', work: '/premium-work.html', init: '/premium-board.html', rep: '/premium-insights.html' };
|
package/workspace/server.js
CHANGED
|
@@ -3354,6 +3354,15 @@ function sweepAutomaticSessions(now = Date.now()) {
|
|
|
3354
3354
|
done.ended.push(s.id);
|
|
3355
3355
|
} else if (act === 'remove' && !s.pty) {
|
|
3356
3356
|
if (removeSession(s.id)) done.removed.push(s.id);
|
|
3357
|
+
} else if (!act && s.pty && /^chat:/.test(String(s.origin || ''))) {
|
|
3358
|
+
// premium-chat-session L1: an idle chat ends too; its next message resumes the same conversation
|
|
3359
|
+
const goal = (() => { try { return require('./lib/goal-chat.js').goalOf(STATE, String(s.origin).slice(5)); } catch { return null; } })();
|
|
3360
|
+
if (sessionOrigin.decideChat({ ...s, shown: () => sessionShown(s, now) }, policy, now, !!(goal && goal.state === 'started')) === 'end') {
|
|
3361
|
+
s.autoEnded = true; s.note = 'ended: idle too long (chat; it resumes on its next message)';
|
|
3362
|
+
if (s.tmux) tmuxKillSession(s.tmux);
|
|
3363
|
+
try { s.pty.kill(); } catch {}
|
|
3364
|
+
done.ended.push(s.id);
|
|
3365
|
+
}
|
|
3357
3366
|
}
|
|
3358
3367
|
}
|
|
3359
3368
|
return done;
|
|
@@ -3791,6 +3800,15 @@ const chatSessions = {
|
|
|
3791
3800
|
try { firstInput.deliver(s, t + '\r'); return true; } catch { return false; }
|
|
3792
3801
|
},
|
|
3793
3802
|
keys: (id, data) => { const s = sessions.get(String(id || '')); if (!s || !s.pty || s.state === 'exited') return false; try { s.pty.write(String(data)); return true; } catch { return false; } },
|
|
3803
|
+
// slice 4 (PRD L3): the live chat sessions, so a new one can end the longest idle; busy = working or a permission prompt waits
|
|
3804
|
+
list: (now = Date.now()) => [...sessions.values()].filter((s) => /^chat:/.test(String(s.origin || '')) && s.pty && s.state !== 'exited')
|
|
3805
|
+
.map((s) => ({ id: s.id, origin: s.origin, lastOutputAt: s.lastOutputAt, busy: harness.deriveState(s.state, s.lastOutputAt, now).state === 'working' || sessionShown(s, now) === 'blocked' })),
|
|
3806
|
+
end: (id) => { const s = sessions.get(String(id || '')); if (!s || !s.pty || s.state === 'exited') return false; s.autoEnded = true; s.note = 'ended: room for a newer chat (it resumes on its next message)'; if (s.tmux) tmuxKillSession(s.tmux); try { s.pty.kill(); } catch {} return true; },
|
|
3807
|
+
// slice 4 (PRD L2): whether Claude Code still has the conversation file for this id (any project folder)
|
|
3808
|
+
hasConversation: (uuid) => {
|
|
3809
|
+
const dir = path.join(process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), '.claude'), 'projects');
|
|
3810
|
+
try { return fs.readdirSync(dir).some((p) => fs.existsSync(path.join(dir, p, String(uuid) + '.jsonl'))); } catch { return false; }
|
|
3811
|
+
},
|
|
3794
3812
|
};
|
|
3795
3813
|
|
|
3796
3814
|
/* A headless run (workspace-headless-jobs). The row is an ordinary session record, so every caller that checks a
|
|
@@ -3907,7 +3925,7 @@ function spawnSession(opts) {
|
|
|
3907
3925
|
return s;
|
|
3908
3926
|
}
|
|
3909
3927
|
function noteSessionEnd(s) { try { if (refreshRun) refreshRun.ended(s); } catch (e) { warnWriteFail('refresh log (end)', e); } }
|
|
3910
|
-
function spawnSessionInner({ name, agent, cwd, ws, origin, initialInput, profile, initiative, modelAsk, planItem, workType, autoDelete, launchFlags, addDirs, onDone, scratch, extraEnv, writePaths }) {
|
|
3928
|
+
function spawnSessionInner({ name, agent, cwd, ws, origin, initialInput, profile, initiative, modelAsk, planItem, workType, autoDelete, launchFlags, addDirs, onDone, scratch, extraEnv, writePaths, chatClaude }) {
|
|
3911
3929
|
const id = nextSessionId();
|
|
3912
3930
|
/* pm-os-absorb Run 1 — every AGENT session gets a token, `<id>.<8 hex>`, in its environment as PMOS_SESSION, and
|
|
3913
3931
|
* PMOS_BIN, this workspace's own bin/pmos.js. `pmos item` run inside it is then attributed `agent:<token>` (the token
|
|
@@ -4005,6 +4023,8 @@ function spawnSessionInner({ name, agent, cwd, ws, origin, initialInput, profile
|
|
|
4005
4023
|
* hooks post to this workspace (lib/routes-hooks.js, loopback only; the session token travels in the PMOS_SESSION env). */
|
|
4006
4024
|
// 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.
|
|
4007
4025
|
if (agent === 'claude' && /^chat:/.test(String(tag || ''))) argv.push('--settings', JSON.stringify(require('./lib/goal-chat.js').hookSettings(PORT)));
|
|
4026
|
+
// premium-chat-session L2: a chat keeps one Claude Code conversation id, so the session that replaces an ended one resumes it
|
|
4027
|
+
if (agent === 'claude' && /^chat:/.test(String(tag || '')) && chatClaude && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(String(chatClaude.id || ''))) argv.push(chatClaude.resume ? '--resume' : '--session-id', String(chatClaude.id));
|
|
4008
4028
|
else if (process.env.PMOS_AGENT_HOOKS === '1' && agent === 'claude') argv.push('--settings', JSON.stringify(require('./lib/routes-hooks.js').settingsFor(PORT)));
|
|
4009
4029
|
const launchArgs = argv;
|
|
4010
4030
|
if (mres.tier) {
|