create-pmos 0.824.0 → 0.825.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.
Files changed (35) hide show
  1. package/package.json +78 -26
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/changelog.json +77 -12
  7. package/workspace/guide/cli.md +9 -0
  8. package/workspace/guide/home.md +1 -0
  9. package/workspace/guide/settings-and-switches.md +2 -0
  10. package/workspace/lib/autonomy-cli.js +14 -2
  11. package/workspace/lib/connector-data.js +138 -0
  12. package/workspace/lib/connectors-cli.js +6 -0
  13. package/workspace/lib/does-alone.js +67 -0
  14. package/workspace/lib/mention-cli.js +36 -2
  15. package/workspace/lib/name-links.js +203 -0
  16. package/workspace/lib/pmos-verbs.js +3 -0
  17. package/workspace/lib/route-modules.js +1 -0
  18. package/workspace/lib/routes-autonomy.js +9 -0
  19. package/workspace/lib/routes-connector-data.js +17 -0
  20. package/workspace/lib/routes-today-log.js +8 -1
  21. package/workspace/package-lock.json +2 -2
  22. package/workspace/package.json +1 -1
  23. package/workspace/public/pm/connector-data.js +47 -0
  24. package/workspace/public/pm/cozy-name-links.js +118 -0
  25. package/workspace/public/pm/cozy-settings.js +42 -7
  26. package/workspace/public/pm/cozy-today-app.js +26 -0
  27. package/workspace/public/pm/cozy-today-page.css +5 -0
  28. package/workspace/public/pm/cozy-today-view.js +8 -3
  29. package/workspace/public/pm/cozy-today.css +9 -0
  30. package/workspace/public/pm/home-chat.js +16 -1
  31. package/workspace/public/pm/home-hold.js +121 -0
  32. package/workspace/test-lists/connector-data.json +9 -0
  33. package/workspace/test-lists/does-alone.json +9 -0
  34. package/workspace/test-lists/hold-to-talk.json +9 -0
  35. package/workspace/test-lists/name-links.json +9 -0
@@ -58,12 +58,15 @@ import { pmGet, pmPost, pressFetch } from './http.js';
58
58
  import { esc, svg, ICON, toast, wsParam, wsQ } from './cozy-evui.js';
59
59
  import { connectorRows, bannerOf } from './cozy-evmodel.js';
60
60
  import * as CD from './cozy-conndir.js';
61
+ import * as CDA from './connector-data.js'; // connector-data (A150): each connector's one line and its page (GET /api/connector-data)
62
+ import { noteUse } from './use-log.js';
61
63
  import * as SW from './cozy-schedwork.js';
62
64
  import * as AD from './cozy-adler.js';
63
65
  import * as SE from './cozy-seasons.js';
64
66
  import { weeksOf, lineOf, storiesOf } from './upd-weeks.js';
65
67
  import * as SRU from './standing-rules-ui.js';
66
68
  import * as SD from './set-ds.js';
69
+ import { noteUse } from './use-log.js'; // does-alone: one doesAloneOpen line per open of What PMOS does alone
67
70
  import { tintOn, setDayTint } from './day-tint.js'; // bet A339: the Light ground follows the clock
68
71
  import { relayState, relayLoad, relayHtml, relayClick } from './cozy-relay.js'; // event-relay (D110): Connectors › Listening
69
72
  import { extState, extLoad, extHtml, extClick } from './cozy-ext.js'; // meeting-buddy: Connectors › Google Meet, the Chrome extension set up from here
@@ -76,9 +79,9 @@ async function pmSend(method, path, body) {
76
79
  catch (e) { return { ok: false, error: 'could not reach the workspace server — ' + ((e && e.message) || String(e)) }; }
77
80
  }
78
81
  const SECTIONS = SD.SECTIONS;
79
- const SUBS = { adler: 'Adler', jl: 'Jev and Laya', workflows: 'Workflows', uselog: 'Use log', ease: 'Ease check' }; // General › Extras and Workspaces › Workflows: each opens as a sub-panel of its section (U4, U1)
82
+ const SUBS = { adler: 'Adler', jl: 'Jev and Laya', workflows: 'Workflows', uselog: 'Use log', ease: 'Ease check', alone: 'What PMOS does alone' }; // General › Extras and Workspaces › Workflows: each opens as a sub-panel of its section (U4, U1)
80
83
  const SRC = { calendar: 'Calendar', wispr: 'Wispr Flow', mail: 'Mail', slack: 'Slack', jira: 'Jira', confluence: 'Confluence', github: 'GitHub', drive: 'Google Drive', figma: 'Figma', website: 'Your websites' };
81
- const T = { lsOpen: false, el: null, sec: 'general', sub: '', ws: null, st: {}, src: null, con: {}, conn: [], set: null, prods: null, msg: '', busy: false, phase: '', say: '', back: null, fresh: null, reading: '', note: {}, info: false, fold: false, dir: null, q: '', cat: 'all', wait: null, dress: false, more: false, bday: false, dset: {}, wkOpen: new Set(), wkMore: new Set(), arc: false };
84
+ const T = { lsOpen: false, el: null, sec: 'general', sub: '', ws: null, st: {}, src: null, con: {}, conn: [], cd: [], set: null, prods: null, msg: '', busy: false, phase: '', say: '', back: null, fresh: null, reading: '', note: {}, info: false, fold: false, dir: null, q: '', cat: 'all', wait: null, dress: false, more: false, bday: false, dset: {}, wkOpen: new Set(), wkMore: new Set(), arc: false };
82
85
  const cmpVer = (a, b) => { const x = String(a || '0').split('-')[0].split('.').map(Number), y = String(b || '0').split('-')[0].split('.').map(Number); for (let i = 0; i < 3; i++) if ((x[i] || 0) !== (y[i] || 0)) return (x[i] || 0) < (y[i] || 0) ? -1 : 1; return 0; };
83
86
  const home = () => (T.ws && T.ws[0] ? T.st[T.ws[0].id] : null);
84
87
  const latest = () => { const s = home(); return (s && (s.latest || (s.lastCheck && s.lastCheck.latest))) || null; };
@@ -316,13 +319,18 @@ function connList() {
316
319
  const row = (label, key, sub, right, name) => `<div class="ev-trow ev-cn-r">${tile(label, key)}<div class="ev-tx ev-grow"><b>${esc(label)}</b><p class="pm-meta">${esc(sub)}</p></div>${slot(name || key)}${right}</div>`;
317
320
  // a connected connector that backs a brief source carries that source's switch; one that backs none, its own switch (as before)
318
321
  const list = (T.dir && T.dir.connected) || T.conn, backed = new Set(list.map((c) => c.source).filter(Boolean));
319
- const conRows = D.connected.map((c) => { const label = c.label || c.name;
322
+ // a connector the list knows (lib/connector-data.js) says in one line what PMOS reads and writes, and opens its page (connector-data, A150)
323
+ const conRows = D.connected.map((c) => { const label = c.label || c.name; const v = CDA.findView(T.cd, label);
324
+ if (v) return row(label, label, v.line, CDA.openBtn(v), c.name);
320
325
  return c.source && c.source in T.src ? row(label, label, T.src[c.source] ? 'PMOS reads it on its own' : 'PMOS does not read it on its own', sw(T.src[c.source], `data-ev-src="${c.source}"`, label), c.name)
321
326
  : row(label, label, T.con[c.name] ? 'On. Your sessions can use it' : 'Your sessions can use it', sw(T.con[c.name], `data-ev-conn="${esc(c.name)}"`, label), c.name); });
322
327
  // the brief sources no connector backs yet keep their switch, with a + when the directory knows the service
323
328
  const loose = Object.keys(SRC).filter((k) => k in T.src && !backed.has(k) && cOk(SRC[k]));
324
329
  const looseIds = new Set(loose.map((k) => (CD.matchOf(SRC[k]) || {}).id).filter(Boolean));
325
- const looseRows = loose.map((k) => { const m = CD.matchOf(SRC[k]); return row(SRC[k], SRC[k], T.src[k] ? 'PMOS reads it on its own' : 'PMOS does not read it on its own', (m ? plusBtn(m) : '') + sw(T.src[k], `data-ev-src="${k}"`, SRC[k]), k); });
330
+ // zero is silence: a source the list knows that no connector backs shows only its +; one another connector backs (Atlassian → Confluence) its line
331
+ const looseRows = loose.map((k) => { const m = CD.matchOf(SRC[k]); const v = (T.cd || []).find((x) => x.id === k);
332
+ if (v) return CDA.isConnected(v, list) ? row(v.name, v.name, v.line, CDA.openBtn(v), k) : row(SRC[k], SRC[k], 'Not connected', m ? plusBtn(m) : '', k);
333
+ return row(SRC[k], SRC[k], T.src[k] ? 'PMOS reads it on its own' : 'PMOS does not read it on its own', (m ? plusBtn(m) : '') + sw(T.src[k], `data-ev-src="${k}"`, SRC[k]), k); });
326
334
  const count = D.count;
327
335
  const head = `<div class="ev-cn-sec"><b class="ev-lbl ev-grow">Connected · ${count}</b>`
328
336
  + `<button type="button" class="ev-ib pm-btn" data-ev-fold aria-expanded="${!T.fold}" aria-controls="evConMore" aria-label="${T.fold ? 'Show the connected ones' : 'Hide the connected ones'}" title="${T.fold ? 'Show the connected ones' : 'Hide the connected ones'}">${svg(T.fold ? CHEV : ICON.down, 18)}</button></div><p class="pm-meta ev-cn-note">Your sessions can use all of them. A switch chooses what PMOS reads on its own.</p>`;
@@ -337,6 +345,7 @@ function connList() {
337
345
  }
338
346
  function connectors() {
339
347
  if (T.sub && T.sub.startsWith('sw:')) return SW.swBody(T.sub);
348
+ if (T.sub && T.sub.startsWith(CDA.SUB)) return cdPage(T.sub.slice(CDA.SUB.length));
340
349
  const info = T.info ? `<p class="pm-meta ev-info" id="evConInfo">${esc(INFO)}</p>` : '';
341
350
  if (T.src === null) return info + readsHtml() + '<p class="pm-meta">Reading the connectors.</p>';
342
351
  const search = `<label class="ev-cn-search"><span class="ev-vh">Search connectors</span>${svg(ICON.search, 16)}<input type="search" class="ev-inp" id="evConQ" placeholder="Search connectors" value="${esc(T.q || '')}" autocomplete="off"></label>`;
@@ -345,6 +354,12 @@ function connectors() {
345
354
  + `<p class="pm-meta ev-cn-foot">PMOS keeps no passwords or keys. A connector is added in your Claude account: + opens that page, and PMOS notices when it is there.</p></div>`
346
355
  + extHtml(XT) + relayHtml(RL);
347
356
  }
357
+ /** One connector's page (connector-data, A150): the switches show what Settings holds now, so a press shows at once. */
358
+ function cdPage(id) {
359
+ const v = (T.cd || []).find((x) => x.id === id);
360
+ if (!v) return '<p class="pm-meta">Reading what PMOS reads and writes.</p>';
361
+ return CDA.pageHtml({ ...v, reads: v.reads.map((r) => (r.switch && T.src && r.switch in T.src ? { ...r, on: !!T.src[r.switch] } : r)) });
362
+ }
348
363
  /** The directory's read; after a +, again every 5 s with the probe until the connector shows or 2 minutes pass. */
349
364
  async function readDir(probe) {
350
365
  const d = await pmGet('/api/connectors/directory' + (probe ? '?probe=1' : '')).catch(() => null);
@@ -456,7 +471,23 @@ function lessonRow(l) {
456
471
  }
457
472
  const NO_KEY = 'pmos.settings.no';
458
473
  const noSet = () => { try { return new Set(JSON.parse(store.get(NO_KEY) || '[]')); } catch { return new Set(); } };
474
+ /* Settings › How PMOS decides › What PMOS does alone (does-alone, board BatchPagesDS 2, A513): one read-only table, one row per kind of
475
+ * action from GET /api/autonomy/alone (lib/does-alone.js). No switch, no Tabs: a kind's arrow goes back to its way above; the always-ask
476
+ * rows have none. D106 opens the guide page that explains it. */
477
+ function aloneSec() {
478
+ const R = T.al;
479
+ if (!R) return '<p class="pm-meta">Reading what PMOS does alone.</p>';
480
+ if (R.ok === false) return `<p class="pm-meta">What PMOS does alone could not be read: ${esc(R.error || 'the server did not answer')}.</p>`;
481
+ const row = (r) => `<tr><td>${esc(r.what)}</td><td>${r.pmos === 'Asks you' ? `<b>${esc(r.pmos)}</b>` : esc(r.pmos)}</td><td class="pm-meta">${esc(r.since)}</td>`
482
+ + `<td><button type="button" class="pm-btn ghost sm" data-ev-dguide="${esc(r.decision.page)}" aria-label="Open decision ${esc(r.decision.id)}" title="Open the decision">${esc(r.decision.id)}</button></td>`
483
+ + `<td>${r.fixed ? '' : `<button type="button" class="ev-ib pm-btn" data-ev-alone="${esc(r.key)}" aria-label="Change how PMOS does ${esc(r.what)}" title="Change it in How PMOS decides">${svg(CHEV, 18)}</button>`}</td></tr>`;
484
+ return (R.off ? `<p class="pm-meta">PMOS does nothing alone now: ${esc(R.off)}.</p>` : '')
485
+ + `<section class="pm-block" aria-label="What PMOS does alone"><table class="pm-table"><thead><tr><th>Kind of action</th><th>PMOS</th><th>Since</th><th>Decision</th><th aria-label="Change"></th></tr></thead><tbody>${R.rows.map(row).join('')}</tbody></table>`
486
+ + (R.line ? `<p class="pm-said"><span class="pm-star" aria-hidden="true">✦</span> ${esc(R.line)}</p>` : '') + '</section>';
487
+ }
488
+ function loadAlone() { pmGet('/api/autonomy/alone').then((r) => { T.al = r && r.ok ? r : { ok: false, error: (r && r.error) || '' }; draw(); }).catch(() => { T.al = { ok: false }; draw(); }); }
459
489
  function decidesSec() {
490
+ if (T.sub === 'alone') return subHead('alone') + aloneSec();
460
491
  const K = T.ck;
461
492
  const kinds = !K ? '<p class="pm-meta">Reading what PMOS did by itself.</p>' : K.ok === false ? `<p class="pm-meta">What PMOS did could not be read: ${esc(K.error || 'the server did not answer')}.</p>`
462
493
  : !K.kinds.length ? '<p class="pm-meta">PMOS has not changed anything by itself yet. Each kind of change shows here once it has.</p>'
@@ -467,7 +498,7 @@ function decidesSec() {
467
498
  + `<p class="pm-meta ev-lead">When you undo or edit what PMOS did, it writes a lesson and uses it next time.</p>`
468
499
  + (T.lsOpen ? `<div class="rows">${L.slice(0, 8).map(lessonRow).join('')}</div>` : '')
469
500
  + `<button type="button" class="pm-fold" data-ev-lsfold aria-expanded="${T.lsOpen}">${T.lsOpen ? 'Hide the lessons' : `See the ${L.length > 8 ? 8 : L.length} ${L.length === 1 ? 'lesson' : 'lessons'}`}</button></section>` : '';
470
- return sug
501
+ return trow('What PMOS does alone', 'Every kind of action in one list: what PMOS does by itself and what always asks you.', subBtn('alone')) + sug
471
502
  + `<section class="pm-block" aria-label="Changes PMOS makes"><div class="head"><h3 class="pm-h">Changes PMOS makes by itself</h3></div><p class="pm-meta ev-lead">For each kind, how many PMOS made and how many you kept. Quietly: it does it and you can Undo. Show me: it does it and tells you. Ask first: it waits for your yes. Two Undos on a kind and it asks first for 7 days.</p>${kinds}</section>`
472
503
  + `<section class="pm-block" aria-label="Always yours"><div class="head"><h3 class="pm-h">Always yours</h3></div><p class="pm-meta ev-lead">PMOS never does these alone, whatever you set above.</p>${ALWAYS.map(([b, p]) => trow(b, p, '<span class="pm-badge">Always asks</span>')).join('')}</section>`
473
504
  + lessons
@@ -677,6 +708,8 @@ async function press(e) {
677
708
  if (t.dataset.evSec) { e.preventDefault(); const m = MOVED[t.dataset.evSec]; T.sec = m ? m[0] : t.dataset.evSec; T.sub = m ? m[1] : ''; T.msg = ''; T.dress = false; draw(); const f = T.el.querySelector(`[data-ev-sec="${T.sec}"]`); if (f) f.focus(); openCheck(); return; }
678
709
  if ('evClose' in t.dataset) { closeSettings(); return; }
679
710
  if ('evLsfold' in t.dataset) { T.lsOpen = !T.lsOpen; draw(); return; }
711
+ if (t.dataset.evDguide) { import('./premium-vw-open.js').then((M) => M.openGuide(t.dataset.evDguide)).catch(() => {}); return; }
712
+ if (t.dataset.evAlone) { const k = t.dataset.evAlone; T.sub = ''; draw(); const f = T.el.querySelector(`[data-ev-seg="claude.way:${k}"][aria-checked="true"]`) || T.el.querySelector('[data-ev-sub="alone"]'); if (f) f.focus(); return; }
680
713
  if (t.dataset.evSug) { // the Suggestion on How PMOS decides: ✓ sets the kind's way, ✕ hides it here, the pencil goes to the kind's own Tabs
681
714
  const kind = t.dataset.kind, to = t.dataset.to;
682
715
  if (t.dataset.evSug === 'yes') { await saveWay(kind, to); return; }
@@ -696,7 +729,7 @@ async function press(e) {
696
729
  if ('evFold' in t.dataset) { T.fold = !T.fold; draw(); return; }
697
730
  if (t.dataset.evMore) { T.wkMore.add(t.dataset.evMore); draw(); return; }
698
731
  if (t.dataset.evGo) { T.sec = t.dataset.evGo; T.sub = ''; draw(); return; }
699
- if (t.dataset.evSub !== undefined) { const k = t.dataset.evSub, was = T.sub; T.sub = k; if (k === 'uselog') { T.ul = null; loadUseLog(); } if (k === 'ease') { T.ec = null; loadEase(); } T.dress = false; T.more = false; T.bday = false; T.msg = ''; draw(); const f = T.el.querySelector(k ? '[data-ev-sub=""]' : `[data-ev-sub="${was}"]`); if (f) f.focus(); return; }
732
+ if (t.dataset.evSub !== undefined) { const k = t.dataset.evSub, was = T.sub; T.sub = k; if (k === 'uselog') { T.ul = null; loadUseLog(); } if (k === 'ease') { T.ec = null; loadEase(); } if (k === 'alone') { T.al = null; loadAlone(); noteUse('doesAloneOpen'); } T.dress = false; T.more = false; T.bday = false; T.msg = ''; draw(); const f = T.el.querySelector(k ? '[data-ev-sub=""]' : `[data-ev-sub="${was}"]`); if (f) f.focus(); return; }
700
733
  if (t.dataset.evSeg && t.dataset.evSeg.startsWith('claude.way:')) { await saveWay(t.dataset.evSeg.slice(11), t.dataset.v); return; }
701
734
  if (t.dataset.evSeg === 'work.role') {
702
735
  const r = await pmPost('/api/settings', { key: 'work.role', value: t.dataset.v });
@@ -761,7 +794,8 @@ async function press(e) {
761
794
  if (T.busy) return;
762
795
  T.busy = true; T.msg = '';
763
796
  try {
764
- if (t.dataset.evSrc) { const k = t.dataset.evSrc, on = !T.src[k]; const r = await pmPost('/api/proactive/settings', { briefSources: { [k]: on } }); if (r && r.ok) T.src[k] = on; else T.msg = (r && r.error) || 'Not saved.'; }
797
+ if (t.dataset.evCdata) { T.sub = CDA.SUB + t.dataset.evCdata; T.msg = ''; noteUse('connectorData'); draw(); const f = T.el.querySelector('.ev-cd .ev-dr-hd .ev-ib'); if (f) f.focus(); }
798
+ else if (t.dataset.evSrc) { const k = t.dataset.evSrc, on = !T.src[k]; const r = await pmPost('/api/proactive/settings', { briefSources: { [k]: on } }); if (r && r.ok) T.src[k] = on; else T.msg = (r && r.error) || 'Not saved.'; }
765
799
  else if (t.dataset.evConn) { const k = t.dataset.evConn, on = !T.con[k]; const r = await pmPost('/api/proactive/settings', { connectors: { [k]: on } }); if (r && r.ok) T.con[k] = on; else T.msg = (r && r.error) || 'Not saved.'; }
766
800
  else if ('evAdd' in t.dataset) {
767
801
  const root = (T.el.querySelector('#evRoot').value || '').trim();
@@ -854,6 +888,7 @@ async function load() {
854
888
  SRU.load(T.ws.filter((x) => !x.linked), draw).catch(() => {}); // Settings › How PMOS decides › Standing rules
855
889
  T.src = p && p.ok && p.settings ? { ...p.settings.briefSources } : {}; T.con = p && p.ok && p.settings ? { ...p.settings.connectors } : {};
856
890
  T.conn = p && p.connectors && Array.isArray(p.connectors.list) ? p.connectors.list : [];
891
+ pmGet('/api/connector-data').then((d) => { T.cd = d && d.ok ? d.connectors : []; draw(); }).catch(() => { T.cd = []; }); // connector-data (A150)
857
892
  readDir(false).then(() => draw()); // the directory: proposals, ✦ For you signals (initiative connectors-directory)
858
893
  T.set = s && s.ok ? s : null;
859
894
  if (T.set) await AD.loadPrefs(async () => T.set);
@@ -22,6 +22,7 @@ import { wireSwipe } from './cozy-phone-swipe.js';
22
22
  let DG = null; // quiet-rows-digest: pm/digest-view.js, loaded on a Monday only (on other days Today loads nothing of the digest)
23
23
  import { noteUse } from './use-log.js'; // your-move (A468): each press on a Your move row is one ym-act line in the local use log (its health number)
24
24
  import * as QB from './quiet-batch.js'; // quiet-rows: Today's batch, the popup (Approve, Skip, Change it first; nothing sent without a press)
25
+ import * as NL from './cozy-name-links.js'; // name-links (A536): names in a line you typed link to the person, meeting or document, with a small card
25
26
  import * as CC from './change-cues.js'; // idea A313: a short cue on the row that is done, moved or dropped, before the log draws again // the phone: rows and the proposal swipe (phone design, Ph2_today)
26
27
 
27
28
  const ASK_SEND = new Set(['session']);
@@ -39,6 +40,7 @@ export function mountToday(ctx) {
39
40
  if (r && r.ok) X.log = { entries: r.entries || [], marks: r.marks || {}, fixed: r.fixed || {} };
40
41
  X.read = true;
41
42
  draw();
43
+ readNames();
42
44
  readReports();
43
45
  readQuestions();
44
46
  readSignoffs();
@@ -46,6 +48,29 @@ export function mountToday(ctx) {
46
48
  readDigest();
47
49
  readSync();
48
50
  }
51
+ /* name-links (A536, board BatchMoreBDS panel 31): the names in the lines you typed that resolve to one person, meeting or document
52
+ * (GET /api/name-links, lib/name-links.js). A line keeps its words; only the names that resolve to one record become links. Read in
53
+ * batches that keep each address short; a line read once is not read again until the log is read again. */
54
+ async function readNames(list) {
55
+ const own = (list || X.log.entries).filter((e) => e && typeof e.text === 'string' && e.text.trim() && !e.links).slice(-40);
56
+ const batches = [];
57
+ let cur = [], len = 0;
58
+ for (const e of own) {
59
+ const q = 't=' + encodeURIComponent(e.text.slice(0, 400));
60
+ if (cur.length && len + q.length > 6000) { batches.push(cur); cur = []; len = 0; }
61
+ cur.push([e, q]); len += q.length + 1;
62
+ }
63
+ if (cur.length) batches.push(cur);
64
+ let any = false;
65
+ for (const b of batches) {
66
+ const r = await ctx.pmGet('/api/name-links?' + b.map((x) => x[1]).join('&')).catch(() => null);
67
+ if (!r || !r.ok || !Array.isArray(r.lines)) continue;
68
+ b.forEach(([e], i) => { const l = r.lines[i]; e.links = l && Array.isArray(l.spans) ? l.spans : []; if (e.links.length) any = true; });
69
+ }
70
+ if (any) draw();
71
+ }
72
+ if (el) NL.wire(el);
73
+
49
74
  /* open-questions-today (A420, board QuestionsA): every product's register (GET /api/open-questions), one list for the Decide tab. A product
50
75
  * that does not answer is left out; nothing is guessed. Read-only: taking a default and putting it off a week are slice 2. */
51
76
  async function readQuestions() {
@@ -690,6 +715,7 @@ export function mountToday(ctx) {
690
715
  draw();
691
716
  const j = document.getElementById('tdCap'); if (j) j.focus();
692
717
  if (r.entry.filed) filedSay(r.entry.key, r.entry.filed);
718
+ readNames([r.entry]);
693
719
  });
694
720
  }
695
721
  /* The capture box's mic on a phone (PhoneTodayDS: "type or speak"): the browser's own speech recognition, where it has one, writes the
@@ -200,3 +200,8 @@ button.td-ev:focus-visible { outline: none; box-shadow: var(--glow); }
200
200
  .dg-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--space-12); }
201
201
  .dg-on { display: inline-flex; align-items: center; gap: var(--space-8); }
202
202
  .dg-l { margin: 0; padding-left: 1.2em; }
203
+ /* name-links (A536, board BatchMoreBDS panel 31): a name in a line you typed that resolves to one record, and its small card */
204
+ .nl-a { text-decoration: underline; text-decoration-color: var(--blue); text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; border-radius: 2px; }
205
+ .nl-a:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
206
+ .pm-ds .pm-menu.nl-card { position: fixed; z-index: 60; max-width: 260px; }
207
+ .nl-card .nl-h { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; font-size: var(--fs-meta); }
@@ -18,6 +18,7 @@
18
18
 
19
19
  import { dashModel as lineDash, dashHtml as lineDashHtml } from './line-view.js'; // quiet-rows-line: Your move ends with the line's dashed line
20
20
  import { groupsHtml as questionGroups, phoneGroupsHtml as phoneQuestionGroups } from './open-questions-view.js'; // open-questions-today (A420)
21
+ import { linkedHtml } from './cozy-name-links.js'; // name-links (A536): names in a line you typed link to the person, meeting or document
21
22
 
22
23
  /** What a right-click on a Today row names (initiative ask-anywhere): its initiative when it has one, else the row itself. */
23
24
  function askOf(r) {
@@ -78,6 +79,10 @@ export function signoffActs(r) {
78
79
  return ib('so-ask', 'Ask in the tracker: ' + (s.draft || t), I.send, r.key);
79
80
  }
80
81
 
82
+ /** name-links (A536): the words of a line you typed, with the names that resolve to one record as links (r.ref.links: GET /api/name-links);
83
+ * any other row's words, escaped. The words never change. */
84
+ export function ownWords(r) { return r && r.src === 'own' && r.ref && r.ref.links ? linkedHtml(r.title, r.ref.links, esc) : esc(r && r.title); }
85
+
81
86
  /** One row of the log: a ListRow (pm-li). o.lit: the lit first row of a group; o.sopen: its members are listed. */
82
87
  export function rowHtml(r, o = {}) {
83
88
  const [kd, kl] = kindOf(r);
@@ -96,7 +101,7 @@ export function rowHtml(r, o = {}) {
96
101
  const cls = ['td-li', 'pm-li', o.lit && !r.done ? 'now' : '', r.done ? 'done' : '', r.bullet === 'note' || r.src === 'note' ? 'note' : '', r.src === 'lab' ? 'lab' : '', r.member ? 'mem nest' : ''].filter(Boolean).join(' ');
97
102
  // a note, an own event and a done row open nothing: their words are the whole of it
98
103
  const opens = !r.done && r.src !== 'own' && r.src !== 'gone' && r.src !== 'note';
99
- const title = opens ? `<button type="button" class="t td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(t)}${r.members ? ic(I.more, 14) : ''}</button>` : `<span class="t td-t">${esc(t)}</span>`;
104
+ const title = opens ? `<button type="button" class="t td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(t)}${r.members ? ic(I.more, 14) : ''}</button>` : `<span class="t td-t">${ownWords(r)}</span>`;
100
105
  const first = r.first && !r.done && r.src === 'own' ? '<span class="pm-badge blue">First</span>' : '';
101
106
  // capture-words-to-fields: what the words gave, as chips, with the one press that takes the reading off
102
107
  const chips = readChips(r) + fileChip(r);
@@ -188,7 +193,7 @@ export function moveRowHtml(r, n, o = {}) {
188
193
  const late = lateOf(r), age = ageOf(r);
189
194
  const meta = [r.work || '', r.src === 'question' || r.src === 'batch' || r.src === 'signoff-by' ? '' : r.src === 'signoff' ? 'a sign-off' : KIND_WORD[r.type] || '', !late && r.tier !== 3 && age ? plural(age, 'day', 'days') : ''].filter(Boolean).join(' · ');
190
195
  // what the PM typed opens nothing: its words are the whole of it
191
- const title = r.src === 'own' ? `<span class="t td-t">${esc(r.title)}</span>`
196
+ const title = r.src === 'own' ? `<span class="t td-t">${ownWords(r)}</span>`
192
197
  : `<button type="button" class="t td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(r.title)}${r.members ? ic(I.more, 14) : ''}</button>`;
193
198
  return `<div class="td-li pm-li ym-r${n === 1 ? ' now' : ''}" data-key="${esc(r.key)}"${askOf(r)}><span class="ym-n pm-meta" aria-hidden="true">${n}</span>`
194
199
  + `<span class="td-kind" role="img" aria-label="${esc(kl)}">${ic(kd)}</span><span class="txt">${title}${meta ? `<span class="w td-rs">${esc(meta)}</span>` : ''}`
@@ -356,7 +361,7 @@ export function fixLine(r) {
356
361
  export function phoneRowHtml(r, o = {}) {
357
362
  const sw = swipeActs(r);
358
363
  const opens = !r.done && r.src !== 'own' && r.src !== 'gone' && r.src !== 'note';
359
- const title = opens ? `<button type="button" class="tdp-t" data-td="open" data-key="${esc(r.key)}">${esc(r.title)}</button>` : `<span class="tdp-t">${esc(r.title)}</span>`;
364
+ const title = opens ? `<button type="button" class="tdp-t" data-td="open" data-key="${esc(r.key)}">${esc(r.title)}</button>` : `<span class="tdp-t">${ownWords(r)}</span>`;
360
365
  const jb = r.job || (r.bullet === 'event' ? 'Event' : r.bullet === 'note' || r.src === 'note' ? 'Note' : '');
361
366
  const late = lateOf(r);
362
367
  const meta = [jb ? `${svg(JOB_IC[jb] || (jb === 'Event' ? KIND.event[0] : TI.Note), 13, 1.8)}<span>${esc(jb)}</span>` : '', r.work ? esc(r.work) : '',
@@ -199,6 +199,15 @@ body.cz-home .hm-r.lr .hm-tile { width: 32px; height: 32px; }
199
199
  .hm-chat .hm-box.ut-on, .hm-chat .hm-basic.ut-on { box-shadow: 0 0 0 2px var(--cz-bluebg); }
200
200
  .ut-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; background: var(--cz-card); border-radius: 28px 28px 0 0; box-shadow: var(--cz-sheet); padding: 10px var(--space-16) calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
201
201
  .ut-sheet[hidden] { display: none; }
202
+ /* hold-to-talk (A13, board BatchPagesDS panel 3): the hold sheet, and a mic a long press does not select or open a menu on */
203
+ .ut-holdsheet { align-items: center; text-align: center; }
204
+ .ut-hold { display: flex; flex-direction: column; align-items: center; gap: var(--space-8); }
205
+ .ut-hold-mic { width: var(--space-64); height: var(--space-64); border-radius: 50%; background: var(--cz-blue); color: var(--cz-card); display: grid; place-items: center; }
206
+ .ut-hold-mic.off { background: var(--cz-ink2); }
207
+ .ut-hold-mic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
208
+ .ut-hold-said { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-ink); }
209
+ .ut-hold-hint { margin: 0; font-size: var(--fs-label); line-height: var(--lh-label); color: var(--cz-ink2); }
210
+ @media (pointer: coarse) { .ut-mic { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; } }
202
211
  .ut-sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--cz-c-c5c9d0); align-self: center; margin-bottom: var(--space-4); }
203
212
  .ut-sheet h3 { margin: 0; font-size: var(--fs-section); font-weight: var(--fw-strong); line-height: var(--lh-section); }
204
213
  .ut-sheet .bar { display: flex; align-items: center; gap: 10px; height: 56px; border-radius: var(--radius-pill); background: var(--cz-bluebg); color: var(--cz-blueink); padding: 0 6px 0 var(--space-16); }
@@ -8,7 +8,8 @@
8
8
  * Claude asks. Where a goal finished, a quiet divider ("Goal done", or in amber why it stopped). Over the box: "Also waiting on you". One box for
9
9
  * every conversation (+, the In:/To: chip, the key hint, ↑ send; typing / opens the commands). The + menu holds Attach a file, the Notes and the terminal of the conversation, and Link to an initiative for a loose session.
10
10
  * The mic is part of the input (canvas HmMic): press it and speak, the words appear as text in the box with a small blue dot while it
11
- * listens, press it again to stop, edit, send. On a phone it opens the "Speak to Claude" sheet (HmPhone): Discard, or stop and send.
11
+ * listens, press it again to stop, edit, send. On a phone a tap opens the "Speak to PMOS" sheet (HmPhone): Discard, or stop and send; a hold
12
+ * talks until you let go, which sends, and sliding left cancels (hold-to-talk, A13, pm/home-hold.js).
12
13
  * Nothing is saved as audio (home-dictate.js). A card the target brings (intro.card, the decision card of HmDecide) draws under the intro.
13
14
  *
14
15
  * The words are Claude Code's own transcript. A conversation is either a chat key (GET /api/briefing-premium/thread?key=, the session it
@@ -39,6 +40,7 @@ import { splitSrc, srcHtml } from './chat-src.js'; // chief-of-staff C1: where
39
40
  import { splitFiles, filesHtml, sizeText, MAX_BYTES, MAX_FILES, setAttachSink } from './premium-attach.js';
40
41
  import * as VWC from './cozy-viewer.js';
41
42
  import { canDictate, dictate } from './home-dictate.js';
43
+ import { holdChat, wireHold } from './home-hold.js'; // hold-to-talk (A13): on a phone, hold the mic, let go to send, slide left to cancel
42
44
  import { adler } from './cozy-adler.js';
43
45
  import { snapOf, turnEnded } from './chat-turn-end.js'; // a finished turn re-reads what the Viewer shows (batch 25 item 3)
44
46
  import { nextPromptUi } from './next-prompt-ui.js'; // the suggested next prompt and the Sharper card above the box (batch 26 item 2)
@@ -733,6 +735,19 @@ export function mountChat(el, host) {
733
735
  drawFoot({ role: role() });
734
736
  const ta = box(); if (ta && host.desk()) ta.focus();
735
737
  }
738
+ /* hold-to-talk (A13, board BatchPagesDS panel 3): on a phone, hold the mic and talk; letting go submits this form, the same send as typed
739
+ * text; sliding left cancels. A short tap keeps the Speak sheet above. */
740
+ const hold = holdChat({
741
+ dictate, box, esc, toast: (t) => host.toast(t), note: (id) => noteUse(id), log: (l) => console.info(l),
742
+ submit: () => { const f = el.querySelector('#hmForm'); if (f) f.requestSubmit(); },
743
+ sheet: (html) => {
744
+ let sh = document.getElementById('utHold');
745
+ if (!html) { if (sh) sh.hidden = true; return; }
746
+ if (!sh) { document.body.insertAdjacentHTML('beforeend', '<div class="ut-sheet ut-holdsheet" id="utHold" aria-label="Speak to PMOS" hidden></div>'); sh = document.getElementById('utHold'); }
747
+ sh.innerHTML = html; sh.hidden = false;
748
+ },
749
+ });
750
+ wireHold(el, { skip: () => host.desk() || !canDictate(), on: () => !!(C.dict && C.dict.on()) || hold.on(), start: () => hold.start(), send: () => hold.send(), cancel: () => hold.cancel(), move: (l) => hold.move(l) });
736
751
  function sheetOf(s) {
737
752
  let sh = document.getElementById('utSpeak');
738
753
  if (!s.on) { if (sh) sh.hidden = true; return; }
@@ -0,0 +1,121 @@
1
+ /* pm/home-hold.js — hold the chat mic to talk, on the phone (idea A13, initiative hold-to-talk; board BatchPagesDS panel 3, agreed
2
+ * 2026-11-25). Press and hold the mic in the chat input: the words show while you talk, letting go sends them, sliding left cancels.
3
+ * A short tap keeps the tap the mic had (the Speak sheet). There is no new screen and no path of its own: letting go submits the same chat
4
+ * form as typed text, so a question gets an answer, a change is done with Undo, changes others see still go to the daily batch and
5
+ * irreversible ones still ask. This file makes no request.
6
+ *
7
+ * HOLD_MS · CANCEL_PX
8
+ * step(state, ev) PURE → { state, act } the gesture. ev: { type: 'down'|'move'|'up'|'timer'|'abort', x?, t }
9
+ * act: 'start' (listen now) · 'tap' (a short press: the old tap) · 'send' · 'cancel' · null
10
+ * sheetHtml(s, esc) PURE → the hold sheet: a large mic, the words heard so far, what letting go does
11
+ * holdChat(o) the chat's side: o: { dictate(box, { onState }), box(), submit(), sheet(html|null), toast(text), note(id), log(line), esc }
12
+ * → { start(), send(), cancel(), move(left), on() }. A release with words submits the chat form; a cancel or a hold
13
+ * with no words heard sends nothing and puts the box back as it was.
14
+ * wireHold(root, o) listens for pointer presses on root's [data-hm-mic]; o: { skip(): bool, on(): bool, start(), send(), cancel(), move(left) }
15
+ */
16
+ export const HOLD_MS = 300;
17
+ export const CANCEL_PX = 60;
18
+
19
+ const IDLE = Object.freeze({ mode: 'idle', x0: 0, t0: 0, left: false });
20
+
21
+ export function step(state, ev) {
22
+ const s = state || IDLE;
23
+ const e = ev || {};
24
+ if (e.type === 'down') return { state: { mode: 'pending', x0: Number(e.x) || 0, t0: Number(e.t) || 0, left: false }, act: null };
25
+ if (s.mode === 'idle') return { state: s, act: null };
26
+ if (e.type === 'abort') return { state: IDLE, act: s.mode === 'holding' ? 'cancel' : null };
27
+ if (e.type === 'timer') {
28
+ if (s.mode === 'pending' && (Number(e.t) || 0) - s.t0 >= HOLD_MS) return { state: { ...s, mode: 'holding' }, act: 'start' };
29
+ return { state: s, act: null };
30
+ }
31
+ if (e.type === 'move') {
32
+ if (s.mode !== 'holding') return { state: s, act: null };
33
+ return { state: { ...s, left: s.x0 - (Number(e.x) || 0) >= CANCEL_PX }, act: null };
34
+ }
35
+ if (e.type === 'up') {
36
+ // a press let go before the timer: a short one is the old tap; one the timer missed (a busy page) does nothing
37
+ if (s.mode === 'pending') return { state: IDLE, act: (Number(e.t) || 0) - s.t0 >= HOLD_MS ? 'none' : 'tap' };
38
+ return { state: IDLE, act: s.left ? 'cancel' : 'send' };
39
+ }
40
+ return { state: s, act: null };
41
+ }
42
+
43
+ const MIC = 'M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3zM5 11a7 7 0 0 0 14 0M12 18v3';
44
+ export function sheetHtml(s, esc = (x) => String(x)) {
45
+ const o = s || {};
46
+ const words = String(o.text || '').trim();
47
+ const shown = words.length > 90 ? '…' + words.slice(-90) : words;
48
+ return '<div class="ut-hold" role="status" aria-live="polite">'
49
+ + `<span class="ut-hold-mic${o.left ? ' off' : ''}" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="${MIC}"/></svg></span>`
50
+ + `<p class="ut-hold-said">${shown ? '“' + esc(shown) + '”' : 'Listening…'}</p>`
51
+ + `<p class="ut-hold-hint">${o.left ? 'Release to cancel' : 'Release to send · slide left to cancel'}</p>`
52
+ + '</div>';
53
+ }
54
+
55
+ /* The chat's side of a hold. Dictation goes into the chat box (pm/home-dictate.js); the sheet shows the words; letting go submits the
56
+ * chat form, the same send as typed text. */
57
+ export function holdChat(o) {
58
+ const H = { dict: null, spoke: false, left: false, text: '', sendAfter: false };
59
+ const draw = () => o.sheet(H.dict ? sheetHtml({ text: H.text, left: H.left }, o.esc) : null);
60
+ return {
61
+ on: () => !!(H.dict && H.dict.on()),
62
+ start() {
63
+ H.spoke = false; H.left = false; H.text = ''; H.sendAfter = false;
64
+ H.dict = o.dictate(o.box, { onState: (s) => {
65
+ if (s.error) o.toast(s.error);
66
+ if (s.text) { H.spoke = true; H.text = s.text; }
67
+ if (s.on === false) {
68
+ const go = H.sendAfter && H.spoke;
69
+ H.dict = null; H.sendAfter = false; draw();
70
+ if (go) {
71
+ o.note('hold-to-talk-send');
72
+ o.log('[hold-to-talk] sent words=' + H.text.split(/\s+/).filter(Boolean).length);
73
+ o.submit();
74
+ }
75
+ return;
76
+ }
77
+ draw();
78
+ } });
79
+ draw();
80
+ },
81
+ move(left) { H.left = !!left; draw(); },
82
+ send() { if (!H.dict) return; if (H.left) { this.cancel(); return; } H.sendAfter = true; H.dict.stop(); },
83
+ cancel() { if (!H.dict) return; H.sendAfter = false; const d = H.dict; d.cancel(); H.dict = null; draw(); },
84
+ };
85
+ }
86
+
87
+ /* The pointer wiring. A press on the mic starts a timer; held for HOLD_MS it starts listening. The click that follows a hold is swallowed,
88
+ * so it does not toggle the old tap. */
89
+ export function wireHold(root, o) {
90
+ let st = IDLE, timer = null, swallow = false;
91
+ const run = (ev) => {
92
+ const r = step(st, ev); st = r.state;
93
+ if (r.act === 'start') { swallow = true; o.start(); }
94
+ else if (r.act === 'none') swallow = true;
95
+ else if (r.act === 'send') { swallow = true; o.send(); }
96
+ else if (r.act === 'cancel') { swallow = true; o.cancel(); }
97
+ // 'tap' is left to the click that follows, as before
98
+ };
99
+ const clear = () => { if (timer) { clearTimeout(timer); timer = null; } };
100
+ root.addEventListener('pointerdown', (e) => {
101
+ const b = e.target.closest && e.target.closest('[data-hm-mic]');
102
+ if (!b || !root.contains(b) || (o.skip && o.skip()) || (o.on && o.on())) return;
103
+ swallow = false; run({ type: 'down', x: e.clientX, t: Date.now() });
104
+ try { b.setPointerCapture(e.pointerId); } catch { /* a capture is a nicety */ }
105
+ clear(); timer = setTimeout(() => { timer = null; run({ type: 'timer', t: Date.now() }); }, HOLD_MS);
106
+ });
107
+ root.addEventListener('pointermove', (e) => {
108
+ if (st.mode !== 'holding') return;
109
+ const was = st.left; run({ type: 'move', x: e.clientX, t: Date.now() });
110
+ if (st.left !== was && o.move) o.move(st.left);
111
+ });
112
+ root.addEventListener('pointerup', (e) => { if (st.mode === 'idle') return; clear(); run({ type: 'up', x: e.clientX, t: Date.now() }); });
113
+ root.addEventListener('pointercancel', () => { clear(); run({ type: 'abort', t: Date.now() }); });
114
+ root.addEventListener('click', (e) => {
115
+ if (!swallow || !(e.target.closest && e.target.closest('[data-hm-mic]'))) return;
116
+ swallow = false; e.stopPropagation(); e.preventDefault();
117
+ }, true);
118
+ // the mic button: a long press shows no menu or text selection on a phone
119
+ root.addEventListener('contextmenu', (e) => { if (e.target.closest && e.target.closest('[data-hm-mic]')) e.preventDefault(); });
120
+ return { state: () => st };
121
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "connector-data (job #1920, A150): what each connector reads and writes, one list for Settings › Connectors, pmos connectors data and the drift checks. No browser, no network.",
3
+ "modules": [
4
+ "connector-data.test.js"
5
+ ],
6
+ "seconds": {
7
+ "connector-data.test.js": 2
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "One page: what PMOS may do alone (does-alone, idea A513, board BatchPagesDS 2, done test planning/done-tests/does-alone.md A1-A5, N1-N2): the rows per kind of action, since when and the decision, the ✦ line, GET /api/autonomy/alone, pmos autonomy alone and the Settings sub-panel's source. No server process, network, model or browser.",
3
+ "modules": [
4
+ "does-alone.test.js"
5
+ ],
6
+ "seconds": {
7
+ "does-alone.test.js": 1
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Hold to talk on the phone (idea A13, initiative hold-to-talk): the gesture, the hold sheet and the chat's side of pm/home-hold.js with a stand-in dictation. No browser, no network.",
3
+ "modules": [
4
+ "hold-to-talk.test.js"
5
+ ],
6
+ "seconds": {
7
+ "hold-to-talk.test.js": 1
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Names in a line link to the real thing (initiative name-links, done test L1-L4, N1-N4): the pure linker, the records of every product, the GET /api/name-links route in-process, the pmos mention names/plain commands and Today's links. No browser, model or network.",
3
+ "modules": [
4
+ "name-links.test.js"
5
+ ],
6
+ "seconds": {
7
+ "name-links.test.js": 3
8
+ }
9
+ }