create-pmos 0.586.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 +27 -27
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/guide/agent-capabilities.md +2 -1
- package/workspace/guide/notes.md +14 -0
- package/workspace/lib/idle-lab.js +17 -1
- package/workspace/lib/meeting-guest-page.js +53 -0
- package/workspace/lib/routes-lab.js +9 -0
- package/workspace/lib/routes-proposals.js +4 -0
- package/workspace/lib/share-store.js +3 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-lab.js +5 -1
- package/workspace/public/pm/ini-agent.js +22 -6
- package/workspace/public/pm/ini-view.js +2 -0
- package/workspace/public/pm/meeting-share.js +192 -0
- package/workspace/public/pm/premium-vw-doc.css +28 -0
- package/workspace/public/pm/premium-vw-mtg.js +13 -8
- package/workspace/public/pm/premium-vw-share.js +70 -9
- package/workspace/server.js +41 -1
- package/workspace/share-server.js +14 -2
- package/workspace/test-lists/meeting-share.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "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,32 @@
|
|
|
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
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"v": "0.587.0",
|
|
51
|
+
"at": "2026-11-17T10:24:56.955Z",
|
|
52
|
+
"f": 4,
|
|
53
|
+
"prs": [
|
|
54
|
+
{
|
|
55
|
+
"n": 1322,
|
|
56
|
+
"t": "The live round's compare view is always reachable: no early ✓, Specimens line opens it",
|
|
57
|
+
"s": "The live round's compare view is always reachable: no early ✓, Specimens line opens it",
|
|
58
|
+
"k": "fix"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
36
62
|
{
|
|
37
63
|
"v": "0.586.0",
|
|
38
64
|
"at": "2026-11-17T09:31:31.443Z",
|
|
@@ -272,32 +298,6 @@
|
|
|
272
298
|
"k": "new"
|
|
273
299
|
}
|
|
274
300
|
]
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
"v": "0.568.0",
|
|
278
|
-
"at": "2026-11-12T05:06:58.936Z",
|
|
279
|
-
"f": 4,
|
|
280
|
-
"prs": [
|
|
281
|
-
{
|
|
282
|
-
"n": 1300,
|
|
283
|
-
"t": "Project and Full SDLC get their own workflows and gates (launch simulation W5)",
|
|
284
|
-
"s": "Project and Full SDLC get their own workflows and gates (launch simulation W5)",
|
|
285
|
-
"k": "new"
|
|
286
|
-
}
|
|
287
|
-
]
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
"v": "0.567.0",
|
|
291
|
-
"at": "2026-11-12T04:54:34.259Z",
|
|
292
|
-
"f": 4,
|
|
293
|
-
"prs": [
|
|
294
|
-
{
|
|
295
|
-
"n": 1298,
|
|
296
|
-
"t": "A refuted outcome reads at risk and files its next step under the ✦",
|
|
297
|
-
"s": "A refuted outcome reads at risk and files its next step under the ✦",
|
|
298
|
-
"k": "new"
|
|
299
|
-
}
|
|
300
|
-
]
|
|
301
301
|
}
|
|
302
302
|
]
|
|
303
303
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -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-
|
|
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-
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-17T10:44:21Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
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
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"v": "0.587.0",
|
|
17
|
+
"at": "2026-11-17T10:24:56.955Z",
|
|
18
|
+
"f": 4,
|
|
19
|
+
"prs": [
|
|
20
|
+
{
|
|
21
|
+
"n": 1322,
|
|
22
|
+
"t": "The live round's compare view is always reachable: no early ✓, Specimens line opens it",
|
|
23
|
+
"s": "The live round's compare view is always reachable: no early ✓, Specimens line opens it",
|
|
24
|
+
"k": "fix"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
2
28
|
{
|
|
3
29
|
"v": "0.586.0",
|
|
4
30
|
"at": "2026-11-17T09:31:31.443Z",
|
|
@@ -195,9 +195,10 @@ Not proven yet: the compare view's Production and Design columns stay left out u
|
|
|
195
195
|
You can ask to see an idea at any moment: alone while you work on an initiative, or with stakeholders in the room. You do not have to step away first.
|
|
196
196
|
|
|
197
197
|
1. **Ask in the initiative's chat.** Say, for example, "show me 3 ways" or "prototype this". PMOS answers with one ✦ under the initiative: "PMOS will show 3 ways", with one line for each direction it chose. Nothing is made yet.
|
|
198
|
-
2. **Press ✓ on that ✦.** PMOS starts three runs at once, one version each. The card shows each version as soon as it opens and renders in a headless browser. A version that is still being made says so. A version that does not render, or that takes more than 2 minutes, shows as "not made" with the reason. A round took about a minute in the dry run on the Mac mini.
|
|
198
|
+
2. **Press ✓ on that ✦.** PMOS starts three runs at once, one version each. The card shows each version as soon as it opens and renders in a headless browser. A version that is still being made says so. A version that does not render, or that takes more than 2 minutes, shows as "not made" with the reason. The card has no ✓ while a version is still being made. Once every version has landed, ✓ opens the compare view, and you keep one there. A round took about a minute in the dry run on the Mac mini.
|
|
199
199
|
3. **Give feedback in one sentence.** For example, "B, but lead with the risk, fewer rows". PMOS files one ✦: "Round 2 of B: …". Its ✓ makes one new version of B, which reads the last one.
|
|
200
200
|
4. **Compare and keep one.** Press a thumbnail to open the compare view. It shows A, B and C side by side, with each round in History. Press a column to pick it, then ✓ keeps that version as the initiative's kept specimen. ✕ drops a round, and you can say why.
|
|
201
|
+
5. **Find it again.** The **Specimens** line of the Experiment card names every version of the newest round, for example "Round 1 · A, B, C are made · none kept yet". Press it to open the compare view, also for a round you kept or dropped.
|
|
201
202
|
|
|
202
203
|
What each part does:
|
|
203
204
|
|
package/workspace/guide/notes.md
CHANGED
|
@@ -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.
|
|
@@ -283,4 +283,20 @@ function compareOf(P, id, { key = '', titleOf = () => '', proven = PROVEN } = {}
|
|
|
283
283
|
return { ini: p.ini, board: p.board || '', id: p.id, sig: PRsig(p), state: stateOf(p), title: name, round, key: k, say, columns: cols, pins, history, ...(live ? { live: true, working: (p.data.live.slots || []).some((s) => s.state === 'working' || s.state === 'proving') } : {}) };
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
/** PURE. The initiative's prototype rounds, newest first, open or not: a kept or dropped round stays reachable from the initiative page
|
|
287
|
+
* (2026-11-17: a round kept too early left no way to its compare view). Each: { id, at, state, keys, made, rounds, working }. */
|
|
288
|
+
function roundsOf(P, ini) {
|
|
289
|
+
if (!P || !ini) return [];
|
|
290
|
+
const keptP = new Set(); for (const k of P.kept) if (!P.undone.has(k.batch)) for (const x of k.ids) keptP.add(x);
|
|
291
|
+
const PRsig = require('./proposals.js').sigOf;
|
|
292
|
+
const stateOf = (x) => (keptP.has(x.id) ? 'kept' : P.drops.has(PRsig(x)) ? 'dropped' : 'open');
|
|
293
|
+
const all = [...P.props.values()];
|
|
294
|
+
return all.filter((x) => x.group === 'prototyped' && x.ini === ini).sort((a, b) => String(b.at).localeCompare(String(a.at))).map((root) => {
|
|
295
|
+
const d = root.data || {}, slots = (d.live && d.live.slots) || [];
|
|
296
|
+
const keys = slots.length ? slots.filter((s) => s.state === 'ok' && s.file).map((s) => s.key) : (d.specimens || []).map((s) => s.key);
|
|
297
|
+
const n = 1 + all.filter((x) => x.group === 'improved' && x.ini === ini && x.data && x.data.of === root.id).length;
|
|
298
|
+
return { id: root.id, at: root.at, state: stateOf(root), keys, made: keys.length, rounds: n, working: slots.some((s) => s.state === 'working' || s.state === 'proving') };
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
module.exports = { LEDGER, GROUPS, TITLES, LOOSE, PROVEN, specimenDir, specimenPath, specimenUrl, result, loose, ledgerFile, readLines, read, append, fold, looseOpen, labOf, compareOf, roundsOf, fmtMs };
|
|
@@ -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) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[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,6 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* GET /api/lab?ws&board → { ok, lab } lab: lib/idle-lab.js labOf (null: nothing ran this week and nothing waits)
|
|
7
7
|
* GET /api/lab/compare?ws&board&id[&key] → { ok, compare } lib/idle-lab.js compareOf (404 when the prototype is gone)
|
|
8
|
+
* GET /api/lab/rounds?ws&initiative → { ok, rounds } lib/idle-lab.js roundsOf: every round of the initiative, newest first, open or not
|
|
8
9
|
* GET /api/lab/present?ws&board&id → { ok, present } lib/lab-present.js presentOf: the round's frames for present mode (GET /pm/present)
|
|
9
10
|
* GET /api/lab/specimen?file → text/html, a specimen from <runtime>/idle-lab/specimens/, served sandboxed (no scripts that can
|
|
10
11
|
* reach PMOS: CSP sandbox without allow-same-origin, no network but the fonts)
|
|
@@ -116,6 +117,14 @@ const READS = {
|
|
|
116
117
|
ctx.json(res, { ok: true, compare: c });
|
|
117
118
|
return true;
|
|
118
119
|
},
|
|
120
|
+
// the initiative page's Specimens line: every round, open or not, so a kept or dropped round can still open its compare view
|
|
121
|
+
'/api/lab/rounds': (ctx, res, url) => {
|
|
122
|
+
const w = wsOf(ctx, url.searchParams.get('ws')); if (!w) return fail(ctx, res, 404, 'no such workspace');
|
|
123
|
+
const dir = dirOf(ctx, w), ini = url.searchParams.get('initiative') || '';
|
|
124
|
+
if (!dir || !ID_RE.test(ini)) return fail(ctx, res, 400, 'initiative names an initiative');
|
|
125
|
+
ctx.json(res, { ok: true, rounds: LAB.roundsOf(PR.read(dir), ini) });
|
|
126
|
+
return true;
|
|
127
|
+
},
|
|
119
128
|
'/api/lab/present': (ctx, res, url) => {
|
|
120
129
|
const w = wsOf(ctx, url.searchParams.get('ws')); if (!w) return fail(ctx, res, 404, 'no such workspace');
|
|
121
130
|
const dir = dirOf(ctx, w), id = url.searchParams.get('id') || '';
|
|
@@ -81,6 +81,7 @@ function keepCore(ctx, p, g, f, ini, want, choices = {}, extra = {}) {
|
|
|
81
81
|
const w = applyOne(ctx, p, g, f, ini, x, choices, outbox);
|
|
82
82
|
if (x.group === 'build' && !w.length) { failed.push({ id: x.id, why: x.failed || 'not opened' }); continue; } // stays open, says why
|
|
83
83
|
if (x.group === 'live' && !w.length) { failed.push({ id: x.id, why: x.failed || 'the round did not start' }); continue; } // stays open, says why
|
|
84
|
+
if ((x.group === 'prototyped' || x.group === 'improved') && !w.length && x.failed) { failed.push({ id: x.id, why: x.failed }); continue; } // a round still being made stays open
|
|
84
85
|
wrote.push(...w);
|
|
85
86
|
if (x.group === 'dates' && x.plan && w.some((y) => y.op === 'dates')) plans++;
|
|
86
87
|
keptIds.push(x.group === 'dates' ? x.id + ':' + x.sig : x.id);
|
|
@@ -307,6 +308,9 @@ function applyOne(ctx, p, g, f, ini, x, choices, outbox) {
|
|
|
307
308
|
// experiment's kept specimen; then the grill runs once on it, as the Review step (D60 as amended 2026-11-17: grill after the session).
|
|
308
309
|
const LAB = require('./idle-lab.js'), d = x.data || {}, name = (sp) => 'Prototype ' + sp.key + ' · ' + sp.title;
|
|
309
310
|
const live = !!d.live, pick = live && choices && typeof choices[x.id] === 'string' ? choices[x.id] : '';
|
|
311
|
+
// a round still being made cannot be kept: the card stays open and says so (2026-11-17: a second ✓ on the fresh round card kept
|
|
312
|
+
// nothing and closed it 20 s before the three versions landed)
|
|
313
|
+
if (live && (d.live.slots || []).some((y) => y.state === 'working' || y.state === 'proving')) { x.failed = 'PMOS is still making this round. ✓ comes back when every version has landed.'; return wrote; }
|
|
310
314
|
const docOf = (title, ref, kind) => add({ op: 'doc', id: 'fd-' + PR.hash(ini + '|' + x.id + '|' + (ref || title)), title: String(title).slice(0, 140), source: live ? 'PMOS, live round' : 'PMOS, while you were away', at: x.at || '', ref, kind, claude: true });
|
|
311
315
|
const keptOnes = [];
|
|
312
316
|
if (x.group === 'prototyped') for (const sp of (d.specimens || []).filter((y) => !pick || y.key === pick)) { docOf(name(sp), LAB.specimenUrl(sp.file), 'prototype'); keptOnes.push({ key: sp.key, title: sp.title, file: sp.file }); }
|
|
@@ -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
|
-
*
|
|
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
|
|
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.
|
|
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.
|
|
9
|
+
"version": "0.588.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -60,8 +60,12 @@ function srcLine(p) {
|
|
|
60
60
|
/** The ✦ card. why: the ✕ was pressed, so the card asks why before it drops. */
|
|
61
61
|
export function cardHtml(p, { why = false } = {}) {
|
|
62
62
|
const d = p.data || {}, id = esc(p.id);
|
|
63
|
+
// a live round still being made has no ✓: the round card takes the ask's place with ✓ in the same spot, and on 2026-11-17 a second
|
|
64
|
+
// tap kept an unfinished round and closed the card (the server refuses the same keep). ✓ returns when every version has landed.
|
|
65
|
+
const making = !!(d.live && (d.live.slots || []).some((x) => x.state === 'working' || x.state === 'proving'));
|
|
63
66
|
const acts = (p.group !== 'scanned' ? ib(`data-lab-open="${id}"`, 'Compare it with production and the design', I.open) : '')
|
|
64
|
-
+ ib(`data-lab-why="${id}" aria-expanded="${why}"`, 'Drop it', I.x)
|
|
67
|
+
+ ib(`data-lab-why="${id}" aria-expanded="${why}"`, 'Drop it', I.x)
|
|
68
|
+
+ (making ? '' : d.live ? ib(`data-lab-open="${id}"`, 'Keep one: open the compare view and pick it there', I.check, 'ok') : ib(`data-pp-keep="${id}"`, 'Keep it', I.check, 'ok'));
|
|
65
69
|
let head = '', body = '';
|
|
66
70
|
if (p.group === 'live') {
|
|
67
71
|
// the live round's ask: ✓ starts it, ✕ asks why first. Nothing is made before ✓.
|
|
@@ -79,7 +79,22 @@ const one = (a, f) => { const v = a && a.fields && a.fields[f]; return v && !Arr
|
|
|
79
79
|
const list = (a, f) => { const v = a && a.fields && a.fields[f]; return Array.isArray(v) ? v.filter((x) => x && x.text) : []; };
|
|
80
80
|
const carried = (a, f) => ((a && a.carried) || []).filter((c) => c.field === f && c.text);
|
|
81
81
|
|
|
82
|
-
/** The
|
|
82
|
+
/** The Specimens row. rounds: GET /api/lab/rounds (newest first, open or not). With a round, the row names every version that landed and opens
|
|
83
|
+
* the compare view (lab: the round's id), so a round kept or closed too early stays reachable (2026-11-17). Without one, the artefact's words. */
|
|
84
|
+
function specimensRow(kept, tries, rounds) {
|
|
85
|
+
const R = Array.isArray(rounds) && rounds.length ? rounds[0] : null;
|
|
86
|
+
if (R && (R.keys.length || R.working)) {
|
|
87
|
+
const made = R.keys.length ? R.keys.join(', ') + (R.keys.length === 1 ? ' is made' : ' are made') : 'none made yet';
|
|
88
|
+
const n = rounds.length > 1 ? rounds.length + ' rounds' : R.rounds > 1 ? R.rounds + ' rounds' : 'Round 1';
|
|
89
|
+
const text = n + ' · ' + made + (R.working ? ', more on the way' : '') + (kept ? ' · kept: ' + kept.text : R.state === 'kept' ? ' · you kept this round' : R.state === 'dropped' ? ' · you dropped this round' : ' · none kept yet');
|
|
90
|
+
return { key: 'specimens', label: 'Specimens', text, by: (kept && kept.by) || '', at: (kept && kept.at) || R.at || '', edit: null, lab: R.id };
|
|
91
|
+
}
|
|
92
|
+
if (kept) return { key: 'specimens', label: 'Specimens', text: 'Kept: ' + kept.text + (tries.length > 1 ? ' (of ' + tries.length + ' attempts)' : ''), by: kept.by || '', at: kept.at || '', edit: null };
|
|
93
|
+
if (tries.length) return { key: 'specimens', label: 'Specimens', text: tries.length + (tries.length === 1 ? ' attempt' : ' attempts') + ', none kept yet: ' + tries[tries.length - 1].text, by: '', at: tries[tries.length - 1].at || '', edit: null };
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The Viewer's model. art: GET /api/artefacts answer for scope experiment:<id>; auto: GET /api/autonomy answer; o: { now, ahead, rounds }. */
|
|
83
98
|
export function agentModel(A, U, id, o = {}) {
|
|
84
99
|
const now = o.now || Date.now();
|
|
85
100
|
const X = art(A, 'experiment'), S = art(A, 'specimens'), T = art(A, 'done-test');
|
|
@@ -92,8 +107,7 @@ export function agentModel(A, U, id, o = {}) {
|
|
|
92
107
|
row('kill', 'Stop if', kill, { artefact: 'experiment', field: 'kill' }),
|
|
93
108
|
row('budget', 'Budget', budget, { artefact: 'experiment', field: 'budget' }),
|
|
94
109
|
ex ? { key: 'executor', label: 'Who builds', text: whoText(ex.text, factory), value: ex.text, by: ex.by || '', at: ex.at || '', edit: { artefact: 'experiment', field: 'executor', pick: picks(factory, ex.text) } } : null,
|
|
95
|
-
|
|
96
|
-
: tries.length ? row('specimens', 'Specimens', { text: tries.length + (tries.length === 1 ? ' attempt' : ' attempts') + ', none kept yet: ' + tries[tries.length - 1].text, at: tries[tries.length - 1].at }) : null,
|
|
110
|
+
specimensRow(kept, tries, o.rounds),
|
|
97
111
|
checks.length ? { key: 'done', label: 'Done when', text: checks.map((c) => c.text).join(' · '), sub: result ? 'Result: ' + result.text : '', at: checks[checks.length - 1].at || '', edit: null } : null,
|
|
98
112
|
].filter(Boolean);
|
|
99
113
|
// the newest line Claude wrote dates the section: "Claude keeps it · 3 Nov"
|
|
@@ -169,6 +183,7 @@ export function expHtml(M, kind) {
|
|
|
169
183
|
const rowHtml = (r) => {
|
|
170
184
|
const val = `<span class="ia-v">${esc(r.text)}${r.sub ? `<small>${esc(r.sub)}</small>` : ''}</span>`;
|
|
171
185
|
return r.edit ? `<button type="button" class="ia-xr" data-ia-edit="${esc(r.key)}" aria-label="${esc(r.label + ': ' + r.text + '. Edit')}" title="Edit"><b>${esc(r.label)}</b>${val}</button>`
|
|
186
|
+
: r.lab ? `<button type="button" class="ia-xr" data-ia-lab="${esc(r.lab)}" aria-label="${esc(r.label + ': ' + r.text + '. Open the compare view')}" title="Open the compare view"><b>${esc(r.label)}</b>${val}</button>`
|
|
172
187
|
: `<div class="ia-xr"><b>${esc(r.label)}</b>${val}</div>`;
|
|
173
188
|
};
|
|
174
189
|
return `<section class="ia-sec" aria-label="Experiment" data-ia-exp><div class="ia-th"><b>Experiment</b><span class="n"><b>${esc(KIND[k])}</b>${esc(' · PMOS wrote it' + (M.exp.at ? ' · ' + dm(M.exp.at) : ''))}</span></div>`
|
|
@@ -223,9 +238,10 @@ export function want(ws, id, done, title) {
|
|
|
223
238
|
const q = ws ? 'ws=' + encodeURIComponent(ws) + '&' : '';
|
|
224
239
|
const p = Promise.all([pmGet('/api/artefacts?' + q + 'scope=' + encodeURIComponent('experiment:' + id)).catch(() => null), pmGet('/api/autonomy' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null),
|
|
225
240
|
pmGet('/api/autonomy/ahead?' + q + 'ini=' + encodeURIComponent(id) + (title ? '&title=' + encodeURIComponent(title) : '')).catch(() => null),
|
|
226
|
-
pmGet('/api/kind-control?' + q + 'ini=' + encodeURIComponent(id)).catch(() => null)
|
|
227
|
-
|
|
228
|
-
|
|
241
|
+
pmGet('/api/kind-control?' + q + 'ini=' + encodeURIComponent(id)).catch(() => null),
|
|
242
|
+
pmGet('/api/lab/rounds?' + q + 'initiative=' + encodeURIComponent(id)).catch(() => null)])
|
|
243
|
+
.then(([a, u, h, k, r]) => {
|
|
244
|
+
const M = agentModel(a && a.ok ? a : null, u && u.ok ? u : null, id, { ahead: h && h.ok ? h : null, rounds: r && r.ok ? r.rounds : null });
|
|
229
245
|
const C = k && k.ok && k.kind !== 'product' ? k : null;
|
|
230
246
|
const was = JSON.stringify([cached(id), cachedControl(id)]);
|
|
231
247
|
CACHE.set(id, { M, C, at: Date.now() });
|
|
@@ -483,6 +483,8 @@ export function wireView(body, h) {
|
|
|
483
483
|
const d = b.dataset;
|
|
484
484
|
// agent-run (AwB): edit a line of the experiment, Undo a change of Claude's, the rest of Claude's work
|
|
485
485
|
if (d.iaEdit) { e.preventDefault(); IA.edit(b); return; }
|
|
486
|
+
// the Specimens line opens the newest round's compare view, kept or not (2026-11-17: a round kept too early had no way back)
|
|
487
|
+
if (d.iaLab) { e.preventDefault(); import('./cozy-lab.js').then((LC) => LC.openCompare({ where: { ws: wsOf(), board: (H.where && H.where().board) || '' }, id: d.iaLab, H: { toast: (body.__iv || {}).toast, reload: () => { IA.forget(id); IA.want(wsOf(), id, () => paintAgent(id)); } } })); return; }
|
|
486
488
|
if ('iaCancel' in d) { e.preventDefault(); paintAgent(id); return; }
|
|
487
489
|
if (d.iaUndo) { e.preventDefault(); IA.undo(b, wsOf(), () => paintAgent(id), H.toast); return; }
|
|
488
490
|
if ('iaMore' in d) { e.preventDefault(); IA.toggleMore(id); paintAgent(id); return; }
|
|
@@ -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) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[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) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[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
|
|
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) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[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
|
-
|
|
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="
|
|
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
|
|
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
|
|
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
|
}
|
package/workspace/server.js
CHANGED
|
@@ -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
|
+
}
|