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
@@ -0,0 +1,120 @@
1
+ 'use strict';
2
+ /* today-order.js — Today rearranges to the day (idea A310, job #1914; board BatchMoreBDS panel 30; done test
3
+ * planning/done-tests/today-order.md). The pin: the one store the page and `pmos today order` read and write.
4
+ *
5
+ * public/pm/today-order.js decides the order from the calendar and what ships (pure; the page and this file import it). This file keeps
6
+ * only the PIN: an order the PM keeps until they unpin it. One small file, <runtime>/today-order/pin.json:
7
+ * { order: [block, …], kind: launch | meetings | monday | friday | own, at }
8
+ * It holds block names and a time only. A pin is repaired on read (whole()): an unknown block is left out and a missing one is put back,
9
+ * so a block never disappears from Today.
10
+ *
11
+ * read(runtimeDir) → { ok, pin: { order, kind, at } | null }
12
+ * pin(runtimeDir, { order, kind }, now) → { ok, pin } | { ok: false, error } (async: it reads the block names from the page module)
13
+ * unpin(runtimeDir) → { ok, pin: null }
14
+ * handle(req, res, url, ctx) GET /api/today-order → read; POST /api/today-order { order, kind } | { unpin: true } (page press)
15
+ * run(argv, { say, runtimeDir }) `pmos today order [--pin <a,b,c,d>|--pin <kind>] [--unpin] [--json]`
16
+ * SINGLE WRITER: put() writes the file, by a rename, so a half-written pin is never read. Each pin and unpin logs one `[today-order]` line.
17
+ */
18
+ const fs = require('fs');
19
+ const path = require('path');
20
+ const { pathToFileURL } = require('url');
21
+
22
+ const TAG = '[today-order]';
23
+ let MOD = null;
24
+ /** The page's pure module (BLOCKS, ORDERS, LABEL, whole): one source for the blocks and the day's orders. */
25
+ const mod = async () => (MOD = MOD || await import(pathToFileURL(path.join(__dirname, '..', 'public', 'pm', 'today-order.js')).href));
26
+
27
+ const fileOf = (rt) => path.join(rt, 'today-order', 'pin.json');
28
+ function put(rt, v) {
29
+ const f = fileOf(rt);
30
+ fs.mkdirSync(path.dirname(f), { recursive: true });
31
+ if (v == null) { try { fs.unlinkSync(f); } catch { /* already unpinned */ } return; }
32
+ const tmp = f + '.' + process.pid + '.tmp';
33
+ fs.writeFileSync(tmp, JSON.stringify(v) + '\n');
34
+ fs.renameSync(tmp, f);
35
+ }
36
+
37
+ function read(rt) {
38
+ if (!rt) return { ok: true, pin: null };
39
+ let v = null;
40
+ try { v = JSON.parse(fs.readFileSync(fileOf(rt), 'utf8')); } catch { return { ok: true, pin: null }; }
41
+ if (!v || !Array.isArray(v.order)) return { ok: true, pin: null };
42
+ return { ok: true, pin: { order: v.order.filter((x) => typeof x === 'string').slice(0, 8), kind: typeof v.kind === 'string' ? v.kind : 'own', at: typeof v.at === 'string' ? v.at : '' } };
43
+ }
44
+
45
+ async function pin(rt, body = {}, now = new Date()) {
46
+ const M = await mod();
47
+ if (!rt) return { ok: false, error: 'no runtime folder to keep the pin in' };
48
+ const kind = body.kind == null || body.kind === '' ? 'own' : String(body.kind);
49
+ if (!M.KINDS.includes(kind)) return { ok: false, error: `${kind} is not a kind of day: ${M.KINDS.join(', ')}` };
50
+ const given = Array.isArray(body.order) ? body.order : kind !== 'own' ? M.ORDERS[kind] : null;
51
+ if (!given || !given.length) return { ok: false, error: 'name the order to pin: the blocks ' + M.BLOCKS.join(', ') + ', or a kind of day' };
52
+ const bad = given.find((b) => !M.BLOCKS.includes(b));
53
+ if (bad) return { ok: false, error: `${bad} is not a block of Today: ${M.BLOCKS.join(', ')}` };
54
+ const v = { order: M.whole(given), kind, at: now.toISOString() };
55
+ put(rt, v);
56
+ console.info(`${TAG} pinned kind=${kind} order=${v.order.join(',')}`);
57
+ return { ok: true, pin: v };
58
+ }
59
+
60
+ function unpin(rt) {
61
+ if (!rt) return { ok: false, error: 'no runtime folder to keep the pin in' };
62
+ put(rt, null);
63
+ console.info(`${TAG} unpinned`);
64
+ return { ok: true, pin: null };
65
+ }
66
+
67
+ /** GET /api/today-order and POST /api/today-order (routes-today.js hands it on). A POST is a page press. */
68
+ async function handle(req, res, url, ctx) {
69
+ if (url.pathname !== '/api/today-order') return false;
70
+ const rt = ctx.runtimeDir;
71
+ if (req.method === 'GET') { ctx.json(res, read(rt)); return true; }
72
+ if (req.method !== 'POST') { ctx.json(res, { ok: false, error: 'GET or POST only' }, 405); return true; }
73
+ const got = await ctx.readJson(req);
74
+ if (!got.ok) { ctx.json(res, { ok: false, error: 'invalid JSON body' }, 400); return true; }
75
+ const body = got.body || {};
76
+ const g = require('./pm-guard.js').requirePagePress(req, body);
77
+ if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
78
+ const out = body.unpin === true ? unpin(rt) : await pin(rt, body);
79
+ ctx.json(res, out, out.ok ? 200 : 400);
80
+ return true;
81
+ }
82
+
83
+ const USAGE = [
84
+ 'usage: pmos today order [--json]',
85
+ ' pmos today order --pin <kind>|<block,block,…>',
86
+ ' pmos today order --unpin',
87
+ 'Today keeps the same blocks (overview, move, log, agenda) and orders them to the day: launch day, 3 or more meetings, Monday, Friday.',
88
+ 'A pinned order wins over the day until you unpin it. The page reads the same pin.',
89
+ ];
90
+
91
+ async function run(argv, { say, runtimeDir } = {}) {
92
+ const M = await mod();
93
+ let rt = runtimeDir;
94
+ if (rt === undefined) { try { rt = require('./state-root.js').defaultRoot({ env: process.env }); } catch { rt = null; } }
95
+ const a = argv[0] === 'order' ? argv.slice(1) : argv.slice();
96
+ const f = { json: false, unpin: false, pin: null };
97
+ for (let i = 0; i < a.length; i++) {
98
+ if (a[i] === '--json') f.json = true;
99
+ else if (a[i] === '--unpin') f.unpin = true;
100
+ else if (a[i] === '--pin' && a[i + 1] && !a[i + 1].startsWith('--')) f.pin = a[++i];
101
+ else if (a[i] === '--help' || a[i] === '-h') { USAGE.forEach((l) => say(l)); return 0; }
102
+ else { say(`✗ ${a[i]} is not an option of pmos today order`); USAGE.forEach((l) => say(l)); return 2; }
103
+ }
104
+ if (f.pin && f.unpin) { say('✗ --pin and --unpin: use one'); return 2; }
105
+ let out;
106
+ if (f.unpin) out = unpin(rt);
107
+ else if (f.pin) out = await pin(rt, M.KINDS.includes(f.pin) ? { kind: f.pin } : { order: f.pin.split(',').map((x) => x.trim()).filter(Boolean) });
108
+ else out = read(rt);
109
+ if (!out.ok) { say('✗ ' + out.error); return 1; }
110
+ if (f.pin || f.unpin) try { require('./use-log.js').record(rt, [{ kind: 'use', page: 'today', control: 'todayOrderPin', device: 'desk' }]); } catch { /* the use log is a count only */ }
111
+ if (f.json) { say(JSON.stringify({ ok: true, pin: out.pin, blocks: M.BLOCKS, days: M.ORDERS })); return 0; }
112
+ if (out.pin) say(`Pinned · the order for ${M.LABEL[out.pin.kind] || M.LABEL.own}: ${M.whole(out.pin.order).join(', ')}`);
113
+ else {
114
+ say('Not pinned: Today orders itself to the day.');
115
+ for (const k of Object.keys(M.ORDERS)) say(` ${M.LABEL[k]}: ${M.ORDERS[k].join(', ')}`);
116
+ }
117
+ return 0;
118
+ }
119
+
120
+ module.exports = { read, pin, unpin, handle, run, USAGE, TAG, fileOf };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.824.0",
3
+ "version": "0.826.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.824.0",
9
+ "version": "0.826.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.824.0",
3
+ "version": "0.826.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -0,0 +1,60 @@
1
+ /* pm/code-map.js — the product's code map on Work: one box per main part of its code (idea A176, initiative code-map, agreed board
2
+ * BatchCodeDS panel 13).
3
+ *
4
+ * mount(host, { ws, single }) → draws the map into `host`; a Work page that shows several products at once shows none
5
+ * mapHtml(map) → the markup (pure, so the test reads it); '' when there is nothing to show
6
+ *
7
+ * Built from the board's parts: a pm-block with its head, the part boxes of panel 13 (card ground, small radius, a 1px line; cozy-board.css .bd-cm-) in a grid,
8
+ * and a pm-meta foot. Each box: the part's name, what it is (the PM's own words from `pmos code describe` when given), how it is tested and
9
+ * who changed it last. A risky part (no tests, or many recent fixes) is tinted with the alert colour and says why; the rest are plain.
10
+ * There are no buttons: PMOS draws the map by itself when the repository is added and again after merges (lib/routes-code-map.js).
11
+ * No repository, no code, or a failed read: the panel stays hidden (zero is silence). It reads GET /api/code-map and nothing else. */
12
+
13
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
14
+ const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
15
+ const CODE = 'M8 7l-5 5 5 5M16 7l5 5-5 5';
16
+ const dayOf = (iso) => { const d = new Date(iso); return isNaN(d) ? '' : d.toLocaleDateString('en-GB', { day: 'numeric', month: 'short' }); };
17
+ const first = (name) => String(name || '').trim().split(/\s+/)[0] || '';
18
+
19
+ /** What a part is: the PM's words, else its language, framework and size. */
20
+ export function whatOf(p) {
21
+ if (p.note) return p.note;
22
+ return [p.kind, p.code + (p.code === 1 ? ' file' : ' files')].filter(Boolean).join(' · ');
23
+ }
24
+ /** How it is tested; a risky part says why, once. */
25
+ export function testedOf(p) {
26
+ if (!p.risky) return p.tested;
27
+ return /^no tests/.test(p.why) ? p.why : p.tested + ' · ' + p.why;
28
+ }
29
+
30
+ export function boxHtml(p) {
31
+ const who = p.last && p.last.by ? `${first(p.last.by)} last, ${dayOf(p.last.at)}` : '';
32
+ const lines = [whatOf(p), testedOf(p), who].filter(Boolean).map((t) => `<span class="bd-cm-l">${esc(t)}</span>`).join('');
33
+ const risk = p.risky ? ` data-risky="1" aria-label="${esc(p.name + '. Risky: ' + p.why)}"` : ` aria-label="${esc(p.name)}"`;
34
+ return `<div class="bd-cm-part" role="listitem"${risk} title="${esc(p.dir || p.name)}"><b>${esc(p.name)}</b>${lines}</div>`;
35
+ }
36
+
37
+ export function mapHtml(map) {
38
+ if (!map || !Array.isArray(map.parts) || !map.parts.length) return '';
39
+ const more = map.more ? `<span class="pm-meta">and ${map.more} smaller part${map.more === 1 ? '' : 's'}</span>` : '';
40
+ return `<section class="pm-block bd-cm" aria-label="Code"><div class="head">${SV(CODE)}<h3 class="pm-h-sm">Code</h3></div>`
41
+ + `<div role="list" class="bd-cm-grid">${map.parts.map(boxHtml).join('')}</div>`
42
+ + `<div class="pm-row bd-cm-foot">${more}<span class="pm-meta">Read from the repo on ${esc(dayOf(map.at))}</span></div></section>`;
43
+ }
44
+
45
+ /** Draw the map into `host`. While PMOS draws it for the first time, read again now and then (at most ~2 minutes). */
46
+ export async function mount(host, opts = {}) {
47
+ if (!host) return;
48
+ const { ws = null, single = true } = opts;
49
+ clearTimeout(host._cmPoll);
50
+ if (!single) { host.hidden = true; host.innerHTML = ''; return; }
51
+ let r = null;
52
+ try { r = await (await fetch('/api/code-map' + (ws ? '?ws=' + encodeURIComponent(ws) : ''), { credentials: 'same-origin' })).json(); } catch { r = null; }
53
+ if (!r || !r.ok) { host.hidden = true; return; } // an extra: a failed read leaves Work as it was
54
+ const html = mapHtml(r.map);
55
+ host.hidden = !html;
56
+ if (host.innerHTML !== html) host.innerHTML = html;
57
+ const tries = Number(host.dataset.polls || 0);
58
+ if (r.building && tries < 24) { host.dataset.polls = String(tries + 1); host._cmPoll = setTimeout(() => { if (host.isConnected) mount(host, opts); }, 5000); }
59
+ else host.dataset.polls = '';
60
+ }
@@ -0,0 +1,47 @@
1
+ /* pm/connector-data.js — Settings › Connectors › one connector's page: what PMOS reads, what it writes, what leaves this computer
2
+ * (initiative connector-data, idea A150; board ConnDataDS). PURE: no DOM, no fetch. The list is lib/connector-data.js, served by
3
+ * GET /api/connector-data; pm/cozy-settings.js fetches it, draws the rows and the page with these, and saves a read switch through
4
+ * POST /api/proactive/settings (data-ev-src, the switch the row had before).
5
+ *
6
+ * SUB the sub-page key prefix: T.sub = 'cd:<id>'
7
+ * findView(views, label) the view a connected connector's name backs (its match), or null
8
+ * isConnected(view, list) true when a connector the session has backs it (Atlassian backs Jira and Confluence)
9
+ * openBtn(view) the row's icon-only button that opens the page (a label for screen readers)
10
+ * ago(iso, now) "12 min ago", "3 h ago", "2 days ago"
11
+ * pageHtml(view, { now }) the page: Back, the name, the last read, then the three parts
12
+ * Zero is silence: a connector that is not connected keeps only its + (pm/cozy-settings.js), never a row line, a switch or this page. */
13
+ import { esc, svg } from './cozy-evui.js';
14
+ const icon = (d, w = 18) => svg(d, w);
15
+ const CHEV = 'M10 7l5 5-5 5', BACK = 'M19 12H5M11 6l-6 6 6 6', LOCK = 'M7 11V8a5 5 0 0 1 10 0v3M6 11h12v9H6z';
16
+
17
+ export const SUB = 'cd:';
18
+ const labelOf = (name) => String(name || '').replace(/^claude\.ai\s+/i, '').trim();
19
+ const re = (v) => { try { return new RegExp(v.match, 'i'); } catch { return null; } };
20
+ export const findView = (views, label) => (Array.isArray(views) ? views : []).find((v) => { const r = re(v); return r && r.test(labelOf(label)); }) || null;
21
+ export const isConnected = (v, list) => { const r = v && re(v); return !!r && (Array.isArray(list) ? list : []).some((c) => r.test(labelOf((c && (c.label || c.name)) || c))); };
22
+
23
+ export const openBtn = (v) => `<button type="button" class="ev-ib pm-btn" data-ev-cdata="${esc(v.id)}" aria-label="${esc('What PMOS reads and writes in ' + v.name)}" title="${esc('What PMOS reads and writes')}">${icon(CHEV)}</button>`;
24
+
25
+ export function ago(iso, now = Date.now()) {
26
+ const t = Date.parse(iso || ''); if (!Number.isFinite(t)) return '';
27
+ const m = Math.max(0, Math.round((now - t) / 60000));
28
+ return m < 1 ? 'just now' : m < 60 ? `${m} min ago` : m < 48 * 60 ? `${Math.round(m / 60)} h ago` : `${Math.round(m / 1440)} days ago`;
29
+ }
30
+
31
+ const swHtml = (r, name) => `<button type="button" class="pm-switch" role="switch" aria-checked="${!!r.on}" aria-label="${esc(r.what + ' (' + name + ')')}" data-ev-src="${esc(r.switch)}"></button>`;
32
+ const readRow = (r, name) => `<div class="ev-trow ev-cd-read"><div class="ev-tx ev-grow"><b>${esc(r.what)}</b><p class="pm-meta">${esc(r.detail)}${r.switch ? '' : ' · Read while connected'}</p></div>${r.switch ? swHtml(r, name) : ''}</div>`;
33
+
34
+ export function pageHtml(v, { now = Date.now() } = {}) {
35
+ if (!v) return '';
36
+ const last = v.lastRead && ago(v.lastRead.at, now);
37
+ const meta = last ? `<span class="pm-meta">last read ${esc(last)}${v.lastRead.items ? ` · ${v.lastRead.items} ${v.lastRead.items === 1 ? 'item' : 'items'}` : ''}</span>` : '';
38
+ const hasSw = v.reads.some((r) => r.switch);
39
+ return `<div class="ev-cd" data-ev-cd="${esc(v.id)}">`
40
+ + `<div class="ev-dr-hd"><button type="button" class="ev-ib pm-btn" data-ev-sub="" aria-label="Back to Connectors" title="Back">${icon(BACK)}</button><h4 class="ev-grow">${esc(v.name)}</h4>${meta}</div>`
41
+ + `<div class="ev-cn-sec"><b class="ev-lbl">What PMOS reads</b></div>${hasSw ? '<p class="pm-meta">A switch turns a read off. Off means PMOS stops reading it and says so where it was used.</p>' : ''}`
42
+ + `<div class="ev-cn-grp">${v.reads.map((r) => readRow(r, v.name)).join('')}</div>`
43
+ + `<div class="ev-cn-sec"><b class="ev-lbl">What PMOS writes</b></div>`
44
+ + (v.writes.length ? `<ul class="ev-cd-list">${v.writes.map((w) => `<li>${esc(w)}</li>`).join('')}</ul>` : '<p class="pm-meta">Nothing. A reply PMOS drafts stays a draft you send yourself.</p>')
45
+ + `<div class="ev-cn-sec"><b class="ev-lbl">What leaves this computer</b></div><p class="pm-meta ev-cd-leaves">${icon(LOCK, 14)} ${esc(v.leaves)}</p>`
46
+ + '</div>';
47
+ }
@@ -1627,3 +1627,11 @@ html.ro body.wk-on .bd-hd { display: none; } /* find and tune moved to the top
1627
1627
  .bd-bc .t .bd-sg { margin-right: 6px; }
1628
1628
  .bd-bc .s.ln { color: var(--cz-ink2); }
1629
1629
  .bd-lrow .s.ln { color: var(--cz-ink2); white-space: normal; }
1630
+ /* the product's code map (pm/code-map.js, idea A176, board BatchCodeDS panel 13): one box per main part; a risky part takes the alert tint */
1631
+ .bd-cm .head h3 { flex: 1; }
1632
+ .bd-cm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-8); }
1633
+ .bd-cm-part { min-width: 0; background: var(--card); border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line); padding: 6px 8px; font: var(--fw-regular) var(--fs-meta)/var(--lh-meta) var(--cz-sans); }
1634
+ .bd-cm-part[data-risky] { background: color-mix(in srgb, var(--alert) 12%, var(--card)); }
1635
+ .bd-cm-part b { display: block; font-weight: var(--fw-strong); }
1636
+ .bd-cm-l { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1637
+ .bd-cm-foot { gap: var(--space-8); margin-top: var(--space-8); }
@@ -0,0 +1,118 @@
1
+ /* pm/cozy-name-links.js — names in a line link to the real thing (initiative name-links, idea A536; board BatchMoreBDS panel 31, agreed by Wawan
2
+ * 2026-11-25). The server finds the names (lib/name-links.js, GET /api/name-links); this module draws them and their card.
3
+ *
4
+ * linkedHtml(text, spans, esc) → html PURE. The line's own words, escaped, with each span (start, end on the text) as one link. Nothing
5
+ * else on the line changes: the text of the html is the text of the line.
6
+ * linkAttrs(span) → the link's attributes: data-ask="kind:id" (the stamp "Ask about anything you press" reads, pm/ask-here-ctx.js idAt),
7
+ * and what the card shows (data-nl-title, data-nl-meta, data-nl-open)
8
+ * PRESS[kind] → [label, icon path] the card's one press: Open the notes · Open the document · Ask PMOS about the person
9
+ * wire(root, { openItem?, askAt? }) a pointer resting on a link (a desk), or a tap or Enter on it, opens the small card; Esc, a press
10
+ * elsewhere or leaving the link and the card closes it. Each card open notes `nameLinkOpen`.
11
+ * An unsure name (two records) comes back from the server as plain text, so it is never drawn here. */
12
+ import { noteUse } from './use-log.js';
13
+
14
+ const ESC = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
15
+ export const PRESS = {
16
+ meeting: ['Open the notes', 'M4 5h16v11H9l-5 4z'],
17
+ document: ['Open the document', 'M6 3h9l4 4v14H6zM14 3v5h5'],
18
+ person: ['Ask PMOS about them', 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z'],
19
+ };
20
+ const KIND_ASK = { meeting: 'meeting', document: 'document', person: 'person' };
21
+
22
+ export function linkAttrs(s, esc = ESC) {
23
+ return `class="nl-a" role="button" tabindex="0" aria-haspopup="dialog" data-ask="${esc((KIND_ASK[s.kind] || s.kind) + ':' + s.id)}"`
24
+ + ` data-nl-kind="${esc(s.kind)}" data-nl-title="${esc(s.title || s.text)}" data-nl-meta="${esc(s.meta || '')}"`
25
+ + (s.open ? ` data-nl-open="${esc(JSON.stringify(s.open))}"` : '') + (s.ws ? ` data-ws="${esc(s.ws)}"` : '');
26
+ }
27
+
28
+ /** PURE. */
29
+ export function linkedHtml(text, spans, esc = ESC) {
30
+ const t = String(text == null ? '' : text);
31
+ let h = '', at = 0;
32
+ for (const s of (spans || []).slice().sort((a, b) => a.start - b.start)) {
33
+ // a span that no longer fits the words (the line changed since it was read) is left out, never forced
34
+ if (!(s.start >= at && s.end > s.start && s.end <= t.length) || (s.text && t.slice(s.start, s.end) !== s.text)) continue;
35
+ h += esc(t.slice(at, s.start)) + `<span ${linkAttrs(s, esc)}>${esc(t.slice(s.start, s.end))}</span>`;
36
+ at = s.end;
37
+ }
38
+ return h + esc(t.slice(at));
39
+ }
40
+
41
+ const S = { card: null, link: null, timer: 0, off: null };
42
+ function close() {
43
+ clearTimeout(S.timer);
44
+ if (S.card) S.card.remove();
45
+ if (S.link) S.link.setAttribute('aria-expanded', 'false');
46
+ S.card = null; S.link = null;
47
+ if (S.off) { S.off(); S.off = null; }
48
+ }
49
+ function show(a, o, focus) {
50
+ if (S.link === a && S.card) return;
51
+ close();
52
+ const kind = a.getAttribute('data-nl-kind') || '';
53
+ const [label, icon] = PRESS[kind] || PRESS.person;
54
+ const title = a.getAttribute('data-nl-title') || a.textContent;
55
+ const card = document.createElement('div');
56
+ card.className = 'pm-menu nl-card';
57
+ card.setAttribute('role', 'dialog');
58
+ card.setAttribute('aria-label', title);
59
+ card.innerHTML = `<div class="nl-h"><b>${ESC(title)}</b><span class="pm-meta">${ESC(a.getAttribute('data-nl-meta') || '')}</span></div>`
60
+ + `<button type="button" role="menuitem"><svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${icon}"/></svg>${ESC(kind === 'person' ? 'Ask PMOS about ' + title.split(' ')[0] : label)}</button>`;
61
+ document.body.appendChild(card);
62
+ const b = a.getBoundingClientRect();
63
+ card.style.top = Math.max(8, Math.min(innerHeight - card.offsetHeight - 8, b.bottom + 6)) + 'px';
64
+ card.style.left = Math.max(8, Math.min(innerWidth - card.offsetWidth - 8, b.left)) + 'px';
65
+ S.card = card; S.link = a;
66
+ a.setAttribute('aria-expanded', 'true');
67
+ noteUse('nameLinkOpen');
68
+ card.querySelector('button').addEventListener('click', () => { close(); press(a, kind, title, o); });
69
+ card.addEventListener('pointerleave', (e) => { if (e.pointerType === 'mouse' && !a.contains(e.relatedTarget)) later(); });
70
+ card.addEventListener('pointerenter', () => clearTimeout(S.timer));
71
+ const out = (e) => { if (S.card && !S.card.contains(e.target) && !a.contains(e.target)) close(); };
72
+ const key = (e) => { if (e.key === 'Escape' && S.card) { e.stopPropagation(); const l = S.link; close(); if (l) l.focus(); } };
73
+ addEventListener('pointerdown', out, true); addEventListener('keydown', key, true);
74
+ S.off = () => { removeEventListener('pointerdown', out, true); removeEventListener('keydown', key, true); };
75
+ if (focus) card.querySelector('button').focus();
76
+ }
77
+ function later() { clearTimeout(S.timer); S.timer = setTimeout(close, 300); }
78
+ async function press(a, kind, title, o) {
79
+ let open = null;
80
+ try { open = JSON.parse(a.getAttribute('data-nl-open') || 'null'); } catch { open = null; }
81
+ if (kind === 'person' || !open) { // a person has no page of their own: the same Ask card a right-click opens, about them
82
+ const M = o.askAt ? { open: o.askAt } : await import('./ask-here.js');
83
+ M.open(a, {});
84
+ return;
85
+ }
86
+ const item = { id: a.getAttribute('data-ask') || '', kind: kind === 'meeting' ? 'meeting' : 'doc', name: title, open };
87
+ const L = o.openItem ? { openItem: o.openItem } : await import('./library-open.js');
88
+ L.openItem(item, {});
89
+ }
90
+
91
+ /** One wiring per page root; a redraw keeps it (the listeners sit on the root, not on the links). */
92
+ export function wire(root, o = {}) {
93
+ if (!root || root.__nlWired) return;
94
+ root.__nlWired = true;
95
+ root.addEventListener('pointerover', (e) => {
96
+ const a = e.target.closest && e.target.closest('.nl-a');
97
+ if (!a || e.pointerType !== 'mouse') return;
98
+ clearTimeout(S.timer);
99
+ S.timer = setTimeout(() => show(a, o, false), 250);
100
+ });
101
+ root.addEventListener('pointerout', (e) => {
102
+ const a = e.target.closest && e.target.closest('.nl-a');
103
+ if (!a || e.pointerType !== 'mouse' || a.contains(e.relatedTarget) || (S.card && S.card.contains(e.relatedTarget))) return;
104
+ if (S.link === a) later(); else clearTimeout(S.timer);
105
+ });
106
+ root.addEventListener('click', (e) => {
107
+ const a = e.target.closest && e.target.closest('.nl-a');
108
+ if (!a) return;
109
+ e.preventDefault(); e.stopPropagation();
110
+ if (S.link === a && S.card) close(); else show(a, o, e.detail === 0);
111
+ });
112
+ root.addEventListener('keydown', (e) => {
113
+ const a = e.target.closest && e.target.closest('.nl-a');
114
+ if (!a || (e.key !== 'Enter' && e.key !== ' ')) return;
115
+ e.preventDefault(); e.stopPropagation();
116
+ show(a, o, true);
117
+ });
118
+ }
@@ -58,12 +58,14 @@ 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)
61
62
  import * as SW from './cozy-schedwork.js';
62
63
  import * as AD from './cozy-adler.js';
63
64
  import * as SE from './cozy-seasons.js';
64
65
  import { weeksOf, lineOf, storiesOf } from './upd-weeks.js';
65
66
  import * as SRU from './standing-rules-ui.js';
66
67
  import * as SD from './set-ds.js';
68
+ import { noteUse } from './use-log.js'; // does-alone: one doesAloneOpen line per open of What PMOS does alone
67
69
  import { tintOn, setDayTint } from './day-tint.js'; // bet A339: the Light ground follows the clock
68
70
  import { relayState, relayLoad, relayHtml, relayClick } from './cozy-relay.js'; // event-relay (D110): Connectors › Listening
69
71
  import { extState, extLoad, extHtml, extClick } from './cozy-ext.js'; // meeting-buddy: Connectors › Google Meet, the Chrome extension set up from here
@@ -76,9 +78,9 @@ async function pmSend(method, path, body) {
76
78
  catch (e) { return { ok: false, error: 'could not reach the workspace server — ' + ((e && e.message) || String(e)) }; }
77
79
  }
78
80
  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)
81
+ 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
82
  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 };
83
+ 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
84
  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
85
  const home = () => (T.ws && T.ws[0] ? T.st[T.ws[0].id] : null);
84
86
  const latest = () => { const s = home(); return (s && (s.latest || (s.lastCheck && s.lastCheck.latest))) || null; };
@@ -316,13 +318,18 @@ function connList() {
316
318
  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
319
  // a connected connector that backs a brief source carries that source's switch; one that backs none, its own switch (as before)
318
320
  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;
321
+ // 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)
322
+ const conRows = D.connected.map((c) => { const label = c.label || c.name; const v = CDA.findView(T.cd, label);
323
+ if (v) return row(label, label, v.line, CDA.openBtn(v), c.name);
320
324
  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
325
  : 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
326
  // the brief sources no connector backs yet keep their switch, with a + when the directory knows the service
323
327
  const loose = Object.keys(SRC).filter((k) => k in T.src && !backed.has(k) && cOk(SRC[k]));
324
328
  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); });
329
+ // zero is silence: a source the list knows that no connector backs shows only its +; one another connector backs (Atlassian → Confluence) its line
330
+ const looseRows = loose.map((k) => { const m = CD.matchOf(SRC[k]); const v = (T.cd || []).find((x) => x.id === k);
331
+ 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);
332
+ 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
333
  const count = D.count;
327
334
  const head = `<div class="ev-cn-sec"><b class="ev-lbl ev-grow">Connected · ${count}</b>`
328
335
  + `<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 +344,7 @@ function connList() {
337
344
  }
338
345
  function connectors() {
339
346
  if (T.sub && T.sub.startsWith('sw:')) return SW.swBody(T.sub);
347
+ if (T.sub && T.sub.startsWith(CDA.SUB)) return cdPage(T.sub.slice(CDA.SUB.length));
340
348
  const info = T.info ? `<p class="pm-meta ev-info" id="evConInfo">${esc(INFO)}</p>` : '';
341
349
  if (T.src === null) return info + readsHtml() + '<p class="pm-meta">Reading the connectors.</p>';
342
350
  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 +353,12 @@ function connectors() {
345
353
  + `<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
354
  + extHtml(XT) + relayHtml(RL);
347
355
  }
356
+ /** One connector's page (connector-data, A150): the switches show what Settings holds now, so a press shows at once. */
357
+ function cdPage(id) {
358
+ const v = (T.cd || []).find((x) => x.id === id);
359
+ if (!v) return '<p class="pm-meta">Reading what PMOS reads and writes.</p>';
360
+ 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)) });
361
+ }
348
362
  /** The directory's read; after a +, again every 5 s with the probe until the connector shows or 2 minutes pass. */
349
363
  async function readDir(probe) {
350
364
  const d = await pmGet('/api/connectors/directory' + (probe ? '?probe=1' : '')).catch(() => null);
@@ -456,7 +470,23 @@ function lessonRow(l) {
456
470
  }
457
471
  const NO_KEY = 'pmos.settings.no';
458
472
  const noSet = () => { try { return new Set(JSON.parse(store.get(NO_KEY) || '[]')); } catch { return new Set(); } };
473
+ /* Settings › How PMOS decides › What PMOS does alone (does-alone, board BatchPagesDS 2, A513): one read-only table, one row per kind of
474
+ * 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
475
+ * rows have none. D106 opens the guide page that explains it. */
476
+ function aloneSec() {
477
+ const R = T.al;
478
+ if (!R) return '<p class="pm-meta">Reading what PMOS does alone.</p>';
479
+ 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>`;
480
+ 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>`
481
+ + `<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>`
482
+ + `<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>`;
483
+ return (R.off ? `<p class="pm-meta">PMOS does nothing alone now: ${esc(R.off)}.</p>` : '')
484
+ + `<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>`
485
+ + (R.line ? `<p class="pm-said"><span class="pm-star" aria-hidden="true">✦</span> ${esc(R.line)}</p>` : '') + '</section>';
486
+ }
487
+ 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
488
  function decidesSec() {
489
+ if (T.sub === 'alone') return subHead('alone') + aloneSec();
460
490
  const K = T.ck;
461
491
  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
492
  : !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 +497,7 @@ function decidesSec() {
467
497
  + `<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
498
  + (T.lsOpen ? `<div class="rows">${L.slice(0, 8).map(lessonRow).join('')}</div>` : '')
469
499
  + `<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
500
+ 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
501
  + `<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
502
  + `<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
503
  + lessons
@@ -677,6 +707,8 @@ async function press(e) {
677
707
  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
708
  if ('evClose' in t.dataset) { closeSettings(); return; }
679
709
  if ('evLsfold' in t.dataset) { T.lsOpen = !T.lsOpen; draw(); return; }
710
+ if (t.dataset.evDguide) { import('./premium-vw-open.js').then((M) => M.openGuide(t.dataset.evDguide)).catch(() => {}); return; }
711
+ 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
712
  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
713
  const kind = t.dataset.kind, to = t.dataset.to;
682
714
  if (t.dataset.evSug === 'yes') { await saveWay(kind, to); return; }
@@ -696,7 +728,7 @@ async function press(e) {
696
728
  if ('evFold' in t.dataset) { T.fold = !T.fold; draw(); return; }
697
729
  if (t.dataset.evMore) { T.wkMore.add(t.dataset.evMore); draw(); return; }
698
730
  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; }
731
+ 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
732
  if (t.dataset.evSeg && t.dataset.evSeg.startsWith('claude.way:')) { await saveWay(t.dataset.evSeg.slice(11), t.dataset.v); return; }
701
733
  if (t.dataset.evSeg === 'work.role') {
702
734
  const r = await pmPost('/api/settings', { key: 'work.role', value: t.dataset.v });
@@ -761,7 +793,8 @@ async function press(e) {
761
793
  if (T.busy) return;
762
794
  T.busy = true; T.msg = '';
763
795
  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.'; }
796
+ 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(); }
797
+ 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
798
  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
799
  else if ('evAdd' in t.dataset) {
767
800
  const root = (T.el.querySelector('#evRoot').value || '').trim();
@@ -854,6 +887,7 @@ async function load() {
854
887
  SRU.load(T.ws.filter((x) => !x.linked), draw).catch(() => {}); // Settings › How PMOS decides › Standing rules
855
888
  T.src = p && p.ok && p.settings ? { ...p.settings.briefSources } : {}; T.con = p && p.ok && p.settings ? { ...p.settings.connectors } : {};
856
889
  T.conn = p && p.connectors && Array.isArray(p.connectors.list) ? p.connectors.list : [];
890
+ pmGet('/api/connector-data').then((d) => { T.cd = d && d.ok ? d.connectors : []; draw(); }).catch(() => { T.cd = []; }); // connector-data (A150)
857
891
  readDir(false).then(() => draw()); // the directory: proposals, ✦ For you signals (initiative connectors-directory)
858
892
  T.set = s && s.ok ? s : null;
859
893
  if (T.set) await AD.loadPrefs(async () => T.set);