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.
@@ -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)}
@@ -1668,6 +1688,45 @@ button.m3-stc{min-height:44px;margin:-7px 0}button.m3-stc:hover{background:var(-
1668
1688
  .m3-kps button:hover{background:var(--well)}.m3-kps time,.m3-kp0 em{font:500 var(--t-small) var(--mono);color:var(--ink-3);font-style:normal}.m3-kps .kd{font-size:var(--t-small);color:var(--ink-3)}
1669
1689
  .m3-ln{display:grid;grid-template-columns:44px 56px minmax(0,1fr);gap:10px;text-align:left;padding:8px 10px;border-radius:14px;font-size:var(--t-body);color:var(--ink-2);line-height:1.45;min-height:44px}.m3-ln time{font:500 var(--t-small) var(--mono);color:var(--ink-3)}.m3-ln b{color:var(--ink)}.m3-ln:hover{background:var(--well)}.m3-ln.cur{background:var(--well);color:var(--ink)}
1670
1690
  .m3-shot{margin:8px 0;display:grid;gap:6px}.m3-shot img{max-width:100%;border-radius:14px;border:1px solid var(--hair)}.m3-shot figcaption{margin:0}
1691
+ /* Replay, as the prototype's replay (prototype/premium-conversation-shell): the whole window, the conversation hidden, the player in the head */
1692
+ #dlg.rpw .dhead .dht,#dlg.rpw #dPane,#dlg.rpw #dExpand{display:none}#dlg.rpw .dhead{justify-content:flex-end}
1693
+ .rpv{max-width:1280px;margin:0 auto}
1694
+ .rpv .m3-fh .i,.rpv .m3-rctl .i,.rpv .m3-now .i,.rpv .m3-lgd .i,.rp-cap .i,.rp-col h4 .i,.rp-q .i{width:14px;height:14px;vertical-align:-2px;margin-right:5px;fill:none;stroke:currentColor;stroke-width:1.8}
1695
+ .rp-hd{padding:16px 18px;border-radius:14px;box-shadow:inset 0 0 0 1.5px var(--b3);margin-bottom:10px}
1696
+ .rp-hd .m3-fh{margin-bottom:10px}.rp-hd .m3-fti .note .i{margin:0 4px 0 2px}
1697
+ .rp-clk{display:grid;justify-items:end;font-family:var(--mono)}.rp-clk b{font-size:var(--t-title)}.rp-clk small{font-size:var(--t-small);color:var(--ink-3)}
1698
+ .rp-hd .m3-rctl{margin-bottom:4px}
1699
+ .rp-tl{position:relative;padding-top:46px}
1700
+ .rp-mks{position:absolute;left:0;right:0;top:0;height:44px}
1701
+ .rp-mk{position:absolute;top:0;width:44px;height:44px;margin-left:-22px;display:grid;place-items:center;border-radius:50%}
1702
+ .rp-mk>span{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;background:var(--card-solid);box-shadow:inset 0 0 0 1.5px var(--ink-2);color:var(--ink-2)}
1703
+ .rp-mk .i{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:2}
1704
+ .rp-mk.action>span,.rp-mk.question>span{box-shadow:inset 0 0 0 1.5px var(--ember-ink);color:var(--ember-ink)}.rp-mk.pm>span{box-shadow:inset 0 0 0 1.5px var(--ink-3);color:var(--ink-3)}
1705
+ .rp-mk.need>span{outline:3px solid color-mix(in oklab,var(--ember) 35%,transparent)}
1706
+ .rp-mk:focus-visible{outline:2px solid var(--ink);outline-offset:-4px}
1707
+ .rp-tl .m3-trk{margin:0}.rp-tl .m3-trk.none .m3-stc{color:var(--ink-3);font-family:var(--sans)}
1708
+ .rp-gap{position:absolute;top:0;bottom:0;background:repeating-linear-gradient(135deg,var(--b3) 0 4px,transparent 4px 8px);border-radius:8px;pointer-events:none}
1709
+ .rp-sc{display:flex;justify-content:space-between;font:500 var(--t-micro) var(--mono);color:var(--ink-3);margin-top:6px}
1710
+ .rpv .m3-lgd .ring{width:11px;height:11px;border-radius:50%;background:none;box-shadow:inset 0 0 0 1.5px var(--ember-ink);vertical-align:-1px}
1711
+ .rpv .m3-now{margin:0 0 10px}.rpv .m3-now .chp{margin-left:auto}.rpv .m3-now .chp~.mtg-b{margin-left:0}
1712
+ .rp-g{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(280px,1fr);gap:10px;align-items:start;margin-bottom:10px}
1713
+ .rp-box{padding:14px 16px;border-radius:14px;box-shadow:inset 0 0 0 1.5px var(--b3);margin-bottom:10px;min-width:0}.rp-g .rp-box{margin-bottom:0}
1714
+ .rp-cap{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-bottom:8px}.rp-cap .note{margin:0 0 0 auto}
1715
+ .rp-none{padding:36px 12px;text-align:center;border-radius:14px;background:var(--well)}
1716
+ .rp-ts{display:flex;flex-wrap:wrap;gap:4px;margin-top:8px}.rp-ts .mtg-b{font-family:var(--mono)}.rp-ts .mtg-b[aria-pressed="true"]{box-shadow:inset 0 0 0 1.5px var(--ink);color:var(--ink)}
1717
+ .rp-cv{display:flex;flex-direction:column;max-height:620px}
1718
+ .rp-cvh .seg2 .mtg-b{min-width:44px;justify-content:center}.rp-cvh{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;padding-bottom:8px;border-bottom:1px solid var(--hair)}.rp-cvh .rp-cap{margin:0}
1719
+ .rp-cv .m3-ftr{flex:1;overflow:auto;min-height:160px;margin:6px 0}
1720
+ .rp-cv .m3-ln{grid-template-columns:48px 64px minmax(0,1fr)}.m3-ln.pm b{color:var(--ink-2)}.m3-ln.pm.fut,.rp-cv .m3-ln.fut{opacity:.55}
1721
+ .rp-kt{font-style:normal;font-size:var(--t-micro);font-weight:600;color:var(--ember-ink);margin-right:6px;text-transform:uppercase;letter-spacing:.04em}
1722
+ .rp-q{display:flex;align-items:center;gap:6px;min-height:44px;padding:0 12px;border-radius:12px;background:var(--well);color:var(--ink-3)}.rp-q input{flex:1;min-width:0;min-height:44px;border:0;background:none;color:var(--ink);font:inherit}.rp-q input:focus-visible{outline:none}.rp-q:focus-within{box-shadow:inset 0 0 0 2px var(--ink)}
1723
+ .rp-kc{grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-top:10px}
1724
+ .rp-col{display:grid;align-content:start}.rp-col h4{display:flex;align-items:center;gap:2px;margin:0 0 6px;font-size:var(--t-small);color:var(--ink-2)}.rp-col h4 small{margin-left:6px;font-family:var(--mono);color:var(--ink-3)}
1725
+ .rp-kc button,.rp-kc .m3-kp0{grid-template-columns:minmax(0,1fr) auto}.rp-kc .kd{display:none}
1726
+ .rp-kc .need{box-shadow:inset 3px 0 0 var(--ember)}
1727
+ .rp-tg{display:flex;gap:8px;flex-wrap:wrap;margin-top:4px;font-size:var(--t-small);color:var(--ink-3)}.rp-tg .warn{color:var(--ember-ink)}
1728
+ @media (hover:hover){.rp-mk:hover>span{background:var(--well)}}
1729
+ @media (max-width:1000px){.rp-g,.rp-kc{grid-template-columns:minmax(0,1fr)}.rp-cv{max-height:none}.rp-cv .m3-ftr{max-height:420px}.rp-clk{justify-items:start}}
1671
1730
  @media (max-width:1000px){.m3-cap{grid-template-columns:1fr}.m3-kps button,.m3-kp0{grid-template-columns:70px minmax(0,1fr)}.m3-kps time,.m3-kp0 em{display:none}.m3-ln{grid-template-columns:40px 48px minmax(0,1fr)}}
1672
1731
 
1673
1732
  /* ---- the premium Welcome page and the first-Briefing card (initiative premium-welcome): the approved mockup's rules (prototype/premium-welcome) ---- */
@@ -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, 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"/>',
@@ -25,7 +25,7 @@ const on = new Set(Object.keys(SRC));
25
25
  const pinned = new Set();
26
26
 
27
27
  wireRail('brief');
28
- const week = mountMeeting({ $, $$, esc, openDlg, toast, pmGet, pmPost, turnA, ptx, kv, H, ws: () => new URLSearchParams(location.search).get('ws'), redraw: () => { if (M) drawTl(); } });
28
+ const week = mountMeeting({ $, $$, esc, openDlg, toast, pmGet, pmPost, turnA, ptx, kv, H, setMode, setFull, ws: () => new URLSearchParams(location.search).get('ws'), redraw: () => { if (M) drawTl(); } });
29
29
  mountCalEntry($('#todayCard'), { $, esc, openDlg, setMode, turnA, ptx, pmGet, ws: () => new URLSearchParams(location.search).get('ws'), openRow: week.openRow }); // the full calendar: Day, Week and Month in the viewer
30
30
  mountNotes({ $, esc, openDlg, toast, pmGet, pmPost, task: week.task });
31
31
 
@@ -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
- return { rows: CL.map((r, i) => ({ ...r, n: i + 1 })), count: CL.length, more: 0, putOff: [], order: CL_ORDER, pendingNote: '' };
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 ? CL.length : M.dock.needs;
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 }), or null for every proposal. Show all clears it. */
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,