create-pmos 0.807.0 → 0.809.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 +24 -3
- 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 +23 -2
- package/workspace/guide/claude-proposes.md +5 -1
- package/workspace/guide/layout.md +1 -1
- package/workspace/lib/briefing-premium.js +1 -1
- package/workspace/lib/kill-check.js +108 -0
- package/workspace/lib/outcome-judge.js +1 -1
- package/workspace/lib/outcome-props.js +48 -3
- package/workspace/lib/routes-proposals.js +3 -1
- package/workspace/lib/today-log.js +124 -5
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-today-app.js +9 -0
- package/workspace/public/pm/cozy-today-model.js +3 -1
- package/workspace/public/pm/cozy-today-page.css +5 -0
- package/workspace/public/pm/cozy-today-view.js +20 -1
- package/workspace/test-lists/capture-words-to-fields.json +9 -0
- package/workspace/test-lists/kill-check.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.809.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,8 @@
|
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
36
|
{
|
|
37
|
-
"v": "0.
|
|
38
|
-
"at": "2026-11-25T05:
|
|
37
|
+
"v": "0.809.0",
|
|
38
|
+
"at": "2026-11-25T05:38:37.920Z",
|
|
39
39
|
"f": 4,
|
|
40
40
|
"prs": [
|
|
41
41
|
{
|
|
@@ -58,6 +58,27 @@
|
|
|
58
58
|
"t": "Rows no longer show below Today's capture box on a phone",
|
|
59
59
|
"s": "Rows no longer show below Today's capture box on a phone",
|
|
60
60
|
"k": "fix"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"n": 1851,
|
|
64
|
+
"t": "The capture line reads the words — kind, date, time and owner as chips with Undo (job #1845, A535, A538)",
|
|
65
|
+
"s": "The capture line reads the words — kind, date, time and owner as chips with Undo (job #1845, A535, A538)",
|
|
66
|
+
"k": "new"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"n": 1850,
|
|
70
|
+
"t": "Kill lines are read like outcome checks (job #1843, A530)",
|
|
71
|
+
"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
|
+
}
|
|
61
82
|
}
|
|
62
83
|
]
|
|
63
84
|
},
|
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-25T05:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T05:38:33Z"}
|
|
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-25T05:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T05:38:33Z"}
|
|
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-25T05:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T05:38:33Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"v": "0.
|
|
4
|
-
"at": "2026-11-25T05:
|
|
3
|
+
"v": "0.809.0",
|
|
4
|
+
"at": "2026-11-25T05:38:37.920Z",
|
|
5
5
|
"f": 4,
|
|
6
6
|
"prs": [
|
|
7
7
|
{
|
|
@@ -24,6 +24,27 @@
|
|
|
24
24
|
"t": "Rows no longer show below Today's capture box on a phone",
|
|
25
25
|
"s": "Rows no longer show below Today's capture box on a phone",
|
|
26
26
|
"k": "fix"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"n": 1851,
|
|
30
|
+
"t": "The capture line reads the words — kind, date, time and owner as chips with Undo (job #1845, A535, A538)",
|
|
31
|
+
"s": "The capture line reads the words — kind, date, time and owner as chips with Undo (job #1845, A535, A538)",
|
|
32
|
+
"k": "new"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"n": 1850,
|
|
36
|
+
"t": "Kill lines are read like outcome checks (job #1843, A530)",
|
|
37
|
+
"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
|
+
}
|
|
27
48
|
}
|
|
28
49
|
]
|
|
29
50
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "PMOS proposes: the ✦, drafts and checks you keep or drop"
|
|
4
4
|
description: "The one ✦ on each initiative, the grill, descriptions, expected outcomes, metric drafts, rehearsals, ask the past, your impact and the weekly drift check."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-25
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# PMOS proposes
|
|
@@ -159,6 +159,10 @@ A new initiative gets its draft at the next daily read after its PRD or its task
|
|
|
159
159
|
|
|
160
160
|
When the check date passes, Today shows the check. Tell PMOS whether it worked, did not work, or you cannot tell yet, and what shows it: a number, a link or what you saw. PMOS records your verdict with the evidence. A verdict is always yours. PMOS never records one from a metric alone.
|
|
161
161
|
|
|
162
|
+
### When a kill line is met
|
|
163
|
+
|
|
164
|
+
On the check date, or once a week when there is none, PMOS reads the initiative's `kill:` line. A line with a number and a direction, such as "Stop if weekly buyers stay below 45", is compared with the newest reading of the initiative's goal. A line such as "Stop if it is not shipped by 2026-12-01" is met when that date passes and the initiative is not done. PMOS does not judge a line that names no number and no date. When the line is met, Today shows one ✦, **Stop <initiative>? Kill line met**, with the line and the reading it read. ✓ stops the initiative, and **Undo** brings it back. ✕ keeps it going, and PMOS does not ask again for that line. Nothing stops until you press ✓.
|
|
165
|
+
|
|
162
166
|
### Switch it off
|
|
163
167
|
|
|
164
168
|
`pmos ai off outcomes` stops the drafts, and `pmos ai on outcomes` starts them again. `PMOS_OUTCOMES=off` stops the daily read.
|
|
@@ -72,7 +72,7 @@ Each row has two lines:
|
|
|
72
72
|
|
|
73
73
|
To use the log:
|
|
74
74
|
|
|
75
|
-
1. Type a task, an event or a note in the first line and press Enter. Start with **o** for an event (add a time, such as 14:00, to put it on the agenda), with **-** for a note, and with **!** for what comes first. Enter only adds the row. It opens nothing and starts no session.
|
|
75
|
+
1. Type a task, an event or a note in the first line and press Enter. Start with **o** for an event (add a time, such as 14:00, to put it on the agenda), with **-** for a note, and with **!** for what comes first. Enter only adds the row. It opens nothing and starts no session. PMOS reads the words of the line. A time or a meeting word makes it an event ("call Ana Friday 3pm"); **note:** in front makes it a note. Day words give it a day — today, tonight, tomorrow, a weekday, next week, "in 3 days", "25 Nov", "Nov 25" or 2026-12-01 — and the day and time words leave the title. A named person the line gives the work to ("Ana to send the deck", "ask Bob to review", "waiting on Priya") becomes its owner, and the row waits on them. What PMOS read shows on the row as chips; the Undo beside them takes the whole reading off and leaves the line as you typed it. A bullet you type (**o**, **-**) wins over the reading. A line for a later day stays on today's log the day you write it, so you can see what PMOS read, and comes back on its day.
|
|
76
76
|
2. Point at a row to see its icons. The first is its job: **Reply**, **Decide** or **Send** opens the item where you do it, and **Done** marks it done. Then come **Move to tomorrow** and **Set a date**. A done row turns grey. Each change shows Undo for a moment. Before the log draws again, the row shows a short cue for about half a second, so you see which row changed: a done row turns green and slides out, a row you move to another day slides out to the side, and a dropped row fades. Today's check does the same. When your system asks for reduced motion, nothing moves: the row only keeps its colour for a moment.
|
|
77
77
|
3. Press a row, or an event in the agenda, to open that one item in the popup. An ask opens that one mention, not the list of mentions. A task opens its initiative at that task, with the task's row lit, and the task itself in a small popup on top; Esc closes only the small popup. A check ("did it work?") opens its initiative. With the popup open, press **j** or **k** (or **↓** and **↑** in an ask) to open the next or the previous row in its place.
|
|
78
78
|
|
|
@@ -692,4 +692,4 @@ const settle = () => inflight || Promise.resolve();
|
|
|
692
692
|
const stale = () => { if (kept) kept.at = 0; };
|
|
693
693
|
const forget = () => { kept = null; partial = null; inflight = null; lastError = null; startedAt = 0; };
|
|
694
694
|
|
|
695
|
-
module.exports = { build, buildMany, allRowsOf, readMeetings, hooks, refresh, readSources, readFast, readInitiatives, repoKey, readFm, readTripwires, modelOf, refreshNow, settle, stale, forget, rebuild, peekModel, rowsOf, heroOf, todayOf, failedReviews, num };
|
|
695
|
+
module.exports = { OPT_TRIPWIRE, build, buildMany, allRowsOf, readMeetings, hooks, refresh, readSources, readFast, readInitiatives, repoKey, readFm, readTripwires, modelOf, refreshNow, settle, stale, forget, rebuild, peekModel, rowsOf, heroOf, todayOf, failedReviews, num };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* kill-check.js — kill lines are read like outcome checks (initiative kill-lines-checked, job #1843, idea A530).
|
|
3
|
+
* Before this, lib/outcomes.js read an initiative's `kill:` line only after an outcome check said it did not work, so a kill line that was met
|
|
4
|
+
* with no check recorded was never read: 254 of 825 PMOS initiatives carry one and none was ever stopped by it.
|
|
5
|
+
* Pure apart from reading the product's own ledgers; no model, no clock of its own (`today` comes in). It writes nothing: lib/outcome-props.js
|
|
6
|
+
* files what it drafts, and only the PM's ✓ stops anything (lib/routes-proposals.js, the refuted-outcome `kill` step).
|
|
7
|
+
*
|
|
8
|
+
* dueKey(it, today) → the key of the read that is due today, or '' when none is: the check date once it passed ("2026-12-09"),
|
|
9
|
+
* else, with no check date, the Monday of this week ("w2026-11-23"): once a week
|
|
10
|
+
* judge({ root, it, src, recordsDir, refDir, today }) → { met: true, why, claims } | { met: false | null, why }
|
|
11
|
+
* number a kill line with a number and a direction (lib/outcome-judge.js barOf: "under 3 uses", "below 40%") is met when the anchor
|
|
12
|
+
* goal's newest reading on or before today is on that side; the reading's line in kr-metrics.jsonl is cited
|
|
13
|
+
* tracker a kill line that says "not <done|shipped|live|launched|released|started|merged> by <YYYY-MM-DD>" is met when that date passed and
|
|
14
|
+
* the initiative is not done (accepted, or its status says done)
|
|
15
|
+
* Anything else is not judged (met null): PMOS reads no meaning into words it cannot compare.
|
|
16
|
+
* drafts(S, { src, recordsDir, refDir, refuted }) → [draft] the ✦ of every met kill line, in the refuted-outcome shape (data.kind
|
|
17
|
+
* 'refuted', next 'kill'): class C, so it waits for the PM on Today; ✓ stops it, Undo brings it back, ✕ keeps it going.
|
|
18
|
+
* refuted: the ids that already have a current refuted check (lib/outcomes.js refutedDrafts asks for those)
|
|
19
|
+
* isKillRef(ref) → true for a ✦ ref that points at a record's kill line, or at the Experiment artefact's kill set (the refuted-outcome pass leaves those alone)
|
|
20
|
+
* The copy says PMOS, never Claude. */
|
|
21
|
+
const fs = require('fs');
|
|
22
|
+
const path = require('path');
|
|
23
|
+
const O = require('./outcomes.js');
|
|
24
|
+
const J = require('./outcome-judge.js');
|
|
25
|
+
|
|
26
|
+
const DAY = 864e5;
|
|
27
|
+
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]+$/, '') + '…'; };
|
|
28
|
+
const fin = (v) => typeof v === 'number' && Number.isFinite(v);
|
|
29
|
+
const isDay = (d) => /^\d{4}-\d{2}-\d{2}$/.test(String(d || ''));
|
|
30
|
+
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; };
|
|
31
|
+
const DONE_STATUS = /\b(done|shipped|live|launched|released|merged|complete|completed)\b/i;
|
|
32
|
+
const TRACKER = /\bnot\s+(?:yet\s+)?(done|shipped|live|launched|released|started|merged)\s+(?:by|before|on)\s+(\d{4}-\d{2}-\d{2})\b/i;
|
|
33
|
+
const KILL_REF = /(\.md|artefacts\.jsonl):\d+$/; // the record's kill: line, or the Experiment artefact's kill set
|
|
34
|
+
|
|
35
|
+
function monday(today) {
|
|
36
|
+
const t = Date.parse(today + 'T00:00:00Z'), dow = (new Date(t).getUTCDay() + 6) % 7;
|
|
37
|
+
return new Date(t - dow * DAY).toISOString().slice(0, 10);
|
|
38
|
+
}
|
|
39
|
+
function dueKey(it, today) {
|
|
40
|
+
if (!it || !isDay(today)) return '';
|
|
41
|
+
if (it.horizon) return it.horizon <= today ? it.horizon : '';
|
|
42
|
+
return 'w' + monday(today);
|
|
43
|
+
}
|
|
44
|
+
const isKillRef = (ref) => KILL_REF.test(String(ref || ''));
|
|
45
|
+
const doneOf = (it) => !!it.accepted || !!(it.fm && it.fm.status && DONE_STATUS.test(String(it.fm.status.value || '')) && !/\bnot\b/i.test(String(it.fm.status.value || '')));
|
|
46
|
+
|
|
47
|
+
function judge({ root, it, src, recordsDir, refDir, today }) {
|
|
48
|
+
root = path.resolve(root);
|
|
49
|
+
const kill = O.experimentField(root, it, 'kill');
|
|
50
|
+
if (!kill) return { met: null, why: 'It has no kill line.' };
|
|
51
|
+
const killClaim = { text: `Its kill line: ${clip(kill.text, 200)}`, sources: [kill.source] };
|
|
52
|
+
// tracker state: "not shipped by 2026-12-01"
|
|
53
|
+
const tm = TRACKER.exec(kill.text);
|
|
54
|
+
if (tm) {
|
|
55
|
+
if (tm[2] >= today) return { met: false, why: `Its kill line's date, ${tm[2]}, has not passed.` };
|
|
56
|
+
if (doneOf(it)) return { met: false, why: 'It is done, so its kill line is not met.' };
|
|
57
|
+
const claims = [killClaim];
|
|
58
|
+
const st = it.fm && it.fm.status;
|
|
59
|
+
if (st && st.n) { const s = J.srcOf(root, refDir, path.join(root, it.record), st.n, st.text, 'Its status'); if (s) claims.push({ text: `Its status: ${clip(st.value, 160)}`, sources: [s] }); }
|
|
60
|
+
return { met: true, why: `${tm[2]} passed and it is not ${tm[1].toLowerCase()}.`, claims };
|
|
61
|
+
}
|
|
62
|
+
// a number with a direction, against the anchor goal's reading
|
|
63
|
+
const bar = J.barOf(kill.text);
|
|
64
|
+
if (!bar) return { met: null, why: 'Its kill line names no number or date PMOS can compare with.' };
|
|
65
|
+
const GS = require('./goal-source.js');
|
|
66
|
+
const rec = it.anchor && src ? GS.resolve(src, it.anchor) : null;
|
|
67
|
+
if (!rec) return { met: null, why: it.anchor ? `Its anchor ${it.anchor} has no goal that PMOS reads.` : 'It has no anchor goal.' };
|
|
68
|
+
const R = (Array.isArray(rec.readings) ? rec.readings : []).filter((x) => x && fin(x.value) && String(x.at || '').slice(0, 10) <= today);
|
|
69
|
+
if (!R.length) return { met: null, why: `"${clip(rec.title || rec.rid, 80)}" has no reading yet.` };
|
|
70
|
+
const reading = R[R.length - 1], v = reading.value;
|
|
71
|
+
if (!J.meets(bar, v)) return { met: false, why: `"${clip(rec.title || rec.rid, 80)}" reads ${fmt(v, rec.unit)}, which does not meet its kill line.` };
|
|
72
|
+
const file = path.join(recordsDir || GS.recordsDirOf(root), 'kr-metrics.jsonl');
|
|
73
|
+
const line = J.readingLine(file, rec.rid, reading);
|
|
74
|
+
const rs = line ? J.srcOf(root, refDir, file, line.n, line.text, 'The goal\'s reading') : null;
|
|
75
|
+
if (!rs) return { met: null, why: 'The reading could not be cited by its line.' };
|
|
76
|
+
const goal = clip(rec.title || rec.rid, 80), on = String(reading.at).slice(0, 10);
|
|
77
|
+
return { met: true, why: `"${goal}" read ${fmt(v, rec.unit)} on ${on}, which meets it.`, claims: [killClaim, { text: `"${goal}" read ${fmt(v, rec.unit)} on ${on}`, sources: [rs] }] };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The other choices of a missed tripwire (lib/briefing-premium.js OPT_TRIPWIRE), in one sentence. */
|
|
81
|
+
function tripwireWords() {
|
|
82
|
+
let opts = [];
|
|
83
|
+
try { opts = require('./briefing-premium.js').OPT_TRIPWIRE || []; } catch { opts = []; }
|
|
84
|
+
const L = opts.map((o) => String(o.t || '').replace(/^\w/, (c) => c.toLowerCase())).filter(Boolean);
|
|
85
|
+
return L.length ? ` If you keep it, you can also ${L.slice(0, -1).join(', ')}${L.length > 1 ? ' or ' : ''}${L[L.length - 1]}: write why in pm-decisions.md.` : '';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function drafts(S, { src, recordsDir, refDir, refuted = new Set() } = {}) {
|
|
89
|
+
const out = [];
|
|
90
|
+
for (const it of S.subjects) {
|
|
91
|
+
if (refuted.has(it.id)) continue; // a current refuted check asks already (lib/outcomes.js refutedDrafts)
|
|
92
|
+
const key = dueKey(it, S.today); if (!key) continue;
|
|
93
|
+
let j = null;
|
|
94
|
+
try { j = judge({ root: S.root, it, src, recordsDir, refDir, today: S.today }); } catch { j = null; }
|
|
95
|
+
if (!j || j.met !== true) continue;
|
|
96
|
+
const kill = O.experimentField(S.root, it, 'kill');
|
|
97
|
+
const evidence = clip(`Kill line met: ${kill.text}. ${j.why}`, 300);
|
|
98
|
+
out.push({
|
|
99
|
+
id: `outcome-kill:${it.id}:${String(kill.source.ref).split(":").pop()}`, title: clip(`Stop ${it.title}? Kill line met`, 120), confidence: 'medium', claims: j.claims,
|
|
100
|
+
say: `Its kill line is met: "${clip(kill.text, 160)}" (${kill.source.ref}). ${j.why} I suggest stopping it. ✓ stops it with this reason; Undo brings it back. ✕ keeps it going.${tripwireWords()}`,
|
|
101
|
+
data: { kind: 'refuted', initiative: it.id, next: 'kill', check: S.today, ref: kill.source.ref, evidence, metric: it.metric, horizon: null,
|
|
102
|
+
killMet: true, anchor: it.anchor || '', title: it.title, lane: it.lane, work: (it.fm.kind && it.fm.kind.value) || '' },
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return out;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
module.exports = { dueKey, judge, drafts, isKillRef, monday };
|
|
@@ -159,4 +159,4 @@ function drafts(S, { src, recordsDir, stateDir, refDir = stateDir, only = null }
|
|
|
159
159
|
return out;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
module.exports = { judge, drafts, barOf, ASK_AFTER, WORDS };
|
|
162
|
+
module.exports = { judge, drafts, barOf, meets, srcOf, readingLine, ASK_AFTER, WORDS }; // meets, srcOf, readingLine: lib/kill-check.js reads a kill line the same way
|
|
@@ -26,6 +26,10 @@
|
|
|
26
26
|
* that says it did not work, files PMOS's next step under the ✦ (lib/outcomes.js refutedDrafts): stop it when the evidence meets the
|
|
27
27
|
* kill condition, a new experiment after a second refuted check, else one more round. Class C (lib/autonomy.js): only the PM's ✓ does it.
|
|
28
28
|
*
|
|
29
|
+
* A MET KILL LINE (initiative kill-lines-checked, A530). In the hours the PM allows, on each initiative's check date (or weekly with none),
|
|
30
|
+
* PMOS reads its kill line against the anchor goal's reading or the tracker state (lib/kill-check.js). A met one files ONE ✦ to stop it, in
|
|
31
|
+
* the refuted-outcome shape (next `kill`, class C): ✓ stops it, Undo brings it back, ✕ keeps it going.
|
|
32
|
+
*
|
|
29
33
|
* A DUE CHECK (initiative outcome-checks-run-themselves, bet 1 of the factory line). Every tick in the hours the PM allows, PMOS judges each
|
|
30
34
|
* outcome whose check date passed (duePass, lib/outcome-judge.js): the anchor goal's own reading files a verdict ✦ (class B: recorded by
|
|
31
35
|
* itself with Undo); a goal PMOS failed to read twice the same way files ONE ask (class C); else one short run per initiative and check date
|
|
@@ -55,6 +59,7 @@ const path = require('path');
|
|
|
55
59
|
const O = require('./outcomes.js');
|
|
56
60
|
const ST = require('./smallest-test.js');
|
|
57
61
|
const PR = require('./proposals.js');
|
|
62
|
+
const KC = require('./kill-check.js');
|
|
58
63
|
|
|
59
64
|
const PER_DAY = 3;
|
|
60
65
|
const flagOff = (v) => /^(off|0|false|no)$/i.test(String(v == null ? '' : v).trim());
|
|
@@ -209,6 +214,7 @@ function create(deps) {
|
|
|
209
214
|
const live = new Set(D.map((d) => d.data.initiative + '|' + d.data.ref));
|
|
210
215
|
for (const p of F.props.values()) {
|
|
211
216
|
if (p.group !== 'outcome' || p.type !== 'refuted' || kept.has(p.id) || F.drops.has(PR.sigOf(p))) continue;
|
|
217
|
+
if (KC.isKillRef(p.data && p.data.ref)) continue; // a met kill line's ✦ (killPass) is not this pass's to drop
|
|
212
218
|
if (!live.has(p.ini + '|' + ((p.data && (p.data.ref || p.data.check)) || ''))) PR.append(dir, { by: 'pmos:outcomes' }, { kind: 'drop', ini: p.ini, sig: PR.sigOf(p) }); // answered another way: zero is silence
|
|
213
219
|
}
|
|
214
220
|
for (const d of D) {
|
|
@@ -231,6 +237,44 @@ function create(deps) {
|
|
|
231
237
|
return { ws: w.id, filed: (r.filed || []).length, held: !!r.held, off: r.off || null };
|
|
232
238
|
}
|
|
233
239
|
|
|
240
|
+
/** A met kill line (initiative kill-lines-checked, A530; lib/kill-check.js): on the check date, or weekly with none, PMOS reads each kill
|
|
241
|
+
* line against the anchor goal's reading or the tracker state. A met one files ONE ✦ in the refuted-outcome shape (next `kill`, class C):
|
|
242
|
+
* ✓ stops it, Undo brings it back, ✕ keeps it going. Filed once per kill line; a ✦ whose line is no longer met, and not answered, goes. */
|
|
243
|
+
async function killPass(w, { now = Date.now() } = {}) {
|
|
244
|
+
const dir = deps.stateDirFor(w); if (!dir) return { ws: w.id, filed: 0 };
|
|
245
|
+
const S = O.scan(w.root, { today: localDay(now) });
|
|
246
|
+
const GS = require('./goal-source.js');
|
|
247
|
+
let recordsDir = null; try { recordsDir = (deps.recordsDir && deps.recordsDir(w)) || GS.recordsDirOf(w.root); } catch { recordsDir = GS.recordsDirOf(w.root); }
|
|
248
|
+
let src = null; try { src = GS.source({ root: w.root, recordsDir }); } catch { src = null; }
|
|
249
|
+
const refuted = new Set(); try { for (const v of O.verdictsOf(S).values()) if (v.current) refuted.add(v.it.id); } catch { /* none */ }
|
|
250
|
+
const D = KC.drafts(S, { src, recordsDir, refDir: dir, refuted });
|
|
251
|
+
const F = PR.read(dir), kept = PR.keptIds(F), fresh = [];
|
|
252
|
+
const live = new Set(D.map((d) => d.data.initiative + '|' + d.data.ref)), subj = new Set(S.subjects.map((it) => it.id));
|
|
253
|
+
for (const p of F.props.values()) {
|
|
254
|
+
if (p.group !== 'outcome' || p.type !== 'refuted' || !KC.isKillRef(p.data && p.data.ref) || kept.has(p.id) || F.drops.has(PR.sigOf(p))) continue;
|
|
255
|
+
// read on its own day only: a weekly read that is not due today keeps its ✦; one whose line is read and no longer met goes
|
|
256
|
+
const it = S.subjects.find((x) => x.id === p.ini);
|
|
257
|
+
if (!subj.has(p.ini) || (it && KC.dueKey(it, S.today) && !live.has(p.ini + '|' + p.data.ref))) PR.append(dir, { by: 'pmos:outcomes' }, { kind: 'drop', ini: p.ini, sig: PR.sigOf(p) });
|
|
258
|
+
}
|
|
259
|
+
for (const d of D) {
|
|
260
|
+
const board = deps.boardOf(w, d.data.initiative); if (!board) continue;
|
|
261
|
+
const l = lineOf(d, board, ''); if (!l) continue;
|
|
262
|
+
if (F.props.has(l.id)) continue; // filed once per kill line: kept, dropped (keep going) or waiting, never again
|
|
263
|
+
fresh.push({ d, board });
|
|
264
|
+
}
|
|
265
|
+
if (!fresh.length) return { ws: w.id, filed: 0 };
|
|
266
|
+
const AG = guardLib(); if (!AG) return { ws: w.id, filed: 0, why: 'the shared guard is not installed' };
|
|
267
|
+
const rt = deps.runtime && deps.runtime(), version = versionOf(w), run = 'ok' + now.toString(36) + crypto.randomBytes(3).toString('hex');
|
|
268
|
+
if (!AG.off(O.JOB, { env: deps.env || process.env, settingsDir: rt }) && !AG.ready(rt, O.JOB, version)) {
|
|
269
|
+
const rep = await AG.replay(O.JOB, version, cases(S, fresh.map((x) => x.d)), { root: w.root, stateDir: rt, refDir: dir, max: PER_DAY });
|
|
270
|
+
if (!rep.ok) { warn('outcomes replay ' + w.id, new Error(rep.failed.map((f) => f.name + ': ' + f.why).join('; '))); return { ws: w.id, filed: 0, replay: rep }; }
|
|
271
|
+
}
|
|
272
|
+
const byId = new Map(fresh.map((x) => [x.d.id, x]));
|
|
273
|
+
const r = await AG.file({ job: O.JOB, version, run, root: w.root, stateDir: rt, refDir: dir, settingsDir: rt, env: deps.env || process.env, max: PER_DAY }, fresh.map((x) => x.d),
|
|
274
|
+
async (acc) => { for (const p of acc) { const x = byId.get(p.id); const l = x && lineOf(x.d, x.board, run); if (l) PR.append(dir, { by: 'agent:outcomes' }, l); } });
|
|
275
|
+
return { ws: w.id, filed: (r.filed || []).length, held: !!r.held, off: r.off || null };
|
|
276
|
+
}
|
|
277
|
+
|
|
234
278
|
/** The due checks (initiative outcome-checks-run-themselves): PMOS judges each one by itself (lib/outcome-judge.js). A goal's own reading
|
|
235
279
|
* that decides it files a verdict ✦ (class B: lib/auto-keep.js records it with Undo); a goal PMOS failed to read twice the same way files
|
|
236
280
|
* ONE ask; anything else starts one short outcome run per initiative and check date (deps.startRun → lib/proposal-runs.js why `outcome`).
|
|
@@ -318,16 +362,17 @@ function create(deps) {
|
|
|
318
362
|
async function tick({ now = Date.now() } = {}) {
|
|
319
363
|
if (off(deps.env) || busy) return { off: off(deps.env), running: busy };
|
|
320
364
|
busy = true;
|
|
321
|
-
const refuted = [];
|
|
365
|
+
const refuted = [], kills = [];
|
|
322
366
|
try {
|
|
323
367
|
for (const w of deps.workspaces()) {
|
|
324
368
|
try { if (deps.isLead && !deps.isLead(w)) continue; } catch { continue; }
|
|
325
369
|
try { refuted.push(await refutedPass(w, { now })); } catch (e) { warn('outcomes refuted ' + w.id, e); }
|
|
370
|
+
try { if (!deps.open || deps.open(now)) kills.push(await killPass(w, { now })); } catch (e) { warn('outcomes kill ' + w.id, e); } // in the hours the PM allows
|
|
326
371
|
}
|
|
327
372
|
} finally { busy = false; }
|
|
328
373
|
const due = await dueTick({ now });
|
|
329
374
|
const r = await dailyTick({ now });
|
|
330
|
-
return { ...r, refuted, due };
|
|
375
|
+
return { ...r, refuted, kills, due };
|
|
331
376
|
}
|
|
332
377
|
/** Every tick in the hours the PM allows (deps.open): the due checks of each product (duePass). */
|
|
333
378
|
async function dueTick({ now = Date.now() } = {}) {
|
|
@@ -366,7 +411,7 @@ function create(deps) {
|
|
|
366
411
|
const t = setInterval(() => { try { if (deps.mayRun && !deps.mayRun()) return; } catch { /* no lock: run */ } tick({}).catch((e) => warn('outcomes tick', e)); }, deps.every);
|
|
367
412
|
if (t.unref) t.unref();
|
|
368
413
|
}
|
|
369
|
-
return { tick, runProduct, refutedPass, duePass, draftPass };
|
|
414
|
+
return { tick, runProduct, refutedPass, killPass, duePass, draftPass };
|
|
370
415
|
}
|
|
371
416
|
|
|
372
417
|
/** The outcome runs started, as `ini|horizon` keys (<state>/outcome-runs.jsonl). */
|
|
@@ -425,7 +425,9 @@ function applyOne(ctx, p, g, f, ini, x, choices, outbox) {
|
|
|
425
425
|
// iterate a task to change what the check showed, and a new check date (the outcome is open again, so the status reads again)
|
|
426
426
|
// new a new experiment on the same anchor, and this one cancelled
|
|
427
427
|
const O = require('./outcomes.js'), IW = require('./initiative-writer.js'), d = x.data || {};
|
|
428
|
-
|
|
428
|
+
// a met kill line (lib/kill-check.js, its ref is the record's kill line) says so, not "the outcome check said"
|
|
429
|
+
const reason = (require('./kill-check.js').isKillRef(d.ref) ? `${String(d.evidence || '').replace(/[.\s]+$/, '')} (read ${d.check}).`
|
|
430
|
+
: `The outcome check on ${d.check} said it did not work: ${String(d.evidence || '').replace(/[.\s]+$/, '')}.`).slice(0, 440);
|
|
429
431
|
const stop = (why) => { const r = O.setLife(p.w.root, ini, 'cancelled', why, g.actor); if (r.ok) add({ op: 'life', from: r.from || 'active', to: 'cancelled' }); };
|
|
430
432
|
if (d.next === 'kill') stop(reason);
|
|
431
433
|
else if (d.next === 'iterate') {
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* log's own line, so the row keeps its × for the rest of the day.
|
|
13
13
|
*
|
|
14
14
|
* parseEntry(text) → { bullet: 'task' | 'event' | 'note', text, first, time } | null PURE
|
|
15
|
+
* readWords(text, { day }) → { bullet, text, first, time, for, owner, waiting, read: [field] } | null PURE, rules only
|
|
16
|
+
* (capture-words-to-fields): the kind, the date, the time and the owner the words name
|
|
15
17
|
* fold(lines, day) → { entries, marks } PURE. entries: open own entries of `day` and of the days before it
|
|
16
18
|
* (carried), and the ones done on `day`; marks: { [key]: { done?, until?, dropped?, kept? } }
|
|
17
19
|
* addEvent(body, day, id) → { event } | { error } PURE: the line POST /api/today-log/add appends
|
|
@@ -30,12 +32,122 @@ const DAY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
|
30
32
|
const KEY_RE = /^[A-Za-z0-9][A-Za-z0-9._:@/+-]{0,199}$/;
|
|
31
33
|
const ID_RE = /^tl-[0-9a-z]{6,20}$/;
|
|
32
34
|
const BULLETS = ['task', 'event', 'note'];
|
|
33
|
-
const ACTS = ['done', 'undone', 'later', 'now', 'drop', 'undrop', 'keep'];
|
|
35
|
+
const ACTS = ['done', 'undone', 'later', 'now', 'drop', 'undrop', 'keep', 'plain']; // plain: take the rules' reading off an own entry (capture-words-to-fields)
|
|
34
36
|
const MAX_TEXT = 240;
|
|
35
37
|
const SNAP = ['title', 'work', 'job'];
|
|
38
|
+
const READ = ['kind', 'date', 'time', 'owner']; // the fields the rules may read from the words (capture-words-to-fields)
|
|
36
39
|
const FIX_MAX = 3; // quiet-rows: at most 3 line rows a day per product
|
|
37
40
|
const WS_RE = /^[A-Za-z0-9._:@/+-]{0,120}$/;
|
|
38
41
|
|
|
42
|
+
/* ── capture-words-to-fields (job #1845, ideas A535, A538): the words decide the fields ──
|
|
43
|
+
* A typed line is read by RULES ONLY — no model call, nothing sent. The reading is shown as chips the PM can take off (the mark `plain`),
|
|
44
|
+
* so a wrong reading costs one press. What the rules read:
|
|
45
|
+
* kind a time or a meeting word makes it an event ("call Ana Friday 3pm"); "note" or "idea" in front makes it a note; else a task
|
|
46
|
+
* date today · tonight · tomorrow · a weekday ("Friday", "next Monday") · "in 3 days" · "next week" · "25 Nov" · "Nov 25" · 2026-12-01
|
|
47
|
+
* time "3pm", "3.30pm", "15:00", "9.15", "at 9"
|
|
48
|
+
* owner a named person the line gives the work to: "Ana to send the deck", "ask Ana to …", "waiting on Ana", "Ana will …", "chase Ana"
|
|
49
|
+
* → owner Ana and `waiting: true`, the waiting-on row
|
|
50
|
+
* The date and time words are taken out of the text (the chips hold them); the owner's words stay, because the line reads as written. */
|
|
51
|
+
const WEEK = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
|
|
52
|
+
const MEET = /\b(meeting|meet|call|lunch|coffee|sync|standup|stand-up|1:1|one-on-one|interview|demo|review with|catch ?up|dinner|breakfast)\b/i;
|
|
53
|
+
const NOTE_RE = /^(?:note|idea|thought)s?\s*[:\-–]\s*/i;
|
|
54
|
+
/* The words that are never a person's name, however they are capitalized: the line starts with them often enough that without this list
|
|
55
|
+
* "Call Ana" would read Call as the owner. */
|
|
56
|
+
const NOT_NAME = new Set(['the', 'a', 'an', 'i', 'we', 'ask', 'call', 'email', 'send', 'write', 'draft', 'check', 'chase', 'review', 'read', 'fix', 'plan', 'book', 'buy', 'pay', 'tell', 'talk', 'move', 'start',
|
|
57
|
+
'finish', 'ship', 'note', 'idea', 'today', 'tonight', 'tomorrow', 'next', 'this', 'waiting', 'wait', 'need', 'needs', 'let', 'make', 'get', 'go', 'do', 'it', 'they', 'he', 'she', 'everyone', 'team', 'all', ...WEEK]);
|
|
58
|
+
const NAME = '([A-Z][a-z]+(?:\\s[A-Z][a-z]+)?)';
|
|
59
|
+
const OWNER_RES = [
|
|
60
|
+
new RegExp('^(?:ask|chase|remind|ping|nudge)\\s+' + NAME + '\\s+(?:to|for|about)\\b', ''),
|
|
61
|
+
new RegExp('^' + NAME + '\\s+(?:to|will|owes|is sending|is to)\\b', ''),
|
|
62
|
+
new RegExp('\\bwaiting (?:on|for)\\s+' + NAME, ''),
|
|
63
|
+
new RegExp('\\b(?:from|with)\\s+' + NAME + '\\s+(?:by|before|on)\\b', ''),
|
|
64
|
+
];
|
|
65
|
+
const addDays = (day, n) => { const d = new Date(day + 'T00:00:00Z'); d.setUTCDate(d.getUTCDate() + n); return d.toISOString().slice(0, 10); };
|
|
66
|
+
const MONTHS = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
|
|
67
|
+
|
|
68
|
+
/** The date the words name, and the words to take out. day = the PM's local day. PURE → { date, cut } | null */
|
|
69
|
+
function dateWords(t, day) {
|
|
70
|
+
if (!DAY_RE.test(String(day || ''))) return null;
|
|
71
|
+
const take = (re, to) => { const m = re.exec(t); return m ? { date: to(m), cut: m[0] } : null; };
|
|
72
|
+
const iso = take(/(?:^|\s)(\d{4}-\d{2}-\d{2})(?=\s|$)/, (m) => m[1]);
|
|
73
|
+
if (iso && DAY_RE.test(iso.date)) return iso;
|
|
74
|
+
const dm = take(new RegExp('(?:^|\\s)(?:on\\s+)?(\\d{1,2})\\s*(' + MONTHS.join('|') + ')[a-z]*(?=\\s|$)', 'i'), (m) => ({ d: +m[1], mo: MONTHS.indexOf(m[2].toLowerCase()) }))
|
|
75
|
+
|| take(new RegExp('(?:^|\\s)(?:on\\s+)?(' + MONTHS.join('|') + ')[a-z]*\\s+(\\d{1,2})(?=\\s|$)', 'i'), (m) => ({ d: +m[2], mo: MONTHS.indexOf(m[1].toLowerCase()) }));
|
|
76
|
+
if (dm) {
|
|
77
|
+
const y = +day.slice(0, 4), mo = dm.date.mo, d = dm.date.d;
|
|
78
|
+
if (mo >= 0 && d >= 1 && d <= 31) {
|
|
79
|
+
let iso2 = y + '-' + String(mo + 1).padStart(2, '0') + '-' + String(d).padStart(2, '0');
|
|
80
|
+
if (iso2 < day) iso2 = (y + 1) + iso2.slice(4); // a month already gone means next year
|
|
81
|
+
return { date: iso2, cut: dm.cut };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const soon = take(/(?:^|\s)(today|tonight|tomorrow|tmr|next week)(?=\s|$)/i, (m) => m[1].toLowerCase());
|
|
85
|
+
if (soon) return { date: soon.date === 'next week' ? addDays(day, 7) : soon.date === 'tomorrow' || soon.date === 'tmr' ? addDays(day, 1) : day, cut: soon.cut };
|
|
86
|
+
const inn = take(/(?:^|\s)in\s+(\d{1,2})\s+days?(?=\s|$)/i, (m) => +m[1]);
|
|
87
|
+
if (inn && inn.date >= 1 && inn.date <= 60) return { date: addDays(day, inn.date), cut: inn.cut };
|
|
88
|
+
const wd = take(new RegExp('(?:^|\\s)(?:(next)\\s+)?(?:on\\s+)?(' + WEEK.join('|') + '|mon|tue|tues|wed|thu|thur|thurs|fri|sat|sun)(?=\\s|$)', 'i'), (m) => m);
|
|
89
|
+
if (wd) {
|
|
90
|
+
const w = wd.date[2].toLowerCase(), i = WEEK.findIndex((x) => x.startsWith(w.slice(0, 3)));
|
|
91
|
+
const from = new Date(day + 'T00:00:00Z').getUTCDay();
|
|
92
|
+
let ahead = (i - from + 7) % 7 || 7; // "Friday" on a Friday means the next one
|
|
93
|
+
if (wd.date[1]) ahead += ahead <= 6 && i !== from ? 0 : 0; // "next Friday" is the same Friday when this week's has gone
|
|
94
|
+
return { date: addDays(day, ahead), cut: wd.cut };
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** The time the words name, and the words to take out. PURE → { time, cut } | null */
|
|
100
|
+
function timeWords(t) {
|
|
101
|
+
let m = /(?:^|\s)(?:at\s+)?(1[0-2]|0?[1-9])(?:[:.]([0-5]\d))?\s*([ap])\.?m\.?(?=\s|$)/i.exec(t);
|
|
102
|
+
if (m) { let h = +m[1] % 12; if (/p/i.test(m[3])) h += 12; return { time: String(h).padStart(2, '0') + ':' + (m[2] || '00'), cut: m[0] }; }
|
|
103
|
+
m = /(?:^|\s)(?:at\s+)?([01]?\d|2[0-3])[:.]([0-5]\d)(?=\s|$)/.exec(t);
|
|
104
|
+
if (m) return { time: String(m[1]).padStart(2, '0') + ':' + m[2], cut: m[0] };
|
|
105
|
+
m = /(?:^|\s)at\s+([01]?\d|2[0-3])(?=\s|$)/.exec(t);
|
|
106
|
+
if (m) return { time: String(m[1]).padStart(2, '0') + ':00', cut: m[0] };
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** The person the line gives the work to. PURE → name | '' */
|
|
111
|
+
function ownerWords(t) {
|
|
112
|
+
for (const re of OWNER_RES) {
|
|
113
|
+
const m = re.exec(t);
|
|
114
|
+
if (!m) continue;
|
|
115
|
+
const name = m[1].trim();
|
|
116
|
+
if (!NOT_NAME.has(name.split(' ')[0].toLowerCase())) return name.slice(0, 60);
|
|
117
|
+
}
|
|
118
|
+
return '';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Take the words out, with the preposition that only led to them ("by Friday", "due 25 Nov"). PURE */
|
|
122
|
+
function cutOut(t, cut) {
|
|
123
|
+
const at = t.indexOf(cut);
|
|
124
|
+
if (at < 0) return t;
|
|
125
|
+
const before = t.slice(0, at).replace(/\s+(by|on|due|before|from|until|till)\s*$/i, ' ');
|
|
126
|
+
return (before + ' ' + t.slice(at + cut.length)).replace(/\s+/g, ' ').trim();
|
|
127
|
+
}
|
|
128
|
+
|
|
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. */
|
|
131
|
+
function readWords(text, { day } = {}) {
|
|
132
|
+
const e = parseEntry(text);
|
|
133
|
+
if (!e) return null;
|
|
134
|
+
let t = e.text, bullet = e.bullet, time = e.time, read = [];
|
|
135
|
+
const typed = /^\s*!?\s*[o○•\-–—]\s/.test(String(text == null ? '' : text)); // a typed bullet is the PM's word, not the rules'
|
|
136
|
+
if (!typed && NOTE_RE.test(t)) { bullet = 'note'; t = t.replace(NOTE_RE, '').trim(); read.push('kind'); }
|
|
137
|
+
const D = dateWords(t, day);
|
|
138
|
+
if (D) t = cutOut(t, D.cut);
|
|
139
|
+
const T = time ? null : timeWords(t);
|
|
140
|
+
if (T) { t = cutOut(t, T.cut); time = T.time; }
|
|
141
|
+
if (!typed && bullet !== 'note' && (time || (D && MEET.test(t)))) { if (bullet !== 'event') read.push('kind'); bullet = 'event'; }
|
|
142
|
+
const owner = ownerWords(t);
|
|
143
|
+
if (!t) return e; // the words were only a date: the line as typed stands
|
|
144
|
+
if (D) read.push('date');
|
|
145
|
+
if (T) read.push('time');
|
|
146
|
+
if (owner) read.push('owner');
|
|
147
|
+
const forDay = D && DAY_RE.test(String(day || '')) && D.date > day ? D.date : '';
|
|
148
|
+
return { bullet, text: t.slice(0, MAX_TEXT), first: e.first, time: bullet === 'event' ? time : null, for: forDay, owner, waiting: !!owner, read };
|
|
149
|
+
}
|
|
150
|
+
|
|
39
151
|
/** One line the PM typed. A leading "!" marks it first; "o " or "○ " makes it an event, "- " or "– " a note, "• " or nothing a task.
|
|
40
152
|
* An event's time ("10:30", "9.15", "14:00") is read from its words and kept apart. */
|
|
41
153
|
function parseEntry(text) {
|
|
@@ -60,11 +172,13 @@ function parseEntry(text) {
|
|
|
60
172
|
function addEvent(body, day, id) {
|
|
61
173
|
if (!DAY_RE.test(String(day || ''))) return { error: 'day is YYYY-MM-DD' };
|
|
62
174
|
if (!ID_RE.test(String(id || ''))) return { error: 'bad id' };
|
|
63
|
-
const e =
|
|
175
|
+
const e = readWords(body && body.text, { day });
|
|
64
176
|
if (!e) return { error: 'write the task, the event or the note first' };
|
|
65
177
|
if (body.bullet != null && !BULLETS.includes(body.bullet)) return { error: 'bullet is task, event or note' };
|
|
66
178
|
const bullet = body.bullet || e.bullet;
|
|
67
|
-
|
|
179
|
+
const read = body.bullet ? (e.read || []).filter((f) => f !== 'kind') : (e.read || []); // a bullet the page sent wins over the rules
|
|
180
|
+
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 } : {}) } };
|
|
68
182
|
}
|
|
69
183
|
|
|
70
184
|
/** The line POST /api/today-log/mark appends. body: { key, act, day, until? (later), snap? { title, work, job } (done: what the row
|
|
@@ -111,7 +225,8 @@ function fold(lines, day) {
|
|
|
111
225
|
// quiet-rows: the day's line rows per product; only the day asked for, the latest line of a product wins
|
|
112
226
|
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; }
|
|
113
227
|
if (ev.event === 'added' && ID_RE.test(String(ev.id || '')) && BULLETS.includes(ev.bullet)) {
|
|
114
|
-
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
|
|
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,
|
|
229
|
+
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)) : [] });
|
|
115
230
|
continue;
|
|
116
231
|
}
|
|
117
232
|
if (ev.event !== 'mark' || !KEY_RE.test(String(ev.key || '')) || !ACTS.includes(ev.act)) continue;
|
|
@@ -123,6 +238,7 @@ function fold(lines, day) {
|
|
|
123
238
|
else if (ev.act === 'drop') m.dropped = ev.day;
|
|
124
239
|
else if (ev.act === 'undrop') delete m.dropped;
|
|
125
240
|
else if (ev.act === 'keep') m.kept = ev.day;
|
|
241
|
+
else if (ev.act === 'plain') m.plain = ev.day;
|
|
126
242
|
}
|
|
127
243
|
// a done mark of an earlier day is history: the row is gone from today's log (an own entry), or it is back as its source says
|
|
128
244
|
for (const k of Object.keys(marks)) { const m = marks[k]; if (m.done && m.done !== d) { m.doneBefore = m.done; delete m.done; delete m.snap; } if (!Object.keys(m).length) delete marks[k]; }
|
|
@@ -131,6 +247,9 @@ function fold(lines, day) {
|
|
|
131
247
|
const m = marks[e.key] || {};
|
|
132
248
|
if (m.dropped) continue;
|
|
133
249
|
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; }
|
|
251
|
+
// 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
|
+
if (e.for && e.for > d && e.day !== d) continue;
|
|
134
253
|
entries.push({ ...e, done: !!m.done });
|
|
135
254
|
}
|
|
136
255
|
return { entries, marks, fixed };
|
|
@@ -146,4 +265,4 @@ function appendLine(file, line, now = new Date()) {
|
|
|
146
265
|
fs.appendFileSync(file, JSON.stringify({ ...line, at: now.toISOString() }) + '\n');
|
|
147
266
|
}
|
|
148
267
|
|
|
149
|
-
module.exports = { DAY_RE, KEY_RE, BULLETS, ACTS, FIX_MAX, parseEntry, addEvent, markEvent, fixEvent, fold, readLines, appendLine };
|
|
268
|
+
module.exports = { DAY_RE, KEY_RE, BULLETS, ACTS, FIX_MAX, READ, parseEntry, readWords, dateWords, timeWords, ownerWords, addEvent, markEvent, fixEvent, fold, readLines, appendLine };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.809.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.809.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -385,6 +385,14 @@ export function mountToday(ctx) {
|
|
|
385
385
|
ctx.toast('Kept. PMOS will not suggest it again for a month.');
|
|
386
386
|
return after(false);
|
|
387
387
|
}
|
|
388
|
+
/** capture-words-to-fields: take PMOS's reading off this line. The line keeps the words the PM typed; the kind, the date, the time and
|
|
389
|
+
* the owner go. One press, and nothing else changes. */
|
|
390
|
+
async function plain(r) {
|
|
391
|
+
const m = await mark(r.key, 'plain');
|
|
392
|
+
if (!m.ok) return ctx.toast('The reading stayed: ' + m.error + '.');
|
|
393
|
+
ctx.toast('PMOS’s reading is off. The line is as you typed it.');
|
|
394
|
+
return after(true);
|
|
395
|
+
}
|
|
388
396
|
async function lab(r, yes) {
|
|
389
397
|
const f = r.ref || {};
|
|
390
398
|
const res = await ctx.pmPost(yes ? '/api/lab/keep' : '/api/lab/drop', { ws: f.ws || undefined, id: f.id }).catch(() => null);
|
|
@@ -557,6 +565,7 @@ export function mountToday(ctx) {
|
|
|
557
565
|
else if (act === 'tomorrow') await later(r, TM.addDays(day(), 1));
|
|
558
566
|
else if (act === 'drop') await drop(r);
|
|
559
567
|
else if (act === 'keep') await keep(r);
|
|
568
|
+
else if (act === 'plain') await plain(r);
|
|
560
569
|
else if (act === 'lab-keep' || act === 'lab-drop') await lab(r, act === 'lab-keep');
|
|
561
570
|
else if (act === 'lk-yes' || act === 'lk-no') await looks(r, act === 'lk-yes');
|
|
562
571
|
else if (act === 'same-yes' || act === 'same-no') await same(r, act === 'same-yes');
|
|
@@ -245,8 +245,10 @@ export function logModel(o = {}) {
|
|
|
245
245
|
for (const e of o.own || []) {
|
|
246
246
|
if (!e || !e.key) continue;
|
|
247
247
|
const carried = e.day && e.day < today && !e.done ? between(e.day, today) : 0;
|
|
248
|
+
// capture-words-to-fields: the fields the words gave ride along as chips (read), with the owner the line waits on
|
|
248
249
|
put({ key: e.key, src: 'own', bullet: e.bullet, first: !!e.first, title: e.text, job: e.bullet === 'task' ? 'Do' : '', carried, late: carried >= LATE_DAYS,
|
|
249
|
-
when: whenWord({ carried, time: e.bullet === 'event' && !carried ? e.time : '' }, today)
|
|
250
|
+
when: whenWord({ carried, time: e.bullet === 'event' && !carried ? e.time : '' }, today) || (e.for && e.for > today ? (e.for === addDays(today, 1) ? 'Tomorrow' : dm(e.for, today)) : ''),
|
|
251
|
+
owner: e.owner || '', waiting: !!e.waiting, read: Array.isArray(e.read) ? e.read : [], forDay: e.for || '', done: !!e.done, ref: e });
|
|
250
252
|
}
|
|
251
253
|
for (const f of o.lab || []) if (f && f.id) put({ key: 'lab:' + (f.ws || '') + ':' + f.id, src: 'lab', bullet: 'lab', title: f.title, work: '', job: 'Decide', why: f.why || '', ref: f });
|
|
252
254
|
// open-questions-today (A420): the register (GET /api/open-questions) is the Decide tab's two groups; a line waiting on the PM whose
|
|
@@ -48,6 +48,11 @@ button.td-t:focus-visible, .td-ln:focus-visible, .td-evl:focus-visible { outline
|
|
|
48
48
|
.td-li.hd .acts { display: flex; } /* Undo on every handled row */
|
|
49
49
|
.td-did { display: inline-flex; align-items: center; gap: 2px; margin-right: var(--space-8); color: var(--blue); font-weight: var(--fw-strong); }
|
|
50
50
|
.td-did b { font-weight: var(--fw-regular); }
|
|
51
|
+
/* capture-words-to-fields: the chips of what PMOS read from the words, with the Undo that takes the reading off */
|
|
52
|
+
.td-rd { display: inline-flex; align-items: center; gap: var(--space-4); margin-left: var(--space-4); }
|
|
53
|
+
.td-rd .pm-badge { color: var(--muted); }
|
|
54
|
+
.td-rd .td-ib { opacity: 0; }
|
|
55
|
+
.td-li:hover .td-rd .td-ib, .td-li:focus-within .td-rd .td-ib { opacity: 1; }
|
|
51
56
|
.rows .td-sg { margin: 2px var(--space-8) var(--space-8) 42px; } /* a Suggestion under its row lines up with the title */
|
|
52
57
|
.td-fold { width: calc(100% - 32px); margin: 0 var(--space-16); }
|
|
53
58
|
.td-fold:last-child { margin-bottom: var(--space-8); }
|
|
@@ -27,6 +27,7 @@ export const I = {
|
|
|
27
27
|
yes: 'M5 12.5l4.5 4.5L19 7.5', no: 'M6 6l12 12M18 6L6 18', cal: 'M4 5.5h16v14H4zM4 10h16M8.5 3.5v4M15.5 3.5v4', more: 'M8 10l4 4 4-4', play: 'M8 5v14l11-7z',
|
|
28
28
|
reply: 'M5 5h14v10H9l-4 4z', decide: 'M12 4l8 8-8 8-8-8z', send: 'M4 12l16-8-6 16-3-7z',
|
|
29
29
|
spark: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z',
|
|
30
|
+
undo: 'M9 14L4 9l5-5M4 9h11a5 5 0 0 1 0 10h-3',
|
|
30
31
|
sun: 'M12 3v2M12 19v2M5 5l1.4 1.4M17.6 17.6L19 19M3 12h2M19 12h2M5 19l1.4-1.4M17.6 6.4L19 5M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8z',
|
|
31
32
|
};
|
|
32
33
|
/** The small sign of each type (one stroke icon). */
|
|
@@ -79,13 +80,15 @@ export function rowHtml(r, o = {}) {
|
|
|
79
80
|
const opens = !r.done && r.src !== 'own' && r.src !== 'gone' && r.src !== 'note';
|
|
80
81
|
const title = opens ? `<button type="button" class="t td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(t)}${r.members ? ic(I.more, 14) : ''}</button>` : `<span class="t td-t">${esc(t)}</span>`;
|
|
81
82
|
const first = r.first && !r.done && r.src === 'own' ? '<span class="pm-badge blue">First</span>' : '';
|
|
83
|
+
// capture-words-to-fields: what the words gave, as chips, with the one press that takes the reading off
|
|
84
|
+
const chips = readChips(r);
|
|
82
85
|
// what PMOS did on it, from records (round 3 point 13): a small ✦ with the count; its words on hover and for a screen reader
|
|
83
86
|
const did = r.did && r.did.length && !r.done ? `<span class="td-did" title="${esc('PMOS did: ' + r.did.join('; '))}" aria-label="${esc('PMOS did: ' + r.did.join('; '))}"><b aria-hidden="true">✦</b>${r.did.length}</span>` : '';
|
|
84
87
|
const why = r.member ? '' : whyLine(r);
|
|
85
88
|
const w = why || did ? `<span class="w td-rs">${did}${esc(why)}</span>` : '';
|
|
86
89
|
const late = lateOf(r);
|
|
87
90
|
const row = `<div class="${cls}" data-key="${esc(r.key)}"><span class="td-kind" role="img" aria-label="${esc(kl)}">${ic(kd)}</span><span class="txt">${title}${w}</span>`
|
|
88
|
-
+ `${first}${late ? `<span class="pm-badge alert">${esc(late)}</span>` : ''}${acts ? `<span class="acts td-a">${acts}</span>` : ''}</div>`;
|
|
91
|
+
+ `${first}${chips}${late ? `<span class="pm-badge alert">${esc(late)}</span>` : ''}${acts ? `<span class="acts td-a">${acts}</span>` : ''}</div>`;
|
|
89
92
|
const sug = r.drop ? sugHtml('PMOS suggests: drop it from your log.', ['drop', 'Drop it'], ['keep', 'Keep it'], r.key) : '';
|
|
90
93
|
const lk = r.looks && !r.done ? sugHtml('Looks answered: ' + (r.looks.who ? r.looks.who + ' replied' : 'someone replied') + ' “' + r.looks.text + '”. Close it?', ['lk-yes', 'Yes, close it: it is answered'], ['lk-no', 'No, it still waits on me'], r.key) : '';
|
|
91
94
|
// the same step for N initiatives: PMOS drafts them, he approves once (audit round 2)
|
|
@@ -94,6 +97,22 @@ export function rowHtml(r, o = {}) {
|
|
|
94
97
|
return row + sug + sj + lk + lab;
|
|
95
98
|
}
|
|
96
99
|
|
|
100
|
+
/** The chips of a line PMOS read from the words (capture-words-to-fields): the kind, the date and time, and the person it waits on, each
|
|
101
|
+
* one word; then the Undo that takes the whole reading off and leaves the line as it was typed. '' when the words gave nothing. */
|
|
102
|
+
function readChips(r) {
|
|
103
|
+
if (!r || r.src !== 'own' || r.done || !(r.read || []).length) return '';
|
|
104
|
+
const got = new Set(r.read);
|
|
105
|
+
const ch = [];
|
|
106
|
+
if (got.has('kind')) ch.push(r.bullet === 'event' ? 'Event' : r.bullet === 'note' ? 'Note' : 'Task');
|
|
107
|
+
if (got.has('date') && r.when) ch.push(r.when);
|
|
108
|
+
if (got.has('time') && r.ref && r.ref.time && !(got.has('date') && r.when === r.ref.time)) ch.push(r.ref.time);
|
|
109
|
+
if (got.has('owner') && r.owner) ch.push((r.waiting ? 'Waiting on ' : '') + r.owner);
|
|
110
|
+
if (!ch.length) return '';
|
|
111
|
+
return `<span class="td-rd" role="group" aria-label="${esc('PMOS read: ' + ch.join(', '))}">`
|
|
112
|
+
+ ch.map((c) => `<span class="pm-badge">${esc(c)}</span>`).join('')
|
|
113
|
+
+ ib('plain', 'Undo what PMOS read: keep the line as you typed it', I.undo, r.key, '', 'outline') + '</span>';
|
|
114
|
+
}
|
|
115
|
+
|
|
97
116
|
/** A tracker sync Suggestion (tracker-sync-on-today, board TrackerSyncDesk): ✓ takes Jira's value on all, ✕ keeps PMOS's, the arrow opens
|
|
98
117
|
* the differences, each with its own ✓. x: cozy-today-model.js syncSuggest()[i]. */
|
|
99
118
|
function syncHtml(x) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "capture-words-to-fields (job #1845, A535, A538): Today's capture line reads the kind, the date, the time and the owner from the words, with chips and an Undo. No browser, no network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"capture-words.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"capture-words.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Kill lines are read like outcome checks (kill-lines-checked, idea A530, done test planning/done-tests/kill-lines-checked.md K1-K4, N1-N3): when a kill line is due, a number against the goal's reading, tracker state, the Stop ✦ and the outcome pass. No server, network, model or browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"kill-check.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"kill-check.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|