create-pmos 0.284.0 → 0.286.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 +1 -1
- 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-test.js +13 -2
- package/workspace/guide/briefing-premium.md +2 -2
- package/workspace/lib/briefing-premium.js +3 -2
- package/workspace/lib/report-setups.js +27 -5
- package/workspace/lib/routes-report-setups.js +3 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/premium-insights.js +9 -3
- package/workspace/public/pm/premium.js +19 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.286.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T03:07:18Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T03:07:18Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T03:07:18Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -229,7 +229,18 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
229
229
|
await p.click('#dPane');
|
|
230
230
|
ok('R4 pressing it again shows the conversation', await p.evaluate(() => document.querySelector('#dlg').dataset.mode === 'split' && getComputedStyle(document.querySelector('#dBody')).display !== 'none'));
|
|
231
231
|
ok('D12 the reply box asks a read-only agent, and says what the agent can and cannot do', !d.input && await p.evaluate(() => !document.querySelector('#askIn').disabled && /cannot change anything/.test(document.querySelector('#askNote').textContent)));
|
|
232
|
-
|
|
232
|
+
let startBody = null;
|
|
233
|
+
await p.route('**/api/agent/start', (r) => { startBody = JSON.parse(r.request().postData()); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, session: { id: 'sx', name: 'draft' } }) }); });
|
|
234
|
+
ok('W8 the start button of a blocked row is live and says what starting does', await p.evaluate(() => { const b = document.querySelector('#startBtn'); const h = document.querySelector('#holdWhy'); return !!b && !b.disabled && /^Start:/.test(b.textContent.trim()) && !!h && /sends nothing outside PMOS/.test(h.textContent); }));
|
|
235
|
+
await p.click('#startBtn');
|
|
236
|
+
ok('W8 pressing Start asks to confirm and starts nothing yet', await p.evaluate(() => !!document.querySelector('#startGo') && /Start this agent session/.test(document.querySelector('#card').textContent)) && startBody === null);
|
|
237
|
+
await p.click('[data-start="no"]');
|
|
238
|
+
ok('W8 Not now goes back to the Start button', await p.evaluate(() => !!document.querySelector('#startBtn') && !document.querySelector('#startGo')) && startBody === null);
|
|
239
|
+
await p.click('#startBtn'); await p.click('#startGo');
|
|
240
|
+
ok('W8 confirming starts a draft session for that initiative, closes the dialog and raises the sessions badge', await until(() => startBody && p.evaluate(() => !document.querySelector('#dlg').classList.contains('on') && !document.querySelector('#sessBdg').hidden)) && startBody.task === 'draft' && !!startBody.initiative && !!startBody.what, JSON.stringify(startBody));
|
|
241
|
+
await p.unroute('**/api/agent/start');
|
|
242
|
+
await row0.focus(); await row0.press('Enter');
|
|
243
|
+
await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
|
|
233
244
|
await p.keyboard.press('Escape');
|
|
234
245
|
await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
235
246
|
// a decision row: no option is chosen for the PM, choosing one drafts the record, and "Not yet" is off
|
|
@@ -267,7 +278,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
267
278
|
await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
268
279
|
|
|
269
280
|
/* R10 */
|
|
270
|
-
ok('R10 a page where nothing was pressed to record sent only GET requests', A.reqs.every((r) => r.startsWith('GET ')), A.reqs.filter((r) => !r.startsWith('GET ')).join());
|
|
281
|
+
ok('R10 a page where nothing was pressed to record sent only GET requests (the one confirmed Start aside)', A.reqs.every((r) => r.startsWith('GET ') || r === 'POST /api/agent/start'), A.reqs.filter((r) => !r.startsWith('GET ')).join());
|
|
271
282
|
ok('0 no page error', A.errors.length === 0, A.errors.join(' | '));
|
|
272
283
|
|
|
273
284
|
/* slice 2: the buttons that record (initiative briefing-premium-writes). The POST routes are answered by the test, so no real file is written;
|
|
@@ -158,7 +158,7 @@ Each button writes one record, through a check that only a real press from this
|
|
|
158
158
|
|
|
159
159
|
Later today means three hours from now. Tomorrow and Next week mean 09:00, tomorrow and next Monday.
|
|
160
160
|
|
|
161
|
-
A decision needs your reason. A prototype or tripwire that already has a decision on record cannot be decided again from this page. A decided row leaves the list because the record changed. A merge has no run of its own, so its return button stays off and says so. The Start button on a blocked row
|
|
161
|
+
A decision needs your reason. A prototype or tripwire that already has a decision on record cannot be decided again from this page. A decided row leaves the list because the record changed. A merge has no run of its own, so its return button stays off and says so. The Start button on a blocked row asks you to confirm, then starts an agent session that drafts the next step. The session is listed in Agent sessions.
|
|
162
162
|
|
|
163
163
|
## Asking the agent
|
|
164
164
|
|
|
@@ -241,7 +241,7 @@ Insights is the fourth place on the rail, at `/premium-insights.html`. It reads
|
|
|
241
241
|
- **What stands out.** Up to three plain sentences taken from the series: behind its line for three readings in a row, behind and still moving away from the target, closing in, slipped, reached its target, or a large one-step move. There is no forecast and no cause.
|
|
242
242
|
- **No series recorded.** A KR metric with one reading or none is listed with the reason and is not drawn.
|
|
243
243
|
- **Ask PMOS to set up a report.** Type what the report is for and press **Ask**. A background run proposes a report and does nothing else. The request is listed as Working, then Ready to review. A ready request opens with its proposal: **Set it up**, **Change it** (say what to change; the run revises it), or **Cancel**.
|
|
244
|
-
- **Found in your work.** Up to three reports PMOS found in your calendar, mail or documents, each with why and what it saw. **Set it up** records the report and drafts its first cycle as a file. **Not a report** hides it and records it after 5 seconds, unless you press **Undo**.
|
|
244
|
+
- **Found in your work.** Up to three reports PMOS found in your calendar, mail or documents, each with why and what it saw. **Set it up** records the report and drafts its first cycle as a file. **Not a report** hides it and records it after 5 seconds, unless you press **Undo**. If the finding changed while the window was open, the window says what happened. It was already set up, it was marked not a report, or a new scan replaced it. The list is read again. Close the window and open the report from the list. If PMOS does not hear back, the window says nothing was recorded. Press the button to try again.
|
|
245
245
|
- **Set up.** Your recurring reports, with their schedule and next draft. A report opens with **Draft it now** (for a report drawn from your work) and **Pause** or **Resume**.
|
|
246
246
|
- **Documents.** The report files of the workspace, with cadence, slot and whether each is a draft or issued. Pressing one opens it on the page as a **Deck**: a title slide, then one slide for each section, with the arrow keys and a strip of slides. **Document** shows it as a page. **Present** shows the slide on the whole screen; the arrow keys move and Escape stops. **Download** gives PowerPoint, Word, Excel, CSV or the Markdown file; the files carry the words, not the look. **Print or save as PDF** prints one slide to a page. **Open in the console** is where a document is edited or issued. Nothing is sent from this page.
|
|
247
247
|
- **Shape a report's look.** On a draft, **Add a sample** takes a PDF, PowerPoint, Word, PNG or JPG file to follow. Say how it should look in the conversation; PMOS draws the next design version (D1, D2, …) and says what it changed. Press a version to go back to it. **This is it** saves the version shown as the report's design, and PMOS draws the cycle to match. An issued cycle is frozen with its look.
|
|
@@ -73,7 +73,7 @@ const fmRows = (fm) => (fm ? [['Lane', fm.lane], ['Anchor', fm.parent_kr], ['Sta
|
|
|
73
73
|
|
|
74
74
|
/* A record the builder cannot read must cost its own row or dialog and nothing more. tryD gives a dialog or null; a record that throws is skipped and counted,
|
|
75
75
|
* and the header says how many (never silently). */
|
|
76
|
-
const
|
|
76
|
+
const START_NOTE = 'Starting opens an agent session that drafts this for you to read. It sends nothing outside PMOS and you can stop it in Agent sessions.';
|
|
77
77
|
const tryD = (fn) => { try { return fn(); } catch { return null; } };
|
|
78
78
|
const skipped = { n: 0 };
|
|
79
79
|
|
|
@@ -100,11 +100,12 @@ function blockedRows(f) {
|
|
|
100
100
|
eye: 'Unblock', logTitle: 'Read from the repository',
|
|
101
101
|
log: ['Read the initiative record' + (i.record ? ' (' + i.record + ')' : ''), 'Ran the workflow order rules on it', 'Found the step that blocks it: ' + st.key],
|
|
102
102
|
say: i.id + ' is blocked at the ' + st.key + ' step.' + (st.rule ? ' The rule it does not meet: ' + clip(st.rule, 200) : ''),
|
|
103
|
-
hold:
|
|
103
|
+
hold: START_NOTE, head: 'The way through',
|
|
104
104
|
facts: [['Blocked at', st.key], ['Initiative', i.id], ['The check', st.rule && clip(st.rule, 200)], ['Record', i.record]].filter((x) => x[1]),
|
|
105
105
|
opts: st.next ? [{ k: 'next', t: clip(st.next[0].toUpperCase() + st.next.slice(1), 140), d: 'The next step on record.' }] : [],
|
|
106
106
|
sel: st.next ? 'next' : null,
|
|
107
107
|
nodef: st.next ? '' : 'No next step is on record.',
|
|
108
|
+
write: st.next ? { kind: 'start', initiative: i.id, what: clip(st.next, 200), ...(i.ws ? { ws: i.ws } : {}) } : undefined,
|
|
108
109
|
prim: { next: 'Start: ' + clip(st.next || '', 40) },
|
|
109
110
|
pane: { label: 'Initiative record', file: i.record || i.id, h: clip(i.title, 90), rows: fmRows(i.fm) },
|
|
110
111
|
})),
|
|
@@ -629,10 +629,32 @@ function fileFinding(file, input, { run, by, now } = {}) {
|
|
|
629
629
|
append(file, { ev: 'finding', id, run: run || null, pattern, name: x.name.trim(), why: x.why.trim(), evidence: ev.evidence, confidence: x.confidence, proposal: pr.proposal }, { now, by });
|
|
630
630
|
return { ok: true, result: 'filed', id };
|
|
631
631
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
632
|
+
/**
|
|
633
|
+
* Find the finding a page names. A page holds an id from its last read, so the ledger may have moved on: the finding was set up (here or in the console),
|
|
634
|
+
* marked not a report, or a later finder run filed the same report again under a new id. Returns { ok: true, finding, moved } (moved: found by name or
|
|
635
|
+
* pattern, not by id) or a refusal whose `reason` is set-up | dismissed | gone and whose text says what happened and what to do next.
|
|
636
|
+
*/
|
|
637
|
+
function lookupFinding(st, id, name) {
|
|
638
|
+
const q = (id == null ? '' : String(id)).slice(0, 80), nm = name ? slugOf(String(name)) : '';
|
|
639
|
+
const byId = st.findings.get(q);
|
|
640
|
+
const label = (f) => `"${String((f && f.name) || name || 'This report').slice(0, 80)}"`;
|
|
641
|
+
if (byId && byId.state === 'open') return { ok: true, finding: byId, moved: false };
|
|
642
|
+
const sameOpen = [...st.findings.values()].find((f) => f.state === 'open' && !isDismissed(st, f.pattern, f.name)
|
|
643
|
+
&& ((byId && (f.pattern === byId.pattern || slugOf(f.name) === slugOf(byId.name))) || (nm && slugOf(f.name) === nm)));
|
|
644
|
+
if (sameOpen) return { ok: true, finding: sameOpen, moved: true };
|
|
645
|
+
if (byId && byId.state === 'set-up') {
|
|
646
|
+
const s = [...st.setups.values()].find((x) => x.from && x.from.finding === byId.id);
|
|
647
|
+
return { ...refuse(409, `${label(byId)} is already set up${s ? ' as ' + s.id : ''}. Nothing more was recorded. Open it under Set up.`), reason: 'set-up' };
|
|
648
|
+
}
|
|
649
|
+
if (byId && byId.state === 'dismissed') return { ...refuse(409, `${label(byId)} was marked not a report, so it is hidden. Nothing was set up.`), reason: 'dismissed' };
|
|
650
|
+
const known = nm && [...st.setups.values()].find((x) => slugOf(x.name) === nm);
|
|
651
|
+
if (known) return { ...refuse(409, `${label()} is already set up as ${known.id}. Nothing more was recorded. Open it under Set up.`), reason: 'set-up' };
|
|
652
|
+
return { ...refuse(404, `${label()} is no longer in the report ledger; a rescan may have replaced it. Nothing was recorded. The list has refreshed: open it again from Found in your work.`), reason: 'gone' };
|
|
653
|
+
}
|
|
654
|
+
function dismissFinding(file, { id, name, by, now }) {
|
|
655
|
+
const l = lookupFinding(fold(readLines(file)), id, name);
|
|
656
|
+
if (!l.ok) return l.reason === 'dismissed' ? { ok: true, unchanged: true } : l;
|
|
657
|
+
append(file, { ev: 'finding-dismiss', id: l.finding.id, pattern: l.finding.pattern }, { now, by });
|
|
636
658
|
return { ok: true };
|
|
637
659
|
}
|
|
638
660
|
function setFinder(file, { cadence, sources, by, now }) {
|
|
@@ -738,6 +760,6 @@ module.exports = {
|
|
|
738
760
|
ledgerFile, stateDir, append, readLines, fold, stateOf, openFindings, isDismissed, slugOf, patternOf, checkProposal, checkEvidence, checkSchedule,
|
|
739
761
|
scheduleLabel, scheduleOf, firstSlot, initialLastRun, nextDraftAt, definitionText, writeDefinition, definitionsOf, definitionFile, shaOf,
|
|
740
762
|
fileScheduleStore, scheduleFor, registerSchedule, updateSchedule, unregisterSchedule,
|
|
741
|
-
setUp, change, pause, resume, remove, askStart, askChange, askCancel, askEnd, fileProposal, findStart, findEnd, fileFinding, dismissFinding, setFinder,
|
|
763
|
+
setUp, change, pause, resume, remove, askStart, askChange, askCancel, askEnd, fileProposal, findStart, findEnd, fileFinding, dismissFinding, lookupFinding, setFinder,
|
|
742
764
|
writeDocument, frameMarkdown, migrate, migratedKeys, dashboardKeys, dashTitle, keyOfSource, longDate, localDay,
|
|
743
765
|
};
|
|
@@ -309,7 +309,7 @@ async function handle(req, res, url, ctx) {
|
|
|
309
309
|
const root = w.root;
|
|
310
310
|
const file = RS.ledgerFile(root);
|
|
311
311
|
const opts = { by: g.actor, wsId: w.id, scheduleStore: ctx.scheduleStore };
|
|
312
|
-
const fail = (r) => send(
|
|
312
|
+
const fail = (r) => send({ status: r.status || 400, body: { ok: false, error: r.error, ...(r.reason ? { reason: r.reason } : {}) } });
|
|
313
313
|
|
|
314
314
|
if (sub === 'ask') {
|
|
315
315
|
if (typeof ctx.spawnSession !== 'function' || headless.kindFor({ agent: 'claude', origin: 'report-setup:probe' }) !== 'report-setup') {
|
|
@@ -343,7 +343,7 @@ async function handle(req, res, url, ctx) {
|
|
|
343
343
|
const st = RS.fold(RS.readLines(file));
|
|
344
344
|
let from = null; let base = null;
|
|
345
345
|
if (body.ask) { const a = st.asks.get(text(body.ask)); if (!a) return send(bad(404, 'no such request')); from = { ask: a.id }; base = a.proposal; }
|
|
346
|
-
else if (body.finding) { const
|
|
346
|
+
else if (body.finding) { const l = RS.lookupFinding(st, text(body.finding), text(body.name)); if (!l.ok) return send({ status: l.status, body: { ok: false, error: l.error, reason: l.reason } }); from = { finding: l.finding.id }; base = l.finding.proposal; }
|
|
347
347
|
const proposal = body.proposal && typeof body.proposal === 'object' && !Array.isArray(body.proposal) ? body.proposal : base;
|
|
348
348
|
if (!proposal) return send(bad(400, 'say which request or finding to set up, or give the proposal'));
|
|
349
349
|
const r = RS.setUp(root, { ...proposal, ...(from ? { from } : {}) }, opts);
|
|
@@ -356,7 +356,7 @@ async function handle(req, res, url, ctx) {
|
|
|
356
356
|
return send({ status: 200, body: { ok: true, setup: setupOut(r.setup, new Date(), documentsOf(ctx, w), copyIndex(root), root), first_draft: r.first_draft, drafted } });
|
|
357
357
|
}
|
|
358
358
|
if (sub === 'dismiss') {
|
|
359
|
-
const r = RS.dismissFinding(file, { id: text(body.finding), by: g.actor });
|
|
359
|
+
const r = RS.dismissFinding(file, { id: text(body.finding), name: text(body.name), by: g.actor });
|
|
360
360
|
if (!r.ok) return fail(r);
|
|
361
361
|
return send({ status: 200, body: { ok: true } });
|
|
362
362
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.286.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.286.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -256,11 +256,17 @@ function repDlg(o) {
|
|
|
256
256
|
closeDlg(); await load();
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
|
+
/* Words for a refused press: what the server said, then how to go on. A reason (set-up | dismissed | gone) means the list this window came from is out of date, so it is read again and a retry would only repeat the refusal. */
|
|
260
|
+
const pressFailed = (res, plain) => {
|
|
261
|
+
const e = res && res.error ? String(res.error) : plain;
|
|
262
|
+
if (res && res.reason) return e + ' This window is out of date. Close it; the list has been read again.';
|
|
263
|
+
return e + ' Nothing was recorded. Press the button to try again.';
|
|
264
|
+
};
|
|
259
265
|
/* A press: post, then say the result in words, or keep the dialog open with the server's refusal. */
|
|
260
266
|
const press = (sub, body, said) => async (m) => {
|
|
261
267
|
m.textContent = 'Recording.';
|
|
262
268
|
const res = await repPost(sub, body);
|
|
263
|
-
if (!res || res.ok !== true) { m.textContent = (res
|
|
269
|
+
if (!res || res.ok !== true) { m.textContent = pressFailed(res, 'That did not go through.'); if (res && res.reason) load(); return 'keep'; }
|
|
264
270
|
toast(typeof said === 'function' ? said(res) : said); return null;
|
|
265
271
|
};
|
|
266
272
|
const setupSaid = (res) => { const d = res.drafted || {}; return 'Set up. ' + (d.path ? 'The first draft is ' + d.path + '.' : 'The first draft was not written' + (d.error ? ': ' + d.error : '') + '. Draft it now on the report tries again.'); };
|
|
@@ -271,9 +277,9 @@ function openFound(f) {
|
|
|
271
277
|
html: `<p class="lede" style="margin:0 0 12px">${esc(f.why)}</p>${propHtml(f.proposal)}<h3 class="h2">What PMOS saw · ${f.evidence.length}</h3><ul class="pdev">${f.evidence.map((x) => `<li>${esc(x.text)}${x.kind ? ` <small>${esc(x.kind)}</small>` : ''}</li>`).join('')}</ul><p class="note">Set it up records the report in the report ledger and drafts its first cycle as a file. Not a report hides it; you can undo for 5 seconds.</p>`,
|
|
272
278
|
acts: [['set', 'Set it up'], ['no', 'Not a report', 1]],
|
|
273
279
|
on: {
|
|
274
|
-
set: press('setup', { finding: f.id }, setupSaid),
|
|
280
|
+
set: press('setup', { finding: f.id, name: f.name }, setupSaid),
|
|
275
281
|
no: (m) => {
|
|
276
|
-
const t = setTimeout(async () => { dismissing.delete(f.id); const res = await repPost('dismiss', { finding: f.id }); if (!res || res.ok !== true) toast((res
|
|
282
|
+
const t = setTimeout(async () => { dismissing.delete(f.id); const res = await repPost('dismiss', { finding: f.id, name: f.name }); if (!res || res.ok !== true) toast(pressFailed(res, 'Not a report did not go through.')); await load(); }, 5000);
|
|
277
283
|
dismissing.set(f.id, t); drawReps();
|
|
278
284
|
m.innerHTML = 'Hidden. It is recorded as not a report in 5 seconds. <button class="lk" id="rxUndo">Undo</button>';
|
|
279
285
|
$('#rxUndo').onclick = () => { clearTimeout(dismissing.get(f.id)); dismissing.delete(f.id); drawReps(); m.textContent = 'Undone. Nothing was recorded.'; $$('#oMain [data-rx]').forEach((x) => { x.disabled = false; }); };
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Slice 2 (initiative briefing-premium-writes): the buttons that record the PM's own calls post to /api/briefing-premium/{decide,put-off,return}.
|
|
4
4
|
* Slice 3: the reply box asks a read-only agent. A control with nothing honest to write stays disabled and says why. */
|
|
5
5
|
import { pmPost, pmGet } from './http.js';
|
|
6
|
+
import { startAgent } from './page-agent.js';
|
|
6
7
|
import { mountMeeting } from './premium-meeting.js';
|
|
7
8
|
import { mountFirst } from './premium-first.js';
|
|
8
9
|
import { lineItems, behindOf, refreshTargets, whenRead } from './freshness-words.js';
|
|
@@ -111,6 +112,7 @@ document.addEventListener('click', (e) => {
|
|
|
111
112
|
function drawDock() { $('#dN').textContent = M.dock.needs == null ? '·' : M.dock.needs; $('#dLab').textContent = M.dock.needs == null ? 'still reading' : M.dock.needs === 0 ? 'need you' : M.dock.label; }
|
|
112
113
|
|
|
113
114
|
const SEL = {}; // the option chosen on each row, for this session
|
|
115
|
+
const START = {}; // 'ask' while the PM is confirming a start, by row key
|
|
114
116
|
const RET = {}; // the reason chosen for returning a run, by row key
|
|
115
117
|
const WHY = {}; // what the PM typed in the reason box, by row key (kept across a redraw and across a refused press)
|
|
116
118
|
const RET_REASONS = ['wrong facts', 'wrong scope', 'not now', 'too long'];
|
|
@@ -138,6 +140,10 @@ function cardHtml(r) {
|
|
|
138
140
|
if (w && w.kind === 'return') {
|
|
139
141
|
return `${head}<p class="ct">Return this run: why</p><div class="seg2" id="retWhy">${RET_REASONS.map((x) => `<button data-ret="${esc(x)}" aria-pressed="${RET[r.key] === x}">${esc(x)}</button>`).join('')}</div>${err}<div class="cact"><button class="cta" id="recBtn" data-rec="return" disabled>${CHECK}<span>${esc(d.action)}</span></button></div></div>`;
|
|
140
142
|
}
|
|
143
|
+
if (w && w.kind === 'start') {
|
|
144
|
+
const ask = START[r.key] === 'ask';
|
|
145
|
+
return `${head}${opts}${err}${ask ? `<p class="nodef">Start this agent session? It drafts “${esc(w.what)}” for you to read and sends nothing outside PMOS.</p><div class="cact" id="cardAct"><button class="cta" id="startGo" data-start="go">${CHECK}<span>Start the session</span></button><button class="cta alt" data-start="no">Not now</button></div>` : `<div class="cact" id="cardAct"><button class="cta" id="startBtn" data-start="ask">${CHECK}<span>${esc(d.prim[d.sel])}</span></button></div>${d.hold ? holdNote(d.hold) : ''}`}</div>`;
|
|
146
|
+
}
|
|
141
147
|
if (d.opts.length) return `${head}${opts}${d.nodef ? `<p class="nodef">${esc(d.nodef)}</p>` : ''}<div class="cact" id="cardAct"><button class="cta" disabled title="${esc(d.hold || 'Nothing here can be recorded yet.')}">${o ? esc(d.prim[o.k]) : 'Your call: choose one'}</button></div>${d.hold ? holdNote(d.hold) : ''}</div>`;
|
|
142
148
|
if (d.link) return `${head}<div class="cact"><a class="cta" id="srcLink" href="${esc(d.link)}" target="_blank" rel="noopener noreferrer">${esc(d.linkLabel || 'Open the source')}</a></div></div>`;
|
|
143
149
|
return `${head}${d.nodef ? `<p class="nodef">${esc(d.nodef)}</p>` : ''}${d.action ? `<div class="cact"><button class="cta" disabled title="${esc(d.hold || 'Nothing here can be recorded.')}">${CHECK}${esc(d.action)}</button></div>${d.hold ? holdNote(d.hold) : ''}` : ''}</div>`;
|
|
@@ -185,6 +191,19 @@ $('#dBody').addEventListener('click', (e) => {
|
|
|
185
191
|
if (!openR) return;
|
|
186
192
|
const op = e.target.closest('[data-op]');
|
|
187
193
|
if (op) { WHY[openR.key] = ($('#why') || {}).value || ''; SEL[openR.key] = op.dataset.op; $('#card').outerHTML = cardHtml(openR); $('#oMain').innerHTML = paneHtml(openR); ctaState(openR); return; }
|
|
194
|
+
const st = e.target.closest('[data-start]');
|
|
195
|
+
if (st) {
|
|
196
|
+
const key = openR.key, w = openR.dialog.write;
|
|
197
|
+
if (st.dataset.start === 'ask') { START[key] = 'ask'; $('#card').outerHTML = cardHtml(openR); return; }
|
|
198
|
+
if (st.dataset.start === 'no') { delete START[key]; $('#card').outerHTML = cardHtml(openR); return; }
|
|
199
|
+
$$('#card button').forEach((b) => { b.disabled = true; });
|
|
200
|
+
startAgent({ ws: w.ws || new URLSearchParams(location.search).get('ws') || undefined, task: 'draft', initiative: w.initiative, what: w.what }).then((res) => {
|
|
201
|
+
if (!res.ok) { $$('#card button').forEach((b) => { b.disabled = false; }); showErr('Not started: ' + res.error); return; }
|
|
202
|
+
delete START[key]; toast('The agent started. It is listed in Agent sessions, and its draft waits for you to read.'); closeDlg();
|
|
203
|
+
const bd = $('#sessBdg'); if (bd) { bd.textContent = String((+bd.textContent || 0) + 1); bd.hidden = false; }
|
|
204
|
+
});
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
188
207
|
const rt = e.target.closest('[data-ret]');
|
|
189
208
|
if (rt) { WHY[openR.key] = ($('#why') || {}).value || ''; RET[openR.key] = rt.dataset.ret; $('#card').outerHTML = cardHtml(openR); ctaState(openR); return; }
|
|
190
209
|
const un = e.target.closest('[data-until]');
|