create-pmos 0.273.0 → 0.274.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 +1 -1
- 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/lib/transcript-read.js +96 -63
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/server.js +1 -1
- package/workspace/test-lists/workspace-harness-incremental.json +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.274.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": {
|
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-18T15:23:35Z"}
|
|
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-18T15:23:35Z"}
|
|
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-18T15:23:35Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -214,48 +214,31 @@ function prettyTool(name) {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
217
|
+
* The running totals of one harness read. `feedHarness` adds complete transcript lines to it and `harnessOf` turns it into the
|
|
218
|
+
* answer, so a transcript that grew can be read from where the last read stopped instead of from its start (see readHarness).
|
|
219
219
|
*/
|
|
220
|
-
function
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const toolCounts = {};
|
|
241
|
-
let toolTotal = 0;
|
|
242
|
-
const tok = { input: 0, output: 0, cacheRead: 0, cacheCreate: 0 };
|
|
243
|
-
let sawUsage = false;
|
|
244
|
-
// For the open-call signal (R2): pair tool_use → tool_result by id in one pass. The NEWEST
|
|
245
|
-
// tool_use with no matching result is the call in flight; its record timestamp dates it. This is
|
|
246
|
-
// the same "written before its result exists" property the append-only transcript guarantees.
|
|
247
|
-
// NOTE the honesty bound lives in the CALLER (server): a dangling call on a crashed/interrupted
|
|
248
|
-
// session is a permanent phantom (measured: 2/25 real transcripts), so the age is rendered ONLY
|
|
249
|
-
// while the session's derived state is `working` — age without liveness is refused. Here we only
|
|
250
|
-
// report the raw fact {verb, sinceTs}; we never claim it is live.
|
|
251
|
-
const openUse = new Map(); // tool_use_id → { verb, ts } (insertion order = chronological)
|
|
252
|
-
const resolved = new Set(); // tool_use_ids that got a tool_result
|
|
253
|
-
// WHOSE TURN IS IT (workspace-waiting-on-you R1). The last TURN-TAKING record's role — nothing
|
|
254
|
-
// more. `ai-title` and `attachment` records are CLI bookkeeping and are deliberately not
|
|
255
|
-
// turn-taking, and neither is a SYNTHETIC assistant record: counting one as "the assistant
|
|
256
|
-
// finished speaking" is exactly how a false `needs you` would be manufactured.
|
|
257
|
-
let lastRole = null; // 'assistant' | 'user' | null
|
|
220
|
+
function newHarnessAcc() {
|
|
221
|
+
return { model: null, effort: null, turns: 0, title: null, skills: null,
|
|
222
|
+
toolCounts: {}, toolTotal: 0, tok: { input: 0, output: 0, cacheRead: 0, cacheCreate: 0 }, sawUsage: false,
|
|
223
|
+
// For the open-call signal (R2): pair tool_use → tool_result by id in one pass. The NEWEST
|
|
224
|
+
// tool_use with no matching result is the call in flight; its record timestamp dates it. This is
|
|
225
|
+
// the same "written before its result exists" property the append-only transcript guarantees.
|
|
226
|
+
// NOTE the honesty bound lives in the CALLER (server): a dangling call on a crashed/interrupted
|
|
227
|
+
// session is a permanent phantom (measured: 2/25 real transcripts), so the age is rendered ONLY
|
|
228
|
+
// while the session's derived state is `working` — age without liveness is refused. Here we only
|
|
229
|
+
// report the raw fact {verb, sinceTs}; we never claim it is live.
|
|
230
|
+
// A pair is dropped as soon as both halves are seen, so these hold only the calls still open (and a result whose call
|
|
231
|
+
// lies before the window): a long transcript does not make them grow.
|
|
232
|
+
openUse: new Map(), // tool_use_id → { verb, ts } (insertion order = chronological)
|
|
233
|
+
resolved: new Set(), // tool_result ids whose tool_use has not been seen
|
|
234
|
+
// WHOSE TURN IS IT (workspace-waiting-on-you R1). The last TURN-TAKING record's role — nothing
|
|
235
|
+
// more. `ai-title` and `attachment` records are CLI bookkeeping and are deliberately not
|
|
236
|
+
// turn-taking, and neither is a SYNTHETIC assistant record: counting one as "the assistant
|
|
237
|
+
// finished speaking" is exactly how a false `needs you` would be manufactured.
|
|
238
|
+
lastRole: null }; // 'assistant' | 'user' | null
|
|
239
|
+
}
|
|
258
240
|
|
|
241
|
+
function feedHarness(acc, raw, clean) {
|
|
259
242
|
for (const line of raw.split('\n')) {
|
|
260
243
|
if (!line) continue;
|
|
261
244
|
let r;
|
|
@@ -264,22 +247,24 @@ function readHarness(file, clean = (x) => x) {
|
|
|
264
247
|
// session carries exactly one, no timestamp), so the UI labels it "opening focus", never
|
|
265
248
|
// "current". Last one wins in case the layout ever changes.
|
|
266
249
|
if (r.type === 'ai-title') {
|
|
267
|
-
if (typeof r.aiTitle === 'string' && r.aiTitle.trim())
|
|
250
|
+
if (typeof r.aiTitle === 'string' && r.aiTitle.trim()) acc.title = clean(r.aiTitle.trim());
|
|
268
251
|
continue;
|
|
269
252
|
}
|
|
270
253
|
// tool_result blocks live inside `user` records; harvest the ids they resolve.
|
|
271
254
|
if (r.type === 'user') {
|
|
272
255
|
const um = r.message || {};
|
|
273
256
|
for (const c of (Array.isArray(um.content) ? um.content : [])) {
|
|
274
|
-
if (c && c.type === 'tool_result' && c.tool_use_id)
|
|
257
|
+
if (c && c.type === 'tool_result' && c.tool_use_id) {
|
|
258
|
+
if (!acc.openUse.delete(c.tool_use_id)) acc.resolved.add(c.tool_use_id);
|
|
259
|
+
}
|
|
275
260
|
}
|
|
276
|
-
lastRole = 'user';
|
|
261
|
+
acc.lastRole = 'user'; // a prompt was submitted, or a tool result landed
|
|
277
262
|
continue;
|
|
278
263
|
}
|
|
279
264
|
if (r.type === 'attachment') {
|
|
280
265
|
const a = r.attachment || {};
|
|
281
266
|
if (a.type === 'skill_listing' && typeof a.skillCount === 'number') {
|
|
282
|
-
|
|
267
|
+
acc.skills = {
|
|
283
268
|
count: a.skillCount,
|
|
284
269
|
names: Array.isArray(a.names) ? a.names.slice(0, 40).map((n) => clean(String(n))) : [],
|
|
285
270
|
};
|
|
@@ -289,34 +274,37 @@ function readHarness(file, clean = (x) => x) {
|
|
|
289
274
|
if (r.type !== 'assistant') continue;
|
|
290
275
|
const m = r.message || {};
|
|
291
276
|
if (m.model && m.model !== SYNTHETIC) {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
lastRole = 'assistant';
|
|
295
|
-
if (r.effort)
|
|
277
|
+
acc.model = clean(m.model);
|
|
278
|
+
acc.turns++; // only real model turns count
|
|
279
|
+
acc.lastRole = 'assistant'; // ...and only a real turn takes the turn
|
|
280
|
+
if (r.effort) acc.effort = clean(String(r.effort));
|
|
296
281
|
}
|
|
297
282
|
const u = m.usage || {};
|
|
298
283
|
if (typeof u.input_tokens === 'number' || typeof u.output_tokens === 'number') {
|
|
299
|
-
sawUsage = true;
|
|
300
|
-
tok.input += u.input_tokens || 0;
|
|
301
|
-
tok.output += u.output_tokens || 0;
|
|
302
|
-
tok.cacheRead += u.cache_read_input_tokens || 0;
|
|
303
|
-
tok.cacheCreate += u.cache_creation_input_tokens || 0;
|
|
284
|
+
acc.sawUsage = true;
|
|
285
|
+
acc.tok.input += u.input_tokens || 0;
|
|
286
|
+
acc.tok.output += u.output_tokens || 0;
|
|
287
|
+
acc.tok.cacheRead += u.cache_read_input_tokens || 0;
|
|
288
|
+
acc.tok.cacheCreate += u.cache_creation_input_tokens || 0;
|
|
304
289
|
}
|
|
305
290
|
for (const c of (m.content || [])) {
|
|
306
291
|
if (c && c.type === 'tool_use' && c.name) {
|
|
307
292
|
const name = clean(prettyTool(c.name));
|
|
308
|
-
toolCounts[name] = (toolCounts[name] || 0) + 1;
|
|
309
|
-
toolTotal++;
|
|
310
|
-
if (c.id) openUse.set(c.id, { verb: name, ts: r.timestamp || null });
|
|
293
|
+
acc.toolCounts[name] = (acc.toolCounts[name] || 0) + 1;
|
|
294
|
+
acc.toolTotal++;
|
|
295
|
+
if (c.id && !acc.resolved.delete(c.id)) acc.openUse.set(c.id, { verb: name, ts: r.timestamp || null });
|
|
311
296
|
}
|
|
312
297
|
}
|
|
313
298
|
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function harnessOf(acc) {
|
|
302
|
+
const out = { model: acc.model, effort: acc.effort, turns: acc.turns, tokens: null, tools: null, skills: acc.skills,
|
|
303
|
+
title: acc.title, openCall: null, turn: null, missing: {} };
|
|
314
304
|
|
|
315
305
|
// The newest tool_use with no matching tool_result is the call in flight (R2). Map preserves
|
|
316
306
|
// insertion (chronological) order, so the last unresolved entry is the newest.
|
|
317
|
-
for (const [
|
|
318
|
-
if (!resolved.has(id)) out.openCall = { verb: info.verb, sinceTs: info.ts };
|
|
319
|
-
}
|
|
307
|
+
for (const [, info] of acc.openUse) out.openCall = { verb: info.verb, sinceTs: info.ts };
|
|
320
308
|
|
|
321
309
|
// ── Whose turn (R1). Derived here, from what the pass already collected — no second walk. ──
|
|
322
310
|
// The ORDER of these three branches is the honesty property the whole feature rests on (R4).
|
|
@@ -327,18 +315,18 @@ function readHarness(file, clean = (x) => x) {
|
|
|
327
315
|
// the phantom: a value it cannot construct. Reordering these branches silently converts a
|
|
328
316
|
// corpse into "waiting on you", which is the one lie this surface must not tell.
|
|
329
317
|
if (out.openCall) out.turn = 'tool'; // awaiting a tool — OR the PM's approval of one
|
|
330
|
-
else if (lastRole === 'assistant') out.turn = 'user'; // the model stopped; the human is up
|
|
331
|
-
else if (lastRole === 'user') out.turn = 'agent'; // a prompt/result landed; the model is up
|
|
318
|
+
else if (acc.lastRole === 'assistant') out.turn = 'user'; // the model stopped; the human is up
|
|
319
|
+
else if (acc.lastRole === 'user') out.turn = 'agent'; // a prompt/result landed; the model is up
|
|
332
320
|
// else: null — nothing turn-taking was parseable, so no claim is made.
|
|
333
321
|
|
|
334
322
|
if (!out.model) out.missing.model = 'the transcript names no model yet';
|
|
335
323
|
if (!out.effort) out.missing.effort = 'the transcript records no effort level';
|
|
336
|
-
if (toolTotal) out.tools = { counts: toolCounts, total: toolTotal };
|
|
324
|
+
if (acc.toolTotal) out.tools = { counts: { ...acc.toolCounts }, total: acc.toolTotal };
|
|
337
325
|
else out.missing.tools = 'no tool calls in the transcript yet';
|
|
338
326
|
// Tokens are reported as ABSOLUTE counts and never as a percentage: the context window size
|
|
339
327
|
// is not in the record, and autocompaction makes the running total move backward. A percentage
|
|
340
328
|
// of an unknown denominator is not a quantity — that refusal predates this module and stands.
|
|
341
|
-
if (sawUsage) out.tokens = tok;
|
|
329
|
+
if (acc.sawUsage) out.tokens = { ...acc.tok };
|
|
342
330
|
else out.missing.tokens = 'the transcript records no token usage yet';
|
|
343
331
|
if (!out.skills) out.missing.skills = 'the CLI listed no skills for this session';
|
|
344
332
|
if (!out.turns) out.missing.turns = 'no model turns in the transcript yet';
|
|
@@ -353,6 +341,51 @@ function readHarness(file, clean = (x) => x) {
|
|
|
353
341
|
return out;
|
|
354
342
|
}
|
|
355
343
|
|
|
344
|
+
/**
|
|
345
|
+
* Read the harness out of a transcript. `clean` is server.js's scrub() — every string that can
|
|
346
|
+
* reach the screen goes through it (D08), because tool names and skill names are free text.
|
|
347
|
+
*
|
|
348
|
+
* `cache` is optional and belongs to one session: an object the caller keeps and passes back on every read. A transcript only
|
|
349
|
+
* grows, so with it a read parses just the bytes written since the last one, where without it every read parses the last
|
|
350
|
+
* MAX_BYTES (8 MB, about 100 ms) again. The first read is the same windowed read as before, and the answer is the same as a
|
|
351
|
+
* windowed read for a transcript under MAX_BYTES; past that, the totals count from the window the first read began at, where
|
|
352
|
+
* a fresh read counts the last MAX_BYTES. A file that is shorter than where the last read stopped (replaced, truncated) is
|
|
353
|
+
* read afresh.
|
|
354
|
+
*/
|
|
355
|
+
function readHarness(file, clean = (x) => x, cache = null) {
|
|
356
|
+
let acc;
|
|
357
|
+
try {
|
|
358
|
+
const st = fs.statSync(file);
|
|
359
|
+
const resume = !!(cache && cache.file === file && cache.acc && cache.ino === st.ino && cache.offset <= st.size);
|
|
360
|
+
const start = resume ? cache.offset : Math.max(0, st.size - MAX_BYTES);
|
|
361
|
+
const len = st.size - start;
|
|
362
|
+
let buf = Buffer.alloc(0);
|
|
363
|
+
if (len > 0) {
|
|
364
|
+
const fd = fs.openSync(file, 'r');
|
|
365
|
+
try {
|
|
366
|
+
buf = Buffer.allocUnsafe(len);
|
|
367
|
+
fs.readSync(fd, buf, 0, len, start);
|
|
368
|
+
} finally { fs.closeSync(fd); }
|
|
369
|
+
}
|
|
370
|
+
let from = 0;
|
|
371
|
+
if (!resume && start > 0) from = buf.indexOf(10) + 1; // drop a partial first line
|
|
372
|
+
let to = buf.length;
|
|
373
|
+
if (cache) {
|
|
374
|
+
// only whole lines are consumed: the CLI may be part-way through writing the last one, and it is read on a later call
|
|
375
|
+
to = Math.max(from, buf.lastIndexOf(10) + 1);
|
|
376
|
+
cache.file = file; cache.ino = st.ino; cache.offset = start + to;
|
|
377
|
+
}
|
|
378
|
+
if (resume) acc = cache.acc;
|
|
379
|
+
else { acc = newHarnessAcc(); if (cache) cache.acc = acc; }
|
|
380
|
+
feedHarness(acc, buf.toString('utf8', from, to), clean);
|
|
381
|
+
} catch {
|
|
382
|
+
if (cache) { cache.file = null; cache.acc = null; cache.offset = 0; }
|
|
383
|
+
return { model: null, effort: null, turns: 0, tokens: null, tools: null, skills: null,
|
|
384
|
+
title: null, openCall: null, turn: null, missing: { all: "can't read the harness — the transcript could not be read" } };
|
|
385
|
+
}
|
|
386
|
+
return harnessOf(acc);
|
|
387
|
+
}
|
|
388
|
+
|
|
356
389
|
/* ── The conversation (console3's session panel) ──────────────────────────────────────────────
|
|
357
390
|
* The PM's prompts and the agent's words, read from the same transcript, so the panel can show the
|
|
358
391
|
* conversation without parsing terminal bytes. Only what a person would call the conversation:
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.274.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.274.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
|
@@ -3087,7 +3087,7 @@ function transcriptHarness(s) {
|
|
|
3087
3087
|
// because the harness is near-static within a run (the leg-A finding that made it a drill-in and
|
|
3088
3088
|
// not a rail). The state dot and the quiet clock do NOT go through here and are never floored.
|
|
3089
3089
|
if (s.tx && (now - (s.txReadAt || 0)) < TX_REREAD_MS) return s.tx;
|
|
3090
|
-
const h = transcript.readHarness(found.file, scrub);
|
|
3090
|
+
const h = transcript.readHarness(found.file, scrub, s.txCache || (s.txCache = {}));
|
|
3091
3091
|
s.txReadAt = now;
|
|
3092
3092
|
h.cliVersion = found.version || null;
|
|
3093
3093
|
s.tx = h; s.txStamp = stamp;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "workspace-harness-incremental: a working agent's transcript is read from where the last read stopped, and the answer equals a fresh read (harness-incremental).",
|
|
3
|
+
"modules": ["harness-incremental.test.js"],
|
|
4
|
+
"seconds": { "harness-incremental.test.js": 1 }
|
|
5
|
+
}
|