create-pmos 0.343.0 → 0.345.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.343.0",
3
+ "version": "0.345.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": {
@@ -32,6 +32,30 @@
32
32
  "audit"
33
33
  ],
34
34
  "pmosChanges": [
35
+ {
36
+ "v": "0.345.0",
37
+ "at": "2026-10-20T05:50:20.786Z",
38
+ "f": 2,
39
+ "prs": [
40
+ {
41
+ "n": 941,
42
+ "t": "Agent results wait in the bell, with deep links to each one",
43
+ "s": "The bell is an inbox of what the agent made that waits on the PM."
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "v": "0.344.0",
49
+ "at": "2026-10-20T05:29:13.194Z",
50
+ "f": 2,
51
+ "prs": [
52
+ {
53
+ "n": 940,
54
+ "t": "Replay takes the rich layout from the prototype",
55
+ "s": "Replay follows the rich layout from prototype PR 901."
56
+ }
57
+ ]
58
+ },
35
59
  {
36
60
  "v": "0.343.0",
37
61
  "at": "2026-10-20T05:20:19.894Z",
@@ -272,40 +296,6 @@
272
296
  "s": "A whole-line HTML comment is kept in the page as a hidden block and is never drawn."
273
297
  }
274
298
  ]
275
- },
276
- {
277
- "v": "0.325.0",
278
- "at": "2026-10-19T22:48:34.964Z",
279
- "f": 2,
280
- "prs": [
281
- {
282
- "n": 912,
283
- "t": "An initiative and its tasks open as viewer tabs",
284
- "s": "The Board's initiative dialog (popup mode) and the initiative's own dialog have Open the full record, and a task's dialog has Open the initiative."
285
- },
286
- {
287
- "n": 913,
288
- "t": "Notes list in the premium dialog, a note beside it, one stage interface for the note sheet",
289
- "s": "The Briefing's Calendar card has a Notes button (in the header on a wide screen; under the day on a phone, where the header has no room beside the full-calendar and fold buttons)."
290
- }
291
- ]
292
- },
293
- {
294
- "v": "0.324.0",
295
- "at": "2026-10-19T22:31:07.298Z",
296
- "f": 2,
297
- "prs": [
298
- {
299
- "n": 914,
300
- "t": "Slide editor in the premium viewer",
301
- "s": "Read > Edit the slides (also on the report's document page) opens the same file as a Slides tab in the viewer."
302
- },
303
- {
304
- "n": 918,
305
- "t": "Presenter mode for the slide editor",
306
- "s": "Present opens the presenter view from the prototype's conversation shell."
307
- }
308
- ]
309
299
  }
310
300
  ]
311
301
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@01d180ef
1
+ kernel-source: pmos@8499d98d
2
2
  assembled: 2026-10-20
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-20T05:20:17Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-20T05:50:16Z"}
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-20T05:20:17Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-20T05:50:16Z"}
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-20T05:20:17Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-20T05:50:16Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -125,6 +125,8 @@ const RECORDER = () => {
125
125
  await page.route('**/api/meeting-focus/topic', (r) => { S.topicPosts.push(JSON.parse(r.request().postData() || '{}')); return json(r, { ok: true }); });
126
126
  await page.route(/\/api\/meeting-focus(\?|$)/, (r) => { if (/[?&]brief=1(&|$)/.test(r.request().url())) S.briefGets++; else S.focusGets++; const a = typeof focus === 'function' ? focus() : focus; return json(r, a, a.ok === false ? 404 : 200); });
127
127
  await page.route('**/api/calendar-links', (r) => json(r, { ok: true }));
128
+ S.planPosts = [];
129
+ await page.route('**/api/plan-items*', (r) => { const req = r.request(); if (req.method() === 'POST') { S.planPosts.push(JSON.parse(req.postData() || '{}')); return json(r, { ok: true, written: [{ item: 'i' + S.planPosts.length }] }); } return json(r, { ok: true, stages: [{ id: 's1', label: 'Now' }] }); });
128
130
  if (stub) await page.addInitScript(RECORDER);
129
131
  await page.addInitScript(() => {
130
132
  const f = window.fetch;
@@ -312,6 +314,40 @@ const RECORDER = () => {
312
314
  ok('R7 at the end it stops by itself', await until(() => Ra.page.evaluate(() => document.querySelector('#rpPlay').textContent === 'Play' && /^0:04/.test(document.querySelector('#rpPos').textContent)), 8000), await Ra.page.evaluate(() => document.querySelector('#rpPos').textContent));
313
315
  await Ra.ctx.close();
314
316
 
317
+ /* R12 the rich Replay layout (prototype PR 901): a wide window, the time of day, marker lanes, PMOS notes, filters, key-point columns and Confirm all */
318
+ const RICH = { ...REPLAY, start_ms: new Date(2026, 9, 20, 10, 0, 0).getTime(), note: { id: 'n1', title: 'Live review notes', initiative: { id: 'premium-viewer', ws: 'w1', title: 'Premium viewer' } },
319
+ lines: REPLAY.lines.map((l) => (l.i === 1 ? { ...l, key: { k: 'decision', id: 'd1' } } : l)),
320
+ keys: [{ id: 'd1', k: 'decision', text: 'Plan with eight people', t: 61000, by: 'Priya', state: 'draft' }, { id: 'a1', k: 'action', text: 'Priya confirms the owner', t: 140000, owner: 'Priya', due: '2026-10-24', state: 'draft' }, { id: 'q1', k: 'question', text: 'Who signs off?', t: 200000, state: 'open' }],
321
+ notes: [{ t: 90000, cat: 'insight', body: 'The plan leans on one hire' }], gaps: [{ from_ms: 240000, to_ms: 260000 }] };
322
+ const Rw = await open({ replay: RICH });
323
+ await press(Rw.page, 'replay');
324
+ await until(() => Rw.page.evaluate(() => !!document.querySelector('#rpKeys')));
325
+ ok('R12 Replay opens full width with the conversation panel hidden', await Rw.page.evaluate(() => { const g = document.getElementById('dlg'); return g.classList.contains('full') && g.classList.contains('rpw') && g.dataset.mode === 'detail'; }));
326
+ ok('R12 the header shows the time of day from the recording start', await Rw.page.evaluate(() => document.querySelector('#rpClk').textContent.trim() === '10:00'), await Rw.page.evaluate(() => document.querySelector('#rpClk').textContent));
327
+ ok('R12 the marker lane has one marker per timed key point and PMOS note, and an open question carries the needs-you ring', await Rw.page.evaluate(() => document.querySelectorAll('#oMain .rp-mk').length === 4 && !!document.querySelector('#oMain .rp-mk.question.need') && !!document.querySelector('#oMain .rp-mk.pm') && !!document.querySelector('#oMain .rp-gap')));
328
+ ok('R12 a key-point line is tagged in the conversation', await Rw.page.evaluate(() => !!document.querySelector('#rl1 .rp-kt')));
329
+ ok('R12 the key points sit in three columns with counts', await Rw.page.evaluate(() => { const c = [...document.querySelectorAll('#rpKeys .rp-col')]; return c.length === 3 && c.every((x) => /1/.test(x.querySelector('h4').textContent)); }));
330
+ await Rw.page.click('#oMain .rp-mk.pm');
331
+ ok('R12 a PMOS marker seeks to its note', await until(() => Rw.page.evaluate(() => /^1:30 \/ 5:00/.test(document.querySelector('#rpPos').textContent))), await Rw.page.evaluate(() => document.querySelector('#rpPos').textContent));
332
+ await Rw.page.click('#oMain [data-rp="tab"][data-v="p"]');
333
+ ok('R12 the PMOS tab lists only PMOS notes', await Rw.page.evaluate(() => { const l = document.querySelector('#rpLines'); return /The plan leans on one hire/.test(l.textContent) && !/Welcome everyone/.test(l.textContent); }));
334
+ await Rw.page.click('#oMain [data-rp="tab"][data-v="k"]');
335
+ ok('R12 the Key points tab lists only key-point lines', await Rw.page.evaluate(() => { const l = document.querySelector('#rpLines'); return /We plan eight people/.test(l.textContent) && !/Welcome everyone/.test(l.textContent); }));
336
+ await Rw.page.click('#oMain [data-rp="tab"][data-v="a"]');
337
+ await Rw.page.fill('#rpQ', 'risks');
338
+ ok('R12 the search narrows the conversation', await until(() => Rw.page.evaluate(() => { const l = document.querySelector('#rpLines'); return /Next the risks/.test(l.textContent) && !/Welcome everyone/.test(l.textContent); })));
339
+ await Rw.page.click('#rpKeys [data-rp="confirm"]');
340
+ ok('R12 Confirm all adds each next step to the note\'s initiative and marks it', await until(() => Rw.page.evaluate(() => /task made/.test(document.querySelector('#rpKeys').textContent))) && Rw.planPosts.length === 1 && Rw.planPosts[0].events[0].initiative === 'premium-viewer' && Rw.planPosts[0].events[0].title === 'Priya confirms the owner' && Rw.planPosts[0].events[0].stage === 's1' && Rw.planPosts[0].events[0].due === '2026-10-24', JSON.stringify(Rw.planPosts));
341
+ await press(Rw.page, 'unreplay');
342
+ ok('R12 Back restores the dialog size and the conversation panel', await until(() => Rw.page.evaluate(() => { const g = document.getElementById('dlg'); return !g.classList.contains('full') && !g.classList.contains('rpw') && g.dataset.mode === 'split'; })));
343
+ await Rw.ctx.close();
344
+ const Rn = await open();
345
+ await press(Rn.page, 'replay');
346
+ await until(() => Rn.page.evaluate(() => !!document.querySelector('#rpKeys')));
347
+ await Rn.page.click('#rpKeys [data-rp="confirm"]');
348
+ ok('R12 with no initiative linked, Confirm all says so and writes nothing', await until(() => Rn.page.evaluate(() => /Link the note to an initiative first/.test(document.body.textContent))) && Rn.planPosts.length === 0);
349
+ await Rn.ctx.close();
350
+
315
351
  /* R8 Topic on material */
316
352
  const Tp = await open({ topics: ['Capacity', 'Risks'] });
317
353
  await reveal(Tp.page, '#mmAdd'); await Tp.page.click('#mmAdd'); await until(() => Tp.page.evaluate(() => /Roadmap/.test(document.querySelector('#mmSug').textContent)));
@@ -60,7 +60,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
60
60
 
61
61
  /* The console's Needs you reads (premium-brief.js): off by default, so the page keeps the model's records-only hero and rows, which most of
62
62
  * this suite checks. `console` stubs them: { briefing, page, agent }; the C block checks that path. */
63
- const open = async ({ w = 1280, h = 900, theme = 'light', model = MODEL, ctxOpts = {}, pre = null, console: cn = null } = {}) => {
63
+ const open = async ({ w = 1280, h = 900, theme = 'light', model = MODEL, ctxOpts = {}, pre = null, console: cn = null, inbox = null } = {}) => {
64
64
  const ctx = await browser.newContext({ viewport: { width: w, height: h }, ...ctxOpts });
65
65
  const page = await ctx.newPage();
66
66
  const errors = [], reqs = [];
@@ -70,13 +70,19 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
70
70
  const json = (body) => (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(body) });
71
71
  if (cn) { await page.route('**/api/brief-page*', json(cn.page)); await page.route('**/api/briefing', json(cn.briefing)); await page.route('**/api/needs?*', json({ needs: cn.agent || [] })); }
72
72
  if (cn && cn.props) await page.route('**/api/driver/open*', (r) => { const k = new URL(r.request().url()).searchParams.get('target_kind'); return json({ ok: true, ws: 'w0', mode: 'approve', targets: cn.props[k] || {} })(r); });
73
+ if (inbox) await page.route('**/api/inbox', json(inbox));
73
74
  if (pre) await page.addInitScript(pre);
74
75
  await page.goto(BASE + '/premium.html?theme=' + theme);
75
76
  const up = await until(() => page.evaluate(() => document.querySelectorAll('#rank .rr').length > 0 || !document.querySelector('#calm').hidden), 20000);
76
77
  return { ctx, page, errors, reqs, up };
77
78
  };
78
79
 
79
- const A = await open();
80
+ /* the bell's inbox (premium-agent-inbox): two new agent results and one piece of work still waiting */
81
+ const ibIt = (id, kind, title, open, pws, at) => ({ id, kind, title, open, pws, at, ws: pws, product: 'IDPF', session: kind.startsWith('goal') ? open.slice(4) : 'src:drv:' + pws + ':x', target: kind.startsWith('goal') ? null : { kind: 'initiative', id: 'checkout', title: 'Checkout' }, isNew: true });
82
+ const INBOX = { ok: true, count: 4, newCount: 2, more: 0, oldest: Date.now() - 5 * 86400000, seenAt: null,
83
+ items: [ibIt('prop:w0:p1', 'proposal', 'Problem statement: Checkout drops one in five carts', 'prop:p1', 'w0', Date.now() - 12 * 60000), ibIt('goal:src:this-page', 'goal-done', 'Check the goal Claude finished: Ship it', 'row:goal:src:this-page', '', Date.now() - 60 * 60000)],
84
+ bundles: [{ key: 'w0|initiative|checkout', title: 'Checkout', product: 'IDPF', count: 2, oldest: Date.now() - 5 * 86400000, open: 'target:initiative:checkout', pws: 'w0', sub: '2 proposals' }] };
85
+ const A = await open({ inbox: INBOX });
80
86
  ok('0 the page draws the list', A.up);
81
87
  if (!A.up) return finish(1);
82
88
  const p = A.page;
@@ -97,8 +103,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
97
103
  await p.route('**/api/sessions', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ sessions: [{ id: 's1', name: 'Fix the footer', state: 'idle', cwd: '.' }, { id: 's2', name: 'Nightly run', state: 'idle', automatic: true }] }) }));
98
104
  await p.click('#moreBtn');
99
105
  const sb = await until(() => p.evaluate(() => { const s = document.querySelector('#pvSearch'), b = document.querySelector('#pvBell'), g = document.querySelector('#pvBdg'); if (!s || !b || !g || g.hidden) return null; const rs = s.getBoundingClientRect(), rb = b.getBoundingClientRect(); return { sw: Math.round(rs.width), sh: Math.round(rs.height), bw: Math.round(rb.width), bh: Math.round(rb.height), n: g.textContent, lab: b.getAttribute('aria-label') }; }), 8000);
100
- const want = MODEL.list.count;
101
- ok('SB1 the ⋯ menu has Search and the header has the bell, 44 px, and the bell counts what the Briefing lists', sb && sb.sw >= 44 && sb.sh >= 44 && sb.bw >= 44 && sb.bh >= 44 && sb.n === String(want) && sb.lab === 'Needs you: ' + want, JSON.stringify(sb));
106
+ ok('SB1 the ⋯ menu has Search and the header has the bell, 44 px, and the bell counts the agent\'s new results', sb && sb.sw >= 44 && sb.sh >= 44 && sb.bw >= 44 && sb.bh >= 44 && sb.n === '2' && sb.lab === 'Needs you: 2 new from the agent', JSON.stringify(sb));
102
107
  await p.keyboard.press('Escape');
103
108
  await p.keyboard.press('Control+k');
104
109
  const pal = await until(() => p.evaluate(() => { const o = document.querySelector('#pvOv'); return o && !o.hidden && document.activeElement && document.activeElement.id === 'pvQ' ? { rail: document.querySelector('.rail').inert, groups: [...document.querySelectorAll('#pvList .pv-grp')].map((x) => x.textContent) } : null; }), 6000);
@@ -113,10 +118,10 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
113
118
  const closed = await until(() => p.evaluate(() => document.querySelector('#pvOv').hidden && !document.querySelector('.rail').inert && document.activeElement.id === 'moreBtn'), 4000);
114
119
  ok('SB5 Escape closes it and puts the focus back on the ⋯ button', !!closed);
115
120
  await p.click('#pvBell');
116
- const rows = await until(() => p.evaluate(() => { const o = document.querySelector('#pvOv'); return !o.hidden ? document.querySelectorAll('#pvList .pv-row').length : 0; }), 6000);
117
- ok('SB6 the bell lists the Briefing rows and a row opens the Briefing', rows === MODEL.list.rows.length, String(rows));
121
+ const bell = await until(() => p.evaluate(() => { const o = document.querySelector('#pvOv'); return !o.hidden && document.querySelector('#pvList .ib-it') ? { items: document.querySelectorAll('#pvList .ib-it').length, sess: document.querySelectorAll('#pvList .ib-it .cta.alt').length, bun: document.querySelectorAll('#pvList .ib-bun').length, yours: /Your own work/.test(document.querySelector('#pvList').textContent) } : null; }), 6000);
122
+ ok('SB6 the bell lists each new agent result with its action, a Session button for a proposal, a line per piece of work still waiting, and a line for your own work', bell && bell.items === 2 && bell.sess === 1 && bell.bun === 1 && bell.yours, JSON.stringify(bell));
118
123
  await p.keyboard.press('Escape');
119
- ok('SB7 search and the bell only read: no POST left the page', !A.reqs.some((x) => x.startsWith('POST ')));
124
+ ok('SB7 search and the bell only read: the one POST is closing the bell, which marks the new results seen', A.reqs.filter((x) => x.startsWith('POST ')).every((x) => x === 'POST /api/inbox/seen'), A.reqs.filter((x) => x.startsWith('POST ')).join());
120
125
  }
121
126
  /* premium-settings: the dialog holds Workspaces and Connectors only; each press goes to its existing route */
122
127
  { await p.click('#moreBtn'); const bt = await p.evaluate(() => { const b = document.querySelector('#settingsBtn'); if (!b) return null; const r = b.getBoundingClientRect(); return { label: b.textContent.trim(), w: Math.round(r.width), h: Math.round(r.height) }; });
@@ -311,7 +316,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
311
316
  await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
312
317
 
313
318
  /* R10 */
314
- 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());
319
+ ok('R10 a page where nothing was pressed to record sent only GET requests (the one confirmed Start and closing the bell aside)', A.reqs.every((r) => r.startsWith('GET ') || r === 'POST /api/agent/start' || r === 'POST /api/inbox/seen'), A.reqs.filter((r) => !r.startsWith('GET ')).join());
315
320
  ok('0 no page error', A.errors.length === 0, A.errors.join(' | '));
316
321
 
317
322
  /* slice 2: the buttons that record (initiative briefing-premium-writes). The POST routes are answered by the test, so no real file is written;
@@ -513,15 +518,16 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
513
518
  props: { initiative: { checkout: [{ id: 'p1', what: 'problem', at: '2026-10-19T09:00:00Z', data: { text: 'Checkout drops one in five carts at the address step.' } }, { id: 'p2', what: 'evidence', at: '2026-10-19T09:05:00Z', data: { text: 'Funnel export, 30 days.' } }],
514
519
  search: [{ id: 'p3', what: 'problem', at: '2026-10-19T09:10:00Z', data: { text: 'A draft on another initiative.' } }] } },
515
520
  };
516
- const C = await open({ console: CN });
521
+ const CIB = { ...INBOX, count: 2, newCount: 1, items: [INBOX.items[0]] };
522
+ const C = await open({ console: CN, inbox: CIB });
517
523
  const cp = C.page;
518
- await until(() => cp.evaluate(() => document.querySelectorAll('#rank .rr').length === 3 && /^The same paragraph as The brief/.test(document.querySelector('#brief').title || '')));
524
+ await until(() => cp.evaluate(() => document.querySelectorAll('#rank .rr').length === 2 && /^The same paragraph as The brief/.test(document.querySelector('#brief').title || '')));
519
525
  const want = await cp.evaluate(() => import('/pm/premium-brief.js').then((m) => m.consoleReads().then((r) => ({ brief: m.briefOf(r).parts.map((x) => x.t).join(''), titles: m.needsListOf(r).map((x) => x.title) }))));
520
526
  const got = await cp.evaluate(() => ({ brief: document.querySelector('#brief').textContent, titles: [...document.querySelectorAll('#rank .rr .rt')].map((t) => t.childNodes[0].textContent), skip: document.querySelectorAll('#rank .rr .skip').length, cap: document.querySelector('#movesCap').textContent, dn: document.querySelector('#dN').textContent, bell: document.querySelector('#pvBdg').textContent, links: document.querySelectorAll('#rank .rr[data-link]').length }));
521
527
  ok('C1 the hero is the console brief, word for word', got.brief === want.brief && /3 things need you/.test(got.brief), got.brief);
522
- ok('C2 the list is the console\'s Needs you, in its order', got.titles.join('|') === want.titles.join('|') && got.titles.length === 3, JSON.stringify(got.titles));
528
+ ok('C2 the list is the console\'s Needs you, in its order, without the agent\'s drafts row: that waits in the bell', got.titles.join('|') === want.titles.filter((t) => !/^Agent has/.test(t)).join('|') && got.titles.length === 2 && want.titles.length === 3, JSON.stringify(got.titles));
523
529
  ok('C3 a console row has no "If you skip" line and no meeting link: no record holds them', got.skip === 0 && got.links === 0, JSON.stringify(got));
524
- ok('C4 the header, the dock and the bell count the same three rows', /3 rows left/.test(got.cap) && got.dn === '3' && got.bell === '3', JSON.stringify(got));
530
+ ok('C4 the header and the dock count the same two rows, and the bell counts the agent\'s new result', /2 rows left/.test(got.cap) && got.dn === '2' && got.bell === '1', JSON.stringify(got));
525
531
  const dec = await cp.evaluate(() => [...document.querySelectorAll('#rank .rr')].findIndex((r) => /Pick the launch market/.test(r.textContent)));
526
532
  await cp.locator('#rank .rr .rhd').nth(dec).click();
527
533
  await until(() => cp.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
@@ -533,15 +539,23 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
533
539
  await cp.locator('#rank .rr .rhd').nth(own).click();
534
540
  await until(() => cp.evaluate(() => /premium-work\.html/.test(location.pathname)));
535
541
  ok('C6 your own item opens on My work, on that item', await cp.evaluate(() => location.pathname === '/premium-work.html' && new URLSearchParams(location.search).get('item') === 'w1'), await cp.evaluate(() => location.href));
536
- await cp.goBack(); await until(() => cp.evaluate(() => location.pathname === '/premium.html' && document.querySelectorAll('#rank .rr').length === 3), 20000);
537
- const ag = await cp.evaluate(() => [...document.querySelectorAll('#rank .rr')].findIndex((r) => /Agent has 2 drafts on Checkout/.test(r.textContent)));
538
- await cp.locator('#rank .rr .rhd').nth(ag).click();
542
+ await cp.goBack(); await until(() => cp.evaluate(() => location.pathname === '/premium.html' && document.querySelectorAll('#rank .rr').length === 2), 20000);
543
+ await cp.click('#pvBell');
544
+ await until(() => cp.evaluate(() => !!document.querySelector('#pvList .ib-bun')), 6000);
545
+ await cp.locator('#pvList .ib-bun').first().click();
539
546
  await until(() => cp.evaluate(() => document.querySelector('#dlg').classList.contains('on') && document.querySelectorAll('#oMain .bd-it').length > 0));
540
547
  const pd = await cp.evaluate(() => ({ path: location.pathname, title: document.querySelector('#dTitle').textContent, ids: [...document.querySelectorAll('#oMain .bd-it')].map((x) => x.dataset.id), keep: !!document.querySelector('#oMain [data-bda="pkeep"]'), all: !!document.querySelector('#oMain [data-bda="pall"]') }));
541
- ok('C8 an agent drafts row stays on the Briefing and opens Agent proposals with that initiative\'s drafts only', pd.path === '/premium.html' && pd.title === 'Agent proposals' && pd.ids.join() === 'p1,p2' && pd.keep && pd.all, JSON.stringify(pd));
548
+ ok('C8 a piece of work in the bell opens Agent proposals on the Briefing with that initiative\'s drafts only', pd.path === '/premium.html' && pd.title === 'Agent proposals' && pd.ids.join() === 'p1,p2' && pd.keep && pd.all, JSON.stringify(pd));
542
549
  await cp.locator('#oMain [data-bda="pall"]').click();
543
550
  ok('C9 Show all proposals lists every proposal', await until(() => cp.evaluate(() => [...document.querySelectorAll('#oMain .bd-it')].map((x) => x.dataset.id).sort().join() === 'p1,p2,p3')));
544
551
  await cp.keyboard.press('Escape');
552
+ await until(() => cp.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
553
+ await cp.click('#pvBell');
554
+ await until(() => cp.evaluate(() => !!document.querySelector('#pvList .ib-it [data-ibo="prop:p1"]')), 6000);
555
+ await cp.locator('#pvList .ib-it [data-ibo="prop:p1"]').click();
556
+ const one = await until(() => cp.evaluate(() => { const ids = [...document.querySelectorAll('#oMain .bd-it')].map((x) => x.dataset.id); return document.querySelector('#dlg').classList.contains('on') && ids.length ? { ids, back: !!document.querySelector('#oMain [data-bda="pbell"]'), path: location.pathname } : null; }), 6000);
557
+ ok('C10 a new proposal in the bell opens that one proposal, with a way back to the bell', one && one.ids.join() === 'p1' && one.back && one.path === '/premium.html', JSON.stringify(one));
558
+ await cp.keyboard.press('Escape');
545
559
  ok('C7 no page error on the console path', C.errors.length === 0, C.errors.join(' | '));
546
560
  await C.ctx.close();
547
561
  /* a portfolio documents drafts row opens the draft in the document sheet, on the Briefing (premium-rows-stay-premium) */
@@ -1,4 +1,28 @@
1
1
  [
2
+ {
3
+ "v": "0.345.0",
4
+ "at": "2026-10-20T05:50:20.786Z",
5
+ "f": 2,
6
+ "prs": [
7
+ {
8
+ "n": 941,
9
+ "t": "Agent results wait in the bell, with deep links to each one",
10
+ "s": "The bell is an inbox of what the agent made that waits on the PM."
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ "v": "0.344.0",
16
+ "at": "2026-10-20T05:29:13.194Z",
17
+ "f": 2,
18
+ "prs": [
19
+ {
20
+ "n": 940,
21
+ "t": "Replay takes the rich layout from the prototype",
22
+ "s": "Replay follows the rich layout from prototype PR 901."
23
+ }
24
+ ]
25
+ },
2
26
  {
3
27
  "v": "0.343.0",
4
28
  "at": "2026-10-20T05:20:19.894Z",
@@ -17,7 +17,7 @@ Every premium page has the same top bar. On the left is where you are, then a ro
17
17
 
18
18
  - **Chat** opens a conversation with Claude about the page you are on: the Briefing, My work, the board, or the initiative. On Insights, Chat opens the Insight Studio, because the Studio is that page's chat.
19
19
  - **Sources** has a green dot when every source was read recently, and an orange dot when a source is old, was never read, failed, or the page could not read it. Hover to see which. A press opens the Sources dialog (see "Sources" below).
20
- - **The bell** counts the same things the Briefing lists under what you need to do, and a press opens the Briefing.
20
+ - **The bell** is your inbox of agent results: see [The bell: what the agent has for you](#the-bell-what-the-agent-has-for-you).
21
21
  - **The ⋯ menu** holds **Search** (Ctrl K), **Agent sessions** with a count, **Console**, **Theme** (Light, Dark or Auto) and **Settings**. On the Board it also holds **Open initiatives** as Page or Popup. An orange dot on ⋯ means a newer PMOS is ready, and **Settings** then shows the version.
22
22
  - **On a phone** the bar is one row: the page name, Chat, the bell and ⋯. Sources moves into the ⋯ menu.
23
23
  - **Menus.** An option that is too long for one line wraps onto the next line, and its row grows to hold it.
@@ -55,12 +55,24 @@ The page reads today's morning brief (`briefs/<date>.json` in the state folder)
55
55
  - **The header** says "no morning brief for today" when there is none, or that the brief could not be read, or that it did not reach a source (mail, Jira, Confluence or Slack).
56
56
  - **`?ws=<id>`** does not show these rows.
57
57
 
58
+ ## The bell: what the agent has for you
59
+
60
+ The agent's results are in the bell, not in the list. Each open proposal from the Initiative Driver, and each goal that is done, stopped or needs you, is one item. The list keeps your own work. Under it, one line says how many agent results wait on you, how many are new, and how old the oldest is. **Open Needs you** opens the bell.
61
+
62
+ - **New from the agent** shows one item per result that came in after you last looked, the newest first. Each item has its main action: **Review** for a proposal, **Read** for a document draft, **Answer** for a goal that needs you, and **See result** for a goal that is done. **Session** opens the conversation with the agent about that piece of work. The badge on the bell counts the new items.
63
+ - **Still waiting** shows one line per piece of work: its name, how many proposals it has and how old the oldest is. A press opens Agent proposals on that piece of work.
64
+ - **Review** opens Agent proposals on that one proposal, where Keep, Send back and Drop are. **Talk to the agent** opens its conversation, and **Back to Needs you** opens the bell again. On another page, a press opens the Briefing with that proposal open.
65
+ - **Seen is not done.** When you close the bell, the new items it showed move to Still waiting. **Mark all seen** moves them all. An item leaves only when you decide it, wherever you decide it.
66
+ - **A toast** names a new result while a premium page is open: at most one every 15 minutes, with several new results bundled into one. Its button opens the result, or the bell.
67
+ - **What counts.** The bell lists the proposals Agent proposals shows (a board in Shadow or Off mode raises none) and the goal rows. Portfolio document drafts stay in the list, because they are your own documents.
68
+ - **Links.** `premium.html?open=prop:<id>&pws=<workspace>` opens one proposal. `?open=target:initiative:<id>&pws=<workspace>` opens one piece of work. `?open=row:<key>` opens an agent or goal row with its conversation.
69
+
70
+ The bell reads `GET /api/inbox`. The only thing it writes is your seen marks, in `inbox-seen.jsonl` in the state folder. They need the page's launch nonce.
71
+
58
72
  ## The agent's drafts
59
73
 
60
- The list also shows what the Initiative Driver is waiting on you for, the same two rows the console's Needs you shows: "Agent has 4 drafts on <initiative>" and "<initiative> is waiting on you: the drafts are 6 days old". They are read from each included product's Driver ledger. Nothing is recorded from these rows.
74
+ The Initiative Driver's rows ("Agent has 4 drafts on <initiative>" and "<initiative> is waiting on you: the drafts are 6 days old") are read from each included product's Driver ledger. They are in the bell, and a Session press opens one. Nothing is recorded from these rows.
61
75
 
62
- - **Order.** A product whose agent is stopped on you comes after the repository rows and before mail, Jira and Confluence. Open drafts come after those, the oldest first. The list shows seven rows; the rest are counted under "more".
63
- - **The hero** says how many agent drafts wait on you, counting every one, shown or not. The dock counts them too.
64
76
  - **The dialog** shows only what the Driver's row holds: the cause, the draft count, the age, and the confidence, recommendation, reversibility and effort the agent stated when it filed. A fact nobody stated is left out. **Review the drafts** opens Around you's Agent proposals, where Keep, Send back and Drop are.
65
77
  - **Pressing a row** opens Around you's Agent proposals on the Briefing, with only that initiative's or Work item's drafts. **Show all proposals** lists every one. A row never opens the console.
66
78
  - **Core-document drafts** open the initiative page or the Board page that holds the documents. Portfolio drafts open in the document sheet on the Briefing, with **Issue it** and **Draft it again**, the same sheet the Board page uses.
@@ -141,7 +153,7 @@ In **Notes**, each next step has **Make task** when the note is linked to an ini
141
153
 
142
154
  **Focus.** The dialog has a **Focus** press. Focus shows the meeting as it is now: the state (starts in, recording, paused, ended), a bar of the stretches by topic, the topic now (or the first topic before the start), the last lines of the talk with who said them, the topics, the material and the counts of decisions, next steps and questions. It reads the meeting every 3 seconds while it is open and stops when you leave it. While the note records, PMOS's companion, a read-only Claude run that sends nothing, may read the last minutes of the talk at most every 40 seconds and writes its own notes. The dialog says this before the first read. **Change** lists the topics. A press records one correction on the meeting through the console's route. If the companion is off, has not answered or has failed, Focus says so and shows only the talk. It shows no topic, line or count that the record does not hold.
143
155
 
144
- **Replay.** When a recording is kept, the Replay part has a **Replay** press. The player plays the note's audio, with Back 10 s and 1x, 1.5x or 2x. It shows a bar of the stretches by topic with a mark for each decision, next step and question, the topic being talked about, the key points and the transcript. A press on a stretch, a key point or a line plays from there, and the current line is marked. A key point with no time has no play press. If no audio was kept, the playhead keeps its own clock. A screen shot is shown only when the recording holds one for that time.
156
+ **Replay.** When a recording is kept, the Replay part has a **Replay** press. Replay opens wide and hides the conversation panel; **Back to the meeting** puts both back. The header shows the meeting's day, start and end, length, the number of people, and the position as m:ss and as the time of day. The player plays the note's audio, with Back 10 s and 1x, 1.5x or 2x. Under it is a bar of the stretches by topic and, above the bar, one marker for each decision, next step, question and PMOS note that has a time. A ring marks a point that needs you (a question still open, or a next step with no owner). A shaded part of the bar is a gap where the recording was off. The line under the bar shows the topic being talked about and the key points near the playhead. Below are two panels: **On screen**, with the screen shot kept for that time and a strip of all shots, and **Conversation**, with the transcript and PMOS's notes. Its tabs show all lines, only the key-point lines or only PMOS's notes, and a search box narrows the lines. The key points sit in three columns: decisions, questions and next steps. **Confirm all** makes a task of each next step in the note's initiative, under its first stage; when the note has no initiative, it says to link one first. A press on a marker, stretch, key point, line or shot plays from there, and the current line is marked. A key point with no time has no play press. If no audio was kept, the playhead keeps its own clock.
145
157
 
146
158
  In the **Add material** sheet, a **Topic** choice ties the item to one of the meeting's topics, so Focus can bring it up. It appears only when the meeting has topics.
147
159
 
@@ -393,6 +405,6 @@ Type `/` in the box to see the commands: `/goal`, `/compact` and `/clear`. Use t
393
405
  - **While it works**, a goal card under the conversation shows the round, each done point met or open, and the deadline. The points are Claude's own report, so the card says "unverified". Each time Claude would stop with a point still open, it is told to keep going.
394
406
  - **It stops by itself** when Claude reports every point met (Done), when it needs you (Needs you: answer it in the box and it goes on), at the deadline, after the round limit (12 unless the goal says fewer), or after 3 rounds that met no new point. The card says which.
395
407
  - **Stop the goal** presses Esc in the session and ends the goal.
396
- - **In the Briefing**, a goal that is done, stopped or needs you is a row at the top of the list. Pressing it opens the goal's own conversation. The row goes when you write in that conversation, or after a week.
408
+ - **In the bell**, a goal that is done, stopped or needs you is an item. Pressing it opens the goal's own conversation. The item goes when you write in that conversation, or after a week.
397
409
 
398
410
  Start, Cancel and Stop need the page's launch nonce too. The goal and each round are kept in `goal-runs.jsonl` in the state folder.
@@ -0,0 +1,135 @@
1
+ 'use strict';
2
+ /* agent-inbox.js — the bell's inbox of agent results that wait on the PM (initiative premium-agent-inbox).
3
+ *
4
+ * build({ proposals, goals, seen, now }) → { count, newCount, items, bundles, seenAt } PURE
5
+ * readProposals(available) → [{ p, ws, product, targetTitle }] the open proposals the Agent proposals dialog shows
6
+ * readSeen(runtimeDir) · appendSeen(runtimeDir, { ids } | { all: true }, now)
7
+ * split(model, goals) → the Briefing model with its agent and goal rows moved to model.agent (N6)
8
+ *
9
+ * An item is one open Driver proposal (a board in Approve mode only, as the dialog reads it) or one goal row of goal-chat. Every word
10
+ * comes from the record. NEW is filed after the PM's last "Mark all seen" and not opened since; seen is not done: an item goes only
11
+ * when its record changes. The only write is the seen line, <runtime>/inbox-seen.jsonl. Nothing here decides or sends anything. */
12
+ const fs = require('fs');
13
+ const path = require('path');
14
+
15
+ const SEEN = 'inbox-seen.jsonl';
16
+ const MAX_NEW = 30;
17
+ const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
18
+ const plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
19
+ const WHAT = { problem: 'Problem statement', evidence: 'Evidence', sizing: 'Opportunity sizing', assumption: 'Riskiest assumption', stakeholders: 'Stakeholders', move: 'Move', note: 'Note', 'next-step': 'Next step', 'follow-up': 'Follow-up', doc: 'Document draft' };
20
+ const GOAL_KIND = { waiting: 'goal-waiting', done: 'goal-done', stopped: 'goal-stopped' };
21
+
22
+ /** The key of a target's drafts row on the Briefing (lib/briefing-premium-drafts.js keyOf of the driver-needs run id): its conversation is the proposal's session. */
23
+ function draftsRowKey(ws, target) {
24
+ const D = require('./driver.js'), Drafts = require('./briefing-premium-drafts.js');
25
+ return Drafts.keyOf(ws, 'driver-needs:drafts:' + D.targetKey(target));
26
+ }
27
+
28
+ function proposalTitle(p) {
29
+ const word = p.what === 'move' && p.data && p.data.to ? 'Move to ' + p.data.to : WHAT[p.what] || p.what || 'Proposal';
30
+ const text = p.data && typeof p.data.text === 'string' ? p.data.text : '';
31
+ return clip(text ? word + ': ' + text : word, 160);
32
+ }
33
+
34
+ /** Pure. proposals: [{ p, ws, product, targetTitle }]; goals: goal-chat goalRowsAt rows; seen: readSeen(). */
35
+ function build({ proposals = [], goals = [], seen = { all: 0, ids: new Set() }, now = Date.now() } = {}) {
36
+ const items = [];
37
+ for (const x of proposals) {
38
+ const p = x.p, at = Date.parse(p.at || '');
39
+ if (!p || !p.id || !p.target) continue;
40
+ const t = p.target, target = { kind: t.kind, id: t.id, title: clip(x.targetTitle || t.id, 120) };
41
+ items.push({
42
+ id: 'prop:' + x.ws + ':' + p.id, kind: p.what === 'doc' ? 'draft' : 'proposal', title: proposalTitle(p), at: Number.isFinite(at) ? at : null,
43
+ ws: x.ws, product: x.product || '', target,
44
+ open: 'prop:' + p.id, pws: x.ws, session: draftsRowKey(x.ws, t),
45
+ });
46
+ }
47
+ for (const g of goals) {
48
+ if (!g || !g.chatKey) continue;
49
+ items.push({ id: g.key, kind: GOAL_KIND[g.goalState] || 'goal-done', title: clip(g.title + ': ' + (g.subject || ''), 160), at: Number.isFinite(g.at) ? g.at : null, ws: '', product: 'Chat', target: null, open: 'row:' + g.key, pws: '', session: g.key });
50
+ }
51
+ for (const it of items) it.isNew = (it.at == null || it.at > seen.all) && !seen.ids.has(it.id);
52
+ const fresh = items.filter((i) => i.isNew).sort((a, b) => (b.at || now) - (a.at || now));
53
+ const rest = items.filter((i) => !i.isNew);
54
+ const by = new Map();
55
+ for (const i of rest) {
56
+ const k = i.target ? i.pws + '|' + i.target.kind + '|' + i.target.id : i.id;
57
+ if (!by.has(k)) by.set(k, { key: k, title: i.target ? i.target.title : i.title, product: i.product, n: 0, oldest: null, kind: i.target ? 'target' : i.kind, open: i.target ? 'target:' + i.target.kind + ':' + i.target.id : i.open, pws: i.pws });
58
+ const b = by.get(k); b.n += 1;
59
+ if (i.at != null && (b.oldest == null || i.at < b.oldest)) b.oldest = i.at;
60
+ }
61
+ const bundles = [...by.values()].sort((a, b) => (a.oldest || now) - (b.oldest || now)).map((b) => ({
62
+ key: b.key, title: b.title, product: b.product, count: b.n, oldest: b.oldest, open: b.open, pws: b.pws,
63
+ sub: b.kind === 'target' ? plural(b.n, 'proposal', 'proposals') : b.kind === 'goal-waiting' ? 'Goal waits on you' : 'Goal to check',
64
+ }));
65
+ const ages = items.map((i) => i.at).filter((v) => v != null);
66
+ return { count: items.length, newCount: fresh.length, items: fresh.slice(0, MAX_NEW), more: Math.max(0, fresh.length - MAX_NEW), bundles, oldest: ages.length ? Math.min(...ages) : null, seenAt: seen.all || null };
67
+ }
68
+
69
+ /** The open proposals of each included product whose board is in Approve mode: the set GET /api/driver/open gives the Agent proposals dialog. A ledger that cannot be read gives none. */
70
+ function readProposals(available) {
71
+ const D = require('./driver.js'), DN = require('./driver-needs.js');
72
+ const out = [];
73
+ for (const a of available || []) {
74
+ if (!a || !a.on || !a.root) continue;
75
+ try {
76
+ const dir = D.stateDirOf(a.root); if (!dir) continue;
77
+ const state = D.fold(D.readLines(D.ledgerFile(dir)));
78
+ if (!state.proposals.size) continue;
79
+ let titles = new Map(); try { titles = DN.titlesOf({ root: a.root }); } catch { /* the ids stand in */ }
80
+ for (const p of D.openProposals(state)) {
81
+ if (!p.target || (p.target.ws && p.target.ws !== a.ws)) continue;
82
+ if (D.modeOf(state, p.target.kind === 'work' ? 'work' : null) !== 'approve') continue;
83
+ out.push({ p, ws: a.ws, product: a.name, targetTitle: titles.get(p.target.kind + ':' + p.target.id) || '' });
84
+ }
85
+ } catch { /* this product gives no items */ }
86
+ }
87
+ return out;
88
+ }
89
+
90
+ function readSeen(runtimeDir) {
91
+ const seen = { all: 0, ids: new Set() };
92
+ let t; try { t = fs.readFileSync(path.join(runtimeDir, SEEN), 'utf8'); } catch { return seen; }
93
+ for (const l of t.split('\n')) {
94
+ if (!l.trim()) continue;
95
+ let e; try { e = JSON.parse(l); } catch { continue; }
96
+ const at = Date.parse(e && e.at);
97
+ if (e.all === true && Number.isFinite(at)) { seen.all = Math.max(seen.all, at); seen.ids.clear(); }
98
+ else if (Array.isArray(e.ids)) for (const id of e.ids) if (typeof id === 'string') seen.ids.add(id);
99
+ }
100
+ return seen;
101
+ }
102
+ const ID_RE = /^(prop:[^\s]{1,200}|goal:[^\s]{1,200})$/;
103
+ /** The check of a body: null when it is good, else the reason. Pure. */
104
+ function badSeen(b) {
105
+ if (!b || typeof b !== 'object') return 'a body is required';
106
+ if (b.all === true) return null;
107
+ if (!Array.isArray(b.ids) || !b.ids.length || b.ids.length > 100 || !b.ids.every((x) => typeof x === 'string' && ID_RE.test(x))) return 'ids must be 1 to 100 inbox item ids, or all must be true';
108
+ return null;
109
+ }
110
+ function appendSeen(runtimeDir, b, now = new Date()) {
111
+ fs.mkdirSync(runtimeDir, { recursive: true });
112
+ fs.appendFileSync(path.join(runtimeDir, SEEN), JSON.stringify(b.all === true ? { all: true, at: now.toISOString() } : { ids: b.ids, at: now.toISOString() }) + '\n');
113
+ }
114
+
115
+ /** N6: the goal rows join the agent's drafts rows (which buildMany's agentAside already keeps off the list) in model.agent, not in
116
+ * "What you need to do". A row of either kind still on the list moves too; the list and the dock count what stays. */
117
+ function split(model, goals = []) {
118
+ if (!model || !model.list) return model;
119
+ const isAgent = (r) => r && (r.kind === 'agent' || r.kind === 'goal');
120
+ const all = model.list.rows || [], out = all.filter(isAgent);
121
+ if (!out.length && !goals.length && model.agent) return model;
122
+ const keep = all.filter((r) => !isAgent(r)).map((r, k) => Object.assign({}, r, { n: k + 1, first: k === 0 }));
123
+ const rows = (model.agent && model.agent.rows || []).concat(out.filter((r) => r.kind === 'agent'));
124
+ const have = new Set(out.filter((r) => r.kind === 'goal').map((r) => r.key));
125
+ const goalRows = out.filter((r) => r.kind === 'goal').concat(goals.map(({ at, goalState, ...r }) => r).filter((r) => !have.has(r.key)));
126
+ const count = (model.list.count || 0) - out.length;
127
+ return {
128
+ ...model,
129
+ list: { ...model.list, rows: keep, count },
130
+ agent: { rows, goals: goalRows },
131
+ dock: model.dock && model.dock.needs != null ? { ...model.dock, needs: count, label: count === 1 ? 'needs you' : 'need you', next: keep[0] ? keep[0].title : null } : model.dock,
132
+ };
133
+ }
134
+
135
+ module.exports = { build, readProposals, readSeen, appendSeen, badSeen, split, draftsRowKey, SEEN, MAX_NEW };
@@ -60,7 +60,7 @@ function rowFor(model, key) {
60
60
  const d = w.dialog || {};
61
61
  return { title: clip(w.title, 160), subject: clip(w.sub, 240), say: clip(d.say, 600), facts: (d.facts || []).slice(0, 12).map(([a, b]) => clip(a, 40) + ': ' + clip(b, 240)), files: (d.files || []).filter((f) => SAFE_PATH.test(f) && !f.includes('..')).slice(0, 4) };
62
62
  }
63
- let row = (model.list && model.list.rows || []).find((r) => r.key === key), kind = row && row.kind, files = [];
63
+ let row = (model.list && model.list.rows || []).concat(model.agent && model.agent.rows || []).find((r) => r.key === key), kind = row && row.kind, files = []; // premium-agent-inbox: the agent's drafts rows live in model.agent
64
64
  let item = row;
65
65
  if (!row) {
66
66
  const m = /^ev:([a-z]+):(\d+)$/.exec(key);
@@ -71,7 +71,7 @@ function start(p, engine, runtimeDir) {
71
71
  }
72
72
 
73
73
  /** The merged answer for the workspaces that are on. `available` is choose()'s list (all of them, with `on`). */
74
- async function modelOfMany({ available, engine, runtimeDir, sources, agent }) {
74
+ async function modelOfMany({ available, engine, runtimeDir, sources, agent, agentAside }) {
75
75
  const now = Date.now();
76
76
  const on = (available || []).filter((a) => a.on);
77
77
  const parts = [];
@@ -98,7 +98,7 @@ async function modelOfMany({ available, engine, runtimeDir, sources, agent }) {
98
98
  const settled = parts.filter((p) => p.state === 'ready').length;
99
99
  if (on.length && !settled && parts.every((p) => p.state === 'reading')) return { state: 'reading', elapsed_ms: elapsed };
100
100
  if (on.length && !settled && parts.every((p) => p.state === 'error')) return { state: 'error', error: parts.map((p) => p.product.name + ': ' + p.error).join('; ').slice(0, 300) };
101
- const model = BP.buildMany({ now, asOf: asOf || now, meetings: BP.readMeetings(runtimeDir, now), defers: Object.fromEntries(W.readDefers(runtimeDir, now)), available: (available || []).map((a) => ({ ws: a.ws, name: a.name, home: a.home, on: a.on })), parts, sources, agent });
101
+ const model = BP.buildMany({ now, asOf: asOf || now, meetings: BP.readMeetings(runtimeDir, now), defers: Object.fromEntries(W.readDefers(runtimeDir, now)), available: (available || []).map((a) => ({ ws: a.ws, name: a.name, home: a.home, on: a.on })), parts, sources, agent, agentAside });
102
102
  last = model;
103
103
  return { state: 'ready', model, as_of: asOf || now, refreshing, pending: model.pending, ...(error ? { error } : {}) };
104
104
  }
@@ -415,7 +415,9 @@ function buildMany(g) {
415
415
  const sx = g.sources ? Src.build(Object.assign({}, g.sources, { products: (id) => owner.get(id) || null })) : null;
416
416
  // the agent's drafts (initiative: the agent drafts slice): a product whose agent is stopped on the PM comes before the sources, the open drafts after them
417
417
  const dx = g.agent ? Drafts.build({ parts: g.agent }).rows : [];
418
- const { rows, more } = cut(every.concat(dx.filter((r) => r.detail.blocked), sx ? sx.rows : [], dx.filter((r) => !r.detail.blocked)), putOff);
418
+ // premium-agent-inbox: with agentAside the drafts rows go to model.agent (the bell lists them), so they take no place in the cap of seven
419
+ const listed = g.agentAside ? [] : dx;
420
+ const { rows, more } = cut(every.concat(listed.filter((r) => r.detail.blocked), sx ? sx.rows : [], listed.filter((r) => !r.detail.blocked)), putOff);
419
421
  const tag = (list, p) => list.map((x) => Object.assign({}, x, { ws: p.product.ws, product: p.product.name }));
420
422
  const cf = {
421
423
  now, asOf, meetings, defers: g.defers || {},
@@ -439,7 +441,7 @@ function buildMany(g) {
439
441
  const srcRows = rows.filter((r) => r.kind === 'source'), srcSeen = [...new Set(srcRows.map((r) => r.detail.source))];
440
442
  if (srcRows.length) hero.push({ parts: [{ t: num(srcRows.length) + ' ' + plural(srcRows.length, 'item', 'items') + ' from ' + joinNames(srcSeen.map((k) => Src.SOURCE_WORD[k])), s: true }, { t: ' ' + plural(srcRows.length, 'needs', 'need') + ' you.', s: false }], from: srcRows.map((r) => r.from[0]) });
441
443
  const agRows = rows.filter((r) => r.kind === 'agent'), agAll = dx.length;
442
- if (agAll) hero.push({ parts: [{ t: num(agAll) + ' ' + plural(agAll, 'agent draft', 'agent drafts') + ' ' + (agAll === 1 ? 'waits' : 'wait'), s: true }, { t: ' on you.', s: false }], from: (agRows.length ? agRows : dx).map((r) => r.from[0]) });
444
+ if (agAll && !g.agentAside) hero.push({ parts: [{ t: num(agAll) + ' ' + plural(agAll, 'agent draft', 'agent drafts') + ' ' + (agAll === 1 ? 'waits' : 'wait'), s: true }, { t: ' on you.', s: false }], from: (agRows.length ? agRows : dx).map((r) => r.from[0]) });
443
445
  const sxNote = !sx ? '' : sx.state === 'ok' ? (sx.notRead.length ? ' · not read by the morning brief: ' + sx.notRead.join(', ') : '') : sx.state === 'bad' ? ' · the morning brief could not be read' : ' · no morning brief for today';
444
446
  return {
445
447
  date: dateLine(now),
@@ -450,6 +452,7 @@ function buildMany(g) {
450
452
  today: todayOf(cf),
451
453
  dock: { needs: pending ? null : rows.length + more, label: plural(rows.length + more, 'needs you', 'need you'), next: rows[0] ? rows[0].title : null },
452
454
  products: { available: available.map((a) => ({ ws: a.ws, name: a.name, home: !!a.home, on: !!a.on })), none },
455
+ ...(g.agentAside ? { agent: { rows: dx, goals: [] } } : {}),
453
456
  };
454
457
  }
455
458