create-pmos 0.813.0 → 0.814.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.813.0",
3
+ "version": "0.814.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -33,6 +33,20 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.814.0",
38
+ "at": "2026-11-25T07:02:21.301Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1854,
43
+ "t": "Ask PMOS about anything you press (right-click / long-press), A528",
44
+ "s": "Ask PMOS about anything you press (right-click / long-press), A528",
45
+ "k": "new",
46
+ "i": "ask-anywhere"
47
+ }
48
+ ]
49
+ },
36
50
  {
37
51
  "v": "0.813.0",
38
52
  "at": "2026-11-25T06:39:24.149Z",
@@ -43,6 +57,7 @@
43
57
  "t": "Where the week went, one quiet Friday card on Today",
44
58
  "s": "Where the week went, one quiet Friday card on Today",
45
59
  "k": "new",
60
+ "i": "week-went-summary",
46
61
  "h": "Where the week went, one quiet Friday card on Today",
47
62
  "try": {
48
63
  "steps": [
@@ -51,8 +66,7 @@
51
66
  ],
52
67
  "see": "One card splits your week: hours in meetings, decisions, reviews, notes written and tasks done, with one line on what moved. Nothing is sent, and the row is gone until next Friday",
53
68
  "open": "/today.html"
54
- },
55
- "i": "week-went-summary"
69
+ }
56
70
  }
57
71
  ]
58
72
  },
@@ -371,35 +385,6 @@
371
385
  "k": "new"
372
386
  }
373
387
  ]
374
- },
375
- {
376
- "v": "0.789.0",
377
- "at": "2026-11-24T18:21:37.096Z",
378
- "f": 4,
379
- "prs": [
380
- {
381
- "n": 1801,
382
- "t": "Scope cuts S2, S6, S7 checks",
383
- "s": "Scope cuts S2, S6, S7 checks",
384
- "k": "x",
385
- "h": "Scope cuts S2, S6, S7 checks",
386
- "try": {
387
- "steps": [
388
- "Open Work and open an initiative whose end date is still ahead but whose tasks run past it",
389
- "Press its ✦ and find Cut to keep the date",
390
- "Keep it, then press Undo"
391
- ],
392
- "see": "The ✦ lists the tasks that finish after the date, each with its forecast and the new dates after the date; Keep moves them and adds a note, and Undo puts them back",
393
- "open": "/premium-board.html"
394
- }
395
- },
396
- {
397
- "n": 1791,
398
- "t": "Status in one line, 12 words at most, the full text kept in the log (status-line, job #1775)",
399
- "s": "Status in one line, 12 words at most, the full text kept in the log (status-line, job #1775)",
400
- "k": "new"
401
- }
402
- ]
403
388
  }
404
389
  ]
405
390
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@b2e2ef88a
1
+ kernel-source: pmos@51dedb0aa
2
2
  assembled: 2026-11-25
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-25T06:39:21Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T07:02:18Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-11-25T06:39:21Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T07:02:18Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-11-25T06:39:21Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T07:02:18Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,18 @@
1
1
  [
2
+ {
3
+ "v": "0.814.0",
4
+ "at": "2026-11-25T07:02:21.301Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1854,
9
+ "t": "Ask PMOS about anything you press (right-click / long-press), A528",
10
+ "s": "Ask PMOS about anything you press (right-click / long-press), A528",
11
+ "k": "new",
12
+ "i": "ask-anywhere"
13
+ }
14
+ ]
15
+ },
2
16
  {
3
17
  "v": "0.813.0",
4
18
  "at": "2026-11-25T06:39:24.149Z",
@@ -9,6 +23,7 @@
9
23
  "t": "Where the week went, one quiet Friday card on Today",
10
24
  "s": "Where the week went, one quiet Friday card on Today",
11
25
  "k": "new",
26
+ "i": "week-went-summary",
12
27
  "h": "Where the week went, one quiet Friday card on Today",
13
28
  "try": {
14
29
  "steps": [
@@ -17,8 +32,7 @@
17
32
  ],
18
33
  "see": "One card splits your week: hours in meetings, decisions, reviews, notes written and tasks done, with one line on what moved. Nothing is sent, and the row is gone until next Friday",
19
34
  "open": "/today.html"
20
- },
21
- "i": "week-went-summary"
35
+ }
22
36
  }
23
37
  ]
24
38
  },
@@ -310,6 +310,18 @@ When the words you type in Search point clearly to one thing, the first row is t
310
310
 
311
311
  When you type a question, such as "why do some customers still use a spreadsheet instead of the app?", and no one sentence holds all your words, the first row says "Finding an answer in your work…". After a few seconds it shows a short answer, written only from passages of your own files, and the names of the files it used. Press Enter on the answer to open the first of them. To go deeper, pick "Ask PMOS" in the next row. When your files do not answer the question, the row goes away and the matches stay.
312
312
 
313
+ ## Ask about what you point at
314
+
315
+ Right-click any part of a page to ask PMOS about it. On a phone, press and hold it. A small Ask card opens next to it.
316
+
317
+ - The top line says what PMOS understood: the item, then the field or the place you pressed, for example **Instant payout to bank › Next milestone · Beta to 5% of users**. In a document it is the heading and the paragraph; on a slide it is the slide and the part, such as a chart bar.
318
+ - When the top line names the wrong thing, press **↑** to step out one level: the field, then the item, then the section, then the page.
319
+ - Under it is the item as Work holds it now, with its usual buttons. A task's date shows three later dates to move it to. Every change has Undo.
320
+ - Up to three questions show with ✦. Press one, or type your own question in the box.
321
+ - **⤢** opens the same conversation in the full chat. **×** or Escape closes the card.
322
+
323
+ Right-click keeps the browser's own menu in a text box, on a link, on selected text and in the terminal. Hold Shift to get the browser's menu anywhere.
324
+
313
325
  ## Keys
314
326
 
315
327
  | Key | What it does |
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.813.0",
3
+ "version": "0.814.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.813.0",
9
+ "version": "0.814.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.813.0",
3
+ "version": "0.814.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,311 @@
1
+ /* pm/ask-here-ctx.js — what the PM pressed, in PMOS's words (initiative ask-anywhere, A528). Pure: it reads only an element's attributes,
2
+ * tag, text and parents, so Node tests it on a small fake tree (ask-here.test.js) and the page runs it on the real one.
3
+ *
4
+ * resolve(el, { scope?, page? }) → ctx | null
5
+ * ctx = { page, section, record: { kind, id, title, via } | null, field, value, control, at }
6
+ * page 'Work · Lendly · Initiatives' the page's words (the caller passes them; pageWords() reads the document)
7
+ * section 'Initiatives' the nearest labelled block
8
+ * record the nearest thing with an id: a stamped data-ask="kind:id" first, then the ids the pages already write
9
+ * (data-wkopen, data-gl-kr …), then an id inside the same row, then scope (the open popup's or Viewer's item)
10
+ * field 'Next milestone' the column, the label, data-ask-field, or the chart part
11
+ * value 'Beta to 5% of users' what the element shows (its label for an icon button)
12
+ * at 'paragraph 2' | 'slide 4' a place inside a document or a deck (data-ask-at)
13
+ * widen(ctx) → ctx one level out: field → record → section → page (↑ on the Ask card); null at the page
14
+ * level(ctx) → 'field' | 'record' | 'section' | 'page'
15
+ * target(ctx) → { id, kind, title, subject, say, facts } for page-chat.js itemTarget, or null at section/page level
16
+ * crumbs(ctx) → [record words, field words] the card's top line shows
17
+ *
18
+ * The proof (A528, /mnt/project-files/ask-anywhere/proof/README.md) found the screen alone names the record on 15–32% of clicks, so the
19
+ * renderers stamp data-ask; the attribute table below is the floor for anything not stamped yet. */
20
+
21
+ /** Attributes that carry a record's id, in the order they are tried at one element. kind null: the value says it ("task:T-12"). */
22
+ export const IDS = [
23
+ ['data-ask', null],
24
+ ['data-wkopen', 'initiative'], ['data-wkstage', 'initiative'], ['data-wkbar', 'initiative'], ['data-line-ini', 'initiative'],
25
+ ['data-gl-ini', 'initiative'], ['data-gl-link', 'initiative'], ['data-gl-kr', 'key result'],
26
+ ['data-hm-prodopen', 'product'], ['data-po-id', 'product'],
27
+ ['data-key', null], ['data-id', null],
28
+ ];
29
+ /** "prefix:id" values: the prefix names the kind. Anything else in data-key / data-id is not trusted as an id. */
30
+ export const PREFIX = {
31
+ board: 'initiative', init: 'initiative', ini: 'initiative', initiative: 'initiative', task: 'task', pop: null, ms: 'milestone', milestone: 'milestone',
32
+ p: 'product', product: 'product', prog: 'program', program: 'program', doc: 'document', document: 'document', kr: 'key result', goal: 'goal',
33
+ jira: 'ticket', ticket: 'ticket', mtg: 'meeting', meeting: 'meeting', ev: 'event', event: 'event', slide: 'slide', deck: 'deck',
34
+ };
35
+ const ROW_TAGS = new Set(['TR', 'LI', 'ARTICLE']);
36
+ const ROW_ROLES = new Set(['row', 'listitem', 'article']);
37
+ const SECTION_TAGS = new Set(['SECTION', 'ARTICLE', 'ASIDE', 'DIALOG', 'TABLE', 'NAV', 'MAIN']);
38
+ const CONTROL_TAGS = new Set(['BUTTON', 'A', 'SELECT', 'INPUT', 'TEXTAREA']);
39
+
40
+ const clean = (s) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim();
41
+ const clip = (s, n = 90) => { const t = clean(s); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
42
+ const attr = (n, k) => (n && typeof n.getAttribute === 'function' ? n.getAttribute(k) : null);
43
+ const tag = (n) => String((n && n.tagName) || '').toUpperCase();
44
+ const up = (n) => (n && n.parentElement) || null;
45
+ const kids = (n) => (n && n.children ? Array.from(n.children) : []);
46
+ const text = (n) => clean(n && n.textContent);
47
+ const isRow = (n) => ROW_TAGS.has(tag(n)) || ROW_ROLES.has(attr(n, 'role')) || / pm-li /.test(' ' + (attr(n, 'class') || '') + ' ');
48
+ const isTop = (n) => !n || tag(n) === 'BODY' || tag(n) === 'HTML';
49
+
50
+ /** The record an id attribute names, or null. */
51
+ export function idOf(name, kind, v) {
52
+ const s = clean(v);
53
+ if (s.length < 2) return null;
54
+ if (name === 'data-ask') { // the stamp: "kind:id", the kind in plain words ("key result:o1::kr2"); a known short prefix is read as its kind
55
+ const i = s.indexOf(':'); if (i < 1 || i === s.length - 1) return null;
56
+ const k = s.slice(0, i).trim().toLowerCase();
57
+ return { kind: PREFIX[k] || k, id: s.slice(i + 1) };
58
+ }
59
+ const m = /^([a-z][a-z-]*):(.+)$/i.exec(s);
60
+ if (m && Object.prototype.hasOwnProperty.call(PREFIX, m[1].toLowerCase())) {
61
+ const k = PREFIX[m[1].toLowerCase()];
62
+ if (k === null) return idOf(name, kind, m[2]); // pop:task:T-1 → task:T-1
63
+ return { kind: kind || k, id: m[2] };
64
+ }
65
+ if (kind) return { kind, id: s };
66
+ if (/^[A-Z][A-Z0-9]{1,9}-\d{1,6}$/.test(s)) return { kind: 'ticket', id: s };
67
+ return null;
68
+ }
69
+ /** The record one element carries itself, or null. */
70
+ export function idAt(n) {
71
+ for (const [name, kind] of IDS) {
72
+ const v = attr(n, name); if (v == null) continue;
73
+ const r = idOf(name, kind, v); if (r) return { ...r, via: name };
74
+ }
75
+ return null;
76
+ }
77
+ function findIn(n, depth = 0) { // an id on something inside a row (the Line writes it on the name button, not the row)
78
+ if (depth > 6) return null;
79
+ for (const c of kids(n)) { const r = idAt(c) || findIn(c, depth + 1); if (r) return r; }
80
+ return null;
81
+ }
82
+ function titleOf(n) {
83
+ const named = attr(n, 'data-ask-title') || attr(n, 'aria-label');
84
+ if (named) return clip(named, 80);
85
+ const walk = (x, d) => { // the first strong-looking child: a link, a heading, a name button
86
+ for (const c of kids(x)) {
87
+ if (/^(A|BUTTON|H1|H2|H3|H4|STRONG|B|TH)$/.test(tag(c)) && text(c)) return text(c);
88
+ const r = d < 4 ? walk(c, d + 1) : ''; if (r) return r;
89
+ }
90
+ return '';
91
+ };
92
+ return clip(walk(n, 0) || text(n), 80);
93
+ }
94
+ function labelOf(n) {
95
+ const l = attr(n, 'aria-label');
96
+ if (l) return clean(l);
97
+ const by = attr(n, 'aria-labelledby');
98
+ if (by && n.ownerDocument && n.ownerDocument.getElementById) { const h = n.ownerDocument.getElementById(by.split(/\s+/)[0]); if (h) return text(h); }
99
+ const walk = (x, d) => { for (const c of kids(x)) { if (/^H[1-4]$/.test(tag(c)) || tag(c) === 'CAPTION') return text(c); const r = d < 2 ? walk(c, d + 1) : ''; if (r) return r; } return ''; };
100
+ return walk(n, 0);
101
+ }
102
+ /** The column header above a table cell: the th at the same index in the table's head row. */
103
+ function headerOf(td) {
104
+ const tr = up(td); if (!tr) return '';
105
+ const i = kids(tr).indexOf(td);
106
+ let t = up(tr); while (t && tag(t) !== 'TABLE') t = up(t);
107
+ if (!t) return '';
108
+ const head = kids(t).find((c) => tag(c) === 'THEAD');
109
+ const row = head && kids(head).find((c) => tag(c) === 'TR');
110
+ const th = row && kids(row)[i];
111
+ return th ? text(th) : '';
112
+ }
113
+ function fieldAt(n) {
114
+ const f = attr(n, 'data-ask-field'); if (f) return clean(f);
115
+ if (tag(n) === 'TD') return headerOf(n);
116
+ if (tag(n) === 'DD') { let p = n.previousElementSibling; if (p && tag(p) === 'DT') return text(p); }
117
+ if (tag(n) === 'LABEL') return clip(text(n), 40);
118
+ if (attr(n, 'data-wkstage')) return 'Stage';
119
+ if (attr(n, 'data-wkbar')) return 'Timeline';
120
+ return '';
121
+ }
122
+
123
+ /** Where a press sits inside a document that has no data-ask-at: the heading above it and its paragraph number under that heading
124
+ * ("Risks · paragraph 2"). Only blocks are counted, so the place stays the same when the words inside change. */
125
+ const BLOCK = new Set(['P', 'LI', 'BLOCKQUOTE', 'PRE', 'TABLE', 'FIGURE', 'UL', 'OL']);
126
+ const HEAD = /^H[1-6]$/;
127
+ const BLOCK_WORD = { P: 'paragraph', LI: 'list item', BLOCKQUOTE: 'quote', PRE: 'code', TABLE: 'table', FIGURE: 'figure', UL: 'list', OL: 'list' };
128
+ export function placeOf(el, root) {
129
+ let b = el;
130
+ while (b && b !== root && !BLOCK.has(tag(b)) && !HEAD.test(tag(b))) b = up(b);
131
+ if (!b || b === root) return '';
132
+ if (HEAD.test(tag(b))) return clip(text(b), 60);
133
+ let item = 0;
134
+ if (tag(b) === 'LI') { const l = up(b); item = kids(l).indexOf(b) + 1; b = l; }
135
+ while (up(b) && up(b) !== root && !kids(up(b)).some((k) => HEAD.test(tag(k)))) b = up(b); // climb to the level the headings sit on
136
+ let n = 0, head = '';
137
+ for (let p = b; p; p = p.previousElementSibling) {
138
+ if (HEAD.test(tag(p))) { head = clip(text(p), 50); break; }
139
+ if (BLOCK.has(tag(p)) && (p === b || tag(p) === tag(b))) n++;
140
+ }
141
+ const word = item ? 'list item' : BLOCK_WORD[tag(b)] || 'paragraph';
142
+ return [head, `${word} ${item || n}`].filter(Boolean).join(' · ');
143
+ }
144
+ /** What the PM pressed. scope: { kind, id, title } of the popup or Viewer the element sits in (the caller finds it). */
145
+ export function resolve(el, o = {}) {
146
+ if (!el || isTop(el)) return null;
147
+ let record = null, field = '', section = '', control = '', at = '', rowAt = null;
148
+ for (let n = el; n && !isTop(n); n = up(n)) {
149
+ if (!control && CONTROL_TAGS.has(tag(n))) control = clip(attr(n, 'aria-label') || attr(n, 'title') || text(n) || attr(n, 'placeholder'), 60);
150
+ if (!field) field = fieldAt(n);
151
+ if (!at) at = clean(attr(n, 'data-ask-at'));
152
+ if (!record) {
153
+ const r = idAt(n);
154
+ if (r) record = { ...r, title: titleOf(n) };
155
+ else if (isRow(n) && !rowAt) { const r2 = findIn(n); if (r2) record = { ...r2, via: r2.via + ' (row)', title: titleOf(n) }; rowAt = n; }
156
+ }
157
+ if (!section && (SECTION_TAGS.has(tag(n)) || /^(region|dialog)$/.test(attr(n, 'role') || ''))) section = clip(labelOf(n), 60);
158
+ if (record && section) break;
159
+ }
160
+ if (!at && record && /^(document|meeting note)$/.test(record.kind)) {
161
+ let root = el; while (root && !isTop(root) && attr(root, 'data-ask') == null) root = up(root);
162
+ if (root && !isTop(root)) at = placeOf(el, root);
163
+ }
164
+ if (!record && o.scope && o.scope.id) record = { kind: clean(o.scope.kind).toLowerCase() || 'item', id: String(o.scope.id), title: clip(o.scope.title || '', 80), via: 'scope' };
165
+ const value = clip(attr(el, 'aria-label') || attr(el, 'title') || text(el) || (el.value || ''), 120);
166
+ return { page: clean(o.page || ''), section, record, field: clean(field), value, control, at };
167
+ }
168
+ export function level(c) { return !c ? 'page' : c.record && (c.field || c.at) ? 'field' : c.record ? 'record' : c.section ? 'section' : 'page'; }
169
+ /** One level out. */
170
+ export function widen(c) {
171
+ const l = level(c);
172
+ if (l === 'field') return { ...c, field: '', at: '', value: c.record.title || c.value };
173
+ if (l === 'record') return { ...c, record: null, field: '', at: '', value: '' };
174
+ if (l === 'section') return { ...c, section: '', record: null, field: '', at: '', value: '' };
175
+ return null;
176
+ }
177
+ /** The card's top line: the record, then the field and its value (or the place in a document). */
178
+ export function crumbs(c) {
179
+ const l = level(c);
180
+ if (l === 'page') return [c.page || 'This page'];
181
+ if (l === 'section') return [c.section];
182
+ const rec = c.record.title || c.record.id;
183
+ if (l === 'record') return [rec];
184
+ const v = c.value && c.value !== rec ? c.value : '';
185
+ return [rec, [c.field || c.at, v].filter(Boolean).join(' · ')];
186
+ }
187
+ /** The chat target's item (page-chat.js itemTarget): its own conversation per record, with what was pressed as facts. */
188
+ export function target(c) {
189
+ const l = level(c);
190
+ if (l === 'page' || l === 'section') return null;
191
+ const facts = [['Kind', c.record.kind], ['Id', c.record.id], ['Page', c.page], ['Section', c.section]];
192
+ if (l === 'field') { if (c.field) facts.push(['Field', c.field]); if (c.at) facts.push(['Place', c.at]); facts.push(['Shows', c.value]); }
193
+ const subject = l === 'field' ? [c.field || c.at, c.value].filter(Boolean).join(': ') : '';
194
+ return {
195
+ id: c.record.id, kind: c.record.kind.replace(/\s+/g, '-'), title: c.record.title || c.record.id, subject,
196
+ say: 'The PM pressed ' + (l === 'field' ? (c.field || c.at || 'part') + ' of ' : '') + 'the ' + c.record.kind + ' "' + (c.record.title || c.record.id) + '" on ' + (c.page || 'this page') + '. Read that record with pmos before you answer.',
197
+ facts: facts.filter((f) => clean(f[1])),
198
+ };
199
+ }
200
+ /** The words for the chat when nothing narrower than a section or the page was pressed. */
201
+ export function hereWords(c) { return [c && c.page, c && c.section].filter(Boolean).join(' · '); }
202
+
203
+ /* ── the card's ✦ questions and its one picker (done test R4). Questions are things PMOS answers from records; a change is offered only
204
+ * as the card catalog's own action (one pmos command with Undo), never a new write path. ── */
205
+ const Q = {
206
+ 'task': { '': ['Where does it stand?', 'What is blocking it?', 'Write its description'], due: ['Will it land on this date?', 'What slips if it moves?', 'Why this date?'],
207
+ owner: ['What else is this person carrying?', 'Who else could do it?', 'Where does it stand?'], status: ['Why is it in this state?', 'What moves it on?', 'Who is waiting on it?'] },
208
+ 'milestone': { '': ['Will it land on time?', 'What is still open?', 'What slips if it moves?'], due: ['Will it land on this date?', 'What slips if it moves?', 'Why this date?'] },
209
+ 'initiative': { '': ['Where does it stand?', 'What is blocking it?', 'What should I do next?'], stage: ['Is it ready for the next stage?', 'What does this stage still need?', 'How long has it been here?'],
210
+ due: ['Will it land on this date?', 'What slips if it moves?', 'What is still open?'], milestone: ['Will this milestone land on time?', 'What is still open for it?', 'What slips if it moves?'] },
211
+ 'key result': { '': ['Where does this number come from?', 'Which initiative moves it most?', 'Is it on pace?'] },
212
+ 'goal': { '': ['Which initiatives serve it?', 'Is it on track?', 'What is missing?'] },
213
+ 'product': { '': ['What needs me on this product?', 'What moved this week?', 'What is at risk?'] },
214
+ 'document': { '': ['Summarise it in three lines', 'Is it still true?', 'What does it decide?'], place: ['Is this still true?', 'Who must agree to it?', 'Say it in one line'] },
215
+ 'slide': { '': ['What is this slide saying?', 'Where does this number come from?', 'Is it still true?'] },
216
+ 'ticket': { '': ['Is it in step with PMOS?', 'Where does it stand?', 'Who is on it?'] },
217
+ 'meeting': { '': ['What should I settle in it?', 'What is owed to me?', 'Draft the agenda'] },
218
+ 'event': { '': ['What should I settle in it?', 'What is owed to me?', 'Draft the agenda'] },
219
+ };
220
+ const SECTION_Q = ['What needs me here?', 'What changed here this week?', 'Explain this part'];
221
+ /** The field kind a column or label is: due, owner, status, stage, milestone, or '' */
222
+ export function fieldKind(f) {
223
+ const s = clean(f).toLowerCase();
224
+ if (!s) return '';
225
+ if (/^(due|date|due date|finish|end|check by|target)$/.test(s) || /\bdue\b|\bdate\b/.test(s)) return 'due';
226
+ if (/owner|assignee|who/.test(s)) return 'owner';
227
+ if (/^stage$|workflow/.test(s)) return 'stage';
228
+ if (/status|state/.test(s)) return 'status';
229
+ if (/milestone/.test(s)) return 'milestone';
230
+ return '';
231
+ }
232
+ /** Three ✦ questions for what was pressed. */
233
+ export function questionsOf(c) {
234
+ const l = level(c);
235
+ if (l === 'page' || l === 'section') return SECTION_Q.slice();
236
+ const k = Q[c.record.kind] || null;
237
+ if (!k) return ['What is this?', 'Where does it stand?', 'What should I do about it?'];
238
+ const fk = l === 'field' ? (c.at ? 'place' : fieldKind(c.field)) : '';
239
+ return (k[fk] || k['']).slice(0, 3);
240
+ }
241
+ const DOW = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
242
+ const iso = (d) => d.toISOString().slice(0, 10);
243
+ const label = (d) => `${DOW[d.getUTCDay()]} ${d.getUTCDate()} ${MON[d.getUTCMonth()]}`;
244
+ function addWorkdays(d, n) { const x = new Date(d.getTime()); let k = 0; while (k < n) { x.setUTCDate(x.getUTCDate() + 1); if (x.getUTCDay() % 6) k++; } return x; }
245
+ /** The picker for a pressed due date of a task or milestone: the card catalog's "Move the date" with three dates, the current one kept
246
+ * 2, 5 and 10 working days after the due date (after today when the date has passed), the first recommended. row: /api/card-rows' row. null when
247
+ * the press is not a task's date, or the row has no date to move. today: 'YYYY-MM-DD'. */
248
+ export function datePick(c, row, today) {
249
+ if (level(c) !== 'field' || fieldKind(c.field) !== 'due' || !row || row.found === false) return null;
250
+ const kind = row.kind || c.record.kind;
251
+ if (!/^(task|subtask|milestone)$/.test(kind) || !/^\d{4}-\d{2}-\d{2}$/.test(String(row.due || ''))) return null;
252
+ const t = new Date(String(today).slice(0, 10) + 'T00:00:00Z'), due = new Date(row.due + 'T00:00:00Z');
253
+ if (isNaN(t) || isNaN(due)) return null;
254
+ // three later dates, never today's own date again (a press that moves nothing is no choice): from the due date when it is ahead, else from today
255
+ const base = due >= t ? due : t;
256
+ const opts = [addWorkdays(base, 2), addWorkdays(base, 5), addWorkdays(base, 10)];
257
+ const options = opts.map((d) => ({ value: iso(d), label: label(d) }));
258
+ return { kind: kind === 'subtask' ? 'task' : kind, id: row.id, action: 'Move the date', question: 'Move ' + (row.title || row.id) + '?', fields: [{ flag: 'due', options, recommended: 0 }] };
259
+ }
260
+
261
+ /** True when a right-click should keep the browser's own menu: a text field, a real link, selected text, the terminal, the Ask card itself,
262
+ * or Shift held (the way back to the browser's menu anywhere). o: { selected: string, shift: boolean }. Works on real elements (closest). */
263
+ export function nativeMenu(el, o = {}) {
264
+ if (!el || typeof el.closest !== 'function') return true;
265
+ if (o.shift || String(o.selected || '').trim()) return true;
266
+ if (el.closest('input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm, .ah-card, video, audio')) return true;
267
+ const a = el.closest('a[href]');
268
+ if (a) { const h = String(a.getAttribute('href') || ''); if (h && h !== '#' && !/^javascript:/i.test(h)) return true; }
269
+ return false;
270
+ }
271
+
272
+ /** The presses that open the Ask card (cozy-nav.js mountNav calls it once per page). A right-click outside nativeMenu's places opens it at
273
+ * the pointer; a phone's long-press (LONG_MS still, under MOVE_PX of movement) opens it as a sheet and eats the click that follows. The
274
+ * card's own module loads on the first press (load: () => import('./ask-here.js')), so a page that is never pressed pays nothing. */
275
+ export const LONG_MS = 600, MOVE_PX = 10;
276
+ /** Places where a press and hold already means something (pick rows, drag to order, tick a check): a long-press there is theirs. */
277
+ export const HOLDS = '[data-pw-row], [data-iv-edit][data-drag], [data-iv-check], .bk-i, [data-po-list] [data-po-id], .gl-tip';
278
+ export function wire(document, load) { // the page's own document (a test passes a stand-in)
279
+ if (!document || !document.defaultView || document.__askHere) return false;
280
+ document.__askHere = true;
281
+ const win = document.defaultView;
282
+ const sel = () => { try { return String(win.getSelection ? win.getSelection() : ''); } catch { return ''; } };
283
+ document.addEventListener('contextmenu', (e) => {
284
+ if (e.defaultPrevented || nativeMenu(e.target, { selected: sel(), shift: e.shiftKey })) return;
285
+ e.preventDefault();
286
+ const x = e.clientX, y = e.clientY, el = e.target;
287
+ load().then((M) => M.open(el, { x, y, sheet: false })).catch(() => null);
288
+ });
289
+ let t = null, at = null, fired = false;
290
+ const stop = () => { if (t) { clearTimeout(t); t = null; } };
291
+ document.addEventListener('touchstart', (e) => {
292
+ stop(); fired = false;
293
+ if (!e.touches || e.touches.length !== 1) return;
294
+ const p = e.touches[0], el = e.target;
295
+ if (nativeMenu(el, { selected: sel() }) || (el.closest && el.closest(HOLDS))) return;
296
+ at = { x: p.clientX, y: p.clientY };
297
+ t = setTimeout(() => {
298
+ t = null;
299
+ if (document.querySelector('.gl-tip:not([hidden])')) return; // the glossary showed a word's meaning on this press
300
+ fired = true;
301
+ try { if (win.navigator && win.navigator.vibrate) win.navigator.vibrate(10); } catch { /* no buzz */ }
302
+ load().then((M) => M.open(el, { x: at.x, y: at.y, sheet: win.innerWidth <= 760 })).catch(() => null);
303
+ }, LONG_MS);
304
+ }, { passive: true });
305
+ document.addEventListener('touchmove', (e) => { const p = e.touches && e.touches[0]; if (t && p && at && Math.hypot(p.clientX - at.x, p.clientY - at.y) > MOVE_PX) stop(); }, { passive: true });
306
+ document.addEventListener('touchend', (e) => { stop(); if (fired) { fired = false; e.preventDefault(); } });
307
+ document.addEventListener('touchcancel', stop, { passive: true });
308
+ // the long-press opened the card: the click the lift would make is not a press on the row
309
+ document.addEventListener('click', (e) => { if (fired) { fired = false; e.preventDefault(); e.stopPropagation(); } }, true);
310
+ return true;
311
+ }
@@ -0,0 +1,36 @@
1
+ /* pm/ask-here.css — the Ask card a right-click or a long-press opens (initiative ask-anywhere; canvas Exploring 3 page askclick, boards
2
+ * AcA, AcA1–AcA5, agreed by Wawan 2026-11-25). Komorebi tokens only. The chat inside is Home's own (cozy-home.css). */
3
+ .ah-ring { outline: 2px solid var(--cz-ok); outline-offset: 2px; border-radius: 6px; box-shadow: 0 0 0 6px var(--cz-okbg); }
4
+ .ah-card { position: fixed; left: var(--bd-ahx, 8px); top: var(--bd-ahy, 8px); z-index: 2147483000; width: 392px; max-width: calc(100vw - 16px); max-height: min(640px, calc(100vh - 16px)); display: flex; flex-direction: column;
5
+ background: var(--cz-card); color: var(--cz-ink); border-radius: 8px; box-shadow: var(--cz-lift), 0 0 0 1px var(--cz-hair);
6
+ font-family: var(--cz-sans); font-size: var(--fs-body); line-height: var(--lh-body); overflow: hidden; }
7
+ .ah-hd { display: flex; align-items: center; gap: 2px; padding: 10px 6px 6px 12px; }
8
+ .ah-crumb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
9
+ .ah-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 26px; padding: 0 10px; border-radius: 6px; background: var(--cz-well); font-size: var(--fs-meta);
10
+ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
11
+ .ah-chip.now { background: var(--cz-okbg); box-shadow: inset 0 0 0 1px var(--cz-ok); }
12
+ .ah-chip .k { color: var(--cz-ink3); }
13
+ .ah-sep { color: var(--cz-ink3); font-size: var(--fs-meta); }
14
+ .ah-icb { width: 32px; height: 32px; flex: none; border: 0; border-radius: 8px; background: none; color: var(--cz-ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
15
+ @media (hover: hover) { .ah-icb:hover, .ah-sug button:hover { background: var(--cz-well); } }
16
+ .ah-icb:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 1px; }
17
+ .ah-icb[disabled] { opacity: .35; cursor: default; }
18
+ .ah-bd { padding: 2px 12px 8px; display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; }
19
+ .ah-sug { display: flex; flex-direction: column; gap: 2px; }
20
+ .ah-sug button { all: unset; display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--cz-ink); font-size: var(--fs-body); }
21
+ .ah-sug button:focus-visible { outline: 2px solid var(--cz-blue); }
22
+ .ah-sug svg { color: var(--cz-ok); flex: none; }
23
+ .ah-chat { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--cz-hair); }
24
+ .ah-chat > .hm-chat { flex: 1 1 auto; min-height: 0; padding: 4px 12px 10px; }
25
+ .ah-chat > .hm-chat > .hm-reopen, .ah-chat [data-hm-scope] { display: none; }
26
+ .ah-chat .hm-log { max-height: 280px; }
27
+ .ah-chat.quiet .hm-log, .ah-chat.quiet .hm-chd, .ah-chat.quiet .hm-sug, .ah-chat.quiet .hm-plw { display: none; } /* before a question: only the box */
28
+ .ah-card .cc-card, .ah-card .cc-pick { margin: 0; }
29
+ /* a phone: the same card as a sheet from the bottom, 44 px targets (board AcA5Phone) */
30
+ .ah-card.sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: 100%; max-width: none; max-height: 80vh; border-radius: 8px; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
31
+ .ah-card.sheet .ah-icb { width: 44px; height: 44px; }
32
+ .ah-card.sheet .ah-sug button { min-height: 44px; }
33
+ .ah-grab { width: 40px; height: 5px; border-radius: 6px; background: var(--cz-hair); margin: 8px auto 0; display: none; }
34
+ .ah-card.sheet .ah-grab { display: block; }
35
+ @media (prefers-reduced-motion: no-preference) { .ah-card { animation: ah-in 160ms cubic-bezier(.2,.7,.2,1); } }
36
+ @keyframes ah-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@@ -0,0 +1,195 @@
1
+ /* pm/ask-here.js — ask PMOS about anything you press (initiative ask-anywhere, A528; canvas Exploring 3 page askclick, boards AcA and
2
+ * AcA1–AcA5, agreed by Wawan 2026-11-25: "Agreed" on A with the card catalog).
3
+ *
4
+ * A right-click (a long-press on a phone, cozy-nav.js wires both and loads this module on the first press) opens one small Ask card beside
5
+ * what was pressed:
6
+ * top line what PMOS understood (pm/ask-here-ctx.js): the record, then the field and its value. ↑ steps out one level
7
+ * (field → record → section → page), ⤢ moves the talk into the one full chat (page-chat.js openAbout), × or Esc closes.
8
+ * the record its card catalog row, live (chat-cards.js, GET /api/card-rows) with the catalog's own buttons; a pressed due date of a task
9
+ * or a milestone brings the catalog's "Move the date" picker. Every press is one pmos command with Undo (action-run.js).
10
+ * ✦ lines three questions for that kind of thing and field; one press asks it.
11
+ * the chat the one chat of the page (page-chat.js box(): the same element and conversation the popup shows), opened on the record's own
12
+ * conversation (itemTarget: pop:<kind>:<id>, its first message carries what was pressed); answers come back with live cards.
13
+ * One chat at a time: the chat element is borrowed and put back where it was when the card closes.
14
+ *
15
+ * open(el, { x, y, sheet }) → true when a card opened close() isOpen() */
16
+ import * as C from './ask-here-ctx.js';
17
+ import { cardsUi } from './chat-cards.js';
18
+ import { runAction, routeOf } from './action-run.js';
19
+ import { tellCards } from './card-log.js';
20
+ import { pmGet, pmPost } from './http.js';
21
+ import { noteUse } from './use-log.js';
22
+
23
+ const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
24
+ const P = (d) => `<svg 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="${d}"/></svg>`;
25
+ const I = { up: 'M12 19V5M6 11l6-6 6 6', expand: 'M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7', x: 'M6 6l12 12M18 6L6 18', star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z' };
26
+ const S = { card: null, ctx: null, el: null, ring: null, ws: '', chat: null, chatEl: null, home: null, CU: null, row: undefined, today: '', key: 0, off: null };
27
+ const toast = (m) => { const t = document.getElementById('toast'); if (!t) return; t.textContent = m; t.classList.add('on'); setTimeout(() => t.classList.remove('on'), 4200); };
28
+
29
+ function sheet() {
30
+ const href = new URL('./ask-here.css', import.meta.url).href;
31
+ if (![...document.querySelectorAll('link[rel="stylesheet"]')].some((l) => l.href === href)) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = href; document.head.appendChild(l); }
32
+ }
33
+ /** The page's words: its title without "PMOS ·", and the switch tab that is on. */
34
+ export function pageWords(doc = document) {
35
+ const name = String(doc.title || '').replace(/^PMOS\s*[·|–-]\s*/i, '').replace(/\s*[·|–-]\s*PMOS\s*$/i, '').trim();
36
+ const tab = doc.querySelector('[role=tab][aria-selected="true"], [data-bksw][aria-pressed="true"], [data-bksw].on');
37
+ const t = tab ? String(tab.textContent || '').replace(/\s+/g, ' ').trim() : '';
38
+ return [name, t && t !== name ? t : ''].filter(Boolean).join(' · ');
39
+ }
40
+ /** The workspace the pressed thing belongs to: a data-ws / data-ask-ws on it or around it, else the page's ?ws=. */
41
+ function wsOf(el) {
42
+ const w = el.closest('[data-ask-ws],[data-ws],[data-gl-ws],[data-line-ws]');
43
+ const v = w && (w.getAttribute('data-ask-ws') || w.getAttribute('data-ws') || w.getAttribute('data-gl-ws') || w.getAttribute('data-line-ws'));
44
+ return v || new URLSearchParams(location.search).get('ws') || '';
45
+ }
46
+ /** The open popup's or Viewer's item, when the press is inside it (the proof: exact on 27 of 27 presses). */
47
+ function scopeOf(el) {
48
+ if (!el.closest('.cz-vw, .cz-pop-card, [role=dialog]')) return null;
49
+ try { const c = window.czViewer && window.czViewer.current && window.czViewer.current(); return c && c.id ? { kind: c.kind, id: c.id, title: c.title } : null; } catch { return null; }
50
+ }
51
+ /** The element the record lives on, to ring: the pressed cell when a field was named, else the row or card. */
52
+ function ringOf(el, ctx) {
53
+ if (C.level(ctx) === 'field') return el.closest('td,th,dd,[data-ask-field],[data-ask-at],p,li,button,a,span') || el;
54
+ return el.closest('[data-ask],tr,[role=listitem],.pm-li,li,article,section') || el;
55
+ }
56
+
57
+ export const isOpen = () => !!S.card;
58
+ export function close() {
59
+ if (!S.card) return;
60
+ if (S.ring) S.ring.classList.remove('ah-ring');
61
+ putChatBack();
62
+ if (S.ro) { S.ro.disconnect(); S.ro = null; }
63
+ S.card.remove(); S.card = null; S.ring = null; S.ctx = null;
64
+ if (S.off) { S.off(); S.off = null; }
65
+ }
66
+ function putChatBack() {
67
+ if (!S.chatEl || !S.home) return;
68
+ const { parent, next } = S.home;
69
+ if (parent && parent.isConnected) parent.insertBefore(S.chatEl, next && next.parentNode === parent ? next : null); else S.chatEl.remove();
70
+ S.home = null;
71
+ }
72
+
73
+ export async function open(el, o = {}) {
74
+ if (!el || el.nodeType !== 1) return false;
75
+ close();
76
+ sheet();
77
+ const ctx = C.resolve(el, { scope: scopeOf(el), page: pageWords() });
78
+ if (!ctx) return false;
79
+ S.ctx = ctx; S.el = el; S.ws = wsOf(el); S.row = undefined; S.key += 1; S.today = new Date().toISOString().slice(0, 10);
80
+ const card = document.createElement('section');
81
+ card.className = 'ah-card' + (o.sheet ? ' sheet' : '');
82
+ card.setAttribute('role', 'dialog'); card.setAttribute('aria-label', 'Ask PMOS about this');
83
+ document.body.appendChild(card); S.card = card;
84
+ if (!S.CU) S.CU = cardsUi({ pmGet, pmPost, toast, redraw: () => drawRecord(), runAction, routeOf, tellCards, ws: () => S.ws });
85
+ draw();
86
+ place(o);
87
+ // the row, the picker and the chat arrive after the card opens: keep it on the screen as it grows
88
+ if (typeof ResizeObserver === 'function') { const ro = new ResizeObserver(() => place(o)); ro.observe(card); S.ro = ro; }
89
+ wireCard(card);
90
+ noteUse('ask-here-open');
91
+ return true;
92
+ }
93
+
94
+ function draw() {
95
+ const card = S.card, ctx = S.ctx; if (!card || !ctx) return;
96
+ const cr = C.crumbs(ctx).map((t, i, a) => (i ? '<span class="ah-sep" aria-hidden="true">›</span>' : '') + `<span class="ah-chip${i === a.length - 1 ? ' now' : ''}">${esc(t)}</span>`).join('');
97
+ const top = C.level(ctx) === 'page';
98
+ card.innerHTML = '<div class="ah-grab" aria-hidden="true"></div>'
99
+ + `<div class="ah-hd"><div class="ah-crumb" aria-label="What PMOS understood">${cr}</div>`
100
+ + `<button type="button" class="ah-icb" data-ah="up" aria-label="Ask about the bigger part instead" title="Ask about the bigger part instead"${top ? ' disabled' : ''}>${P(I.up)}</button>`
101
+ + `<button type="button" class="ah-icb" data-ah="full" aria-label="Open in the full chat" title="Open in the full chat">${P(I.expand)}</button>`
102
+ + `<button type="button" class="ah-icb" data-ah="x" aria-label="Close" title="Close">${P(I.x)}</button></div>`
103
+ + '<div class="ah-bd"><div class="ah-rec" id="ahRec"></div>'
104
+ + `<div class="ah-sug" id="ahSug">${C.questionsOf(ctx).map((q) => `<button type="button" data-ah-q="${esc(q)}">${P(I.star)}${esc(q)}</button>`).join('')}</div></div>`
105
+ + '<div class="ah-chat quiet" id="ahChat"></div>';
106
+ ring();
107
+ drawRecord();
108
+ mountChat();
109
+ }
110
+ function ring() {
111
+ if (S.ring) S.ring.classList.remove('ah-ring');
112
+ S.ring = null;
113
+ if (C.level(S.ctx) === 'page' || C.level(S.ctx) === 'section' || !S.el || !S.el.isConnected) return;
114
+ S.ring = ringOf(S.el, S.ctx); if (S.ring) S.ring.classList.add('ah-ring');
115
+ }
116
+ /** The record as its card catalog row, and the field's picker (only the kinds chat-cards.js draws: task, subtask, milestone, initiative). */
117
+ function drawRecord() {
118
+ const box = S.card && S.card.querySelector('#ahRec'); if (!box) return;
119
+ const ctx = S.ctx, l = C.level(ctx);
120
+ if (l === 'page' || l === 'section' || !/^(task|subtask|milestone|initiative)$/.test(ctx.record.kind)) { box.innerHTML = ''; return; }
121
+ let text = '```pmos-card ' + JSON.stringify({ kind: ctx.record.kind, ids: [ctx.record.id] }) + '```';
122
+ if (S.row === undefined) readRow();
123
+ const pick = S.row ? C.datePick(ctx, S.row, S.today) : null;
124
+ if (pick) text += '\n```pmos-pick ' + JSON.stringify(pick) + '```';
125
+ const sp = S.CU.split(text);
126
+ box.innerHTML = S.CU.html(sp, 'ah' + S.key);
127
+ }
128
+ function readRow() {
129
+ S.row = null;
130
+ const ctx = S.ctx, k = S.key;
131
+ pmGet('/api/card-rows?kind=' + encodeURIComponent(ctx.record.kind) + '&ids=' + encodeURIComponent(ctx.record.id) + (S.ws ? '&ws=' + encodeURIComponent(S.ws) : ''))
132
+ .then((r) => { if (k !== S.key) return; S.row = r && r.ok && Array.isArray(r.rows) ? (r.rows[0] || null) : null; drawRecord(); })
133
+ .catch(() => null);
134
+ }
135
+ /** The chat target: the record's own conversation with what was pressed, or Ask PMOS over the page at section and page level. */
136
+ async function targetOf() {
137
+ const M = await import('./page-chat.js');
138
+ const t = C.target(S.ctx);
139
+ return (t && M.itemTarget(t, S.ws || undefined)) || M.cosTarget(C.hereWords(S.ctx), S.ws || undefined);
140
+ }
141
+ async function mountChat() {
142
+ const holder = S.card && S.card.querySelector('#ahChat'); if (!holder) return;
143
+ const M = await import('./page-chat.js');
144
+ const { el, chat } = await M.box();
145
+ if (!S.card || !holder.isConnected) return;
146
+ if (!S.home && el.parentNode && !S.card.contains(el)) S.home = { parent: el.parentNode, next: el.nextSibling };
147
+ S.chatEl = el; S.chat = chat;
148
+ holder.appendChild(el);
149
+ chat.open(await targetOf());
150
+ }
151
+ function ask(q) {
152
+ const holder = S.card && S.card.querySelector('#ahChat'); if (!holder) return;
153
+ holder.classList.remove('quiet');
154
+ const sug = S.card.querySelector('#ahSug'); if (sug) sug.hidden = true;
155
+ const ta = holder.querySelector('textarea'), form = holder.querySelector('form.hm-box');
156
+ if (!ta || !form) return;
157
+ ta.value = q; ta.dispatchEvent(new Event('input', { bubbles: true }));
158
+ form.requestSubmit();
159
+ }
160
+ async function full() {
161
+ const t = await targetOf();
162
+ close();
163
+ noteUse('ask-here-full');
164
+ const M = await import('./page-chat.js');
165
+ return M.openAbout(t);
166
+ }
167
+ function place(o) {
168
+ const card = S.card; if (!card || o.sheet) return;
169
+ const r = card.getBoundingClientRect(), W = innerWidth, H = innerHeight;
170
+ const x = Number.isFinite(o.x) ? o.x : W / 2, y = Number.isFinite(o.y) ? o.y : H / 3;
171
+ let left = Math.min(Math.max(8, x - 40), W - r.width - 8), top = y + 14;
172
+ if (top + r.height > H - 8) top = Math.max(8, y - r.height - 14);
173
+ card.style.setProperty('--bd-ahx', Math.round(left) + 'px'); card.style.setProperty('--bd-ahy', Math.round(top) + 'px');
174
+ }
175
+ // one click listener on the document for every card (a card's own buttons are real <button>s; the listener only routes them)
176
+ let routed = false;
177
+ function wireCard() {
178
+ if (routed) return; routed = true;
179
+ document.addEventListener('click', async (e) => {
180
+ const card = S.card; if (!card || !e.target || !e.target.closest || !card.contains(e.target)) return;
181
+ const b = e.target.closest('button'); if (!b) return;
182
+ if (S.CU && S.CU.owns(b)) { e.preventDefault(); await S.CU.press(b); return; }
183
+ const a = b.getAttribute('data-ah');
184
+ if (a === 'x') { close(); return; }
185
+ if (a === 'full') { full(); return; }
186
+ if (a === 'up') { const w = C.widen(S.ctx); if (w) { S.ctx = w; S.row = undefined; S.key += 1; noteUse('ask-here-widen'); putChatBack(); draw(); } return; }
187
+ const q = b.getAttribute('data-ah-q'); if (q) { noteUse('ask-here-question'); ask(q); }
188
+ });
189
+ card.addEventListener('input', (e) => { if (e.target && e.target.matches('textarea')) card.querySelector('#ahChat').classList.remove('quiet'); });
190
+ const esc = (e) => { if (e.key === 'Escape' && S.card) { e.stopPropagation(); close(); } };
191
+ const outside = (e) => { if (S.card && !S.card.contains(e.target) && !e.target.closest('.cz-pop-card, .cz-vw, [data-esc-layer]')) close(); };
192
+ window.addEventListener('keydown', esc, true);
193
+ setTimeout(() => document.addEventListener('pointerdown', outside, true), 0);
194
+ S.off = () => { window.removeEventListener('keydown', esc, true); document.removeEventListener('pointerdown', outside, true); };
195
+ }
@@ -391,7 +391,7 @@ function rowHtml(t, gk, cols = COLS) {
391
391
  jira: `<span class="c-jira">${jira}</span>`, epic: `<span class="c-epic">${epic}</span>`, ini: `<span class="c-ini">${ini}</span>`, who: `<span class="c-who">${whoHtml(t)}</span>`,
392
392
  state: `<span class="c-state bk-s${s.tone ? ' ' + s.tone : ''}${gk === 'take' ? ' tk' : ''}" title="${esc(s.text + (s.note ? ' · ' + s.note : ''))}"><i class="bk-dot ${s.dot}"></i>${s.tone === 'late' && gk === 'take' ? `<em class="lt">${esc(s.text)}</em>` : esc(s.text)}${s.note ? `<em> · ${esc(s.note)}</em>` : ''}</span>`,
393
393
  };
394
- return `<div class="bk-r bk-i${ck ? ' sel' : ''}" role="row" data-bk="${esc(u)}">`
394
+ return `<div class="bk-r bk-i${ck ? ' sel' : ''}" role="row" data-bk="${esc(u)}" data-ask="${t.milestone ? 'milestone' : 'task'}:${esc(t.id)}" data-ask-title="${esc(t.title)}" data-ask-ws="${esc(t.ws)}">`
395
395
  + `<span class="c-ck"><input type="checkbox" class="bk-ck" data-bkck="${esc(u)}" aria-label="Tick ${esc(t.title)}"${ck ? ' checked' : ''}></span>`
396
396
  + `<span class="c-n bk-n">${icon}<button type="button" class="bk-t" data-bkopen="${esc(u)}" title="${esc(t.title)}">${esc(t.title)}</button></span>`
397
397
  + cols.map((c) => cell[c]).join('')
@@ -90,6 +90,14 @@ export const markOf = (type, tone) => `<i class="evp-k ${MARK[type] || 'evp-rd'}
90
90
  export const markHtml = (x) => markOf(typeOf(x), x.tone);
91
91
  const STAR = (w = 14) => svg(ICON.spark, w).replace('class="pm-ic"', 'class="pm-ic pm-star"');
92
92
 
93
+ /** What a right-click on a date row names (initiative ask-anywhere): the milestone, task, initiative end or ticket behind the date. */
94
+ const ASK_OF = { ms: 'milestone', task: 'task', end: 'initiative' };
95
+ function askOf(x) {
96
+ const k = String(x.key || ''), i = k.indexOf(':'), pre = k.slice(0, i), rest = k.slice(i + 1);
97
+ if (pre === 'jira') return ` data-ask="ticket:${esc(rest)}" data-ask-title="${esc(x.title)}"`;
98
+ if (ASK_OF[pre]) { const [ws, , id] = rest.split('|'); if (id) return ` data-ask="${ASK_OF[pre]}:${esc(id)}" data-ask-title="${esc(x.title)}" data-ask-ws="${esc(ws)}"`; }
99
+ return ` data-ask="date:${esc(k)}" data-ask-title="${esc(x.title)}"`;
100
+ }
93
101
  /** The Suggestion part for one date, under its row (Coming up: only where a date is at risk). */
94
102
  function sugLine(x) {
95
103
  const s = x.suggest;
@@ -148,7 +156,7 @@ export function rowHtml(x, o = {}) {
148
156
  const late = x.group === 'late' ? -between(today, x.date) : 0;
149
157
  const badge = late > 0 ? `<span class="pm-badge alert">${late} ${plural(late, 'day', 'days')} late</span>` : ''; // at risk shows as the mark's tone and, where PMOS has a fix, the Suggestion under the row
150
158
  const kindWord = TYPE_WORD[typeOf(x)];
151
- return `<div class="evp-r${o.child ? ' evp-kid' : ''}${x.fixed ? ' fixed' : ''}${o.busy && o.busy.has(x.key) ? ' busy' : ''} pm-li" data-key="${esc(x.key)}" data-kind="${esc(x.kind)}" data-type="${esc(typeOf(x))}" aria-label="${esc(kindWord)}">`
159
+ return `<div class="evp-r${o.child ? ' evp-kid' : ''}${x.fixed ? ' fixed' : ''}${o.busy && o.busy.has(x.key) ? ' busy' : ''} pm-li" data-key="${esc(x.key)}" data-kind="${esc(x.kind)}" data-type="${esc(typeOf(x))}"${askOf(x)} aria-label="${esc(kindWord)}">`
152
160
  + `<span class="evp-d ${x.tone || ''}"><b>${esc(d.b)}</b>${d.s || x.fixed ? `<small>${esc(d.s)}${x.fixed ? (d.s ? ' · ' : '') + 'fixed' : ''}</small>` : ''}</span>${markHtml(x)}${whatHtml(x, o, fixLine)}`
153
161
  + `${badge}${actsHtml(x, o, fixLine)}</div>${srcHtml(x, o)}${x.suggest && !fixLine ? sugLine(x) : ''}`;
154
162
  }
@@ -44,6 +44,7 @@ import { fabLabel, bannerOf } from './cozy-evmodel.js';
44
44
  import { mountToastFaces, loadPrefs } from './cozy-adler.js';
45
45
  import './draft-keep.js'; // forms-keep-drafts: every text box on every page keeps a draft until sent, saved or cleared
46
46
  import { pmPost } from './http.js'; // Adler (batch 16 item 2): every toast carries his S face; Settings > Adler is read once
47
+ import { wire as askHere } from './ask-here-ctx.js'; // ask-anywhere (A528): only the small resolver loads with the page; the card loads on the first press
47
48
  import { startUseLog } from './use-log.js'; // bet A466: every page mounts the menu, so the menu starts the local use log (this computer only)
48
49
  import { startActionKeys } from './action-keys.js'; // bet A477: y o s p z act on the item under the pointer, ? lists the keys
49
50
  import { startGlossary } from './glossary.js'; // bet A386: a product's own words show their meaning on hover (a long press on a phone)
@@ -205,6 +206,7 @@ export function mountNav(here, doc = document, opts = {}) {
205
206
  doc.body.appendChild(w);
206
207
  mountToastFaces(doc); loadPrefs();
207
208
  startUseLog(doc);
209
+ askHere(doc, () => import('./ask-here.js')); // ask-anywhere: a right-click (a phone: a long-press) asks PMOS about what was pressed
208
210
  startActionKeys(doc);
209
211
  startFocusMode(doc);
210
212
  startGlossary(doc);
@@ -18,6 +18,12 @@
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
+
22
+ /** What a right-click on a Today row names (initiative ask-anywhere): its initiative when it has one, else the row itself. */
23
+ function askOf(r) {
24
+ if (r.ini) return ` data-ask="initiative:${esc(r.ini)}" data-ask-title="${esc(r.work || r.ini)}"${r.ws ? ` data-ask-ws="${esc(r.ws)}"` : ''}`;
25
+ return ` data-ask="today item:${esc(r.key)}" data-ask-title="${esc(r.title || r.text || '')}"`;
26
+ }
21
27
  export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
22
28
  const svg = (d, w = 15, sw = 1.9) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
23
29
  /** The system's icon (pm-ic: stroke, size and caps come from the part). */
@@ -87,7 +93,7 @@ export function rowHtml(r, o = {}) {
87
93
  const why = r.member ? '' : whyLine(r);
88
94
  const w = why || did ? `<span class="w td-rs">${did}${esc(why)}</span>` : '';
89
95
  const late = lateOf(r);
90
- const row = `<div class="${cls}" data-key="${esc(r.key)}"><span class="td-kind" role="img" aria-label="${esc(kl)}">${ic(kd)}</span><span class="txt">${title}${w}</span>`
96
+ const row = `<div class="${cls}" data-key="${esc(r.key)}"${askOf(r)}><span class="td-kind" role="img" aria-label="${esc(kl)}">${ic(kd)}</span><span class="txt">${title}${w}</span>`
91
97
  + `${first}${chips}${late ? `<span class="pm-badge alert">${esc(late)}</span>` : ''}${acts ? `<span class="acts td-a">${acts}</span>` : ''}</div>`;
92
98
  const sug = r.drop ? sugHtml('PMOS suggests: drop it from your log.', ['drop', 'Drop it'], ['keep', 'Keep it'], r.key) : '';
93
99
  const lk = r.looks && !r.done ? sugHtml('Looks answered: ' + (r.looks.who ? r.looks.who + ' replied' : 'someone replied') + ' “' + r.looks.text + '”. Close it?', ['lk-yes', 'Yes, close it: it is answered'], ['lk-no', 'No, it still waits on me'], r.key) : '';
@@ -132,7 +138,7 @@ export function overviewHtml(O) {
132
138
  let said = esc(O.said || '');
133
139
  for (const x of O.refs || []) {
134
140
  const t = esc(x.text), at = said.indexOf(t);
135
- if (at >= 0) said = said.slice(0, at) + `<button type="button" class="td-ln" data-td="open" data-key="${esc(x.key)}">${t}</button>` + said.slice(at + t.length);
141
+ if (at >= 0) said = said.slice(0, at) + `<button type="button" class="td-ln" data-td="open" data-key="${esc(x.key)}"${askOf(x)}>${t}</button>` + said.slice(at + t.length);
136
142
  }
137
143
  const sug = (O.suggest || []).map((x) => (x.act === 'sync' ? syncHtml(x) : sugHtml(x.text, ['ov-yes', x.text], ['ov-no', 'Keep them: ' + x.text], x.key, 'td-ovs'))).join('');
138
144
  return `<section class="td-ov pm-block" aria-label="Overview"><h2 class="pm-h-sm pm-row">${ic(I.spark, 16, 'pm-star')}Overview</h2>${said ? `<p>${said}</p>` : ''}${sug}</section>`;
@@ -161,7 +167,7 @@ export function moveRowHtml(r, n, o = {}) {
161
167
  // what the PM typed opens nothing: its words are the whole of it
162
168
  const title = r.src === 'own' ? `<span class="t td-t">${esc(r.title)}</span>`
163
169
  : `<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>`;
164
- return `<div class="td-li pm-li ym-r${n === 1 ? ' now' : ''}" data-key="${esc(r.key)}"><span class="ym-n pm-meta" aria-hidden="true">${n}</span>`
170
+ 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>`
165
171
  + `<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>` : ''}`
166
172
  + `<span class="w td-rs ym-why">${ic(I.spark, 13, 'pm-star')}${esc(r.why || '')}</span></span>${late ? `<span class="pm-badge alert">${esc(late)}</span>` : ''}`
167
173
  + `<span class="acts td-a">${moveAct(r)}${ib('tomorrow', 'Put off a day: ' + r.title, I.tomorrow, r.key)}</span></div>`
@@ -335,7 +341,7 @@ export function phoneRowHtml(r, o = {}) {
335
341
  : fx ? `<span class="tdp-pro">${svg(PI.spark, 13, 1.9)}<span>${esc(fx)}</span></span>` : '';
336
342
  const dot = rowDot(r, o), dl = r.done ? 'Done' : dot === 'alert' ? 'Late' : dot === 'blue' ? 'For today' : 'Can wait';
337
343
  const say = sw.right ? ` aria-describedby="tdpHint"` : '';
338
- return `<li class="tdp-r${r.done ? ' done' : ''}${r.first && !r.done ? ' first' : ''}" data-key="${esc(r.key)}"${sw.right ? ` data-sw-right="${sw.right}"` : ''}${sw.left ? ` data-sw-left="${sw.left}"` : ''}${say}>`
344
+ return `<li class="tdp-r${r.done ? ' done' : ''}${r.first && !r.done ? ' first' : ''}" data-key="${esc(r.key)}"${askOf(r)}${sw.right ? ` data-sw-right="${sw.right}"` : ''}${sw.left ? ` data-sw-left="${sw.left}"` : ''}${say}>`
339
345
  + (r.done ? `<span class="tdp-b" role="img" aria-label="Done">${svg(I.done, 13, 2)}</span>` : `<i class="tdp-dot ${dot}" role="img" aria-label="${dl}"></i>`)
340
346
  + `<div class="tdp-x">${title}${meta ? `<small class="tdp-m">${meta}</small>` : ''}${fix}</div></li>`;
341
347
  }
@@ -350,13 +350,19 @@ function tileHtml(r) {
350
350
  if (r.kind === 'update') return `<span class="hm-tile">${SVG(I.doc, 14)}</span>`;
351
351
  return `<span class="hm-tile">${SVG(ROW_ICON[r.icon] || I.chat, 14)}</span>`;
352
352
  }
353
+ // what a right-click on a Today row names (initiative ask-anywhere): its initiative when it has one, else the row itself
354
+ function askOf(r) {
355
+ const ir = r.ini && r.ini !== 'product' ? iniRowOf(r.ini) : null;
356
+ if (ir) return ` data-ask="initiative:${esc(r.ini)}" data-ask-title="${esc(ir.title || r.ini)}"${r.ws ? ` data-ask-ws="${esc(r.ws)}"` : ''}`;
357
+ return ` data-ask="today item:${esc(r.id)}" data-ask-title="${esc(r.name || '')}"`;
358
+ }
353
359
  function rowHtml(r, o = {}) {
354
360
  const sel = S.sel === r.id;
355
361
  const end = r.kind === 'session' && r.sid ? `<button type="button" class="hm-x" data-hm-end="${esc(r.id)}" aria-label="End ${esc(r.name)}" title="End this session">${SVG(I.x, 14, 2)}</button>`
356
362
  : r.kind === 'need' && r.row ? `<button type="button" class="hm-x" data-hm-end="${esc(r.id)}" aria-label="Put off ${esc(r.name)} until tomorrow" title="Put off until tomorrow">${SVG(I.x, 14, 2)}</button>` : '';
357
363
  const chip = r.chip ? `<button type="button" class="hm-kc${r.chip.loud ? ' loud' : ''}" data-hm-kids="${esc(r.id)}" aria-expanded="${S.kids.has(r.id)}" aria-label="${esc(r.chip.text)} in ${esc(r.name)}. Show">${esc(r.chip.text)}${SVG(S.kids.has(r.id) ? I.down : I.chev, 12, 2.2)}</button>` : '';
358
364
  const kids = r.kids && S.kids.has(r.id) ? `<div class="hm-kids" role="group" aria-label="In ${esc(r.name)}">${r.kids.map((k) => rowHtml(k, { kid: true })).join('') || '<p class="hm-none">Nothing here now.</p>'}</div>` : '';
359
- return `<div class="hm-r${sel ? ' sel' : ''}${o.kid ? ' kid' : ''} st-${esc(r.state)}" data-id="${esc(r.id)}">`
365
+ return `<div class="hm-r${sel ? ' sel' : ''}${o.kid ? ' kid' : ''} st-${esc(r.state)}" data-id="${esc(r.id)}"${askOf(r)}>`
360
366
  + `<button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}"${sel ? ' aria-current="true"' : ''}><i class="hm-dot ${dotCls(r.state)}" aria-hidden="true"></i>${tileHtml(r)}`
361
367
  + `<span class="hm-rt"><b>${r.kind === 'ini' ? SM.nameHtml(r.board, r.name) : esc(r.name)}</b><em>${esc(r.hint || '')}</em></span></button>${chip}${end}</div>${kids}`;
362
368
  }
@@ -39,6 +39,8 @@ const ICON = {
39
39
  proto: 'M4 5h16v12H4zM9 20h6',
40
40
  checks: 'M4 6.5l2 2 3.5-3.5M4 13.5l2 2 3.5-3.5M13 7h7M13 14h7M13 19h7',
41
41
  };
42
+ // what a right-click on a row names (initiative ask-anywhere): the item, in plain words
43
+ const ASK_KIND = { meeting: 'meeting note', link: 'link', proto: 'prototype', checks: 'checklist' };
42
44
  const PEN = 'M4 20h4L18.5 9.5a2.1 2.1 0 0 0-3-3L5 17zM13.5 6.5l3 3', CLEAR = 'M4 6h16M7 12h10M10 18h4', RELOAD = 'M20 12a8 8 0 1 1-2.3-5.7M20 4v5h-5';
43
45
  const CHEV_D = 'M6 9l6 6 6-6', CHEV_R = 'M9 6l6 6-6 6', TICK = 'M5 12.5l4.5 4.5L19 7.5', X = 'M6 6l12 12M18 6L6 18', PART = 'M7 12h10';
44
46
  const SPARK = 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z', OPEN = 'M14 4h6v6M20 4l-9 9M18 14v5H5V6h5';
@@ -219,7 +221,7 @@ function rowHtml(r, i, sub = false, shelf = '') {
219
221
  if (!aboutText(x) && x.kind === 'meeting' && x.suggest) {
220
222
  why += ` · <button type="button" class="lb-sg" data-lb-link="${esc(x.id)}" title="PMOS suggests: this note is about ${esc(x.suggest.title)}. Press to link it">${svg(SPARK, 'pm-star')}<span>${esc(x.suggest.title)}?</span></button>`;
221
223
  }
222
- return `<div class="pm-li lb-i${sub ? ' nest' : ''}${S.pick === x.id ? ' now' : ''}" role="listitem" data-lb-i="${i}" aria-label="${esc(label)}">`
224
+ return `<div class="pm-li lb-i${sub ? ' nest' : ''}${S.pick === x.id ? ' now' : ''}" role="listitem" data-lb-i="${i}" data-ask="${ASK_KIND[x.kind] || 'document'}:${esc(x.path || x.id)}" data-ask-title="${esc(x.name)}" aria-label="${esc(label)}">`
223
225
  + `<span class="pm-meta lb-mi">${svg(ICON[x.kind] || ICON.doc)}</span>`
224
226
  + `<span class="txt">${nameHtml(shown, older)}<span class="w">${why}</span></span>${badge(r)}${actsHtml(x)}</div>`;
225
227
  }
@@ -327,7 +327,7 @@ function makePage(d, ctx) {
327
327
  if (!el || !el.isConnected) return;
328
328
  const keepScroll = el.scrollTop;
329
329
  const reading = P.mode === 'read' && !ctx.host && P.text != null && !P.err && !openProp();
330
- el.innerHTML = `<div class="vwdoc${reading ? ' rdw pm-reads' : ''}">${pageHtml()}</div>`;
330
+ el.innerHTML = `<div class="vwdoc${reading ? ' rdw pm-reads' : ''}" data-ask="document:${esc(d.path)}" data-ask-title="${esc(d.title || String(d.path).split('/').pop())}"${baseWs() ? ` data-ask-ws="${esc(baseWs())}"` : ''}>${pageHtml()}</div>`;
331
331
  el.scrollTop = keepScroll;
332
332
  if (reading) wireReading(el, el, d.path); else if (P.mode === 'read') tocOf();
333
333
  if (P.mode === 'edit') startEdit();
@@ -41,10 +41,12 @@ function chartSvg(e) {
41
41
  if (e.kind === 'line') {
42
42
  const P = d.map((x, i) => [bw * i + bw / 2, Y(+x[1] || 0)]);
43
43
  g += `<polyline class="sl-line" points="${P.map((p) => p.join(',')).join(' ')}"/>` + P.map((p, i) => `<circle class="sl-pt" cx="${p[0]}" cy="${p[1]}" r="8"/>${lab(p[0], p[1] - 16, d[i][1])}`).join('');
44
- } else g += d.map((x, i) => { const y = Y(+x[1] || 0); return `<rect class="sl-bar${i === d.length - 1 ? ' last' : ''}" x="${bw * i + bw * 0.17}" y="${y}" width="${bw * 0.66}" height="${Math.max(0, h - B - y)}" rx="6"/>${lab(bw * i + bw / 2, y - 10, x[1])}`; }).join('');
44
+ } else g += d.map((x, i) => { const y = Y(+x[1] || 0); return `<rect class="sl-bar${i === d.length - 1 ? ' last' : ''}" data-ask-field="Chart bar" aria-label="${esc(x[0] + ' · ' + x[1])}" x="${bw * i + bw * 0.17}" y="${y}" width="${bw * 0.66}" height="${Math.max(0, h - B - y)}" rx="6"/>${lab(bw * i + bw / 2, y - 10, x[1])}`; }).join('');
45
45
  g += d.map((x, i) => `<text class="sl-axl" x="${bw * i + bw / 2}" y="${h - 8}" text-anchor="middle">${esc(x[0])}</text>`).join('');
46
46
  return `<svg viewBox="0 0 ${w} ${h}" role="img" aria-label="${esc((e.kind === 'line' ? 'Line' : 'Bar') + ' chart: ' + d.map((x) => x[0] + ' ' + x[1]).join(', '))}">${g}</svg>`;
47
47
  }
48
+ // what a right-click on a part of a slide names (initiative ask-anywhere)
49
+ const PART = { title: 'Title', text: 'Text', chart: 'Chart', table: 'Table', img: 'Image' };
48
50
  function elHtml(e, ws, edit) {
49
51
  const inner = e.t === 'text' ? `<div class="sl-tx">${e.html}</div>`
50
52
  : e.t === 'chart' ? chartSvg(e)
@@ -52,7 +54,7 @@ function elHtml(e, ws, edit) {
52
54
  : e.t === 'img' ? (e.src ? `<img src="${esc(asset(ws, e.src))}" alt="${esc(e.alt || '')}" data-src="${esc(e.src)}">` : `<div class="sl-ph">${I('img')}<span>${edit ? 'Double-click to choose an image' : 'No image'}</span></div>`)
53
55
  : `<div class="sl-sh f-${e.fill || 'acc'}${e.round ? ' dot' : ''}"></div>`;
54
56
  const cls = `sl-it t-${e.t}${e.role ? ' r-' + e.role : ''}${e.align && e.align !== 'left' ? ' a-' + e.align : ''}${e.color ? ' c-' + e.color : ''}`;
55
- return `<div class="${cls}" data-id="${e.id || ''}" data-g="${e.x},${e.y},${e.w},${e.h}">${inner}${edit ? ['nw', 'ne', 'sw', 'se'].map((h) => `<i class="sl-hdot h-${h}" data-h="${h}"></i>`).join('') : ''}</div>`;
57
+ return `<div class="${cls}" data-id="${e.id || ''}" data-ask-field="${PART[e.t === 'text' && e.k === 'title' ? 'title' : e.t] || 'Shape'}" data-g="${e.x},${e.y},${e.w},${e.h}">${inner}${edit ? ['nw', 'ne', 'sw', 'se'].map((h) => `<i class="sl-hdot h-${h}" data-h="${h}"></i>`).join('') : ''}</div>`;
56
58
  }
57
59
  export function slideHtml(s, theme, ws, edit) {
58
60
  return `<div class="sl-cv${edit ? ' ed' : ''}" data-th="${esc(theme)}">${s.els.map((e) => elHtml(e, ws, edit)).join('')}${edit ? '<i class="sl-guide gv"></i><i class="sl-guide gh"></i>' : ''}</div>`;
@@ -273,6 +275,9 @@ const railName = (s, k) => { const t = s.els.find((e) => e.t === 'text' && e.k =
273
275
  function drawStage(S) {
274
276
  const st = S.$('.sl-stage');
275
277
  st.innerHTML = slideHtml(cur(S), S.deck.theme, S.ws, !S.ro);
278
+ // the slide is the record a right-click names (initiative ask-anywhere): the deck's path and the slide's number
279
+ st.dataset.ask = 'slide:' + S.path + '#' + (S.i + 1); st.dataset.askTitle = String(S.path).split('/').pop() + ' · slide ' + (S.i + 1);
280
+ if (S.ws) st.dataset.askWs = S.ws;
276
281
  fit(st); place(st);
277
282
  if (S.sel) { const n = node(S, S.sel); if (n) n.classList.add('sel'); else S.sel = null; }
278
283
  }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Ask PMOS about anything you click (initiative ask-anywhere, A528, done test planning/done-tests/ask-anywhere.md R1-R3): pm/ask-here-ctx.js names the pressed record, field and value on a fake tree, steps out with ↑, and hands page-chat.js itemTarget the facts. No server, network or browser.",
3
+ "modules": [
4
+ "ask-here.test.js"
5
+ ],
6
+ "seconds": {
7
+ "ask-here.test.js": 1
8
+ }
9
+ }