create-pmos 0.587.0 → 0.588.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.587.0",
3
+ "version": "0.588.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,19 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.588.0",
38
+ "at": "2026-11-17T10:44:25.596Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1324,
43
+ "t": "Share a meeting note with people who have no PMOS",
44
+ "s": "Share a meeting note with people who have no PMOS",
45
+ "k": "new"
46
+ }
47
+ ]
48
+ },
36
49
  {
37
50
  "v": "0.587.0",
38
51
  "at": "2026-11-17T10:24:56.955Z",
@@ -285,19 +298,6 @@
285
298
  "k": "new"
286
299
  }
287
300
  ]
288
- },
289
- {
290
- "v": "0.568.0",
291
- "at": "2026-11-12T05:06:58.936Z",
292
- "f": 4,
293
- "prs": [
294
- {
295
- "n": 1300,
296
- "t": "Project and Full SDLC get their own workflows and gates (launch simulation W5)",
297
- "s": "Project and Full SDLC get their own workflows and gates (launch simulation W5)",
298
- "k": "new"
299
- }
300
- ]
301
301
  }
302
302
  ]
303
303
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@8b05fc39
1
+ kernel-source: pmos@5646a9fa
2
2
  assembled: 2026-11-17
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-17T10:24:53Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-17T10:44:21Z"}
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-17T10:24:53Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-17T10:44:21Z"}
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-17T10:24:53Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-17T10:44:21Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,17 @@
1
1
  [
2
+ {
3
+ "v": "0.588.0",
4
+ "at": "2026-11-17T10:44:25.596Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1324,
9
+ "t": "Share a meeting note with people who have no PMOS",
10
+ "s": "Share a meeting note with people who have no PMOS",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
2
15
  {
3
16
  "v": "0.587.0",
4
17
  "at": "2026-11-17T10:24:56.955Z",
@@ -391,6 +391,20 @@ To take notes for a calendar event, open the meeting from Your day or the calend
391
391
  - **Summary by agent** starts an agent session in the selected repository that writes a summary into the note. Lines that look like a secret are removed first.
392
392
  - **Delete note** in the **⋯** menu removes the note, its transcript, its summaries and its audio from this machine after you confirm. The note's summary goes from the calendar and the initiative. You cannot undo it. Deleting a note that is not being taken does not stop the one that is.
393
393
 
394
+ ## Share a meeting note
395
+
396
+ You can share a meeting note with people who do not use PMOS. They get a read-only page. Nothing is sent for you.
397
+
398
+ 1. Open a meeting that has notes. Press the share icon, next to **⋯**.
399
+ 2. Under **What goes out**, PMOS turns on Summary, Decisions, Next steps and Questions. Facts mentioned and Since the last one stay off. Press a chip to change it. The transcript, the recording and the screen shots never go out.
400
+ 3. The **✦** row tells you what PMOS kept back. Press it to see the list:
401
+ - **Stays inside**: your own to-dos and rules, and lines about a team or a person who was not in the meeting. Press the eye on a line to let it go out.
402
+ - **Taken out of the lines that go**: the link to the initiative, ticket keys, who said what, call links and email addresses. Press a chip to leave that detail in.
403
+ 4. These choices change only the shared copy. Your own note stays the same. Set the password (on by default) and when the link ends (1, 7 or 30 days). Then press the link icon. The link is a copy of the note as it is now.
404
+ 5. Under **Follow-up**, the mail icon opens a draft in your mail app. The draft has a subject, the parts that go out and the link. The copy icon puts the draft on the clipboard. Send the password in a different message.
405
+
406
+ Guests see the title, the date, first names, and the parts you chose. The page has a download icon and says PMOS. **Open links** lists each link with its views. **Turn off** deletes the copy at once. Share links use your Online hostname, so set up Online in Settings first. A private note cannot be shared.
407
+
394
408
  ## What stays on your machine
395
409
 
396
410
  - Audio never leaves this machine. The page sends it to the workspace on this machine, which gives it to whisper.cpp in a temporary file and deletes that file at once. For replay, the workspace keeps one recording of each note in `notes/recordings/` in the state folder, with a cleaned copy beside it when you use **Clean up the replay sound**, until you delete the audio, the note, or mark the note private. The cleaned copy is made by ffmpeg on this machine, and nothing is sent anywhere. The browser's own recognition is used only on the device, never in the cloud.
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+ /* meeting-guest-page.js — the read-only page a guest sees for a shared meeting note (initiative shareable-meeting-notes, design "Guest page" on
3
+ * Exploring 2). The copy comes from public/pm/meeting-share.js applyCut; this file only draws it. The share server serves the page as it is,
4
+ * with no other file and a CSP that allows no script, so the cozy colours are written here, light and dark, from the cozy tokens.
5
+ * guestPage(copy, { by, ends }) → the page. FILE_TOKEN stands for the Download address; share-server.js puts the link's own in its place. */
6
+ const FILE_TOKEN = '__PMOS_FILE__';
7
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
8
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
9
+ const dayOf = (iso) => { const t = new Date(iso); return Number.isFinite(t.getTime()) ? t.getDate() + ' ' + MON[t.getMonth()] : ''; };
10
+ const andList = (xs) => (xs.length <= 1 ? xs.join('') : xs.slice(0, -1).join(', ') + ' and ' + xs[xs.length - 1]);
11
+ const stepMeta = (s) => [s.owner, s.due && /^\d{4}-\d{2}-\d{2}$/.test(s.due) ? dayOf(s.due + 'T12:00:00') : s.due].filter(Boolean).join(' · ');
12
+
13
+ const I_CAL = '<svg viewBox="0 0 24 24" aria-hidden="true"><rect x="4" y="5" width="16" height="15" rx="2"/><path d="M8 3v4M16 3v4M4 10h16"/></svg>';
14
+ const I_DL = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4v11M7 10l5 5 5-5M5 20h14"/></svg>';
15
+ /* the cozy tokens (cozy-tokens.css), light and dark, inline: the share server serves the page with no other file */
16
+ const GUEST_CSS = `:root{--ground:#fbfaf7;--card:#fff;--well:#f5f3ee;--ink:#22201c;--ink-2:#4a463f;--ink-3:#6f6a61;--hair:#e9e5dc;--ok:#3e6e4e;--q:#a6461a;--tile:#eef2fb;--tile-ink:#2f5aa8;
17
+ --sans:"Plus Jakarta Sans",ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;--mono:ui-monospace,"SF Mono",Menlo,monospace}
18
+ @media (prefers-color-scheme:dark){:root{--ground:#1b1a17;--card:#23221f;--well:#2b2925;--ink:#efece6;--ink-2:#d2cec5;--ink-3:#a7a197;--hair:#38352f;--ok:#7fb58f;--q:#e49a72;--tile:#26304a;--tile-ink:#a9c0ee}}
19
+ *{box-sizing:border-box}html{-webkit-text-size-adjust:100%}body{margin:0;background:var(--ground);color:var(--ink);font:400 16px/1.5 var(--sans)}
20
+ main{max-width:920px;margin:24px auto;padding:20px 24px 16px;background:var(--card);border-radius:22px;box-shadow:0 1px 2px rgba(30,25,15,.04),0 12px 40px rgba(30,25,15,.06)}
21
+ header{display:flex;align-items:center;gap:12px;min-height:44px}h1{flex:1;margin:0;font-size:17px;font-weight:600;line-height:1.3}
22
+ .tile{width:34px;height:34px;flex:none;border-radius:10px;background:var(--tile);color:var(--tile-ink);display:grid;place-items:center}
23
+ svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
24
+ .dl{width:44px;height:44px;border-radius:12px;display:grid;place-items:center;color:var(--ink-2);text-decoration:none}.dl:hover{background:var(--well)}.dl:focus-visible{outline:2px solid var(--tile-ink);outline-offset:2px}
25
+ .body{padding:8px 0 0 46px}.meta{margin:0 0 18px;color:var(--ink-3);font-size:13px}
26
+ .sum{margin:0 0 24px;padding:14px 16px;background:var(--well);border-radius:16px;font-size:16px;line-height:1.55}
27
+ h2{margin:22px 0 8px;font:400 12px/1.4 var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--ink-3)}
28
+ ul{list-style:none;margin:0;padding:0}li{display:flex;gap:14px;padding:10px 0;border-top:1px solid var(--hair)}li:first-child{border-top:0}
29
+ .mk{width:20px;flex:none;display:grid;place-items:start center;padding-top:6px}.dot{width:9px;height:9px;border-radius:50%;background:var(--ok)}
30
+ .box{width:11px;height:11px;border:1.5px solid var(--ink-2);border-radius:2px}.qm{font:700 11px/1 var(--sans);color:var(--q);padding-top:3px}
31
+ li p{margin:0}li small{display:block;margin-top:2px;color:var(--ink-3);font-size:13px}.tag{color:var(--ink-3);font-size:13px}
32
+ footer{display:flex;align-items:center;gap:16px;margin:28px 0 0;padding:14px 0 4px 46px;border-top:1px solid var(--hair);color:var(--ink-3);font-size:13px}footer span{flex:1}footer b{font-weight:700;color:var(--ink-2);letter-spacing:.02em}
33
+ @media (max-width:640px){main{margin:0;border-radius:0;box-shadow:none;padding:14px 16px 12px;min-height:100vh}.body,footer{padding-left:0}.sum{font-size:15px}}`;
34
+
35
+ /** The read-only page a guest sees: the title, when and who, the summary, then each section that goes. No script, no outside file. Pure. */
36
+ function guestPage(c, { by = '', ends = '' } = {}) {
37
+ const meta = [c.when, c.people.length ? andList(c.people) : ''].filter(Boolean).join(' · ');
38
+ const list = (head, items, mark, sub) => (items.length ? `<h2>${esc(head)}</h2><ul>${items.map((x) => `<li><span class="mk">${mark(x)}</span><span><p>${esc(x.text)}</p>${sub(x) ? `<small>${esc(sub(x))}</small>` : ''}</span></li>`).join('')}</ul>` : '');
39
+ const foot = [by ? 'A read-only copy shared by ' + by + '.' : 'A read-only copy.', ends ? 'The link ends ' + dayOf(ends) + '.' : ''].filter(Boolean).join(' ');
40
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex">`
41
+ + `<title>${esc(c.title)}</title><style>${GUEST_CSS}</style></head><body><main>`
42
+ + `<header><span class="tile">${I_CAL}</span><h1>${esc(c.title)}</h1><a class="dl" href="${FILE_TOKEN}" download aria-label="Download the notes" title="Download">${I_DL}</a></header>`
43
+ + `<div class="body">${meta ? `<p class="meta">${esc(meta)}</p>` : ''}${c.summary ? `<p class="sum">${esc(c.summary)}</p>` : ''}`
44
+ + list('Decided', c.decisions, () => '<span class="dot"></span>', (x) => x.why)
45
+ + list('Next steps', c.steps, () => '<span class="box"></span>', stepMeta)
46
+ + list('Still open', c.questions, () => '<span class="qm">?</span>', () => '')
47
+ + list('Facts mentioned', c.facts, () => '<span class="dot"></span>', () => '')
48
+ + list('Since the last one', c.since, () => '<span class="box"></span>', (x) => [x.tag, x.owner].filter(Boolean).join(' · '))
49
+ + `</div><footer><span>${esc(foot)}</span><b>PMOS</b></footer></main></body></html>`;
50
+ }
51
+
52
+
53
+ module.exports = { guestPage, FILE_TOKEN };
@@ -5,7 +5,8 @@
5
5
  * THE FOLDER. `<runtime state>/shares/<id>/`, in the per-user runtime directory outside every repository, mode 0700:
6
6
  * meta.json { id, name, kind, made, ends, pw: 'scrypt$<salt>$<hash>' | null, key, views, last, fails, lockedUntil } mode 0600
7
7
  * page.html the copy as a page: an .html file as it is, markdown rendered by the caller, other text in a <pre> mode 0600
8
- * file the file's own text, for the guest's Download mode 0600
8
+ * kind 'meeting' (shareable-meeting-notes): the guest page public/pm/meeting-share.js made from the PM's cut, no script
9
+ * file the file's own text, for the guest's Download; a meeting's shared parts as Markdown mode 0600
9
10
  * id is 128 random bits (base64url, 22 characters). `key` is a random secret per link that signs the guest's cookie. No IP address,
10
11
  * header or user agent is stored (D08): a view is a count and a time.
11
12
  *
@@ -67,7 +68,7 @@ function newPassword() {
67
68
  function create(dir, o = {}) {
68
69
  const days = Number(o.days);
69
70
  if (!DAYS.includes(days)) return { ok: false, error: 'days must be 1, 7 or 30' };
70
- if (!['html', 'markdown', 'text'].includes(o.kind)) return { ok: false, error: 'kind must be html, markdown or text' };
71
+ if (!['html', 'markdown', 'text', 'meeting'].includes(o.kind)) return { ok: false, error: 'kind must be html, markdown, text or meeting' };
71
72
  if (typeof o.page !== 'string' || typeof o.file !== 'string') return { ok: false, error: 'there is nothing to share' };
72
73
  if (o.password != null) {
73
74
  const p = String(o.password);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.587.0",
3
+ "version": "0.588.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.587.0",
9
+ "version": "0.588.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.587.0",
3
+ "version": "0.588.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,192 @@
1
+ /* pm/meeting-share.js — a meeting note shared with people who have no PMOS (initiative shareable-meeting-notes, batch 31 item 1, design A plus the
2
+ * follow-up draft on Exploring 2 "Shareable meeting notes"). Pure: the page's share popover and the workspace server's POST /api/shares both use it,
3
+ * so the cut the PM approves in the popover is the cut the server writes.
4
+ *
5
+ * THE CUT. PMOS proposes it and the PM only approves:
6
+ * sections Summary, Decisions, Next steps and Questions go out; Facts mentioned and Since the last one stay in. Each is a chip.
7
+ * never the transcript, the recording and the screen shots. They are not in the list, there is no switch, and nothing here reads them.
8
+ * inside lines PMOS keeps inside: the PM's own to-dos and rules ("goes to you before release"), and lines about a team or a person who was
9
+ * not in the meeting ("Tell Communicator about the release"). PMOS's read of each line, listed with its reason; an eye puts it back.
10
+ * out details taken out of the lines that go: the link to the initiative, ticket keys, who said what, calendar and call links, email
11
+ * addresses. Listed only when the note holds one; a press puts that kind back.
12
+ * cut = { on: ['summary', …], back: ['in:<line id>', 'out:<kind>', …] } line ids: d<i> decisions, s<i> next steps, q<i> questions,
13
+ * f<i> facts, n<i> since the last one, o the summary.
14
+ *
15
+ * factsOf(note) → the facts mentioned (premium-vw-mtg.js shows the same list)
16
+ * proposeCut({ sheet, facts, pm, people }) → { sections, inside, out } sheet: premium-vw-meet.js noteSheet
17
+ * applyCut(proposal, cut, { sheet, facts, people, pm }) → the guest's copy: { title, when, people, summary, decisions, steps, questions, facts, since }
18
+ * (the guest page itself is lib/meeting-guest-page.js: a standalone page with its own colours, made on the server only)
19
+ * guestMarkdown(copy, { by, ends }) → the same copy as Markdown, the guest's Download
20
+ * followUp(copy, { url, by }) → { subject, body, mailto }: a draft for the PM's own mail app. PMOS sends nothing. */
21
+
22
+ export const SECTIONS = [
23
+ { k: 'summary', label: 'Summary', on: true },
24
+ { k: 'decisions', label: 'Decisions', on: true },
25
+ { k: 'steps', label: 'Next steps', on: true },
26
+ { k: 'questions', label: 'Questions', on: true },
27
+ { k: 'facts', label: 'Facts mentioned', on: false },
28
+ { k: 'since', label: 'Since the last one', on: false },
29
+ ];
30
+ export const NEVER_LINE = 'Transcript, recording and screens stay inside.';
31
+ export const OUT_LABEL = { ini: 'Link to the initiative', ticket: 'Ticket keys', who: 'Who said what', call: 'Calendar and call links', mail: 'Email addresses' };
32
+
33
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
34
+ const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
35
+ const low = (s) => String(s || '').toLowerCase();
36
+ /** "Ana Putri" → "Ana"; an email address → its name part, capitalised; '' for nothing. */
37
+ export function firstName(s) {
38
+ let t = String(s || '').trim();
39
+ if (!t) return '';
40
+ if (/@/.test(t)) t = t.split('@')[0].split(/[._+-]/)[0];
41
+ t = t.split(/\s+/)[0].replace(/[^\p{L}\p{N}'-]/gu, '');
42
+ return t ? t[0].toUpperCase() + t.slice(1) : '';
43
+ }
44
+ const isPm = (name, pm) => { const f = low(firstName(name)); return !!f && (f === 'you' || f === 'me' || (!!pm && f === low(firstName(pm)))); };
45
+
46
+ /** The facts mentioned: statements with a number, or checked against a document. */
47
+ export function factsOf(n) {
48
+ if (!n || n.private) return [];
49
+ return (n.transcript || []).filter((x) => x && x.text && !x.dropped && x.cat === 'statement' && (/\d|\b(?:percent|half|double|twice)\b/i.test(x.text) || (x.check && x.check.doc)))
50
+ .map((x) => { const v = x.check && x.check.verdict; return { text: clip(x.text, 240), src: (x.check && x.check.doc) || '', tag: v === 'agrees' ? 'Matches' : v === 'differs' ? 'Differs' : 'Not checked', k: v === 'agrees' ? 'ok' : v === 'differs' ? 'warn' : '' }; });
51
+ }
52
+
53
+ /* ── the details taken out of the lines that go ── */
54
+ const TICKET_RX = /\s*(?:→\s*)?\(?\b[A-Z][A-Z0-9]{1,9}-\d{1,6}\b\)?/g;
55
+ const CALL_RX = /\s*\(?\bhttps?:\/\/(?:[a-z0-9-]+\.)*(?:meet\.google\.com|zoom\.us|teams\.microsoft\.com|teams\.live\.com|webex\.com|calendar\.google\.com|outlook\.office\.com|outlook\.live\.com|whereby\.com|around\.co)\S*\)?/gi;
56
+ const MAIL_RX = /\s*\(?\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b\)?/g;
57
+ const SAID = '(?:said|says|asked|asks|mentioned|suggested|proposed|noted|argued|thinks|thought|wants|wanted|pushed back|agreed|raised)';
58
+ const whoRx = (names) => (names.length ? new RegExp('\\b(?:' + names.map((x) => x.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|') + ')\\s+' + SAID + '\\b', 'g') : null);
59
+ const has = (rx, t) => { rx.lastIndex = 0; const y = rx.test(t); rx.lastIndex = 0; return y; };
60
+ const tidy = (t) => String(t).replace(/\b(?:call|join|meeting link|link)\s*:\s*$/gim, '').replace(/\s{2,}/g, ' ').replace(/\s+([,.;:!?])/g, '$1').replace(/\(\s*\)/g, '').trim();
61
+
62
+ /** Who was in the meeting, by first name, without the PM. */
63
+ const namesOf = (people, pm) => [...new Set((people || []).map(firstName).filter(Boolean))].filter((x) => !isPm(x, pm));
64
+
65
+ /* ── the lines PMOS keeps inside ── */
66
+ const AT_PM = /\b(?:to|by|with|from|for|ask|asks|tell|tells|ping|pings)\s+you\b|\byour\s+(?:own\s+)?(?:approval|call|sign-?off|review|ok|okay|decision)\b|\bgoes?\s+to\s+you\b|\byou\s+(?:approve|decide|sign\s+off|review)\b/i;
67
+ const either = (w) => '[' + w[0].toUpperCase() + w[0] + ']' + w.slice(1);
68
+ const TELL = new RegExp('\\b(?:' + ['tell', 'inform', 'update', 'ping', 'loop in', 'let', 'ask', 'email', 'message', 'brief', 'warn', 'notify', 'escalate to'].map(either).join('|')
69
+ + ')\\s+(?:the\\s+)?([A-Z][\\p{L}0-9&-]*(?:\\s+[A-Z][\\p{L}0-9&-]*)?)', 'u');
70
+ const TEAM = /\b(?:the\s+)?([A-Z][\p{L}0-9&-]*)\s+(?:team|squad|group|department|dept)\b/u;
71
+ /** PMOS's read of one line: why it stays inside, or '' when it can go. */
72
+ function insideWhy(line, { pm, names }) {
73
+ const why = [];
74
+ if (line.owner && isPm(line.owner, pm)) why.push('Your own to-do');
75
+ else if (AT_PM.test(line.text) || (pm && new RegExp('\\b(?:to|by|with|for)\\s+' + firstName(pm) + '\\b', 'i').test(line.text))) why.push('Your own approval rule');
76
+ const known = new Set(names.map(low));
77
+ const t = TELL.exec(line.text) || TEAM.exec(line.text);
78
+ if (t) {
79
+ const who = t[1].split(/\s+/)[0];
80
+ if (!known.has(low(who)) && !isPm(who, pm) && !/^(?:Them|The|Everyone|All|Us)$/i.test(who)) why.push(why.length ? 'about another team' : 'About another team');
81
+ }
82
+ return why.join(', ');
83
+ }
84
+
85
+ /** Every line that could go, with its id, its section and its owner. */
86
+ function linesOf(sheet, facts) {
87
+ const S = sheet || {};
88
+ const out = [];
89
+ (S.decisions || []).forEach((d, i) => out.push({ id: 'd' + i, sec: 'decisions', text: d.text, why: d.why || '' }));
90
+ (S.actions || []).forEach((a, i) => out.push({ id: 's' + i, sec: 'steps', text: a.text, owner: a.owner || '', due: a.due || '' }));
91
+ (S.questions || []).forEach((q, i) => out.push({ id: 'q' + i, sec: 'questions', text: q.text }));
92
+ (facts || []).forEach((f, i) => out.push({ id: 'f' + i, sec: 'facts', text: f.text }));
93
+ const since = S.since ? [...(S.since.items || []).map((x) => ({ ...x, tag: x.state === 'done' ? 'Done' : x.state === 'again' || x.state === 'raised' ? 'Raised again' : 'Not mentioned' })), ...(S.since.fresh || []).map((x) => ({ ...x, tag: 'New' }))] : [];
94
+ since.forEach((x, i) => out.push({ id: 'n' + i, sec: 'since', text: x.text, owner: x.owner || '', tag: x.tag }));
95
+ return out;
96
+ }
97
+
98
+ /** What PMOS proposes for a note. Pure. */
99
+ export function proposeCut({ sheet, facts = [], pm = '', people = [] } = {}) {
100
+ const S = sheet || {};
101
+ const names = namesOf(people, pm);
102
+ const lines = linesOf(S, facts);
103
+ const count = { summary: S.overview ? 1 : 0 };
104
+ for (const l of lines) count[l.sec] = (count[l.sec] || 0) + 1;
105
+ const sections = SECTIONS.map((s) => ({ k: s.k, label: s.label, n: s.k === 'summary' ? 0 : count[s.k] || 0, on: s.on, has: s.k === 'summary' ? !!S.overview : (count[s.k] || 0) > 0 })).filter((s) => s.has);
106
+ const inside = lines.map((l) => ({ id: l.id, sec: l.sec, text: l.text, why: insideWhy(l, { pm, names }) })).filter((l) => l.why);
107
+ // the details, over everything that could go
108
+ const all = [S.overview || '', ...lines.map((l) => l.text + ' ' + (l.why || ''))].join('\n');
109
+ const out = [];
110
+ if (S.initiative || S.about) out.push({ k: 'ini', label: S.initiative && S.initiative.name ? 'Link to the ' + clip(S.initiative.name, 40) + ' initiative' : OUT_LABEL.ini });
111
+ const tk = all.match(TICKET_RX);
112
+ if (tk) out.push({ k: 'ticket', label: 'Ticket keys, like ' + tk[0].replace(/[\s→()]/g, '') });
113
+ const wr = whoRx([...names, ...(pm ? [firstName(pm)] : [])]);
114
+ if (wr && has(wr, all)) out.push({ k: 'who', label: OUT_LABEL.who });
115
+ if (has(CALL_RX, all)) out.push({ k: 'call', label: OUT_LABEL.call });
116
+ if (has(MAIL_RX, all)) out.push({ k: 'mail', label: OUT_LABEL.mail });
117
+ return { sections, inside, out };
118
+ }
119
+
120
+ /** The proposal's cut as the popover starts it: the default sections, nothing put back. */
121
+ export const defaultCut = (prop) => ({ on: (prop && prop.sections ? prop.sections : []).filter((s) => s.on).map((s) => s.k), back: [] });
122
+
123
+ /** The guest's copy: only the sections that are on, without the lines kept inside (unless put back), with the details taken out. Pure. */
124
+ export function applyCut(prop, cut, { sheet, facts = [], people = [], pm = '' } = {}) {
125
+ const S = sheet || {};
126
+ const on = new Set(((cut && cut.on) || []).filter((k) => SECTIONS.some((s) => s.k === k)));
127
+ const back = new Set((cut && cut.back) || []);
128
+ const kept = new Set((prop.inside || []).filter((l) => !back.has('in:' + l.id)).map((l) => l.id));
129
+ const outK = new Set((prop.out || []).map((o) => o.k).filter((k) => !back.has('out:' + k)));
130
+ const names = namesOf(people, pm);
131
+ const wr = outK.has('who') ? whoRx([...names, ...(pm ? [firstName(pm)] : [])]) : null;
132
+ const clean = (t) => {
133
+ let s = String(t || '');
134
+ if (outK.has('ticket')) s = s.replace(TICKET_RX, '');
135
+ if (outK.has('call')) s = s.replace(CALL_RX, '');
136
+ if (outK.has('mail')) s = s.replace(MAIL_RX, '');
137
+ if (wr) s = s.replace(wr, (m) => 'Someone ' + m.replace(/^\S+\s+/, ''));
138
+ return tidy(s);
139
+ };
140
+ const lines = linesOf(S, facts).filter((l) => on.has(l.sec) && !kept.has(l.id));
141
+ const pick = (sec) => lines.filter((l) => l.sec === sec);
142
+ const who = [...new Set((people || []).map(firstName).filter(Boolean))];
143
+ return {
144
+ title: clean(S.event && S.event.title ? S.event.title : S.title || 'Meeting notes'),
145
+ when: [S.event && S.event.when ? S.event.when : S.day || '', S.minutes ? S.minutes + ' min' : ''].filter(Boolean).join(' · '),
146
+ people: who,
147
+ about: outK.has('ini') ? '' : S.about || '',
148
+ summary: on.has('summary') && !kept.has('o') ? clean(S.overview || '') : '',
149
+ decisions: pick('decisions').map((l) => ({ text: clean(l.text), why: clean(l.why) })).filter((x) => x.text),
150
+ steps: pick('steps').map((l) => ({ text: clean(l.text), owner: firstName(l.owner), due: l.due || '' })).filter((x) => x.text),
151
+ questions: pick('questions').map((l) => ({ text: clean(l.text) })).filter((x) => x.text),
152
+ facts: pick('facts').map((l) => ({ text: clean(l.text) })).filter((x) => x.text),
153
+ since: pick('since').map((l) => ({ text: clean(l.text), tag: l.tag, owner: firstName(l.owner) })).filter((x) => x.text),
154
+ };
155
+ }
156
+
157
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
158
+ const dayOf = (iso) => { const t = new Date(iso); return Number.isFinite(t.getTime()) ? t.getDate() + ' ' + MON[t.getMonth()] : ''; };
159
+ const andList = (xs) => (xs.length <= 1 ? xs.join('') : xs.slice(0, -1).join(', ') + ' and ' + xs[xs.length - 1]);
160
+ const stepMeta = (s) => [s.owner, s.due && /^\d{4}-\d{2}-\d{2}$/.test(s.due) ? dayOf(s.due + 'T12:00:00') : s.due].filter(Boolean).join(' · ');
161
+
162
+ /** The same copy as Markdown: what the guest's Download saves. Pure. */
163
+ export function guestMarkdown(c, { by = '', ends = '' } = {}) {
164
+ const out = ['# ' + c.title, ''];
165
+ const meta = [c.when, c.people.length ? andList(c.people) : ''].filter(Boolean).join(' · ');
166
+ if (meta) out.push('_' + meta + '_', '');
167
+ if (c.summary) out.push(c.summary, '');
168
+ const sec = (h, xs, f) => { if (xs.length) out.push('## ' + h, '', ...xs.map(f), ''); };
169
+ sec('Decided', c.decisions, (x) => '- ' + x.text + (x.why ? ' (' + x.why + ')' : ''));
170
+ sec('Next steps', c.steps, (x) => '- [ ] ' + x.text + (stepMeta(x) ? ' (' + stepMeta(x) + ')' : ''));
171
+ sec('Still open', c.questions, (x) => '- ' + x.text);
172
+ sec('Facts mentioned', c.facts, (x) => '- ' + x.text);
173
+ sec('Since the last one', c.since, (x) => '- ' + x.text + (x.tag ? ' (' + x.tag + ')' : ''));
174
+ out.push('---', '', [by ? 'A read-only copy shared by ' + by + '.' : 'A read-only copy.', ends ? 'The link ends ' + dayOf(ends) + '.' : ''].filter(Boolean).join(' ') + ' Made with PMOS.');
175
+ return out.join('\n').replace(/\n{3,}/g, '\n\n') + '\n';
176
+ }
177
+
178
+ /** The follow-up draft: a subject, the shared parts and the link, for the PM's own mail app (mailto) or the clipboard. PMOS sends nothing. Pure. */
179
+ export function followUp(c, { url = '', by = '', to = [] } = {}) {
180
+ const hi = c.people.filter((x) => !isPm(x, by));
181
+ const lines = [hi.length ? 'Hi ' + andList(hi) + ',' : 'Hi,', ''];
182
+ if (c.summary) lines.push(c.summary, '');
183
+ if (c.decisions.length) lines.push('Decided:', ...c.decisions.map((x) => '- ' + x.text), '');
184
+ if (c.steps.length) lines.push('Next steps:', ...c.steps.map((x) => '- ' + x.text + (x.owner ? ' (' + x.owner + ')' : '')), '');
185
+ if (c.questions.length) lines.push('Still open:', ...c.questions.map((x) => '- ' + x.text), '');
186
+ if (url) lines.push('The notes: ' + url, 'The password comes in a second message.', '');
187
+ if (by) lines.push(by);
188
+ const subject = c.title + ': what we settled';
189
+ const body = lines.join('\n').replace(/\n{3,}/g, '\n\n').trim();
190
+ const addr = (to || []).filter((x) => /^[^\s@,;?&]+@[^\s@,;?&]+\.[a-z]{2,}$/i.test(x)).join(',');
191
+ return { subject, body, mailto: 'mailto:' + encodeURIComponent(addr).replace(/%40/g, '@').replace(/%2C/g, ',') + '?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(body) };
192
+ }
@@ -229,6 +229,34 @@ iframe.vwprint{position:fixed;right:0;bottom:0;width:1px;height:1px;border:0;opa
229
229
  .vwsm,.vwsrow2,.vwsoff,.vwshp .vwseg,.vwsgo{min-height:44px}.vwsw{width:48px;height:30px}.vwsw::after{width:22px;height:22px}.vwsw[aria-checked="true"]::after{left:23px}
230
230
  }
231
231
  @media (prefers-reduced-motion:reduce){.vwsw::after{transition:none}}
232
+ /* a meeting's share popover (shareable-meeting-notes, design A plus the follow-up draft, Exploring 2): under the share icon beside ⋯ */
233
+ .cz-vw-hd:has(> .vwshp){position:relative}.cz-vw-hd > .vwshp{top:calc(100% + 2px);right:8px}
234
+ /* on a cozy page that does not load premium.css or cozy-viewer.css (premium-viewer.html), the popover names the cozy tokens itself */
235
+ .cz-vw-hd > .vwshp{--hair:var(--cz-hair);--ink:var(--cz-ink);--ink-2:var(--cz-ink2);--ink-3:var(--cz-ink3);--ember:var(--cz-blue);--card:var(--cz-card);--card-solid:var(--cz-card);
236
+ --well:var(--cz-well);--ok:var(--cz-ok);--bad:var(--cz-red);--sans:var(--cz-sans);--mono:var(--cz-mono);--card-shadow:var(--cz-lift);border-radius:18px;padding:10px;max-height:calc(100dvh - 140px);overflow:auto}
237
+ .vwshp:has(.vwmc){width:380px;max-width:min(380px,calc(100vw - 32px))}
238
+ .vwmc{display:flex;flex-wrap:wrap;gap:6px;padding:4px 8px}
239
+ .vwmchip,.vwmout{display:inline-flex;align-items:center;gap:6px;min-height:34px;padding:0 12px;border-radius:999px;border:1px solid var(--hair);background:var(--card-solid);color:var(--ink);font:var(--fw-regular) var(--fs-body)/1.2 var(--sans);cursor:pointer}
240
+ .vwmchip small{color:var(--ink-3);font-size:var(--fs-meta)}
241
+ .vwmchip[aria-pressed="true"]{background:var(--cz-bluebg);border-color:var(--cz-blueink);color:var(--cz-blueink)}
242
+ .vwmchip[aria-pressed="true"] small{color:inherit;opacity:.8}
243
+ .vwmout{min-height:30px;padding:0 10px;font-size:var(--fs-meta);background:var(--well);border-color:transparent;color:var(--ink-2)}
244
+ .vwmout .st{text-decoration:line-through;text-decoration-color:var(--ink-3)}.vwmout[aria-pressed="true"]{background:var(--card-solid);border-color:var(--hair);color:var(--ink)}
245
+ .vwmnv{display:flex;align-items:flex-start;gap:8px;margin:2px 8px 4px;color:var(--ink-3);font-size:var(--fs-meta);line-height:1.45}.vwmnv .i{width:14px;height:14px;margin-top:2px}
246
+ .vwmprop{display:flex;align-items:center;gap:10px;min-height:40px;padding:6px 8px;border:0;border-radius:6px;background:transparent;color:var(--ink);font:inherit;text-align:left;cursor:pointer}
247
+ .vwmprop span{flex:1}.vwmprop .sp{color:var(--cz-blueink);fill:currentColor}.vwmprop[aria-expanded="true"] .i:last-child{transform:rotate(90deg)}
248
+ .vwmin{display:flex;align-items:flex-start;gap:10px;padding:6px 8px;border-radius:8px}.vwmin>span{flex:1;min-width:0}.vwmin>.i{margin-top:3px}
249
+ .vwmin b{display:block;font-weight:var(--fw-regular)}.vwmin em{display:block;font-style:normal;color:var(--ink-3);font-size:var(--fs-meta)}.vwmin.back b{color:var(--ink)}
250
+ .vwmeye{width:36px;height:36px;flex:none;display:grid;place-items:center;border:0;border-radius:8px;background:transparent;color:var(--ink-2);cursor:pointer}
251
+ .vwmgo,.vwmfa{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:4px 8px 6px}.vwmfa .vwsok{flex:1}
252
+ .vwmmk,.vwmmail{width:48px;height:48px;flex:none;display:grid;place-items:center;border:0;border-radius:50%;background:var(--cz-blueink);color:var(--card-solid);cursor:pointer;text-decoration:none}
253
+ .vwmmk .i,.vwmmail .i{color:var(--card-solid);width:20px;height:20px}.vwmmk:disabled{opacity:.45;cursor:default}
254
+ .vwmdr{margin:2px 8px 4px;padding:12px;border-radius:12px;background:var(--well);display:grid;gap:6px}
255
+ .vwmdr b{font-weight:var(--fw-strong)}.vwmdr p{margin:0;color:var(--ink-2);display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;overflow:hidden}
256
+ .vwmdr code{display:flex;align-items:center;gap:6px;font:var(--fw-regular) var(--fs-meta)/var(--lh-meta) var(--mono);color:var(--ink-3);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.vwmdr code .i{width:14px;height:14px}
257
+ @media (hover:hover){.vwmprop:hover,.vwmeye:hover{background:var(--well)}.vwmchip:hover{border-color:var(--ink-3)}}
258
+ @media (max-width:640px){.vwmchip,.vwmout,.vwmprop,.vwmeye{min-height:44px}.vwmeye{width:44px}
259
+ .cz-vw-hd > .vwshp,.vwshp:has(.vwmc){position:fixed;left:8px;right:8px;top:auto;bottom:calc(8px + env(safe-area-inset-bottom,0px));width:auto;max-width:none;max-height:80dvh;overflow:auto;z-index:60}}
232
260
  /* The Edit log and Proposals under the page: a plain minimal section until the Agreed design draws them (initiative premium-agreed-design) */
233
261
  .vwside{display:grid;gap:8px;margin:18px 0 0;padding:14px 0 0;border-top:1px solid var(--hair)}
234
262
  .vwside .vwmp{display:grid;gap:8px}
@@ -44,6 +44,8 @@ import { APPS, recall, remember } from './listen-sources.js';
44
44
  import { replayView, phoneHtml, editHtml, mentions, phraseOf as phraseOfPage, deskHtml, leftHtml, wx, placesBy, wordPopHtml, posOf, lineAtPos, captionHtml } from './premium-mtg-replay.js';
45
45
  import { announce } from './rec-state.js';
46
46
  import { presentInRecording } from './cozy-rec-bridge.js'; // while a meeting records, Present goes to the recording tab (batch 12 item 1, rule 10)
47
+ import { factsOf } from './meeting-share.js'; // the facts mentioned: one list for the note and a shared copy (shareable-meeting-notes)
48
+ export { factsOf };
47
49
 
48
50
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
49
51
  const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
@@ -98,12 +100,6 @@ export function linesOf(n) {
98
100
  return byTime((n.transcript || []).filter((x) => x && x.text && !x.dropped)).map((x) => ({ t: x.t, text: String(x.text), who: sp[x.source] || DEF[x.source] || 'You', key: '', source: x.source || 'mic' }));
99
101
  }
100
102
  /** The facts said in the meeting, as view-notes.js caught() reads them: a statement with a number, or one checked against a repository file. */
101
- export function factsOf(n) {
102
- if (!n || n.private) return [];
103
- return (n.transcript || []).filter((x) => x && x.text && !x.dropped && x.cat === 'statement' && (/\d|\b(?:percent|half|double|twice)\b/i.test(x.text) || (x.check && x.check.doc)))
104
- .map((x) => { const v = x.check && x.check.verdict; return { text: clip(x.text, 240), src: (x.check && x.check.doc) || '', tag: v === 'agrees' ? 'Matches' : v === 'differs' ? 'Differs' : 'Not checked', k: v === 'agrees' ? 'ok' : v === 'differs' ? 'warn' : '' }; });
105
- }
106
-
107
103
  export const NO_NOTES = 'No notes for this meeting. It was not recorded, and nobody wrote any.';
108
104
  export const PAUSED_LINE = 'nothing is kept while paused';
109
105
  const peopleText = (ps) => (ps.length ? ps.slice(0, 3).join(', ') + (ps.length > 3 ? ' and ' + (ps.length - 3) + ' more' : '') : '');
@@ -680,11 +676,13 @@ function draw(me) {
680
676
  const body = vCur() && vCur().id === me.vid ? document.querySelector('#czViewer .cz-vw-body') : null;
681
677
  const m = me.model = meetModel({ ...me.D, elapsed: elapsedOf(me) });
682
678
  const busy = body && body.contains(document.activeElement) && /^(TEXTAREA|INPUT|SELECT)$/.test(document.activeElement.tagName);
683
- const sig = m.more.map((x) => x.k || '-').join(',');
679
+ const canShare = m.mk === 'notes' && !!m.noteId && !m.private; // shareable-meeting-notes: the share icon beside ⋯ once there are notes
680
+ const sig = m.more.map((x) => x.k || '-').join(',') + (canShare ? ',share' : '');
684
681
  if (!body || me.kind !== m.kind || me.head !== m.head || me.sig !== sig) { // the header names the state and ⋯ holds its presses: open again when they changed
685
682
  if (me.previewing) return; // the PM is looking at material: the meeting is drawn again when ← comes back to it
686
683
  me.kind = m.kind; me.head = m.head; me.sig = sig; me.reopen = true;
687
- vOpen({ id: me.vid, kind: m.kind, title: m.head, icon: 'meet', url: meetingUrl({ ...refNow(me), ws: me.ws }), render: (b) => paint(me, b), onClose: () => closed(me), more: moreOf(me, m) });
684
+ vOpen({ id: me.vid, kind: m.kind, title: m.head, icon: 'meet', url: meetingUrl({ ...refNow(me), ws: me.ws }), render: (b) => paint(me, b), onClose: () => closed(me), more: moreOf(me, m),
685
+ presses: canShare ? [{ act: 'share', label: 'Share…', icon: SHARE_ICON }] : [], onPress: (a, b) => { if (a === 'share') shareNote(me, b); } });
688
686
  widen('mtg');
689
687
  me.reopen = false;
690
688
  wideOnce(me, m);
@@ -702,6 +700,13 @@ function wideOnce(me, m) {
702
700
  }
703
701
  const refNow = (me) => (me.n ? { note: me.n.id } : me.row ? { event: me.row.id, date: me.row.day } : me.R);
704
702
  /** ⋯ of the meeting: the model's list, each with its press. */
703
+ /** The share icon (shareable-meeting-notes, design A): the D97 share popover with the cut PMOS proposes for this note. */
704
+ const SHARE_ICON = 'M12 15V4M8 8l4-4 4 4M6 12v7h12v-7';
705
+ function shareNote(me, btn) {
706
+ const m = me.model; if (!m || !me.n || !me.D || !me.D.S) return;
707
+ btn.setAttribute('aria-haspopup', 'dialog');
708
+ import('./premium-vw-share.js').then((M) => M.shareMenu(btn, { name: m.title, note: { id: me.n.id, sheet: me.D.S, facts: factsOf(me.n), people: m.people } }));
709
+ }
705
710
  function moreOf(me, m) {
706
711
  const on = (k) => () => act(me, k);
707
712
  return m.more.map((x) => (x.sep ? { sep: true } : { label: x.label, danger: !!x.danger, on: on(x.k) }));
@@ -5,13 +5,29 @@
5
5
  * the share copies folder through POST /api/shares; the share server (share-server.js, D97) serves it. Nothing is public before the press.
6
6
  * Open links every open link with its end date and views, and Turn off (a second press confirms). Turn off deletes the copy at once.
7
7
  * Reads GET /api/shares and GET /api/shares/password; writes only through the two page-press routes.
8
- * shareMenu(btn, f) f is the file tab's record: { name, ws, rel, kind, text } */
8
+ * shareMenu(btn, f) f is the file tab's record: { name, ws, rel, kind, text }, or a meeting note (shareable-meeting-notes):
9
+ * { name, note: { id, sheet, facts, people } }. A meeting's popover adds, above the link (design A, Exploring 2):
10
+ * What goes out the parts PMOS proposes as chips (meeting-share.js proposeCut); the transcript, recording and screens stay inside,
11
+ * one quiet line and no switch.
12
+ * ✦ row "PMOS kept 2 lines inside · 4 details out": opens the lines kept inside, each with an eye to put it back, and the
13
+ * details taken out, each a chip to keep it. The PM only approves, by pressing the link icon.
14
+ * Follow-up once the link is made: a ready email (subject, the shared parts, the link) that opens in the PM's own mail app
15
+ * (a mailto link) or goes to the clipboard. PMOS sends nothing.
16
+ * The server makes the meeting's copy from the note and the cut (POST /api/shares { note, cut, people }), never from text the page sends. */
9
17
  import { pmGet, pmPost } from './http.js';
18
+ import { proposeCut, defaultCut, NEVER_LINE } from './meeting-share.js';
10
19
 
11
20
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
12
21
  const day = (iso) => { try { return new Date(iso).toLocaleDateString(undefined, { day: 'numeric', month: 'short' }); } catch { return ''; } };
13
22
  const LOCK = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/></svg>';
14
23
  const LINK = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/></svg>';
24
+ const SPARK = '<svg class="i sp" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/></svg>';
25
+ const CHEV = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg>';
26
+ const EYE = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg>';
27
+ const EYE_OFF = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 3l18 18M10.6 5.1A10 10 0 0 1 12 5c6.4 0 10 7 10 7a17 17 0 0 1-3.2 4.1M6.6 6.6A17 17 0 0 0 2 12s3.6 7 10 7a9.7 9.7 0 0 0 4.4-1"/><path d="M9.9 9.9a3 3 0 0 0 4.2 4.2"/></svg>';
28
+ const UP = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 15V4M8 8l4-4 4 4M6 12v7h12v-7"/></svg>';
29
+ const COPY = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V5a1 1 0 0 1 1-1h10"/></svg>';
30
+ const MAIL = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/></svg>';
15
31
  const SEND = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 12l16-8-6 16-2-7z"/></svg>';
16
32
 
17
33
  /** Whether this device can hand a file to the system share sheet (a phone, mostly). */
@@ -20,6 +36,33 @@ export function canSendFile(f) {
20
36
  catch { return false; }
21
37
  }
22
38
 
39
+ /** A meeting's cut (above the link): the chips, the line that never goes, and the ✦ row with what PMOS kept inside. Pure. */
40
+ export function cutHtml(S) {
41
+ const P = S.prop, cut = S.cut, back = new Set(cut.back);
42
+ const chips = P.sections.map((x) => `<button type="button" class="vwmchip" data-cut="${esc(x.k)}" aria-pressed="${cut.on.includes(x.k)}">${esc(x.label)}${x.n ? `<small>${x.n}</small>` : ''}</button>`).join('');
43
+ const inN = P.inside.filter((l) => !back.has('in:' + l.id)).length, outN = P.out.filter((o) => !back.has('out:' + o.k)).length;
44
+ const say = [inN ? `PMOS kept ${inN} ${inN === 1 ? 'line' : 'lines'} inside` : '', outN ? `${outN} ${outN === 1 ? 'detail' : 'details'} out` : ''].filter(Boolean).join(' · ')
45
+ || (P.inside.length || P.out.length ? 'Everything PMOS kept inside is put back' : '');
46
+ const row = say ? `<button type="button" class="vwmprop" data-sh="prop" aria-expanded="${!!S.open}">${SPARK}<span>${esc(say)}</span>${CHEV}</button>` : '';
47
+ const open = !S.open ? '' : (P.inside.length ? `<div class="vwsh">Stays inside</div>` + P.inside.map((l) => { const b = back.has('in:' + l.id);
48
+ return `<div class="vwmin${b ? ' back' : ''}">${b ? EYE : EYE_OFF}<span><b>${esc(l.text)}</b><em>${esc(b ? 'Put back: it goes out' : l.why)}</em></span>`
49
+ + `<button type="button" class="vwmeye" data-back="in:${esc(l.id)}" aria-pressed="${b}" aria-label="${esc(b ? 'Keep it inside' : 'Put it back')}" title="${esc(b ? 'Keep it inside' : 'Put it back')}">${b ? EYE_OFF : EYE}</button></div>`; }).join('') : '')
50
+ + (P.out.length ? `<div class="vwsh">Taken out of the lines that go</div><div class="vwmc">` + P.out.map((o) => { const b = back.has('out:' + o.k);
51
+ return `<button type="button" class="vwmout" data-back="out:${esc(o.k)}" aria-pressed="${b}" title="${esc(b ? 'It goes out. Press to take it out again' : 'Press to keep it')}">${LINK}<span${b ? '' : ' class="st"'}>${esc(o.label)}</span></button>`; }).join('') + '</div>' : '')
52
+ + `<p class="vwsn">Attendees show by first name. Nothing here changes your own note.</p>`;
53
+ return `<div class="vwsh">What goes out</div><div class="vwmc" role="group" aria-label="What goes out">${chips}</div>`
54
+ + `<p class="vwmnv">${LOCK}<span>${esc(NEVER_LINE)}</span></p>` + (row ? '<div class="vwssep"></div>' + row : '') + open;
55
+ }
56
+ /** The follow-up draft once the link is made: it opens in the PM's mail app or goes to the clipboard. Pure. */
57
+ export function draftHtml(S) {
58
+ const d = S.made && S.made.draft; if (!d) return '';
59
+ const body = d.body.split('\n').filter((l) => l && !/^The notes: /.test(l) && !/^The password comes/.test(l)).slice(0, 8).map((l) => l.replace(/^- /, '· ')).join(' ');
60
+ return `<div class="vwssep"></div><div class="vwsh">Follow-up</div><div class="vwmdr"><b>${esc(d.subject)}</b><p>${esc(body)}</p><code>${LINK}${esc(S.made.url)}</code></div>`
61
+ + `<p class="vwmnv">${LOCK}<span>${S.made.pass ? 'The password goes in a second message. ' : ''}Nothing is sent: it opens in your mail app.</span></p>`
62
+ + `<div class="vwmfa"><span class="vwsok" role="status">${esc(S.dcopied || '')}</span><button type="button" class="vwib" data-sh="dcopy" aria-label="Copy the draft" title="Copy the draft">${COPY}</button>`
63
+ + `<a class="vwmmail" href="${esc(d.mailto)}" aria-label="Open the draft in your mail app" title="Open in your mail app">${MAIL}</a></div>`;
64
+ }
65
+
23
66
  /** The popover's inside as HTML. Pure. S = { pw, pass, days, made, err, busy, list, host, off, send } */
24
67
  export function shareHtml(S) {
25
68
  const send = S.send ? `<button type="button" class="vwsm" data-sh="send">${SEND}<span>Send a copy</span><small>share sheet</small></button><div class="vwssep"></div>` : '';
@@ -32,19 +75,24 @@ export function shareHtml(S) {
32
75
  + (S.made.pass ? `<div class="vwspw">${LOCK}<code>${esc(S.made.pass)}</code></div>` : '')
33
76
  + `<div class="vwsr"><button type="button" class="vwbtn pri" data-sh="copy">${S.made.pass ? 'Copy link and password' : 'Copy link'}</button><span class="vwsok" role="status">${esc(S.copied || '')}</span></div>`
34
77
  + `<p class="vwsn">Ends ${esc(day(S.made.ends))}.${S.made.pass ? ' Send the password in a different message.' : ''}</p></div>`
78
+ + (S.prop ? draftHtml(S) : '')
35
79
  + (list ? '<div class="vwssep"></div>' + list : '');
36
80
  }
37
- return send + `<div class="vwsh">Public link</div>`
81
+ const mtg = !!S.prop;
82
+ return send + (mtg ? cutHtml(S) + '<div class="vwssep"></div>' : '') + `<div class="vwsh">Public link</div>`
38
83
  + `<div class="vwsrow2">${LOCK}<span>Password</span><button type="button" class="vwsw" role="switch" aria-checked="${S.pw}" aria-label="Password" data-sh="pw"></button></div>`
39
84
  + (S.pw ? `<div class="vwspwi"><input id="vwsPass" type="text" spellcheck="false" autocomplete="off" aria-label="Password" value="${esc(S.pass)}"><button type="button" class="vwbtn" data-sh="new">New</button></div>` : '')
40
85
  + `<div class="vwsrow2"><span>Ends</span><div class="vwsg" role="group" aria-label="Link ends after">${[1, 7, 30].map((d) => `<button type="button" class="vwseg" data-days="${d}" aria-pressed="${S.days === d}">${d === 1 ? '1 day' : d + ' days'}</button>`).join('')}</div></div>`
41
- + `<p class="vwsn">Anyone with the link${S.pw ? ' and the password' : ''} can read a copy of this file as it is now. Later edits are not shared.</p>`
86
+ + `<p class="vwsn">Anyone with the link${S.pw ? ' and the password' : ''} can read a copy of ${mtg ? 'what goes out' : 'this file'} as it is now. Later edits are not shared.</p>`
42
87
  + (S.err ? `<p class="vwserr" role="alert">${esc(S.err)}</p>` : '')
43
- + `<button type="button" class="vwbtn pri vwsgo" data-sh="make"${S.busy ? ' disabled' : ''}>${S.busy ? 'Making the link…' : 'Create link'}</button>`
88
+ + (mtg ? `<div class="vwmgo"><button type="button" class="vwmmk" data-sh="make" aria-label="${S.busy ? 'Making the link…' : 'Create link'}" title="Create link"${S.busy || !S.cut.on.length ? ' disabled' : ''}>${UP}</button></div>`
89
+ : `<button type="button" class="vwbtn pri vwsgo" data-sh="make"${S.busy ? ' disabled' : ''}>${S.busy ? 'Making the link…' : 'Create link'}</button>`)
44
90
  + (list ? '<div class="vwssep"></div>' + list : '');
45
91
  }
46
92
 
93
+ const CSS = new URL('./premium-vw-doc.css', import.meta.url).href; // the popover's look: a meeting page may not have loaded it yet
47
94
  export function shareMenu(btn, f) {
95
+ if (typeof document !== 'undefined' && !document.querySelector(`link[href="${CSS}"]`)) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l); }
48
96
  const box = btn.parentElement;
49
97
  const old = box.querySelector('.vwshp');
50
98
  const close = (focus) => { const k = box.querySelector('.vwshp'); if (k) k.remove(); btn.setAttribute('aria-expanded', 'false'); if (focus) btn.focus(); };
@@ -52,7 +100,11 @@ export function shareMenu(btn, f) {
52
100
  // Escape closes the popover wherever the focus is (a press redraws it), before the dialog under it sees the key
53
101
  const onKey = (e) => { if (e.key !== 'Escape') return; document.removeEventListener('keydown', onKey, true); if (!m.isConnected) return; e.stopPropagation(); close(true); };
54
102
  box.querySelectorAll('.vmenu').forEach((m) => m.remove());
55
- const S = { pw: true, pass: '', days: 7, made: null, err: '', busy: false, list: [], host: null, off: null, send: canSendFile(f), copied: '' };
103
+ const N = f.note || null;
104
+ const propOf = (pm) => proposeCut({ sheet: N.sheet, facts: N.facts || [], people: N.people || [], pm });
105
+ const S = { pw: true, pass: '', days: 7, made: null, err: '', busy: false, list: [], host: null, off: null, send: !N && canSendFile(f), copied: '', dcopied: '',
106
+ prop: N ? propOf('') : null, cut: null, open: false, me: '' };
107
+ if (N) S.cut = defaultCut(S.prop);
56
108
  const m = document.createElement('div');
57
109
  m.className = 'vwshp'; m.setAttribute('role', 'dialog'); m.setAttribute('aria-label', 'Share ' + (f.name || 'this file')); m.dataset.escLayer = '1';
58
110
  const draw = (focus) => {
@@ -61,7 +113,7 @@ export function shareMenu(btn, f) {
61
113
  };
62
114
  const load = async () => {
63
115
  const [l, p] = await Promise.all([pmGet('/api/shares'), S.pass ? null : pmGet('/api/shares/password')]);
64
- if (l && l.ok) { S.list = l.shares || []; S.host = l.host; }
116
+ if (l && l.ok) { S.list = l.shares || []; S.host = l.host; if (N && l.me && l.me !== S.me) { S.me = l.me; S.prop = propOf(l.me); S.cut = { on: S.cut.on, back: S.cut.back }; } }
65
117
  const typed = m.querySelector('#vwsPass');
66
118
  if (typed && typed.value) S.pass = typed.value; // the PM typed before the generated one arrived
67
119
  else if (p && p.ok && !S.pass) S.pass = p.password;
@@ -72,6 +124,8 @@ export function shareMenu(btn, f) {
72
124
  const b = e.target.closest('button'); if (!b) return;
73
125
  const pass = m.querySelector('#vwsPass'); if (pass) S.pass = pass.value;
74
126
  if (b.dataset.days) { S.days = Number(b.dataset.days); return draw(`[data-days="${S.days}"]`); }
127
+ if (b.dataset.cut) { const k = b.dataset.cut; S.cut.on = S.cut.on.includes(k) ? S.cut.on.filter((x) => x !== k) : [...S.cut.on, k]; S.err = ''; return draw(`[data-cut="${k}"]`); }
128
+ if (b.dataset.back) { const k = b.dataset.back; S.cut.back = S.cut.back.includes(k) ? S.cut.back.filter((x) => x !== k) : [...S.cut.back, k]; return draw(`[data-back="${k}"]`); }
75
129
  if (b.dataset.off) {
76
130
  if (S.off !== b.dataset.off) { S.off = b.dataset.off; return draw(`[data-off="${S.off}"]`); }
77
131
  const r = await pmPost('/api/shares/off', { id: b.dataset.off });
@@ -80,6 +134,12 @@ export function shareMenu(btn, f) {
80
134
  }
81
135
  const k = b.dataset.sh;
82
136
  if (k === 'pw') { S.pw = !S.pw; return draw('[data-sh="pw"]'); }
137
+ if (k === 'prop') { S.open = !S.open; return draw('[data-sh="prop"]'); }
138
+ if (k === 'dcopy') {
139
+ const d = S.made && S.made.draft; if (!d) return;
140
+ try { await navigator.clipboard.writeText(d.subject + '\n\n' + d.body); S.dcopied = 'Copied'; } catch { S.dcopied = 'The browser did not allow copying'; }
141
+ return draw('[data-sh="dcopy"]');
142
+ }
83
143
  if (k === 'new') { const p = await pmGet('/api/shares/password'); if (p && p.ok) S.pass = p.password; return draw('[data-sh="new"]'); }
84
144
  if (k === 'send') {
85
145
  try { await navigator.share({ files: [new File([f.text || ''], f.name || 'file.txt', { type: 'text/plain' })], title: f.name }); close(true); }
@@ -89,10 +149,11 @@ export function shareMenu(btn, f) {
89
149
  if (k === 'make') {
90
150
  if (S.pw && String(S.pass || '').trim().length < 8) { S.err = 'The password needs at least 8 characters.'; return draw(); }
91
151
  S.busy = true; S.err = ''; draw();
92
- const r = await pmPost('/api/shares', { ws: f.ws, path: f.rel, days: S.days, password: S.pw ? String(S.pass).trim() : null });
152
+ const what = N ? { note: N.id, cut: S.cut, people: N.people || [] } : { ws: f.ws, path: f.rel };
153
+ const r = await pmPost('/api/shares', { ...what, days: S.days, password: S.pw ? String(S.pass).trim() : null });
93
154
  S.busy = false;
94
155
  if (!r || !r.ok) { S.err = (r && r.error) || 'The link could not be made.'; return draw(); }
95
- S.made = { url: r.url, ends: r.ends, pass: S.pw ? String(S.pass).trim() : '' };
156
+ S.made = { url: r.url, ends: r.ends, pass: S.pw ? String(S.pass).trim() : '', draft: r.draft || null };
96
157
  const l = await pmGet('/api/shares'); if (l && l.ok) S.list = l.shares || [];
97
158
  return draw('[data-sh="copy"]');
98
159
  }
@@ -107,6 +168,6 @@ export function shareMenu(btn, f) {
107
168
  draw();
108
169
  box.append(m); btn.setAttribute('aria-expanded', 'true');
109
170
  const first = m.querySelector('button'); if (first) first.focus();
110
- setTimeout(() => document.addEventListener('click', function off(e) { if (!e.target.closest('.vwshp,[data-fsh]')) close(); if (!box.querySelector('.vwshp')) document.removeEventListener('click', off, true); }, true), 0);
171
+ setTimeout(() => document.addEventListener('click', function off(e) { if (!e.target.closest('.vwshp,[data-fsh],[data-cz-vw-p="share"]')) close(); if (!box.querySelector('.vwshp')) document.removeEventListener('click', off, true); }, true), 0);
111
172
  load();
112
173
  }
@@ -378,6 +378,39 @@ function startShareServer() {
378
378
  mine.on('exit', () => { if (SHARE.child !== mine) return; SHARE.child = null; if (!SHARE.stopped && !SHARE.timer) { SHARE.timer = setTimeout(() => { SHARE.timer = null; startShareServer(); }, 5000); if (SHARE.timer.unref) SHARE.timer.unref(); } });
379
379
  }
380
380
  function stopShareServer() { SHARE.stopped = true; if (SHARE.timer) clearTimeout(SHARE.timer); const c = SHARE.child; SHARE.child = null; if (c) { try { c.kill('SIGTERM'); } catch { /* gone */ } } }
381
+ /** The PM's first name for a shared meeting note ("A read-only copy shared by Wawan"): git's user.name, as Home's greeting reads it. */
382
+ function shareMe() { try { const n = require('./lib/routes-brief-page.js').firstName(path.resolve(__dirname, '..')) || ''; return /^claude$/i.test(n) ? '' : n; } catch { return ''; } } // a guest page never says Claude (an agent's git name)
383
+ /** A meeting note's guest copy (shareable-meeting-notes): the note is read here, PMOS's proposal is made again from it (public/pm/meeting-share.js,
384
+ * the same one the popover showed), and only the sections that are on and the lines the PM put back go out. The transcript, the recording and the
385
+ * screen shots are never read into it. The page goes through the same secret scan as a file. → { ok, id, ends, draft(url) } | { ok: false, error, status } */
386
+ async function meetingShareCopy(body) {
387
+ const notes = require('./lib/notes.js');
388
+ const id = String(body.note || '');
389
+ const r = notes.read(STATE, id);
390
+ if (!r || !r.ok) return { ok: false, error: 'no such note', status: 404 };
391
+ if (r.note.private) return { ok: false, error: 'This note is private. Private notes are not shared.', status: 409 };
392
+ let place = null; try { place = require('./lib/notes-series.js').placeOf(STATE, id); } catch { place = null; }
393
+ let Meet, MS;
394
+ try { [Meet, MS] = await Promise.all([import('./public/pm/premium-vw-meet.js'), import('./public/pm/meeting-share.js')]); }
395
+ catch { return { ok: false, error: 'The copy could not be made.', status: 500 }; }
396
+ const sheet = Meet.noteSheet({ ok: true, note: r.note, place });
397
+ if (!sheet) return { ok: false, error: 'no such note', status: 404 };
398
+ const facts = MS.factsOf(r.note);
399
+ const people = (Array.isArray(body.people) ? body.people : []).map((x) => String(x || '').slice(0, 80)).filter(Boolean).slice(0, 40);
400
+ const pm = shareMe();
401
+ const prop = MS.proposeCut({ sheet, facts, pm, people });
402
+ const cut = { on: Array.isArray(body.cut && body.cut.on) ? body.cut.on.map(String) : MS.defaultCut(prop).on, back: Array.isArray(body.cut && body.cut.back) ? body.cut.back.map(String) : [] };
403
+ const copy = MS.applyCut(prop, cut, { sheet, facts, people, pm });
404
+ if (!copy.summary && !copy.decisions.length && !copy.steps.length && !copy.questions.length && !copy.facts.length && !copy.since.length) return { ok: false, error: 'Nothing is chosen to go out. Turn on a part first.', status: 400 };
405
+ const days = Number(body.days), now = Date.now();
406
+ const ends = shareStore.DAYS.includes(days) ? new Date(now + days * 86400000).toISOString() : '';
407
+ const page = require('./lib/meeting-guest-page.js').guestPage(copy, { by: pm, ends }), file = MS.guestMarkdown(copy, { by: pm, ends });
408
+ const hits = require('./lib/secret-scan').scan(page + '\n' + file);
409
+ if (hits.length) return { ok: false, error: 'The shared part holds what looks like a secret (' + hits.join(', ') + '). Leave that part inside, then share again.', secrets: hits, status: 422 };
410
+ const made = shareStore.create(STATE, { name: (copy.title || 'Meeting notes') + '.md', kind: 'meeting', page, file, days, now, password: body.password == null || body.password === '' ? null : String(body.password) });
411
+ if (!made.ok) return { ok: false, error: made.error, status: 400 };
412
+ return { ok: true, id: made.id, ends: made.ends, draft: (url) => MS.followUp(copy, { url, by: pm }) };
413
+ }
381
414
  /** The hostname a share link names: PMOS_SHARE_HOST, else share.<the Online hostname's domain>, else null (Online is not set up). */
382
415
  function shareHost() {
383
416
  const env = String(process.env.PMOS_SHARE_HOST || '').trim().toLowerCase();
@@ -8508,7 +8541,7 @@ async function handleRequest(req, res) {
8508
8541
  /* ── premium-viewer-share (D97): share links. Listing is a read; making and turning off a link is a page press, never an agent session. ── */
8509
8542
  if (p === '/api/shares' && req.method === 'GET') {
8510
8543
  const host = shareHost();
8511
- return json(res, { ok: true, host, days: shareStore.DAYS, shares: shareStore.list(STATE).map((x) => ({ ...x, url: host ? `https://${host}/s/${x.id}` : null })) });
8544
+ return json(res, { ok: true, host, days: shareStore.DAYS, me: shareMe(), shares: shareStore.list(STATE).map((x) => ({ ...x, url: host ? `https://${host}/s/${x.id}` : null })) });
8512
8545
  }
8513
8546
  if (p === '/api/shares/password' && req.method === 'GET') return json(res, { ok: true, password: shareStore.newPassword() });
8514
8547
  if ((p === '/api/shares' || p === '/api/shares/off') && req.method === 'POST') {
@@ -8524,6 +8557,13 @@ async function handleRequest(req, res) {
8524
8557
  }
8525
8558
  const host = shareHost();
8526
8559
  if (!host) return json(res, { ok: false, error: 'Share links use your Online hostname. Set up Online in Settings first, or set PMOS_SHARE_HOST.' }, 409);
8560
+ // a meeting note (shareable-meeting-notes): the copy is made here from the note itself and the PM's cut, never from text the page sends
8561
+ if (body.note != null) {
8562
+ const r = await meetingShareCopy(body);
8563
+ if (!r.ok) return json(res, { ok: false, error: r.error, ...(r.secrets ? { secrets: r.secrets } : {}) }, r.status || 400);
8564
+ startShareServer();
8565
+ return json(res, { ok: true, id: r.id, ends: r.ends, url: `https://${host}/s/${r.id}`, draft: r.draft(`https://${host}/s/${r.id}`) });
8566
+ }
8527
8567
  const w = docRootOf(body.ws);
8528
8568
  const rel = String(body.path || '');
8529
8569
  const got = readDocWhy(w, rel);
@@ -8,7 +8,8 @@
8
8
  * share hostname (share.pm-os.app) here, with no Access application in front; the workspace hostname keeps its Access check.
9
9
  *
10
10
  * GET /robots.txt Disallow: /
11
- * GET /s/<id> the password page, or the copy in a sandboxed frame with Download
11
+ * GET /s/<id> the password page, or the copy in a sandboxed frame with Download; a meeting note (shareable-meeting-notes)
12
+ * is its guest page itself, under a CSP with no script
12
13
  * POST /s/<id> the password form (pw=…): a right password sets a cookie for this link only, for 12 hours
13
14
  * GET /s/<id>/view the copy itself, under a sandbox CSP (only with a valid cookie when the link has a password)
14
15
  * GET /s/<id>/file the file's own text as an attachment (the same rule)
@@ -34,6 +35,9 @@ const BASE_HEADERS = {
34
35
  };
35
36
  const PAGE_CSP = "default-src 'none'; style-src 'unsafe-inline'; frame-src 'self'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'";
36
37
  // the copy itself: the viewer's own sandbox (premium-vw-file.js FRAME_CSP), shown only inside its own page
38
+ // a shared meeting note: no script at all, its own inline style, nothing else from anywhere
39
+ const MEETING_CSP = "default-src 'none'; style-src 'unsafe-inline'; img-src data:; form-action 'none'; frame-ancestors 'none'; base-uri 'none'";
40
+ const { FILE_TOKEN } = require('./lib/meeting-guest-page.js');
37
41
  const VIEW_CSP = (scripts) => `sandbox${scripts ? ' allow-scripts' : ''}; default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:; script-src ${scripts ? "'unsafe-inline'" : "'none'"}; frame-ancestors 'self'; base-uri 'none'; form-action 'none'`;
38
42
 
39
43
  function send(res, status, body, headers = {}) {
@@ -113,6 +117,14 @@ async function handle(req, res) {
113
117
  return res.end(req.method === 'HEAD' ? undefined : text);
114
118
  }
115
119
  if (req.method === 'GET') store.view(DIR, id, now);
120
+ // a meeting note (shareable-meeting-notes) is the guest page itself: made by PMOS with no script, so it needs no frame, and its own
121
+ // download icon names the Download address
122
+ if (meta.kind === 'meeting') {
123
+ const page = store.readPart(DIR, id, 'page.html');
124
+ if (page == null) return gone(res);
125
+ res.writeHead(200, { ...BASE_HEADERS, 'Content-Type': 'text/html; charset=utf-8', 'Content-Security-Policy': MEETING_CSP, 'X-Frame-Options': 'DENY' });
126
+ return res.end(req.method === 'HEAD' ? undefined : page.split(FILE_TOKEN).join(`/s/${id}/file`));
127
+ }
116
128
  return send(res, 200, doc(meta.name, `<div class="wrap"><iframe src="/s/${esc(id)}/view" title="${esc(meta.name)}" sandbox="${meta.kind === 'html' ? 'allow-scripts' : ''}" referrerpolicy="no-referrer"></iframe>`
117
129
  + `<div class="bar"><span>A shared copy, made ${esc(day(meta.made))}. The link ends ${esc(day(meta.ends))}.</span><a class="btn" href="/s/${esc(id)}/file" download>Download</a></div></div>`));
118
130
  }
@@ -132,4 +144,4 @@ if (require.main === module) {
132
144
  const parent = Number(process.env.PMOS_SHARE_PARENT);
133
145
  if (parent > 0) setInterval(() => { try { process.kill(parent, 0); } catch { process.exit(0); } }, 5000).unref();
134
146
  }
135
- module.exports = { start, handle, VIEW_CSP, PAGE_CSP };
147
+ module.exports = { start, handle, VIEW_CSP, PAGE_CSP, MEETING_CSP };
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "shareable-meeting-notes (batch 31 item 1): the cut PMOS proposes for a meeting note (pm/meeting-share.js), the guest page and the follow-up draft, POST /api/shares with a note, and share-server.js serving it. Node only, a real server, no browser.",
3
+ "modules": [
4
+ "meeting-share.test.js"
5
+ ],
6
+ "seconds": {
7
+ "meeting-share.test.js": 6
8
+ }
9
+ }