create-pmos 0.654.0 → 0.656.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 +27 -27
- 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 +26 -0
- package/workspace/guide/agent-capabilities.md +13 -2
- package/workspace/guide/cli.md +1 -0
- package/workspace/guide/settings-and-switches.md +1 -1
- package/workspace/lib/ai-guard.js +9 -7
- package/workspace/lib/autonomy.js +5 -2
- package/workspace/lib/bg-queue.js +1 -0
- package/workspace/lib/headless.js +1 -1
- package/workspace/lib/job-graph.js +5 -1
- 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/question-batch.js +91 -0
- package/workspace/lib/routes-proposals.js +57 -1
- package/workspace/lib/routes-your-move.js +17 -4
- package/workspace/lib/source-guard.js +79 -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 +3 -0
- package/workspace/skills/initiative-propose.skill +8 -2
- package/workspace/test-lists/act-alone-only-with-a-source.json +11 -0
- package/workspace/test-lists/outcome-checks-run-themselves.json +11 -0
|
@@ -81,6 +81,8 @@ function keepCore(ctx, p, g, f, ini, want, choices = {}, extra = {}) {
|
|
|
81
81
|
const w = applyOne(ctx, p, g, f, ini, x, choices, outbox);
|
|
82
82
|
if (x.group === 'build' && !w.length) { failed.push({ id: x.id, why: x.failed || 'not opened' }); continue; } // stays open, says why
|
|
83
83
|
if (x.group === 'live' && !w.length) { failed.push({ id: x.id, why: x.failed || 'the round did not start' }); continue; } // stays open, says why
|
|
84
|
+
// a verdict on an outcome that is no longer due on its date: nothing is recorded and the ✦ goes (the PM answered it another way)
|
|
85
|
+
if (x.group === 'outcome' && x.type === 'verdict' && !w.length) { failed.push({ id: x.id, why: x.failed || 'not recorded' }); if (x.sig || x.why) PR.append(dir, { by: 'pmos:outcomes' }, { kind: 'drop', ini, sig: PR.sigOf(x), id: x.id, group: 'outcome', type: 'verdict' }); continue; }
|
|
84
86
|
if ((x.group === 'prototyped' || x.group === 'improved') && !w.length && x.failed) { failed.push({ id: x.id, why: x.failed }); continue; } // a round still being made stays open
|
|
85
87
|
wrote.push(...w);
|
|
86
88
|
if (x.group === 'dates' && x.plan && w.some((y) => y.op === 'dates')) plans++;
|
|
@@ -122,6 +124,14 @@ function undoCore(ctx, p, g, id) {
|
|
|
122
124
|
else if (w.op === 'created') { r = RB.writeAs(ctx, '/api/boards/ini-delete', { ws: p.w.id, board: p.board.id, id: w.id }, g); }
|
|
123
125
|
else if (w.op === 'round') { const LR = require('./live-round.js'); LR.cancel(w.round); if (w.proposal) LR.dropCard(dir, w.proposal); back++; continue; } // a live round: its runs stop and its card goes
|
|
124
126
|
else if (w.op === 'pr') { const r2 = require('./build-engine.js').close(p.w.root, w.item, { url: w.url }); if (r2.ok) back++; else kept++; continue; } // D108: Undo closes the pull request (the branch stays)
|
|
127
|
+
else if (w.op === 'verdict') {
|
|
128
|
+
// the PM's Undo of a verdict PMOS recorded by itself: the check is taken back (the outcome is due again, and Your move asks the PM),
|
|
129
|
+
// and the ✦ is dropped so PMOS does not record the same verdict again
|
|
130
|
+
const r2 = require('./outcomes.js').undoCheck(p.w.root, { initiative: k.ini, at: w.at, by: (g.actor && g.actor.by) || 'pm', via: 'ui' });
|
|
131
|
+
if (r2.ok) back++; else kept++;
|
|
132
|
+
for (const pid of k.ids) { const pp = F.props.get(pid); if (pp && pp.group === 'outcome' && pp.type === 'verdict') PR.append(dir, { by: 'pmos:outcomes' }, { kind: 'drop', ini: k.ini, sig: PR.sigOf(pp), id: pid, group: 'outcome', type: 'verdict' }); }
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
125
135
|
else if (w.op === 'outcome') { const r2 = require('./initiative-writer.js').restoreOutcome(p.w.root, k.ini, w.from || {}, w.to || {}, { actor: g.actor }); if (r2.ok && !r2.kept) back++; else kept++; continue; } // a record edited since keeps its edit
|
|
126
136
|
if (r && r.body && r.body.ok) back++; else kept++;
|
|
127
137
|
}
|
|
@@ -162,6 +172,7 @@ function autoKeep(ctx, w, { modeOf = () => 'auto', now } = {}) {
|
|
|
162
172
|
if (!d.apply) { out.held++; continue; }
|
|
163
173
|
try {
|
|
164
174
|
const r = keepCore(ctx, p, g, f, ini, [x], {}, { auto: true, group: x.group });
|
|
175
|
+
if (!r.keptIds.length) { out.held++; continue; } // nothing landed (a verdict no longer due, a pull request not opened): nothing to list
|
|
165
176
|
A.recordApplied(dir, { job: `propose:${x.group}`, product: w.id, ref: r.batch, title: x.title || x.why || x.group, cls, ini, why: x.title && x.why && x.why !== x.title ? x.why : '' }, { now, settingsDir: ctx.runtimeDir || null });
|
|
166
177
|
out.applied.push({ ini, batch: r.batch, group: x.group, title: x.title || x.why || '' });
|
|
167
178
|
} catch { out.held++; }
|
|
@@ -171,6 +182,32 @@ function autoKeep(ctx, w, { modeOf = () => 'auto', now } = {}) {
|
|
|
171
182
|
return out;
|
|
172
183
|
}
|
|
173
184
|
|
|
185
|
+
/** act-alone-only-with-a-source: the open proposals of a workspace that PMOS holds for want of a source (lib/source-guard.js), on every
|
|
186
|
+
* board, for the day's question list (lib/question-batch.js). → [{ ini, title, board, prop, hold }] */
|
|
187
|
+
function heldOf(ctx, w) {
|
|
188
|
+
const SG = require('./source-guard.js');
|
|
189
|
+
const out = [];
|
|
190
|
+
if (!dirOf(ctx, w)) return out;
|
|
191
|
+
const fr = RB.frameFor(ctx, w);
|
|
192
|
+
for (const board of fr.boards || []) {
|
|
193
|
+
// no derive: a read that finds the rows still being derived skips the board this time (the list is fixed later in the day, and the
|
|
194
|
+
// synchronous derive would hold the server for every request behind it)
|
|
195
|
+
const f = TLR.frame(ctx, w, board);
|
|
196
|
+
if (!f) continue;
|
|
197
|
+
for (const row of f.rows || []) {
|
|
198
|
+
if (!row || !row.id) continue;
|
|
199
|
+
let v = null;
|
|
200
|
+
try { v = view(ctx, { w, fr, board, file: null }, row.id, f, { grillAll: true }); } catch { v = null; }
|
|
201
|
+
if (!v) continue;
|
|
202
|
+
for (const x of v.groups.flatMap((gr) => gr.props)) {
|
|
203
|
+
const hold = SG.holdOf(x);
|
|
204
|
+
if (hold) out.push({ ini: row.id, title: row.title || row.name || row.id, board: board.id, prop: x, hold });
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return out;
|
|
209
|
+
}
|
|
210
|
+
|
|
174
211
|
/** The writes of one proposal. → [write] (each { op, ... } that landed). sk: the item ids the PM left out (✕ on one item). */
|
|
175
212
|
/** A live round's specimen kept (lib/live-round.js): it is the experiment's kept specimen and a lesson, and the grill runs once on it as
|
|
176
213
|
* the Review step (D60 as amended 2026-11-17: never during the round, once after ✓). A grill that cannot start now is said in the lesson. */
|
|
@@ -266,6 +303,24 @@ function applyOne(ctx, p, g, f, ini, x, choices, outbox) {
|
|
|
266
303
|
const next = String((x.data && x.data.next) || x.title || 'Change the factory harness').slice(0, 200);
|
|
267
304
|
const r = RB.taskAdd(ctx, { ws: p.w.id, board: p.board.id, initiative: ini, title: next, notes: [x.why, source ? 'From ' + source : ''].filter(Boolean).join('\n').slice(0, 1900) }, g);
|
|
268
305
|
if (W.ok(r)) add({ op: 'add', task: r.body.item && (r.body.item.uid || r.body.item.id), title: next, to: { start: '', due: '' } });
|
|
306
|
+
} else if (x.group === 'outcome' && x.type === 'verdict') {
|
|
307
|
+
// PMOS's own verdict on a due outcome (initiative outcome-checks-run-themselves). Class B: recorded at once with Undo. It records only
|
|
308
|
+
// while the check is still due on the date it answers: a verdict the PM gave another way, or a check date moved since, writes nothing.
|
|
309
|
+
const O = require('./outcomes.js'), d = x.data || {};
|
|
310
|
+
const S = O.scan(p.w.root);
|
|
311
|
+
const it = S.due.find((y) => y.id === ini);
|
|
312
|
+
if (!it || it.horizon !== d.horizon) x.failed = 'This outcome is not due on that date any more.';
|
|
313
|
+
else {
|
|
314
|
+
const by = g.actor && g.actor.by && g.actor.by !== 'agent:auto' ? g.actor.by : 'agent:outcomes';
|
|
315
|
+
const r = O.recordCheck(p.w.root, { initiative: ini, disposition: d.disposition, evidence: d.evidence, by, via: 'pmos', sources: x.sources || [] });
|
|
316
|
+
if (r.ok) add({ op: 'verdict', at: r.line.at, disposition: d.disposition, horizon: d.horizon });
|
|
317
|
+
else x.failed = r.error;
|
|
318
|
+
}
|
|
319
|
+
} else if (x.group === 'outcome' && x.type === 'source') {
|
|
320
|
+
// the one ask for a goal PMOS cannot read (lib/outcome-judge.js). Class C: only the PM's ✓ reaches here. It adds a task for the PM.
|
|
321
|
+
const d = x.data || {}, title = `Connect the source of "${String(d.goal || 'the goal').slice(0, 80)}", or pick another number`.slice(0, 200);
|
|
322
|
+
const r = RB.taskAdd(ctx, { ws: p.w.id, board: p.board.id, initiative: ini, title, notes: [x.why, source ? 'From ' + source : ''].filter(Boolean).join('\n').slice(0, 1900) }, g);
|
|
323
|
+
if (W.ok(r)) add({ op: 'add', task: r.body.item && (r.body.item.uid || r.body.item.id), title, to: { start: '', due: '' } });
|
|
269
324
|
} else if (x.group === 'outcome' && x.type === 'refuted') {
|
|
270
325
|
// a refuted outcome's next step (launch simulation W2; lib/outcomes.js refutedDrafts). Class C: only the PM's ✓ reaches here.
|
|
271
326
|
// kill the experiment is cancelled with the check as its reason (the D70 lifecycle line the Board's ⋯ Cancel writes)
|
|
@@ -390,6 +445,7 @@ function saidOf(wrote, plans, left) {
|
|
|
390
445
|
if (n('created')) bits.push((bits.length ? 'started ' : 'Started ') + 'the next experiment');
|
|
391
446
|
if (wrote.some((w) => w.op === 'life' && w.to === 'cancelled')) bits.push((bits.length ? 'stopped ' : 'Stopped ') + 'this one');
|
|
392
447
|
if (n('outcome')) bits.push((bits.length ? 'set ' : 'Set ') + 'the outcome and its check date');
|
|
448
|
+
if (n('verdict')) bits.push((bits.length ? 'recorded ' : 'Recorded ') + 'whether it worked');
|
|
393
449
|
// a live round (lib/live-round.js): each version shows on its card as soon as it renders
|
|
394
450
|
const rd = wrote.find((w) => w.op === 'round');
|
|
395
451
|
if (rd) bits.push((bits.length ? 'started ' : 'Started ') + ((rd.keys || []).length > 1 ? (rd.keys || []).join(', ').replace(/, ([^,]*)$/, ' and $1') + ': each shows as soon as it renders' : 'the new round: it shows as soon as it renders'));
|
|
@@ -490,7 +546,7 @@ const WRITES = {
|
|
|
490
546
|
|
|
491
547
|
module.exports = {
|
|
492
548
|
prefixes: ['/api/proposals'],
|
|
493
|
-
viewFor, saidOf, prdRename, keepCore, undoCore, autoKeep,
|
|
549
|
+
viewFor, saidOf, prdRename, keepCore, undoCore, autoKeep, heldOf,
|
|
494
550
|
handle: async (req, res, url, ctx) => {
|
|
495
551
|
const p0 = url.pathname;
|
|
496
552
|
if (req.method === 'GET') {
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
/* routes-your-move.js — what Your move reads from a product beside its Board rows (workspace grill W3, frame WgW3Move).
|
|
3
3
|
*
|
|
4
4
|
* GET /api/your-move?ws=<id> → { ok, ws, today, verdicts: [lib/your-move.js verdict + board], kr: lib/your-move.js krOf | null,
|
|
5
|
-
* expired: [{ ini, id, group, title, why, at }], done: lib/done-feed.js doneOf
|
|
5
|
+
* expired: [{ ini, id, group, title, why, at }], done: lib/done-feed.js doneOf,
|
|
6
|
+
* questions: { day, questions, later } }
|
|
6
7
|
*
|
|
7
8
|
* verdicts: the outcome checks past their date with no verdict (lib/outcomes.js scan, less Intelligence's verdicts in
|
|
8
9
|
* lib/insights-records.js), each with Claude's draft from the board's Jira tickets and the board it is on (the ✓ records it there through
|
|
@@ -12,7 +13,9 @@
|
|
|
12
13
|
* EXPIRY (chief-of-staff C3, board CsE). The one write: a filed ✦ the PM left unanswered for 14 days expires here, as upkeep with one right
|
|
13
14
|
* answer. Nothing on the initiative changes; one `expire` line per proposal goes to proposals.jsonl with its reason (lib/proposals.js
|
|
14
15
|
* staleOf), and `expired` lists the ones of the last 7 days, so Your move says it once. Idempotent: an expired proposal folds as dropped.
|
|
15
|
-
* DONE (C2, board CsD): what an agent kept by itself in the last 14 days, one line per batch with its Undo (lib/done-feed.js).
|
|
16
|
+
* DONE (C2, board CsD): what an agent kept by itself in the last 14 days, one line per batch with its Undo (lib/done-feed.js).
|
|
17
|
+
* QUESTIONS (act-alone-only-with-a-source): { day, questions: [lib/question-batch.js question], later } — the changes PMOS holds for want
|
|
18
|
+
* of a source, one question per owner and initiative, the PM's first; the list is fixed for the day (one line in question-days.jsonl). */
|
|
16
19
|
const YM = require('./your-move.js');
|
|
17
20
|
|
|
18
21
|
const localDay = (ms = Date.now()) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
|
|
@@ -62,8 +65,16 @@ function expire(ctx, w, now = Date.now()) {
|
|
|
62
65
|
return PR.expiredSince(F, now - 7 * 864e5).map((e) => ({ ini: e.ini, id: e.id, group: e.group, title: e.title, why: e.why, at: e.at }));
|
|
63
66
|
}
|
|
64
67
|
|
|
68
|
+
/** The day's question list (act-alone-only-with-a-source): the changes PMOS holds for want of a source, one question per owner and
|
|
69
|
+
* initiative, fixed once a day (lib/question-batch.js). Questions for teammates are drafts: nothing is sent. */
|
|
70
|
+
function questions(ctx, w, today) {
|
|
71
|
+
const dir = ctx.stateDirFor ? ctx.stateDirFor(w) : null;
|
|
72
|
+
const held = require('./routes-proposals.js').heldOf(ctx, w);
|
|
73
|
+
return require('./question-batch.js').today(dir, held, { day: today });
|
|
74
|
+
}
|
|
75
|
+
|
|
65
76
|
module.exports = {
|
|
66
|
-
expire,
|
|
77
|
+
expire, questions,
|
|
67
78
|
prefixes: ['/api/your-move'],
|
|
68
79
|
handle: async (req, res, url, ctx) => {
|
|
69
80
|
if (url.pathname !== '/api/your-move') return false;
|
|
@@ -78,7 +89,9 @@ module.exports = {
|
|
|
78
89
|
try { X = expire(ctx, w); } catch { X = []; }
|
|
79
90
|
let D = [];
|
|
80
91
|
try { const dir = ctx.stateDirFor ? ctx.stateDirFor(w) : null; D = dir ? require('./done-feed.js').doneOf(require('./proposals.js').read(dir)) : []; } catch { D = []; }
|
|
81
|
-
|
|
92
|
+
let Q = { day: today, questions: [], later: 0 };
|
|
93
|
+
try { Q = questions(ctx, w, today); } catch { Q = { day: today, questions: [], later: 0 }; }
|
|
94
|
+
ctx.json(res, { ok: true, ws: w.id, today, verdicts: V, kr: K, expired: X, done: D, questions: Q });
|
|
82
95
|
return true;
|
|
83
96
|
},
|
|
84
97
|
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* source-guard.js — PMOS changes a plan by itself only with a source (initiative act-alone-only-with-a-source; bets 1b, 1c, 1d in
|
|
3
|
+
* pmos-ideas/bets.md, proofs A58, A120, A126). Pure: no file is read.
|
|
4
|
+
*
|
|
5
|
+
* holdOf(p) → null | { why, kinds } null: the proposal keeps its class. Otherwise PMOS asks instead of applying it.
|
|
6
|
+
* kindsOf(p) → [kind] the different kinds of source a proposal cites, e.g. ['jira', 'meeting']
|
|
7
|
+
* kindOf(text) → kind the kind of one source label or ref
|
|
8
|
+
* bigOf(p) → '' | 'close' | 'rename' | 'date' a change that needs two kinds of source
|
|
9
|
+
*
|
|
10
|
+
* THE RULE. It applies to the plan changes on a product: the groups in PLAN (dates, status, names, found, links).
|
|
11
|
+
* 1. No source, or a date proposal that found no reason (`noReason`): held.
|
|
12
|
+
* 2. A close (status done), a rename (names), or a date moved more than BIG_DAYS days needs two different kinds of source. Anyone who can
|
|
13
|
+
* post in a channel PMOS reads can write one line of text (A58), so one kind is not enough for a change that is hard to see afterwards.
|
|
14
|
+
* Two Slack lines are one kind. With one kind: held.
|
|
15
|
+
* 3. Anything else keeps its class. A tidy name (group names) that cites only the plan itself ('the tasks') is PMOS's name standard
|
|
16
|
+
* applied to the task's own words, not a rename from outside text: it keeps its class.
|
|
17
|
+
* A held proposal is class C (lib/autonomy.js classOfProposal): the self-apply step (lib/routes-proposals.js autoKeep) leaves it for the
|
|
18
|
+
* owner, and it joins the day's question list (lib/question-batch.js). Other groups (description, outcome, build, the idle lab) carry their
|
|
19
|
+
* own evidence rules and are not touched here. */
|
|
20
|
+
|
|
21
|
+
const PLAN = new Set(['dates', 'status', 'names', 'found', 'links']);
|
|
22
|
+
const BIG_DAYS = 30;
|
|
23
|
+
const KINDS = [
|
|
24
|
+
['plan', /^\s*(the|this|its)\s+(tasks?|plan|board|initiative|stage)\b/i],
|
|
25
|
+
['jira', /\bjira\b|\b[A-Z][A-Z0-9]+-\d+\b/],
|
|
26
|
+
['slack', /\bslack\b/i],
|
|
27
|
+
['mail', /\bg?mail\b|\be-?mail\b|\binbox\b/i],
|
|
28
|
+
['meeting', /\bmeeting|\bcalendar\b|\bnotes?\b|\bminutes\b|\btranscript|\bwispr\b/i],
|
|
29
|
+
['docs', /\bdrive\b|\bdocs?\b|\bdocument|\bsheets?\b|\bslides?\b|\bconfluence\b|\bwiki\b|docs\.google\.com/i],
|
|
30
|
+
['repo', /\brepo(sitory)?\b|\bgithub\b|\bcommit\b|\bpull request\b|\bPR #?\d+|\.(md|js|ts|json|jsonl|py)(:\d+)?\b/i],
|
|
31
|
+
['chat', /\bchat\b|\bteams\b/i],
|
|
32
|
+
];
|
|
33
|
+
const KIND_NAMES = { plan: 'the plan itself', jira: 'Jira', slack: 'Slack', mail: 'mail', meeting: 'a meeting note', docs: 'a document', repo: 'the repository', chat: 'chat', other: 'one source' };
|
|
34
|
+
const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
35
|
+
const dn = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? Math.round(Date.UTC(+m[1], +m[2] - 1, +m[3]) / 864e5) : null; };
|
|
36
|
+
|
|
37
|
+
/** The kind of one source label or ref. A text no rule names is 'other'. */
|
|
38
|
+
function kindOf(text) {
|
|
39
|
+
const s = String(text || '');
|
|
40
|
+
for (const [k, re] of KINDS) if (re.test(s)) return k;
|
|
41
|
+
return 'other';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The texts a proposal cites: its sources (label and ref together) and each item's own source. */
|
|
45
|
+
function citesOf(p) {
|
|
46
|
+
const out = [];
|
|
47
|
+
for (const s of (isObj(p) && Array.isArray(p.sources) ? p.sources : [])) if (isObj(s) && (s.label || s.ref)) out.push([s.label, s.ref].filter(Boolean).join(' '));
|
|
48
|
+
for (const x of (isObj(p) && Array.isArray(p.items) ? p.items : [])) if (isObj(x) && x.source) out.push(String(x.source));
|
|
49
|
+
return out.filter((t) => t.trim());
|
|
50
|
+
}
|
|
51
|
+
const kindsOf = (p) => [...new Set(citesOf(p).map(kindOf))];
|
|
52
|
+
|
|
53
|
+
/** The days a date item moves its due date, or null when the plan does not say where it was. */
|
|
54
|
+
function shiftOf(x) {
|
|
55
|
+
const a = dn(isObj(x.from) ? x.from.due : x.fromDue), b = dn(isObj(x.to) ? x.to.due : x.due);
|
|
56
|
+
return a == null || b == null ? null : b - a;
|
|
57
|
+
}
|
|
58
|
+
function bigOf(p) {
|
|
59
|
+
if (!isObj(p)) return '';
|
|
60
|
+
if (p.group === 'status') return 'close';
|
|
61
|
+
// a tidy name whose only source is the plan itself (the task's own words, PMOS's name standard) claims nothing from outside text: it is
|
|
62
|
+
// not a rename from a source. A name change that cites Slack, mail, a meeting or Jira is one (A58: 6 of the 11 it held).
|
|
63
|
+
if (p.group === 'names') return kindsOf(p).every((k) => k === 'plan') ? '' : 'rename';
|
|
64
|
+
if (p.group === 'dates' && (p.items || []).some((x) => isObj(x) && Math.abs(shiftOf(x) || 0) > BIG_DAYS)) return 'date';
|
|
65
|
+
return '';
|
|
66
|
+
}
|
|
67
|
+
const BIG_WORDS = { close: 'closes work', rename: 'renames work', date: 'moves a date by more than ' + BIG_DAYS + ' days' };
|
|
68
|
+
|
|
69
|
+
/** null when PMOS may apply the proposal by itself under its class; else { why, kinds }. PURE. */
|
|
70
|
+
function holdOf(p) {
|
|
71
|
+
if (!isObj(p) || !PLAN.has(p.group)) return null;
|
|
72
|
+
const kinds = kindsOf(p);
|
|
73
|
+
if (p.noReason === true || !kinds.length) return { why: 'It cites no source, so PMOS asks instead of changing the plan.', kinds };
|
|
74
|
+
const big = bigOf(p);
|
|
75
|
+
if (big && kinds.length < 2) return { why: `It ${BIG_WORDS[big]} on one kind of source (${KIND_NAMES[kinds[0]] || kinds[0]}). PMOS needs two kinds, or the owner's answer.`, kinds };
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
module.exports = { holdOf, kindsOf, kindOf, bigOf, shiftOf, PLAN, BIG_DAYS, KIND_NAMES };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.656.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.656.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
package/workspace/run-tests.js
CHANGED
|
@@ -694,6 +694,11 @@ function traceChanges(changes, ctx) {
|
|
|
694
694
|
for (const s of list) if (s === 'headless.test.js' || nk.some((x) => (get(s) || '').includes(x))) picked.add(s);
|
|
695
695
|
continue;
|
|
696
696
|
}
|
|
697
|
+
const rk = f === 'lib/headless.js' ? runEnvOnly(sget(f), lines) : null;
|
|
698
|
+
if (rk) { // a pin added to RUN_ENV: only the runs whose spec sets one of those variables are touched, so the suites that name them
|
|
699
|
+
for (const s of list) if (s === 'headless.test.js' || rk.some((x) => (get(s) || '').includes(x))) picked.add(s);
|
|
700
|
+
continue;
|
|
701
|
+
}
|
|
697
702
|
let why = null;
|
|
698
703
|
const before = picked.size;
|
|
699
704
|
if (get(f) == null) { // removed: only the names in the suites can say who used it
|
|
@@ -747,6 +752,26 @@ function newKindOnly(src, lines) {
|
|
|
747
752
|
return [...[...consts.values()].flat(), ...kinds].map((x) => `'${x}`);
|
|
748
753
|
}
|
|
749
754
|
|
|
755
|
+
/* lib/headless.js RUN_ENV lists the variables a background run's spawn spec may set. A change whose every line sits inside that list and
|
|
756
|
+
* holds only quoted PMOS_ names changes what one kind of run is pinned with, not how any run is spawned: it reaches the suites that name
|
|
757
|
+
* one of the names on those lines. Returns those names, or null when any changed line is something else. `src` is without comments. */
|
|
758
|
+
function runEnvOnly(src, lines) {
|
|
759
|
+
if (src == null || !Array.isArray(lines) || !lines.length) return null;
|
|
760
|
+
const C = src.split('\n');
|
|
761
|
+
const start = C.findIndex((l) => /^const RUN_ENV = Object\.freeze\(\[/.test(l.trim()));
|
|
762
|
+
if (start < 0) return null;
|
|
763
|
+
let end = start; while (end < C.length && !/\]\);\s*$/.test(C[end])) end++;
|
|
764
|
+
const names = new Set();
|
|
765
|
+
for (const n of lines) {
|
|
766
|
+
const l = (C[n - 1] || '').trim();
|
|
767
|
+
if (!l) continue;
|
|
768
|
+
if (n - 1 <= start || n - 1 > end) return null;
|
|
769
|
+
if (!/^('PMOS_[A-Z0-9_]+',?\s*)+(\]\);)?$/.test(l)) return null;
|
|
770
|
+
for (const m of l.matchAll(/'(PMOS_[A-Z0-9_]+)'/g)) names.add(m[1]);
|
|
771
|
+
}
|
|
772
|
+
return names.size ? [...names] : null;
|
|
773
|
+
}
|
|
774
|
+
|
|
750
775
|
/* The suites in `list` that the diff against `ref` can reach, by traceChanges() above. Returns { files, suites, why }. */
|
|
751
776
|
function changedSuites(list, ref, { exact = false } = {}) {
|
|
752
777
|
const git = (...a) => {
|
|
@@ -968,4 +993,4 @@ async function main() {
|
|
|
968
993
|
}
|
|
969
994
|
|
|
970
995
|
if (require.main === module) main().catch((e) => { console.error(e); process.exitCode = 1; });
|
|
971
|
-
else module.exports = { traceChanges, diffLines, strip, changedDeps, WIDE };
|
|
996
|
+
else module.exports = { traceChanges, runEnvOnly, diffLines, strip, changedDeps, WIDE };
|
package/workspace/server.js
CHANGED
|
@@ -3222,6 +3222,9 @@ const outcomeProps = require('./lib/outcome-props.js').create({
|
|
|
3222
3222
|
boardOf: (w, id) => require('./lib/routes-boards.js').boardIndex(proposalCtx(), w).of(id),
|
|
3223
3223
|
runtime: () => STATE,
|
|
3224
3224
|
open: (now) => !proactiveLib.inQuietHours(now, proSettings().quiet),
|
|
3225
|
+
// outcome-checks-run-themselves: a due check no reading decides gets one short run that reads the initiative's records (lib/proposal-runs.js)
|
|
3226
|
+
startRun: (w, o) => proposalRuns.start({ ws: w.id, board: o.board, ini: o.ini, why: 'outcome', press: false, now: o.now,
|
|
3227
|
+
outcome: { metric: o.it.metric, horizon: o.it.horizon, anchor: o.it.anchor, record: o.it.record, why: o.why } }),
|
|
3225
3228
|
env: process.env,
|
|
3226
3229
|
every: TICK_MS,
|
|
3227
3230
|
mayRun: () => { try { return scheduleOwner.mayRun(); } catch { return true; } },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: initiative-propose
|
|
3
3
|
label: "Claude proposes, per initiative"
|
|
4
|
-
description: "One short background run for one initiative. When the initiative was just added, it looks for it in every connected source and files what it finds: the stage the work is really in, its documents and its tasks with their dates. Each morning it finds why late tasks slipped and files new dates, done and tidy names. Everything waits under the initiative's ✦ for the PM's ✓. It writes no task, document or stage and sends nothing."
|
|
4
|
+
description: "One short background run for one initiative. When the initiative was just added, it looks for it in every connected source and files what it finds: the stage the work is really in, its documents and its tasks with their dates. Each morning it finds why late tasks slipped and files new dates, done and tidy names. When an outcome check date passes and no reading decides it, it reads the records and files whether it worked. Everything waits under the initiative's ✦ for the PM's ✓. It writes no task, document or stage and sends nothing."
|
|
5
5
|
run: agent
|
|
6
6
|
agent: claude
|
|
7
7
|
output:
|
|
@@ -10,7 +10,7 @@ output:
|
|
|
10
10
|
- Not read
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
/initiative-propose: for ONE initiative, find what the evidence says and file it with `pmos propose`, then stop. The lines after this procedure name the initiative, why this run runs (populate or
|
|
13
|
+
/initiative-propose: for ONE initiative, find what the evidence says and file it with `pmos propose`, then stop. The lines after this procedure name the initiative, why this run runs (populate, check or outcome), today, its stages and what the PM dropped.
|
|
14
14
|
|
|
15
15
|
Rules that always hold:
|
|
16
16
|
1. THE ONLY WRITE is `pmos propose`. You have no Write and no Edit tool. Do not add a task, move a stage or write a document: the PM's ✓ on the page does that. Do not commit and do not push.
|
|
@@ -39,6 +39,12 @@ Procedure when the run is `check` (the morning check: tasks are late or at risk)
|
|
|
39
39
|
3. When the evidence says the work happened (an email was sent, a ticket closed), file `pmos propose done --json -` with `{ "why", "sources", "items": [{ "task" }] }`.
|
|
40
40
|
4. For names that do not keep the standard, file one `pmos propose name --json -`: `{ "why": "Verb first, short, the WBS number kept. Detail moves to the task's notes.", "sources": [{ "label": "The tasks" }], "items": [{ "task", "to", "notes" }] }`. The standard: the WBS number kept if the PM uses one, verb first, sentence case, at most about 7 words, no "+" and no brackets. Put the detail you cut in `notes`. Propose a new task's name once.
|
|
41
41
|
|
|
42
|
+
Procedure when the run is `outcome` (the check date of its expected outcome has passed, and its goal's own reading did not decide it):
|
|
43
|
+
1. Read the lines below: the expected outcome, the check date, the anchor, the record and why the reading did not decide it. Read the record, its PRD and done test if it names them, and the product's own ledgers and files the outcome is about (for example a ledger that should keep filling, a bench that should have run, a feedback ledger with or without a repeat complaint). Read the stored reads first (`pmos source show <source>`).
|
|
44
|
+
2. Decide only from what you read: `worked` when the evidence shows the expected outcome happened, `didnt-work` when it shows it did not. "Nobody complained" is not evidence it worked. When you cannot tell, file `{ "disposition": "cant-tell" }`: the PM is asked, and that is the right answer.
|
|
45
|
+
3. File once with `pmos propose verdict --json -`: `{ "disposition": "worked" | "didnt-work" | "cant-tell", "evidence": "<one line: what you found, with the number>", "claims": [{ "text": "<one fact>", "sources": [{ "label": "<what it is>", "ref": "<path:line, from the repository root>", "quote": "<the text on that line, at least 12 characters>" }] }] }`. Each quote is checked against its line; a claim that does not match is refused, and so is the verdict.
|
|
46
|
+
4. Do not record the check yourself: the server records your verdict with Undo.
|
|
47
|
+
|
|
42
48
|
Output contract: produce EXACTLY these sections in your final message:
|
|
43
49
|
- Filed (the proposal ids and their kinds, or "nothing new")
|
|
44
50
|
- Not found (what you looked for and did not find)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Act alone only with a source (initiative act-alone-only-with-a-source, done test C1-C11): PMOS holds a plan change with no source, and a close, rename or big date move on one kind of source; the held changes fold into one question list a day. Pure checks plus a scratch server each. No connector, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"source-guard.test.js",
|
|
5
|
+
"question-batch.test.js"
|
|
6
|
+
],
|
|
7
|
+
"seconds": {
|
|
8
|
+
"source-guard.test.js": 10,
|
|
9
|
+
"question-batch.test.js": 10
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Outcome checks that run themselves (initiative outcome-checks-run-themselves, done test C1-C12): PMOS judges a due outcome from the goal's own reading, asks once for a source it cannot read twice, and starts one short run per check date for the rest; the verdict's ✓ and Undo on a scratch server. No connector, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"outcome-judge.test.js",
|
|
5
|
+
"outcome-check-runs.test.js"
|
|
6
|
+
],
|
|
7
|
+
"seconds": {
|
|
8
|
+
"outcome-judge.test.js": 4,
|
|
9
|
+
"outcome-check-runs.test.js": 12
|
|
10
|
+
}
|
|
11
|
+
}
|