create-pmos 0.653.0 → 0.655.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 +22 -16
- 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 +21 -2
- package/workspace/guide/agent-capabilities.md +2 -2
- package/workspace/guide/cli.md +1 -0
- package/workspace/guide/settings-and-switches.md +4 -1
- package/workspace/lib/ai-guard.js +9 -7
- package/workspace/lib/autonomy.js +2 -2
- package/workspace/lib/headless.js +1 -1
- package/workspace/lib/job-graph.js +3 -1
- package/workspace/lib/kit-update.js +29 -4
- package/workspace/lib/outcome-judge.js +162 -0
- package/workspace/lib/outcome-props.js +115 -11
- package/workspace/lib/outcomes.js +33 -8
- package/workspace/lib/proposal-runs.js +12 -6
- package/workspace/lib/proposals.js +15 -1
- package/workspace/lib/propose-cli.js +36 -1
- package/workspace/lib/routes-proposals.js +30 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/run-tests.js +26 -1
- package/workspace/server.js +4 -1
- package/workspace/skills/initiative-propose.skill +8 -2
- package/workspace/test-lists/outcome-checks-run-themselves.json +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.655.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": {
|
|
@@ -34,8 +34,21 @@
|
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
36
|
{
|
|
37
|
-
"v": "0.
|
|
38
|
-
"at": "2026-11-
|
|
37
|
+
"v": "0.655.0",
|
|
38
|
+
"at": "2026-11-22T02:03:29.259Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1439,
|
|
43
|
+
"t": "Outcome checks that run themselves",
|
|
44
|
+
"s": "Outcome checks that run themselves",
|
|
45
|
+
"k": "new"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"v": "0.654.0",
|
|
51
|
+
"at": "2026-11-22T01:23:23.116Z",
|
|
39
52
|
"f": 4,
|
|
40
53
|
"prs": [
|
|
41
54
|
{
|
|
@@ -43,6 +56,12 @@
|
|
|
43
56
|
"t": "The Initiatives | Backlog switch is a tablist with its label again",
|
|
44
57
|
"s": "The Initiatives | Backlog switch is a tablist with its label again",
|
|
45
58
|
"k": "fix"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"n": 1437,
|
|
62
|
+
"t": "Publish to beta first; promote to GA only on evidence",
|
|
63
|
+
"s": "Publish to beta first; promote to GA only on evidence",
|
|
64
|
+
"k": "x"
|
|
46
65
|
}
|
|
47
66
|
]
|
|
48
67
|
},
|
|
@@ -297,19 +316,6 @@
|
|
|
297
316
|
"k": "fix"
|
|
298
317
|
}
|
|
299
318
|
]
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
"v": "0.629.0",
|
|
303
|
-
"at": "2026-11-19T07:37:18.343Z",
|
|
304
|
-
"f": 4,
|
|
305
|
-
"prs": [
|
|
306
|
-
{
|
|
307
|
-
"n": 1410,
|
|
308
|
-
"t": "Jira read goes where the tickets are, and the sprint read no longer sticks on an old sprint",
|
|
309
|
-
"s": "Jira read goes where the tickets are, and the sprint read no longer sticks on an old sprint",
|
|
310
|
-
"k": "fix"
|
|
311
|
-
}
|
|
312
|
-
]
|
|
313
319
|
}
|
|
314
320
|
]
|
|
315
321
|
}
|
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-22T02:03:26Z"}
|
|
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-22T02:03:26Z"}
|
|
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-22T02:03:26Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"v": "0.
|
|
4
|
-
"at": "2026-11-
|
|
3
|
+
"v": "0.655.0",
|
|
4
|
+
"at": "2026-11-22T02:03:29.259Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1439,
|
|
9
|
+
"t": "Outcome checks that run themselves",
|
|
10
|
+
"s": "Outcome checks that run themselves",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"v": "0.654.0",
|
|
17
|
+
"at": "2026-11-22T01:23:23.116Z",
|
|
5
18
|
"f": 4,
|
|
6
19
|
"prs": [
|
|
7
20
|
{
|
|
@@ -9,6 +22,12 @@
|
|
|
9
22
|
"t": "The Initiatives | Backlog switch is a tablist with its label again",
|
|
10
23
|
"s": "The Initiatives | Backlog switch is a tablist with its label again",
|
|
11
24
|
"k": "fix"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"n": 1437,
|
|
28
|
+
"t": "Publish to beta first; promote to GA only on evidence",
|
|
29
|
+
"s": "Publish to beta first; promote to GA only on evidence",
|
|
30
|
+
"k": "x"
|
|
12
31
|
}
|
|
13
32
|
]
|
|
14
33
|
},
|
|
@@ -97,7 +97,7 @@ A loop never sends a message, moves a Jira ticket, merges into a product reposit
|
|
|
97
97
|
| [Grill](claude-proposes.md) | Before an initiative leaves a stage, when a forecast turns at risk, when scope or dates move a lot, and once a month on running work with late work. Also when you write "grill this" in the initiative's chat. | The initiative, your stored research, your meeting notes and the decisions that stand | "PMOS grilled it" under the initiative's ✦ | Settings › PMOS › Checks: Off. `PMOS_GRILL=off` |
|
|
98
98
|
| [You decided this before](claude-proposes.md) | You add an initiative that repeats an earlier decision | `DECISIONS.md`, the decision records, the PM journal, `planning/out-of-scope/` and the initiative records | The initiative's ✦ | `pmos ai off past-repeat` |
|
|
99
99
|
| [Initiative descriptions](claude-proposes.md) | Once a day. At most 3 drafts a day for each product. | The PRD's first Problem or Why paragraph, or the record's own first paragraph | "Description" under the initiative's ✦ | `pmos ai off descriptions`. `PMOS_DESCRIPTIONS=off` |
|
|
100
|
-
| [Expected outcomes](claude-proposes.md) | Once a day. At most 3 drafts a day for each product. | The PRD's success criteria, or the anchored key result | "Expected outcome" under the initiative's ✦.
|
|
100
|
+
| [Expected outcomes](claude-proposes.md) | Once a day. At most 3 drafts a day for each product. When a check date passes: the verdict, from the goal's reading or one short run. | The PRD's success criteria, or the anchored key result. For a verdict: the goal's reading, or the lines the run cites | "Expected outcome" under the initiative's ✦. A verdict is recorded with Undo. Your move when PMOS cannot tell. | `pmos ai off outcomes`. `PMOS_OUTCOMES=off` |
|
|
101
101
|
| [Metric drafts](claude-proposes.md) | A product with no North Star, the first 14 days of a quarter, a program with no goal, and an initiative that gets a PRD | The last 8 weeks of real readings | The page of that product, program or initiative | `PMOS_METRIC_DRAFT=off` |
|
|
102
102
|
| [Horizon scan](intelligence-okr-goals.md) | Daily by default, at most once a day, the first time you step away after 09:00. Scan now: at most 3 a day. | The public web for your kept watch list, and your repository | Report documents and proposals you approve | Cadence: Off. `PMOS_SCAN=off` |
|
|
103
103
|
| Live round | When you press ✓ on its ✦ ask, or run `pmos lab round`. Three runs at once. No time limit: you see its progress and can stop it. | The initiative's name, the product's Intent and the PMOS design system; a feedback round also reads the last version. | "PMOS prototyped it" or "PMOS improved it" under the initiative's ✦, each version as soon as it renders. | ✕ on its ✦ ask; Undo after ✓ |
|
|
@@ -131,7 +131,7 @@ Sync by itself is on by default. `PMOS_AUTO_SYNC=0` stops the sync, the repair a
|
|
|
131
131
|
|
|
132
132
|
- It sends, posts, replies, pushes and merges nothing. A message to a person is a draft that you send. A Jira change is a drafted comment in your outbox. These are class C: they always wait for you.
|
|
133
133
|
- It does not create an initiative. The Horizon scan proposes one, and you approve it.
|
|
134
|
-
- It
|
|
134
|
+
- It records a verdict on an outcome only from evidence it cites: the goal's own reading, or the lines a short outcome run read. Each verdict is listed with Undo. When it cannot tell, it records nothing and Your move asks you. A goal it fails to read twice the same way becomes one question for you, not a silent failure.
|
|
135
135
|
|
|
136
136
|
When you ask an agent session to do a piece of work, it can finish it, including acts that were yours alone. Each line it writes names the agent, so you see who did it. See **PM-only acts**.
|
|
137
137
|
|
package/workspace/guide/cli.md
CHANGED
|
@@ -160,6 +160,7 @@ PMOS's background run files proposals with these commands. The server pins the i
|
|
|
160
160
|
- `pmos propose date --json <file|->`: new dates for late or at-risk tasks, with the reason.
|
|
161
161
|
- `pmos propose done --json <file|->`: a task that looks done, with the evidence.
|
|
162
162
|
- `pmos propose name --json <file|->`: tidy names.
|
|
163
|
+
- `pmos propose verdict --json <file|->`: whether an initiative's expected outcome worked, once its check date has passed, with cited evidence. Only the outcome check run can file it. `cant-tell` files nothing, and the check stays with you.
|
|
163
164
|
- `pmos propose status`: what is open, kept and dropped.
|
|
164
165
|
- `pmos propose loose <link|merge|finish|start> --json <file|->`: the clean-up of the work that is not in an initiative. Only the clean-up run can file these, and that run files nothing else. `pmos propose loose status` shows what is open and kept.
|
|
165
166
|
|
|
@@ -21,6 +21,8 @@ Press the round menu button at the bottom of any page, then the **Settings** ico
|
|
|
21
21
|
|
|
22
22
|
Open **Updates**. PMOS asks the npm registry for the latest version at once, and the card says if a newer one is ready. **Check now** asks again. PMOS also checks once a day while a page is open. To check only when you press **Check now**, set the update check to press (the `upd.check` setting, or `PMOS_UPDATE_CHECK=press`).
|
|
23
23
|
|
|
24
|
+
Every new version goes to beta first. A computer that follows beta (the `upd.channel` setting set to early, or `PMOS_CHANNEL=beta`) is offered it at once. Every other computer is offered a version only after it becomes general availability (GA). A beta becomes GA only after it was used and checked, never because time passed.
|
|
25
|
+
|
|
24
26
|
- **Update to** a version on the **PMOS app** row updates the app. Press **Update** (or **Restart to update**) and PMOS starts at once, with no second question. PMOS stops, installs the new version, and starts again. Open terminals keep running. The page that you are on reloads when the new version starts. PMOS does not open a new tab. If the update is refused, or PMOS starts again on the old version, or PMOS does not come back, the row says so and names the update log.
|
|
25
27
|
- When PMOS runs from a PMOS checkout, the row says to update it with `git pull`. There is no Update button.
|
|
26
28
|
- **Update** on a workspace row updates the kit in that repository. It replaces the kit files in its `pmos/` folder (AGENTS.md, skills, scripts, templates, `okf/core`, the mod and KIT-VERSION). It does not change `state/`, `planning/` or `okf/product/`, and it does not commit. Review the change in the repository as a normal pull request.
|
|
@@ -189,6 +191,7 @@ An "off" switch accepts `off`, `0`, `false` or `no` unless the row says a differ
|
|
|
189
191
|
| `PMOS_AUTO_PROFILE` | `0` stops PMOS writing a repository profile. `1` turns it on for a server with its own state folder. | on | — |
|
|
190
192
|
| `PMOS_AUTO_LAUNCHER` | `0` does not add the login item during setup. | on | — |
|
|
191
193
|
| `PMOS_UPDATE_CHECK` | `press` checks for an update only when you press **Check now**. | daily | Updates (the `upd.check` setting) |
|
|
194
|
+
| `PMOS_CHANNEL` | `beta` offers each new version as soon as it is published; `latest` offers only GA versions. | GA | Updates (the `upd.channel` setting) |
|
|
192
195
|
| `PMOS_UPDATE_SOURCE` | A built create-pmos package on this computer to update from. | the npm registry | — |
|
|
193
196
|
| `PMOS_KIT_PAYLOAD` | The kit folder that project setup copies. | the app's `payload/` | — |
|
|
194
197
|
| `PMOS_INGEST_TIMEOUT_MS` | The longest time a repository clone may take. | 2 minutes | — |
|
|
@@ -280,7 +283,7 @@ PMOS sets these in the environment of a terminal session or a background run. Do
|
|
|
280
283
|
| `PMOS_CHECK` | Set to `1` inside each product check that `pmos build check` and `pmos build propose` run in a work item's worktree, with no network. A check can read it. | none | — |
|
|
281
284
|
| `PMOS_TEAM_FILE`, `PMOS_TEAM_ROOT`, `PMOS_TEAM_WS`, `PMOS_TEAM_ROLE`, `PMOS_TEAM_RUN`, `PMOS_TEAM_INI`, `PMOS_TEAM_MODE` | Set inside a role agent's run: its ledger, product folder, workspace, role, run, initiative, and whether it proposes or applies (`auto`). | none | — |
|
|
282
285
|
| `PMOS_GRILL_FILE`, `PMOS_GRILL_LOG`, `PMOS_GRILL_ROOT`, `PMOS_GRILL_BOARD`, `PMOS_GRILL_INI`, `PMOS_GRILL_RUN`, `PMOS_GRILL_BUDGET`, `PMOS_GRILL_WS` | Pin a grill run to its ledger, log, repository, board, initiative, run id and budget. No command reads `PMOS_GRILL_WS`. | none | — |
|
|
283
|
-
| `PMOS_PROPOSE_FILE`, `PMOS_PROPOSE_BOARD`, `PMOS_PROPOSE_INI`, `PMOS_PROPOSE_RUN`, `PMOS_PROPOSE_WS` | Pin a proposal run to its ledger, board, initiative and run id. No command reads `PMOS_PROPOSE_WS`. | none | — |
|
|
286
|
+
| `PMOS_PROPOSE_FILE`, `PMOS_PROPOSE_BOARD`, `PMOS_PROPOSE_INI`, `PMOS_PROPOSE_RUN`, `PMOS_PROPOSE_WS`, `PMOS_PROPOSE_ROOT` | Pin a proposal run to its ledger, board, initiative and run id. `PMOS_PROPOSE_ROOT` is the repository an outcome run's verdict citations are checked in. No command reads `PMOS_PROPOSE_WS`. | none | — |
|
|
284
287
|
| `PMOS_METRIC_DRAFT_FILE`, `PMOS_METRIC_DRAFT_SCOPE`, `PMOS_METRIC_DRAFT_ID`, `PMOS_METRIC_DRAFT_RUN`, `PMOS_METRIC_DRAFT_WS` | Pin a metric draft run to its ledger, scope, id and run id. No command reads `PMOS_METRIC_DRAFT_WS`. | none | — |
|
|
285
288
|
| `PMOS_METRIC_READ_FILE`, `PMOS_METRIC_READ_RECORDS`, `PMOS_METRIC_READ_DRAFTS`, `PMOS_METRIC_READ_WS`, `PMOS_METRIC_READ_RUN`, `PMOS_METRIC_READ_RIDS`, `PMOS_METRIC_READ_TEST` | Pin a goal reading run to its ledger, records, drafts, workspace, run id, goals and test mode. | none | — |
|
|
286
289
|
| `PMOS_IMPACT_FILE`, `PMOS_IMPACT_RUN` | Pin an impact run to its ledger and run id. | none | — |
|
|
@@ -33,9 +33,11 @@
|
|
|
33
33
|
*
|
|
34
34
|
* off(job, { env, settingsDir }) → null | reason
|
|
35
35
|
* check(p, { root, stateDir }) → { ok, p, errors }
|
|
36
|
-
* replay(job, version, cases, { root, stateDir }) → Promise<{ ok, failed: [{ name, why }] }>
|
|
36
|
+
* replay(job, version, cases, { root, stateDir, refDir? }) → Promise<{ ok, failed: [{ name, why }] }>
|
|
37
|
+
* refDir: the folder `state:` refs resolve in, when it is not stateDir (a product's own state folder, while the audit and the replay
|
|
38
|
+
* record stay in the per-user runtime folder: lib/outcome-props.js)
|
|
37
39
|
* ready(stateDir, job, version) → bool
|
|
38
|
-
* file({ job, version, run, root, stateDir, settingsDir?, env?, max? }, proposals, deliver) → Promise<{ filed, dropped, held?, off? }>
|
|
40
|
+
* file({ job, version, run, root, stateDir, refDir?, settingsDir?, env?, max? }, proposals, deliver) → Promise<{ filed, dropped, held?, off? }>
|
|
39
41
|
* audit(stateDir, line) · readAudit(stateDir, { job?, limit? }) → [line] · status({ stateDir, settingsDir, env }) → summary
|
|
40
42
|
* setOff(settingsDir, job | null, off) → { ok } | { ok: false, error }
|
|
41
43
|
*/
|
|
@@ -258,7 +260,7 @@ function expectFails(name, expect, got) {
|
|
|
258
260
|
}
|
|
259
261
|
|
|
260
262
|
/** Run a job's replay cases plus the guard's negatives; record the result for (job, version). */
|
|
261
|
-
async function replay(job, version, cases, { root, stateDir, max = MAX } = {}) {
|
|
263
|
+
async function replay(job, version, cases, { root, stateDir, refDir = null, max = MAX } = {}) {
|
|
262
264
|
const failed = [];
|
|
263
265
|
let seed = null;
|
|
264
266
|
if (!JOB_ID.test(String(job || ''))) return { ok: false, failed: [{ name: 'job', why: 'the job id is not valid' }] };
|
|
@@ -267,13 +269,13 @@ async function replay(job, version, cases, { root, stateDir, max = MAX } = {}) {
|
|
|
267
269
|
const name = one(c && c.name, 120) || '(unnamed)';
|
|
268
270
|
let list;
|
|
269
271
|
try { list = await c.run(); } catch (e) { failed.push({ name, why: 'the case threw: ' + one(e && e.message, 200) }); continue; }
|
|
270
|
-
const got = sift(list, { root, stateDir, max });
|
|
272
|
+
const got = sift(list, { root, stateDir: refDir || stateDir, max });
|
|
271
273
|
const why = expectFails(name, c.expect, got);
|
|
272
274
|
if (why) failed.push({ name, why });
|
|
273
275
|
if (!seed) seed = got.filed.find((p) => p.claims.length) || null;
|
|
274
276
|
}
|
|
275
277
|
if (seed) for (const n of negatives(seed)) {
|
|
276
|
-
const got = sift([n.p], { root, stateDir, max });
|
|
278
|
+
const got = sift([n.p], { root, stateDir: refDir || stateDir, max });
|
|
277
279
|
if (got.filed.length) failed.push({ name: n.name, why: 'the guard filed it' });
|
|
278
280
|
} else if (!failed.length) failed.push({ name: '(negatives)', why: 'no case filed a cited proposal, so the guard could not test its own drops; add a case that files one' });
|
|
279
281
|
const ok = !failed.length;
|
|
@@ -289,7 +291,7 @@ async function replay(job, version, cases, { root, stateDir, max = MAX } = {}) {
|
|
|
289
291
|
/* ── the door ────────────────────────────────────────────────────────────────────────────── */
|
|
290
292
|
|
|
291
293
|
async function file(o, proposals, deliver) {
|
|
292
|
-
const { job, version, run = null, root, stateDir, settingsDir = stateDir, env = process.env, max = MAX } = o || {};
|
|
294
|
+
const { job, version, run = null, root, stateDir, refDir = null, settingsDir = stateDir, env = process.env, max = MAX } = o || {};
|
|
293
295
|
const base = { job, version: String(version), ...(run ? { run } : {}) };
|
|
294
296
|
if (!JOB_ID.test(String(job || ''))) return { filed: [], dropped: [], error: 'the job id is not valid' };
|
|
295
297
|
const why = off(job, { env, settingsDir });
|
|
@@ -299,7 +301,7 @@ async function file(o, proposals, deliver) {
|
|
|
299
301
|
audit(stateDir, { ...base, event: 'held', n: list.length, why: 'no passing replay for this version' });
|
|
300
302
|
return { filed: [], dropped: [], held: true };
|
|
301
303
|
}
|
|
302
|
-
const got = sift(list, { root, stateDir, max });
|
|
304
|
+
const got = sift(list, { root, stateDir: refDir || stateDir, max });
|
|
303
305
|
for (const d of got.dropped) audit(stateDir, { ...base, event: 'dropped', id: d.id, why: one(d.why, 400) });
|
|
304
306
|
if (!got.filed.length) { audit(stateDir, { ...base, event: 'end', filed: 0, dropped: got.dropped.length }); return { filed: [], dropped: got.dropped }; }
|
|
305
307
|
try { await deliver(got.filed); } catch (e) {
|
|
@@ -91,7 +91,7 @@ const KIND_LIST = Object.freeze([
|
|
|
91
91
|
k('notes', 'Notes on where work stands', ['driver:note']),
|
|
92
92
|
k('problem', 'Problem statements and evidence', ['driver:problem', 'driver:evidence', 'driver:sizing', 'driver:assumption', 'driver:stakeholders', 'driver:overlap']),
|
|
93
93
|
k('experiment', 'The experiment and its next step', ['driver:artefact', 'driver:doc', 'driver:next-step']),
|
|
94
|
-
k('outcome', 'Expected outcomes and
|
|
94
|
+
k('outcome', 'Expected outcomes, check dates and whether they worked', ['propose:outcome']),
|
|
95
95
|
k('names', 'Task names', ['propose:names']),
|
|
96
96
|
k('dates', 'Dates moved by evidence', ['propose:dates']),
|
|
97
97
|
k('status', 'Closing tasks Jira marked Done', ['propose:status']),
|
|
@@ -119,7 +119,7 @@ function classOfProposal(p) {
|
|
|
119
119
|
if (!isObj(p)) return 'C';
|
|
120
120
|
const c = PROPOSAL_CLASS[p.group] || 'C';
|
|
121
121
|
if (p.group === 'status' && (p.items || []).some((x) => x && x.jira)) return 'C';
|
|
122
|
-
if (p.group === 'outcome' && p.type === 'refuted') return 'C';
|
|
122
|
+
if (p.group === 'outcome' && (p.type === 'refuted' || p.type === 'source')) return 'C'; // a next step, or the one ask for a source PMOS cannot read
|
|
123
123
|
// D108 as amended 2026-11-16 (Wawan: "Open them automatically"): the factory's pull request opens by itself, from the server (never the
|
|
124
124
|
// Builder's run), and Undo closes it. The guardrail and CI decide merge or review. `pmos ai off` or a demotion returns it to the ✓.
|
|
125
125
|
// a live round's prototype (lib/live-round.js, data.live) is the PM's to keep: PMOS never keeps one by itself (2026-11-18: a test round it
|
|
@@ -679,7 +679,7 @@ const RUN_ENV = Object.freeze(['PMOS_SCAN_FILE', 'PMOS_SCAN_ORIGIN', 'PMOS_SCAN_
|
|
|
679
679
|
'PMOS_CORE_DOC_SCOPE', 'PMOS_CORE_DOC_KEY', 'PMOS_CORE_DOC_KEYS',
|
|
680
680
|
'PMOS_METRIC_DRAFT_FILE', 'PMOS_METRIC_DRAFT_WS', 'PMOS_METRIC_DRAFT_SCOPE', 'PMOS_METRIC_DRAFT_ID', 'PMOS_METRIC_DRAFT_RUN',
|
|
681
681
|
'PMOS_METRIC_READ_FILE', 'PMOS_METRIC_READ_RECORDS', 'PMOS_METRIC_READ_DRAFTS', 'PMOS_METRIC_READ_WS', 'PMOS_METRIC_READ_RUN', 'PMOS_METRIC_READ_RIDS', 'PMOS_METRIC_READ_TEST',
|
|
682
|
-
'PMOS_PROPOSE_FILE', 'PMOS_PROPOSE_WS', 'PMOS_PROPOSE_BOARD', 'PMOS_PROPOSE_INI', 'PMOS_PROPOSE_RUN',
|
|
682
|
+
'PMOS_PROPOSE_FILE', 'PMOS_PROPOSE_WS', 'PMOS_PROPOSE_BOARD', 'PMOS_PROPOSE_INI', 'PMOS_PROPOSE_RUN', 'PMOS_PROPOSE_ROOT',
|
|
683
683
|
'PMOS_GRILL_FILE', 'PMOS_GRILL_LOG', 'PMOS_GRILL_WS', 'PMOS_GRILL_BOARD', 'PMOS_GRILL_INI', 'PMOS_GRILL_RUN', 'PMOS_GRILL_BUDGET',
|
|
684
684
|
'PMOS_IMPACT_FILE', 'PMOS_IMPACT_RUN', 'PMOS_VERIFY_RUN', 'PMOS_REVIEW_RUN', 'PMOS_IMPROVE_RUN', 'PMOS_IMPROVE_WS', 'PMOS_IMPROVE_AREA', 'PMOS_IMPROVE_STATE', 'PMOS_IMPROVE_ROOT', 'PMOS_CHECK_REF', 'PMOS_CHECK_DIR', 'PMOS_MS_REVIEW_FILE', 'PMOS_MS_REVIEW_RUN', 'PMOS_MS_REVIEW_PROGRAM',
|
|
685
685
|
'PMOS_TEAM_FILE', 'PMOS_TEAM_ROOT', 'PMOS_TEAM_WS', 'PMOS_TEAM_ROLE', 'PMOS_TEAM_RUN', 'PMOS_TEAM_INI', 'PMOS_TEAM_MODE',
|
|
@@ -67,6 +67,8 @@ const LEDGERS = Object.freeze({
|
|
|
67
67
|
r('lib/routes-forecast.js', null, 'the forecast on the Board and Intelligence')] },
|
|
68
68
|
'<state>/scan.jsonl': { concept: 'horizon-scan', owner: 'lib/scan.js', readers: [
|
|
69
69
|
r('lib/routes-scan.js', null, 'the Horizon scan results')] },
|
|
70
|
+
'<state>/outcome-runs.jsonl': { concept: 'outcome-runs', owner: 'lib/outcome-props.js', readers: [
|
|
71
|
+
r('lib/outcome-props.js', 'runsOf', 'one outcome run per initiative and check date')] },
|
|
70
72
|
'<state>/drift.jsonl': { concept: 'drift', owner: 'lib/drift.js', readers: [
|
|
71
73
|
r('lib/routes-drift.js', null, "What you might have missed, in Home's chat")] },
|
|
72
74
|
'<runtime>/idle-lab.jsonl': { concept: 'idle-lab', owner: 'lib/idle-lab.js', readers: [
|
|
@@ -164,7 +166,7 @@ const JOBS = Object.freeze([
|
|
|
164
166
|
q('meeting-prewarm', 'lib/live-round-meeting.js', ['<runtime>/idle-lab/meeting-prewarm.jsonl'], [props, 'calendar', '<runtime>/meeting-material.jsonl'], 'round 1 itself is filed by lib/live-round.js (W1)'),
|
|
165
167
|
ai('past-repeat', 'lib/past-repeat.js', [props], ['repo:DECISIONS.md']),
|
|
166
168
|
ai('decision-memory', 'lib/decision-memory.js', [props], ['repo:DECISIONS.md']),
|
|
167
|
-
ai('outcomes', 'lib/outcome-props.js', [props], ['initiative records']),
|
|
169
|
+
ai('outcomes', 'lib/outcome-props.js', [props, '<state>/outcome-runs.jsonl'], ['initiative records', 'repo:planning/runs/outcome_checks.jsonl', '<state>/metric-reads.jsonl']),
|
|
168
170
|
ai('descriptions', 'lib/description-props.js', [props], ['initiative records']),
|
|
169
171
|
ai('drift', 'lib/drift-runs.js', ['<state>/drift.jsonl'], ['<state>/boards.jsonl']),
|
|
170
172
|
ai('rehearse', 'lib/rehearse-guard.js', [], ['task links']),
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* readKit(root) → { present:false } | { present:true, version, kernelSource, installed, mode }
|
|
5
5
|
* status({ root, appVersion, appDir }) → { app: { version, fromCheckout }, kit, changes } local only, no network
|
|
6
6
|
* source(env) → { kind:'npm' } | { kind:'local', path } | { kind:'local', path, error }
|
|
7
|
-
*
|
|
7
|
+
* channel(env, stateDir) → 'latest' | 'beta' which release line this computer follows (factory line, 2026-11-21)
|
|
8
|
+
* latest({ exec, source, tag }) → Promise<{ ok, version, changes, tag } | { ok:false, error }> npm view create-pmos[@beta] version pmosChanges
|
|
8
9
|
* readChanges(appDir) → [{ v, at, prs: [{ n, t?, s }] }] the installed app's changelog.json, newest first
|
|
9
10
|
* readLastCheck(stateDir) · writeLastCheck(stateDir, { latest, changes }) the last check's answer, kept in the state folder
|
|
10
11
|
* compare(st, latestVersion) → { appBehind, kitBehind }
|
|
@@ -25,6 +26,11 @@
|
|
|
25
26
|
* minute later. The app upgrade stops this server (create-pmos runs `pmos stop`), so it runs DETACHED, writes its output
|
|
26
27
|
* to a log file, and the page waits for the server to come back.
|
|
27
28
|
*
|
|
29
|
+
* TWO RELEASE LINES (factory line, Wawan 2026-11-21). kit-publish publishes every merge under the npm tag `beta`.
|
|
30
|
+
* A beta becomes `latest` (GA, what everyone installs) only by kit-promote.yml, on evidence: the PM used the changed part
|
|
31
|
+
* and the Checker passed it on real data. A computer follows beta when the setting upd.channel is `early` or PMOS_CHANNEL
|
|
32
|
+
* is `beta`; every other computer follows GA and sees no beta. When no beta exists yet, the check reads GA.
|
|
33
|
+
*
|
|
28
34
|
* WHAT'S NEW (premium-updates). kit-publish writes workspace/changelog.json (one summary per kit, copied from its merged PRs)
|
|
29
35
|
* and the newest 20 entries as the package's `pmosChanges` field. The installed list is read from disk; the check reads the
|
|
30
36
|
* newer kits' entries in the same `npm view` call, so the page can say what an update brings before it runs.
|
|
@@ -208,7 +214,16 @@ function why(r, what) {
|
|
|
208
214
|
return `${what} did not finish${said ? ': ' + said : ''}`;
|
|
209
215
|
}
|
|
210
216
|
|
|
211
|
-
|
|
217
|
+
/** The release line this computer follows: 'beta' (setting upd.channel = early, or PMOS_CHANNEL=beta) or 'latest' (GA). */
|
|
218
|
+
function channel(env = process.env, stateDir = null) {
|
|
219
|
+
const e = String((env && env.PMOS_CHANNEL) || '').trim().toLowerCase();
|
|
220
|
+
if (e === 'beta' || e === 'early') return 'beta';
|
|
221
|
+
if (e === 'latest' || e === 'ga' || e === 'stable') return 'latest';
|
|
222
|
+
if (!stateDir) return 'latest';
|
|
223
|
+
try { return require('./settings-store.js').get(stateDir, 'upd.channel') === 'early' ? 'beta' : 'latest'; } catch { return 'latest'; }
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async function latest({ exec = cp.execFile, source: src = source(), tag = 'latest' } = {}) {
|
|
212
227
|
if (src.kind === 'local') {
|
|
213
228
|
if (src.error) return { ok: false, error: src.error };
|
|
214
229
|
if (!src.version) return { ok: false, error: `${src.path} has no version number` };
|
|
@@ -218,7 +233,17 @@ async function latest({ exec = cp.execFile, source: src = source() } = {}) {
|
|
|
218
233
|
}
|
|
219
234
|
// pmosChanges: the newest kits' summaries (premium-updates). A package published before it has none, and npm then answers
|
|
220
235
|
// with the version alone, as a plain JSON string.
|
|
221
|
-
|
|
236
|
+
// GA asks exactly what it always asked. Beta asks for both tags and takes the newer: no beta yet, or a GA newer than
|
|
237
|
+
// the beta, gives GA.
|
|
238
|
+
const ga = await viewLatest({ exec, spec: PKG_NAME });
|
|
239
|
+
if (tag !== 'beta') return ga;
|
|
240
|
+
const b = await viewLatest({ exec, spec: `${PKG_NAME}@beta` });
|
|
241
|
+
if (!b.ok || (ga.ok && cmpVer(b.version, ga.version) <= 0)) return ga;
|
|
242
|
+
return { ...b, tag: 'beta' };
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async function viewLatest({ exec, spec }) {
|
|
246
|
+
const r = await run(exec, NPM, ['view', spec, 'version', 'pmosChanges', '--json'], { timeout: CHECK_TIMEOUT_MS });
|
|
222
247
|
const bad = why(r, 'The check');
|
|
223
248
|
if (bad) return { ok: false, error: bad };
|
|
224
249
|
let v = r.stdout.trim();
|
|
@@ -352,4 +377,4 @@ function releaseHeads(pkg = PKG_NAME, { exec = cp.execFileSync } = {}) {
|
|
|
352
377
|
{ encoding: 'utf8', timeout: 20000, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true, shell: IS_WIN }));
|
|
353
378
|
}
|
|
354
379
|
|
|
355
|
-
module.exports = { PKG_NAME, releaseHeads, windowsHop, appUpdateCommand, cmpVer, readChanges, readLastCheck, writeLastCheck, notServedYet, validVersion, source, npxArgs, readKit, fromCheckout, status, compare, latest, updateKit, updateEnv, upgradeApp, whereFrom };
|
|
380
|
+
module.exports = { PKG_NAME, channel, releaseHeads, windowsHop, appUpdateCommand, cmpVer, readChanges, readLastCheck, writeLastCheck, notServedYet, validVersion, source, npxArgs, readKit, fromCheckout, status, compare, latest, updateKit, updateEnv, upgradeApp, whereFrom };
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* outcome-judge.js — PMOS checks an outcome by itself when its check date passes (initiative outcome-checks-run-themselves; bet 1 of the
|
|
3
|
+
* factory line, proof A3). Pure apart from reading the product's own ledgers; no model, no clock of its own (`today` comes in).
|
|
4
|
+
*
|
|
5
|
+
* judge({ root, it, src, recordsDir, stateDir, today }) → one of
|
|
6
|
+
* { kind: 'verdict', disposition: validated | refuted, evidence, reading, rec, claims } the anchor goal's own reading decides it
|
|
7
|
+
* { kind: 'cant', rid, goal, why, repeats, claims } PMOS could not read that goal; repeats = the identical failures in a row
|
|
8
|
+
* { kind: 'none', why } nothing here decides it: a short run reads the records (lib/proposal-runs.js `outcome`)
|
|
9
|
+
* drafts(S, { src, recordsDir, stateDir, refDir, only }) → [{ judged, draft }] the ai-guard drafts (lib/ai-guard.js) of the due outcomes
|
|
10
|
+
* verdict class B: recorded by itself with Undo (lib/routes-proposals.js applyOne → lib/outcomes.js recordCheck)
|
|
11
|
+
* source class C: ONE ask to the PM, filed at the second identical "can't read" of the goal the outcome rests on
|
|
12
|
+
* barOf(text) → { lt, inclusive, v, pct } | null the number and direction an expected outcome names ("at least 70%", "≤ 2 hours")
|
|
13
|
+
* ASK_AFTER identical failures before the one ask (2)
|
|
14
|
+
*
|
|
15
|
+
* WHAT DECIDES (nothing else does; a reading never says more than it read):
|
|
16
|
+
* 1. The initiative's anchor (parent_kr) resolves to a goal record (lib/goal-source.js resolve) with a reading taken no earlier than the check
|
|
17
|
+
* date less the goal's own staleness window (lib/goal-status.js staleDays), and no later than today.
|
|
18
|
+
* 2. The expected outcome names a number with a direction: the reading meets it → validated, misses it → refuted.
|
|
19
|
+
* It names none: the goal's own target. Reached → validated. Not reached → no verdict (the initiative may move only part of it).
|
|
20
|
+
* A limit goal (Stay within) is never judged from its target here: the run reads it.
|
|
21
|
+
* 3. No fresh reading, and the goal's reads failed since its last good one → `cant`, with the failures cited.
|
|
22
|
+
* Every verdict cites the reading's own line in kr-metrics.jsonl and the record's outcome_metric line. With no citable line there is no verdict.
|
|
23
|
+
*/
|
|
24
|
+
const fs = require('fs');
|
|
25
|
+
const path = require('path');
|
|
26
|
+
const O = require('./outcomes.js');
|
|
27
|
+
|
|
28
|
+
const ASK_AFTER = 2;
|
|
29
|
+
const DAY = 864e5;
|
|
30
|
+
const fin = (v) => typeof v === 'number' && Number.isFinite(v);
|
|
31
|
+
const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length <= n ? t : t.slice(0, n - 1).replace(/[,;:\s]+$/, '') + '…'; };
|
|
32
|
+
const rel = (root, f) => path.relative(root, f).split(path.sep).join('/');
|
|
33
|
+
const inside = (base, f) => { const b = path.resolve(base), a = path.resolve(f); return a === b || a.startsWith(b + path.sep); };
|
|
34
|
+
const dayMs = (d) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(d || '')); return m ? Date.UTC(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
35
|
+
const addDays = (d, n) => new Date(dayMs(d) + n * DAY).toISOString().slice(0, 10);
|
|
36
|
+
const linesOf = (f) => { try { return fs.readFileSync(f, 'utf8').split('\n'); } catch { return null; } };
|
|
37
|
+
const parse = (s) => { try { const o = JSON.parse(s); return o && typeof o === 'object' ? o : null; } catch { return null; } };
|
|
38
|
+
const fmt = (v, unit) => { const r = Math.abs(v) >= 100 ? Math.round(v) : Math.round(v * 100) / 100, s = Math.abs(r) >= 1000 ? r.toLocaleString('en-US') : String(r), u = String(unit || '').trim(); return u ? (/^[A-Za-z]/.test(u) ? s + ' ' + u : s + u) : s; };
|
|
39
|
+
const norm = (s) => String(s || '').toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
|
|
40
|
+
|
|
41
|
+
/* ── the number an expected outcome names ─────────────────────────────────────────────────────────────────── */
|
|
42
|
+
|
|
43
|
+
const N = '(\\d{1,3}(?:,\\d{3})+|\\d+(?:\\.\\d+)?)\\s*(%)?';
|
|
44
|
+
const LT_U = new RegExp('(≤|<=|<|fewer than|less than|lower than|below|under|at most|no more than|drops? (?:to|below)|falls? (?:to|below))\\s*' + N, 'i');
|
|
45
|
+
const GT_U = new RegExp('(≥|>=|>|more than|greater than|higher than|above|over|at least|exceeds?|rises? (?:to|above))\\s*' + N, 'i');
|
|
46
|
+
const INCL = /at most|no more than|at least|≤|≥|<=|>=/i;
|
|
47
|
+
/** The number and direction an expected outcome names. → { lt, inclusive, v, pct } | null (no number with a direction: the goal's target decides) */
|
|
48
|
+
function barOf(text) {
|
|
49
|
+
const t = String(text || '');
|
|
50
|
+
const lt = LT_U.exec(t), gt = GT_U.exec(t);
|
|
51
|
+
const m = lt && gt ? (lt.index <= gt.index ? lt : gt) : lt || gt;
|
|
52
|
+
if (!m) return null;
|
|
53
|
+
return { lt: m === lt, inclusive: INCL.test(m[1]), v: Number(m[2].replace(/,/g, '')), pct: !!m[3] };
|
|
54
|
+
}
|
|
55
|
+
const meets = (bar, v) => (bar.lt ? (bar.inclusive ? v <= bar.v : v < bar.v) : (bar.inclusive ? v >= bar.v : v > bar.v));
|
|
56
|
+
|
|
57
|
+
/* ── where each fact sits (path:line and its text, for the citation guard) ───────────────────────────────── */
|
|
58
|
+
|
|
59
|
+
/** A cited source for line n of file f: repository-relative when it is inside the repository, else `state:` relative to refDir. → source | null */
|
|
60
|
+
function srcOf(root, refDir, f, n, text, label) {
|
|
61
|
+
const quote = clip(String(text || '').trim(), 400);
|
|
62
|
+
if (inside(root, f)) return { label, ref: rel(root, f) + ':' + n, quote };
|
|
63
|
+
if (refDir && inside(refDir, f)) return { label, ref: 'state:' + rel(refDir, f) + ':' + n, quote };
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
/** The newest line of kr-metrics.jsonl that holds this reading. → { n, text } | null */
|
|
67
|
+
function readingLine(file, rid, reading) {
|
|
68
|
+
const L = linesOf(file); if (!L) return null;
|
|
69
|
+
for (let i = L.length - 1; i >= 0; i--) {
|
|
70
|
+
const e = parse(L[i]);
|
|
71
|
+
if (e && e.kind === 'reading' && e.rid === rid && e.fields && e.fields.at === reading.at && e.fields.value === reading.value) return { n: i + 1, text: L[i] };
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
/** The goal's failed reads since its last good one, oldest first, from metric-reads.jsonl (a test read never counts). → [{ n, text, why }] */
|
|
76
|
+
function cantsOf(file, rid) {
|
|
77
|
+
const L = linesOf(file); if (!L) return [];
|
|
78
|
+
let out = [];
|
|
79
|
+
L.forEach((raw, i) => {
|
|
80
|
+
const e = parse(raw); if (!e || e.rid !== rid || e.test) return;
|
|
81
|
+
if (e.kind === 'read') out = [];
|
|
82
|
+
else if (e.kind === 'cant') out.push({ n: i + 1, text: raw, why: String(e.why || '').trim() });
|
|
83
|
+
});
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* ── the judgement ───────────────────────────────────────────────────────────────────────────────────────── */
|
|
88
|
+
|
|
89
|
+
function judge({ root, it, src, recordsDir, stateDir, refDir = stateDir, today }) {
|
|
90
|
+
root = path.resolve(root);
|
|
91
|
+
if (!it || !it.horizon) return { kind: 'none', why: 'It has no check date.' };
|
|
92
|
+
const GS = require('./goal-source.js'), ST = require('./goal-status.js');
|
|
93
|
+
const rec = it.anchor ? GS.resolve(src, it.anchor) : null;
|
|
94
|
+
if (!rec) return { kind: 'none', why: it.anchor ? `Its anchor ${it.anchor} has no goal that PMOS reads.` : 'It has no anchor goal.' };
|
|
95
|
+
const goal = clip(rec.title || rec.metric || rec.rid, 80);
|
|
96
|
+
const from = addDays(it.horizon, -ST.staleDays(rec));
|
|
97
|
+
const fresh = (Array.isArray(rec.readings) ? rec.readings : []).filter((x) => x && fin(x.value) && String(x.at || '') >= from && String(x.at || '').slice(0, 10) <= today);
|
|
98
|
+
const metricSrc = it.fm && it.fm.outcome_metric ? srcOf(root, refDir, path.join(root, it.record), it.fm.outcome_metric.n, it.fm.outcome_metric.text, 'Expected outcome') : null;
|
|
99
|
+
|
|
100
|
+
if (!fresh.length) {
|
|
101
|
+
const cants = stateDir ? cantsOf(path.join(stateDir, 'metric-reads.jsonl'), rec.rid) : [];
|
|
102
|
+
if (!cants.length) return { kind: 'none', why: `"${goal}" has no reading since ${from}.` };
|
|
103
|
+
const last = cants[cants.length - 1];
|
|
104
|
+
let repeats = 0;
|
|
105
|
+
for (let i = cants.length - 1; i >= 0 && norm(cants[i].why) === norm(last.why); i--) repeats++;
|
|
106
|
+
const file = path.join(stateDir, 'metric-reads.jsonl');
|
|
107
|
+
const sources = cants.slice(-repeats).slice(-3).map((c) => srcOf(root, refDir, file, c.n, c.text, 'PMOS could not read it')).filter(Boolean);
|
|
108
|
+
return { kind: 'cant', rid: rec.rid, goal, why: last.why || 'no reason given', repeats, claims: sources.length ? [{ text: `PMOS could not read "${goal}" ${repeats} time${repeats === 1 ? '' : 's'} in a row: ${clip(last.why, 160)}`, sources }] : [] };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const reading = fresh[fresh.length - 1], v = reading.value;
|
|
112
|
+
const bar = barOf(it.metric);
|
|
113
|
+
let disposition = null, said = '';
|
|
114
|
+
if (bar) {
|
|
115
|
+
disposition = meets(bar, v) ? 'validated' : 'refuted';
|
|
116
|
+
said = `${disposition === 'validated' ? 'meets' : 'misses'} the ${bar.lt ? (bar.inclusive ? 'at most' : 'below') : (bar.inclusive ? 'at least' : 'above')} ${fmt(bar.v, bar.pct ? '%' : '')} it expected`;
|
|
117
|
+
} else if (!ST.isLimit(rec) && fin(Number(rec.target)) && fin(Number(rec.baseline)) && Number(rec.target) !== Number(rec.baseline)) {
|
|
118
|
+
const target = Number(rec.target), up = target > Number(rec.baseline);
|
|
119
|
+
if (up ? v >= target : v <= target) { disposition = 'validated'; said = `reached its target of ${fmt(target, rec.unit)}`; }
|
|
120
|
+
else return { kind: 'none', why: `"${goal}" reads ${fmt(v, rec.unit)}, short of its target of ${fmt(target, rec.unit)}, and the expected outcome names no number of its own.` };
|
|
121
|
+
} else return { kind: 'none', why: 'The expected outcome names no number, and the goal has no target PMOS can compare with.' };
|
|
122
|
+
|
|
123
|
+
const file = path.join(recordsDir || GS.recordsDirOf(root), 'kr-metrics.jsonl');
|
|
124
|
+
const line = readingLine(file, rec.rid, reading);
|
|
125
|
+
const rsrc = line ? srcOf(root, refDir, file, line.n, line.text, 'The goal\'s reading') : null;
|
|
126
|
+
if (!rsrc) return { kind: 'none', why: 'The reading could not be cited by its line.' };
|
|
127
|
+
const evidence = clip(`"${goal}" read ${fmt(v, rec.unit)} on ${String(reading.at).slice(0, 10)}${reading.source ? ' (' + reading.source + ')' : ''}, which ${said}. Source: ${rsrc.ref}`, 600);
|
|
128
|
+
const claims = [{ text: `"${goal}" read ${fmt(v, rec.unit)} on ${String(reading.at).slice(0, 10)}`, sources: [rsrc] }];
|
|
129
|
+
if (metricSrc) claims.push({ text: `It expected: ${clip(it.metric, 160)}`, sources: [metricSrc] });
|
|
130
|
+
return { kind: 'verdict', disposition, evidence, reading, rec, claims };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const WORDS = Object.freeze({ validated: 'It worked', refuted: 'It did not work' });
|
|
134
|
+
|
|
135
|
+
/** The drafts of the due outcomes of one scan (lib/outcomes.js scan). → [{ judged, it, draft | null }] (draft null: nothing to file now) */
|
|
136
|
+
function drafts(S, { src, recordsDir, stateDir, refDir = stateDir, only = null } = {}) {
|
|
137
|
+
const out = [];
|
|
138
|
+
for (const it of S.due) {
|
|
139
|
+
if (only && it.id !== only) continue;
|
|
140
|
+
const j = judge({ root: S.root, it, src, recordsDir, stateDir, refDir, today: S.today });
|
|
141
|
+
let draft = null;
|
|
142
|
+
if (j.kind === 'verdict') {
|
|
143
|
+
draft = {
|
|
144
|
+
id: `outcome-verdict:${it.id}:${it.horizon}`, cls: 'B', confidence: 'medium', claims: j.claims,
|
|
145
|
+
title: `${WORDS[j.disposition]}: ${clip(it.title, 80)}`,
|
|
146
|
+
say: `Its check date was ${O.short(it.horizon)}. ${j.evidence.replace(/ Source: .*$/, '')} PMOS recorded "${j.disposition === 'validated' ? 'worked' : 'didn\'t work'}". Undo takes it back.`,
|
|
147
|
+
data: { kind: 'verdict', initiative: it.id, disposition: j.disposition, evidence: j.evidence, horizon: it.horizon },
|
|
148
|
+
};
|
|
149
|
+
} else if (j.kind === 'cant' && j.repeats >= ASK_AFTER && j.claims.length) {
|
|
150
|
+
draft = {
|
|
151
|
+
id: `outcome-source:${it.id}:${j.rid}`, cls: 'C', confidence: 'medium', claims: j.claims,
|
|
152
|
+
title: `PMOS can't read "${clip(j.goal, 60)}"`,
|
|
153
|
+
say: `PMOS tried to read "${j.goal}" ${j.repeats} times and could not: ${clip(j.why, 200)}. Until it can, the outcome of ${clip(it.title, 80)} can't be checked. Connect the source, or pick another number to steer by. ✓ adds this as a task for you.`,
|
|
154
|
+
data: { kind: 'source', initiative: it.id, rid: j.rid, goal: j.goal, why: clip(j.why, 300), repeats: j.repeats, horizon: it.horizon },
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
out.push({ judged: j, it, draft });
|
|
158
|
+
}
|
|
159
|
+
return out;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
module.exports = { judge, drafts, barOf, ASK_AFTER, WORDS };
|