create-pmos 0.809.0 → 0.811.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 +31 -88
- 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 +30 -20
- package/workspace/guide/cli.md +1 -0
- package/workspace/lib/outcomes.js +8 -0
- package/workspace/lib/today-log.js +8 -5
- package/workspace/lib/try-it.js +62 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/test-lists/try-answers-as-evidence.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.811.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": {
|
|
@@ -33,6 +33,34 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.811.0",
|
|
38
|
+
"at": "2026-11-25T06:16:01.641Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1857,
|
|
43
|
+
"t": "Undo on a read line gives back every typed word (job #1845 fix round)",
|
|
44
|
+
"s": "Undo on a read line gives back every typed word (job #1845 fix round)",
|
|
45
|
+
"k": "fix",
|
|
46
|
+
"i": "capture-words-to-fields"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"v": "0.810.0",
|
|
52
|
+
"at": "2026-11-25T05:54:34.966Z",
|
|
53
|
+
"f": 4,
|
|
54
|
+
"prs": [
|
|
55
|
+
{
|
|
56
|
+
"n": 1853,
|
|
57
|
+
"t": "Try-it answers count as outcome evidence (job #1837, A487)",
|
|
58
|
+
"s": "Try-it answers count as outcome evidence (job #1837, A487)",
|
|
59
|
+
"k": "new",
|
|
60
|
+
"i": "try-answers-as-evidence"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
36
64
|
{
|
|
37
65
|
"v": "0.809.0",
|
|
38
66
|
"at": "2026-11-25T05:38:37.920Z",
|
|
@@ -42,16 +70,7 @@
|
|
|
42
70
|
"n": 1849,
|
|
43
71
|
"t": "Warn when an experiment cannot conclude by its check date (job #1840, A404)",
|
|
44
72
|
"s": "Warn when an experiment cannot conclude by its check date (job #1840, A404)",
|
|
45
|
-
"k": "new"
|
|
46
|
-
"try": {
|
|
47
|
-
"steps": [
|
|
48
|
-
"On Work, open an initiative whose record has baseline: 10%, min_change: 1pp, weekly_traffic: 500 and outcome_horizon a week away.",
|
|
49
|
-
"Look at the Overview's lines.",
|
|
50
|
-
"Change weekly_traffic to 50000 and open the popup again."
|
|
51
|
-
],
|
|
52
|
-
"see": "First the Overview shows 'It cannot conclude by <date>: it needs about 30,000 people, 60 weeks at 500 a week.' from the record; with 50,000 a week the line is gone.",
|
|
53
|
-
"open": "/premium-board.html"
|
|
54
|
-
}
|
|
73
|
+
"k": "new"
|
|
55
74
|
},
|
|
56
75
|
{
|
|
57
76
|
"n": 1848,
|
|
@@ -69,16 +88,7 @@
|
|
|
69
88
|
"n": 1850,
|
|
70
89
|
"t": "Kill lines are read like outcome checks (job #1843, A530)",
|
|
71
90
|
"s": "Kill lines are read like outcome checks (job #1843, A530)",
|
|
72
|
-
"k": "new"
|
|
73
|
-
"try": {
|
|
74
|
-
"steps": [
|
|
75
|
-
"On Today, find the ✦ 'Stop <initiative>? Kill line met' for an initiative whose kill line names a number its goal's reading passed.",
|
|
76
|
-
"Read its line and source, then press ✓.",
|
|
77
|
-
"Press Undo."
|
|
78
|
-
],
|
|
79
|
-
"see": "✓ stops the initiative (it leaves Work's open list) and Undo brings it back; ✕ keeps it going and the ✦ does not come back for that kill line.",
|
|
80
|
-
"open": "/today.html"
|
|
81
|
-
}
|
|
91
|
+
"k": "new"
|
|
82
92
|
}
|
|
83
93
|
]
|
|
84
94
|
},
|
|
@@ -364,73 +374,6 @@
|
|
|
364
374
|
"k": "new"
|
|
365
375
|
}
|
|
366
376
|
]
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
"v": "0.787.0",
|
|
370
|
-
"at": "2026-11-24T17:51:02.745Z",
|
|
371
|
-
"f": 4,
|
|
372
|
-
"prs": [
|
|
373
|
-
{
|
|
374
|
-
"n": 1772,
|
|
375
|
-
"t": "Find every feature — PMOS / commands, typed-words suggestion and What PMOS can do",
|
|
376
|
-
"s": "Find every feature — PMOS / commands, typed-words suggestion and What PMOS can do",
|
|
377
|
-
"k": "new",
|
|
378
|
-
"h": "Find every feature — PMOS / commands, typed-words suggestion and What PMOS can do",
|
|
379
|
-
"try": {
|
|
380
|
-
"steps": [
|
|
381
|
-
"On Today, type / in the chat and pick Why this work exists",
|
|
382
|
-
"Type 'what if the API task slips a week' and press Tab on the suggestion",
|
|
383
|
-
"Press Ctrl+K, type features, and open What PMOS can do"
|
|
384
|
-
],
|
|
385
|
-
"see": "The / menu lists PMOS commands first, each with its name and one line; the typed sentence turns into /rehearse; the directory lists features by job with New since you last looked on top",
|
|
386
|
-
"open": "/today.html"
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
]
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
"v": "0.786.0",
|
|
393
|
-
"at": "2026-11-24T17:39:55.270Z",
|
|
394
|
-
"f": 4,
|
|
395
|
-
"prs": [
|
|
396
|
-
{
|
|
397
|
-
"n": 1779,
|
|
398
|
-
"t": "A weekly sweep of quiet work — keep, park or close each initiative quiet 30 days",
|
|
399
|
-
"s": "A weekly sweep of quiet work — keep, park or close each initiative quiet 30 days",
|
|
400
|
-
"k": "new",
|
|
401
|
-
"h": "A weekly sweep of quiet work — keep, park or close each initiative quiet 30 days",
|
|
402
|
-
"try": {
|
|
403
|
-
"steps": [
|
|
404
|
-
"Open Today and press the row that says how many initiatives are quiet 30 days or more",
|
|
405
|
-
"Press Park on one row, then Undo in the message",
|
|
406
|
-
"Open Work and find an initiative you parked or closed"
|
|
407
|
-
],
|
|
408
|
-
"see": "One list of quiet initiatives, most quiet first, each with Keep, Park and Close; the row leaves the list at once, Undo puts it back, and Work shows the parked one on hold",
|
|
409
|
-
"open": "/today.html"
|
|
410
|
-
}
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
"n": 1788,
|
|
414
|
-
"t": "The One change block on a past sprint (sprint-retro-one-change, step 2)",
|
|
415
|
-
"s": "The One change block on a past sprint (sprint-retro-one-change, step 2)",
|
|
416
|
-
"k": "new",
|
|
417
|
-
"h": "The One change block on a past sprint (sprint-retro-one-change, step 2)",
|
|
418
|
-
"try": {
|
|
419
|
-
"steps": [
|
|
420
|
-
"Open Work, then Backlog, and press the sprint name to pick a past sprint",
|
|
421
|
-
"Read the One change block beside Lessons, or ask the chat on Today: what was the retro of our last sprint?"
|
|
422
|
-
],
|
|
423
|
-
"see": "The block (and the chat) give done of total, why work was carried (never started, started, in review, carried twice, added after the start), names one change for the next sprint, and for a sprint…",
|
|
424
|
-
"open": "/premium-board.html"
|
|
425
|
-
}
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
"n": 1789,
|
|
429
|
-
"t": "A published read-only Board opens no live stream",
|
|
430
|
-
"s": "A published read-only Board opens no live stream",
|
|
431
|
-
"k": "fix"
|
|
432
|
-
}
|
|
433
|
-
]
|
|
434
377
|
}
|
|
435
378
|
]
|
|
436
379
|
}
|
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-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T06:15:57Z"}
|
|
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-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T06:15:57Z"}
|
|
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-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T06:15:57Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.811.0",
|
|
4
|
+
"at": "2026-11-25T06:16:01.641Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1857,
|
|
9
|
+
"t": "Undo on a read line gives back every typed word (job #1845 fix round)",
|
|
10
|
+
"s": "Undo on a read line gives back every typed word (job #1845 fix round)",
|
|
11
|
+
"k": "fix",
|
|
12
|
+
"i": "capture-words-to-fields"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"v": "0.810.0",
|
|
18
|
+
"at": "2026-11-25T05:54:34.966Z",
|
|
19
|
+
"f": 4,
|
|
20
|
+
"prs": [
|
|
21
|
+
{
|
|
22
|
+
"n": 1853,
|
|
23
|
+
"t": "Try-it answers count as outcome evidence (job #1837, A487)",
|
|
24
|
+
"s": "Try-it answers count as outcome evidence (job #1837, A487)",
|
|
25
|
+
"k": "new",
|
|
26
|
+
"i": "try-answers-as-evidence"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
2
30
|
{
|
|
3
31
|
"v": "0.809.0",
|
|
4
32
|
"at": "2026-11-25T05:38:37.920Z",
|
|
@@ -8,16 +36,7 @@
|
|
|
8
36
|
"n": 1849,
|
|
9
37
|
"t": "Warn when an experiment cannot conclude by its check date (job #1840, A404)",
|
|
10
38
|
"s": "Warn when an experiment cannot conclude by its check date (job #1840, A404)",
|
|
11
|
-
"k": "new"
|
|
12
|
-
"try": {
|
|
13
|
-
"steps": [
|
|
14
|
-
"On Work, open an initiative whose record has baseline: 10%, min_change: 1pp, weekly_traffic: 500 and outcome_horizon a week away.",
|
|
15
|
-
"Look at the Overview's lines.",
|
|
16
|
-
"Change weekly_traffic to 50000 and open the popup again."
|
|
17
|
-
],
|
|
18
|
-
"see": "First the Overview shows 'It cannot conclude by <date>: it needs about 30,000 people, 60 weeks at 500 a week.' from the record; with 50,000 a week the line is gone.",
|
|
19
|
-
"open": "/premium-board.html"
|
|
20
|
-
}
|
|
39
|
+
"k": "new"
|
|
21
40
|
},
|
|
22
41
|
{
|
|
23
42
|
"n": 1848,
|
|
@@ -35,16 +54,7 @@
|
|
|
35
54
|
"n": 1850,
|
|
36
55
|
"t": "Kill lines are read like outcome checks (job #1843, A530)",
|
|
37
56
|
"s": "Kill lines are read like outcome checks (job #1843, A530)",
|
|
38
|
-
"k": "new"
|
|
39
|
-
"try": {
|
|
40
|
-
"steps": [
|
|
41
|
-
"On Today, find the ✦ 'Stop <initiative>? Kill line met' for an initiative whose kill line names a number its goal's reading passed.",
|
|
42
|
-
"Read its line and source, then press ✓.",
|
|
43
|
-
"Press Undo."
|
|
44
|
-
],
|
|
45
|
-
"see": "✓ stops the initiative (it leaves Work's open list) and Undo brings it back; ✕ keeps it going and the ✦ does not come back for that kill line.",
|
|
46
|
-
"open": "/today.html"
|
|
47
|
-
}
|
|
57
|
+
"k": "new"
|
|
48
58
|
}
|
|
49
59
|
]
|
|
50
60
|
},
|
package/workspace/guide/cli.md
CHANGED
|
@@ -294,6 +294,7 @@ On a computer that follows the beta line, each update brings a short list of cha
|
|
|
294
294
|
|
|
295
295
|
- `pmos try` (or `pmos try list`) lists the changes to try, newest first: what changed, 1 to 3 steps, what you should see, and the page to open.
|
|
296
296
|
- `pmos try works <n>`, `pmos try broken <n> [--note "…"]` and `pmos try note <n> --note "…"` keep your answer. `<n>` is the number in the list. `pmos try undo <n>` takes it back.
|
|
297
|
+
- An answer to a change whose pull request names its initiative also counts as evidence for that initiative. The factory writes it to the repository's `planning/runs/try-evidence.jsonl`, and the initiative's outcome check shows it, with the version, the pull request and the date. `pmos try undo <n>` takes it out of the check too.
|
|
297
298
|
- `pmos try later` hides Today's row until tomorrow. `pmos try count` prints the percent of recent changes you answered.
|
|
298
299
|
- Your answers stay on this computer. A computer on the GA line has no list.
|
|
299
300
|
|
|
@@ -357,6 +357,14 @@ function dueDraft(S, it) {
|
|
|
357
357
|
const claims = [claim(`It expects: ${clip(it.metric, 160)}`, [recSrc(S, it, 'outcome_metric', 'Expected outcome')]),
|
|
358
358
|
claim(`Its check date was ${short(it.horizon)}`, [recSrc(S, it, 'outcome_horizon', 'Check date')])];
|
|
359
359
|
if (p) claims.push(claim('The PRD says what success looks like', [p.source]));
|
|
360
|
+
// try-answers-as-evidence (job #1837): what the PM said when they tried the change on a beta computer, each with its ledger line
|
|
361
|
+
let tries = [];
|
|
362
|
+
try { tries = require('./try-it.js').evidenceFor(S.root, it.id); } catch { tries = []; }
|
|
363
|
+
for (const t of tries.slice(0, 3)) {
|
|
364
|
+
const said = t.verdict === 'works' ? 'it works' : t.verdict === 'broken' ? 'it did not work' : 'a note';
|
|
365
|
+
claims.push(claim(`Tried ${t.v || 'the change'}${t.pr ? ' (#' + t.pr + ')' : ''} on ${short(t.date)}: ${said}${t.note ? ': ' + clip(t.note, 100) : ''}`,
|
|
366
|
+
[{ label: 'Try it answer', ref: t.ref, quote: t.quote }]));
|
|
367
|
+
}
|
|
360
368
|
return {
|
|
361
369
|
id: `outcome-due:${it.id}`, title: `Check the outcome of ${clip(it.title, 80)}`, confidence: 'medium', claims,
|
|
362
370
|
say: `Its check date passed on ${short(it.horizon)}. Did "${clip(it.metric, 120)}" happen? Tell me worked, didn't work or can't tell yet, and what shows it, and I'll record it.`,
|
|
@@ -127,13 +127,15 @@ function cutOut(t, cut) {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/** The whole reading of one typed line. PURE → { bullet, text, first, time, for, owner, waiting, read: [field] } | null
|
|
130
|
-
* `for` is the day the line is for when the words name a later day ('' otherwise); `read` names the fields the words gave, for the chips
|
|
130
|
+
* `for` is the day the line is for when the words name a later day ('' otherwise); `read` names the fields the words gave, for the chips;
|
|
131
|
+
* `typed` is the line as typed when the reading cut words out of it, so the mark `plain` gives every word back. */
|
|
131
132
|
function readWords(text, { day } = {}) {
|
|
132
133
|
const e = parseEntry(text);
|
|
133
134
|
if (!e) return null;
|
|
134
135
|
let t = e.text, bullet = e.bullet, time = e.time, read = [];
|
|
135
136
|
const typed = /^\s*!?\s*[o○•\-–—]\s/.test(String(text == null ? '' : text)); // a typed bullet is the PM's word, not the rules'
|
|
136
137
|
if (!typed && NOTE_RE.test(t)) { bullet = 'note'; t = t.replace(NOTE_RE, '').trim(); read.push('kind'); }
|
|
138
|
+
const words = t; // the line as typed (a "note:" word aside): what the Undo gives back
|
|
137
139
|
const D = dateWords(t, day);
|
|
138
140
|
if (D) t = cutOut(t, D.cut);
|
|
139
141
|
const T = time ? null : timeWords(t);
|
|
@@ -145,7 +147,8 @@ function readWords(text, { day } = {}) {
|
|
|
145
147
|
if (T) read.push('time');
|
|
146
148
|
if (owner) read.push('owner');
|
|
147
149
|
const forDay = D && DAY_RE.test(String(day || '')) && D.date > day ? D.date : '';
|
|
148
|
-
|
|
150
|
+
const cutText = t.slice(0, MAX_TEXT);
|
|
151
|
+
return { bullet, text: cutText, ...(words !== cutText ? { typed: words.slice(0, MAX_TEXT) } : {}), first: e.first, time: bullet === 'event' ? time : null, for: forDay, owner, waiting: !!owner, read };
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
/** One line the PM typed. A leading "!" marks it first; "o " or "○ " makes it an event, "- " or "– " a note, "• " or nothing a task.
|
|
@@ -178,7 +181,7 @@ function addEvent(body, day, id) {
|
|
|
178
181
|
const bullet = body.bullet || e.bullet;
|
|
179
182
|
const read = body.bullet ? (e.read || []).filter((f) => f !== 'kind') : (e.read || []); // a bullet the page sent wins over the rules
|
|
180
183
|
return { event: { event: 'added', id, day, bullet, text: e.text, first: !!(body.first || e.first), time: bullet === 'event' ? e.time : null,
|
|
181
|
-
...(e.for ? { for: e.for } : {}), ...(e.owner ? { owner: e.owner, waiting: !!e.waiting } : {}), ...(read.length ? { read } : {}) } };
|
|
184
|
+
...(e.typed ? { typed: e.typed } : {}), ...(e.for ? { for: e.for } : {}), ...(e.owner ? { owner: e.owner, waiting: !!e.waiting } : {}), ...(read.length ? { read } : {}) } };
|
|
182
185
|
}
|
|
183
186
|
|
|
184
187
|
/** The line POST /api/today-log/mark appends. body: { key, act, day, until? (later), snap? { title, work, job } (done: what the row
|
|
@@ -225,7 +228,7 @@ function fold(lines, day) {
|
|
|
225
228
|
// quiet-rows: the day's line rows per product; only the day asked for, the latest line of a product wins
|
|
226
229
|
if (ev.event === 'fix') { if (ev.day === d && Array.isArray(ev.keys) && WS_RE.test(String(ev.ws == null ? '' : ev.ws))) fixed[String(ev.ws || '')] = ev.keys.filter((k) => KEY_RE.test(String(k))).slice(0, FIX_MAX); continue; }
|
|
227
230
|
if (ev.event === 'added' && ID_RE.test(String(ev.id || '')) && BULLETS.includes(ev.bullet)) {
|
|
228
|
-
own.set(ev.id, { id: ev.id, key: 'own:' + ev.id, bullet: ev.bullet, text: String(ev.text || ''), first: !!ev.first, time: ev.time || null, day: ev.day, at: ev.at || null,
|
|
231
|
+
own.set(ev.id, { id: ev.id, key: 'own:' + ev.id, bullet: ev.bullet, text: String(ev.text || ''), typed: String(ev.typed || '').slice(0, MAX_TEXT), first: !!ev.first, time: ev.time || null, day: ev.day, at: ev.at || null,
|
|
229
232
|
for: DAY_RE.test(String(ev.for || '')) ? ev.for : '', owner: String(ev.owner || '').slice(0, 60), waiting: !!ev.waiting, read: Array.isArray(ev.read) ? ev.read.filter((f) => READ.includes(f)) : [] });
|
|
230
233
|
continue;
|
|
231
234
|
}
|
|
@@ -247,7 +250,7 @@ function fold(lines, day) {
|
|
|
247
250
|
const m = marks[e.key] || {};
|
|
248
251
|
if (m.dropped) continue;
|
|
249
252
|
if (m.doneBefore && !m.done) continue;
|
|
250
|
-
if (m.plain) { entries.push({ ...e, bullet: e.bullet === 'note' ? 'note' : 'task', time: null, for: '', owner: '', waiting: false, read: [], done: !!m.done }); continue; }
|
|
253
|
+
if (m.plain) { entries.push({ ...e, text: e.typed || e.text, bullet: e.bullet === 'note' ? 'note' : 'task', time: null, for: '', owner: '', waiting: false, read: [], done: !!m.done }); continue; }
|
|
251
254
|
// the words named a later day: the line shows on the day it was typed (its chips and the Undo) and from that day on, not in between
|
|
252
255
|
if (e.for && e.for > d && e.day !== d) continue;
|
|
253
256
|
entries.push({ ...e, done: !!m.done });
|
package/workspace/lib/try-it.js
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
* answer(dir, { key, verdict, note }, list) → { ok, line } | { ok: false, error } refuses a key the list does not hold
|
|
20
20
|
* count(lines, changes, now) → { tried, answered, pct } PURE, the health number
|
|
21
21
|
* rowOf(list, { later, today }) → the Home row or null PURE (public/pm/try-view.js has the same rule for the page)
|
|
22
|
+
* evidenceOf(lines) PURE · recordEvidence(root, lines) · evidenceFor(root, initiative) try-it answers as outcome evidence
|
|
23
|
+
* (try-answers-as-evidence, job #1837): <repo>/planning/runs/try-evidence.jsonl, append-only
|
|
22
24
|
* CLI: pmos try [list|works|broken|note|undo|later|count] … (run), and node lib/try-it.js count (the health number on its last line) */
|
|
23
25
|
const fs = require('fs');
|
|
24
26
|
const path = require('path');
|
|
@@ -34,6 +36,8 @@ const localDay = (t = Date.now()) => { const d = new Date(t); return new Date(d.
|
|
|
34
36
|
const vnum = (v) => String(v || '').split('-')[0].split('.').map((x) => Number(x) || 0);
|
|
35
37
|
const vcmp = (a, b) => { const A = vnum(a), B = vnum(b); for (let i = 0; i < 3; i++) if ((A[i] || 0) !== (B[i] || 0)) return (A[i] || 0) - (B[i] || 0); return 0; };
|
|
36
38
|
const str = (x, max) => (typeof x === 'string' ? x.replace(/\s+/g, ' ').trim().slice(0, max) : '');
|
|
39
|
+
const INI_RE = /^[a-z0-9][a-z0-9-]{0,99}$/; // an initiative id (try-answers-as-evidence)
|
|
40
|
+
const EVIDENCE = 'try-evidence.jsonl'; // in the repository's runs folder: planning/runs/, or pmos/state/ in a kit layout
|
|
37
41
|
const OPEN_RE = /^\/(?!\/)[A-Za-z0-9._~!$&'()*+,;=:@%/?#-]{0,300}$/;
|
|
38
42
|
|
|
39
43
|
function changesOf(appDir = APP_DIR) {
|
|
@@ -73,7 +77,7 @@ function cardsOf(changes, installed, now) {
|
|
|
73
77
|
if (!steps.length) continue;
|
|
74
78
|
const open = typeof y.open === 'string' && OPEN_RE.test(y.open) ? y.open : null;
|
|
75
79
|
out.push({ key: `${e.v}#${p.n == null ? str(p.h || p.t, 40) : p.n}`, v: e.v, n: p.n == null ? null : p.n, at: e.at,
|
|
76
|
-
title: str(p.h || p.t || p.s, 120), kind: p.k || null, steps, see: str(y.see, 200) || null, open });
|
|
80
|
+
title: str(p.h || p.t || p.s, 120), kind: p.k || null, steps, see: str(y.see, 200) || null, open, ini: typeof p.i === 'string' && INI_RE.test(p.i) ? p.i : null });
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
return out.sort((a, b) => vcmp(b.v, a.v) || (b.n || 0) - (a.n || 0));
|
|
@@ -106,7 +110,7 @@ function answer(dir, { key, verdict, note } = {}, { changes = [], installed = nu
|
|
|
106
110
|
if (!known) return { ok: false, error: 'no change to try has that key' };
|
|
107
111
|
const text = str(note, 1000);
|
|
108
112
|
if (verdict === 'note' && !text) return { ok: false, error: 'a note needs its text' };
|
|
109
|
-
const line = { at: new Date(now).toISOString(), key, v: known.v, n: known.n, title: known.title, verdict, ...(text ? { note: text } : {}) };
|
|
113
|
+
const line = { at: new Date(now).toISOString(), key, v: known.v, n: known.n, title: known.title, verdict, ...(text ? { note: text } : {}), ...(known.ini ? { ini: known.ini } : {}) };
|
|
110
114
|
append(dir, line);
|
|
111
115
|
console.log(`${TAG} ${verdict} ${key}`);
|
|
112
116
|
return { ok: true, line };
|
|
@@ -125,6 +129,61 @@ function count(lines, changes, now = Date.now()) {
|
|
|
125
129
|
return { tried: cards.length, answered, pct: cards.length ? Math.round((answered / cards.length) * 100) : 0 };
|
|
126
130
|
}
|
|
127
131
|
|
|
132
|
+
/* ── answers as outcome evidence (try-answers-as-evidence, job #1837, idea A487) ──────────────────────────────────────────────────
|
|
133
|
+
* The answers stay on the beta computer; the factory copies them (factory/checker/try-feedback.js) and writes the standing ones that name an
|
|
134
|
+
* initiative to the repository's evidence ledger, which the outcome check cites (lib/outcomes.js dueDraft). No model, nothing sent. */
|
|
135
|
+
|
|
136
|
+
/** The standing answers that name an initiative: the last press per change; an undo takes the change out. PURE → [{ ini, key, verdict, … }] */
|
|
137
|
+
function evidenceOf(lines) {
|
|
138
|
+
const by = new Map();
|
|
139
|
+
for (const l of lines || []) {
|
|
140
|
+
if (!l || typeof l.key !== 'string' || l.key === '*') continue;
|
|
141
|
+
if (l.verdict === 'undo') { by.delete(l.key); continue; }
|
|
142
|
+
if (!VERDICTS.has(l.verdict)) continue;
|
|
143
|
+
if (typeof l.ini === 'string' && INI_RE.test(l.ini)) by.set(l.key, l); else by.delete(l.key);
|
|
144
|
+
}
|
|
145
|
+
return [...by.values()].map((l) => ({ ini: l.ini, key: l.key, verdict: l.verdict, v: l.v || null, n: l.n == null ? null : l.n, title: str(l.title, 120), note: str(l.note, 300), at: l.at }));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function evidenceFile(root) {
|
|
149
|
+
const kit = fs.existsSync(path.join(root, 'pmos', 'state'));
|
|
150
|
+
return path.join(root, ...(kit ? ['pmos', 'state'] : ['planning', 'runs']), EVIDENCE);
|
|
151
|
+
}
|
|
152
|
+
/** The ledger folded: each change's standing evidence line, with its line number for the source. PURE over the file → Map key → { line, ln } */
|
|
153
|
+
function evidenceLedger(root) {
|
|
154
|
+
const f = evidenceFile(root), by = new Map();
|
|
155
|
+
let text = ''; try { text = fs.readFileSync(f, 'utf8'); } catch { return { file: f, by }; }
|
|
156
|
+
text.split('\n').forEach((s, i) => {
|
|
157
|
+
if (!s.trim()) return;
|
|
158
|
+
let l; try { l = JSON.parse(s); } catch { return; }
|
|
159
|
+
if (!l || typeof l.key !== 'string') return;
|
|
160
|
+
if (l.type === 'undo') by.delete(l.key); else if (l.type === 'evidence' && INI_RE.test(String(l.initiative || ''))) by.set(l.key, { line: l, ln: i + 1, quote: s });
|
|
161
|
+
});
|
|
162
|
+
return { file: f, by };
|
|
163
|
+
}
|
|
164
|
+
/** Write the standing answers to the ledger: one evidence line per new or changed answer, an undo line per answer taken back. Append-only;
|
|
165
|
+
* a second run with the same answers writes nothing. → { ok, wrote, undone, file } */
|
|
166
|
+
function recordEvidence(root, lines, { now = Date.now(), by = 'agent:checker' } = {}) {
|
|
167
|
+
const want = new Map(evidenceOf(lines).map((e) => [e.key, e]));
|
|
168
|
+
const L = evidenceLedger(root), out = [];
|
|
169
|
+
for (const [key, had] of L.by) if (!want.has(key)) out.push({ type: 'undo', key, initiative: had.line.initiative, at: new Date(now).toISOString(), by });
|
|
170
|
+
for (const e of want.values()) {
|
|
171
|
+
const had = L.by.get(e.key);
|
|
172
|
+
if (had && had.line.verdict === e.verdict && had.line.answered === e.at && had.line.initiative === e.ini) continue;
|
|
173
|
+
out.push({ type: 'evidence', initiative: e.ini, source: 'try', key: e.key, verdict: e.verdict, v: e.v, pr: e.n, title: e.title, ...(e.note ? { note: e.note } : {}),
|
|
174
|
+
answered: e.at, date: String(e.at || '').slice(0, 10), at: new Date(now).toISOString(), by });
|
|
175
|
+
}
|
|
176
|
+
if (out.length) { fs.mkdirSync(path.dirname(L.file), { recursive: true }); fs.appendFileSync(L.file, out.map((l) => JSON.stringify(l)).join('\n') + '\n'); }
|
|
177
|
+
console.log(`${TAG} evidence wrote ${out.filter((l) => l.type === 'evidence').length}, undone ${out.filter((l) => l.type === 'undo').length}`);
|
|
178
|
+
return { ok: true, wrote: out.filter((l) => l.type === 'evidence').length, undone: out.filter((l) => l.type === 'undo').length, file: L.file };
|
|
179
|
+
}
|
|
180
|
+
/** The standing evidence of one initiative, each with its source (path:line from the root and the line's text), newest first. */
|
|
181
|
+
function evidenceFor(root, initiative) {
|
|
182
|
+
const L = evidenceLedger(root), rel = path.relative(root, L.file).split(path.sep).join('/');
|
|
183
|
+
return [...L.by.values()].filter((x) => x.line.initiative === initiative).sort((a, b) => String(b.line.answered).localeCompare(String(a.line.answered)))
|
|
184
|
+
.map((x) => ({ ...x.line, ref: rel + ':' + x.ln, quote: x.quote }));
|
|
185
|
+
}
|
|
186
|
+
|
|
128
187
|
/* ── pmos try ─────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
129
188
|
const USAGE = [
|
|
130
189
|
'usage: pmos try [list|works|broken|note|undo|later|count] — try what shipped in your recent updates (beta only)',
|
|
@@ -191,4 +250,4 @@ if (require.main === module) {
|
|
|
191
250
|
else process.exitCode = run(a);
|
|
192
251
|
}
|
|
193
252
|
|
|
194
|
-
module.exports = { TAG, DAYS, SHOW, ledgerFile, localDay, vcmp, changesOf, installedOf, readLines, fold, cardsOf, listOf, rowOf, answer, later, count, run, ctxOf, USAGE, COMMANDS: { try: ['list', 'works', 'broken', 'note', 'undo', 'later', 'count'] } };
|
|
253
|
+
module.exports = { TAG, DAYS, SHOW, EVIDENCE, evidenceOf, evidenceFile, recordEvidence, evidenceFor, ledgerFile, localDay, vcmp, changesOf, installedOf, readLines, fold, cardsOf, listOf, rowOf, answer, later, count, run, ctxOf, USAGE, COMMANDS: { try: ['list', 'works', 'broken', 'note', 'undo', 'later', 'count'] } };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.811.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.811.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED