create-pmos 0.556.0 → 0.558.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 -81
- 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/home.md +7 -2
- package/workspace/guide/initiatives-and-next-steps.md +18 -2
- package/workspace/lib/board-premium.js +2 -1
- package/workspace/lib/coming-up.js +51 -0
- package/workspace/lib/initiative-cli.js +4 -4
- package/workspace/lib/initiative-premium.js +1 -1
- package/workspace/lib/initiative-writer.js +28 -4
- package/workspace/lib/routes-autonomy.js +12 -0
- package/workspace/lib/routes-boards.js +5 -4
- package/workspace/lib/routes-initiatives.js +12 -0
- package/workspace/lib/routes-intake.js +6 -2
- package/workspace/lib/work-kind.js +48 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-asks.js +16 -10
- package/workspace/public/pm/bd-ini-panel.js +11 -1
- package/workspace/public/pm/bd-next.js +14 -4
- package/workspace/public/pm/bd-views.js +3 -2
- package/workspace/public/pm/cozy-board.css +10 -0
- package/workspace/public/pm/cozy-viewer.js +11 -5
- package/workspace/public/pm/home-ini.js +10 -1
- package/workspace/public/pm/ini-agent.js +122 -30
- package/workspace/public/pm/ini-view-model.js +3 -2
- package/workspace/public/pm/ini-view.css +5 -2
- package/workspace/public/pm/ini-view.js +4 -3
- package/workspace/public/pm/premium-board.js +3 -2
- package/workspace/public/pm/work-kind.js +82 -0
- package/workspace/test-files.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.558.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.558.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* the kind PMOS suggests, its anchor, the initiative it is close to and an earlier rejection. Accept to Triage
|
|
4
4
|
* POST /api/boards/asks/accept (Undo archives what it made); Add to <initiative> and Decline POST /api/boards/asks/decline
|
|
5
5
|
* with the reason. An ask the record gives two products for sits under "Not sure which product".
|
|
6
|
-
* New initiative (BdNew) the side panel: name, why, material (links and files),
|
|
7
|
-
*
|
|
6
|
+
* New initiative (BdNew) the side panel: name, why, material (links and files), the kind of work (batch 29 item 11: Product, Full SDLC or
|
|
7
|
+
* Project; PMOS pre-picks it from the name until the PM taps one), no lane field (PMOS leans on the intake draft), what it
|
|
8
|
+
* counts toward, the product. A name close to an earlier rejection or to an open initiative
|
|
8
9
|
* says so. Create: POST /api/boards/asks/add then /asks/accept (it starts in the first stage), then POST /api/board-grill/start
|
|
9
10
|
* and POST /api/proposals/look (Claude looks for it elsewhere; batch 12 item 4)
|
|
10
11
|
* and /file for the material.
|
|
@@ -15,7 +16,8 @@ import { pmPost } from './http.js';
|
|
|
15
16
|
import { $, $$, esc } from './premium-shell.js';
|
|
16
17
|
import * as Pop from './bd-pop.js';
|
|
17
18
|
import { avatar } from './bd-views.js';
|
|
18
|
-
import { adler } from './cozy-adler.js';
|
|
19
|
+
import { adler } from './cozy-adler.js';
|
|
20
|
+
import * as WK from './work-kind.js'; // the kind of work on New initiative (batch 29 item 11) // Adler heads the New asks (batch 17 item 4-A, canvas AdM2 New asks)
|
|
19
21
|
|
|
20
22
|
let A = null; // the page: { M(), load(), say(msg, undo?), panel(html, from, cls), close(), rowOf(key), openIni(r), openDoc(path), anchors(ws, board), programs(), reloadPrograms() }
|
|
21
23
|
export function init(api) { A = api; }
|
|
@@ -122,10 +124,8 @@ function materialChips() {
|
|
|
122
124
|
return N.links.map((k, i) => `<span class="bd-chip sm">${SV(I.link)}${esc(k.label)}<button type="button" class="bd-x0" data-rmlink="${i}" aria-label="Remove ${esc(k.label)}">${SV(I.x)}</button></span>`).join('')
|
|
123
125
|
+ N.files.map((f, i) => `<span class="bd-chip sm">${SV(I.file)}${esc(f.name)}<button type="button" class="bd-x0" data-rmfile="${i}" aria-label="Remove ${esc(f.name)}">${SV(I.x)}</button></span>`).join('');
|
|
124
126
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return `<b>Workflow · PMOS works it out</b><span>No need to choose now. It starts in ${esc(firstStage())}, and PMOS names the workflow (Product feature, or one you made) once the BRD makes it clear. It tells you why, and you can change it.</span><span class="bd-amut">Now: Product feature, until the BRD says otherwise</span>`;
|
|
128
|
-
}
|
|
127
|
+
/** Kind of work (batch 29 item 11, KdA/KdAP): the pill switch with its caption, and the ✦ line while the pick is PMOS's from the name. */
|
|
128
|
+
const kindBox = () => WK.segHtml(N.kind, N.kindBy === 'pmos');
|
|
129
129
|
function hintsHtml() {
|
|
130
130
|
const p = N.prior && N.prior[0] && !N.ack ? `<div class="bd-warn"><b>Close to something you declined</b><span>“${esc(N.prior[0].title)}” was set aside in ${esc(N.prior[0].file)}.</span><div class="bd-arow"><button type="button" class="bd-btn sm" data-newact="seewhy">See why</button><button type="button" class="bd-btn sm ghost" data-newact="ack">It is different</button></div></div>` : '';
|
|
131
131
|
const c = N.close ? `<div class="bd-need">${SV(I.info)}<span>Also close to <button type="button" class="bd-dlink" data-newact="close">${esc(N.close.title)}</button> in ${esc(N.close.stage || 'its stage')}. Add to it instead?</span></div>` : '';
|
|
@@ -160,14 +160,16 @@ async function fillAnchors(ws, board, want) {
|
|
|
160
160
|
document.addEventListener('change', (e) => { if (N && e.target.matches('form[data-form="new2"] select[name="product"]')) { const B = boardOfForm(e.target.form); if (B) fillAnchors(B.ws, B.board, ''); } });
|
|
161
161
|
export async function openNew(from, ask) {
|
|
162
162
|
const d = ask ? ask.draft || {} : {};
|
|
163
|
-
|
|
163
|
+
// kind: the one picked; kindBy: 'pmos' while PMOS's pre-pick from the name stands, 'you' once the PM taps one (then it never changes)
|
|
164
|
+
const dk = d.kind && WK.KINDS.includes(d.kind) && d.kind_cue ? d.kind : null;
|
|
165
|
+
N = { ask: ask || null, links: [], files: [], lean: d.lane || null, prior: ask ? ask.prior || [] : [], ack: false, close: null, kind: dk || 'product', kindBy: dk ? 'pmos' : null };
|
|
164
166
|
const body = `<form class="bd-form bd-new" data-form="new2"${ask ? ` data-ask="${esc(ask.id)}"` : ''} novalidate>`
|
|
165
167
|
+ (ask ? `<p class="bd-quote">“${esc(ask.line)}”</p>` : '')
|
|
166
168
|
+ `<label class="bd-field">Name<input class="bd-inp" name="title" maxlength="120" value="${esc(d.title || '')}" placeholder="For example: Partner SSO audit trail" autocomplete="off"></label>`
|
|
167
169
|
+ `<label class="bd-field">Why<textarea class="bd-inp ta" name="why" rows="3" maxlength="400" placeholder="Who asks for it, and what it changes for them">${esc(ask ? ask.line : '')}</textarea></label>`
|
|
168
170
|
+ `<div class="bd-field"><span class="bd-flbl">Material · links or files</span><div class="bd-drop" id="nwDrop"><span class="bd-mchips" id="nwMat"></span><span class="bd-sp"></span><button type="button" class="bd-ib sm" data-newact="link" aria-label="Paste a link" title="Paste a link">${SV(I.link)}</button><button type="button" class="bd-ib sm" data-newact="file" aria-label="Upload a file" title="Upload a file">${SV(I.up)}</button><input type="file" id="nwFile" multiple hidden></div>`
|
|
169
171
|
+ `<div class="bd-linkin" id="nwLink" hidden><input class="bd-inp sm" name="link" maxlength="600" placeholder="https://" aria-label="A link"><button type="button" class="bd-btn sm" data-newact="addlink">Add</button></div><p class="bd-amut">Drop files here. PMOS reads them before it asks you anything.</p></div>`
|
|
170
|
-
+ `<div class="bd-
|
|
172
|
+
+ `<div class="bd-field" id="nwKind">${kindBox()}</div>`
|
|
171
173
|
+ `<label class="bd-field">Counts toward<span id="anW"><select class="bd-inp" name="anchor" disabled><option>Reading the goals</option></select></span><span class="bd-amut">A goal, or a health budget for upkeep work.</span></label>`
|
|
172
174
|
+ productField(ask)
|
|
173
175
|
+ `<div id="nwHints">${hintsHtml()}</div><p class="bd-amsg" id="formM" role="status"></p>`
|
|
@@ -188,6 +190,8 @@ function lean(text) {
|
|
|
188
190
|
const r = text.trim().length > 3 ? await pmPost('/api/intake/draft', { line: text.trim() }).catch(() => null) : null;
|
|
189
191
|
if (!N) return;
|
|
190
192
|
if (r && r.ok && r.draft) { N.lean = r.draft.lane || N.lean; if (!N.ask) N.prior = r.draft.prior_rejections || []; }
|
|
193
|
+
// PMOS's pre-pick follows the name until the PM taps a kind; a name that tells nothing goes back to Product with no ✦ line
|
|
194
|
+
if (N.kindBy !== 'you') { const cue = r && r.ok && r.draft && r.draft.kind_cue && WK.KINDS.includes(r.draft.kind); N.kind = cue ? r.draft.kind : 'product'; N.kindBy = cue ? 'pmos' : null; }
|
|
191
195
|
const k = $('#nwKind'), h = $('#nwHints'); if (k) k.innerHTML = kindBox(); if (h) h.innerHTML = hintsHtml();
|
|
192
196
|
}, 350);
|
|
193
197
|
}
|
|
@@ -202,6 +206,8 @@ document.addEventListener('click', (e) => {
|
|
|
202
206
|
if (!N) return;
|
|
203
207
|
const rl = e.target.closest('[data-rmlink]'); if (rl) { N.links.splice(+rl.dataset.rmlink, 1); drawMat(); return; }
|
|
204
208
|
const rf = e.target.closest('[data-rmfile]'); if (rf) { N.files.splice(+rf.dataset.rmfile, 1); drawMat(); return; }
|
|
209
|
+
const kb = e.target.closest('#nwKind [data-kind]');
|
|
210
|
+
if (kb) { N.kind = kb.dataset.kind; N.kindBy = 'you'; const k0 = $('#nwKind'); if (k0) { k0.innerHTML = kindBox(); const f = k0.querySelector(`[data-kind="${N.kind}"]`); if (f) f.focus(); } return; }
|
|
205
211
|
const b = e.target.closest('[data-newact]'); if (!b) return;
|
|
206
212
|
const k = b.dataset.newact;
|
|
207
213
|
if (k === 'file') $('#nwFile').click();
|
|
@@ -229,7 +235,7 @@ document.addEventListener('submit', async (e) => {
|
|
|
229
235
|
go.disabled = true; m.textContent = '';
|
|
230
236
|
let ask = askId;
|
|
231
237
|
if (!ask) { const r0 = await post('/api/boards/asks/add', { ws: B.ws, board: B.board, line: title, source: 'New initiative, typed by you' }).catch(() => null); if (!r0 || r0.ok !== true) { go.disabled = false; m.textContent = errOf(r0); return; } ask = r0.ask && r0.ask.id; }
|
|
232
|
-
const res = await post('/api/boards/asks/accept', { ws: B.ws, board: B.board, ask, title, lane: N.lean || 'feature', anchor, ...(why ? { intent: why } : {}) }).catch(() => null);
|
|
238
|
+
const res = await post('/api/boards/asks/accept', { ws: B.ws, board: B.board, ask, title, lane: N.lean || 'feature', anchor, kind: WK.kindOf(N.kind), ...(why ? { intent: why } : {}) }).catch(() => null);
|
|
233
239
|
if (!res || res.ok !== true) { go.disabled = false; m.textContent = errOf(res); return; }
|
|
234
240
|
const id = res.initiative && res.initiative.id, stage = res.stage || firstStage(B);
|
|
235
241
|
if (id) {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* The rest sits on the thing it changes: the stage chip's picker moves the stage with the row menu's own presses (moreAct(r, k, btn), bd-acts.js);
|
|
23
23
|
* Change workflow, Won't do and Archive are Home's (ini-wf.js). Discuss in chat takes the question to Home. */
|
|
24
24
|
import * as TL from './ini-tail.js'; // the parts under Linked, Home's page draws them too (UI grill U1): drafted tickets, the PRD drift, Your impact
|
|
25
|
+
import * as WK from './work-kind.js'; // the kind of work in the header (batch 29 item 11, KdV1-3)
|
|
25
26
|
import * as VW from './cozy-viewer.js';
|
|
26
27
|
import * as SV from './small-vw.js'; // the one stakeholder form, Home's too (batch 18 item 2-C)
|
|
27
28
|
import { esc } from './premium-shell.js';
|
|
@@ -260,7 +261,16 @@ export function openIni(r, from, o = {}) {
|
|
|
260
261
|
// the same tile as Home's initiative page; no "Open in full": the header's expand already opens it wide (batch 14 item 5)
|
|
261
262
|
VW.open({ kind: 'Initiative', title: r.title, icon: 'goal', wrap: true, id: vidOf(r),
|
|
262
263
|
discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: () => iniMore(O.rowOf(r.key) || r), rename: O.rename ? O.rename(r) : null,
|
|
263
|
-
|
|
264
|
+
// the kind of work (batch 29 item 11, KdV1-3): its glyph stands before Discuss; a tap opens the three kinds. A published copy
|
|
265
|
+
// (pm/readonly.js) cannot change it, so it has no press: the Board's icon still names the kind
|
|
266
|
+
presses: (window.PMOS_READONLY ? [] : [WK.pressOf(r.kind)]).concat(dashFor(r) ? dashFor(r).presses() : []), onPress: (a, b) => {
|
|
267
|
+
const x = O.rowOf(r.key) || r, h = dashFor(x);
|
|
268
|
+
if (a === 'dash' && h) h.toggle();
|
|
269
|
+
else if (a === 'kind' && x.id) WK.pick(b, x.kind, (to) => WK.change({ pmPost, ws: where(x).ws, id: x.id, from: x.kind, to, toast: (t, u) => O.toast(t, u),
|
|
270
|
+
// the row shows the new kind at once (its icon, the Next words, the Experiment); the Board's read catches up in the background
|
|
271
|
+
apply: (k) => { const y = O.rowOf(r.key) || x; y.kind = k; VW.setPresses(vidOf(y), [WK.pressOf(k)].concat(dashFor(y) ? dashFor(y).presses() : [])); if (O.redraw) O.redraw(); refresh(true); },
|
|
272
|
+
reload: async () => { if (O.reload) await O.reload(); } }));
|
|
273
|
+
},
|
|
264
274
|
render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null }; O.onShow(x.key, from); body.innerHTML = iniBody(x); wire(body, x.key); { const h = dashFor(x); if (h) h.wire(body); } if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
|
|
265
275
|
onClose: () => { if (cur && cur.key === r.key && !cur.tk) { cur = null; O.onHide(); } } });
|
|
266
276
|
}
|
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
* machinery, not the PM's. Ticket and task counts stay: they are the team's work, read from Jira and the tasks.
|
|
7
7
|
*
|
|
8
8
|
* nextOf(r, ctx) → { who: claude | you | team, words, when, count, tone, title, act } | null PURE. ctx: { self (a PMOS-self board) }
|
|
9
|
+
* r.kind (batch 29 item 11) words PMOS's own steps: Product as below, Project as dates and chasing, Full SDLC's Build as its pull request
|
|
9
10
|
* nextHtml(r, o) → the cell's markup. o: { self, icon (false on the phone), due (false in the List: Finish says the date) }
|
|
10
11
|
*
|
|
11
12
|
* The icon action stays only where PMOS does the step from the page (move the stage, add a stage task, link the epic, read Jira): a button with
|
|
12
13
|
* data-nx (move | add | epic | jira) and data-nxrow (the row key); the page runs it. Nothing is invented: a step with no record behind it draws
|
|
13
14
|
* nothing (zero is silence). */
|
|
14
|
-
|
|
15
|
+
// its own esc (not premium-shell's): this file stays pure, so Node imports it (kind-of-work.test.js)
|
|
16
|
+
const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
15
17
|
import { sectionOf } from './ini-view-model.js';
|
|
16
18
|
|
|
17
19
|
const PF = 'product-feature';
|
|
@@ -24,6 +26,12 @@ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct
|
|
|
24
26
|
const dm = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
|
|
25
27
|
// what Claude does with the parts of a step: the documents became the seven artefacts (D107); Claude writes them by itself
|
|
26
28
|
const CLAUDE = { triage: 'PMOS writes the experiment', discover: 'PMOS writes the experiment', plan: 'PMOS writes the done test', prioritize: 'PMOS ranks it against its goal' };
|
|
29
|
+
// the kind of work (batch 29 item 11, KdBd): Product reads as above; Project's steps are dates and chasing; Full SDLC's Build is PMOS's pull request
|
|
30
|
+
const KIND_WORDS = {
|
|
31
|
+
project: { triage: 'PMOS writes the plan and its dates', discover: 'PMOS writes the plan and its dates', plan: 'PMOS sets the dates with the team', build: 'PMOS chases the team for the first update', monitor: 'PMOS writes the status line' },
|
|
32
|
+
sdlc: { build: 'PMOS builds the first pull request' },
|
|
33
|
+
};
|
|
34
|
+
const kindWords = (r, key) => { const w = KIND_WORDS[r && r.kind]; return (w && w[key]) || null; };
|
|
27
35
|
const ANCHOR = 'PMOS anchors it to a goal';
|
|
28
36
|
const OPEN_TK = ['In review', 'In progress', 'To do'];
|
|
29
37
|
const CLOSED = new Set(['Done', "Won't do", 'Archived']);
|
|
@@ -74,16 +82,18 @@ export function nextOf(r, ctx = {}) {
|
|
|
74
82
|
return moveLine(r, ctx, count);
|
|
75
83
|
}
|
|
76
84
|
const epic = (it.links && it.links.epic) || (r.epics || [])[0] || null;
|
|
85
|
+
// Full SDLC builds with PMOS's own pull requests (no Jira epic needed); Project chases the team until there are tickets
|
|
86
|
+
if (key === 'build' && !epic && kindWords(r, 'build')) return claude(kindWords(r, 'build'));
|
|
77
87
|
return epic ? claude('PMOS reads Jira', { act: { kind: 'jira', label: 'Read Jira again for ' + epic } }) : claude('PMOS finds the Jira epic', { act: { kind: 'epic', label: 'Link the Jira epic' } });
|
|
78
88
|
}
|
|
79
89
|
const past = r.end && /^\d{4}-\d{2}-\d{2}/.test(r.end) && String(r.end).slice(0, 10) < new Date().toISOString().slice(0, 10);
|
|
80
90
|
const due = (key === 'monitor' || key === 'evaluate') && r.end ? (past ? 'was due ' : 'due ') + dm(r.end) : '';
|
|
81
|
-
if (key === 'monitor') return claude('PMOS reads the outcome', { when: due });
|
|
91
|
+
if (key === 'monitor') return claude(kindWords(r, 'monitor') || 'PMOS reads the outcome', { when: due });
|
|
82
92
|
// the parts of the step: the trail's (the documents' headings, the tickets drafted), else what the model counts (Prioritize's anchor and rank)
|
|
83
93
|
let parts = Array.isArray(it.parts) && it.parts.length ? it.parts : null;
|
|
84
94
|
if (!parts && (key === 'plan' || key === 'prioritize')) parts = (t.segs || []).filter((s) => s.st === 'done' || s.st === 'to do').map((s) => ({ name: key === 'prioritize' && /^kr/i.test(s.name) ? 'KR or health budget' : s.name.toLowerCase(), done: s.st === 'done' }));
|
|
85
95
|
if (key === 'evaluate' && (!parts || !parts.length || parts.some((p) => !p.done && isVerdict(p)) || parts.every((p) => p.done))) return yours('did it work?', { when: due });
|
|
86
|
-
if (!parts || !parts.length) return CLAUDE[key] ? claude(CLAUDE[key]) : null;
|
|
96
|
+
if (!parts || !parts.length) return kindWords(r, key) ? claude(kindWords(r, key)) : CLAUDE[key] ? claude(CLAUDE[key]) : null;
|
|
87
97
|
const open = parts.filter((p) => !p.done);
|
|
88
98
|
if (!open.length) return moveLine(r, ctx, '');
|
|
89
99
|
if (open.some(isVerdict)) return yours('did it work?', { when: due });
|
|
@@ -93,7 +103,7 @@ export function nextOf(r, ctx = {}) {
|
|
|
93
103
|
if (open.some((p) => /^kr or health budget$/i.test(p.name))) return claude(ANCHOR);
|
|
94
104
|
if (open[0] && /tickets/.test(open[0].name)) return claude('PMOS drafts the tickets');
|
|
95
105
|
if (key === 'evaluate') return claude('PMOS writes the lessons', { when: due });
|
|
96
|
-
return claude(CLAUDE[key] || 'PMOS writes the experiment');
|
|
106
|
+
return claude(kindWords(r, key) || CLAUDE[key] || 'PMOS writes the experiment');
|
|
97
107
|
}
|
|
98
108
|
|
|
99
109
|
const SPARK = 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z';
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* kind chips, health, when it changed and who changed it (GET /api/board-docs), and a row opens the document's panel.
|
|
10
10
|
* Nothing here invents a value: what no record holds is shown as "—" or not drawn. */
|
|
11
11
|
import { nameHtml } from './split-merge.js'; // Claude suggests a split or a merge: the purple dot after the name (batch 11 item 14)
|
|
12
|
+
import * as WK from './work-kind.js'; // the kind of work before each title (batch 29 item 11, KdBd)
|
|
12
13
|
import { esc } from './premium-shell.js';
|
|
13
14
|
import * as WF from './bd-wf.js';
|
|
14
15
|
import * as GL from './bd-goal.js'; // By goal in every view (batch 29 item 4): a goal's head over its rows
|
|
@@ -84,7 +85,7 @@ function listRow(r, pg) {
|
|
|
84
85
|
const p = pg ? progOf(r) : null, prod = pg ? r.product || A.product() : '';
|
|
85
86
|
const pcells = pg ? `<span role="cell" class="bd-pt">${A.tileHtml(prod, 'bd-ti s')}<span class="bd-ell">${esc(prod)}</span></span><span role="cell" class="bd-pt">${p ? A.progTile('bd-pti s') + `<span class="bd-ell">${esc(p.title)}</span>` : ''}</span>` : '';
|
|
86
87
|
return `<div class="bd-lt${sel ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}">`
|
|
87
|
-
+ `<button type="button" class="bd-ltn ini2" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${nameHtml(r)}</b></button>${pcells}`
|
|
88
|
+
+ `<button type="button" class="bd-ltn ini2" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${WK.iconHtml(r.kind)}${nameHtml(r)}</b></button>${pcells}`
|
|
88
89
|
+ `<span role="cell" class="bd-wfn">${WF.wfIcon(WF.wfOf(r), 18)}<span class="bd-ell">${esc(WF.wfOf(r).name)}</span></span><span role="cell">${stageChip(r, { ms: (r.track || {}).ms })}${(r.track || {}).days ? ' <span class="bd-ell">' + (r.track || {}).days + 'd</span>' : ''}</span><span role="cell">${catPill(r)}</span>`
|
|
89
90
|
+ `<span role="cell" class="cs s-${s.tone}"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i>${esc(s.text)}</span>`
|
|
90
91
|
+ `<span role="cell">${avatar(r.owner)}</span><span role="cell" class="bd-nxc">${nextHtml(r, { self: M().board.self, due: false })}</span>`
|
|
@@ -265,7 +266,7 @@ export function stagesHtml(L, o = {}) {
|
|
|
265
266
|
function phoneRow(r) {
|
|
266
267
|
const s = statusLine(r), t = r.track || {}, w = WF.stageOfRow(r);
|
|
267
268
|
const sub = [stageName(r) || (w && w.name), t.you ? t.you.replace(/^Your /, 'your ') : s.tone !== 'ok' && s.tone !== 'q' ? s.text.toLowerCase() : '', r.owner].filter(Boolean).join(' · ');
|
|
268
|
-
return `<button type="button" class="bd-lrow ini2${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}" aria-haspopup="dialog"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i><span class="tx"><span class="t">${nameHtml(r)}</span><span class="s${t.you ? '' : ' q'}">${esc(sub)}</span></span>${t.you && t.days != null ? `<span class="r">${t.days}d</span>` : ''}${many() ? WF.wfIcon(WF.wfOf(r), 18) : ''}</button>`;
|
|
269
|
+
return `<button type="button" class="bd-lrow ini2${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}" aria-haspopup="dialog"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i><span class="tx"><span class="t">${WK.iconHtml(r.kind)}${nameHtml(r)}</span><span class="s${t.you ? '' : ' q'}">${esc(sub)}</span></span>${t.you && t.days != null ? `<span class="r">${t.days}d</span>` : ''}${many() ? WF.wfIcon(WF.wfOf(r), 18) : ''}</button>`;
|
|
269
270
|
}
|
|
270
271
|
export function phoneListHtml(L) {
|
|
271
272
|
const you = L.filter((r) => r.track && r.track.you), bad = L.filter((r) => !you.includes(r) && needOf(r) <= 3), left = L.filter((r) => !you.includes(r) && !bad.includes(r));
|
|
@@ -1580,3 +1580,13 @@ span.tg-ng { cursor: default; }
|
|
|
1580
1580
|
.bd-lt.gh { grid-template-columns: minmax(0, 1fr) auto; min-height: 50px; background: var(--bd-row); }
|
|
1581
1581
|
.bd-ltw.pg .bd-lt.gh { grid-template-columns: minmax(0, 1fr) auto; }
|
|
1582
1582
|
.bd-gln .bd-pti, .bd-glb .bd-pti { background: var(--bd-progbg); }
|
|
1583
|
+
|
|
1584
|
+
/* the kind of work (batch 29 item 11, KdA, KdAP, KdBd; pm/work-kind.js): New initiative's switch, its caption and ✦ line, and the Board's icon */
|
|
1585
|
+
.kd-cap { margin: 8px 2px 0; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink2); }
|
|
1586
|
+
.kd-cap b { font-weight: var(--fw-strong); color: var(--cz-ink); }
|
|
1587
|
+
.kd-lean { display: flex; gap: 6px; align-items: flex-start; margin: 8px 2px 0; font-size: var(--fs-label); line-height: var(--lh-label); color: var(--cz-blueink); }
|
|
1588
|
+
.kd-lean svg { flex: 0 0 auto; margin-top: 2px; }
|
|
1589
|
+
.kd-seg { display: flex; width: 100%; }
|
|
1590
|
+
.kd-seg > button:not(.bd-ib) { flex: 1 1 0%; justify-content: center; gap: 6px; height: 38px; }
|
|
1591
|
+
.kd-seg > button svg { flex: 0 0 auto; }
|
|
1592
|
+
.kd-g { display: inline-grid; vertical-align: -3px; margin-right: 6px; color: var(--cz-ink3); }
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
* sub one quiet line under the title: what the item is when the title is its parent's name (a program's "Charter", canvas MsBCharter)
|
|
37
37
|
* chip { n, label, on(button) }: the blue ✦ with its count right after the title (what Claude proposes on an initiative, batch 12
|
|
38
38
|
* items 2, 3 and 4, canvas In development PiA0/TpA1). Hidden at zero. setChip(id, chip) changes it while the item is shown.
|
|
39
|
-
* presses [{ act, label, icon, text?, solid?, blue?, pressed? }]: the item's own presses before ⋯ (
|
|
39
|
+
* presses [{ act, label, icon, text?, solid?, blue?, pressed?, lead? }]: the item's own presses before ⋯ (lead: before Discuss, the
|
|
40
|
+
* initiative's kind of work, batch 29 item 11) (a program's charter icon, canvas MsB0Entry; the
|
|
40
41
|
* charter's Save, MsBCharter). text draws the word beside the icon (not on a phone); solid is the one dark primary; blue
|
|
41
42
|
* makes it the round blue ✓ a form saves with (batch 18 item 2-C, canvas OvA8People, OvA9Docs).
|
|
42
43
|
* onPress(act, button) runs them. setPresses(id, list) changes them while the item is shown (Save shows only after a change).
|
|
@@ -179,9 +180,12 @@ export function headHtml(it) {
|
|
|
179
180
|
const inMenu = phone && (o.presses || []).some((x) => x && x.menu && x.act && x.label);
|
|
180
181
|
const more = inMenu || typeof o.more === 'function' || (Array.isArray(o.more) && o.more.some((m) => m && !m.sep)) || o.url ? ib('more', 'More', P.more, ' aria-haspopup="menu" aria-expanded="false"') : '';
|
|
181
182
|
const add = o.add && o.add.label && !phone ? ib('add', o.add.label, P.add) : '';
|
|
182
|
-
const
|
|
183
|
+
const pressHtml = (x) => (x.solid
|
|
183
184
|
? `<button type="button" class="cz-vw-pri${x.text && !phone ? '' : ' i'}${x.blue ? ' blue' : ''}" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}">${svg(path(x.icon), 15, 2.2)}${x.text && !phone ? `<span>${esc(x.text)}</span>` : ''}</button>`
|
|
184
|
-
: `<button type="button" class="cz-vw-ib" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}"${x.pressed != null ? ` aria-pressed="${x.pressed ? 'true' : 'false'}"` : ''}>${svg(path(x.icon), 18)}</button>`)
|
|
185
|
+
: `<button type="button" class="cz-vw-ib" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}"${x.pressed != null ? ` aria-pressed="${x.pressed ? 'true' : 'false'}"` : ''}${x.lead ? ' aria-haspopup="menu"' : ''}>${svg(path(x.icon), 18)}</button>`);
|
|
186
|
+
const shown = (o.presses || []).filter((x) => x && x.act && x.label && !(phone && x.menu));
|
|
187
|
+
// lead: a press that stands before Discuss (the initiative's kind of work, batch 29 item 11, KdV1-3)
|
|
188
|
+
const lead = shown.filter((x) => x.lead).map(pressHtml).join(''), own = shown.filter((x) => !x.lead).map(pressHtml).join('');
|
|
185
189
|
const sub = o.sub ? `<p class="cz-vw-sub">${esc(o.sub)}</p>` : '';
|
|
186
190
|
const chip = o.chip && (o.chip.n > 0 || o.chip.looking) ? `<button type="button" class="cz-vw-chip${o.chip.looking ? ' live' : ''}" data-cz-vw="chip" aria-haspopup="dialog" aria-label="${esc(o.chip.label || 'PMOS proposes ' + o.chip.n + '. Open')}" title="${esc(o.chip.label || 'PMOS proposes')}">${svg(ICONS.spark, 13, 2)}${o.chip.n > 0 && !o.chip.quiet ? `<b>${esc(o.chip.n)}</b>` : ''}</button>` : '';
|
|
187
191
|
return (o.canBack || phone ? ib('back', o.canBack ? (o.backTo ? 'Back to ' + o.backTo : 'Back') : 'Close the viewer', P.back) : '')
|
|
@@ -189,7 +193,7 @@ export function headHtml(it) {
|
|
|
189
193
|
+ (o.check ? `<button type="button" class="cz-vw-tile cz-vw-chk s-${esc(o.check.state || 'todo')}" data-cz-vw="press" data-cz-vw-p="check" aria-label="${esc(o.check.label || 'Mark done')}" title="${esc(o.check.title || o.check.label || 'Mark done')}"${o.check.disabled ? ' disabled' : ''}><span class="bx"></span></button>`
|
|
190
194
|
: `<span class="cz-vw-tile" aria-hidden="true">${svg(path(o.icon), 17)}</span>`)
|
|
191
195
|
+ (o.renaming ? renHtml(o) : `<div class="cz-vw-t">${kind}<h3 class="cz-vw-title${chip ? ' has-chip' : ''}${o.wrap ? ' wrap' : ''}" id="czVwTitle">${o.rename ? `<button type="button" class="cz-vw-rn" data-cz-vw-rn aria-label="${esc('Rename ' + (o.title || ''))}" title="Rename">${esc(o.title || '')}</button>` : chip ? `<span class="cz-vw-tt">${esc(o.title || '')}</span>` : esc(o.title || '')}${chip}</h3>${sub}</div>`)
|
|
192
|
-
+ disc + own + add + more
|
|
196
|
+
+ lead + disc + own + add + more
|
|
193
197
|
// ⧉ (batch 18 item 15, TbT7Place): where a page arranges panels, one placement press takes the place of ⤢ (Full screen is in it)
|
|
194
198
|
+ (phone ? '' : o.place ? ib('place', 'Arrange', P.place, ' aria-haspopup="menu" aria-expanded="false"')
|
|
195
199
|
: ib('wide', o.isWide ? 'Back to the side' : 'Open wide', o.isWide ? P.side : P.wide, ` aria-pressed="${o.isWide ? 'true' : 'false'}"`))
|
|
@@ -566,7 +570,9 @@ function setChip0(id, chip) {
|
|
|
566
570
|
if (V.cur.args) V.cur.args = { ...V.cur.args, chip: V.cur.chip };
|
|
567
571
|
if ((was ? was.n || 0 : -1) !== n || (was && chip && (was.label !== chip.label || !!was.looking !== !!chip.looking))) { if (!V.cur.renaming) redraw(); }
|
|
568
572
|
}
|
|
569
|
-
|
|
573
|
+
// a list with no lead press keeps the item's lead presses (the kind of work stays when the Dashboard's press changes)
|
|
574
|
+
const withLead = (list) => { const L = list || []; if (L.some((x) => x && x.lead)) return L; const k = ((V.cur && V.cur.presses) || []).filter((x) => x && x.lead); return k.length ? k.concat(L) : list; };
|
|
575
|
+
function setPresses0(id, list) { if (V.cur && V.cur.id === String(id)) { list = withLead(list); V.cur.presses = list || null; if (V.cur.args) V.cur.args = { ...V.cur.args, presses: list || null }; if (!V.cur.renaming) redraw(); } }
|
|
570
576
|
/** A task's check box changes while it is shown (a status move from the card, canvas XetX1Done). */
|
|
571
577
|
function setCheck0(id, check) { if (V.cur && V.cur.id === String(id)) { V.cur.check = check || null; if (V.cur.args) V.cur.args = { ...V.cur.args, check: check || null }; if (!V.cur.renaming) redraw(); } }
|
|
572
578
|
/** The item may be shown in any Viewer, not only the one used last: each one that shows it changes. */
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
* batch 11 item 20 they are the page's Tasks section's, the same on the Board (ini-groups.js). In shell A Documents and Stage open from the
|
|
27
27
|
* page; the phone keeps the Documents | Stage switch. */
|
|
28
28
|
import * as MD from './home-ini-model.js';
|
|
29
|
+
import * as WK from './work-kind.js'; // the kind of work in the header (batch 29 item 11, KdV1-3)
|
|
29
30
|
import * as WF from './ini-wf.js';
|
|
30
31
|
import { openPop, closePop, undoToast, popEl, ensureCss as ensurePopCss } from './hi-pop.js';
|
|
31
32
|
import { iniMore, iniText, pageHref, stagePick, deleteSaid, DELETE_MS } from './ini-more.js'; // the one initiative ⋯ menu and stage picker, the same on the Board (batch 14 item 5, batch 16 item 5c)
|
|
@@ -448,6 +449,8 @@ async function autoPress(id, M, on) {
|
|
|
448
449
|
await X.ctx.load(); redrawView();
|
|
449
450
|
return true;
|
|
450
451
|
}
|
|
452
|
+
/** The initiative's kind of work: the page's own model, else its Board row; none reads as Product management. */
|
|
453
|
+
const kindNow = (id) => { const M = curM(); return (M && M.kind) || rowOf(id).kind || 'product'; };
|
|
451
454
|
export function iniPage() {
|
|
452
455
|
if (!X.ctx) return false;
|
|
453
456
|
const S = X.ctx.S, id = S.ini;
|
|
@@ -459,7 +462,13 @@ export function iniPage() {
|
|
|
459
462
|
const dh = dashFor(id);
|
|
460
463
|
BODY = VW.open({ id: 'ov:' + id, kind: X.ctx.kindOf(id), title: X.ctx.iniTitle(id), icon: 'goal', wrap: true, more: () => pageMore(id), rename,
|
|
461
464
|
discuss: () => X.ctx.newIn(id), discussHome: true, // the one view (OvViewers): Discuss starts a new session about it, where + New session was
|
|
462
|
-
|
|
465
|
+
// the kind of work (batch 29 item 11, KdV1-3): its glyph stands before Discuss; a tap opens the three kinds
|
|
466
|
+
presses: [WK.pressOf(kindNow(id))].concat(dh ? dh.presses() : []), onPress: (a, btn) => {
|
|
467
|
+
if (a === 'dash' && dh) dh.toggle();
|
|
468
|
+
else if (a === 'kind') { const from = kindNow(id); WK.pick(btn, from, (to) => WK.change({ pmPost: X.ctx.pmPost, ws: wsOf(curM()) || rowOf(id).ws, id, from, to, toast: (t, u) => (u ? undoToast(t, u) : X.ctx.toast(t)),
|
|
469
|
+
apply: (k) => { const M = curM(); if (M) M.kind = k; const row = rowOf(id); if (row && row.id) row.kind = k; VW.setPresses('ov:' + id, [WK.pressOf(k)].concat(dh ? dh.presses() : [])); redrawView(); },
|
|
470
|
+
reload: async () => { await X.ctx.load(); redrawView(); } })); }
|
|
471
|
+
},
|
|
463
472
|
render: (b) => { X.view = 'page'; BODY = b; ADDING = null; draw(b); wire(b, id); wirePage(b, id); if (dh) dh.wire(b); } });
|
|
464
473
|
// came to read (?view=dashboard: a report, Intelligence, a notification) or to act (a Home task): which view opens first
|
|
465
474
|
if (dh) dh.read(new URLSearchParams(location.search).get('view') === 'dashboard' ? 'read' : 'act');
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Wawan 2026-11-10; requirements R4, R5, R7, R12, R17, R18 and decision D107). Pure parts first: Node imports them (ini-agent.test.js).
|
|
3
3
|
*
|
|
4
4
|
* agentModel(art, auto, id, o) → M | null what the Viewer shows, from GET /api/artefacts?scope=experiment:<id> and GET /api/autonomy
|
|
5
|
-
* expHtml(M) · workHtml(M) · sectionsHtml(M) the Experiment section
|
|
6
|
-
*
|
|
5
|
+
* expHtml(M, kind) · workHtml(M) · comingHtml(rows) · sectionsHtml(M, v) the Experiment section (its rows follow v.kind, kindRows), PMOS's work (with its amber line) and
|
|
6
|
+
* Coming up, each '' when it has nothing to say
|
|
7
|
+
* comingUp(v, M) → [row] what is ahead for the initiative, dated, oldest first (batch 29 item 7, board CuA)
|
|
7
8
|
* gateOf(M) → { label, parts } | null D107: the gate to Build reads the done test and the kill condition, not PRD and rubric
|
|
8
9
|
* want(ws, id, done) · cached(id) · edit(body, btn) · save(body, form) · undo(btn) the reads and presses (the page only)
|
|
9
10
|
*
|
|
@@ -12,18 +13,58 @@
|
|
|
12
13
|
* written there is no section (zero is silence). The PM edits a one-line field in place (POST /api/artefacts/set); Claude then asks before
|
|
13
14
|
* it changes that line again (lib/artefacts.js pmEdited).
|
|
14
15
|
* CLAUDE'S WORK (R7): the changes Claude made here by itself in the last 14 days (GET /api/autonomy done, by initiative), each with its
|
|
15
|
-
* one-line reason, its day and Undo; a run that stopped is one amber line (R4)
|
|
16
|
+
* one-line reason, its day and Undo; a run that stopped is one amber line (R4).
|
|
17
|
+
* COMING UP (R5; batch 29 item 7, Exploring 2 board CuA, picked by Wawan 2026-11-11): a short dated list under its own head, three rows and
|
|
18
|
+
* "N more", in the same row shape as PMOS's work. Five kinds, each row naming its source; a kind with nothing ahead is not drawn:
|
|
19
|
+
* due the open milestones ahead and the plan's end (the Viewer's stage model) ◇
|
|
20
|
+
* outcome the record's outcome check date, while it is still ahead (GET /api/autonomy/ahead) target
|
|
21
|
+
* kill the date in the experiment's stop line, else its budget's end flag (amber)
|
|
22
|
+
* job PMOS's scheduled jobs that name this initiative, next 30 days (…/ahead) clock: PMOS does it
|
|
23
|
+
* wait what waits on someone else: a blocked Jira ticket, an open dependency person
|
|
24
|
+
* A check that is already due is Your move on Home, so nothing here repeats it.
|
|
16
25
|
* Icon-only presses carry their words in aria-label and title. */
|
|
17
26
|
import { pmGet, pmPost } from './http.js';
|
|
18
27
|
|
|
19
28
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
20
29
|
const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
21
30
|
const P = { undo: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3', check: 'M5 12l5 5 9-10', warn: 'M12 8v5M12 16.5v.01M10.3 3.9L2.6 17.5A2 2 0 0 0 4.3 20.5h15.4a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z',
|
|
22
|
-
clock: 'M12 7.5V12l3 2M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17', x: 'M6 6l12 12M18 6L6 18', right: 'M10 7l5 5-5 5'
|
|
31
|
+
clock: 'M12 7.5V12l3 2M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17', x: 'M6 6l12 12M18 6L6 18', right: 'M10 7l5 5-5 5',
|
|
32
|
+
flag: 'M5 21V4M5 4h11l-2 4 2 4H5', target: 'M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17M12 8a4 4 0 1 0 0 8a4 4 0 1 0 0-8M12 11.5v1',
|
|
33
|
+
person: 'M12 4a3.5 3.5 0 1 0 0 7a3.5 3.5 0 1 0 0-7M5 20a7 7 0 0 1 14 0', ms: 'M12 3.5l8.5 8.5-8.5 8.5-8.5-8.5z' };
|
|
23
34
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
24
35
|
const dm = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
|
|
25
36
|
const DAY = 864e5, SHOW = 3;
|
|
26
|
-
export const WHO = { factory: 'PMOS builds it
|
|
37
|
+
export const WHO = { factory: 'PMOS builds it and opens pull requests. You merge.', team: 'The team builds it. PMOS writes the done test.', 'team-agents': 'The team’s agents build it. PMOS writes the done test.' };
|
|
38
|
+
/* THE KIND OF WORK (batch 29 item 11, boards KdV1-3): the kind is named once, in the Experiment's header, and the rows follow it. Who builds
|
|
39
|
+
* defaults from the kind until someone writes it (Full SDLC: PMOS, the factory; Product and Project: the team); Project reads "Who does it"
|
|
40
|
+
* and needs no specimens. A kind never changes a line someone wrote. */
|
|
41
|
+
export const KIND = { product: 'Product management', sdlc: 'Full SDLC', project: 'Project management' };
|
|
42
|
+
const kindOf = (k) => (KIND[k] ? k : 'product');
|
|
43
|
+
const DEF_EX = { product: 'team', sdlc: 'factory', project: 'team' };
|
|
44
|
+
const PROJECT_WHO = 'The team does it. PMOS chases, syncs the dates and writes the status line.';
|
|
45
|
+
/** The Experiment's rows for one kind: the model's rows, with Who builds from the kind when nobody wrote it, and Project's wording. */
|
|
46
|
+
export function kindRows(M, kind) {
|
|
47
|
+
if (!M || !M.exp) return [];
|
|
48
|
+
const k = kindOf(kind), rows = M.exp.rows.slice();
|
|
49
|
+
let i = rows.findIndex((r) => r.key === 'executor');
|
|
50
|
+
if (i < 0) {
|
|
51
|
+
const at = rows.findIndex((r) => r.key === 'specimens' || r.key === 'done');
|
|
52
|
+
const ex = DEF_EX[k];
|
|
53
|
+
const r = { key: 'executor', label: 'Who builds', text: WHO[ex], value: ex, by: '', at: '', sub: k === 'sdlc' ? 'Set one experiment to the team in Jira any time.' : '', def: true, edit: { artefact: 'experiment', field: 'executor', pick: Object.keys(WHO) } };
|
|
54
|
+
if (at < 0) rows.push(r); else rows.splice(at, 0, r);
|
|
55
|
+
i = rows.indexOf(r);
|
|
56
|
+
}
|
|
57
|
+
if (k === 'project') {
|
|
58
|
+
const r = rows[i];
|
|
59
|
+
rows[i] = { ...r, label: 'Who does it', text: r.def ? PROJECT_WHO : r.text, sub: '' };
|
|
60
|
+
if (!rows.some((x) => x.key === 'specimens')) {
|
|
61
|
+
const d = rows.findIndex((x) => x.key === 'done');
|
|
62
|
+
const sp = { key: 'specimens', label: 'Specimens', text: 'None needed. The plan is what you look at.', edit: null };
|
|
63
|
+
if (d < 0) rows.push(sp); else rows.splice(d, 0, sp);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return rows;
|
|
67
|
+
}
|
|
27
68
|
|
|
28
69
|
const art = (A, key) => ((A && A.artefacts) || []).find((a) => a.key === key) || null;
|
|
29
70
|
const one = (a, f) => { const v = a && a.fields && a.fields[f]; return v && !Array.isArray(v) && v.text ? v : null; };
|
|
@@ -57,7 +98,9 @@ export function agentModel(A, U, id, o = {}) {
|
|
|
57
98
|
const fl = ((U && U.failed) || []).filter((f) => f && f.ini === id && now - Date.parse(f.at || '') <= 7 * DAY);
|
|
58
99
|
const failed = fl.length ? { n: fl.length, at: fl[0].at, why: fl[0].why || '' } : null;
|
|
59
100
|
const week = work.filter((w) => now - Date.parse(w.at) <= 7 * DAY).length;
|
|
60
|
-
|
|
101
|
+
const AH = o.ahead && o.ahead.ok !== false ? o.ahead : null;
|
|
102
|
+
const ahead = AH ? { outcome: AH.outcome || null, jobs: Array.isArray(AH.jobs) ? AH.jobs : [] } : null;
|
|
103
|
+
return { id, ws: (U && U.ws) || (A && A.ws) || '', exp, gate, work, week, failed, ahead, kill: kill ? kill.text : '', budget: budget ? budget.text : '' };
|
|
61
104
|
}
|
|
62
105
|
|
|
63
106
|
/** D107: with an experiment on record, the gate to Build is its done test and its kill condition (not the PRD and the rubric). */
|
|
@@ -66,45 +109,90 @@ export function gateOf(M) {
|
|
|
66
109
|
return { label: 'Gate to Build', parts: [{ text: 'done test', ok: M.gate.done, ...(M.gate.done ? {} : { note: 'No done test is written yet' }) }, { text: 'kill condition', ok: M.gate.kill, ...(M.gate.kill ? {} : { note: 'No kill condition is written yet' }) }] };
|
|
67
110
|
}
|
|
68
111
|
|
|
69
|
-
/**
|
|
70
|
-
export function
|
|
112
|
+
/** A date written in a line ("by 30 Nov", "Nov 30", "2026-11-30") as YYYY-MM-DD, on or after today; '' when it names none. */
|
|
113
|
+
export function dateIn(text, today) {
|
|
114
|
+
const t = String(text || ''), y0 = +String(today || '').slice(0, 4) || new Date().getFullYear();
|
|
115
|
+
let m = /\b(\d{4})-(\d{2})-(\d{2})\b/.exec(t);
|
|
116
|
+
if (m) return m[0];
|
|
117
|
+
const mon = (w) => MON.findIndex((x) => x.toLowerCase() === String(w).slice(0, 3).toLowerCase());
|
|
118
|
+
m = /\b(\d{1,2})\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\.?(?:,?\s+(\d{4}))?/i.exec(t);
|
|
119
|
+
let d = m ? +m[1] : 0, k = m ? mon(m[2]) : -1, y = m && m[3] ? +m[3] : 0;
|
|
120
|
+
if (!m) { m = /\b(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\.?\s+(\d{1,2})\b(?:,?\s+(\d{4}))?/i.exec(t); if (m) { d = +m[2]; k = mon(m[1]); y = m[3] ? +m[3] : 0; } }
|
|
121
|
+
if (!m || k < 0 || d < 1 || d > 31) return '';
|
|
122
|
+
const iso = (yy) => yy + '-' + String(k + 1).padStart(2, '0') + '-' + String(d).padStart(2, '0');
|
|
123
|
+
// no year written: this year's date, else next year's when this year's has passed
|
|
124
|
+
return y ? iso(y) : iso(y0) >= String(today || '') ? iso(y0) : iso(y0 + 1);
|
|
125
|
+
}
|
|
126
|
+
const stop = (s) => String(s || '').trim().replace(/[.!?]?$/, '.');
|
|
127
|
+
|
|
128
|
+
/** What is ahead for the initiative: v is the Viewer's model (ini-view-model.js iniView), M this file's agentModel. Dated rows oldest
|
|
129
|
+
* first, then the undated waits; each { kind, iso, text, src }. Nothing ahead: []. */
|
|
130
|
+
export function comingUp(v, M) {
|
|
131
|
+
const today = (v && v.today) || new Date().toISOString().slice(0, 10), out = [];
|
|
132
|
+
const add = (kind, iso, text, src) => { const d = String(iso || '').slice(0, 10); if (d && d < today) return; out.push({ kind, iso: d, text, src }); };
|
|
71
133
|
const st = v && v.stage;
|
|
72
|
-
if (!
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
|
|
134
|
+
for (const g of (st && st.gates && st.gates.open) || []) if (!g.late && g.iso) add('due', g.iso, stop(g.name + ' is due'), 'From the milestone task' + (g.owner ? ', owner ' + g.owner : ''));
|
|
135
|
+
if (st && st.endIso && st.dates && !st.dates.over) add('due', st.endIso, 'The plan ends.', 'From the initiative’s end date');
|
|
136
|
+
const A = M && M.ahead;
|
|
137
|
+
if (A && A.outcome && A.outcome.date) add('outcome', A.outcome.date, stop('Outcome check: ' + (A.outcome.metric || 'the outcome')), 'From the outcome check date on the record');
|
|
138
|
+
if (M && M.kill) {
|
|
139
|
+
const k = dateIn(M.kill, today), b = k ? '' : dateIn(M.budget, today);
|
|
140
|
+
if (k || b) add('kill', k || b, stop('Kill check: ' + M.kill), k ? 'From the experiment’s stop line' : 'From the end of the experiment’s budget');
|
|
141
|
+
}
|
|
142
|
+
for (const j of (A && A.jobs) || []) add('job', j.date, stop('PMOS runs “' + j.name + '”'), 'From the schedule, ' + j.src.replace(/^Scheduled /, ''));
|
|
143
|
+
for (const sec of (v && v.tasks && v.tasks.sections) || []) {
|
|
144
|
+
for (const k of (sec.jira && sec.jira.open) || []) if (k.warn) add('wait', /^\d{4}-\d{2}-\d{2}/.test(k.due || '') ? k.due : '', stop(k.title + ' waits'), 'From Jira ' + k.key + (k.sub ? ': ' + k.sub : ''));
|
|
145
|
+
}
|
|
146
|
+
for (const l of (v && v.linked) || []) {
|
|
147
|
+
if (l.kind !== 'dep' || /: done$/.test(l.title || '')) continue;
|
|
148
|
+
add('wait', '', stop(l.label), 'From a dependency on the record');
|
|
149
|
+
}
|
|
150
|
+
const seen = new Set();
|
|
151
|
+
return out.filter((r) => { const k = r.kind + '|' + r.iso + '|' + r.text; if (seen.has(k)) return false; seen.add(k); return true; })
|
|
152
|
+
.sort((a, b) => (a.iso ? 0 : 1) - (b.iso ? 0 : 1) || a.iso.localeCompare(b.iso));
|
|
78
153
|
}
|
|
79
154
|
|
|
80
155
|
const failLine = (F) => `<div class="ia-fl" role="status">${SVG(P.warn, 14, 2)}<span>${esc((F.n === 1 ? 'The ' + dm(F.at) + ' run' : F.n + ' runs') + ' ended with an error.' + (F.why ? ' ' + String(F.why).replace(/\.?$/, '.') : '') + ' PMOS runs ' + (F.n === 1 ? 'it' : 'them') + ' again on the next wake. Nothing ' + (F.n === 1 ? 'it' : 'they') + ' made was kept.')}</span></div>`;
|
|
81
156
|
|
|
82
|
-
export function expHtml(M) {
|
|
157
|
+
export function expHtml(M, kind) {
|
|
83
158
|
if (!M || !M.exp) return '';
|
|
159
|
+
const k = kindOf(kind);
|
|
84
160
|
const rowHtml = (r) => {
|
|
85
161
|
const val = `<span class="ia-v">${esc(r.text)}${r.sub ? `<small>${esc(r.sub)}</small>` : ''}</span>`;
|
|
86
162
|
return r.edit ? `<button type="button" class="ia-xr" data-ia-edit="${esc(r.key)}" aria-label="${esc(r.label + ': ' + r.text + '. Edit')}" title="Edit"><b>${esc(r.label)}</b>${val}</button>`
|
|
87
163
|
: `<div class="ia-xr"><b>${esc(r.label)}</b>${val}</div>`;
|
|
88
164
|
};
|
|
89
|
-
return `<section class="ia-sec" aria-label="Experiment" data-ia-exp><div class="ia-th"><b>Experiment</b><span class="n">${esc('PMOS
|
|
90
|
-
+ `<div class="iv-folds">${M.
|
|
165
|
+
return `<section class="ia-sec" aria-label="Experiment" data-ia-exp><div class="ia-th"><b>Experiment</b><span class="n"><b>${esc(KIND[k])}</b>${esc(' · PMOS wrote it' + (M.exp.at ? ' · ' + dm(M.exp.at) : ''))}</span></div>`
|
|
166
|
+
+ `<div class="iv-folds">${kindRows(M, k).map(rowHtml).join('')}<p class="ia-note">Press a line to edit it. PMOS asks before it changes one you edited.</p></div></section>`;
|
|
91
167
|
}
|
|
92
168
|
|
|
93
|
-
export function workHtml(M,
|
|
94
|
-
if (!M || (!M.work.length && !M.failed
|
|
169
|
+
export function workHtml(M, o = {}) {
|
|
170
|
+
if (!M || (!M.work.length && !M.failed)) return '';
|
|
95
171
|
const all = !!o.all, shown = all ? M.work : M.work.slice(0, SHOW), more = M.work.length - shown.length;
|
|
96
172
|
const row = (w) => `<div class="ia-dr" data-ref="${esc(w.ref)}"><span class="ck" aria-hidden="true">${SVG(P.check, 12, 2.6)}</span><span><b>${esc(w.title)}</b><em>${esc([w.reason, dm(w.at)].filter(Boolean).join(' · '))}</em></span>`
|
|
97
173
|
+ `<button type="button" class="yd-alt sm" data-ia-undo="${esc(w.ref)}" data-ws="${esc(w.ws)}" aria-label="${esc('Undo: ' + w.title)}" title="Undo">${SVG(P.undo, 16, 2)}</button></div>`;
|
|
98
|
-
const list =
|
|
99
|
-
+ (more > 0 ? `<button type="button" class="iv-fr" data-ia-more aria-expanded="false"><b>${more} more</b><span class="iv-cv" aria-hidden="true">${SVG(P.right, 14, 2)}</span></button>` : '') + '</div>'
|
|
100
|
-
const cu = up ? `<p class="ia-cu">${SVG(P.clock, 14, 2)}<span><b>${esc('Coming up · ' + up.date + '.')}</b> ${esc(up.text)}</span></p>` : '';
|
|
174
|
+
const list = `<div class="iv-folds">${M.failed ? failLine(M.failed) : ''}${shown.map(row).join('')}`
|
|
175
|
+
+ (more > 0 ? `<button type="button" class="iv-fr" data-ia-more aria-expanded="false"><b>${more} more</b><span class="iv-cv" aria-hidden="true">${SVG(P.right, 14, 2)}</span></button>` : '') + '</div>';
|
|
101
176
|
const n = M.week ? M.week + ' this week' : M.work.length ? M.work.length + ' in 14 days' : '';
|
|
102
|
-
return `<section class="ia-sec" aria-label="PMOS’s work" data-ia-work><div class="ia-th"><b>PMOS’s work</b>${n ? `<span class="n">${esc(n)}</span>` : ''}</div>${list}
|
|
177
|
+
return `<section class="ia-sec" aria-label="PMOS’s work" data-ia-work><div class="ia-th"><b>PMOS’s work</b>${n ? `<span class="n">${esc(n)}</span>` : ''}</div>${list}</section>`;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const SIGN = { due: ['ms', ''], outcome: ['target', ''], kill: ['flag', ' k'], job: ['clock', ''], wait: ['person', ''] };
|
|
181
|
+
/** Coming up (board CuA): three rows and "N more", the PMOS's work row shape; the sign says who acts. Nothing ahead: ''. */
|
|
182
|
+
export function comingHtml(rows, o = {}) {
|
|
183
|
+
if (!rows || !rows.length) return '';
|
|
184
|
+
const all = !!o.all, shown = all ? rows : rows.slice(0, SHOW), more = rows.length - shown.length;
|
|
185
|
+
const row = (r) => { const [ic, cls] = SIGN[r.kind] || SIGN.due;
|
|
186
|
+
return `<div class="ia-dr ia-up" data-kind="${esc(r.kind)}"><span class="ck up${cls}" aria-hidden="true">${SVG(P[ic], 12, 2.2)}</span><span><b>${esc((r.iso ? dm(r.iso) + ' · ' : '') + r.text)}</b><em>${esc(stop(r.src))}</em></span></div>`; };
|
|
187
|
+
return `<section class="ia-sec" aria-label="Coming up" data-ia-cu><div class="ia-th"><b>Coming up</b><span class="n">${esc(rows.length + ' ahead')}</span></div><div class="iv-folds">${shown.map(row).join('')}`
|
|
188
|
+
+ (more > 0 ? `<button type="button" class="iv-fr" data-ia-cumore aria-expanded="false"><b>${more} more</b><span class="iv-cv" aria-hidden="true">${SVG(P.right, 14, 2)}</span></button>` : '')
|
|
189
|
+
+ (all && rows.length > SHOW ? `<button type="button" class="iv-fr" data-ia-cumore aria-expanded="true"><b>Fewer</b><span class="iv-cv" aria-hidden="true">${SVG(P.right, 14, 2)}</span></button>` : '') + '</div></section>';
|
|
103
190
|
}
|
|
104
191
|
|
|
105
192
|
/** Both sections in one holder the page can swap when the reads arrive. */
|
|
106
193
|
export function sectionsHtml(M, v, id, o = {}) {
|
|
107
|
-
|
|
194
|
+
const k = v && v.kind ? kindOf(v.kind) : '';
|
|
195
|
+
return `<div class="ia" data-ia="${esc(id)}"${k ? ` data-ia-kind="${k}"` : ''}>${expHtml(M, k)}${workHtml(M, o)}${comingHtml(comingUp(v, M), { all: !!o.cuAll })}</div>`;
|
|
108
196
|
}
|
|
109
197
|
|
|
110
198
|
/* ── the reads and the presses (the page only) ── */
|
|
@@ -113,15 +201,16 @@ const FRESH_MS = 30e3;
|
|
|
113
201
|
export const cached = (id) => (CACHE.get(id) || {}).M || null;
|
|
114
202
|
export const allOpen = (id) => OPEN.has(id);
|
|
115
203
|
/** Read the experiment and Claude's work for one initiative, at most every 30 s; done() runs when the answer changed what shows. */
|
|
116
|
-
export function want(ws, id, done) {
|
|
204
|
+
export function want(ws, id, done, title) {
|
|
117
205
|
if (!id) return;
|
|
118
206
|
const c = CACHE.get(id), k = ws + '|' + id;
|
|
119
207
|
if (c && Date.now() - c.at < FRESH_MS) return;
|
|
120
208
|
if (WANT.has(k)) return;
|
|
121
209
|
const q = ws ? 'ws=' + encodeURIComponent(ws) + '&' : '';
|
|
122
|
-
const p = Promise.all([pmGet('/api/artefacts?' + q + 'scope=' + encodeURIComponent('experiment:' + id)).catch(() => null), pmGet('/api/autonomy' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)
|
|
123
|
-
|
|
124
|
-
|
|
210
|
+
const p = Promise.all([pmGet('/api/artefacts?' + q + 'scope=' + encodeURIComponent('experiment:' + id)).catch(() => null), pmGet('/api/autonomy' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null),
|
|
211
|
+
pmGet('/api/autonomy/ahead?' + q + 'ini=' + encodeURIComponent(id) + (title ? '&title=' + encodeURIComponent(title) : '')).catch(() => null)])
|
|
212
|
+
.then(([a, u, h]) => {
|
|
213
|
+
const M = agentModel(a && a.ok ? a : null, u && u.ok ? u : null, id, { ahead: h && h.ok ? h : null });
|
|
125
214
|
const was = JSON.stringify(cached(id));
|
|
126
215
|
CACHE.set(id, { M, at: Date.now() });
|
|
127
216
|
if (JSON.stringify(M) !== was && done) done();
|
|
@@ -130,11 +219,14 @@ export function want(ws, id, done) {
|
|
|
130
219
|
}
|
|
131
220
|
const forget = (id) => { const c = CACHE.get(id); if (c) c.at = 0; };
|
|
132
221
|
export function toggleMore(id) { if (OPEN.has(id)) OPEN.delete(id); else OPEN.add(id); }
|
|
222
|
+
/** Coming up's own "N more" and "Fewer", kept apart from PMOS's work. */
|
|
223
|
+
export const cuOpen = (id) => OPEN.has('cu|' + id);
|
|
224
|
+
export function toggleCu(id) { toggleMore('cu|' + id); }
|
|
133
225
|
|
|
134
226
|
/** A press on a field: the line turns into its editor (a text field, or the three builders for Who builds). */
|
|
135
227
|
export function edit(btn) {
|
|
136
228
|
const sec = btn.closest('[data-ia]'), id = sec && sec.dataset.ia, M = cached(id);
|
|
137
|
-
const r = M
|
|
229
|
+
const r = kindRows(M, sec && sec.dataset.iaKind).find((x) => x.key === btn.dataset.iaEdit);
|
|
138
230
|
if (!r || !r.edit) return;
|
|
139
231
|
const field = r.edit.pick ? `<select name="v" aria-label="${esc(r.label)}">${r.edit.pick.map((p) => `<option value="${esc(p)}"${p === r.value ? ' selected' : ''}>${esc(WHO[p])}</option>`).join('')}</select>`
|
|
140
232
|
: `<textarea name="v" rows="2" aria-label="${esc(r.label)}">${esc(r.text)}</textarea>`;
|
|
@@ -146,7 +238,7 @@ export function edit(btn) {
|
|
|
146
238
|
}
|
|
147
239
|
/** Save the PM's edit of one line; then read again and draw. */
|
|
148
240
|
export async function save(form, ws, redraw, toast) {
|
|
149
|
-
const
|
|
241
|
+
const sec = form.closest('[data-ia]'), id = sec.dataset.ia, M = cached(id), r = kindRows(M, sec.dataset.iaKind).find((x) => x.key === form.dataset.iaKey);
|
|
150
242
|
const v = String(form.querySelector('[name="v"]').value || '').trim();
|
|
151
243
|
if (!r || !v) { redraw(); return; }
|
|
152
244
|
const res = await pmPost('/api/artefacts/set', { ws: ws || undefined, scope: 'experiment:' + id, artefact: r.edit.artefact, field: r.edit.field, text: v }).catch(() => null);
|