create-pmos 0.553.0 → 0.554.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 +20 -14
- 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/briefing-premium-board-test.js +4 -4
- package/workspace/briefing-premium-initiative-test.js +2 -2
- package/workspace/briefing-premium-test.js +1 -1
- package/workspace/changelog.json +19 -0
- package/workspace/chat-asks-test.js +5 -5
- package/workspace/ev-everywhere-test.js +2 -2
- package/workspace/goals-clear-ui-test.js +1 -1
- package/workspace/guide/agent-capabilities.md +31 -31
- package/workspace/guide/claude-proposes.md +68 -68
- package/workspace/guide/cli.md +22 -22
- package/workspace/guide/cloud.md +3 -3
- package/workspace/guide/home.md +38 -38
- package/workspace/guide/index.md +5 -5
- package/workspace/guide/intelligence-okr-goals.md +4 -4
- package/workspace/guide/layout.md +23 -23
- package/workspace/guide/notes.md +8 -8
- package/workspace/guide/programs.md +17 -17
- package/workspace/guide/reports.md +16 -16
- package/workspace/guide/settings-and-switches.md +37 -37
- package/workspace/guide/statuses.md +3 -3
- package/workspace/home-other-product-test.js +8 -8
- package/workspace/home-pill-test.js +3 -3
- package/workspace/home-rows-test.js +7 -7
- package/workspace/intel-report-ui-test.js +1 -1
- package/workspace/intelligence-gaps-ui-test.js +2 -2
- package/workspace/lib/agent-roles.js +1 -1
- package/workspace/lib/autonomy.js +1 -1
- package/workspace/lib/bg-queue.js +1 -1
- package/workspace/lib/briefing-premium-agent.js +2 -2
- package/workspace/lib/decision-memory.js +2 -2
- package/workspace/lib/driver-decide.js +2 -2
- package/workspace/lib/driver.js +6 -2
- package/workspace/lib/folder-needs.js +1 -1
- package/workspace/lib/goal-chat.js +5 -5
- package/workspace/lib/goal-watch.js +1 -1
- package/workspace/lib/grill-runs.js +5 -5
- package/workspace/lib/idle-lab.js +5 -5
- package/workspace/lib/impact-runs.js +2 -2
- package/workspace/lib/job-graph.js +2 -2
- package/workspace/lib/metric-draft-runs.js +4 -4
- package/workspace/lib/metric-read-runs.js +5 -5
- package/workspace/lib/news-for-you.js +1 -1
- package/workspace/lib/proposal-runs.js +6 -6
- package/workspace/lib/refresh.js +1 -1
- package/workspace/lib/routes-board-premium.js +1 -1
- package/workspace/lib/routes-goal-status.js +4 -4
- package/workspace/lib/routes-impact.js +1 -1
- package/workspace/lib/routes-insight-moves.js +1 -1
- package/workspace/lib/routes-loose.js +2 -2
- package/workspace/lib/routes-mentions.js +1 -1
- package/workspace/lib/routes-metric-drafts.js +9 -9
- package/workspace/lib/routes-proposals.js +8 -8
- package/workspace/lib/routes-ready-reports.js +1 -1
- package/workspace/lib/routes-slash.js +1 -1
- package/workspace/lib/source-heal.js +3 -3
- package/workspace/lib/state-root.js +22 -1
- package/workspace/lib/task-items.js +1 -1
- package/workspace/lib/task-links.js +2 -2
- package/workspace/lib/today.js +2 -2
- package/workspace/live-pill-round-test.js +1 -1
- package/workspace/metric-drafts-ui-test.js +1 -1
- package/workspace/milestone-suggest-test.js +5 -5
- package/workspace/news-viewers-test.js +3 -3
- package/workspace/okr-goals-ui-test.js +1 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-chat-chart-tab-test.js +1 -1
- package/workspace/premium-chat-context-test.js +4 -4
- package/workspace/premium-chat-goal-setup-test.js +3 -3
- package/workspace/premium-chat-goal-view-test.js +1 -1
- package/workspace/premium-chat-line-test.js +6 -6
- package/workspace/premium-chat-notes-test.js +4 -4
- package/workspace/premium-chat-report-tab-test.js +4 -4
- package/workspace/premium-rec-now-test.js +2 -2
- package/workspace/public/pm/batch-press.js +4 -4
- package/workspace/public/pm/bd-fc-card.js +1 -1
- package/workspace/public/pm/bd-next.js +10 -10
- package/workspace/public/pm/bd-prog-panel.js +5 -5
- package/workspace/public/pm/chat-ask.js +1 -1
- package/workspace/public/pm/chat-context.js +3 -3
- package/workspace/public/pm/cozy-evmodel.js +1 -1
- package/workspace/public/pm/cozy-home.css +1 -1
- package/workspace/public/pm/cozy-lab-ins.js +4 -4
- package/workspace/public/pm/cozy-lab.js +1 -1
- package/workspace/public/pm/cozy-news.js +2 -2
- package/workspace/public/pm/cozy-onboard.js +2 -2
- package/workspace/public/pm/cozy-rec-now.js +5 -5
- package/workspace/public/pm/cozy-rec-present.js +1 -1
- package/workspace/public/pm/cozy-reveal.js +2 -2
- package/workspace/public/pm/cozy-settings.js +19 -19
- package/workspace/public/pm/cozy-steps.js +2 -2
- package/workspace/public/pm/cozy-viewer.js +1 -1
- package/workspace/public/pm/ctx-wedge.js +1 -1
- package/workspace/public/pm/dash-view.js +1 -1
- package/workspace/public/pm/goal-chat.js +6 -6
- package/workspace/public/pm/good-morning.js +2 -2
- package/workspace/public/pm/grill-words.js +1 -1
- package/workspace/public/pm/home-app.js +19 -19
- package/workspace/public/pm/home-ask.js +1 -1
- package/workspace/public/pm/home-chat.js +6 -6
- package/workspace/public/pm/home-data.js +2 -2
- package/workspace/public/pm/home-day.js +3 -3
- package/workspace/public/pm/home-drift.js +1 -1
- package/workspace/public/pm/home-goal.js +1 -1
- package/workspace/public/pm/home-impact.js +1 -1
- package/workspace/public/pm/home-ini.js +1 -1
- package/workspace/public/pm/home-line.js +5 -5
- package/workspace/public/pm/home-mentions.js +4 -4
- package/workspace/public/pm/home-moment.js +1 -1
- package/workspace/public/pm/home-need.js +1 -1
- package/workspace/public/pm/home-phone-card.js +1 -1
- package/workspace/public/pm/home-stage-card.js +2 -2
- package/workspace/public/pm/home-sweep.js +1 -1
- package/workspace/public/pm/home-today.js +2 -2
- package/workspace/public/pm/ini-about.js +2 -2
- package/workspace/public/pm/ini-agent.js +5 -5
- package/workspace/public/pm/ini-links.js +5 -5
- package/workspace/public/pm/ini-props.js +11 -11
- package/workspace/public/pm/ini-view-model.js +1 -1
- package/workspace/public/pm/ini-view.js +2 -2
- package/workspace/public/pm/intent.js +3 -3
- package/workspace/public/pm/loose-props.js +5 -5
- package/workspace/public/pm/metric-drafts.js +1 -1
- package/workspace/public/pm/ms-suggest.js +3 -3
- package/workspace/public/pm/next-prompt-ui.js +2 -2
- package/workspace/public/pm/okr-list.js +1 -1
- package/workspace/public/pm/page-chat.js +2 -2
- package/workspace/public/pm/premium-attach.js +1 -1
- package/workspace/public/pm/premium-initiative-head.js +1 -1
- package/workspace/public/pm/premium-insights.js +3 -3
- package/workspace/public/pm/premium-meeting.js +1 -1
- package/workspace/public/pm/premium-mtg-replay.js +1 -1
- package/workspace/public/pm/premium-notes.js +2 -2
- package/workspace/public/pm/premium-report-read.js +6 -6
- package/workspace/public/pm/premium-report-tab.js +7 -7
- package/workspace/public/pm/premium-shell.js +18 -18
- package/workspace/public/pm/premium-vw-ctx.js +3 -3
- package/workspace/public/pm/premium-vw-jira.js +1 -1
- package/workspace/public/pm/premium-welcome.js +1 -1
- package/workspace/public/pm/prog-order.js +2 -2
- package/workspace/public/pm/program-charter.js +3 -3
- package/workspace/public/pm/program-model.js +1 -1
- package/workspace/public/pm/ready-lib.js +4 -4
- package/workspace/public/pm/report-flow.js +7 -7
- package/workspace/public/pm/report-orders-ui.js +2 -2
- package/workspace/public/pm/split-merge.js +5 -5
- package/workspace/public/pm/story.js +1 -1
- package/workspace/public/pm/task-card.js +1 -1
- package/workspace/public/pm/tk-draft.js +1 -1
- package/workspace/public/pm/tk-send.js +2 -2
- package/workspace/public/pm/wf-page.js +2 -2
- package/workspace/ready-dash-ui-test.js +1 -1
- package/workspace/rec-present-test.js +2 -2
- package/workspace/server.js +12 -8
- package/workspace/session-names-test.js +3 -3
- package/workspace/skills/doc-check.skill +2 -0
- package/workspace/skills/idle-lab-prototype.skill +2 -0
- package/workspace/skills/measure.skill +2 -0
- package/workspace/skills/metric-read.skill +2 -0
- package/workspace/skills/milestone-review.skill +2 -0
- package/workspace/skills/report-biweekly.skill +2 -0
- package/workspace/skills/report-daily.skill +2 -0
- package/workspace/skills/report-design.skill +2 -0
- package/workspace/skills/report-monthly.skill +2 -0
- package/workspace/skills/report-weekly.skill +2 -0
- package/workspace/split-merge-ui-test.js +3 -3
- package/workspace/stage-card-test.js +4 -4
- package/workspace/task-links-test.js +1 -1
- package/workspace/task-views-test.js +7 -7
- package/workspace/tk-tasks-test.js +2 -2
|
@@ -155,7 +155,7 @@ const recentOf = (m) => ({ ...m, recent: [...m.toread, ...m.answered] });
|
|
|
155
155
|
// wait for the fold to land too: the list draws before the split, and a slow runner read it in between (CI, batch 20)
|
|
156
156
|
const L1 = (await until(() => listOf(p).then((l) => (l && l.move.length && l.split ? l : null)))) || (await listOf(p));
|
|
157
157
|
ok('M3 the row opens the Mentions Viewer, wide on a desktop, the list and the conversation side by side', !!L1 && L1.split, JSON.stringify(L1 && L1.secs));
|
|
158
|
-
ok('M3 Adler opens on who waits and what
|
|
158
|
+
ok('M3 Adler opens on who waits and what PMOS drafted, plainly; no button on a light day', !!L1 && L1.face && L1.open === 'Four people wait on you. I drafted one reply; Maya and Dion’s needs you.' && !L1.go.length, JSON.stringify(L1 && [L1.open, L1.go]));
|
|
159
159
|
ok('M3 Your move open with 3; To read closed with 3; Answered this week closed with 2 and a stack of faces', !!L1 && JSON.stringify(L1.secs) === JSON.stringify([['Your move', '3', 'true'], ['To read', '3', 'false'], ['Answered this week', '2', 'false']]) && L1.stack === 2, JSON.stringify(L1 && [L1.secs, L1.stack]));
|
|
160
160
|
const mv = L1 ? L1.move : [];
|
|
161
161
|
ok('M3 one row per conversation, oldest first: first names, "Maya and Dion", the place, the message count', mv.map((x) => x.nm + mx(x)).join(';') === 'Samuel· #tech-team-cem3;Maya and Dion· #idpf-launch5;Jason· DM', JSON.stringify(mv));
|
|
@@ -170,14 +170,14 @@ const recentOf = (m) => ({ ...m, recent: [...m.toread, ...m.answered] });
|
|
|
170
170
|
const C1 = await until(() => convOf(p).then((c) => (c && c.ak ? c : null)));
|
|
171
171
|
ok('M4 the oldest conversation shows beside the list: full name, place, messages since when, ↗', !!C1 && /^Samuel Chandra#tech-team-cem · 3 messages since (Mon|Tue|Wed|Thu|Fri|Sat|Sun)$/.test(C1.head) && C1.out, JSON.stringify(C1 && C1.head));
|
|
172
172
|
ok('M4 the ask first: "Asks you · 2 days", the ask, the drafted reply', !!C1 && C1.ak === 'Asks you · 2 days' && C1.aq === 'Which build goes to UAT, 2.4.1 or 2.4.2?' && C1.draft === '2.4.2, please. It has the login fix the ST team asked for.', JSON.stringify(C1));
|
|
173
|
-
ok('M4 four one-tap acts, then ✎ and send', !!C1 && C1.four.join('|') === 'Mark answered|Remind me at 09:00|Make it a task|Not an ask' && C1.right.join('|') === 'Change it with
|
|
173
|
+
ok('M4 four one-tap acts, then ✎ and send', !!C1 && C1.four.join('|') === 'Mark answered|Remind me at 09:00|Make it a task|Not an ask' && C1.right.join('|') === 'Change it with PMOS|Copy it and open Slack. PMOS never posts.', JSON.stringify(C1 && [C1.four, C1.right]));
|
|
174
174
|
ok('M4 Where it stands: what is settled, then what is open', !!C1 && C1.stands.join('|') === 'ok:UAT keyword agreed: PSLE Companion 2027.|ok:Release notes reviewed.|open:The tag waits on your answer above.', JSON.stringify(C1 && C1.stands));
|
|
175
|
-
ok('M4
|
|
175
|
+
ok('M4 PMOS offers to watch the dated promise, ✓ ×', !!C1 && C1.watch.join('|') === 'I’ll watch for the tag and nudge Samuel at 09:00 if it’s still missing.|No, don’t watch|Yes, watch for it', JSON.stringify(C1 && C1.watch));
|
|
176
176
|
ok('M4 the messages last, open on the desktop, by day, the PM\'s on the right', !!C1 && C1.msgsOpen === 'true' && C1.msgs.join('|') === 'The UAT keyword is PSLE Companion 2027.|me:Confirmed, go ahead.|Which one for UAT?' && C1.days.length >= 1, JSON.stringify(C1 && [C1.msgs, C1.days]));
|
|
177
177
|
await shot(p, 'mentions-1440');
|
|
178
178
|
await p.click('#czViewer [data-mn-row="aaaaaaaaaaa2"] [data-mn="open"]');
|
|
179
179
|
const C2 = await until(() => convOf(p).then((c) => (c && /^Maya Tan and Dion Lee/.test(c.head) ? c : null)));
|
|
180
|
-
ok('M4 a press on a row shows that conversation beside the list; no draft: ✎ "Write it with
|
|
180
|
+
ok('M4 a press on a row shows that conversation beside the list; no draft: ✎ "Write it with PMOS" only', !!C2 && C2.right.join('|') === 'Write it with PMOS' && !C2.stands.length && !C2.watch.length, JSON.stringify(C2));
|
|
181
181
|
await p.click('#czViewer [data-mn-row="aaaaaaaaaaa1"] [data-mn="open"]');
|
|
182
182
|
await until(() => convOf(p).then((c) => (c && /^Samuel/.test(c.head) ? c : null)));
|
|
183
183
|
|
|
@@ -213,7 +213,7 @@ const recentOf = (m) => ({ ...m, recent: [...m.toread, ...m.answered] });
|
|
|
213
213
|
ok('M6 the pencil opens the chat "Reply to Samuel" and the Viewer stays beside it', !!ch && ch.vw, JSON.stringify(ch));
|
|
214
214
|
A.men.cur = JSON.parse(JSON.stringify(A.men.cur)); A.men.cur.waiting[0].draft = '2.4.2, please. It has the login fix.';
|
|
215
215
|
const nd = await until(() => p.evaluate(() => (document.querySelector('#czViewer [data-mn-conv] [data-mn-draft]') || {}).textContent === '2.4.2, please. It has the login fix.'), 14000, 300);
|
|
216
|
-
ok('M6 a reply
|
|
216
|
+
ok('M6 a reply PMOS saves shows while the conversation is open', !!nd);
|
|
217
217
|
|
|
218
218
|
/* T: To read */
|
|
219
219
|
await p.click('#czViewer .czs-sec[data-czs-id="toread"] [data-czs-fold]');
|
|
@@ -354,8 +354,8 @@ const recentOf = (m) => ({ ...m, recent: [...m.toread, ...m.answered] });
|
|
|
354
354
|
const pl = await until(() => listOf(P.page).then((l) => (l && l.move.length ? l : null)));
|
|
355
355
|
ok('F on a phone the list is one column, no conversation beside it', !!pl && !pl.split, JSON.stringify(pl && pl.split));
|
|
356
356
|
const pm = pl ? pl.move : [];
|
|
357
|
-
ok('F a calm day on a phone: a drafted reply shows on its row with ✎ and send only', !!pm[0] && /I drafted your reply2\.4\.2, please/.test(pm[0].extra) && pm[0].btns.join('|') === 'Change it with
|
|
358
|
-
ok('F no draft: why, in one line, and ✎ "Write it with
|
|
357
|
+
ok('F a calm day on a phone: a drafted reply shows on its row with ✎ and send only', !!pm[0] && /I drafted your reply2\.4\.2, please/.test(pm[0].extra) && pm[0].btns.join('|') === 'Change it with PMOS|Copy it and open Slack. PMOS never posts.', JSON.stringify(pm[0]));
|
|
358
|
+
ok('F no draft: why, in one line, and ✎ "Write it with PMOS" is the only button', !!pm[1] && pm[1].extra === 'I can’t draft this oneThe cap isn’t in the PRD or the last review.' && pm[1].btns.join('|') === 'Write it with PMOS', JSON.stringify(pm[1]));
|
|
359
359
|
ok('F after send: "Sent from Slack? I’ll see it at the next read."', !!pm[2] && pm[2].extra === 'Sent from Slack? I’ll see it at the next read.' && !pm[2].btns.length, JSON.stringify(pm[2]));
|
|
360
360
|
await P.page.click('#czViewer [data-mn-row="aaaaaaaaaaa1"] [data-mn="open"]');
|
|
361
361
|
const pc = await until(() => vw(P.page).then((v) => (v && v.title === 'Samuel Chandra' ? v : null)));
|
|
@@ -166,7 +166,7 @@ const FINDING = { id: 'rf-0123456789', name: 'Partner numbers to Lee', why: 'You
|
|
|
166
166
|
|
|
167
167
|
/* ── P: the ✦ strip proposes a report ── */
|
|
168
168
|
const pageTo = async () => { for (let i = 0; i < 6; i++) { const has = await p.evaluate(() => !!document.querySelector('#insAct [data-rp="see"]')); if (has) return true; const dots = await p.$$('#insPg button:not([hidden])'); if (!dots.length) return false; await dots[dots.length - 1].click(); await sleep(120); } return false; };
|
|
169
|
-
ok('P the strip holds a report
|
|
169
|
+
ok('P the strip holds a report PMOS proposes', await until(pageTo, 4000));
|
|
170
170
|
const pr = await p.evaluate(() => ({ text: document.querySelector('#brief').textContent, acts: [...document.querySelectorAll('#insAct [data-rp]')].map((b) => ({ k: b.dataset.rp, label: b.getAttribute('aria-label'), text: b.textContent.trim(), solid: b.classList.contains('solid') })), ask: document.querySelector('#askWhy').hidden, askShown: getComputedStyle(document.querySelector('#askWhy')).display }));
|
|
171
171
|
ok('P it says the pattern in plain words', /^You send Lee these numbers every Monday\. Shall I make it a report that drafts itself\?$/.test(pr.text), pr.text);
|
|
172
172
|
ok('P See the draft, Not now and a solid ✓ Set it up, icon-only, and no Ask why', pr.acts.map((a) => a.label).join() === 'See the draft,Not now,Set it up for Lee' && pr.acts.every((a) => !a.text) && pr.acts[2].solid && pr.ask && pr.askShown === 'none', JSON.stringify(pr));
|
|
@@ -121,7 +121,7 @@ const WEEKLY = { view: 'view', weeks: 3, day: 'Mon', opens: 4 };
|
|
|
121
121
|
await openEd();
|
|
122
122
|
const e0 = await until(() => p.evaluate(() => { const r = document.querySelector('#czViewer [data-gc-ed]'); return r ? { f: [...r.querySelectorAll('input')].map((x) => x.name + '=' + x.value), acts: [...r.querySelectorAll('.gc-foot a, .gc-foot button')].map((b) => b.getAttribute('aria-label') + (b.textContent.trim() ? '!' : '')), focus: document.activeElement && document.activeElement.name } : null; }), 3000);
|
|
123
123
|
ok('E ✎ turns the panel into fields: name, target, source; ask in Home, ×, ✓, all icon-only; the name has the focus', !!e0 && e0.f.join('|') === 'name=Weekly signed-in shoppers|target=45000|source=Amplitude'
|
|
124
|
-
&& e0.acts.join() === 'Ask
|
|
124
|
+
&& e0.acts.join() === 'Ask PMOS in Home to change how it is counted,Cancel the edit,Save' && e0.focus === 'name', JSON.stringify(e0));
|
|
125
125
|
await shot(p, 'gap2-draft-edit', '#czViewer');
|
|
126
126
|
await p.click('#czViewer [data-gc="edit-x"]');
|
|
127
127
|
ok('E × puts the check back', await until(() => p.evaluate(() => !document.querySelector('#czViewer [data-gc-ed]') && !!document.querySelector('#czViewer [data-gc="edit"]')), 2000));
|
|
@@ -149,7 +149,7 @@ const WEEKLY = { view: 'view', weeks: 3, day: 'Mon', opens: 4 };
|
|
|
149
149
|
return { was, f, acts: [...host.querySelectorAll('.md-ft .md-ib')].map((b) => b.getAttribute('aria-label')) };
|
|
150
150
|
}, MODEL.board.ws);
|
|
151
151
|
ok('C the program card\'s ✎ is a press now, and opens each draft\'s fields in place with ask, ×, ✓', !!c0 && c0.was === 'BUTTON' && c0.f.join() === 'md-ns:name,md-ns:target,md-ns:source,md-g:name,md-g:target,md-g:source'
|
|
152
|
-
&& c0.acts.join() === 'Ask
|
|
152
|
+
&& c0.acts.join() === 'Ask PMOS in Home to change something else,Cancel the edit,Save the edit', JSON.stringify(c0));
|
|
153
153
|
await p.fill('#mdHost [data-md-row="md-g"][data-md-f="target"]', '1.5');
|
|
154
154
|
await p.click('#mdHost [data-md="save"]');
|
|
155
155
|
const ce = await until(() => A.posts.filter((x) => x.path === '/api/metric-drafts/edit' && x.body.scope === 'program'), 3000);
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* Pure: the client imports the same table through GET /api/home-desk (roles), so both sides say the same name. */
|
|
14
14
|
|
|
15
15
|
const ROLES = Object.freeze({
|
|
16
|
-
claude: { key: 'claude', name: '
|
|
16
|
+
claude: { key: 'claude', name: 'PMOS', initial: 'P' },
|
|
17
17
|
spec: { key: 'spec', name: 'Spec writer', initial: 'Sp' },
|
|
18
18
|
eval: { key: 'eval', name: 'Evaluator', initial: 'Ev' },
|
|
19
19
|
strategy: { key: 'strategy', name: 'Strategist', initial: 'St' },
|
|
@@ -92,7 +92,7 @@ const KIND_LIST = Object.freeze([
|
|
|
92
92
|
k('dates', 'Dates moved by evidence', ['propose:dates']),
|
|
93
93
|
k('status', 'Closing tasks Jira marked Done', ['propose:status']),
|
|
94
94
|
k('description', 'Descriptions and links', ['propose:description', 'propose:links']),
|
|
95
|
-
k('found', 'What
|
|
95
|
+
k('found', 'What PMOS found elsewhere', ['propose:found', 'propose:scanned', 'propose:improved', 'propose:prototyped']),
|
|
96
96
|
k('grill', 'Fixes from a check', ['propose:grill']),
|
|
97
97
|
]);
|
|
98
98
|
const KIND_OF_JOB = new Map(KIND_LIST.flatMap((x) => x.jobs.map((j) => [j, x.key])));
|
|
@@ -108,7 +108,7 @@ function plan({ jobs = JOBS, now = Date.now(), idleMs = 0, idleLimit = 30 * 60 *
|
|
|
108
108
|
if (j.step < 5) return row(true);
|
|
109
109
|
if (quiet) return row(false, 'quiet hours');
|
|
110
110
|
if (!away) return row(false, 'waiting for you to step away');
|
|
111
|
-
if (spend && spend.atCap) return row(false, spend.why || "the spend limit in Settings ›
|
|
111
|
+
if (spend && spend.atCap) return row(false, spend.why || "the spend limit in Settings › PMOS's checks is reached");
|
|
112
112
|
if (live >= cap) return row(false, `${live} background runs are live (limit ${cap})`);
|
|
113
113
|
live++; // a step-5 job may start one run: the next one sees it
|
|
114
114
|
return row(true);
|
|
@@ -206,7 +206,7 @@ function chat({ runtimeDir, key, text, model, context, sessions, wsId, iniInfo,
|
|
|
206
206
|
if (!runtimeDir) return fail(409, 'this workspace has no state folder to keep the conversation in');
|
|
207
207
|
if (!KEY_RE.test(String(key || ''))) return fail(400, 'key must name a row');
|
|
208
208
|
const q = String(text == null ? '' : text).trim();
|
|
209
|
-
if (!q) return fail(400, 'Write a message for
|
|
209
|
+
if (!q) return fail(400, 'Write a message for PMOS.');
|
|
210
210
|
if (q.length > MAX_Q * 4) return fail(400, 'The message is too long (' + MAX_Q * 4 + ' characters at most).');
|
|
211
211
|
if (!sessions || typeof sessions.spawn !== 'function') return fail(409, 'this workspace cannot start sessions');
|
|
212
212
|
const live = chatSessionOf(runtimeDir, key);
|
|
@@ -256,7 +256,7 @@ function chat({ runtimeDir, key, text, model, context, sessions, wsId, iniInfo,
|
|
|
256
256
|
// chief-of-staff C1/C6: the opening of Home's own chat carries the chief-of-staff rule (lib/cos-chat.js)
|
|
257
257
|
const cosRule = CosChat.isKey(key) && !goal ? [CosChat.RULE] : [];
|
|
258
258
|
try { s = sessions.spawn({ name, agent: 'claude', ws: wsId, origin: 'chat:' + key, chatClaude: { id: claude, resume }, initialInput: (resume ? msg : openingFor(row, msg, [...iniRule, ...cosRule])) + '\r', ...(resume && /^\/[A-Za-z0-9]/.test(msg) ? { typedByPm: true } : {}) }); } catch (e) { s = { state: 'exited', note: String((e && e.message) || e).slice(0, 120) }; }
|
|
259
|
-
if (!s || s.state === 'exited' || !s.id) return fail(409, '
|
|
259
|
+
if (!s || s.state === 'exited' || !s.id) return fail(409, 'PMOS could not start: ' + ((s && s.note) || 'no session'));
|
|
260
260
|
fs.mkdirSync(runtimeDir, { recursive: true });
|
|
261
261
|
fs.appendFileSync(path.join(runtimeDir, CHATS), JSON.stringify({ key, session: s.id, claude, name, at: now.toISOString() }) + '\n');
|
|
262
262
|
return { status: 200, body: { ok: true, session: s.id, started: true, ...(resume ? { resumed: true } : {}), ...extra } };
|
|
@@ -110,7 +110,7 @@ function checkFinding(L, input, { root = '.', read = (f) => fs.readFileSync(f, '
|
|
|
110
110
|
const prop = {
|
|
111
111
|
id: 'pr-' + hash([ini, 'grill', 'decision', id, pfile].join('|')),
|
|
112
112
|
title: one(`Earlier decision: ${conflict}`, 200),
|
|
113
|
-
say: one(`${id}${d.date ? ' (' + d.date + ')' : ''} says "${quote}". ${one(plan.label, LIM.label)} says "${pquote}". Keep ${id} and change the plan, change ${id}, or drop it.
|
|
113
|
+
say: one(`${id}${d.date ? ' (' + d.date + ')' : ''} says "${quote}". ${one(plan.label, LIM.label)} says "${pquote}". Keep ${id} and change the plan, change ${id}, or drop it. PMOS suggests: ${RECOMMEND[rec].replace('{D}', id)}.`, 900),
|
|
114
114
|
confidence: conf,
|
|
115
115
|
claims: [
|
|
116
116
|
{ text: `${id} · ${d.title}`, sources: [{ label: id, ...dsrc }] },
|
|
@@ -167,7 +167,7 @@ function replayCases(L, { root = '.', read } = {}) {
|
|
|
167
167
|
const before = DL.asOf(L, newer), was = before.decisions.get(older);
|
|
168
168
|
// an older decision already superseded before N (D64 replaced D24 before D66 did) is refused before N too, naming the earlier successor
|
|
169
169
|
if (was && was.status === 'superseded') cases.push({ name: `${newer} → ${older}: before ${newer}, ${older} was already superseded by ${was.supersededBy.join(', ')}`, run: refused(before, finding, was.supersededBy), expect: { none: true } });
|
|
170
|
-
else cases.push({ name: `${newer} → ${older}: before ${newer},
|
|
170
|
+
else cases.push({ name: `${newer} → ${older}: before ${newer}, PMOS pushes back`, run: filed(before, finding), expect: { filed: 1, cites: [O.path] } });
|
|
171
171
|
cases.push({ name: `${newer} → ${older}: after ${newer}, ${older} is not quoted as live`, run: refused(L, finding, [newer]), expect: { none: true } });
|
|
172
172
|
}
|
|
173
173
|
return cases;
|
|
@@ -143,11 +143,11 @@ async function autoApply({ file, proposal, actor, ctx = {}, now, stateDir, produ
|
|
|
143
143
|
const d = A.decide({ stateDir, job: jobOf(p), product, cls, mode: m, undoable: UNDOABLE.has(p.what), now, settingsDir: ctx.settingsDir || null });
|
|
144
144
|
if (!d.apply) return { applied: false, why: d.why, cls };
|
|
145
145
|
// board AwI: Intent is the PM's; Claude's change to it is a ✦ proposal on the product page and never applies by itself
|
|
146
|
-
if (p.what === 'artefact' && p.data && p.data.artefact === 'intent') return { applied: false, why: 'Intent is the PM\'s, so
|
|
146
|
+
if (p.what === 'artefact' && p.data && p.data.artefact === 'intent') return { applied: false, why: 'Intent is the PM\'s, so PMOS only proposes', cls };
|
|
147
147
|
// board AwB: a line of an artefact the PM edited is the PM's now; Claude's change to it waits as a proposal
|
|
148
148
|
if (p.what === 'artefact' && ctx.root) {
|
|
149
149
|
const AR = require('./artefacts.js');
|
|
150
|
-
try { if (AR.pmEdited(AR.fold(AR.readLines(AR.file(AR.dirOf(ctx.root)))), p.data || {})) return { applied: false, why: 'the PM edited this line, so
|
|
150
|
+
try { if (AR.pmEdited(AR.fold(AR.readLines(AR.file(AR.dirOf(ctx.root)))), p.data || {})) return { applied: false, why: 'the PM edited this line, so PMOS asks first', cls }; } catch { /* no artefacts yet: nothing edited */ }
|
|
151
151
|
}
|
|
152
152
|
const r = await decide('keep', { file, proposal, actor, ctx, now, auto: true });
|
|
153
153
|
if (!r.ok) return { applied: false, why: r.error, cls };
|
package/workspace/lib/driver.js
CHANGED
|
@@ -95,14 +95,18 @@ function localDay(ms) {
|
|
|
95
95
|
// ── where the ledger lives ───────────────────────────────────────────────────────────────────────────
|
|
96
96
|
const isDir = (d) => { try { return fs.statSync(d).isDirectory(); } catch { return false; } };
|
|
97
97
|
/** The repository's state folder, by the rule server.js stateDirFor uses; the checkout this file ships in falls back to
|
|
98
|
-
*
|
|
98
|
+
* lib/state-root.js#selfRecordsDir, as the server does for PMOS-self. Null when there is none (and `create` is off). */
|
|
99
99
|
function stateDirOf(root, { create = false } = {}) {
|
|
100
100
|
if (!root) return null;
|
|
101
101
|
for (const rel of [['pmos', 'state'], ['state'], ['.pmos']]) {
|
|
102
102
|
const d = path.join(root, ...rel);
|
|
103
103
|
if (isDir(d)) return d;
|
|
104
104
|
}
|
|
105
|
-
if (path.resolve(root) === path.resolve(__dirname, '..', '..')
|
|
105
|
+
if (path.resolve(root) === path.resolve(__dirname, '..', '..')) {
|
|
106
|
+
// PMOS-self with no pmos/state/: the per-user records folder (lib/state-root.js#selfRecordsDir), never the app folder.
|
|
107
|
+
const d = require('./state-root.js').selfRecordsDir({ legacy: path.join(__dirname, '..', 'state') });
|
|
108
|
+
try { fs.mkdirSync(d, { recursive: true }); return d; } catch { return null; }
|
|
109
|
+
}
|
|
106
110
|
if (create) {
|
|
107
111
|
const d = path.join(root, 'pmos', 'state');
|
|
108
112
|
try { fs.mkdirSync(d, { recursive: true }); return d; } catch { return null; }
|
|
@@ -21,7 +21,7 @@ function rowsFor(w, { lead } = {}) {
|
|
|
21
21
|
const evidence = a.files.length ? a.files.join(', ') : '';
|
|
22
22
|
return [{
|
|
23
23
|
run_id: `${NAME}:${w.id}`, kind: 'folder-attention', initiative_id: null, question: a.message, doc: null, ws: w.id,
|
|
24
|
-
today: { kind: 8, source: NAME, cause: a.message, evidence, act: { label: 'Ask
|
|
24
|
+
today: { kind: 8, source: NAME, cause: a.message, evidence, act: { label: 'Ask PMOS to sort it out', cli: null } },
|
|
25
25
|
}];
|
|
26
26
|
}
|
|
27
27
|
function sig(w) {
|
|
@@ -233,7 +233,7 @@ function resume({ runtimeDir, key, now = new Date() }) {
|
|
|
233
233
|
* One row per conversation (key goal:<conversation key>); chatKey names the conversation, so pressing the row opens it and its goal card.
|
|
234
234
|
* A row goes when the PM writes in the conversation, starts a new /goal there, or after ROW_DAYS. */
|
|
235
235
|
const ROW_DAYS = 7;
|
|
236
|
-
const ROW_TITLE = { done: 'Check the goal
|
|
236
|
+
const ROW_TITLE = { done: 'Check the goal PMOS finished', waiting: 'PMOS needs you on a goal', stopped: 'A goal stopped before it was done' };
|
|
237
237
|
function briefingRows(runtimeDir, now = Date.now()) { return goalRowsAt(runtimeDir, now).map(({ at, goalState, ...r }) => r); }
|
|
238
238
|
/** briefingRows with each row's `at` (ms of the goal's last event) and `goalState` (done, stopped, waiting) kept: the bell's inbox orders and marks new by it (premium-agent-inbox). */
|
|
239
239
|
function goalRowsAt(runtimeDir, now = Date.now()) {
|
|
@@ -247,17 +247,17 @@ function goalRowsAt(runtimeDir, now = Date.now()) {
|
|
|
247
247
|
const at = Date.parse(g.at || '');
|
|
248
248
|
if (Number.isFinite(at) && now - at > ROW_DAYS * 86400000) continue;
|
|
249
249
|
const all = requiredOf(g), met = (g.met || []).filter((x) => all.includes(x)).length;
|
|
250
|
-
const why = g.state === 'stopped' ? (REASON[g.reason] || 'It stopped.') : g.state === 'waiting' ? (g.reason === 'issue' ? REASON.issue : '
|
|
250
|
+
const why = g.state === 'stopped' ? (REASON[g.reason] || 'It stopped.') : g.state === 'waiting' ? (g.reason === 'issue' ? REASON.issue : 'PMOS asked you something in the conversation.') : 'PMOS reports every done point met. It checked its own work.';
|
|
251
251
|
out.push({
|
|
252
252
|
kind: 'goal', key: 'goal:' + key, chatKey: key, goalState: g.state, title: ROW_TITLE[g.state], subject: clip(g.draft.goal, 90),
|
|
253
|
-
prepared: met + ' of ' + all.length + ' done points met, as
|
|
253
|
+
prepared: met + ' of ' + all.length + ' done points met, as PMOS reports it. ' + why,
|
|
254
254
|
skip: g.state === 'waiting' ? 'If you skip: the goal waits and nothing more is done on it.' : 'If you skip: nobody checks the work before it is relied on.',
|
|
255
255
|
at,
|
|
256
256
|
dialog: {
|
|
257
257
|
eye: 'Goal', logTitle: 'Read from the goal record', log: ['Read goal-runs.jsonl in the state folder', 'Kept the latest state of this goal', 'Changed nothing'],
|
|
258
258
|
say: clip(g.draft.goal, 200) + ': ' + why, head: 'The goal',
|
|
259
259
|
facts: [['State', ROW_TITLE[g.state]], ['Done points', met + ' of ' + all.length + ' met, unverified'], ['By', g.draft.by], ['Rounds', String(g.rounds || 0)]].filter((x) => x[1]),
|
|
260
|
-
opts: [], sel: null, nodef: 'The goal card is in the conversation beside this. Write there to answer
|
|
260
|
+
opts: [], sel: null, nodef: 'The goal card is in the conversation beside this. Write there to answer PMOS or to go on.',
|
|
261
261
|
pane: { label: 'Goal', file: 'goal-runs.jsonl', h: clip(g.draft.goal, 90), intro: why, rows: (g.draft.done || []).map((x) => [(g.skipped || []).includes(x) ? 'Skipped' : (g.met || []).includes(x) ? 'Met' : 'Open', x]), paras: [] },
|
|
262
262
|
},
|
|
263
263
|
});
|
|
@@ -341,7 +341,7 @@ function decide({ runtimeDir, key, id, act, draft, point, session, sessions, now
|
|
|
341
341
|
if (act === 'skip' && (skipped.includes(p) || (g.met || []).includes(p))) return fail(409, 'That point is already ' + (skipped.includes(p) ? 'skipped.' : 'met.'));
|
|
342
342
|
if (act === 'skip' && requiredOf(g).length <= 1) return fail(409, 'A goal keeps at least one done point. Stop it instead.');
|
|
343
343
|
if (act === 'unskip' && !skipped.includes(p)) return fail(409, 'That point is not skipped.');
|
|
344
|
-
if (act === 'unskip' && Date.parse((g.skipAt || {})[p] || '') <= Date.parse(g.roundAt || '')) return fail(409, '
|
|
344
|
+
if (act === 'unskip' && Date.parse((g.skipAt || {})[p] || '') <= Date.parse(g.roundAt || '')) return fail(409, 'PMOS has already dropped that point. Tell PMOS to pick it up again.');
|
|
345
345
|
// a queued instruction: typed while Claude works, so Claude reads it after its current step
|
|
346
346
|
if (!alive || !sessions.type(session, act === 'skip' ? skipMessage(p) : unskipMessage(p))) return fail(409, 'The message did not reach the session. Open it in Sessions.');
|
|
347
347
|
append(runtimeDir, { event: act, point: p, id, key, at });
|
|
@@ -61,7 +61,7 @@ function historyOf(lines, rid) {
|
|
|
61
61
|
const out = [];
|
|
62
62
|
for (const l of lines || []) {
|
|
63
63
|
if (!l || l.rid !== rid || l.kind === 'reading') continue;
|
|
64
|
-
const who = String(l.by || '').startsWith('human:') ? 'You' : '
|
|
64
|
+
const who = String(l.by || '').startsWith('human:') ? 'You' : 'PMOS';
|
|
65
65
|
const what = l.kind === 'add' ? 'added it' : 'changed ' + Object.keys(l.fields || {}).filter((k) => k !== 'retired').join(', ');
|
|
66
66
|
out.push({ at: timeOf(l.id), text: who + ' ' + what + (l.why ? ': ' + String(l.why).slice(0, 120) : '') });
|
|
67
67
|
}
|
|
@@ -85,8 +85,8 @@ function create(deps) {
|
|
|
85
85
|
|
|
86
86
|
/** Start one run now. → { ok, run, budget } | { ok: false, error, paused?, held? } */
|
|
87
87
|
function start({ ws, board, ini, why = 'monthly', key = '', detail = '', now = Date.now() } = {}) {
|
|
88
|
-
if (isOff()) return { ok: false, error: '
|
|
89
|
-
if (active.size >= MAX) return { ok: false, held: true, error: '
|
|
88
|
+
if (isOff()) return { ok: false, error: 'PMOS\'s grill runs are off (Settings grill.mode, PMOS_GRILL or PMOS_HEADLESS)' };
|
|
89
|
+
if (active.size >= MAX) return { ok: false, held: true, error: 'PMOS is already grilling one initiative' };
|
|
90
90
|
const rt = runtime(); if (!rt) return { ok: false, error: 'no runtime state folder' };
|
|
91
91
|
const w = (deps.workspaces() || []).find((x) => x.id === ws);
|
|
92
92
|
if (!w) return { ok: false, error: 'no such workspace' };
|
|
@@ -96,7 +96,7 @@ function create(deps) {
|
|
|
96
96
|
const month = G.monthOf(now);
|
|
97
97
|
// at the cap Claude pauses and says so once a month
|
|
98
98
|
if (!F.paused.has(month)) try { G.append(rt, { kind: 'paused', month, spent: b.spent, cap: cap() }, now); } catch (e) { warn('grill pause', e); }
|
|
99
|
-
return { ok: false, paused: true, error: `
|
|
99
|
+
return { ok: false, paused: true, error: `PMOS paused grilling: this month spent $${b.spent} of the $${cap()} cap` };
|
|
100
100
|
}
|
|
101
101
|
const skill = deps.promptFor('grill');
|
|
102
102
|
if (!skill) return { ok: false, error: 'the grill skill is not installed' };
|
|
@@ -130,12 +130,12 @@ function create(deps) {
|
|
|
130
130
|
env,
|
|
131
131
|
onDone: (r) => ended(run, r) });
|
|
132
132
|
} catch (e) { warn('grill run', e); }
|
|
133
|
-
if (session && session.held) { active.delete(run); return { ok: false, held: true, error: '
|
|
133
|
+
if (session && session.held) { active.delete(run); return { ok: false, held: true, error: 'PMOS is busy with other runs; it grills in a minute' }; }
|
|
134
134
|
G.append(rt, { kind: 'start', run, ws, ini, board: board || '', why, key, budget: b.budget }, now);
|
|
135
135
|
if (!session || session.state === 'exited' || session.headless !== 'grill') {
|
|
136
136
|
if (session && session.headless !== 'grill' && session.state !== 'exited' && deps.stop) { try { deps.stop(session); } catch { /* best effort */ } }
|
|
137
137
|
ended(run, { code: 1, note: (session && session.note) || 'the run could not start in the background', result: { costUsd: 0 } }, now);
|
|
138
|
-
return { ok: false, error: (session && session.note) || '
|
|
138
|
+
return { ok: false, error: (session && session.note) || 'PMOS could not start grilling' };
|
|
139
139
|
}
|
|
140
140
|
active.get(run).session = session;
|
|
141
141
|
return { ok: true, run, budget: b.budget };
|
|
@@ -44,7 +44,7 @@ const crypto = require('crypto');
|
|
|
44
44
|
const LEDGER = 'idle-lab.jsonl';
|
|
45
45
|
const KINDS = new Set(['propose', 'drop', 'keep', 'undo', 'run', 'next']);
|
|
46
46
|
const GROUPS = Object.freeze(['prototyped', 'improved', 'scanned']);
|
|
47
|
-
const TITLES = Object.freeze({ prototyped: '
|
|
47
|
+
const TITLES = Object.freeze({ prototyped: 'PMOS prototyped it', improved: 'PMOS improved it', scanned: 'PMOS scanned for it' });
|
|
48
48
|
const LOOSE = Object.freeze(['start', 'scan']);
|
|
49
49
|
const PROVEN = Object.freeze({ production: false, design: false });
|
|
50
50
|
const WEEK = 7 * 864e5;
|
|
@@ -85,7 +85,7 @@ function result(group, input) {
|
|
|
85
85
|
if (!GROUPS.includes(group)) return { error: 'group is one of ' + GROUPS.join(', ') };
|
|
86
86
|
if (!isObj(input)) return { error: 'the result is a JSON object' };
|
|
87
87
|
const why = one(input.why, LIM.why);
|
|
88
|
-
if (!why) return { error: 'why is one line: what
|
|
88
|
+
if (!why) return { error: 'why is one line: what PMOS did and from what' };
|
|
89
89
|
const s = srcList(input.sources, 1); if (s.error) return s;
|
|
90
90
|
const data = {};
|
|
91
91
|
if (group === 'prototyped') {
|
|
@@ -114,7 +114,7 @@ function result(group, input) {
|
|
|
114
114
|
}
|
|
115
115
|
if (group !== 'scanned') {
|
|
116
116
|
const checked = one(input.checked, LIM.checked);
|
|
117
|
-
if (!checked) return { error: 'checked says how
|
|
117
|
+
if (!checked) return { error: 'checked says how PMOS proved it (for example: all three open and render in the Viewer)' };
|
|
118
118
|
data.checked = checked;
|
|
119
119
|
}
|
|
120
120
|
if (isObj(input.compare)) data.compare = compareData(input.compare);
|
|
@@ -258,9 +258,9 @@ function compareOf(P, id, { key = '', titleOf = () => '', proven = PROVEN } = {}
|
|
|
258
258
|
const c = (p.data && p.data.compare) || {};
|
|
259
259
|
const cols = [];
|
|
260
260
|
cols.push(proven.production && c.production ? { id: 'production', title: 'Production', meta: 'main, today', file: c.production.file, read: c.production.read }
|
|
261
|
-
: { id: 'production', title: 'Production', left: 'Left out:
|
|
261
|
+
: { id: 'production', title: 'Production', left: 'Left out: PMOS cannot render production from the product repo yet. It shows here once that is proven.' });
|
|
262
262
|
cols.push(proven.design && c.design ? { id: 'design', title: 'Design', meta: 'the design for this screen', file: c.design.file, read: c.design.read }
|
|
263
|
-
: { id: 'design', title: 'Design', left: 'Left out:
|
|
263
|
+
: { id: 'design', title: 'Design', left: 'Left out: PMOS cannot read the design from Figma or a canvas yet. It shows here once that is proven.' });
|
|
264
264
|
cols.push({ id: 'prototype', title: 'Prototype', meta: 'round ' + round + (spec ? ' · ' + spec.key : ''), file, read: (p.data && p.data.checked) || '' });
|
|
265
265
|
const shown = new Set(cols.filter((x) => !x.left).map((x) => x.id));
|
|
266
266
|
const pins = (c.pins || []).filter((x) => shown.has(x.vs)).map((x, i) => ({ n: i + 1, vs: x.vs, text: x.text }));
|
|
@@ -81,12 +81,12 @@ function create(deps) {
|
|
|
81
81
|
session = go({ name: 'Reading your impact', ws: w.id, origin: 'impact:' + run, initialInput: prompt + '\r',
|
|
82
82
|
env: { PMOS_IMPACT_FILE: IM.ledgerFile(dir), PMOS_IMPACT_RUN: run }, onDone: (r) => ended(run, r) });
|
|
83
83
|
} catch (e) { warn('impact run', e); }
|
|
84
|
-
if (session && session.held) { active = null; return { ok: false, held: true, error: '
|
|
84
|
+
if (session && session.held) { active = null; return { ok: false, held: true, error: 'PMOS is busy with other runs. It tries again later.' }; }
|
|
85
85
|
IM.append(dir, null, { kind: 'run', run }, new Date(now).toISOString());
|
|
86
86
|
if (!session || session.state === 'exited' || session.headless !== 'impact') {
|
|
87
87
|
if (session && session.headless !== 'impact' && session.state !== 'exited' && deps.stop) { try { deps.stop(session); } catch { /* best effort */ } }
|
|
88
88
|
ended(run, { code: 1, note: (session && session.note) || 'the run could not start in the background', result: {} }, now);
|
|
89
|
-
return { ok: false, error: (session && session.note) || '
|
|
89
|
+
return { ok: false, error: (session && session.note) || 'PMOS could not start reading.' };
|
|
90
90
|
}
|
|
91
91
|
if (active) active.session = session;
|
|
92
92
|
return { ok: true, run };
|
|
@@ -41,10 +41,10 @@ const LEDGERS = Object.freeze({
|
|
|
41
41
|
'<runtime>/run-tokens.jsonl': { concept: 'run-tokens', owner: 'lib/run-tokens.js', readers: [
|
|
42
42
|
r('lib/ai-cli.js', 'run-tokens.js', '`pmos ai status`: tokens read per background run, lean and full')] },
|
|
43
43
|
'<runtime>/bg-queue.jsonl': { concept: 'background-turns', owner: 'lib/bg-queue.js', readers: [
|
|
44
|
-
r('lib/routes-lab.js', 'bgQueue.record', 'Intelligence › Lab: what
|
|
44
|
+
r('lib/routes-lab.js', 'bgQueue.record', 'Intelligence › Lab: what PMOS did in the background')] },
|
|
45
45
|
'<runtime>/grill-runs.jsonl': { concept: 'grill-spend', owner: 'lib/grill.js', readers: [
|
|
46
46
|
r('lib/bg-queue.js', 'grill-runs.jsonl', 'the spend limit that holds step 5'),
|
|
47
|
-
r('lib/routes-grill.js', null, "Settings ›
|
|
47
|
+
r('lib/routes-grill.js', null, "Settings › PMOS's checks: this month's spend")] },
|
|
48
48
|
'<runtime>/goal-loops.jsonl': { concept: 'goal-loops', owner: 'lib/goal-loop.js', readers: [
|
|
49
49
|
r('lib/loop-cli.js', null, '`pmos loop status`: each goal, its round and its state')] },
|
|
50
50
|
'<state>/driver.jsonl': { concept: 'driver-runs', owner: 'lib/driver.js', readers: [
|
|
@@ -145,14 +145,14 @@ function create(deps) {
|
|
|
145
145
|
|
|
146
146
|
/** Start one run now. → { ok, run } | { ok: false, error, held? } */
|
|
147
147
|
function start({ ws, scope, id, why = 'press', press = true, now = Date.now(), gaps = null, sig = null } = {}) {
|
|
148
|
-
if (off(deps.env) || (deps.headlessOff && deps.headlessOff())) return { ok: false, error: '
|
|
148
|
+
if (off(deps.env) || (deps.headlessOff && deps.headlessOff())) return { ok: false, error: 'PMOS\'s metric drafts are off (PMOS_METRIC_DRAFT or PMOS_HEADLESS).' };
|
|
149
149
|
if (!MD.SCOPES.includes(scope) || !id) return { ok: false, error: 'Say which product, program or initiative to draft for.' };
|
|
150
150
|
const w = (deps.workspaces() || []).find((x) => x.id === ws);
|
|
151
151
|
if (!w) return { ok: false, error: 'no such workspace' };
|
|
152
152
|
const dir = deps.stateDirFor(w);
|
|
153
153
|
if (!dir) return { ok: false, error: 'This repository has no PMOS state folder, so nothing can be drafted.' };
|
|
154
154
|
for (const [r, a] of active) if (a.ws === ws && a.scope === scope && a.id === id) return { ok: true, run: r, already: true };
|
|
155
|
-
if (active.size >= MAX) return { ok: false, held: true, error: '
|
|
155
|
+
if (active.size >= MAX) return { ok: false, held: true, error: 'PMOS is drafting two others now. It drafts this one when one ends.' };
|
|
156
156
|
const skill = deps.promptFor('metric-draft');
|
|
157
157
|
if (!skill) return { ok: false, error: 'The metric-draft skill is not installed.' };
|
|
158
158
|
const run = 'md' + now.toString(36) + crypto.randomBytes(3).toString('hex');
|
|
@@ -171,13 +171,13 @@ function create(deps) {
|
|
|
171
171
|
session = go({ name: 'Drafting metrics · ' + one(title, 60), ws, ...(press ? { byPm: true } : {}), origin: `metric-draft:${ws}:${scope}:${id}:${run}`, initialInput: prompt + '\r', ...(scope === 'initiative' ? { initiative: id } : {}),
|
|
172
172
|
env: { PMOS_METRIC_DRAFT_FILE: MD.ledgerFile(dir), PMOS_METRIC_DRAFT_WS: ws, PMOS_METRIC_DRAFT_SCOPE: scope, PMOS_METRIC_DRAFT_ID: id, PMOS_METRIC_DRAFT_RUN: run }, onDone: (r) => ended(run, r) });
|
|
173
173
|
} catch (e) { warn('metric draft run', e); }
|
|
174
|
-
if (session && session.held) { active.delete(run); return { ok: false, held: true, error: '
|
|
174
|
+
if (session && session.held) { active.delete(run); return { ok: false, held: true, error: 'PMOS is busy with other runs. It tries again in a minute.' }; }
|
|
175
175
|
// the start line lands before the run's first `pmos metrics draft` (the run starts reading after this returns), stamped with the tick's clock
|
|
176
176
|
MD.append(dir, null, { kind: 'start', scope, id, run, why, title, when: MD.WHEN[why] || '', ...(sig ? { gaps: sig } : {}) }, new Date(now).toISOString());
|
|
177
177
|
if (!session || session.state === 'exited' || session.headless !== 'metric-draft') {
|
|
178
178
|
if (session && session.headless !== 'metric-draft' && session.state !== 'exited' && deps.stop) { try { deps.stop(session); } catch { /* best effort */ } }
|
|
179
179
|
ended(run, { code: 1, note: (session && session.note) || 'the run could not start in the background', result: {} }, now);
|
|
180
|
-
return { ok: false, error: (session && session.note) || '
|
|
180
|
+
return { ok: false, error: (session && session.note) || 'PMOS could not start drafting.' };
|
|
181
181
|
}
|
|
182
182
|
const a = active.get(run); if (a) a.session = session;
|
|
183
183
|
return { ok: true, run };
|
|
@@ -65,13 +65,13 @@ function create(deps) {
|
|
|
65
65
|
|
|
66
66
|
/** Start one run now. → { ok, run } | { ok: false, error, held? } */
|
|
67
67
|
function start({ ws, rids, why = 'press', now = Date.now(), compare = null } = {}) {
|
|
68
|
-
if (off(deps.env) || (deps.headlessOff && deps.headlessOff())) return { ok: false, error: '
|
|
68
|
+
if (off(deps.env) || (deps.headlessOff && deps.headlessOff())) return { ok: false, error: 'PMOS\'s goal readings are off (PMOS_METRIC_READ or PMOS_HEADLESS).' };
|
|
69
69
|
const w = (deps.workspaces() || []).find((x) => x.id === ws);
|
|
70
70
|
if (!w) return { ok: false, error: 'no such workspace' };
|
|
71
71
|
const dir = deps.stateDirFor(w);
|
|
72
72
|
if (!dir) return { ok: false, error: 'This repository has no PMOS state folder, so nothing can be read.' };
|
|
73
|
-
for (const [r, a] of active) if (a.ws === ws) return { ok: false, held: true, already: r, error: '
|
|
74
|
-
if (active.size >= MAX) return { ok: false, held: true, error: '
|
|
73
|
+
for (const [r, a] of active) if (a.ws === ws) return { ok: false, held: true, already: r, error: 'PMOS is reading this product\'s goals now. It reads these when that run ends.' };
|
|
74
|
+
if (active.size >= MAX) return { ok: false, held: true, error: 'PMOS is reading two other products now. It reads these when one ends.' };
|
|
75
75
|
const test = why === 'test' || !!(compare && compare.draft);
|
|
76
76
|
let items = [];
|
|
77
77
|
if (test) { try { items = (deps.testItems && deps.testItems(w, rids)) || []; } catch { items = []; } }
|
|
@@ -95,13 +95,13 @@ function create(deps) {
|
|
|
95
95
|
env: { PMOS_METRIC_READ_FILE: MR.ledgerFile(dir), PMOS_METRIC_READ_RECORDS: deps.recordsDir(w), PMOS_METRIC_READ_DRAFTS: (deps.draftsFile && deps.draftsFile(w)) || '',
|
|
96
96
|
PMOS_METRIC_READ_WS: ws, PMOS_METRIC_READ_RUN: run, PMOS_METRIC_READ_RIDS: ids.join(','), PMOS_METRIC_READ_TEST: test ? '1' : '' }, onDone: (r) => ended(run, r) });
|
|
97
97
|
} catch (e) { warn('metric read run', e); }
|
|
98
|
-
if (session && session.held) { active.delete(run); return { ok: false, held: true, error: '
|
|
98
|
+
if (session && session.held) { active.delete(run); return { ok: false, held: true, error: 'PMOS is busy with other runs. It tries again in a minute.' }; }
|
|
99
99
|
// the start line lands before the run's first `pmos metrics reading` (the run starts reading after this returns)
|
|
100
100
|
MR.append(dir, null, { kind: 'start', run, ws, rids: ids, why }, new Date(now).toISOString());
|
|
101
101
|
if (!session || session.state === 'exited' || session.headless !== 'metric-read') {
|
|
102
102
|
if (session && session.headless !== 'metric-read' && session.state !== 'exited' && deps.stop) { try { deps.stop(session); } catch { /* best effort */ } }
|
|
103
103
|
ended(run, { code: 1, note: (session && session.note) || 'the run could not start in the background' }, now);
|
|
104
|
-
return { ok: false, error: (session && session.note) || '
|
|
104
|
+
return { ok: false, error: (session && session.note) || 'PMOS could not start reading.' };
|
|
105
105
|
}
|
|
106
106
|
const a = active.get(run); if (a) a.session = session;
|
|
107
107
|
return { ok: true, run, rids: ids };
|
|
@@ -63,7 +63,7 @@ function build({ inbox = null, work = null, seen = new Set(), name = () => '', b
|
|
|
63
63
|
const by = (a, b) => (b.at || 0) - (a.at || 0);
|
|
64
64
|
const ib = inbox && inbox.ok !== false && Array.isArray(inbox.items) ? inbox.items : [];
|
|
65
65
|
const groups = [
|
|
66
|
-
{ key: 'propose', label: '
|
|
66
|
+
{ key: 'propose', label: 'PMOS proposes', items: ib.filter((x) => x && x.id && x.overlap && x.overlap.with && !seen.has(x.id)).map((x) => overlapItem(x, name))
|
|
67
67
|
.concat((bridges || []).filter((x) => x && x.id && x.kind === 'wf-bridge' && !seen.has(x.id))).sort(by) },
|
|
68
68
|
{ key: 'given', label: 'Given to you', items: givenItems(work, seen, name).sort(by) },
|
|
69
69
|
{ key: 'finished', label: 'Finished while you were away', items: finishedItems(inbox, seen).sort(by) },
|
|
@@ -95,7 +95,7 @@ function create(deps) {
|
|
|
95
95
|
|
|
96
96
|
/** Start one run now. → { ok, run } | { ok: false, error } */
|
|
97
97
|
function start({ ws, board, ini, why = 'populate', press = true, now = Date.now() } = {}) {
|
|
98
|
-
if (off(deps.env) || (deps.headlessOff && deps.headlessOff())) return { ok: false, error: '
|
|
98
|
+
if (off(deps.env) || (deps.headlessOff && deps.headlessOff())) return { ok: false, error: 'PMOS\'s background runs are off (PMOS_PROPOSE or PMOS_HEADLESS)' };
|
|
99
99
|
const w = (deps.workspaces() || []).find((x) => x.id === ws);
|
|
100
100
|
if (!w) return { ok: false, error: 'no such workspace' };
|
|
101
101
|
const dir = deps.stateDirFor(w);
|
|
@@ -119,14 +119,14 @@ function create(deps) {
|
|
|
119
119
|
session = go({ name: (why === 'check' ? 'Task check · ' : 'Looking for · ') + one(row.title || ini, 60), ws, origin: `propose:${ws}:${ini}:${run}`, initialInput: prompt + '\r', initiative: ini,
|
|
120
120
|
env: { PMOS_PROPOSE_FILE: PR.ledgerFile(dir), PMOS_PROPOSE_WS: ws, PMOS_PROPOSE_BOARD: board || '', PMOS_PROPOSE_INI: ini, PMOS_PROPOSE_RUN: run }, onDone: (r) => ended(run, r) });
|
|
121
121
|
} catch (e) { warn('proposal run', e); }
|
|
122
|
-
if (session && session.held) { active.delete(run); return { ok: false, held: true, error: '
|
|
122
|
+
if (session && session.held) { active.delete(run); return { ok: false, held: true, error: 'PMOS is busy with other runs; it looks again in a minute' }; }
|
|
123
123
|
// the look line lands before the run's first `pmos propose look` (the run starts reading after this returns)
|
|
124
124
|
// stamped with the tick's clock, so "once a day" compares the same clock the tick reads (a test or a tick near midnight)
|
|
125
125
|
PR.append(dir, null, { kind: 'look', ini, board: board || (deps.boardOf && deps.boardOf(w, ini)) || '', run, why, at: new Date(now).toISOString() });
|
|
126
126
|
if (!session || session.state === 'exited' || session.headless !== 'propose') {
|
|
127
127
|
if (session && session.headless !== 'propose' && session.state !== 'exited' && deps.stop) { try { deps.stop(session); } catch { /* best effort */ } }
|
|
128
128
|
ended(run, { code: 1, note: (session && session.note) || 'the run could not start in the background', result: {} }, now);
|
|
129
|
-
return { ok: false, error: (session && session.note) || '
|
|
129
|
+
return { ok: false, error: (session && session.note) || 'PMOS could not start looking' };
|
|
130
130
|
}
|
|
131
131
|
const a = active.get(run); if (a) a.session = session;
|
|
132
132
|
return { ok: true, run };
|
|
@@ -134,7 +134,7 @@ function create(deps) {
|
|
|
134
134
|
|
|
135
135
|
/** Home's clean-up: one run over the rows Home last showed loose. → { ok, run } | { ok: false, error, held? } */
|
|
136
136
|
function startLoose({ why = 'check', press = true, now = Date.now() } = {}) {
|
|
137
|
-
if (off(deps.env) || (deps.headlessOff && deps.headlessOff())) return { ok: false, error: '
|
|
137
|
+
if (off(deps.env) || (deps.headlessOff && deps.headlessOff())) return { ok: false, error: 'PMOS\'s background runs are off (PMOS_PROPOSE or PMOS_HEADLESS)' };
|
|
138
138
|
const dir = deps.looseDir ? deps.looseDir() : null, w = deps.homeWs ? deps.homeWs() : null;
|
|
139
139
|
if (!dir || !w) return { ok: false, error: 'no place to keep the clean-up' };
|
|
140
140
|
for (const [r, a] of active) if (a.ini === LOOSE) return { ok: true, run: r, already: true };
|
|
@@ -153,12 +153,12 @@ function create(deps) {
|
|
|
153
153
|
session = go({ name: 'Tidy loose work', ws: w.id, origin: `propose:${w.id}:${LOOSE}:${run}`, initialInput: prompt + '\r',
|
|
154
154
|
env: { PMOS_PROPOSE_FILE: LP.ledgerFile(dir), PMOS_PROPOSE_WS: w.id, PMOS_PROPOSE_BOARD: '', PMOS_PROPOSE_INI: LOOSE, PMOS_PROPOSE_RUN: run }, onDone: (r) => ended(run, r) });
|
|
155
155
|
} catch (e) { warn('clean-up run', e); }
|
|
156
|
-
if (session && session.held) { active.delete(run); return { ok: false, held: true, error: '
|
|
156
|
+
if (session && session.held) { active.delete(run); return { ok: false, held: true, error: 'PMOS is busy with other runs; it looks again in a minute' }; }
|
|
157
157
|
LP.append(dir, null, { kind: 'look', run, why, at: new Date(now).toISOString() });
|
|
158
158
|
if (!session || session.state === 'exited' || session.headless !== 'propose') {
|
|
159
159
|
if (session && session.headless !== 'propose' && session.state !== 'exited' && deps.stop) { try { deps.stop(session); } catch { /* best effort */ } }
|
|
160
160
|
ended(run, { code: 1, note: (session && session.note) || 'the run could not start in the background', result: {} }, now);
|
|
161
|
-
return { ok: false, error: (session && session.note) || '
|
|
161
|
+
return { ok: false, error: (session && session.note) || 'PMOS could not start looking' };
|
|
162
162
|
}
|
|
163
163
|
const a = active.get(run); if (a) a.session = session;
|
|
164
164
|
return { ok: true, run };
|
package/workspace/lib/refresh.js
CHANGED
|
@@ -65,7 +65,7 @@ const SOURCES = Object.freeze([
|
|
|
65
65
|
def: { kind: 'daily', times: ['06:45'] } },
|
|
66
66
|
// popup context slice 3b (PM pick, 2026-10-21): one leads session after the reads, for the popups the PM opened; it reads no tool
|
|
67
67
|
{ id: 'leads', label: 'Popup leads', group: 'pmos', ic: 'notes', run: 'skill', skill: 'popup-leads', how: 'bg',
|
|
68
|
-
what: '
|
|
68
|
+
what: 'PMOS\'s short lead for each popup you opened in the last 14 days, written from the stored reads after they are refreshed. It reads no tool.', uses: ['calendar', 'jira', 'mywork', 'tools'],
|
|
69
69
|
impact: 'Popups show their last lead, or none, until you press Refresh in the popup.',
|
|
70
70
|
def: { kind: 'manual' } },
|
|
71
71
|
{ id: 'daycheck', label: 'Day check', group: 'pmos', ic: 'clock', run: 'job', how: 'bg',
|
|
@@ -172,7 +172,7 @@ module.exports = {
|
|
|
172
172
|
const F = PR.read(dir), today = model.today || new Date().toISOString().slice(0, 10);
|
|
173
173
|
for (const L of [model.rows, ...(model.stages || []).map((x) => x.rows)]) PR.decorate(L, F, items.filter((x) => x && x.kind !== 'Epic'), { today, links: () => approved, settle: TL.settle });
|
|
174
174
|
}
|
|
175
|
-
} catch { missing.push('
|
|
175
|
+
} catch { missing.push('PMOS\'s proposals'); }
|
|
176
176
|
// Claude's suggestion to split an initiative or merge two (batch 11 item 14): made from the tasks and tickets on every read, never a timer;
|
|
177
177
|
// the PM's ✕ hides one while its facts hold (the same group, the same partner). A failure here only leaves the suggestions out.
|
|
178
178
|
try {
|
|
@@ -67,7 +67,7 @@ function heldOrCompare(ctx, w, what, body, { root, id, rec }) {
|
|
|
67
67
|
const reading = { at: h.day, value: h.value, source: h.source || 'held reading', via: 'held', read_at: h.at };
|
|
68
68
|
for (const k of ['num', 'den']) if (Number.isFinite(h[k])) reading[k] = h[k];
|
|
69
69
|
if (h.period) reading.period = h.period;
|
|
70
|
-
const r = records().addReading(root, rec.rid, reading, UI(), 'The PM filed a reading
|
|
70
|
+
const r = records().addReading(root, rec.rid, reading, UI(), 'The PM filed a reading PMOS held');
|
|
71
71
|
if (!r.ok) return bad(400, (r.reasons || []).join('; '));
|
|
72
72
|
MR.append(dir, UI(), { kind: 'filed', rid: rec.rid, held: h.at }, now);
|
|
73
73
|
if (h.ticket) { try { MD.append(dir, UI(), { kind: 'clear', scope: 'product', id: w.id, row: h.ticket }, now); } catch { /* the ticket stays a draft */ } }
|
|
@@ -159,12 +159,12 @@ async function handle(req, res, url, ctx) {
|
|
|
159
159
|
}
|
|
160
160
|
if (body.close_band !== undefined) { const b = Number(body.close_band); if (!Number.isFinite(b) || b < 0) return send(bad(400, 'close_band is a number, 0 or more')); set.close_band = b; }
|
|
161
161
|
if (!Object.keys(set).length) return send(bad(400, 'Say the recipe, the rhythm or the close band.'));
|
|
162
|
-
const out = edit(set, body.recipe === undefined && body.rhythm !== undefined ? 'How often
|
|
162
|
+
const out = edit(set, body.recipe === undefined && body.rhythm !== undefined ? 'How often PMOS reads this goal' : 'How PMOS reads this goal');
|
|
163
163
|
if (out.status === 200 && set.recipe) out.body.rhythm = MR.rhythmOf(set.recipe);
|
|
164
164
|
return send(out);
|
|
165
165
|
}
|
|
166
166
|
if (what === 'read' || what === 'test') {
|
|
167
|
-
if (!ctx.metricReadRuns) return send(bad(503, '
|
|
167
|
+
if (!ctx.metricReadRuns) return send(bad(503, 'PMOS\'s runs are off on this server.'));
|
|
168
168
|
let rids;
|
|
169
169
|
if (what === 'test') {
|
|
170
170
|
rids = Array.isArray(body.rows) ? body.rows.filter((x) => typeof x === 'string').slice(0, 8) : [];
|
|
@@ -172,7 +172,7 @@ async function handle(req, res, url, ctx) {
|
|
|
172
172
|
} else rids = rec ? [rec.rid] : id ? [] : liveRecords(ctx, w).filter((r) => r.recipe && r.recipe.connector).map((r) => r.rid);
|
|
173
173
|
if (!rids.length) return send(bad(id ? 404 : 409, id ? 'There is no such goal.' : 'No goal has a way to be read yet.'));
|
|
174
174
|
const r = ctx.metricReadRuns.start({ ws: w.id, rids, why: what === 'test' ? 'test' : 'press' });
|
|
175
|
-
return send(r && r.ok ? { status: 200, body: { ok: true, run: r.run, rids: r.rids } } : bad(409, (r && r.error) || '
|
|
175
|
+
return send(r && r.ok ? { status: 200, body: { ok: true, run: r.run, rids: r.rids } } : bad(409, (r && r.error) || 'PMOS could not start reading.'));
|
|
176
176
|
}
|
|
177
177
|
if (what === 'file-held' || what === 'compare' || what === 'compare-pick') return send(heldOrCompare(ctx, w, what, body, { root, id, rec }));
|
|
178
178
|
// csv: the fallback when no connector reads it
|
|
@@ -53,7 +53,7 @@ async function handle(req, res, url, ctx) {
|
|
|
53
53
|
}
|
|
54
54
|
if (!['verdict', 'verdict-all', 'undo', 'seen', 'looked'].includes(what)) return send(bad(404, 'no such impact route'));
|
|
55
55
|
if (req.method !== 'POST') return send(bad(405, 'POST only'));
|
|
56
|
-
if (req.headers && req.headers['x-pmos-session']) return send(bad(403, 'Only you check your impact, from the page.
|
|
56
|
+
if (req.headers && req.headers['x-pmos-session']) return send(bad(403, 'Only you check your impact, from the page. PMOS\'s run files items with pmos impact.'));
|
|
57
57
|
const rd = await ctx.readJson(req);
|
|
58
58
|
if (!rd.ok) return send(bad(400, 'the body is not JSON'));
|
|
59
59
|
const body = rd.body || {};
|
|
@@ -37,7 +37,7 @@ const movesIn = (m) => { const I = (m && m.insight) || {}; return [I.move].conca
|
|
|
37
37
|
function write(ctx, w, mv, actor) {
|
|
38
38
|
if (mv.kind === 'date') {
|
|
39
39
|
let e;
|
|
40
|
-
try { e = records().edit(recordsDirFor(ctx, w.id), 'kr-metrics', mv.goal, { by: mv.to }, UI(), 'Moved the target date
|
|
40
|
+
try { e = records().edit(recordsDirFor(ctx, w.id), 'kr-metrics', mv.goal, { by: mv.to }, UI(), 'Moved the target date PMOS drafted on Intelligence'); } catch (x) { e = { ok: false, reasons: [String((x && x.message) || x).slice(0, 160)] }; }
|
|
41
41
|
return e.ok ? { undo: { by: mv.from } } : { error: 'The date could not be moved: ' + (e.reasons || []).join('; ') };
|
|
42
42
|
}
|
|
43
43
|
if (mv.kind === 'anchor') {
|