create-pmos 0.357.0 → 0.358.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 +13 -13
- 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/changelog.json +12 -0
- 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/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.358.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.358.0",
|
|
37
|
+
"at": "2026-10-20T11:00:48.565Z",
|
|
38
|
+
"f": 2,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 939,
|
|
42
|
+
"t": "Chat sessions end when idle, resume, and cap at 4 live",
|
|
43
|
+
"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."
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
35
47
|
{
|
|
36
48
|
"v": "0.357.0",
|
|
37
49
|
"at": "2026-10-20T09:57:04.765Z",
|
|
@@ -279,18 +291,6 @@
|
|
|
279
291
|
"s": "Every chat panel session starts with a Claude Code Stop hook."
|
|
280
292
|
}
|
|
281
293
|
]
|
|
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-20T11:00:45Z"}
|
|
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-20T11:00:45Z"}
|
|
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-20T11:00:45Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.358.0",
|
|
4
|
+
"at": "2026-10-20T11:00:48.565Z",
|
|
5
|
+
"f": 2,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 939,
|
|
9
|
+
"t": "Chat sessions end when idle, resume, and cap at 4 live",
|
|
10
|
+
"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."
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
2
14
|
{
|
|
3
15
|
"v": "0.357.0",
|
|
4
16
|
"at": "2026-10-20T09:57:04.765Z",
|
|
@@ -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.358.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.358.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
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) {
|