create-pmos 0.344.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 +13 -18
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-test.js +30 -16
- package/workspace/changelog.json +12 -0
- package/workspace/guide/briefing-premium.md +17 -5
- package/workspace/lib/agent-inbox.js +135 -0
- package/workspace/lib/briefing-premium-agent.js +1 -1
- package/workspace/lib/briefing-premium-products.js +2 -2
- package/workspace/lib/briefing-premium.js +5 -2
- package/workspace/lib/goal-chat.js +6 -4
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-briefing-premium.js +5 -3
- package/workspace/lib/routes-inbox.js +44 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/premium-shell.js +72 -14
- package/workspace/public/pm/premium.css +20 -0
- package/workspace/public/pm/premium.js +55 -9
- package/workspace/test-files.json +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "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,18 @@
|
|
|
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
|
+
},
|
|
35
47
|
{
|
|
36
48
|
"v": "0.344.0",
|
|
37
49
|
"at": "2026-10-20T05:29:13.194Z",
|
|
@@ -284,23 +296,6 @@
|
|
|
284
296
|
"s": "A whole-line HTML comment is kept in the page as a hidden block and is never drawn."
|
|
285
297
|
}
|
|
286
298
|
]
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
"v": "0.325.0",
|
|
290
|
-
"at": "2026-10-19T22:48:34.964Z",
|
|
291
|
-
"f": 2,
|
|
292
|
-
"prs": [
|
|
293
|
-
{
|
|
294
|
-
"n": 912,
|
|
295
|
-
"t": "An initiative and its tasks open as viewer tabs",
|
|
296
|
-
"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."
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"n": 913,
|
|
300
|
-
"t": "Notes list in the premium dialog, a note beside it, one stage interface for the note sheet",
|
|
301
|
-
"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)."
|
|
302
|
-
}
|
|
303
|
-
]
|
|
304
299
|
}
|
|
305
300
|
]
|
|
306
301
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-20T05:
|
|
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:
|
|
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:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-20T05:50:16Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
117
|
-
ok('SB6 the bell lists
|
|
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:
|
|
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
|
|
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 ===
|
|
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
|
|
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 ===
|
|
537
|
-
|
|
538
|
-
await cp.
|
|
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
|
|
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) */
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
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
|
+
},
|
|
2
14
|
{
|
|
3
15
|
"v": "0.344.0",
|
|
4
16
|
"at": "2026-10-20T05:29:13.194Z",
|
|
@@ -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**
|
|
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
|
|
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.
|
|
@@ -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
|
|
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
|
-
|
|
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
|
|
|
@@ -142,7 +142,9 @@ function resume({ runtimeDir, key, now = new Date() }) {
|
|
|
142
142
|
* A row goes when the PM writes in the conversation, starts a new /goal there, or after ROW_DAYS. */
|
|
143
143
|
const ROW_DAYS = 7;
|
|
144
144
|
const ROW_TITLE = { done: 'Check the goal Claude finished', waiting: 'Claude needs you on a goal', stopped: 'A goal stopped before it was done' };
|
|
145
|
-
function briefingRows(runtimeDir, now = Date.now()) {
|
|
145
|
+
function briefingRows(runtimeDir, now = Date.now()) { return goalRowsAt(runtimeDir, now).map(({ at, goalState, ...r }) => r); }
|
|
146
|
+
/** briefingRows with each row's `at` (ms of the goal's last event) and `goalState` (done, stopped, waiting) kept: the bell's inbox orders and marks new by it (premium-agent-inbox). */
|
|
147
|
+
function goalRowsAt(runtimeDir, now = Date.now()) {
|
|
146
148
|
let t; try { t = fs.readFileSync(path.join(runtimeDir, RUNS), 'utf8'); } catch { return []; }
|
|
147
149
|
const keys = new Set();
|
|
148
150
|
for (const l of t.split('\n')) { if (!l.trim()) continue; try { const e = JSON.parse(l); if (e && typeof e.key === 'string') keys.add(e.key); } catch { /* skip */ } }
|
|
@@ -155,7 +157,7 @@ function briefingRows(runtimeDir, now = Date.now()) {
|
|
|
155
157
|
const all = g.draft.done || [], met = (g.met || []).length;
|
|
156
158
|
const why = g.state === 'stopped' ? (REASON[g.reason] || 'It stopped.') : g.state === 'waiting' ? 'Claude asked you something in the conversation.' : 'Claude reports every done point met. It checked its own work.';
|
|
157
159
|
out.push({
|
|
158
|
-
kind: 'goal', key: 'goal:' + key, chatKey: key, title: ROW_TITLE[g.state], subject: clip(g.draft.goal, 90),
|
|
160
|
+
kind: 'goal', key: 'goal:' + key, chatKey: key, goalState: g.state, title: ROW_TITLE[g.state], subject: clip(g.draft.goal, 90),
|
|
159
161
|
prepared: met + ' of ' + all.length + ' done points met, as Claude reports it. ' + why,
|
|
160
162
|
skip: g.state === 'waiting' ? 'If you skip: the goal waits and nothing more is done on it.' : 'If you skip: nobody checks the work before it is relied on.',
|
|
161
163
|
at,
|
|
@@ -169,7 +171,7 @@ function briefingRows(runtimeDir, now = Date.now()) {
|
|
|
169
171
|
});
|
|
170
172
|
}
|
|
171
173
|
// the newest first, those that wait on the PM before the rest
|
|
172
|
-
return out.sort((a, b) => ((a.title === ROW_TITLE.waiting ? 0 : 1) - (b.title === ROW_TITLE.waiting ? 0 : 1)) || (b.at - a.at))
|
|
174
|
+
return out.sort((a, b) => ((a.title === ROW_TITLE.waiting ? 0 : 1) - (b.title === ROW_TITLE.waiting ? 0 : 1)) || (b.at - a.at));
|
|
173
175
|
}
|
|
174
176
|
/** The Briefing model with the goal rows first (U7). The rows already on the list follow; the count and the dock count them too. */
|
|
175
177
|
function withGoalRows(model, rows) {
|
|
@@ -218,4 +220,4 @@ function decide({ runtimeDir, key, id, act, draft, session, sessions, now = new
|
|
|
218
220
|
return { status: 200, body: { ok: true, id, state: act === 'start' ? 'started' : 'cancelled' } };
|
|
219
221
|
}
|
|
220
222
|
|
|
221
|
-
module.exports = { parseCommand, grillPrompt, startMessage, cancelMessage, cleanDraft, goalOf, begin, decide, onStop, resume, briefingRows, withGoalRows, blockOf, keyOfSession, hookSettings, MARK, RUNS, LIMIT, NO_PROGRESS, REASON };
|
|
223
|
+
module.exports = { parseCommand, grillPrompt, startMessage, cancelMessage, cleanDraft, goalOf, begin, decide, onStop, resume, briefingRows, goalRowsAt, withGoalRows, blockOf, keyOfSession, hookSettings, MARK, RUNS, LIMIT, NO_PROGRESS, REASON };
|
|
@@ -56,6 +56,7 @@ const MODULES = Object.freeze([
|
|
|
56
56
|
'routes-initiative-premium', // briefing-premium-initiative: the premium initiative page's model from the Initiatives sheet's own routes (read-only)
|
|
57
57
|
'routes-brief-page', // console3 Briefing as the brief: Today agenda, Needs you and Mentions (read-only; writes go through routes-pm-items)
|
|
58
58
|
'routes-mentions', // console3 Briefing Mentions: the PM's read marks (page press only)
|
|
59
|
+
'routes-inbox', // premium-agent-inbox: the bell's agent results and the PM's seen marks (page press only)
|
|
59
60
|
'routes-phone-day', // phone companion: the agent's finished drafts, the evening recap and tomorrow at a glance (read-only)
|
|
60
61
|
'routes-report-facts', // console3 D: GET /api/report-families/facts (read-only, real data only)
|
|
61
62
|
'routes-records', // console3 E1a: ideas, hypotheses, decisions, KR metrics, bets (GET list; page-press add/edit/reading)
|
|
@@ -14,6 +14,7 @@ const guard = require('./pm-guard.js');
|
|
|
14
14
|
const Wr = require('./briefing-premium-writes.js');
|
|
15
15
|
const Ag = require('./briefing-premium-agent.js');
|
|
16
16
|
const Goal = require('./goal-chat.js');
|
|
17
|
+
const Inbox = require('./agent-inbox.js');
|
|
17
18
|
const actor = require('./actor.js');
|
|
18
19
|
const WP = require('./my-work-premium.js');
|
|
19
20
|
const BoardP = require('./board-premium.js');
|
|
@@ -106,6 +107,7 @@ async function post(req, res, url, ctx) {
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
module.exports = {
|
|
110
|
+
products,
|
|
109
111
|
prefixes: ['/api/briefing-premium'],
|
|
110
112
|
handle: async (req, res, url, ctx) => {
|
|
111
113
|
if (url.pathname === '/api/briefing-premium/goal-stop') {
|
|
@@ -139,8 +141,8 @@ module.exports = {
|
|
|
139
141
|
const sel = products(ctx);
|
|
140
142
|
const sources = await Src.readSources(ctx, Date.now()).catch(() => null);
|
|
141
143
|
const agent = Drafts.readDrafts(sel.available);
|
|
142
|
-
const r = await Prod.modelOfMany({ available: sel.available, engine: enginePath(), runtimeDir: ctx.runtimeDir, sources, agent });
|
|
143
|
-
if (r.model
|
|
144
|
+
const r = await Prod.modelOfMany({ available: sel.available, engine: enginePath(), runtimeDir: ctx.runtimeDir, sources, agent, agentAside: true });
|
|
145
|
+
if (r.model) r.model = Inbox.split(r.model, ctx.runtimeDir ? Goal.goalRowsAt(ctx.runtimeDir) : []); // premium-chat-session U7: goals read live, not cached; premium-agent-inbox: they and the drafts go to the bell
|
|
144
146
|
ctx.json(res, r.state === 'error' ? { ok: false, ...r } : { ok: true, ...r }, r.state === 'ready' ? 200 : r.state === 'reading' ? 202 : 500);
|
|
145
147
|
return true;
|
|
146
148
|
}
|
|
@@ -148,7 +150,7 @@ module.exports = {
|
|
|
148
150
|
try { const w = ctx.getWs && ctx.getWs(url.searchParams.get('ws') || null); root = w && w.root; } catch { root = null; }
|
|
149
151
|
root = root || path.resolve(__dirname, '..', '..');
|
|
150
152
|
const r = await BP.modelOf({ root, engine: enginePath(), runtimeDir: ctx.runtimeDir });
|
|
151
|
-
if (r.model
|
|
153
|
+
if (r.model) r.model = Inbox.split(r.model, ctx.runtimeDir ? Goal.goalRowsAt(ctx.runtimeDir) : []);
|
|
152
154
|
// 200 with the model, 202 while the first read goes on, 500 with the reason when a read failed
|
|
153
155
|
ctx.json(res, r.state === 'error' ? { ok: false, ...r } : { ok: true, ...r }, r.state === 'ready' ? 200 : r.state === 'reading' ? 202 : 500);
|
|
154
156
|
return true;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* routes-inbox.js — the bell's inbox of agent results that wait on the PM (initiative premium-agent-inbox).
|
|
3
|
+
*
|
|
4
|
+
* GET /api/inbox → { ok, count, newCount, items, more, bundles, oldest, seenAt } lib/agent-inbox.js build()
|
|
5
|
+
* POST /api/inbox/seen { ids } | { all } → { ok } one line in <runtime>/inbox-seen.jsonl, a page press only (pm-guard requirePagePress)
|
|
6
|
+
*
|
|
7
|
+
* The read takes the products the premium Briefing reads (routes-briefing-premium products), their Driver ledgers and the goal rows.
|
|
8
|
+
* Seen is not done: an item goes only when its record changes. Nothing here decides a proposal or sends anything. */
|
|
9
|
+
const guard = require('./pm-guard.js');
|
|
10
|
+
const Inbox = require('./agent-inbox.js');
|
|
11
|
+
const Goal = require('./goal-chat.js');
|
|
12
|
+
|
|
13
|
+
module.exports = {
|
|
14
|
+
prefixes: ['/api/inbox'],
|
|
15
|
+
handle: async (req, res, url, ctx) => {
|
|
16
|
+
if (url.pathname === '/api/inbox/seen') {
|
|
17
|
+
if (req.method !== 'POST') { ctx.json(res, { ok: false, error: 'POST only' }, 405); return true; }
|
|
18
|
+
const got = await ctx.readJson(req);
|
|
19
|
+
if (!got.ok) { ctx.json(res, { ok: false, error: 'invalid JSON body' }, 400); return true; }
|
|
20
|
+
const b = got.body || {};
|
|
21
|
+
const g = guard.requirePagePress(req, b);
|
|
22
|
+
if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
|
|
23
|
+
const err = Inbox.badSeen(b);
|
|
24
|
+
if (err) { ctx.json(res, { ok: false, error: err }, 400); return true; }
|
|
25
|
+
if (!ctx.runtimeDir) { ctx.json(res, { ok: false, error: 'no runtime folder' }, 500); return true; }
|
|
26
|
+
Inbox.appendSeen(ctx.runtimeDir, b);
|
|
27
|
+
ctx.json(res, { ok: true });
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (url.pathname !== '/api/inbox') return false;
|
|
31
|
+
if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
|
|
32
|
+
const { products } = require('./routes-briefing-premium.js');
|
|
33
|
+
let available = [];
|
|
34
|
+
try { available = products(ctx).available; } catch { available = []; }
|
|
35
|
+
const out = Inbox.build({
|
|
36
|
+
proposals: Inbox.readProposals(available),
|
|
37
|
+
goals: ctx.runtimeDir ? Goal.goalRowsAt(ctx.runtimeDir) : [],
|
|
38
|
+
seen: ctx.runtimeDir ? Inbox.readSeen(ctx.runtimeDir) : undefined,
|
|
39
|
+
now: Date.now(),
|
|
40
|
+
});
|
|
41
|
+
ctx.json(res, { ok: true, ...out });
|
|
42
|
+
return true;
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.345.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.345.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -163,7 +163,14 @@ tbMount(); // the top bar first: the menu holds the Settings, Agent sessions,
|
|
|
163
163
|
|
|
164
164
|
/* ── toast ──────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
165
165
|
let tt = null;
|
|
166
|
-
export function toast(msg
|
|
166
|
+
export function toast(msg, act) {
|
|
167
|
+
const t = $('#toast'); t.textContent = msg; t.classList.add('on'); clearTimeout(tt);
|
|
168
|
+
if (act) { // premium-agent-inbox: one action on the toast (the bell's "Review"), kept a little longer so it can be pressed
|
|
169
|
+
const b = document.createElement('button'); b.type = 'button'; b.className = 'cta'; b.textContent = act.label;
|
|
170
|
+
b.onclick = () => { t.classList.remove('on'); act.fn(); }; t.appendChild(b);
|
|
171
|
+
}
|
|
172
|
+
tt = setTimeout(() => t.classList.remove('on'), act ? 9000 : 4200);
|
|
173
|
+
}
|
|
167
174
|
|
|
168
175
|
/* ── the standard dialog: detail first, the conversation beside it (Detail tab first on a phone) ─────────── */
|
|
169
176
|
export const kv = (rows) => `<div class="kv2">${rows.filter((r) => r && r[1]).map(([k, v]) => `<span>${esc(k)}</span><span>${esc(v)}</span>`).join('')}</div>`;
|
|
@@ -499,19 +506,26 @@ const PV_WS = new URLSearchParams(location.search).get('ws');
|
|
|
499
506
|
const pvQ = (sep) => (PV_WS ? sep + 'ws=' + encodeURIComponent(PV_WS) : '');
|
|
500
507
|
async function pvGet(u) { try { const r = await fetch(u, { credentials: 'same-origin' }); return { status: r.status, j: await r.json() }; } catch { return { status: 0, j: null }; } }
|
|
501
508
|
const pvOv = { kind: null, back: null, at: 0, list: [], pal: null, need: null };
|
|
509
|
+
/* the bell's inbox (initiative premium-agent-inbox): r is the last GET /api/inbox answer, ids the item ids it held (null before the first read, so the
|
|
510
|
+
* first read never toasts), shown the new ids the open panel shows (closing the panel marks them seen), toastAt the last toast (at most one per 15 min). */
|
|
511
|
+
const IB = { r: null, ids: null, shown: [], toastAt: 0 };
|
|
502
512
|
function pvMount() {
|
|
503
513
|
const a = $('#tbMore'); if (!a || $('#pvBell')) return;
|
|
504
514
|
a.insertAdjacentHTML('beforebegin', `<button class="glass round pv-hp" id="pvBell" aria-haspopup="dialog" aria-label="Needs you" title="Needs you">${BELL}<span class="pv-bdg" id="pvBdg" hidden></span></button>`);
|
|
505
515
|
document.body.insertAdjacentHTML('beforeend', '<div class="pv-scrim" id="pvScrim"></div><div class="pv-ov" id="pvOv" role="dialog" aria-modal="true" hidden inert></div>');
|
|
506
516
|
$('#pvSearch').onclick = () => pvOpen('pal'); $('#pvBell').onclick = () => pvOpen('bell'); $('#pvScrim').onclick = pvClose;
|
|
507
|
-
pvNeeds();
|
|
517
|
+
pvNeeds(); ibRead();
|
|
518
|
+
setInterval(() => { if (!document.hidden) ibRead(); }, 60000);
|
|
519
|
+
document.addEventListener('visibilitychange', () => { if (!document.hidden) ibRead(); });
|
|
508
520
|
}
|
|
509
521
|
export function pvClose() {
|
|
510
522
|
if (!pvOv.kind) return;
|
|
523
|
+
if (pvOv.kind === 'bell' && IB.shown.length) { const ids = IB.shown.slice(0, 100); IB.shown = []; pmPost('/api/inbox/seen', { ids }).then(ibRead); } // seen is not done: they move to Still waiting
|
|
511
524
|
pvOv.kind = null; $('#pvOv').hidden = true; $('#pvOv').inert = true; $('#pvScrim').classList.remove('on');
|
|
512
525
|
$$('.rail,main.stage,#dock').forEach((x) => { x.inert = false; }); $('#dock').inert = !document.body.classList.contains('docked'); document.documentElement.style.overflow = '';
|
|
513
526
|
if (pvOv.back) { try { pvOv.back.focus(); } catch { /* gone */ } }
|
|
514
527
|
}
|
|
528
|
+
export const pvOpenBell = () => pvOpen('bell');
|
|
515
529
|
function pvOpen(kind) {
|
|
516
530
|
if (pvOv.kind === kind) { pvClose(); return; }
|
|
517
531
|
if (pvOv.kind) pvClose();
|
|
@@ -520,7 +534,7 @@ function pvOpen(kind) {
|
|
|
520
534
|
$$('.rail,main.stage,#dock').forEach((x) => { x.inert = true; }); document.documentElement.style.overflow = 'hidden';
|
|
521
535
|
const o = $('#pvOv'); o.className = 'pv-ov ' + kind; o.setAttribute('aria-label', kind === 'pal' ? 'Search' : 'Needs you'); o.hidden = false; o.inert = false; $('#pvScrim').classList.add('on');
|
|
522
536
|
if (kind === 'pal') { o.innerHTML = '<div class="pv-pin">' + SRCH + '<input id="pvQ" type="text" placeholder="Search places, initiatives, documents and sessions" aria-label="Search" autocomplete="off" role="combobox" aria-expanded="true" aria-controls="pvList"><kbd>Esc</kbd></div><div id="pvList" role="listbox" aria-label="Results"></div><p class="pv-note">Ctrl K or / opens this from any page. Arrow keys move, Enter opens.</p>'; $('#pvQ').focus(); pvPal(); }
|
|
523
|
-
else { o.innerHTML = '<div class="pv-hd"><h2>Needs you</h2><small id="pvN"></small
|
|
537
|
+
else { o.innerHTML = '<div class="pv-hd"><h2>Needs you</h2><small id="pvN"></small><button type="button" class="ib-all" id="ibAll" hidden>Mark all seen</button></div><div id="pvList" class="pv-lst"></div>'; pvBellDraw(); pvNeeds(); ibRead(); }
|
|
524
538
|
}
|
|
525
539
|
const pvGo = (it) => { pvClose(); if (it.go) location.assign(it.go); };
|
|
526
540
|
const pvRow = (it, i, sel) => `<button type="button" class="pv-row" role="option" id="pvo${i}" data-i="${i}" aria-selected="${sel}"><span class="gl">${GL[it.gl]}</span><span><b>${esc(it.t)}</b>${it.s ? `<small>${esc(it.s)}</small>` : ''}</span></button>`;
|
|
@@ -551,13 +565,54 @@ function pvPalDraw() {
|
|
|
551
565
|
export function pvFeed(r) {
|
|
552
566
|
const M = r && r.ok && r.model, L = M && M.list;
|
|
553
567
|
pvOv.need = r && r.state === 'reading' ? { state: 'reading' } : L ? { state: 'ready', count: L.count, rows: L.rows || [] } : { state: 'error' };
|
|
554
|
-
const n = pvOv.need, b = $('#pvBdg'), btn = $('#pvBell'); if (!b) return;
|
|
555
|
-
const on = n.state === 'ready' && n.count > 0;
|
|
556
|
-
b.hidden = !on; b.textContent = on ? (n.count > 99 ? '99+' : String(n.count)) : '';
|
|
557
|
-
btn.setAttribute('aria-label', n.state === 'ready' ? 'Needs you: ' + n.count : 'Needs you');
|
|
558
568
|
if (pvOv.kind === 'bell') pvBellDraw();
|
|
559
569
|
}
|
|
560
|
-
|
|
570
|
+
/* ── the bell's inbox (initiative premium-agent-inbox): one item per agent result that waits on the PM, a press opens that exact proposal or goal ── */
|
|
571
|
+
const IB_KIND = { proposal: 'Proposal', draft: 'Draft', 'goal-waiting': 'Goal needs you', 'goal-done': 'Goal finished', 'goal-stopped': 'Goal stopped' };
|
|
572
|
+
const IB_ACT = { proposal: 'Review', draft: 'Read', 'goal-waiting': 'Answer', 'goal-done': 'See result', 'goal-stopped': 'See why' };
|
|
573
|
+
const IB_GL = { proposal: IC('M4 20h4L19 9l-4-4L4 16zM14 6l4 4'), draft: GL.doc, 'goal-waiting': IC('M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8'), 'goal-done': IC('M5 12l5 5L20 7'), 'goal-stopped': IC('M6 6h12v12H6z') };
|
|
574
|
+
const ibAgo = (ms) => { if (ms == null) return ''; const m = Math.round((Date.now() - ms) / 60000); return m < 1 ? 'just now' : m < 60 ? m + ' min ago' : m < 1440 ? Math.round(m / 60) + ' h ago' : Math.round(m / 1440) + (Math.round(m / 1440) === 1 ? ' day ago' : ' days ago'); };
|
|
575
|
+
const ibOld = (ms) => { if (ms == null) return ''; const d = Math.floor((Date.now() - ms) / 86400000); return d < 1 ? 'oldest is from today' : 'oldest is ' + d + (d === 1 ? ' day old' : ' days old'); };
|
|
576
|
+
/** The deep link of an inbox item or bundle: the Briefing opens it (premium.js openParam). */
|
|
577
|
+
export const ibHref = (open, pws) => '/premium.html?' + ['open=' + encodeURIComponent(open), pws ? 'pws=' + encodeURIComponent(pws) : '', PV_WS ? 'ws=' + encodeURIComponent(PV_WS) : ''].filter(Boolean).join('&');
|
|
578
|
+
/** The last inbox answer, for the Briefing's count line: { count, newCount, oldest } or null. */
|
|
579
|
+
export const ibState = () => IB.r;
|
|
580
|
+
async function ibRead() {
|
|
581
|
+
const { j } = await pvGet('/api/inbox');
|
|
582
|
+
if (!j || !j.ok) return;
|
|
583
|
+
const before = IB.ids; IB.r = j; IB.ids = new Set(j.items.map((i) => i.id));
|
|
584
|
+
const fresh = before ? j.items.filter((i) => !before.has(i.id)) : [];
|
|
585
|
+
const b = $('#pvBdg'), btn = $('#pvBell');
|
|
586
|
+
if (b) { b.hidden = !j.newCount; b.textContent = j.newCount > 99 ? '99+' : String(j.newCount || ''); btn.setAttribute('aria-label', j.newCount ? 'Needs you: ' + j.newCount + ' new from the agent' : 'Needs you'); }
|
|
587
|
+
if (fresh.length && pvOv.kind !== 'bell' && Date.now() - IB.toastAt >= 15 * 60000) { // at most one toast every 15 minutes, bundled; never on a page's first read
|
|
588
|
+
IB.toastAt = Date.now();
|
|
589
|
+
if (fresh.length === 1) toast('New from the agent: ' + fresh[0].title, { label: IB_ACT[fresh[0].kind] || 'Open', fn: () => ibGo(fresh[0].open, fresh[0].pws, fresh[0].id) });
|
|
590
|
+
else toast(fresh.length + ' new agent results', { label: 'Open', fn: () => pvOpen('bell') });
|
|
591
|
+
}
|
|
592
|
+
if (pvOv.kind === 'bell') pvBellDraw();
|
|
593
|
+
document.dispatchEvent(new CustomEvent('pmos:inbox', { detail: j }));
|
|
594
|
+
}
|
|
595
|
+
/** Open an inbox item: on the Briefing in place (premium.js listens), elsewhere by the deep link. The item opened is seen. */
|
|
596
|
+
function ibGo(open, pws, id) {
|
|
597
|
+
if (id) { IB.shown = IB.shown.filter((x) => x !== id); pmPost('/api/inbox/seen', { ids: [id] }); }
|
|
598
|
+
pvClose();
|
|
599
|
+
if (!pvOnBriefing()) { location.assign(ibHref(open, pws)); return; }
|
|
600
|
+
document.dispatchEvent(new CustomEvent('pmos:open', { detail: { open, pws } }));
|
|
601
|
+
}
|
|
602
|
+
function ibHtml() {
|
|
603
|
+
const j = IB.r; if (!j) return '';
|
|
604
|
+
const item = (it) => `<div class="ib-it"><span class="gl">${IB_GL[it.kind] || GL.need}</span><span class="ib-b"><b><span class="ib-k">${esc(IB_KIND[it.kind] || 'Agent')}</span>${esc(it.title)}</b><small>${esc([it.product, it.target ? it.target.title : '', ibAgo(it.at)].filter(Boolean).join(' · '))}</small><span class="ib-acts"><button type="button" class="cta" data-ibo="${esc(it.open)}" data-ibw="${esc(it.pws || '')}" data-ibi="${esc(it.id)}">${esc(IB_ACT[it.kind] || 'Open')}</button>${/^row:/.test(it.open) ? '' : `<button type="button" class="cta alt" data-ibo="row:${esc(it.session)}" data-ibi="${esc(it.id)}">Session</button>`}</span></span></div>`;
|
|
605
|
+
const bun = (x) => `<button type="button" class="pv-row ib-bun" data-ibo="${esc(x.open)}" data-ibw="${esc(x.pws || '')}"><span class="gl">${GL.ini}</span><span><b>${esc(x.title)}</b><small>${esc([x.product, x.sub, ibOld(x.oldest)].filter(Boolean).join(' · '))}</small></span></button>`;
|
|
606
|
+
IB.shown = j.items.map((i) => i.id);
|
|
607
|
+
return (j.items.length ? `<div class="pv-grp">New from the agent · ${j.newCount}</div>` + j.items.map(item).join('') + (j.more ? `<p class="pv-note">${j.more} more new. Mark all seen to fold them by piece of work.</p>` : '') : '')
|
|
608
|
+
+ (j.bundles.length ? '<div class="pv-grp">Still waiting · one line per piece of work</div>' + j.bundles.map(bun).join('') : '');
|
|
609
|
+
}
|
|
610
|
+
document.addEventListener('click', (e) => {
|
|
611
|
+
const o = e.target.closest('#pvOv [data-ibo]');
|
|
612
|
+
if (o) { ibGo(o.dataset.ibo, o.dataset.ibw || '', o.dataset.ibi || ''); return; }
|
|
613
|
+
if (e.target.closest('#ibAll')) { IB.shown = []; pmPost('/api/inbox/seen', { all: true }).then((r) => { if (!r || !r.ok) toast('It was not marked seen: ' + ((r && r.error) || 'the server did not answer') + '.'); ibRead(); }); }
|
|
614
|
+
});
|
|
615
|
+
const pvOnBriefing = () => /^\/(?:premium(?:\.html)?|index\.html)?$/.test(location.pathname); // '/' and '/index.html' serve the Briefing too
|
|
561
616
|
async function pvNeeds() {
|
|
562
617
|
if (pvOnBriefing()) return;
|
|
563
618
|
const r = await pvGet('/api/briefing-premium' + pvQ('?'));
|
|
@@ -565,12 +620,15 @@ async function pvNeeds() {
|
|
|
565
620
|
}
|
|
566
621
|
function pvBellDraw() {
|
|
567
622
|
const n = pvOv.need, box = $('#pvList'); if (!box) return;
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
623
|
+
const j = IB.r;
|
|
624
|
+
$('#pvN').textContent = j ? String(j.count) : '';
|
|
625
|
+
$('#ibAll').hidden = !(j && j.newCount);
|
|
626
|
+
// the PM's own work stays on the Briefing: one line here says how much, and a press goes there
|
|
627
|
+
const own = !n || n.state === 'reading' ? 'Your own work is still being read.' : n.state === 'error' ? 'Your own work could not be read.' : n.count ? 'Your own work: ' + n.count + (n.count === 1 ? ' item' : ' items') + ' on the Briefing.' : 'Your own work: nothing waits on the Briefing.';
|
|
628
|
+
pvOv.list = [{ gl: 'need', t: own, s: 'What you need to do', go: '/premium.html' + pvQ('?') }];
|
|
629
|
+
box.innerHTML = (!j ? '<p class="pv-note" role="status">Reading what the agent has for you.</p>' : j.count ? ibHtml() : '<p class="pv-note" role="status">No agent result waits on you.</p>')
|
|
630
|
+
+ '<div class="pv-grp">Yours</div>' + pvRow(pvOv.list[0], 0, false).replace('role="option"', 'role="listitem"').replace(' aria-selected="false"', '')
|
|
631
|
+
+ '<p class="pv-note">An item leaves when you decide it, wherever you decide it. Closing this marks the new ones seen.</p>';
|
|
574
632
|
}
|
|
575
633
|
document.addEventListener('click', (e) => { const b = e.target.closest('#pvList .pv-row'); if (b && pvOv.list[+b.dataset.i]) pvGo(pvOv.list[+b.dataset.i]); });
|
|
576
634
|
document.addEventListener('input', (e) => { if (e.target.id === 'pvQ') { pvOv.at = 0; pvPalDraw(); } });
|
|
@@ -1562,6 +1562,26 @@ button.dsn:hover{box-shadow:inset 0 0 0 1.5px rgb(79,109,245)}
|
|
|
1562
1562
|
.pv-note{margin:0;padding:10px 14px 4px;color:var(--ink-3);font-size:var(--t-small)}
|
|
1563
1563
|
@media (max-width:700px){.pv-ov{top:8vh}.pv-ov.bell{right:16px}}
|
|
1564
1564
|
.pv-row .gl svg{width:20px;height:20px}
|
|
1565
|
+
/* the bell's inbox (initiative premium-agent-inbox): one item per agent result, its main action and its session; the Briefing's count line */
|
|
1566
|
+
.pv-hd .ib-all{margin-left:auto;min-height:44px;padding:0 6px;color:var(--ink-2);font-size:var(--t-small);font-weight:600}
|
|
1567
|
+
.pv-hd .ib-all[hidden]{display:none}
|
|
1568
|
+
.ib-it{display:grid;grid-template-columns:40px minmax(0,1fr);gap:14px;padding:10px 14px;border-radius:var(--r-in)}
|
|
1569
|
+
.ib-it:hover{background:var(--well)}
|
|
1570
|
+
.ib-it .gl{width:40px;height:40px;border-radius:14px;display:grid;place-items:center;background:var(--spot);color:var(--ember-ink)}
|
|
1571
|
+
.ib-it .gl svg{width:20px;height:20px}
|
|
1572
|
+
.ib-b{min-width:0;display:block}
|
|
1573
|
+
.ib-b b{display:block;font-weight:600;line-height:1.35;overflow-wrap:anywhere}
|
|
1574
|
+
.ib-b small{display:block;color:var(--ink-3);font-size:var(--t-small);margin-top:2px;overflow-wrap:anywhere}
|
|
1575
|
+
.ib-k{display:inline-block;margin-right:8px;padding:1px 9px;border-radius:999px;background:var(--spot);color:var(--ember-ink);font-size:var(--t-small);font-weight:600;vertical-align:1px}
|
|
1576
|
+
.ib-acts{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
|
|
1577
|
+
.ib-acts .cta.alt{background:var(--well)}
|
|
1578
|
+
.ib-bun b{white-space:normal}
|
|
1579
|
+
.ib-sum{display:flex;align-items:center;gap:16px;margin-top:14px;padding:14px 16px;border-radius:var(--r-in);background:var(--well)}
|
|
1580
|
+
.ib-sum .ib-n{font:600 var(--fs-6) var(--mono);color:var(--ink)}
|
|
1581
|
+
.ib-sum .ib-b{flex:1}
|
|
1582
|
+
.ib-sum .cta{white-space:nowrap}
|
|
1583
|
+
.toast .cta{height:40px;padding:0 16px}
|
|
1584
|
+
@media (max-width:640px){.ib-sum{flex-wrap:wrap}.ib-sum .cta{width:100%}}
|
|
1565
1585
|
@media (max-width:700px){.top .tools{position:relative}.pkw{position:static}.pkmenu{left:0;right:0;min-width:0}}
|
|
1566
1586
|
/* Settings dialog rows (initiative premium-settings) */
|
|
1567
1587
|
.sr{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;padding:8px 0;border-bottom:1px solid var(--hair)}
|
|
@@ -12,7 +12,7 @@ import { lineItems, behindOf, refreshTargets, whenRead } from './freshness-words
|
|
|
12
12
|
import { consoleReads, briefOf, needsListOf } from './premium-brief.js';
|
|
13
13
|
import { mountDocSheet } from './premium-doc-sheet.js';
|
|
14
14
|
import { momentOf, inText } from './c3-phone-model.js';
|
|
15
|
-
import { $, $$, esc, store, THEME_KEY, RM, AI, S, theme, toast, kv, H, openDlg, closeDlg, setTab, setMode, setFull, CHECK, CHEV, ptx, turnA, turnU, H1, H2, P1, UL, logHtml, loadThread, onScroll, wireRail, pvFeed, setPageGaps, sourcesHook, onPageChat, openPageChat } from './premium-shell.js';
|
|
15
|
+
import { $, $$, esc, store, THEME_KEY, RM, AI, S, theme, toast, kv, H, openDlg, closeDlg, setTab, setMode, setFull, CHECK, CHEV, ptx, turnA, turnU, H1, H2, P1, UL, logHtml, loadThread, onScroll, wireRail, pvFeed, setPageGaps, sourcesHook, onPageChat, openPageChat, pvOpenBell, ibState } from './premium-shell.js';
|
|
16
16
|
const ICON = {
|
|
17
17
|
meeting: '<rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/>',
|
|
18
18
|
merge: '<circle cx="6" cy="6" r="2"/><circle cx="6" cy="18" r="2"/><circle cx="18" cy="9" r="2"/><path d="M6 8v8M18 11c0 4-6 3-12 5"/>',
|
|
@@ -75,8 +75,18 @@ const CL_ORDER = 'In the order of Needs you on the console: what cannot wait fir
|
|
|
75
75
|
/** The list the page draws: the console's Needs you once it is read, else the model's records-only rows. */
|
|
76
76
|
function LIST() {
|
|
77
77
|
if (!CL) return M.list;
|
|
78
|
-
|
|
78
|
+
const own = CL.filter((r) => !r.prop); // premium-agent-inbox: the Driver's drafts rows are in the bell; the count line below the rows names them
|
|
79
|
+
return { rows: own.map((r, i) => ({ ...r, n: i + 1 })), count: own.length, more: 0, putOff: [], order: CL_ORDER, pendingNote: '' };
|
|
79
80
|
}
|
|
81
|
+
/** The count line of the agent's results under the rows (premium-agent-inbox): the total, the new ones and the oldest, and a press opens the bell. */
|
|
82
|
+
function inboxLine() {
|
|
83
|
+
const j = ibState(); if (!j || !j.count) return '';
|
|
84
|
+
const d = j.oldest == null ? null : Math.floor((Date.now() - j.oldest) / 86400000);
|
|
85
|
+
const sub = [j.newCount ? j.newCount + ' new since you last looked' : 'none new since you last looked', d == null ? '' : d < 1 ? 'the oldest is from today' : 'the oldest is ' + d + (d === 1 ? ' day old' : ' days old')].filter(Boolean).join(' · ');
|
|
86
|
+
return `<div class="ib-sum"><span class="ib-n">${j.count}</span><span class="ib-b"><b>${j.count === 1 ? 'agent result waits' : 'agent results wait'} on you.</b><small>${esc(sub)}</small></span><button type="button" class="cta" id="ibOpen" aria-haspopup="dialog">Open Needs you</button></div>`;
|
|
87
|
+
}
|
|
88
|
+
document.addEventListener('pmos:inbox', () => { if (M) drawRows(); });
|
|
89
|
+
document.addEventListener('click', (e) => { if (e.target.closest('#ibOpen')) pvOpenBell(); });
|
|
80
90
|
function drawRows() {
|
|
81
91
|
const LS = LIST(), pend = M.pending && !CL;
|
|
82
92
|
const rows = LS.rows, L = $('#rank');
|
|
@@ -85,6 +95,9 @@ function drawRows() {
|
|
|
85
95
|
const order = rows.slice().sort((a, b) => (pinned.has(b.key) - pinned.has(a.key)) || (a.n - b.n));
|
|
86
96
|
L.innerHTML = order.map((r, i) => `<div class="rr${i < 3 ? ' lead' : ''}${i === 0 ? ' first' : ''}" data-key="${esc(r.key)}"${linkOf(r) ? ` data-link="${esc(linkOf(r))}"` : ''}><button class="rhd" aria-haspopup="dialog"><span class="rn">${STAMP(i + 1)}</span><span><span class="rt">${esc(r.title)}${i === 0 ? '<em class="tgf">Do this first</em>' : ''}</span><span class="rs">${r.product ? `<b class="pn">${esc(r.product)}</b>` : ''}${esc(r.subject)}</span><span class="sug"><span>${esc(r.prepared)}</span></span>${r.skip ? `<span class="skip">${esc(r.skip)}</span>` : ''}</span></button><button class="rpin" data-pin="${esc(r.key)}" aria-pressed="${pinned.has(r.key)}" aria-label="Pin ${esc(r.title)} to the top" title="Pin to the top"><svg class="i" viewBox="0 0 24 24"><path d="M9 4h6l-1 6 3 3H7l3-3zM12 13v7"/></svg></button></div>`).join('')
|
|
87
97
|
+ (LS.more ? `<p class="note">${LS.more} more ${LS.more === 1 ? 'row is' : 'rows are'} not shown here.</p>` : '');
|
|
98
|
+
if (!$('#ibLine')) $('#calm').insertAdjacentHTML('afterend', '<div id="ibLine"></div>'); // premium-agent-inbox: the agent's results, one count line under the PM's own rows
|
|
99
|
+
$('#ibLine').innerHTML = inboxLine();
|
|
100
|
+
$('#calm b').textContent = ibState() && ibState().count ? 'Nothing of your own waits right now.' : 'Nothing needs you right now.';
|
|
88
101
|
const n = LS.count;
|
|
89
102
|
$('#movesCap').innerHTML = pend ? `${n} ${n === 1 ? 'row' : 'rows'} so far · still reading` : n ? `<b>${done} of ${total}</b> done · ${n} ${n === 1 ? 'row' : 'rows'} left` : 'All clear';
|
|
90
103
|
$('#movesCap').title = 'Counts rows that cleared since this page first read today. A row clears when its record changes.';
|
|
@@ -161,7 +174,7 @@ document.addEventListener('click', (e) => {
|
|
|
161
174
|
|
|
162
175
|
/* ── dock ───────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
163
176
|
function drawDock() {
|
|
164
|
-
const n = CL ?
|
|
177
|
+
const n = CL ? LIST().count : M.dock.needs;
|
|
165
178
|
$('#dN').textContent = n == null ? '·' : n; $('#dLab').textContent = n == null ? 'still reading' : n === 0 ? 'need you' : CL ? (n === 1 ? 'needs you' : 'need you') : M.dock.label;
|
|
166
179
|
}
|
|
167
180
|
|
|
@@ -251,7 +264,7 @@ $('#dBody').addEventListener('click', (e) => {
|
|
|
251
264
|
const lt = e.target.closest('#logT');
|
|
252
265
|
if (lt) { const c = $('#alog').classList.toggle('col'); lt.setAttribute('aria-expanded', !c); return; }
|
|
253
266
|
if (!openR) return;
|
|
254
|
-
if (e.target.closest('#openProps')) { closeDlg(); openPropsDlg(); return; }
|
|
267
|
+
if (e.target.closest('#openProps')) { const r = openR; closeDlg(); openPropsDlg(rowTarget(r)); return; } // a drafts row: that target's proposals only
|
|
255
268
|
const op = e.target.closest('[data-op]');
|
|
256
269
|
if (op) { WHY[openR.key] = ($('#why') || {}).value || ''; SEL[openR.key] = op.dataset.op; $('#card').outerHTML = cardHtml(openR); $('#oMain').innerHTML = paneHtml(openR); ctaState(openR); return; }
|
|
257
270
|
const st = e.target.closest('[data-start]');
|
|
@@ -615,20 +628,30 @@ async function openCoreDraft(t) {
|
|
|
615
628
|
pdSheet.open(d);
|
|
616
629
|
}
|
|
617
630
|
|
|
618
|
-
/* PFOCUS: the one target a "What you need to do" row opened the dialog on ({ kind, ws, id }),
|
|
631
|
+
/* PFOCUS: the one target a "What you need to do" row opened the dialog on ({ kind, ws, id }), the one proposal the bell opened it on ({ proposal, ws }),
|
|
632
|
+
* or null for every proposal. Show all clears it. A focus from the bell (premium-agent-inbox) also carries `bell` and the target's drafts row key `session`. */
|
|
619
633
|
let PFOCUS = null;
|
|
620
|
-
const inFocus = (it) => !PFOCUS || (it.kind === PFOCUS.kind && it.tid === PFOCUS.id && (!PFOCUS.ws || it.ws === PFOCUS.ws));
|
|
634
|
+
const inFocus = (it) => !PFOCUS || (PFOCUS.proposal ? it.id === PFOCUS.proposal && (!PFOCUS.ws || it.ws === PFOCUS.ws) : it.kind === PFOCUS.kind && it.tid === PFOCUS.id && (!PFOCUS.ws || it.ws === PFOCUS.ws));
|
|
635
|
+
/** The Driver target of an agent drafts row (its run id driver-needs:<drafts|blocked>:<kind>:<ws>:<id>), or null: Review the drafts opens that target's proposals. */
|
|
636
|
+
function rowTarget(r) {
|
|
637
|
+
const m = /driver-needs:(?:drafts|blocked):(initiative|work):([^:]+):(.+)$/.exec(String((r && r.from && r.from[0]) || ''));
|
|
638
|
+
return m ? { kind: m[1], ws: m[2], id: m[3] } : null;
|
|
639
|
+
}
|
|
640
|
+
/** The agent's drafts rows and goal rows (in model.agent since premium-agent-inbox) and the list's rows: a deep link opens one by its key. */
|
|
641
|
+
const anyRow = (key) => [].concat(M && M.agent ? M.agent.rows || [] : [], M && M.agent ? M.agent.goals || [] : [], M ? M.list.rows : [], CL || []).find((r) => r.key === key) || null;
|
|
621
642
|
function propsHtml() {
|
|
622
643
|
const a = A.prop; if (!a.ok) return `<p class="nodef err" role="alert">Agent proposals ${esc(said(a))}</p>`;
|
|
623
644
|
const all = a.items.concat([...DEC.values()].map((d) => d.item).filter((it) => !a.items.some((o) => o.id === it.id)));
|
|
624
645
|
const L = all.filter(inFocus), open = a.items.filter(inFocus).length, rest = PFOCUS ? a.items.length - open : 0;
|
|
625
|
-
const more = PFOCUS ? bdActs(bdBtn('Show all proposals', 'pall', null, true)) + (rest ? `<p class="bd-why">${pl(rest, 'more proposal waits', 'more proposals wait')} on other work.</p>` : '') : '';
|
|
646
|
+
const more = PFOCUS ? bdActs(bdBtn('Show all proposals', 'pall', null, true), PFOCUS.session && anyRow(PFOCUS.session) ? bdBtn('Talk to the agent', 'psess', null, true) : '', PFOCUS.bell ? bdBtn('Back to Needs you', 'pbell', null, true) : '') + (rest ? `<p class="bd-why">${pl(rest, 'more proposal waits', 'more proposals wait')} on other work.</p>` : '') : '';
|
|
626
647
|
return (L.length ? `<p class="bd-top">${open ? pl(open, 'proposal waits', 'proposals wait') + ' for you.' : 'All decided.'} The agent drafts and asks you. Nothing it wrote has changed a record until you keep it.</p><div class="bd-list">${L.map(propItem).join('')}</div>` : `<p class="empty3">${CHECK}${PFOCUS ? 'No proposal waits on this one. It may have been decided since the list was read.' : 'No agent proposals wait.'}</p>`) + more
|
|
627
648
|
+ (a.errs.length ? `<p class="note">Not read: ${esc(a.errs[0])}</p>` : '') + '<p class="note">The agent mode (Off, Shadow, Approve) stays in the console. This list shows a kind only when its mode is Approve.</p>';
|
|
628
649
|
}
|
|
629
650
|
async function propPress(e, redraw) {
|
|
630
651
|
const b = e.target.closest('[data-bda]'); if (!b || BUSY) return;
|
|
631
652
|
if (b.dataset.bda === 'pall') { PFOCUS = null; redraw(); return; }
|
|
653
|
+
if (b.dataset.bda === 'psess') { const r = anyRow(PFOCUS && PFOCUS.session); closeDlg(); if (r) openRow(r); return; } // the target's drafts row: its conversation is the agent's session
|
|
654
|
+
if (b.dataset.bda === 'pbell') { closeDlg(); pvOpenBell(); return; }
|
|
632
655
|
const act = b.dataset.bda, id = b.dataset.id, it = openProps().find((x) => x.id === id);
|
|
633
656
|
if (!it) return;
|
|
634
657
|
if (act === 'pnote') { PBACK.add(id); redraw(`[data-bdn="${CSS.escape(id)}"]`); return; }
|
|
@@ -644,6 +667,29 @@ async function propPress(e, redraw) {
|
|
|
644
667
|
toast(act === 'pkeep' ? 'Kept.' : act === 'pback' ? 'Sent back with your note.' : 'Dropped. It counts as a correction.');
|
|
645
668
|
await readAll(['prop']); redraw(`.bd-it[data-id="${CSS.escape(id)}"] .bd-done`);
|
|
646
669
|
}
|
|
670
|
+
/** ?open= (premium-agent-inbox): the bell's deep link. prop:<id> opens the Agent proposals dialog on that one proposal, target:<kind>:<id> on that target's,
|
|
671
|
+
* row:<key> a drafts or goal row's dialog, whose conversation is the session. pws names the product. On this page the bell opens it in place ('pmos:open'). */
|
|
672
|
+
function openParam(open, pws) {
|
|
673
|
+
const v = String(open || ''), ws = pws || null;
|
|
674
|
+
let m;
|
|
675
|
+
if ((m = /^prop:(.+)$/.exec(v))) {
|
|
676
|
+
const it = openProps().find((x) => x.id === m[1] && (!ws || x.ws === ws));
|
|
677
|
+
openPropsDlg({ proposal: m[1], ws, bell: true, session: it ? rowKeyOf(it) : null });
|
|
678
|
+
} else if ((m = /^target:(initiative|work):(.+)$/.exec(v))) openPropsDlg({ kind: m[1], id: m[2], ws, bell: true, session: ws ? rowKeyOf({ kind: m[1], ws, tid: m[2] }) : null });
|
|
679
|
+
else if ((m = /^row:(.+)$/.exec(v))) { const r = anyRow(m[1]); if (r) openRow(r); else toast('That item no longer waits on you. It may have been decided since.'); }
|
|
680
|
+
}
|
|
681
|
+
/** The key of a target's drafts row (lib/agent-inbox.js draftsRowKey): the row's conversation is that target's agent session. */
|
|
682
|
+
function rowKeyOf(it) {
|
|
683
|
+
const k = (M && M.agent && M.agent.rows || []).find((r) => { const t = rowTarget(r); return t && t.kind === it.kind && t.ws === it.ws && t.id === it.tid; });
|
|
684
|
+
return k ? k.key : null;
|
|
685
|
+
}
|
|
686
|
+
function openOpenParam() {
|
|
687
|
+
const q = new URLSearchParams(location.search), v = q.get('open');
|
|
688
|
+
if (!v) return;
|
|
689
|
+
try { const u = new URL(location.href); u.searchParams.delete('open'); u.searchParams.delete('pws'); history.replaceState(history.state, '', u); } catch { /* no history */ }
|
|
690
|
+
openParam(v, q.get('pws'));
|
|
691
|
+
}
|
|
692
|
+
document.addEventListener('pmos:open', (e) => { if (!M) return; const d = e.detail || {}; (A.prop ? Promise.resolve() : readAll(['prop'])).then(() => openParam(d.open, d.pws)); });
|
|
647
693
|
/** ?around=<prop|scan|rep|src|men|pulse> opens that Around you dialog once its read is in: another premium page links here (a board document's Run a scan). */
|
|
648
694
|
function openAroundParam() {
|
|
649
695
|
const k = new URLSearchParams(location.search).get('around'), fn = { prop: openPropsDlg, men: openMen, pulse: openPulse, scan: openScan, rep: openReport, src: openSrc }[k];
|
|
@@ -652,7 +698,7 @@ function openAroundParam() {
|
|
|
652
698
|
fn();
|
|
653
699
|
}
|
|
654
700
|
const openPropsDlg = async (focus) => {
|
|
655
|
-
PFOCUS = focus && focus.kind && focus.id ? focus : null;
|
|
701
|
+
PFOCUS = focus && ((focus.kind && focus.id) || focus.proposal) ? focus : null;
|
|
656
702
|
if (PFOCUS && !A.prop) await readAll(['prop']); // pressed before Around you has read: read the proposals first
|
|
657
703
|
const n = openProps().filter(inFocus).length;
|
|
658
704
|
bdDlg('prop', 'Agent proposals · real data', 'Agent proposals', 'The Initiative Driver, read from each product\'s ledger',
|
|
@@ -982,7 +1028,7 @@ async function load() {
|
|
|
982
1028
|
return;
|
|
983
1029
|
}
|
|
984
1030
|
M = r.model; drawHero(); drawRows(); drawChips(); drawTl(); readPrep(); drawDock(); drawPick(); onScroll();
|
|
985
|
-
if (!AROUND) { AROUND = true; readAll().then(openAroundParam); setInterval(() => { if (!document.hidden && !$('#dlg').classList.contains('on')) readAll(); }, 300000); }
|
|
1031
|
+
if (!AROUND) { AROUND = true; readAll().then(() => { openAroundParam(); openOpenParam(); }); setInterval(() => { if (!document.hidden && !$('#dlg').classList.contains('on')) readAll(); }, 300000); }
|
|
986
1032
|
const age = Date.now() - r.as_of;
|
|
987
1033
|
if (age > 5 * 60000) $('#snap').textContent += ' · read ' + ago(age) + (r.refreshing ? ', refreshing' : '');
|
|
988
1034
|
if (r.error) $('#snap').textContent += ' · the latest read failed: ' + r.error.slice(0, 120);
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"briefing-premium-products.test.js",
|
|
56
56
|
"briefing-premium-sources.test.js",
|
|
57
57
|
"briefing-premium-drafts.test.js",
|
|
58
|
+
"agent-inbox.test.js",
|
|
58
59
|
"briefing-premium-metrics.test.js",
|
|
59
60
|
"premium-welcome.test.js",
|
|
60
61
|
"calendar-events.test.js",
|
|
@@ -230,6 +231,7 @@
|
|
|
230
231
|
"briefing-premium-products.test.js": 1,
|
|
231
232
|
"briefing-premium-sources.test.js": 1,
|
|
232
233
|
"briefing-premium-drafts.test.js": 1,
|
|
234
|
+
"agent-inbox.test.js": 1,
|
|
233
235
|
"briefing-premium-metrics.test.js": 1,
|
|
234
236
|
"premium-welcome.test.js": 1,
|
|
235
237
|
"calendar-events.test.js": 1,
|