create-pmos 0.824.0 → 0.826.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 (53) hide show
  1. package/package.json +149 -39
  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 +148 -12
  7. package/workspace/guide/agent-capabilities.md +1 -0
  8. package/workspace/guide/cli.md +32 -0
  9. package/workspace/guide/home.md +2 -0
  10. package/workspace/guide/layout.md +1 -1
  11. package/workspace/guide/settings-and-switches.md +4 -0
  12. package/workspace/lib/autonomy-cli.js +14 -2
  13. package/workspace/lib/code-map-cli.js +100 -0
  14. package/workspace/lib/code-map.js +247 -0
  15. package/workspace/lib/connector-data.js +138 -0
  16. package/workspace/lib/connectors-cli.js +6 -0
  17. package/workspace/lib/does-alone.js +67 -0
  18. package/workspace/lib/features.json +58 -1
  19. package/workspace/lib/mention-cli.js +36 -2
  20. package/workspace/lib/name-links.js +203 -0
  21. package/workspace/lib/pmos-verbs.js +6 -0
  22. package/workspace/lib/route-modules.js +2 -0
  23. package/workspace/lib/routes-autonomy.js +9 -0
  24. package/workspace/lib/routes-code-map.js +66 -0
  25. package/workspace/lib/routes-connector-data.js +17 -0
  26. package/workspace/lib/routes-today-log.js +8 -1
  27. package/workspace/lib/routes-today.js +2 -1
  28. package/workspace/lib/today-cli.js +4 -2
  29. package/workspace/lib/today-order.js +120 -0
  30. package/workspace/package-lock.json +2 -2
  31. package/workspace/package.json +1 -1
  32. package/workspace/public/pm/code-map.js +60 -0
  33. package/workspace/public/pm/connector-data.js +47 -0
  34. package/workspace/public/pm/cozy-board.css +8 -0
  35. package/workspace/public/pm/cozy-name-links.js +118 -0
  36. package/workspace/public/pm/cozy-settings.js +41 -7
  37. package/workspace/public/pm/cozy-today-app.js +67 -2
  38. package/workspace/public/pm/cozy-today-page.css +8 -0
  39. package/workspace/public/pm/cozy-today-view.js +28 -8
  40. package/workspace/public/pm/cozy-today.css +9 -0
  41. package/workspace/public/pm/home-chat.js +16 -1
  42. package/workspace/public/pm/home-hold.js +121 -0
  43. package/workspace/public/pm/pop-cap.js +5 -2
  44. package/workspace/public/pm/premium-board.js +2 -0
  45. package/workspace/public/pm/today-order.js +88 -0
  46. package/workspace/public/premium-board.html +2 -0
  47. package/workspace/test-lists/code-map.json +9 -0
  48. package/workspace/test-lists/connector-data.json +9 -0
  49. package/workspace/test-lists/directory-all-verbs.json +9 -0
  50. package/workspace/test-lists/does-alone.json +9 -0
  51. package/workspace/test-lists/hold-to-talk.json +9 -0
  52. package/workspace/test-lists/name-links.json +9 -0
  53. package/workspace/test-lists/today-order.json +9 -0
@@ -22,6 +22,8 @@ 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 TO from './today-order.js'; // today-order (A310, board BatchMoreBDS panel 30): the same blocks in the day's order, and the pin
26
+ 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
27
  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
28
 
27
29
  const ASK_SEND = new Set(['session']);
@@ -39,13 +41,73 @@ export function mountToday(ctx) {
39
41
  if (r && r.ok) X.log = { entries: r.entries || [], marks: r.marks || {}, fixed: r.fixed || {} };
40
42
  X.read = true;
41
43
  draw();
44
+ readNames();
42
45
  readReports();
43
46
  readQuestions();
44
47
  readSignoffs();
45
48
  readLine();
46
49
  readDigest();
47
50
  readSync();
51
+ readPin();
48
52
  }
53
+ /* today-order (A310): the pinned order (GET /api/today-order, lib/today-order.js), the one store `pmos today order` writes too */
54
+ async function readPin() {
55
+ const r = await ctx.pmGet('/api/today-order').catch(() => null);
56
+ if (!r || !r.ok) return;
57
+ if (JSON.stringify(r.pin || null) === JSON.stringify(X.pin || null)) return;
58
+ X.pin = r.pin || null; draw();
59
+ }
60
+ /** Today's order: the pin, else the day (the calendar and what ships today), else the page's own. One [today-order] line per change. */
61
+ function orderOf(A) {
62
+ const today = day(), ships = [];
63
+ for (const r of ctx.rows().values()) {
64
+ if (r && r.kind === 'ini' && r.board && String(r.board.end || '').slice(0, 10) === today) ships.push({ title: r.name || r.ini });
65
+ }
66
+ const T = TO.orderFor({ now: ctx.now(), meetings: ctx.meetings() || [], ships, pin: X.pin || null, phone: phone() });
67
+ const sig = T.order.join(',') + '|' + T.kind + '|' + T.pinned;
68
+ if (sig !== X.ordSig) { X.ordSig = sig; console.info('[today-order] kind=' + (T.kind || 'own') + ' pinned=' + T.pinned + ' order=' + T.order.join(',') + ' agenda=' + ((A && A.items) || []).length); }
69
+ return T;
70
+ }
71
+ async function pinPress(b) {
72
+ const T = X.order; if (!T || X.busy.has('ord-pin')) return;
73
+ X.busy.add('ord-pin'); b.disabled = true;
74
+ try {
75
+ const was = X.pin || null;
76
+ const body = T.pinned ? { unpin: true } : { order: T.order, kind: T.kind || 'own' };
77
+ const r = await ctx.pmPost('/api/today-order', body).catch(() => null);
78
+ if (!r || !r.ok) { ctx.toast((r && r.error) || 'The order did not change.'); return; }
79
+ noteUse('todayOrderPin'); // today-order's health number
80
+ X.pin = r.pin || null; draw();
81
+ ctx.toastUndo(T.pinned ? 'Unpinned. Today orders itself to the day again.' : 'Pinned. Today keeps this order until you unpin it.', async () => {
82
+ const u = await ctx.pmPost('/api/today-order', was ? { order: was.order, kind: was.kind } : { unpin: true }).catch(() => null);
83
+ if (u && u.ok) { X.pin = u.pin || null; draw(); }
84
+ return u || { ok: false };
85
+ });
86
+ } finally { X.busy.delete('ord-pin'); if (b.isConnected) b.disabled = false; }
87
+ }
88
+ /* name-links (A536, board BatchMoreBDS panel 31): the names in the lines you typed that resolve to one person, meeting or document
89
+ * (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
90
+ * batches that keep each address short; a line read once is not read again until the log is read again. */
91
+ async function readNames(list) {
92
+ const own = (list || X.log.entries).filter((e) => e && typeof e.text === 'string' && e.text.trim() && !e.links).slice(-40);
93
+ const batches = [];
94
+ let cur = [], len = 0;
95
+ for (const e of own) {
96
+ const q = 't=' + encodeURIComponent(e.text.slice(0, 400));
97
+ if (cur.length && len + q.length > 6000) { batches.push(cur); cur = []; len = 0; }
98
+ cur.push([e, q]); len += q.length + 1;
99
+ }
100
+ if (cur.length) batches.push(cur);
101
+ let any = false;
102
+ for (const b of batches) {
103
+ const r = await ctx.pmGet('/api/name-links?' + b.map((x) => x[1]).join('&')).catch(() => null);
104
+ if (!r || !r.ok || !Array.isArray(r.lines)) continue;
105
+ b.forEach(([e], i) => { const l = r.lines[i]; e.links = l && Array.isArray(l.spans) ? l.spans : []; if (e.links.length) any = true; });
106
+ }
107
+ if (any) draw();
108
+ }
109
+ if (el) NL.wire(el);
110
+
49
111
  /* open-questions-today (A420, board QuestionsA): every product's register (GET /api/open-questions), one list for the Decide tab. A product
50
112
  * 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
113
  async function readQuestions() {
@@ -236,10 +298,11 @@ export function mountToday(ctx) {
236
298
  const cap = document.getElementById('tdCap'), draft = cap ? cap.value : '', focus = !!cap && document.activeElement === cap;
237
299
  // the log filters by job (All, Reply, Do, Decide, Send) on a desk and a phone; a job whose count went to zero goes back to All
238
300
  if (X.job && !(L.counts || {})[X.job.toLowerCase()] && !(X.job === 'Decide' && L.questions && L.questions.others.length)) X.job = '';
301
+ const T = X.order = orderOf(A), ord = { order: T.order, orderLine: TO.lineHtml(T) }; // today-order (A310)
239
302
  if (phone()) {
240
303
  // PhoneTodayDS (job #1540): Where it stands, the log with All ⌄, the capture box at the foot, the ✦ proposal's sheet
241
304
  if (X.sheet && !(O.suggest || []).some((x) => x.key === X.sheet)) X.sheet = '';
242
- const html = TP.phonePageHtml(L, A, O, { head: TM.headModel(ctx.now()), job: X.job, open: X.open, ymOpen: X.ymOpen, sopen: [...X.sopen], filed: filedLine(), now: ctx.now(), draft, mic: !!SPEECH(), sheet: X.sheet });
305
+ const html = TP.phonePageHtml(L, A, O, { ...ord, head: TM.headModel(ctx.now()), job: X.job, open: X.open, ymOpen: X.ymOpen, sopen: [...X.sopen], filed: filedLine(), now: ctx.now(), draft, mic: !!SPEECH(), sheet: X.sheet });
243
306
  if (html === X.html && el.firstChild) return;
244
307
  X.html = html; el.classList.add('tdp');
245
308
  document.body.classList.toggle('tdp-sheeton', !!X.sheet);
@@ -249,7 +312,7 @@ export function mountToday(ctx) {
249
312
  return;
250
313
  }
251
314
  el.classList.remove('tdp');
252
- const html = TP.pageHtml(L, A, { draft, overview: O, job: X.job, open: X.open || !!X.job, ymOpen: X.ymOpen, handled: X.job && X.job !== 'Reply' ? [] : handled(), hopen: X.hopen, sopen: [...X.sopen], filed: filedLine(), lines: X.lines || null });
315
+ const html = TP.pageHtml(L, A, { ...ord, draft, overview: O, job: X.job, open: X.open || !!X.job, ymOpen: X.ymOpen, handled: X.job && X.job !== 'Reply' ? [] : handled(), hopen: X.hopen, sopen: [...X.sopen], filed: filedLine(), lines: X.lines || null });
253
316
  if (html === X.html && el.firstChild) return;
254
317
  X.html = html;
255
318
  const st = el.parentNode ? el.parentNode.scrollTop : 0;
@@ -573,6 +636,7 @@ export function mountToday(ctx) {
573
636
  async function run(act, key, b) {
574
637
  if (act === 'line') { console.info('[quiet-rows-line] dashed line opened'); return; } // the link opens Work › Line, which counts the open (qr-line)
575
638
  if (act === 'cal') { ctx.openCalendar(); return; }
639
+ if (act === 'ord-pin') { pinPress(b); return; } // today-order: pin or unpin the order
576
640
  // the phone (Ph2_today): Record on the next event starts its recording; with no event, a recording of its own (PMOS names it after)
577
641
  if (act === 'rec' || act === 'rec-ev') {
578
642
  const x = act === 'rec-ev' && X.agenda && X.agenda.items.find((y) => y.key === key);
@@ -690,6 +754,7 @@ export function mountToday(ctx) {
690
754
  draw();
691
755
  const j = document.getElementById('tdCap'); if (j) j.focus();
692
756
  if (r.entry.filed) filedSay(r.entry.key, r.entry.filed);
757
+ readNames([r.entry]);
693
758
  });
694
759
  }
695
760
  /* The capture box's mic on a phone (PhoneTodayDS: "type or speak"): the browser's own speech recognition, where it has one, writes the
@@ -27,6 +27,9 @@
27
27
  .td-main, .td-side { min-width: 0; display: flex; flex-direction: column; gap: var(--space-16); }
28
28
  .td-top { margin: 0 0 var(--space-16); }
29
29
  .td-top h1, .td p { margin: 0; }
30
+ /* today-order (A310, board BatchMoreBDS panel 30): the one quiet line that says why the blocks are in this order, and the pin */
31
+ .td-ord { display: flex; align-items: center; gap: var(--space-8); margin: calc(-1 * var(--space-8)) 0 var(--space-12); }
32
+ .td-ord .pm-meta { flex: 1; min-width: 0; }
30
33
 
31
34
  /* item names in the Overview's sentence open the item */
32
35
  .td-ln { border: 0; background: none; padding: 0; font: inherit; color: var(--blue); text-decoration: underline; cursor: pointer; }
@@ -200,3 +203,8 @@ button.td-ev:focus-visible { outline: none; box-shadow: var(--glow); }
200
203
  .dg-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--space-12); }
201
204
  .dg-on { display: inline-flex; align-items: center; gap: var(--space-8); }
202
205
  .dg-l { margin: 0; padding-left: 1.2em; }
206
+ /* name-links (A536, board BatchMoreBDS panel 31): a name in a line you typed that resolves to one record, and its small card */
207
+ .nl-a { text-decoration: underline; text-decoration-color: var(--blue); text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; border-radius: 2px; }
208
+ .nl-a:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
209
+ .pm-ds .pm-menu.nl-card { position: fixed; z-index: 60; max-width: 260px; }
210
+ .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>` : ''}`
@@ -235,7 +240,7 @@ export function logHtml(L, o = {}) {
235
240
  const one = (r, lit) => (r.members ? rowHtml(r, { sopen: so.has(r.key), lit }) + (so.has(r.key) ? r.members.map((m) => rowHtml(m)).join('') : '') : rowHtml(r, { lit }));
236
241
  const today = pick(L.todayRows), wait = pick(L.wait);
237
242
  let body = job === 'Decide' ? questionGroups(L.questions) : '';
238
- body += moveHtml(pick(L.move || L.first), job ? { ...o, lines: null } : o);
243
+ if (!o.noMove) body += moveHtml(pick(L.move || L.first), job ? { ...o, lines: null } : o);
239
244
  if (today.length) body += `<div class="td-gr pm-group">Today</div><div class="rows">${today.map((r) => one(r)).join('')}</div>`;
240
245
  if (wait.length) {
241
246
  const oldest = Math.max(0, ...wait.map((r) => r.carried || 0));
@@ -251,7 +256,8 @@ export function logHtml(L, o = {}) {
251
256
  + `<span class="txt"><span class="t td-t">${esc(h.title)}</span><span class="w td-rs">${esc(h.proof)}</span></span><span class="acts td-a">`
252
257
  + `<button type="button" class="td-undo pm-btn" data-td="h-undo" data-key="${esc(h.id)}" aria-label="${esc('Undo: it still waits on me, ' + h.title)}" title="Undo">${ic(PI.undo)}</button></span></div>`).join('') + '</div>';
253
258
  }
254
- const list = body || `<p class="td-none pm-meta">${job ? 'Nothing to ' + job.toLowerCase() + ' today.' : 'Nothing waits on you today.'}</p>`;
259
+ // today-order: with Your move as its own block, an empty log says nothing while Your move holds rows
260
+ const list = body || (o.noMove && pick(L.move || L.first).length ? '' : `<p class="td-none pm-meta">${job ? 'Nothing to ' + job.toLowerCase() + ' today.' : 'Nothing waits on you today.'}</p>`);
255
261
  return `<section class="td-log pm-block list" aria-label="Today’s log">${head}${cap}${list}</section>`;
256
262
  }
257
263
 
@@ -295,10 +301,21 @@ export function filedHtml(f) {
295
301
  /** The page head: the day and the time, small, then the greeting. Hd: headModel(). */
296
302
  export const headHtml = (Hd) => `<header class="td-top"><div class="td-when pm-meta">${esc(Hd.when)}</div><h1 class="title">${esc(Hd.hello)}</h1></header>`;
297
303
 
304
+ /** Your move as its own block (today-order: when the day puts it anywhere but right before Today's log). '' when nothing waits. */
305
+ export function moveBlockHtml(L, o = {}) {
306
+ const job = o.job || '';
307
+ const rows = (L.move || L.first || []).filter((r) => !job || (r.job === job && !(job === 'Decide' && r.src === 'question')));
308
+ const h = moveHtml(rows, job ? { ...o, lines: null } : o);
309
+ return h ? `<section class="td-log td-ymb pm-block list" aria-label="Your move">${h}</section>` : '';
310
+ }
298
311
  /** The whole page, Main + side: the Overview and the log, then the agenda and the recorded meeting beside them.
299
- * o: { head, overview: overviewModel(), filed, …logHtml's o } */
312
+ * o: { head, overview: overviewModel(), filed, order: the blocks in order (pm/today-order.js; the desk's own order when absent),
313
+ * orderLine: the quiet line that says why, …logHtml's o }. Your move stays inside the log when it comes right before it. */
300
314
  export function pageHtml(L, A, o = {}) {
301
- return `${o.head ? headHtml(o.head) : ''}<div class="td"><div class="td-main">${o.overview ? overviewHtml(o.overview) : ''}${logHtml(L, o)}</div>`
315
+ const order = (o.order || ['overview', 'move', 'log']).filter((b) => b !== 'agenda');
316
+ const inLog = order.indexOf('move') + 1 === order.indexOf('log');
317
+ const block = { overview: () => (o.overview ? overviewHtml(o.overview) : ''), move: () => (inLog ? '' : moveBlockHtml(L, o)), log: () => logHtml(L, inLog ? o : { ...o, noMove: true }) };
318
+ return `${o.head ? headHtml(o.head) : ''}${o.orderLine || ''}<div class="td"><div class="td-main">${order.map((b) => (block[b] ? block[b]() : '')).join('')}</div>`
302
319
  + `<div class="td-side">${agendaHtml(A)}${filedHtml(o.filed)}</div></div>`;
303
320
  }
304
321
 
@@ -356,7 +373,7 @@ export function fixLine(r) {
356
373
  export function phoneRowHtml(r, o = {}) {
357
374
  const sw = swipeActs(r);
358
375
  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>`;
376
+ 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
377
  const jb = r.job || (r.bullet === 'event' ? 'Event' : r.bullet === 'note' || r.src === 'note' ? 'Note' : '');
361
378
  const late = lateOf(r);
362
379
  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) : '',
@@ -461,7 +478,10 @@ export function phonePageHtml(L, A, O, o = {}) {
461
478
  if (o.open) cw += `<ul class="tdp-rows tdp-waitl">${wait.map((r) => phoneRowHtml(r, { wait: true })).join('')}</ul>`;
462
479
  }
463
480
  const sheet = o.sheet && sg && o.sheet === sg.key ? phoneSheetHtml(sg) : '';
464
- return `${H}${filed}${ym}${ov}${ev}${log}${cw}${phoneCapHtml(o)}${sheet}`;
481
+ // today-order: the same blocks in the day's order (pm/today-order.js), the phone's own order when none is given
482
+ const block = { move: ym, overview: ov, agenda: ev, log: log + cw };
483
+ const order = o.order || ['move', 'overview', 'agenda', 'log'];
484
+ return `${H}${o.orderLine || ''}${filed}${order.map((b) => block[b] || '').join('')}${phoneCapHtml(o)}${sheet}`;
465
485
  }
466
486
  const cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
467
487
  /** Your move on a phone (board YourMovePhone): the same five rows in the same order as the desk, rows with a dot (the alert colour when
@@ -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
+ }
@@ -5,7 +5,7 @@
5
5
  * THE CAP Ask PMOS (in the popup's header) and the four actions of the toolbar: five. Back and Close move you; they are not actions.
6
6
  * The ⋯ (More actions) holds the rest, grouped Change, Plan, View and Jira. Keys (Ctrl K, the action keys) still reach every action.
7
7
  * ACTIONS the toolbar's candidates: add, who, date, stage, shift, epic. DEFAULT: add, who, date, stage.
8
- * four(counts, span) → the four ids: the ones used most in the last 30 days; while there are fewer than 30 days of use, DEFAULT
8
+ * four(counts, span) → the four ids: the ones used most in the last 30 days; until the log reaches back to its 30-day cut (span ≥ FULL_DAYS, 29), DEFAULT
9
9
  * due(saved, now) → true when the four are worked out again: none saved, or saved a week or more ago
10
10
  * toolbarHtml(ids, o) → the toolbar: the four icon buttons (data-pw-act). o: { picked, jiraPicked }
11
11
  * pickLineHtml(act, n) → the line while picking: "Pick the tasks to change · Esc to stop", then "Who for 2 tasks" with its button
@@ -24,6 +24,9 @@ const SV = (d, w = 16) => `<svg class="pm-ic" aria-hidden="true" width="${w}" he
24
24
  export const MAX = 5; // Ask PMOS plus the four
25
25
  export const ROW_MAX = 3; // Who, Date, More
26
26
  export const SPAN_DAYS = 30; // the use that picks the four
27
+ // The use log keeps 30 days and reads its window as now − 30 days, so its oldest line is at most 29 whole days back: a log that
28
+ // reaches back to that cut is full. Compare against 29, never 30, or the four stay on DEFAULT for ever.
29
+ export const FULL_DAYS = SPAN_DAYS - 1;
27
30
  export const WEEK = 7 * 864e5;
28
31
  export const IC = {
29
32
  plus: 'M12 5v14M5 12h14', who: 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM5 20a7 7 0 0 1 14 0', cal: 'M5 6h14v14H5zM5 10h14M9 4v4M15 4v4',
@@ -46,7 +49,7 @@ const ORDER = Object.keys(ACTIONS);
46
49
 
47
50
  /** The four toolbar ids. counts: { 'pop-who': 12, … } (or { who: 12 }); span: days of use the log holds. */
48
51
  export function four(counts, span) {
49
- if (!(Number(span) >= SPAN_DAYS) || !counts) return [...DEFAULT];
52
+ if (!(Number(span) >= FULL_DAYS) || !counts) return [...DEFAULT];
50
53
  const n = (k) => Number(counts['pop-' + k] != null ? counts['pop-' + k] : counts[k]) || 0;
51
54
  const used = ORDER.filter((k) => n(k) > 0).sort((a, b) => n(b) - n(a) || ORDER.indexOf(a) - ORDER.indexOf(b));
52
55
  const out = used.slice(0, 4);
@@ -72,6 +72,7 @@ import * as ST from './bd-stands.js'; // Where it stands, its Suggestion and t
72
72
  import * as LS from './load-shapes.js'; // the skeleton and the slow-case line while the board is read (page-open-speed, SpD) // the Board as the first panel: fit(), the rows that open beside, the open row's mark
73
73
  import * as STRAT from './bd-strategy.js'; // the product's strategy in five lines above the initiatives (bet A458)
74
74
  import * as PRIN from './bd-principles.js'; // the product's principles drafted from its decisions, below the strategy (bet A352)
75
+ import * as CMAP from './code-map.js'; // the product's code map, one box per main part (idea A176)
75
76
  import * as SWN from './cozy-status-when.js'; // the day a status move really happened, in the toast (round 3 point 18)
76
77
  import { pressHold } from './state-glyph.js';
77
78
  import * as LB from './list-balance.js'; // the balance meter under the Initiatives header (bet A448, board BalanceDS) // a state is a shape, not a word (state-glyphs)
@@ -1511,6 +1512,7 @@ async function load() {
1511
1512
  LE.loaded({ since, stale: !!r.stale }); // a change still saving stays on the new read; open views (the big Work breakdown) follow it
1512
1513
  STRAT.refresh($('#cStrat'), { ws: M.board.ws || null, board: M.board.id || null, single: !ALL, say });
1513
1514
  PRIN.refresh($('#cPrin'), { ws: M.board.ws || null, single: !ALL, say });
1515
+ CMAP.mount($('#cCode'), { ws: M.board.ws || null, single: !ALL });
1514
1516
  focusOnce(); taskOnce(); programOnce(); newOnce(); loadOthers(); loadWorkflows();
1515
1517
  if (r.stale) setTimeout(load, 2000); // a press is still being derived: ask again
1516
1518
  else { loadTrail(); loadGrill(); }
@@ -0,0 +1,88 @@
1
+ /* pm/today-order.js — Today rearranges to the day (idea A310, job #1914; board BatchMoreBDS panel 30, agreed 2026-11-25; done test
2
+ * planning/done-tests/today-order.md). Pure: Node imports it (today-order.test.js, lib/today-order.js).
3
+ *
4
+ * Today keeps the same blocks and changes only their order, from the calendar and what is happening:
5
+ * overview the ✦ Overview (the plan and its risks)
6
+ * move Your move (what needs you)
7
+ * log Today's log (what moves today, and what was done)
8
+ * agenda the day's events (on a desk it stays in the side column, so a desk orders the other three)
9
+ * THE DAY, first match wins:
10
+ * launch an initiative's ship date (its board end) is today: Your move, the log, the Overview, the agenda
11
+ * meetings MEETINGS_DAY or more meetings today: the agenda, Your move, the Overview, the log
12
+ * monday the Overview, Your move, the agenda, the log
13
+ * friday the log, Your move, the Overview, the agenda
14
+ * Any other day takes the page's own order (DESK, PHONE) and says nothing: zero is silence. One quiet line says why the order changed, with
15
+ * one icon button that pins the order; a pinned order wins over the day until it is unpinned (lib/today-order.js keeps the pin).
16
+ * BLOCKS NEVER DISAPPEAR. whole() repairs any order: an unknown block is left out, a missing one is put back at the end.
17
+ *
18
+ * whole(order) → every block once, in that order
19
+ * dayKind({ now, meetings, ships }) → { kind, order, why } | null
20
+ * orderFor({ now, meetings, ships, pin, phone }) → { order, kind, line, pinned, changed }
21
+ * deskOf(order) → the desk's main column (no agenda) · lineHtml(T) → the quiet line, '' when unchanged */
22
+ export const BLOCKS = ['overview', 'move', 'log', 'agenda'];
23
+ export const DESK = ['overview', 'move', 'log', 'agenda']; // the desk's own order (the agenda sits in the side column)
24
+ export const PHONE = ['move', 'overview', 'agenda', 'log']; // the phone's own order (pm/cozy-today-view.js phonePageHtml)
25
+ export const MEETINGS_DAY = 3;
26
+ export const ORDERS = {
27
+ launch: ['move', 'log', 'overview', 'agenda'],
28
+ meetings: ['agenda', 'move', 'overview', 'log'],
29
+ monday: ['overview', 'move', 'agenda', 'log'],
30
+ friday: ['log', 'move', 'overview', 'agenda'],
31
+ };
32
+ /** The words a pinned order is named by: "Pinned · the order for Monday". */
33
+ export const LABEL = { launch: 'launch day', meetings: 'a day of meetings', monday: 'Monday', friday: 'Friday', own: 'your own order' };
34
+ export const KINDS = Object.keys(LABEL);
35
+
36
+ const dayKey = (ms) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
37
+ const same = (a, b) => a.length === b.length && a.every((x, i) => x === b[i]);
38
+
39
+ /** Every block once, in the order given: an unknown block is left out, a repeat is left out, a missing one goes at the end. */
40
+ export function whole(order) {
41
+ const out = [];
42
+ for (const b of Array.isArray(order) ? order : []) if (BLOCKS.includes(b) && !out.includes(b)) out.push(b);
43
+ for (const b of BLOCKS) if (!out.includes(b)) out.push(b);
44
+ return out;
45
+ }
46
+ /** The desk's main column: the order without the agenda (the agenda stays in the side column). */
47
+ export const deskOf = (order) => whole(order).filter((b) => b !== 'agenda');
48
+
49
+ /** What kind of day it is, from the calendar and what ships. meetings: today's meetings ({ start }); ships: the initiatives whose ship day
50
+ * is today ({ title }). null on an ordinary day. */
51
+ export function dayKind({ now = Date.now(), meetings = [], ships = [] } = {}) {
52
+ const today = dayKey(now);
53
+ const ship = (ships || []).find((s) => s && s.title);
54
+ if (ship) return { kind: 'launch', order: ORDERS.launch, why: 'Ordered for launch day · ' + ship.title + ' ships today' };
55
+ const n = (meetings || []).filter((m) => m && m.start && !Number.isNaN(Date.parse(m.start)) && dayKey(Date.parse(m.start)) === today).length;
56
+ if (n >= MEETINGS_DAY) return { kind: 'meetings', order: ORDERS.meetings, why: 'Ordered for ' + n + ' meetings · from your calendar' };
57
+ const wd = new Date(now).getDay();
58
+ if (wd === 1) return { kind: 'monday', order: ORDERS.monday, why: 'Ordered for Monday · from your calendar' };
59
+ if (wd === 5) return { kind: 'friday', order: ORDERS.friday, why: 'Ordered for Friday · from your calendar' };
60
+ return null;
61
+ }
62
+
63
+ /** Today's order for one page. pin: the kept pin ({ order, kind } from GET /api/today-order) or null; phone: the phone's one column.
64
+ * changed: the line shows (a pin always shows it, so it can be unpinned). */
65
+ export function orderFor({ now = Date.now(), meetings = [], ships = [], pin = null, phone = false } = {}) {
66
+ const own = phone ? PHONE : DESK;
67
+ if (pin && Array.isArray(pin.order)) {
68
+ const kind = KINDS.includes(pin.kind) ? pin.kind : 'own';
69
+ return { order: whole(pin.order), kind, line: 'Pinned · the order for ' + LABEL[kind], pinned: true, changed: true };
70
+ }
71
+ const k = dayKind({ now, meetings, ships });
72
+ if (!k) return { order: own.slice(), kind: '', line: '', pinned: false, changed: false };
73
+ const order = whole(k.order);
74
+ const changed = phone ? !same(order, own) : !same(deskOf(order), deskOf(own));
75
+ return changed ? { order, kind: k.kind, line: k.why, pinned: false, changed } : { order: own.slice(), kind: '', line: '', pinned: false, changed: false };
76
+ }
77
+
78
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
79
+ const LOCK = 'M6 11h12v9H6zM9 11V8a3 3 0 0 1 6 0v3';
80
+ const OPEN = 'M6 11h12v9H6zM9 11V8a3 3 0 0 1 6 0';
81
+ /** The quiet line (board panel 30): why the order changed, and the one icon button that pins it or unpins it. '' when nothing changed. */
82
+ export function lineHtml(T) {
83
+ if (!T || !T.changed || !T.line) return '';
84
+ const label = T.pinned ? 'Unpin this order' : 'Pin this order';
85
+ return `<div class="td-ord pm-row" role="status"><span class="pm-meta">${esc(T.line)}</span>`
86
+ + `<button type="button" class="pm-btn" data-td="ord-pin" aria-pressed="${!!T.pinned}" aria-label="${label}" title="${label}">`
87
+ + `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${T.pinned ? LOCK : OPEN}"/></svg></button></div>`;
88
+ }
@@ -64,6 +64,8 @@
64
64
  <section class="bd-sec" id="cStrat" aria-label="Strategy" hidden></section>
65
65
  <!-- the product's principles drafted from its decisions (pm/bd-principles.js, bet A352): below the strategy, one product only -->
66
66
  <section class="bd-sec" id="cPrin" aria-label="Principles" hidden></section>
67
+ <!-- the product's code map (pm/code-map.js, idea A176): one box per main part of its repository, one product only -->
68
+ <section class="bd-sec" id="cCode" aria-label="Code" hidden></section>
67
69
  <section class="bd-sec" id="cIni" aria-labelledby="hIni">
68
70
  <h2 class="vh" id="hIni">Initiatives</h2>
69
71
  <div id="bdShowing" hidden></div>
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "A map of the product's code on day one (initiative code-map, done test C1-C7, N1, N2): the parts and risk rules, the read-only git draw on scratch repositories, pmos code, the route's redraw on merges and the panel's markup. No server, browser, model or network.",
3
+ "modules": [
4
+ "code-map.test.js"
5
+ ],
6
+ "seconds": {
7
+ "code-map.test.js": 2
8
+ }
9
+ }
@@ -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": "What PMOS can do lists every pmos verb (directory-all-verbs, idea A540, done test planning/done-tests/directory-all-verbs.md V1-V3, N1-N2): a registry row per verb, user and agent rows, no clash with a session command, no phrases. No server, network, model or browser.",
3
+ "modules": [
4
+ "features-verbs.test.js"
5
+ ],
6
+ "seconds": {
7
+ "features-verbs.test.js": 1
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
+ }