create-pmos 0.817.0 → 0.819.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 +51 -3
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +50 -2
- package/workspace/guide/agent-capabilities.md +2 -1
- package/workspace/guide/cli.md +14 -0
- package/workspace/guide/layout.md +2 -0
- package/workspace/guide/reports.md +8 -0
- package/workspace/lib/driver-run.js +4 -2
- package/workspace/lib/factory-cli.js +25 -1
- package/workspace/lib/factory-floor.js +245 -0
- package/workspace/lib/job-graph.js +1 -0
- package/workspace/lib/pick-cli.js +75 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/report-cli.js +24 -4
- package/workspace/lib/report-translate.js +238 -0
- package/workspace/lib/routes-factory-metrics.js +22 -1
- package/workspace/lib/routes-reports.js +5 -1
- package/workspace/lib/routes-search.js +17 -1
- package/workspace/lib/time-box-pick.js +141 -0
- package/workspace/lib/waiting-on.js +2 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-chat-attach-test.js +19 -1
- package/workspace/public/pm/cozy-search.js +1 -0
- package/workspace/public/pm/premium-report-read.js +9 -5
- package/workspace/server.js +2 -0
- package/workspace/test-lists/factory-floor.json +9 -0
- package/workspace/test-lists/report-translate.json +9 -0
- package/workspace/test-lists/time-box-pick-chat.json +9 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* time-box-pick.js — "I have N minutes": the one thing that fits the time and unblocks the most (initiative time-box-pick-chat, job #1873,
|
|
3
|
+
* idea A293; done test planning/done-tests/time-box-pick-chat.md).
|
|
4
|
+
*
|
|
5
|
+
* minutesOf(text) → the minutes the PM says they have ("I have 30 minutes", "an hour", "2h"), or null PURE
|
|
6
|
+
* candidatesOf({ cards, gaps, nudges }) → [candidate] one per Today card, action with no owner, and drafted nudge PURE
|
|
7
|
+
* pick(cands, minutes) → { pick, line, fits, minutes, shortest } the choice and its one line of why PURE
|
|
8
|
+
* read({ w, stateDir, runtimeDir, sessions, minutes }) → pick() over what PMOS holds now READ-ONLY
|
|
9
|
+
* answerOf(p) → the Ctrl K answer row (lib/search-answer.js shape) | null PURE
|
|
10
|
+
* logUse(runtimeDir, page) → one `timeBoxPick` line in the local use log (the kill line's count)
|
|
11
|
+
*
|
|
12
|
+
* WHERE IT LOOKS. The asks Today ranks (lib/today.js todayFor cards, in Today's order) and Waiting on others (lib/waiting-on.js): an
|
|
13
|
+
* action a meeting agreed that nobody owns, and a nudge PMOS drafted that is not sent yet. Nothing else: no model picks and no new list.
|
|
14
|
+
*
|
|
15
|
+
* HOW LONG. A fixed time per kind, so the PM can check it (MINUTES): a session that asks 5 min, a gate 10, a returned step or work to
|
|
16
|
+
* check 15, a breakdown or a capture 5, a cycle review 30, a repair 20, naming an owner or sending a nudge 2.
|
|
17
|
+
*
|
|
18
|
+
* WHAT IT UNBLOCKS. 1 when a person or a run waits on it (a gate, a session, a returned step, an action with no owner, a nudge), plus
|
|
19
|
+
* the other candidates on the same initiative, which move once this one does. The pick is the candidate that fits and unblocks the most;
|
|
20
|
+
* a tie goes to Today's order, then the shorter. Nothing fits: the shortest is named with its time. Nothing at all: "Nothing needs you".
|
|
21
|
+
*
|
|
22
|
+
* It calls no model, sends nothing and changes no record. The only write is the use log line, through lib/use-log.js. */
|
|
23
|
+
const TAG = '[time-box-pick]';
|
|
24
|
+
|
|
25
|
+
const NUM = { a: 1, an: 1, one: 1, two: 2, three: 3, four: 4, five: 5, ten: 10, fifteen: 15, twenty: 20, thirty: 30, forty: 40, 'forty-five': 45, sixty: 60, ninety: 90 };
|
|
26
|
+
const UNIT = '(minutes?|mins?|m|hours?|hrs?|h)';
|
|
27
|
+
const AMOUNT = '(\\d+(?:[.,]\\d+)?|a|an|one|two|three|four|five|ten|fifteen|twenty|thirty|forty-five|forty|sixty|ninety)';
|
|
28
|
+
const TIME_RE = new RegExp('(?:^|[^a-z0-9])' + AMOUNT + '\\s*' + UNIT + '(?![a-z])', 'i');
|
|
29
|
+
const HALF_RE = /\bhalf an? hour\b/i;
|
|
30
|
+
const QUARTER_RE = /\ba quarter of an hour\b/i;
|
|
31
|
+
// the time must be the PM's own: "I have", "I've got", "got", "free for", "with", or the time alone ("30 min")
|
|
32
|
+
const OWN_RE = /\b(i\s*have|i've|ive|i\s*got|got|have|free|spare|with|only|just|next)\b/i;
|
|
33
|
+
|
|
34
|
+
/** The minutes in "I have 30 minutes" (1 to 480), or null when the text names no time the PM has. Pure. */
|
|
35
|
+
function minutesOf(text) {
|
|
36
|
+
const s = String(text || '').trim();
|
|
37
|
+
if (!s || s.length > 120) return null;
|
|
38
|
+
let m = null;
|
|
39
|
+
if (QUARTER_RE.test(s)) m = 15;
|
|
40
|
+
else if (HALF_RE.test(s)) m = 30;
|
|
41
|
+
else {
|
|
42
|
+
const t = TIME_RE.exec(s);
|
|
43
|
+
if (!t) return null;
|
|
44
|
+
const raw = t[1].toLowerCase(), n = /\d/.test(raw) ? Number(raw.replace(',', '.')) : NUM[raw];
|
|
45
|
+
if (!Number.isFinite(n) || n <= 0) return null;
|
|
46
|
+
m = /^h/i.test(t[2]) ? n * 60 : n;
|
|
47
|
+
// "30 min" alone is the time; a longer sentence must say it is the PM's time
|
|
48
|
+
const alone = s.replace(t[0], ' ').replace(/[\s?.!,]+/g, '') === '';
|
|
49
|
+
if (!alone && !OWN_RE.test(s)) return null;
|
|
50
|
+
}
|
|
51
|
+
m = Math.round(m);
|
|
52
|
+
return m >= 1 && m <= 480 ? m : null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** How long each kind of ask takes, in minutes (Today's kinds 1 to 8, then Waiting on others). */
|
|
56
|
+
const MINUTES = Object.freeze({ 1: 10, 2: 5, 3: 15, 4: 15, 5: 5, 6: 5, 7: 30, 8: 20, owner: 2, nudge: 2 });
|
|
57
|
+
const WAITS = new Set([1, 2, 3, 'owner', 'nudge']);
|
|
58
|
+
const VERB = Object.freeze({ 1: 'a gate you owe', 2: 'a session waits on you', 3: 'a step came back to you', 4: 'work to check', 5: 'a breakdown to keep',
|
|
59
|
+
6: 'a capture to file', 7: 'a cycle review', 8: 'something to repair', owner: 'an action with no owner', nudge: 'a nudge to send' });
|
|
60
|
+
const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).replace(/\s+\S*$/, '') + '…' : t; };
|
|
61
|
+
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
62
|
+
const timeWord = (m) => (m >= 60 && m % 60 === 0 ? plural(m / 60, 'hour', 'hours') : m > 60 ? (m / 60).toFixed(1).replace(/\.0$/, '') + ' hours' : m + ' min');
|
|
63
|
+
|
|
64
|
+
/** One candidate per ask. cards: lib/today.js cards (Today's order); gaps: waiting-on gaps; nudges: outbox entries drafted, not sent. Pure. */
|
|
65
|
+
function candidatesOf({ cards = [], gaps = [], nudges = [] } = {}) {
|
|
66
|
+
const out = [];
|
|
67
|
+
(cards || []).forEach((c, i) => {
|
|
68
|
+
if (!c || !Number.isInteger(c.kind)) return;
|
|
69
|
+
out.push({ key: 'card:' + (c.id || i), kind: c.kind, title: clip(c.cause, 140), minutes: MINUTES[c.kind] || 15, ini: c.initiative_id || '',
|
|
70
|
+
ws: c.ws || '', order: i, base: WAITS.has(c.kind) ? 1 : 0, open: c.act && c.act.cli ? c.act.cli : '' });
|
|
71
|
+
});
|
|
72
|
+
for (const g of gaps || []) {
|
|
73
|
+
if (!g || !g.key) continue;
|
|
74
|
+
out.push({ key: g.key, kind: 'owner', title: clip('Name an owner for: ' + g.title, 140), minutes: MINUTES.owner, ini: g.ini || '', ws: g.ws || '', order: 1000 + out.length, base: 1, open: '' });
|
|
75
|
+
}
|
|
76
|
+
for (const e of nudges || []) {
|
|
77
|
+
if (!e || !e.id || !e.about || e.state !== 'queued') continue;
|
|
78
|
+
out.push({ key: 'nudge:' + e.id, kind: 'nudge', title: clip('Send the nudge to ' + (e.recipient || 'them') + (e.subject ? ': ' + String(e.subject).replace(/^Nudge:\s*/, '') : ''), 140),
|
|
79
|
+
minutes: MINUTES.nudge, ini: '', ws: '', order: 2000 + out.length, base: 1, open: '' });
|
|
80
|
+
}
|
|
81
|
+
const perIni = new Map();
|
|
82
|
+
for (const c of out) if (c.ini) perIni.set(c.ini, (perIni.get(c.ini) || 0) + 1);
|
|
83
|
+
for (const c of out) c.unblocks = c.base + (c.ini ? perIni.get(c.ini) - 1 : 0);
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The pick for a time: { pick, line, fits, minutes, shortest }. pick is null when nothing fits or nothing waits. Pure. */
|
|
88
|
+
function pick(cands, minutes) {
|
|
89
|
+
const all = (cands || []).filter(Boolean);
|
|
90
|
+
const m = Number(minutes);
|
|
91
|
+
if (!all.length) return { pick: null, fits: 0, minutes: m, shortest: null, line: 'Nothing needs you, so the ' + timeWord(m) + ' are yours.' };
|
|
92
|
+
const fit = all.filter((c) => c.minutes <= m).sort((a, b) => b.unblocks - a.unblocks || a.order - b.order || a.minutes - b.minutes);
|
|
93
|
+
if (!fit.length) {
|
|
94
|
+
const s = all.slice().sort((a, b) => a.minutes - b.minutes || a.order - b.order)[0];
|
|
95
|
+
return { pick: null, fits: 0, minutes: m, shortest: s, line: 'Nothing fits in ' + timeWord(m) + '. The shortest is "' + s.title + '", about ' + timeWord(s.minutes) + '.' };
|
|
96
|
+
}
|
|
97
|
+
const p = fit[0];
|
|
98
|
+
const why = p.unblocks ? 'it unblocks ' + plural(p.unblocks, 'other', 'others') : 'nothing else that fits unblocks more';
|
|
99
|
+
return { pick: p, fits: fit.length, minutes: m, shortest: null,
|
|
100
|
+
line: 'In ' + timeWord(m) + ': ' + p.title.replace(/[.…]+$/, '') + ' (about ' + timeWord(p.minutes) + '). ' + VERB[p.kind].replace(/^./, (x) => x.toUpperCase()) + ', and ' + why + '.' };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** What PMOS holds now, picked for the time. READ-ONLY: it never runs Waiting on others' view (that drafts nudges). */
|
|
104
|
+
function read({ w, stateDir, runtimeDir, sessions = [], registered, minutes, cards } = {}) {
|
|
105
|
+
let list = Array.isArray(cards) ? cards : null;
|
|
106
|
+
if (!list) {
|
|
107
|
+
try { const t = require('./today.js').todayFor(w, { stateDir: stateDir || undefined, sessions, registered }); list = t && t.ok ? t.cards : []; } catch { list = []; }
|
|
108
|
+
}
|
|
109
|
+
let gaps = [], nudges = [];
|
|
110
|
+
if (runtimeDir) {
|
|
111
|
+
try {
|
|
112
|
+
const WO = require('./waiting-on.js'), store = require('./outbox-store.js');
|
|
113
|
+
const entries = store.readOutbox(runtimeDir);
|
|
114
|
+
nudges = entries.filter((e) => e && e.about && e.state === 'queued');
|
|
115
|
+
gaps = WO.derive({ notes: WO.notesOf(runtimeDir, Date.now()), jira: [], sent: entries, mentions: [] }, {}).gaps || [];
|
|
116
|
+
} catch { gaps = []; }
|
|
117
|
+
}
|
|
118
|
+
const p = pick(candidatesOf({ cards: list, gaps, nudges }), minutes);
|
|
119
|
+
console.info(TAG + ' minutes=' + minutes + ' candidates=' + (list.length + gaps.length + nudges.length) + ' fits=' + p.fits + ' pick=' + (p.pick ? p.pick.kind : 'none'));
|
|
120
|
+
return p;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** The Ctrl K answer row: the line, opening the item's initiative, else Today. Pure. */
|
|
124
|
+
function answerOf(p) {
|
|
125
|
+
if (!p || !p.line) return null;
|
|
126
|
+
const c = p.pick || p.shortest;
|
|
127
|
+
const source = c && c.ini ? { kind: 'initiative', id: c.ini, title: c.ini, path: '', main: true, ...(c.ws ? { ws: c.ws } : {}) } : { kind: 'today', title: 'Today', path: '', main: true };
|
|
128
|
+
return { text: p.line, facts: [], made: true, source, sources: [{ title: 'Your move and Waiting on others', path: '' }], pick: c ? { key: c.key, kind: c.kind, minutes: c.minutes, unblocks: c.unblocks, ini: c.ini || null } : null };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** One `timeBoxPick` line in the local use log, so the kill line can count picks. Ctrl K asks again as the PM types ("30 m", "30 min",
|
|
132
|
+
* "30 minutes"), so a second pick within a minute is the same pick and is not counted. Never throws. */
|
|
133
|
+
const lastLog = new Map();
|
|
134
|
+
function logUse(runtimeDir, page = 'search', now = Date.now()) {
|
|
135
|
+
if (!runtimeDir) return;
|
|
136
|
+
if (now - (lastLog.get(runtimeDir) || 0) < 60e3) return;
|
|
137
|
+
lastLog.set(runtimeDir, now);
|
|
138
|
+
try { require('./use-log.js').record(runtimeDir, [{ kind: 'use', page, control: 'timeBoxPick', device: 'desk' }]); } catch { /* the count misses one */ }
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
module.exports = { TAG, MINUTES, minutesOf, candidatesOf, pick, read, answerOf, logUse };
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* nudgesToDraft(rows, lines, now) → [entry] pure. The nudges to put in the outbox (drafted, never sent)
|
|
9
9
|
* view(rt, o) → { ok, rows, gaps, closed } the files: reads the records, writes <rt>/waiting/state.json and the drafts
|
|
10
10
|
* channelWord(channel) → 'Jira comment' · 'team note' · …
|
|
11
|
+
* notesOf(rt, now) → the notes derive reads (read-only; lib/time-box-pick.js reads the gaps with it)
|
|
11
12
|
*
|
|
12
13
|
* THE SOURCES (the brief, item 2). A row exists only with a real who: a name or a Jira assignee.
|
|
13
14
|
* note a meeting note's action item whose owner is not the PM (the final notes' actions when they exist, else the local summary's).
|
|
@@ -249,4 +250,4 @@ function view(rt, o = {}) {
|
|
|
249
250
|
return { ok: true, rows, gaps: d.gaps, closed: t.closed, as_of: new Date(now).toISOString() };
|
|
250
251
|
}
|
|
251
252
|
|
|
252
|
-
module.exports = { WINDOW_DAYS, STALE_DAYS, NUDGE_DAYS, CLOSED_DAYS, realWho, isMe, derive, track, nudgeOf, nudgesToDraft, nudgeBody, channelWord, view, stateFile };
|
|
253
|
+
module.exports = { WINDOW_DAYS, STALE_DAYS, NUDGE_DAYS, CLOSED_DAYS, realWho, isMe, derive, track, nudgeOf, nudgesToDraft, nudgeBody, channelWord, view, stateFile, notesOf };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.819.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.819.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -41,6 +41,13 @@ const filesIn = () => { const d = path.join(T.STATE_DIR, 'chat-files'); const ou
|
|
|
41
41
|
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
42
42
|
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
43
43
|
await T.waitForServer(BASE);
|
|
44
|
+
// Home stays on "Reading your day." until the board's first read lands, and that read scans the real checkout: ~9 s here, more than the
|
|
45
|
+
// 15 s the box gets on a loaded CI runner (ci-dynamic-shards: the pending reads showed only the live stream). Wait for it once, here.
|
|
46
|
+
for (const t0 = Date.now(); Date.now() - t0 < 90000;) {
|
|
47
|
+
const r = await fetch(BASE + '/api/board-premium').then((x) => x.json()).catch(() => null);
|
|
48
|
+
if (r && !(r.state === 'reading' || (r.pending && !r.model))) break;
|
|
49
|
+
await sleep(500);
|
|
50
|
+
}
|
|
44
51
|
browser = await chromium.launch({ executablePath: exe });
|
|
45
52
|
|
|
46
53
|
const open = async ({ w = 1280, h = 900, scheme = 'light', url = '/premium-chat.html?about=' + encodeURIComponent(KEY) } = {}) => {
|
|
@@ -48,13 +55,24 @@ const filesIn = () => { const d = path.join(T.STATE_DIR, 'chat-files'); const ou
|
|
|
48
55
|
const page = await ctx.newPage();
|
|
49
56
|
const errors = [], asks = [], st = { session: null, messages: [] };
|
|
50
57
|
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
58
|
+
const failed = []; page.on('response', (r) => { if (r.status() >= 400) failed.push(`${r.status()} ${new URL(r.url()).pathname}`); });
|
|
59
|
+
// the reads still open when the box never shows: names the slow route rather than only the timeout
|
|
60
|
+
const pending = new Map(); page.on('request', (rq) => pending.set(rq, Date.now()));
|
|
61
|
+
const done = (rq) => pending.delete(rq); page.on('requestfinished', done); page.on('requestfailed', done);
|
|
51
62
|
if (process.env.ATT_DEBUG) page.on('request', (rq) => { if (/chat-file/.test(rq.url())) console.log('REQ', rq.method(), rq.url()); });
|
|
52
63
|
await page.route('**/api/briefing-premium/**', (r) => { const rq = r.request(); if (rq.method() !== 'GET') asks.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}') }); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, turns: [], working: false, ...(st.session ? { session: st.session } : {}) }) }); });
|
|
53
64
|
await page.route('**/api/sessions/conversation**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'user', messages: st.messages } }));
|
|
54
65
|
await page.route('**/api/sessions', (r) => r.fulfill({ json: { ok: true, sessions: [{ id: 's-term', name: 'A terminal session', origin: '', shown: 'quiet' }] } }));
|
|
55
66
|
await page.goto(BASE + url, { waitUntil: 'domcontentloaded' });
|
|
56
67
|
// on a desktop the chat the address names opens in the popup (home-page-retire): wait until the box shows, not only exists
|
|
57
|
-
|
|
68
|
+
try {
|
|
69
|
+
await page.waitForFunction(() => { const i = document.querySelector('#hmIn'); return !!i && i.getClientRects().length > 0; }, null, { timeout: 15000 });
|
|
70
|
+
} catch (e) {
|
|
71
|
+
// say why the box never showed, so a red run names its cause (ci-dynamic-shards: it timed out on CI only, with nothing logged)
|
|
72
|
+
const seen = await page.evaluate(() => ({ url: location.href, hmIn: !!document.querySelector('#hmIn'), body: (document.body && document.body.innerText || '').slice(0, 400) })).catch((x) => String(x));
|
|
73
|
+
console.log('open: #hmIn never showed —', JSON.stringify({ seen, errors, failed, pending: [...pending].map(([rq, t]) => `${new URL(rq.url()).pathname}${new URL(rq.url()).search} ${Math.round((Date.now() - t) / 1000)}s`) }));
|
|
74
|
+
throw e;
|
|
75
|
+
}
|
|
58
76
|
return { page, ctx, errors, asks, st };
|
|
59
77
|
};
|
|
60
78
|
const chips = (page) => page.$$eval('#hmFiles .hm-att', (xs) => xs.map((x) => ({ name: x.querySelector('b').textContent, meta: (x.querySelector('em') || {}).textContent || '' })));
|
|
@@ -215,6 +215,7 @@ function go(r) {
|
|
|
215
215
|
closeSearch();
|
|
216
216
|
if (r.kind === 'ask') { askClaude(r.title); return; }
|
|
217
217
|
if (r.kind === 'answer') { const src = r.answer.source; go({ ...src, kind: src.kind || 'document', title: src.title || src.path }); return; }
|
|
218
|
+
if (r.kind === 'today') { location.assign(homeUrl({})); return; } // "I have 30 minutes" with no initiative: the ask is on Today (time-box-pick-chat)
|
|
218
219
|
if (r.kind === 'scoped') { if (typeof r.open === 'function') r.open(); return; }
|
|
219
220
|
if (r.kind === 'initiative') { if (S.go) { S.go({ ini: r.id }); return; } location.assign(homeUrl(r.board ? { ini: r.id, board: r.board } : { ini: r.id })); return; }
|
|
220
221
|
if (r.kind === 'session') { if (S.go) { S.go({ ses: r.id }); return; } location.assign(homeUrl({ session: r.id })); return; }
|
|
@@ -292,18 +292,20 @@ function cycPop() {
|
|
|
292
292
|
/**
|
|
293
293
|
* What ⋯ holds (canvas note xvMore; OvReport): only what the card does not already show. The bar has the read-as switch, Edit, Present,
|
|
294
294
|
* Share and Download; the folds have the cycles and the Brief; the summary has the one primary. So ⋯ holds Schedule, Start the next cycle
|
|
295
|
-
* (an issued cycle) and, red and last, Discard this draft or Archive this cycle. Each item is { r, label, note, danger } or { sep }; r is the
|
|
295
|
+
* (an issued cycle), Also in <language> (a translated copy on disk) and, red and last, Discard this draft or Archive this cycle. Each item is { r, label, note, danger } or { sep }; r is the
|
|
296
296
|
* press, the same one the panel's own buttons send.
|
|
297
297
|
*/
|
|
298
298
|
export function moreItems(o) {
|
|
299
299
|
if (o.edit || o.archived) return [];
|
|
300
300
|
const L = [], sched = o.schedule && o.schedule !== 'Not scheduled' ? o.schedule.replace(/\s\d{2}:\d{2}$/, '') : '';
|
|
301
301
|
L.push({ r: 'sched', label: 'Schedule', note: sched });
|
|
302
|
+
// a translated copy beside the draft (lib/report-translate.js): one item per language, the reader under it
|
|
303
|
+
for (const a of o.also || []) if (a && a.path && a.language) L.push({ r: 'also|' + a.path, label: 'Also in ' + a.language, note: a.reader ? 'for ' + a.reader : '' });
|
|
302
304
|
if (o.issued) L.push({ r: 'nextcyc', label: 'Start the next cycle' });
|
|
303
305
|
L.push({ sep: true }, o.issued ? { r: 'archive', label: 'Archive this cycle', danger: true } : { r: 'discard', label: 'Discard this draft', danger: true });
|
|
304
306
|
return L;
|
|
305
307
|
}
|
|
306
|
-
const menuOf = () => moreItems({ edit: R.edit, issued: R.issued, archived: R.archived, schedule: R.setup === undefined ? '' : schedLabel(R.setup) });
|
|
308
|
+
const menuOf = () => moreItems({ edit: R.edit, issued: R.issued, archived: R.archived, schedule: R.setup === undefined ? '' : schedLabel(R.setup), also: R.also });
|
|
307
309
|
/** Shell A's ⋯ (open({ more })) reads the list when it opens, so the list is refilled in place as the cycle changes: one array per report. */
|
|
308
310
|
function syncMore() {
|
|
309
311
|
if (!R) return;
|
|
@@ -711,6 +713,7 @@ export function fit(root) { root.querySelectorAll('.vz-fr').forEach((c) => { if
|
|
|
711
713
|
/* ── the presses ── */
|
|
712
714
|
const say = (text, tone) => { R.msg = { text, tone }; draw(); const me = R, m = R.msg; if (tone !== 'bad') setTimeout(() => { if (R === me && R.msg === m) { R.msg = null; draw(); } }, 9000); };
|
|
713
715
|
async function act([k, v], t) {
|
|
716
|
+
if (k === 'also') { const a = (R.also || []).find((x) => x.path === v); return openReport({ path: v, state: 'draft' }, { ws: R.ws, name: R.name + (a ? ' · ' + a.language : ''), cycles: [] }); }
|
|
714
717
|
if (k === 'rv-do' || k === 'rv-no' || k === 'rv-all') return rvAct(k, v);
|
|
715
718
|
if (k === 'ord') return ordAct(v, t.dataset.r.split('|').slice(2).join('|'));
|
|
716
719
|
if (k === 'pop') { R.pop = v || null; return draw(); }
|
|
@@ -1118,10 +1121,11 @@ export async function openReport(row, hand = {}) {
|
|
|
1118
1121
|
vOpen(head());
|
|
1119
1122
|
try { R.text = await textOf('/api/doc?' + q({ ws: R.ws, path: row.path })); R.W = wordsOf(R.text, R.name); if (!hand.name && R.W.title) R.name = R.W.title; } catch (x) { R.err = String((x && x.message) || x); R.W = { title: R.name, sections: [] }; }
|
|
1120
1123
|
if (R !== me) return me;
|
|
1121
|
-
if (
|
|
1122
|
-
const d = await Promise.resolve(pmGet('/api/report/draft?' + q({ cadence: c.cadence, slot: c.slot }))).catch(() => null);
|
|
1124
|
+
if (c.cadence && c.slot) { // the report route names the workspace when the page was opened without one, and the translated copies (Also in …)
|
|
1125
|
+
const d = await Promise.resolve(pmGet('/api/report/draft?' + q({ ...(R.ws ? { ws: R.ws } : {}), cadence: c.cadence, slot: c.slot }))).catch(() => null);
|
|
1123
1126
|
if (R !== me) return me;
|
|
1124
|
-
if (d && d.ws) R.ws = d.ws;
|
|
1127
|
+
if (!R.ws && d && d.ws) R.ws = d.ws;
|
|
1128
|
+
R.also = d && Array.isArray(d.also) ? d.also : [];
|
|
1125
1129
|
}
|
|
1126
1130
|
await Promise.all([readCycle(), readSetup(), readShares()]);
|
|
1127
1131
|
if (R !== me) return me;
|
package/workspace/server.js
CHANGED
|
@@ -2943,6 +2943,8 @@ try { require('./lib/routes-report-design.js').attach(reportDesignCtx); } catch
|
|
|
2943
2943
|
// report-reader-review: every report draft this process writes is read once as the CFO, the engineer and the sceptic; their questions go under the
|
|
2944
2944
|
// ✦ of the initiatives the report covers (lib/report-readers.js, through lib/ai-guard.js). The read runs through spawnScheduled (the capacity governor).
|
|
2945
2945
|
try { require('./lib/report-readers.js').attach(() => ({ ...reportDesignCtx(), stateDirFor })); } catch { /* a checkout without the module still starts */ }
|
|
2946
|
+
// Each draft in each reader's language: a translated copy beside it when its definition names a `languages:` line (lib/report-translate.js).
|
|
2947
|
+
try { require('./lib/report-translate.js').attach(() => reportDesignCtx()); } catch { /* a checkout without the module still starts */ }
|
|
2946
2948
|
// report-structure: the structure jobs, the source checks (interactive sessions started like Work's approved steps, STEP_FLAGS) and the draft gate.
|
|
2947
2949
|
// The tick collects check answers and starts the drafts that waited for a failing source (4 hours, then without it).
|
|
2948
2950
|
// agent-orchestrator: the checks of a draft the schedule tick fired, and the tick's retries of them, use spawnScheduled (the capacity governor). A press uses spawnSession.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Factory page slice B (factory-floor-snapshot): the factory's numbers per product and station, saved after each Driver run (lib/factory-floor.js, GET /api/factory in lib/routes-factory-metrics.js, pmos factory). Temporary state folders; no git, no server, no browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"factory-floor.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"factory-floor.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Reports in each reader's language (report-reader-language, idea A111, done test planning/done-tests/report-reader-language.md L1-L4, N1-N3): the definition's languages line, the translated copy with numbers and names checked, the ⋯ Also in item and pmos report language. The model's answer is recorded. No server, network, model or browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"report-translate.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"report-translate.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "I have N minutes (initiative time-box-pick-chat, done test P1-P6, N1-N3): the pure pick, the Ctrl K route in process on a scratch runtime folder, and pmos pick. No server, browser, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"time-box-pick.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"time-box-pick.test.js": 3
|
|
8
|
+
}
|
|
9
|
+
}
|