create-pmos 0.283.0 → 0.285.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.283.0",
3
+ "version": "0.285.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": {
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@f4c3796
1
+ kernel-source: pmos@5f35d52
2
2
  assembled: 2026-10-19
3
3
  mode: vendor
@@ -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-19T02:39:02Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T02:58:44Z"}
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-19T02:39:02Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T02:58:44Z"}
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-19T02:39:02Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T02:58:44Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -118,7 +118,7 @@ const SUGGEST = { ok: true, suggested: [{ kind: 'pmos-doc', ref: 'planning/prd/p
118
118
  const p = A.page;
119
119
 
120
120
  /* M1 the sheet */
121
- ok('M2 each removable row has Remove, and the row says its scope', await p.evaluate(() => { const b = document.querySelector('.mtg-rm'); return !!b && /Roadmap/.test(b.getAttribute('aria-label')) && /document itself is not changed/.test(b.title) && /for this meeting/.test(b.closest('li').textContent); }));
121
+ ok('M2 each removable row has Remove, and the row says its scope', await p.evaluate(() => { const b = document.querySelector('.mtg-rm'); return !!b && /Roadmap/.test(b.getAttribute('aria-label')) && /document itself is not changed/.test(b.title) && /for this meeting/.test(b.closest('.mat').textContent); }));
122
122
  await p.click('#mmAdd');
123
123
  const sheet = await until(() => p.evaluate(() => { const s = document.querySelector('.mtg-sheet'); return s && /Premium UX PRD/.test(s.textContent) ? s.textContent : null; }));
124
124
  ok('M1 the sheet opens in the dialog with Suggested, Find in PMOS and Or paste a link', sheet && /Suggested for this meeting/.test(sheet) && /Find in PMOS/.test(sheet) && /Or paste a link/.test(sheet), String(sheet).slice(0, 200));
@@ -219,10 +219,11 @@ const SUGGEST = { ok: true, suggested: [{ kind: 'pmos-doc', ref: 'planning/prd/p
219
219
  const css = (page, sel) => page.evaluate((s) => { const e = document.querySelector(s); if (!e) return null; const c = getComputedStyle(e); return ['fontWeight', 'borderRadius'].map((k) => c[k]).join('|'); }, sel);
220
220
  const mk = await browser.newContext({ viewport: { width: 1280, height: 900 } }); const mp = await mk.newPage();
221
221
  await mp.setContent(MOCKUP); await mp.waitForTimeout(500);
222
- const ctaM = await mp.evaluate(() => { const b = document.createElement('button'); b.className = 'cta'; document.body.appendChild(b); const c = getComputedStyle(b); return c.fontWeight + '|' + c.borderRadius; }), F1 = await open(), addB = await css(F1.page, '#mmAdd');
222
+ const ctaM = await mp.evaluate(() => { const b = document.createElement('button'); b.className = 'cta'; document.body.appendChild(b); const c = getComputedStyle(b); return c.fontWeight + '|' + c.borderRadius; });
223
+ const addM = await mp.evaluate(() => { const b = document.createElement('button'); b.className = 'addb'; document.body.appendChild(b); const c = getComputedStyle(b); return c.fontWeight + '|' + c.borderRadius; }), F1 = await open(), addB = await css(F1.page, '#mmAdd');
223
224
  await F1.page.click('#mmAdd'); await until(() => F1.page.evaluate(() => /Premium UX PRD/.test(document.querySelector('#mmSug').textContent))); await F1.page.click('#mmSug [data-pick]');
224
225
  const doB = await css(F1.page, '#mmDo');
225
- ok('M7 fidelity: the buttons keep the mockup\'s pill radius and weight', ctaM && addB && addB === ctaM && doB === ctaM, ctaM + ' vs ' + addB + ' / ' + doB);
226
+ ok('M7 fidelity: the buttons keep the mockup\'s pill radius and weight', ctaM && addB && addB === addM && doB === ctaM, ctaM + ' / ' + addM + ' vs ' + addB + ' / ' + doB);
226
227
  const labM = await mp.evaluate(() => { const e = document.querySelector('.label'); return e ? getComputedStyle(e).fontSize + '|' + getComputedStyle(e).textTransform : null; });
227
228
  const labP = await F1.page.evaluate(() => { const e = document.querySelector('.mtg-sec .label'); return e ? getComputedStyle(e).fontSize + '|' + getComputedStyle(e).textTransform : null; });
228
229
  ok('M7 fidelity: a sheet section label uses the mockup\'s label type', labM && labP && labM === labP, labM + ' vs ' + labP);
@@ -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
- ok('W8 the start button of a blocked row is disabled and says why, in words and in its title', await p.evaluate(() => { const b = document.querySelector('#card .cta'); const h = document.querySelector('#holdWhy'); return !!b && b.disabled && /live conversation/.test(b.title) && !!h && /live conversation/.test(h.textContent); }));
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 stays off until the live conversation arrives in the next slice.
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
 
@@ -266,3 +266,5 @@ The premium Briefing is the default page: `/` and `/index.html` open it. The con
266
266
  On a phone or tablet (under 1000 px) every dialog opens on **Detail**. A **Detail / Conversation** switch sits under the title, and **Open it** at the foot of Detail brings the conversation when an action waits there. The header holds only **Close**. A document sheet picks its view (**Read**, **Edit**, **Proposals**, **Edit log**, **Health**) from one button with a menu.
267
267
 
268
268
  A dialog's detail panel opens with the record's path, its heading and one lead line. A decision's evidence reads as a list. A measure's dialog draws the measure's chart above its facts and readings.
269
+
270
+ A calendar meeting's panel follows the mockup's Design review panel: the title with a status chip (when it starts, on now, or done), **Focus** and **Record**, **Prepared for you** (what it is about, people, material and the last meeting, each Ready only when PMOS holds that record), **Material** with **Add material**, **Previous meetings** and **Topics**. What Record and Focus do is one press away under **What Record does** and **What Focus reads**.
@@ -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 START_HOLD = 'Starting an agent from here arrives with the live conversation (the next slice).';
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: START_HOLD, head: 'The way through',
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
  })),
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.283.0",
3
+ "version": "0.285.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.283.0",
9
+ "version": "0.285.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.283.0",
3
+ "version": "0.285.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@ export function weekView(r, today) {
43
43
  }
44
44
 
45
45
  /** The meeting dialog's sections. `row` is a weekView row; `replay` is { state:'none'|'ok'|'error', body }; `material` is { state, items }. Nothing here is invented. */
46
- export function meetingView(row, replay, material) {
46
+ export function meetingView(row, replay, material, extra) {
47
47
  const rep = replay && replay.state === 'ok' ? replay.body : null;
48
48
  const people = row.who && row.who.length ? row.who : (rep && rep.meeting && Array.isArray(rep.meeting.attendees) ? rep.meeting.attendees : []);
49
49
  const keys = rep && Array.isArray(rep.keys) ? rep.keys : [];
@@ -57,11 +57,43 @@ export function meetingView(row, replay, material) {
57
57
  notesLine: !replay ? 'Reading the notes.' : replay.state === 'error' ? 'The notes could not be read: ' + clip(replay.error, 120) : replay.state === 'none' ? 'No notes for this meeting.' : '',
58
58
  replay: rep && (rep.audio || heard) ? { minutes: heard, keyPoints: keys.length, lines: Array.isArray(rep.lines) ? rep.lines.length : 0 } : null,
59
59
  material: material && material.state === 'ok' ? (material.items || []).map((i, n) => ({ n, title: clip(i.title || i.ref || i.url, 120), kind: i.kind || '', topic: clip(i.topic, 80), scope: i.scope === 'series' ? 'every meeting of this series' : 'this meeting', removable: i.from === 'you' && (i.scope === 'series' || i.scope === 'meeting'), line: removeLine(i) })) : null,
60
+ ...prepOf(row, people, material, extra, aboutOf(row.level)),
60
61
  materialLine: !material ? 'Reading the material.' : material.state === 'error' ? 'The material could not be read: ' + clip(material.error, 120) : (material.items || []).length ? '' : 'No material is linked to this meeting.',
61
62
  row,
62
63
  };
63
64
  }
64
65
 
66
+ /** The meetings before this one in its series, from GET /api/notes/series: the date, what was decided and how many next steps it added. Newest first. */
67
+ export function prevOf(series, row) {
68
+ const ms = series && series.ok === true && series.series && Array.isArray(series.series.meetings) ? series.series.meetings : [];
69
+ const at = Date.parse(row.at);
70
+ return ms.filter((m) => m && Number.isFinite(Date.parse(m.at)) && Date.parse(m.at) < at - 60000).slice(0, 5)
71
+ .map((m) => ({ id: m.id, date: (() => { const t = new Date(m.at); return t.getDate() + ' ' + MON[t.getMonth()]; })(), decided: Number(m.decisions) || 0, steps: Number(m.new_actions) || 0, overview: clip(m.overview, 160) }));
72
+ }
73
+ /** The chips next to the title: when it starts, or that it is on or done. Only what the clock and the note say. */
74
+ export function statusChips(row, note, now = Date.now()) {
75
+ const out = [], at = Date.parse(row.at);
76
+ if (note && note.state === 'recording') return [{ text: 'Recording', kind: 'bad' }];
77
+ if (note && note.state === 'paused') return [{ text: 'Paused', kind: 'warn' }];
78
+ if (note && note.state === 'ended') return [{ text: 'Done', kind: 'ok' }];
79
+ if (!hasTime(row.at)) return out;
80
+ if (now < at) { const m = Math.max(1, Math.round((at - now) / 60000)); out.push({ text: 'Starts in ' + (m < 60 ? m + ' min' : Math.floor(m / 60) + ' h' + (m % 60 ? ' ' + (m % 60) + ' min' : '')), kind: m <= 60 ? 'warn' : '' }); }
81
+ else if (row.past || (Number.isFinite(Date.parse(row.end)) && now > Date.parse(row.end))) out.push({ text: 'Done', kind: 'ok' });
82
+ else out.push({ text: 'On now', kind: 'bad' });
83
+ return out;
84
+ }
85
+ /** "Prepared for you": one row per thing PMOS can say it holds for this meeting. A row is ready only when its record exists. */
86
+ function prepOf(row, people, material, extra, about) {
87
+ const mats = material && material.state === 'ok' ? material.items || [] : [], prev = (extra && extra.prev) || [];
88
+ const rows = [
89
+ { ic: 'link', l: 'What it is about', ok: !!about, text: about || (row.past ? 'The calendar answer holds no link for an earlier meeting.' : 'Not linked yet.'), about: true },
90
+ { ic: 'user', l: 'People', ok: people.length > 0, text: people.length ? '' : 'The calendar lists no other people.', people: people.slice(0, 12) },
91
+ { ic: 'doc', l: 'Material', ok: mats.length > 0, text: mats.length ? '' : !material ? 'Reading the material.' : 'No material is linked to this meeting.', chips: mats.slice(0, 3).map((i) => clip(i.title || i.ref || i.url, 40)) },
92
+ { ic: 'clock', l: 'Last time', ok: prev.length > 0, text: prev.length ? prev[0].date + ' · ' + prev[0].decided + ' decided' + (prev[0].overview ? ' · ' + prev[0].overview : '') : 'No earlier notes of this meeting are kept.' },
93
+ ];
94
+ return { prep: rows, prepReady: rows.filter((r) => r.ok).length, prev, planned: (extra && extra.topics) || [] };
95
+ }
96
+
65
97
  /** The body of POST /api/calendar-links for a choice made in the dialog: 'portfolio', 'none', 'board|<ws>|<id>' or 'initiative|<id>'. */
66
98
  export function linkBody(row, choice, boards) {
67
99
  const event = { title: row.title, ...(row.series ? { series: row.series } : {}) };
@@ -359,33 +391,45 @@ export function mountMeeting(d) {
359
391
  else if (st.mode === 'stale') h = `<div class="m3-row"><b>Marked recording</b>${b('resume', 'Resume')}${b('stop', 'Stop')}</div><p class="note">The server holds this meeting as recording, but this page is not capturing audio. Resume starts listening again.</p>`;
360
392
  else if (st.mode === 'paused') h = `<div class="m3-row"><b>Paused</b>${n && n.resume_until ? `<span class="note">Open until ${esc(hhmm(n.resume_until))}</span>` : ''}${b('resume', 'Resume')}${b('stop', 'Stop')}</div><p class="note">${esc(RESUME_LINE)}</p>`;
361
393
  else if (st.mode === 'ended') h = '<p class="note">The recording of this meeting has ended. A stopped meeting cannot be recorded again.</p>';
362
- else if (recordable(row)) h = `<div class="m3-row">${b('rec', 'Record', 'cta')}</div><p class="note">${esc(RECORD_LINE)}</p>`;
394
+ else if (recordable(row)) h = `<button class="addb pri" data-m3="rec" title="${esc(RECORD_LINE)}">${ic('mic')}Record</button><button class="whyb" data-m3="why" aria-expanded="false">What Record does</button><p class="note why" hidden>${esc(RECORD_LINE)}</p>`;
363
395
  return h + msg;
364
396
  }
365
- const actsHtml = (row, ui) => `<div class="m3-acts"><div id="m3Rec">${recBarHtml(row, ui)}</div><div class="m3-row"><button class="mtg-b" data-m3="focus">Focus</button></div><p class="note">${esc(FOCUS_LINE)}</p></div>`;
397
+ const actsHtml = (row, ui) => `<div class="acts2"><button class="addb" data-m3="focus" title="${esc(FOCUS_LINE)}">${ic('scale')}Focus</button><div id="m3Rec" class="m3r">${recBarHtml(row, ui)}</div><button class="whyb" data-m3="why" aria-expanded="false">What Focus reads</button><p class="note why" hidden>${esc(FOCUS_LINE)}</p></div>`;
366
398
 
367
399
  /* the dialog */
368
400
  const sec = (label, body) => `<div class="mtg-sec"><span class="label">${esc(label)}</span>${body}</div>`;
401
+ const IC = { spark: '<path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/>', clock: '<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>', scale: '<path d="M12 4v16M6 20h12M5 8h14M5 8l-2 6a3 3 0 0 0 4 0zM19 8l-2 6a3 3 0 0 0 4 0z"/>', doc: '<path d="M7 3h7l4 4v14H7zM14 3v4h4"/>', user: '<circle cx="12" cy="8" r="4"/><path d="M4 21c1-4 4-6 8-6s7 2 8 6"/>', link: '<path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/>', mic: '<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0M12 18v3"/>', plus: '<path d="M12 5v14M5 12h14"/>', x: '<path d="M6 6l12 12M18 6 6 18"/>', check: '<path d="M5 12.5l4.5 4.5L19 7.5"/>' };
402
+ const ic = (n) => `<svg class="i" viewBox="0 0 24 24">${IC[n]}</svg>`;
403
+ const secH = (t, tag, extra) => `<h4 class="sh">${esc(t)}${tag ? ` <small>${esc(tag)}</small>` : ''}${extra || ''}</h4>`;
369
404
  const items = (L, task) => `<ul class="mtg-l">${L.map((x, i) => `<li>${esc(x.text)}${x.owner || x.due ? `<em>${esc([x.owner, x.due].filter(Boolean).join(' · '))}</em>` : ''}${task ? `<button class="mtg-b mtg-task" data-task="${i}"${task.done.has(i) ? ' disabled' : ''}>${task.done.has(i) ? 'Task made' : 'Make task'}</button>` : ''}</li>`).join('')}</ul>`;
370
405
  const pickLi = (it, key, on) => `<li class="mtg-pick"><span>${esc(clip(it.title, 120))}<em>${esc([it.kind, it.meta].filter(Boolean).join(' · '))}</em></span>${on ? '<span class="mtg-on">Picked</span>' : `<button class="mtg-b" data-pick="${esc(key)}">Pick</button>`}</li>`;
371
406
 
372
407
  function detailHtml(v, boards, inis, saved, ui) {
373
- const r = v.row, lv = r.level;
408
+ const r = v.row, lv = r.level, note = noteOfRow(NR, r);
374
409
  const aboutNow = lv ? aboutOf(lv) : saved || '';
375
410
  const opts = [['', aboutNow ? 'Change what it is about' : 'Choose what it is about'], ['portfolio', 'Portfolio']].concat(boards.map((b) => ['board|' + b.ws + '|' + b.id, 'Board: ' + b.name]), inis.map((i) => ['initiative|' + i.id, 'Initiative: ' + i.name]), [['none', 'Remove the link']]);
376
- const about = `<p>${aboutNow ? 'It is about <b>' + esc(aboutNow) + '</b>.' + (lv && lv.why ? ' ' + esc(lv.why) + '.' : '') : (r.past ? 'The calendar answer holds no link for an earlier meeting.' : 'Not linked to anything yet.')}</p>
377
- <div class="mtg-link"><select id="mtgSel" aria-label="What this meeting is about">${opts.map(([val, t]) => `<option value="${esc(val)}">${esc(t)}</option>`).join('')}</select><button class="cta" id="mtgLink" disabled>Link it</button></div>
411
+ const link = `<div class="mtg-link"><select id="mtgSel" aria-label="What this meeting is about">${opts.map(([val, t]) => `<option value="${esc(val)}">${esc(t)}</option>`).join('')}</select><button class="addb pri" id="mtgLink" disabled>Link it</button></div>
378
412
  <p class="note" id="mtgMsg" role="status">The link applies to every occurrence of “${esc(r.title)}”. The calendar itself is never written.</p>`;
379
413
  const n = v.notes;
380
414
  const task = n && n.actions.length ? { done: ui.tasked } : null;
381
- const notes = v.notesLine ? `<p class="note">${esc(v.notesLine)}</p>` : [n.title ? `<p><b>${esc(n.title)}</b></p>` : '',
415
+ const notes = v.notesLine ? `<p class="mut">${esc(v.notesLine)}</p>` : [n.title ? `<p><b>${esc(n.title)}</b></p>` : '',
382
416
  n.decisions.length ? `<h4 class="mtg-h">Decisions ${n.decisions.length}</h4>${items(n.decisions)}` : '', n.actions.length ? `<h4 class="mtg-h">Next steps ${n.actions.length}</h4>${items(n.actions, task)}` : '',
383
- n.questions.length ? `<h4 class="mtg-h">Open questions ${n.questions.length}</h4>${items(n.questions)}` : '', (n.decisions.length + n.actions.length + n.questions.length) ? '' : '<p class="note">The note holds no decisions, next steps or questions yet.</p>'].join('');
384
- const mat = (v.materialLine ? `<p class="note">${esc(v.materialLine)}</p>` : `<ul class="mtg-l">${v.material.map((m) => `<li>${esc(m.title)}<em>${esc([m.kind, 'for ' + m.scope, m.topic ? 'on ' + m.topic : ''].filter(Boolean).join(' · '))}</em>${m.removable ? `<button class="mtg-b mtg-rm" data-rm="${m.n}" aria-label="Remove ${esc(m.title)}" title="${esc(m.line)}">Remove</button>` : ''}</li>`).join('')}</ul>`)
385
- + `<div class="mtg-foot"><button class="mtg-b" id="mmAdd">Add material</button><span class="note">Your calendar invite is not changed.</span></div>`;
386
- const rep = v.replay ? `<p>A recording is kept: ${v.replay.minutes ? v.replay.minutes + ' min, ' : ''}${v.replay.keyPoints} key ${v.replay.keyPoints === 1 ? 'point' : 'points'}.</p><div class="mtg-foot"><button class="cta" data-m3="replay">Replay</button><span class="note">Plays the note’s audio kept on this machine, with the transcript and the key points.</span></div>` : '';
417
+ n.questions.length ? `<h4 class="mtg-h">Open questions ${n.questions.length}</h4>${items(n.questions)}` : '', (n.decisions.length + n.actions.length + n.questions.length) ? '' : '<p class="mut">The note holds no decisions, next steps or questions yet.</p>'].join('');
418
+ const person = (nm) => `<span class="pp"><i class="av2">${esc(String(nm).trim().charAt(0).toUpperCase())}</i>${esc(clip(nm, 40))}</span>`;
419
+ const prow = (x) => `<div class="prow"><span class="pi${x.ok ? '' : ' w'}">${ic(x.ic)}</span><div><b>${esc(x.l)}</b><div class="pv">${x.about && aboutNow ? '<span>It is about <b>' + esc(aboutNow) + '</b>.' + (lv && lv.why ? ' ' + esc(lv.why) + '.' : '') + '</span>' : x.people ? x.people.map(person).join('') : x.chips && x.chips.length ? x.chips.map((c) => `<span class="chp sm">${ic('doc')}${esc(c)}</span>`).join('') : '<span>' + esc(x.text) + '</span>'}</div>${x.about ? link : ''}</div>${x.ok ? '<span class="chp ok sm"><i></i>Ready</span>' : '<span class="chp warn sm"><i></i>Not yet</span>'}</div>`;
420
+ const ready = v.prepReady;
421
+ const prep = secH('Prepared for you', ready === v.prep.length ? 'all ready' : ready + ' of ' + v.prep.length + ' ready') + `<div class="prows">${v.prep.map(prow).join('')}</div>`;
422
+ const mats = v.materialLine ? `<p class="mut">${esc(v.materialLine)}</p>` : `<div class="mats">${v.material.map((m) => `<div class="mat"><span class="kd">${esc(m.kind || 'link')}</span><div><b>${esc(m.title)}</b><small>${esc([m.topic, 'for ' + m.scope].filter(Boolean).join(' · '))}</small></div><span class="mb">${m.removable ? `<button class="ib2 mtg-rm" data-rm="${m.n}" aria-label="Remove ${esc(m.title)}" title="${esc(m.line)}">${ic('x')}</button>` : ''}</span></div>`).join('')}</div>`;
423
+ const mat = secH('Material', v.material && v.material.length ? v.material.length + ' linked' : '', `<button class="addb" id="mmAdd" title="Your calendar invite is not changed.">${ic('plus')}Add material</button>`) + mats;
424
+ const prev = secH('Previous meetings', v.prev.length ? v.prev.length + ' before this' : '') + (v.prev.length ? `<div class="prevs">${v.prev.map((p) => `<div class="pvx"><div class="pvh"><time>${esc(p.date)}</time><span>${p.decided} decided</span><span>${p.steps} new next ${p.steps === 1 ? 'step' : 'steps'}</span></div></div>`).join('')}</div>` : '<p class="mut">No earlier notes of this meeting are kept.</p>');
425
+ const tops = secH('Topics', v.planned.length ? 'planned' : '') + (v.planned.length ? `<div class="tops">${v.planned.map((t, i) => `<div class="tp plan"><i>${i + 1}</i><span>${esc(clip(t.text, 120))}</span><small>planned</small></div>`).join('')}</div>` : '<p class="mut">The meeting has no topics yet.</p>');
426
+ const rep = v.replay ? secH('Replay', 'kept on this machine') + `<p>A recording is kept: ${v.replay.minutes ? v.replay.minutes + ' min, ' : ''}${v.replay.keyPoints} key ${v.replay.keyPoints === 1 ? 'point' : 'points'}.</p><div class="mtg-foot"><button class="addb pri" data-m3="replay">Replay</button><span class="note">Plays the note’s audio kept on this machine, with the transcript and the key points.</span></div>` : '';
427
+ const out = secH('Notes', v.notesLine ? '' : 'from the meeting note') + notes;
428
+ const chips = statusChips(r, note).map((c) => `<span class="chp${c.kind ? ' ' + c.kind : ''}"><i></i>${esc(c.text)}</span>`).join('');
429
+ const done = !!(note && note.state === 'ended') || (r.past && !!v.replay);
387
430
  const status = ui.status ? `<p class="note mtg-status" id="mtgStatus" role="status">${esc(ui.status.text)}${ui.status.undo ? ' <button class="mtg-b" id="mtgUndo">Undo</button>' : ''}</p>` : '<p class="note mtg-status" id="mtgStatus" role="status" hidden></p>';
388
- return `<article class="paper doc mtg">${status}${d.kv([['When', r.day + ' · ' + r.time + (r.len ? ' · ' + r.len : '')], ['People', v.people.join(', ') || 'The calendar lists no other people.']])}${actsHtml(r, ui)}${sec('What it is about', about)}${sec('Notes', notes)}${sec('Material', mat)}${rep ? sec('Replay', rep) : ''}</article>`;
431
+ const hdr = `<div class="mh2"><div><h3 class="d1">${esc(r.title)}</h3><p class="mt">${esc(r.time)}${r.end && hasTime(r.end) ? ' to ' + esc(hhmm(r.end)) : ''}${r.len ? ' · ' + esc(r.len) : ''} · ${esc(r.day)}</p>${v.people.length ? `<p class="mt">With ${esc(v.people.join(', '))}</p>` : ''}</div><div class="chs">${chips}</div></div>`;
432
+ return `<article class="paper doc mtg">${status}${hdr}${actsHtml(r, ui)}${(done ? [out, rep, mat, prev, tops] : [prep, mat, prev, tops, out, rep]).join('')}</article>`;
389
433
  }
390
434
  function sheetHtml(row) {
391
435
  return `<article class="paper doc mtg mtg-sheet"><button class="mtg-b" id="mmBack">Back to the meeting</button>
@@ -395,10 +439,10 @@ export function mountMeeting(d) {
395
439
  }
396
440
 
397
441
  async function openRow(row, via) {
398
- let replay = null, material = null, boards = W ? W.boards : [], inis = W ? W.initiatives : [], saved = '';
442
+ let replay = null, material = null, extra = { prev: [], topics: [] }, boards = W ? W.boards : [], inis = W ? W.initiatives : [], saved = '';
399
443
  const ui = { view: 'detail', status: null, tasked: new Set() }, SH = { sug: null, found: [], pick: null, scope: 'meeting', q: '', link: '', token: 0, topics: [], topic: null };
400
444
  let stT = null, findT = null, undoFn = null;
401
- const view = () => meetingView(row, replay, material);
445
+ const view = () => meetingView(row, replay, material, extra);
402
446
  const say = (text, undo) => { clearTimeout(stT); undoFn = undo || null; ui.status = { text, undo: undo || null }; if (ui.view === 'detail') { paint(); stT = setTimeout(() => { ui.status = null; if (ui.view === 'detail') paint(); }, 9000); } else d.toast(text); };
403
447
  const paint = () => {
404
448
  const pane = $('#dOut'), top = pane ? pane.scrollTop : 0, same = ui.last === ui.view; ui.last = ui.view;
@@ -518,6 +562,7 @@ export function mountMeeting(d) {
518
562
  if (res.ok && ui.view === 'detail') d.toast('Recording started.');
519
563
  };
520
564
  switch (act) {
565
+ case 'why': { const n = t.nextElementSibling, on = n && n.hidden; if (n) { n.hidden = !on; t.setAttribute('aria-expanded', String(on)); } return; }
521
566
  case 'rec': if (!consented.has(k)) { ui.ask = 'consent'; paintRec(); const g = $('#m3Rec [data-m3="go"]'); if (g) g.focus(); return; } return started('rec');
522
567
  case 'go': consented.add(k); return started('rec');
523
568
  case 'no': ui.ask = null; paintRec(); { const b = $('#m3Rec [data-m3="rec"]'); if (b) b.focus(); } return;
@@ -562,7 +607,7 @@ export function mountMeeting(d) {
562
607
  material = mt && mt.ok === true ? { state: 'ok', items: mt.items || [] } : { state: 'error', error: (mt && mt.error) || 'no answer' };
563
608
  }
564
609
  const matPath = () => '/api/meeting-material?event=' + encodeURIComponent(row.id) + '&title=' + encodeURIComponent(row.title) + (row.series ? '&series=' + encodeURIComponent(row.series) : '') + '&date=' + row.day;
565
- d.openDlg({ eye: 'Calendar · real data', title: row.title, sub: [row.day, row.time, row.len].filter(Boolean).join(' · '), noteKey: via === 'today' ? 'ev:meeting:' + Date.parse(row.at) : null,
610
+ d.openDlg({ eye: 'Calendar · real data', title: row.title, sub: [row.day, row.time, row.len, row.who && row.who.length ? row.who.join(', ') : ''].filter(Boolean).join(' · '), noteKey: via === 'today' ? 'ev:meeting:' + Date.parse(row.at) : null,
566
611
  stream: d.turnA(d.ptx('This meeting is in the calendar PMOS holds. Its notes, material and recording appear here only if PMOS holds them.')), pane: detailHtml(meetingView(row, null, null), boards, inis, '', ui), label: 'Meeting' });
567
612
  if (via !== 'today') $('#askF').hidden = true;
568
613
  const [rp, mt] = await Promise.all([d.pmGet('/api/meeting-replay?event=' + encodeURIComponent(row.id) + '&date=' + row.day), d.pmGet(matPath())]);
@@ -572,6 +617,12 @@ export function mountMeeting(d) {
572
617
  await readNotes();
573
618
  if ($('#dTitle').textContent !== row.title) return;
574
619
  paint(); if (HOLD) tickClock(); mark();
620
+ {
621
+ const sk = (noteOfRow(NR, row) || {}).series, [sr, tp] = await Promise.all([sk && sk.key ? d.pmGet('/api/notes/series?key=' + encodeURIComponent(sk.key)) : null, d.pmGet(matPath() + '&topics=1')]);
622
+ if ($('#dTitle').textContent !== row.title) return;
623
+ extra = { prev: prevOf(sr, row), topics: tp && tp.ok && Array.isArray(tp.topics) ? tp.topics.filter((t) => t && t.text).slice(0, 8) : [] };
624
+ if (ui.view === 'detail') paint();
625
+ }
575
626
 
576
627
  const write = async (body) => { const res = await d.pmPost('/api/meeting-material', body); return res && res.ok === true ? res : { ok: false, error: (res && res.error) || 'The material was not saved.' }; };
577
628
  async function removeItem(item) {
@@ -1783,3 +1783,55 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
1783
1783
  .phstats b{font-size:var(--t-lead,20px);font-weight:700;color:var(--ink)}
1784
1784
  .phstats span{font-size:var(--t-small);color:var(--ink-3)}
1785
1785
  }
1786
+
1787
+ /* the meeting dialog, as the mockup draws it (briefing-artifact.html, meetCanvas): header chips, Focus and Record, Prepared for you, Material, Previous meetings, Topics */
1788
+ .mtg .mh2{display:flex;justify-content:space-between;align-items:flex-start;gap:14px;flex-wrap:wrap}
1789
+ .mtg .mh2 .d1{font-size:28px;line-height:1.2;margin:0 0 2px;font-weight:700;letter-spacing:-.02em}
1790
+ @media (max-width:700px){.dlg .mtg .mh2 .d1{display:none}}
1791
+ .mtg p.mt{margin:2px 0 0;font-size:12.5px;color:var(--ink-3);line-height:1.4}
1792
+ .mtg .chs{display:flex;gap:6px;flex-wrap:wrap}
1793
+ .mtg .chp.sm{padding:3px 9px;font-size:12px;gap:6px}
1794
+ .mtg .chp svg{width:13px;height:13px}
1795
+ .mtg .mut{color:var(--ink-3);font-size:15px;margin:0}
1796
+ .mtg h4.sh{display:flex;align-items:center;gap:10px;font-size:15px;font-weight:650;letter-spacing:-.01em;margin:28px 0 10px;color:var(--ink)}
1797
+ .mtg h4.sh small{font-weight:500;color:var(--ink-3);font-size:12.5px}
1798
+ .mtg h4.sh .addb{margin-left:auto}
1799
+ .mtg .acts2{display:flex;gap:8px;flex-wrap:wrap;margin:16px 0 4px;align-items:center}
1800
+ .mtg .acts2 .m3r{display:contents}
1801
+ .mtg .acts2 .m3r>div,.mtg .acts2 .m3r>p,.mtg .acts2>p{flex:1 1 100%;margin:0}
1802
+ .mtg .whyb{min-height:44px;padding:0 6px;font-size:12.5px;font-weight:500;color:var(--ink-3);text-decoration:underline;text-underline-offset:3px;border-radius:999px}
1803
+ .mtg .whyb:hover{color:var(--ink)}
1804
+ .mtg .addb{display:inline-flex;align-items:center;gap:7px;min-height:44px;padding:0 16px;border-radius:999px;background:var(--well);font-size:12.5px;font-weight:600;color:var(--ink)}
1805
+ .mtg .addb:hover{background:var(--b3)}
1806
+ .mtg .addb svg{width:14px;height:14px}
1807
+ .mtg .addb.pri{background:var(--solid);color:var(--on-solid)}
1808
+ .mtg .addb:disabled{opacity:.5}
1809
+ .mtg .ib2{width:44px;height:44px;border-radius:50%;background:var(--well);display:inline-grid;place-items:center;color:var(--ink-2);flex:none}
1810
+ .mtg .ib2:hover{background:var(--b3)}
1811
+ .mtg .ib2 svg{width:15px;height:15px}
1812
+ .mtg .prow{display:grid;grid-template-columns:34px minmax(0,1fr) auto;gap:12px;align-items:start;padding:12px 0;border-top:1px solid var(--hair)}
1813
+ @media (max-width:560px){.mtg .prow{grid-template-columns:34px minmax(0,1fr)}.mtg .prow>.chp{grid-column:2}}
1814
+ .mtg .prow:first-child{border-top:0}
1815
+ .mtg .pi{width:32px;height:32px;border-radius:50%;background:var(--well);display:grid;place-items:center;color:var(--ink-2)}
1816
+ .mtg .pi svg{width:16px;height:16px}
1817
+ .mtg .pi.w{background:color-mix(in oklab,var(--ember) 18%,var(--well));color:var(--ember-ink)}
1818
+ .mtg .prow b{font-size:15px;font-weight:600}
1819
+ .mtg .pv{display:flex;gap:6px;flex-wrap:wrap;margin-top:3px;font-size:15px;color:var(--ink-2);line-height:1.45}
1820
+ .mtg .pv b{font-weight:600;color:var(--ink)}
1821
+ .mtg .pp{display:inline-flex;align-items:center;gap:6px;margin-right:8px}
1822
+ .mtg .av2{width:22px;height:22px;border-radius:50%;background:var(--well);display:grid;place-items:center;font:600 11px var(--mono);font-style:normal;color:var(--ink-2);box-shadow:inset 0 0 0 1px var(--hair)}
1823
+ .mtg .mat{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:12px;align-items:center;padding:10px 0;border-top:1px solid var(--hair)}
1824
+ .mtg .mat:first-child{border-top:0}
1825
+ .mtg .mat b{font-size:15px;display:block}
1826
+ .mtg .mat small{color:var(--ink-3);font-size:12.5px}
1827
+ .mtg .kd{font:600 12.5px var(--mono);letter-spacing:.06em;text-transform:uppercase;padding:4px 8px;border-radius:8px;background:var(--well);color:var(--ink-3);white-space:nowrap}
1828
+ .mtg .mb{display:inline-flex;gap:6px}
1829
+ .mtg .pvx{border-top:1px solid var(--hair)}
1830
+ .mtg .pvx:first-child{border-top:0}
1831
+ .mtg .pvh{display:grid;grid-template-columns:62px 1fr 1fr;gap:10px;align-items:center;padding:11px 0;font-size:15px;color:var(--ink-2)}
1832
+ .mtg .pvh time{font:500 12.5px var(--mono);color:var(--ink-3)}
1833
+ .mtg .tp{display:grid;grid-template-columns:26px minmax(0,1fr) auto;gap:10px;align-items:center;padding:8px 0;border-top:1px solid var(--hair);font-size:15px}
1834
+ .mtg .tp:first-child{border-top:0}
1835
+ .mtg .tp i{width:24px;height:24px;border-radius:50%;display:grid;place-items:center;font:600 12.5px var(--mono);font-style:normal;box-shadow:inset 0 0 0 1.8px var(--ink-3);color:var(--ink-3)}
1836
+ .mtg .tp small{color:var(--ink-3);font-size:12.5px}
1837
+ .mtg .mtg-link{margin:8px 0 6px}
@@ -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]');