create-pmos 0.390.0 → 0.392.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 +30 -30
- 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 +29 -0
- package/workspace/guide/briefing-premium.md +2 -2
- package/workspace/guide/phone-companion.md +10 -1
- package/workspace/lib/chat-file-locate.js +28 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-report-read-test.js +4 -2
- package/workspace/public/pm/audio-capture.js +7 -5
- package/workspace/public/pm/notes-capture-worklet.js +3 -2
- package/workspace/public/pm/notes-lock.js +66 -0
- package/workspace/public/pm/premium-insights.js +9 -6
- package/workspace/public/pm/premium-meeting.js +2 -1
- package/workspace/public/pm/view-notes.js +92 -5
- package/workspace/server.js +25 -5
- package/workspace/test-lists/meeting-notes.json +8 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.392.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": {
|
|
@@ -32,6 +32,35 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.392.0",
|
|
37
|
+
"at": "2026-10-22T04:00:27.581Z",
|
|
38
|
+
"f": 2,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 1006,
|
|
42
|
+
"t": "Files Claude wrote in a git worktree open in the chat viewer",
|
|
43
|
+
"s": "Files Claude wrote in a git worktree open in the chat viewer"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"v": "0.391.0",
|
|
49
|
+
"at": "2026-10-22T03:35:32.308Z",
|
|
50
|
+
"f": 2,
|
|
51
|
+
"prs": [
|
|
52
|
+
{
|
|
53
|
+
"n": 1004,
|
|
54
|
+
"t": "Hide archived report cycles on Insights",
|
|
55
|
+
"s": "Hide archived report cycles on Insights"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"n": 1005,
|
|
59
|
+
"t": "Keep recording through a phone lock",
|
|
60
|
+
"s": "Keep recording through a phone lock"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
35
64
|
{
|
|
36
65
|
"v": "0.390.0",
|
|
37
66
|
"at": "2026-10-22T02:01:40.673Z",
|
|
@@ -267,35 +296,6 @@
|
|
|
267
296
|
"s": "Calmer Briefing first screen: mic, calendar ⋯, pin on hover (calmer first screen 5/5)"
|
|
268
297
|
}
|
|
269
298
|
]
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
"v": "0.372.0",
|
|
273
|
-
"at": "2026-10-21T02:53:20.808Z",
|
|
274
|
-
"f": 2,
|
|
275
|
-
"prs": [
|
|
276
|
-
{
|
|
277
|
-
"n": 981,
|
|
278
|
-
"t": "The Board's first screen has quiet chips, not two segmented rows (calmer first screen 4/5)",
|
|
279
|
-
"s": "The Board's first screen has quiet chips, not two segmented rows (calmer first screen 4/5)"
|
|
280
|
-
}
|
|
281
|
-
]
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
"v": "0.371.0",
|
|
285
|
-
"at": "2026-10-21T02:38:31.758Z",
|
|
286
|
-
"f": 2,
|
|
287
|
-
"prs": [
|
|
288
|
-
{
|
|
289
|
-
"n": 979,
|
|
290
|
-
"t": "Each Briefing card names the reads it shows and when (briefing-source-flow, slice 5)",
|
|
291
|
-
"s": "Each card says which reads it shows and when they were read, as in the approved mockup."
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
"n": 978,
|
|
295
|
-
"t": "Quiet the standing chat note until the box has focus (calmer first screen 3/5)",
|
|
296
|
-
"s": "Quiet the standing chat note until the box has focus (calmer first screen 3/5)"
|
|
297
|
-
}
|
|
298
|
-
]
|
|
299
299
|
}
|
|
300
300
|
]
|
|
301
301
|
}
|
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-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-22T04:00:24Z"}
|
|
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-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-22T04:00:24Z"}
|
|
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-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-22T04:00:24Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.392.0",
|
|
4
|
+
"at": "2026-10-22T04:00:27.581Z",
|
|
5
|
+
"f": 2,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1006,
|
|
9
|
+
"t": "Files Claude wrote in a git worktree open in the chat viewer",
|
|
10
|
+
"s": "Files Claude wrote in a git worktree open in the chat viewer"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"v": "0.391.0",
|
|
16
|
+
"at": "2026-10-22T03:35:32.308Z",
|
|
17
|
+
"f": 2,
|
|
18
|
+
"prs": [
|
|
19
|
+
{
|
|
20
|
+
"n": 1004,
|
|
21
|
+
"t": "Hide archived report cycles on Insights",
|
|
22
|
+
"s": "Hide archived report cycles on Insights"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"n": 1005,
|
|
26
|
+
"t": "Keep recording through a phone lock",
|
|
27
|
+
"s": "Keep recording through a phone lock"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
2
31
|
{
|
|
3
32
|
"v": "0.390.0",
|
|
4
33
|
"at": "2026-10-22T02:01:40.673Z",
|
|
@@ -357,7 +357,7 @@ Insights is the fifth place on the rail, at `/premium-insights.html`. It reads t
|
|
|
357
357
|
- **Charts.** One chart for each KR metric that holds at least two readings. The line runs through the readings at their dates, so a month with no reading is a gap and not a zero. The dashed line is the metric's target. The chip is the record's own line status: on its line, behind it, or well behind it. Pressing a chart, or its Details link, opens the metric's record in the dialog with the read-only agent beside it.
|
|
358
358
|
- **The insight.** The page opens with one finding across the board's measures, in a large line, with the reason and its numbers under it, up to two more findings, **Ask PMOS why** (opens the measure's dialog on the Conversation tab) and **See the chart**. A measure that is short of its target, with a target date after its last reading, gets a projection: a straight line through its last four readings (all, when fewer), carried to the target date. When the line lands short, the finding says the measure will miss its target on that date at this pace, where it lands, how far short, and when it would get there. When the line lands on or past the target, it says the measure is on course. The page says how the projection is made, and no forecast line is drawn on a chart. With no KR metric, or none with two readings, the page says there is no insight yet and why.
|
|
359
359
|
- **The pinned dashboard.** The card under the insight shows the pinned dashboard: its insight band (the next findings on it, past the one the page leads with), and its charts. Its **⋯** holds **Unpin** (or **Pin**, with Not pinned when nothing is pinned), **Back to** the pinned one, **Edit** and **New chart**, and its **ⓘ** says what the dashboard is for. When nothing can be charted yet, the card is hidden and All measures is a row of the list; the insight's explanation is then behind the **ⓘ** next to Insight. Pressing a dashboard in the list shows it in this card. One dashboard per board is pinned, All measures included; pillar groups cannot be pinned. The pin is a line in `premium-dashboards.jsonl` and shows on Insights only.
|
|
360
|
-
- **Dashboards and reports.** One list holds the dashboards (All measures, your saved ones, then the pillars the metrics name) and then the reports (your set-up reports, then the report files). One chip in the card's head (**All** with its count) opens **All**, **Dashboards** and **Reports**, and shows only when the list holds both kinds; it shows six rows to a page, with page numbers. A dashboard row shows its top finding and a pin. A report has one row, whatever number of cycles it has: the row quotes the opening sentence of its latest cycle and counts its cycles (for example **1 draft**, **3 issued
|
|
360
|
+
- **Dashboards and reports.** One list holds the dashboards (All measures, your saved ones, then the pillars the metrics name) and then the reports (your set-up reports, then the report files). One chip in the card's head (**All** with its count) opens **All**, **Dashboards** and **Reports**, and shows only when the list holds both kinds; it shows six rows to a page, with page numbers. A dashboard row shows its top finding and a pin. A report has one row, whatever number of cycles it has: the row quotes the opening sentence of its latest cycle and counts its cycles (for example **1 draft**, **3 issued**). Archived cycles are hidden here: a report whose cycles are all archived has no row (a set-up report keeps its set-up row). An archived cycle is still listed under **Archived** in the report's cycle chip. A set-up report with no file says no draft is written yet. **New** offers **Dashboard** or **Report**. Your requests and what PMOS found in your work stay at the top of the list. A saved dashboard draws its charts in the order you saved them. A chart whose record is gone, or that has fewer than two readings, is listed in its place with the reason and is not drawn.
|
|
361
361
|
- **Make or change a dashboard, a chart or a report in a chat.** There is no Insight Studio. **+**, then **Dashboard** or **Report**, and **New chart** in the dashboard's **⋯**, open the Chat page with a first line in the message box ("Make a dashboard of ") for you to finish and send. **Edit** on a saved dashboard or one of your charts, and **Shape it in a chat** on a report drawn from your work, open the Chat page with it in its tab beside the conversation. See [Reports from a chat](#reports-from-a-chat).
|
|
362
362
|
- **The findings.** Each finding is one sentence with its reason, taken from the series: will miss its target at this pace, on course, behind its line for three readings in a row, behind and still moving away from the target, closing in, slipped, reached its target, or a large one-step move. No cause is given.
|
|
363
363
|
- **Board measures.** The same four tiles as the Board's Metrics card, counted from the board's repository and drawn the same way. Choose **8 weeks**, **26 weeks** or **52 weeks**; the page keeps your choice. Press a measure to read its definition and values and to set its target: type a number and press **Save target**, or press **Clear target**. For Corrections, Blocked and Idle, lower is better, so the target is the most you accept; for Merged a week it is the least. The target goes to the workspace's state folder (`board-metric-targets.jsonl`) and the Board draws it too. An agent session cannot set one.
|
|
@@ -435,7 +435,7 @@ Every popup has this chat, including the ones that have no row of their own: a t
|
|
|
435
435
|
- **Stop** shows while Claude works. It presses Esc in the session.
|
|
436
436
|
- **The conversation** is Claude Code's own record, word for word. Claude's answers are formatted as Claude Code formats them: headings, bold, lists, code, tables, quotes and links (links open in a new tab). Your messages keep their line breaks, and a paste shows without the tags Claude Code wraps around it. A run of tool calls shows as one small grey line, for example "Used Read ×2, slack_read_thread". A connector tool shows its short name.
|
|
437
437
|
- **While a session runs**, the panel reads it again every 2 seconds and changes only when there is something new. The messages already on screen stay still, so nothing blinks beside the viewer.
|
|
438
|
-
- **A file Claude names** (a path such as `briefs/drafts/plan.md`, or a link to one) is underlined. Press it to read the file beside the conversation, as a tab in the viewer; on a phone, the Detail side shows it (on the Chat page, the viewer opens over the conversation). Markdown shows as a page, an HTML file shows as the page it draws (press **Source** for its code), and other text files show as code. An HTML page runs its own scripts, so its toggles and charts work, but it cannot reach PMOS or the internet: a web font falls back to the system font. It is read-only. While the tab is open it shows the newest version, so a file Claude is still writing stays current. A file
|
|
438
|
+
- **A file Claude names** (a path such as `briefs/drafts/plan.md`, or a link to one) is underlined. Press it to read the file beside the conversation, as a tab in the viewer; on a phone, the Detail side shows it (on the Chat page, the viewer opens over the conversation). Markdown shows as a page, an HTML file shows as the page it draws (press **Source** for its code), and other text files show as code. An HTML page runs its own scripts, so its toggles and charts work, but it cannot reach PMOS or the internet: a web font falls back to the system font. It is read-only. While the tab is open it shows the newest version, so a file Claude is still writing stays current. A file in a workspace PMOS serves, in a git worktree of one, or in the folder a session runs in opens here. Any other file says "Not in a workspace" and is not read.
|
|
439
439
|
- **Download a file** with the download icon at the right of its name in the viewer. An HTML file saves as **HTML** (as it is) or **PDF**. A markdown file saves as **Markdown**, **Word .docx** or **PDF**. Other text files save at once as they are, with no menu. PDF opens your browser's print window: choose **Save as PDF** there. An HTML page prints with no access to PMOS or the internet, as in the viewer. Word holds the note's headings, paragraphs, lists and tables.
|
|
440
440
|
- **Share a file** with the share icon beside download. On a phone, **Send a copy** comes first: it opens the phone's share sheet with the file, and no link is made. **Public link** makes a link to a copy of the file as it is now, for someone with no PMOS or Cloudflare login. The password is on, with a generated one you can change or turn off. The link ends after 7 days; press **1 day** or **30 days** to change it. Press **Create link**, then **Copy link and password**, and send the password in a different message. The same popover lists your **open links** with their end date and views; **Turn off** (pressed twice) deletes the copy at once. A file with a key or token in it is not shared. Links need Online and one more tunnel rule: see REMOTE.md, "Share links".
|
|
441
441
|
- **What an answer worked with** shows as buttons under it: the files Claude wrote, changed or read, the Jira tickets and Slack channels it used, and the links it named. The first one is the main one: a file Claude wrote comes first, then what it named in its words, then what it only read. When an answer finishes while the chat is open, its main one opens in the viewer by itself, once; answers that were there when you opened the chat open nothing. On a phone a bar over the message box offers it instead (**View**), so the conversation stays in view. A Jira ticket shows what PMOS last read from Jira for a board or initiative it syncs, with **Open in Jira**; a ticket PMOS has not read says so. A Slack channel or message opens with **Open in Slack**, as PMOS keeps no copy of Slack messages.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Guide: the phone companion"
|
|
4
4
|
description: "At phone width the console shows a companion: one moment of your day, your items one at a time, Tell PMOS and Record."
|
|
5
|
-
timestamp: 2026-10-
|
|
5
|
+
timestamp: 2026-10-22
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Guide: the phone companion
|
|
@@ -48,6 +48,15 @@ Type a note, a to-do or an idea in the bar at the bottom and press Enter. PMOS p
|
|
|
48
48
|
|
|
49
49
|
The red button records a conversation or a meeting with the same recorder as **Record** on the desktop. When the recording starts, the phone opens focus.
|
|
50
50
|
|
|
51
|
+
### When the phone locks
|
|
52
|
+
|
|
53
|
+
A web page cannot record while the phone is locked. Keep the PMOS screen open during a meeting.
|
|
54
|
+
|
|
55
|
+
- While it records, PMOS keeps the screen on, so the phone does not lock by itself. If the power button locks the phone, or you go to another app, the recording pauses.
|
|
56
|
+
- When you come back to PMOS, the recording continues in the same note. PMOS tells you how long the gap was. The replay has silence for the gap, and the times of the later lines stay correct.
|
|
57
|
+
- If the phone asks for a tap first, PMOS shows **Tap anywhere on the page to go on recording**. Tap the page once.
|
|
58
|
+
- Battery saver can stop PMOS from keeping the screen on. Then set a longer screen lock time in the phone's settings, or keep the phone awake by hand.
|
|
59
|
+
|
|
51
60
|
## Focus
|
|
52
61
|
|
|
53
62
|
Focus shows the meeting on one screen. You do not scroll it. From the top:
|
|
@@ -9,9 +9,16 @@
|
|
|
9
9
|
* base the session's own workspace id: a relative path resolves against its root.
|
|
10
10
|
* home the user's home folder, for ~/.
|
|
11
11
|
* reason: 'outside' (no served workspace holds the path), 'missing' (no such file), 'not-file' (a folder), 'bad' (no path).
|
|
12
|
-
* Both the path and each root are resolved to their real paths, so a symlink inside a workspace cannot lead out of it.
|
|
12
|
+
* Both the path and each root are resolved to their real paths, so a symlink inside a workspace cannot lead out of it.
|
|
13
|
+
*
|
|
14
|
+
* extraRoots({ workspaces, worktreesOf, sessionDirs, home }) -> [{ id, root }]
|
|
15
|
+
* The folders an agent session writes in that are not served workspaces (PM, 2026-10-22: files Claude wrote in a git worktree of pmos-idpf showed
|
|
16
|
+
* "Not in a workspace"). Two kinds only, so no other file on the machine becomes readable: the linked git worktrees of a served workspace's
|
|
17
|
+
* repository (the same repository, checked out in another folder) and the working folders of live sessions. Each gets a stable id `wt-<hash>`
|
|
18
|
+
* that GET /api/doc reads under the same root guard as a workspace. */
|
|
13
19
|
const fs = require('fs');
|
|
14
20
|
const path = require('path');
|
|
21
|
+
const crypto = require('crypto');
|
|
15
22
|
|
|
16
23
|
const inside = (root, p) => p === root || p.startsWith(root.endsWith(path.sep) ? root : root + path.sep);
|
|
17
24
|
const real = (p) => { try { return fs.realpathSync(p); } catch { return null; } };
|
|
@@ -46,4 +53,23 @@ function locate({ path: raw, roots = [], base = null, home = null } = {}) {
|
|
|
46
53
|
return { ok: true, ws: w.id, rel, abs: path.join(w.root, rel), name: path.basename(r), size: st.size, mtime: st.mtimeMs };
|
|
47
54
|
}
|
|
48
55
|
|
|
49
|
-
|
|
56
|
+
/** The id a non-workspace root is read under. Pure. */
|
|
57
|
+
const extraId = (root) => 'wt-' + crypto.createHash('sha1').update(path.resolve(root)).digest('hex').slice(0, 12);
|
|
58
|
+
|
|
59
|
+
/** Worktrees of the served repositories and live session folders, minus the served workspaces themselves. worktreesOf(root) -> [dir]. */
|
|
60
|
+
function extraRoots({ workspaces = [], worktreesOf = () => [], sessionDirs = [], home = null } = {}) {
|
|
61
|
+
const served = new Set(workspaces.filter((w) => w && w.root).map((w) => path.resolve(w.root)));
|
|
62
|
+
const seen = new Set(), out = [];
|
|
63
|
+
const add = (d) => {
|
|
64
|
+
if (!d || typeof d !== 'string' || !path.isAbsolute(d)) return;
|
|
65
|
+
const r = path.resolve(d);
|
|
66
|
+
if (served.has(r) || seen.has(r) || r === path.parse(r).root) return; // never the filesystem root
|
|
67
|
+
if (home && (r === path.resolve(home) || inside(r, path.resolve(home)))) return; // never the home folder or a folder above it
|
|
68
|
+
seen.add(r); out.push({ id: extraId(r), root: r });
|
|
69
|
+
};
|
|
70
|
+
for (const w of workspaces) { if (!w || !w.root) continue; let ds = []; try { ds = worktreesOf(w.root) || []; } catch { ds = []; } ds.forEach(add); }
|
|
71
|
+
sessionDirs.forEach(add);
|
|
72
|
+
return out;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = { locate, cleanPath, extraRoots, extraId };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.392.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.392.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -110,9 +110,10 @@ fs.writeFileSync(path.join(base, 'brand.png'), PNG);
|
|
|
110
110
|
await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#rdSlide')));
|
|
111
111
|
ok('O1 a document row opens the reader on the page, not the console', p.url().includes('/premium-insights.html') && await p.evaluate(() => document.querySelector('#dlg').classList.contains('rdrd')), p.url());
|
|
112
112
|
ok('O2 the dialog names the report, its date and its state', await p.textContent('#dTitle') === CAD && /2026-10-12|12 Oct/.test(await p.textContent('#dSub')) && /draft/.test(await p.textContent('#dEye')), await p.textContent('#dEye'));
|
|
113
|
-
|
|
113
|
+
await p.evaluate(() => document.fonts.ready); await until(() => p.evaluate(() => !!document.querySelector('#oMain .rdbar [data-rr="sched"]'))); // the schedule chip lands after the template read; measure the finished row
|
|
114
|
+
const bar = await p.evaluate(() => { const L = [...document.querySelectorAll('#oMain .rdbar > *')].filter((x) => x.offsetWidth && x.offsetHeight), c = L.map((x) => { const r = x.getBoundingClientRect(); return r.top + r.height / 2; }); return { spread: Math.round(Math.max(...c) - Math.min(...c)), words: [...document.querySelectorAll('#oMain .rdbar .rdib')].filter((b) => b.textContent.trim() || !b.getAttribute('aria-label') || !b.title).length }; }); // one row: every item's centre within a few px (the empty spacer is left out)
|
|
114
115
|
await shot('reader-bar-1280');
|
|
115
|
-
ok('O3 the bar is one row of icon buttons, each named by its label and tooltip', bar.
|
|
116
|
+
ok('O3 the bar is one row of icon buttons, each named by its label and tooltip', bar.spread <= 6 && bar.words === 0, JSON.stringify(bar));
|
|
116
117
|
ok('O4 no source line, no design row and no Add a sample in the report pane', await p.evaluate(() => !document.querySelector('#rdSrc') && !document.querySelector('.rdz') && !document.querySelector('#oMain [data-rr="pick"]')));
|
|
117
118
|
/* C: the cycle chip under the name lists this report's cycles, grouped */
|
|
118
119
|
await p.click('#dSub [data-rr="cycm"]');
|
|
@@ -277,6 +278,7 @@ fs.writeFileSync(path.join(base, 'brand.png'), PNG);
|
|
|
277
278
|
ok('A1 Archive first asks, and posts nothing', await until(() => p.$('[data-ask-bar="archive"]')) && posts.length === b2);
|
|
278
279
|
await tap('#oMain [data-rr="askok"]');
|
|
279
280
|
ok('A2 Archive it posts the archive route and the chip says Archived', await until(() => p.evaluate(() => /Archived/.test(document.querySelector('#oMain .rdst').textContent)), 8000) && posts.slice(b2).join() === '/api/report-documents/archive', posts.slice(b2).join());
|
|
281
|
+
ok('A2b Insights hides the archived cycle: the row counts 1 issued and says nothing of archived (PM 2026-10-22)', await until(() => p.evaluate((r) => { const t = document.querySelector(r).textContent; return /1 issued/.test(t) && !/archived/i.test(t); }, ROW), 8000), await p.textContent(ROW));
|
|
280
282
|
await tap('#oMain [data-rr="mo"]'); await tap('#oMain [data-rr="unarchive"]');
|
|
281
283
|
ok('A3 Bring back undoes it', await until(() => p.evaluate(() => !/Archived/.test(document.querySelector('#oMain .rdst').textContent)), 8000));
|
|
282
284
|
ok('F3 no page error', errs.length === 0, errs.join(' | '));
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
*
|
|
3
3
|
* makeResampler(inRate) a stateful low-pass resampler: push(float32 block) → Int16Array at 16 kHz, flush() → the tail
|
|
4
4
|
* toInt16(input, inRate) one block, whole: the same filter, run once. Pure.
|
|
5
|
-
* openCapture(ac, src, sink, onBlock) → { mode, node } an AudioWorklet that hands float32 blocks to onBlock
|
|
5
|
+
* openCapture(ac, src, sink, onBlock) → { mode, node } an AudioWorklet that hands float32 blocks to onBlock(block, stamp), stamp
|
|
6
|
+
* being the audio clock at the block's end in seconds;
|
|
6
7
|
* a ScriptProcessor does the same where the browser has no worklet
|
|
7
8
|
*
|
|
8
9
|
* WHY A FILTER. A context that cannot run at 16 kHz gives 44.1 or 48 kHz blocks. Averaging the samples under each output sample
|
|
@@ -83,20 +84,21 @@ export function toInt16(input, inRate) {
|
|
|
83
84
|
return out;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
/** Take blocks of the first channel from `src` and give each to onBlock as a Float32Array
|
|
87
|
-
* graph pulling. Returns { mode: 'worklet' | 'script', node }
|
|
87
|
+
/** Take blocks of the first channel from `src` and give each to onBlock as a Float32Array, with the audio clock at its end in seconds.
|
|
88
|
+
* `sink` is a muted node that keeps the graph pulling. Returns { mode: 'worklet' | 'script', node }; a source opened again later
|
|
89
|
+
* (a microphone after the phone was locked) is connected to the same node. */
|
|
88
90
|
export async function openCapture(ac, src, sink, onBlock) {
|
|
89
91
|
if (ac.audioWorklet && typeof AudioWorkletNode === 'function') {
|
|
90
92
|
try {
|
|
91
93
|
await ac.audioWorklet.addModule(new URL('./notes-capture-worklet.js', import.meta.url).href);
|
|
92
94
|
const node = new AudioWorkletNode(ac, 'notes-capture', { numberOfInputs: 1, numberOfOutputs: 1, channelCount: 1, channelCountMode: 'explicit' });
|
|
93
|
-
node.port.onmessage = (e) =>
|
|
95
|
+
node.port.onmessage = (e) => { const d = e.data; if (d && d.b) onBlock(d.b, d.t); else onBlock(d); };
|
|
94
96
|
src.connect(node); node.connect(sink);
|
|
95
97
|
return { mode: 'worklet', node };
|
|
96
98
|
} catch { /* the module did not load: the older route below */ }
|
|
97
99
|
}
|
|
98
100
|
const node = ac.createScriptProcessor(4096, 1, 1);
|
|
99
|
-
node.onaudioprocess = (e) => onBlock(new Float32Array(e.inputBuffer.getChannelData(0)));
|
|
101
|
+
node.onaudioprocess = (e) => onBlock(new Float32Array(e.inputBuffer.getChannelData(0)), e.playbackTime + e.inputBuffer.duration);
|
|
100
102
|
src.connect(node); node.connect(sink);
|
|
101
103
|
return { mode: 'script', node };
|
|
102
104
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* notes-capture-worklet.js — runs on the audio thread (notes-audio-quality R4). It copies the first channel of what it hears into
|
|
2
|
-
* blocks of 2048 samples and posts each block to the page, which resamples and sends it. It makes no sound.
|
|
2
|
+
* blocks of 2048 samples and posts each block to the page, which resamples and sends it. It makes no sound. Each block goes with the
|
|
3
|
+
* audio clock at its end (`t`, seconds), so the page can tell a stretch with no sound from a page that was only late (notes-lock.js). */
|
|
3
4
|
class NotesCapture extends AudioWorkletProcessor {
|
|
4
5
|
constructor() { super(); this.block = new Float32Array(2048); this.at = 0; }
|
|
5
6
|
process(inputs) {
|
|
@@ -7,7 +8,7 @@ class NotesCapture extends AudioWorkletProcessor {
|
|
|
7
8
|
if (!ch) return true;
|
|
8
9
|
for (let i = 0; i < ch.length; i++) {
|
|
9
10
|
this.block[this.at++] = ch[i];
|
|
10
|
-
if (this.at === this.block.length) { this.port.postMessage(this.block, [this.block.buffer]); this.block = new Float32Array(2048); this.at = 0; }
|
|
11
|
+
if (this.at === this.block.length) { this.port.postMessage({ b: this.block, t: currentTime + (i + 1) / sampleRate }, [this.block.buffer]); this.block = new Float32Array(2048); this.at = 0; }
|
|
11
12
|
}
|
|
12
13
|
return true;
|
|
13
14
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* notes-lock.js — a recording when the phone locks or the page goes to the background (notes-lock-recovery).
|
|
2
|
+
*
|
|
3
|
+
* makeGapClock({ gapMs }) one per source: block(n, rate, { nowMs, ctxSec, stamp }) → the ms of sound that never arrived
|
|
4
|
+
* before this block, or 0. Pure, for the suite.
|
|
5
|
+
* makeWakeLock(nav, doc) hold() asks the browser to keep the screen on; again() asks once more after the page is shown
|
|
6
|
+
* (the browser lets the lock go whenever the page is hidden); release() lets the screen sleep.
|
|
7
|
+
*
|
|
8
|
+
* WHAT A PHONE DOES. A web page cannot record while the phone is locked. iOS freezes the page and interrupts its AudioContext;
|
|
9
|
+
* Android may end the microphone track or let the page fall behind. When the PM unlocks the phone the page runs again, but
|
|
10
|
+
* the context stays interrupted until it is resumed and an ended track stays ended until it is opened again. Before this
|
|
11
|
+
* module the page did neither, so the recording stopped for good at the first lock, and audio that did come after it was
|
|
12
|
+
* written straight after the audio before it: every later line and the replay were early by the time the phone was locked.
|
|
13
|
+
*
|
|
14
|
+
* WHAT THE PAGE NOW DOES (view-notes.js startAudio). While it records it holds a screen wake lock, so the phone does not lock
|
|
15
|
+
* by itself. The press of the power button still locks it. When the page is shown again it resumes the context and opens an
|
|
16
|
+
* ended microphone again; when the browser wants a tap first, the next tap anywhere does it. The time that was missed is
|
|
17
|
+
* counted here, and the chunk offset jumps over it: the replay keeps silence there, the line times stay on the meeting
|
|
18
|
+
* clock, and the PM is told how long the gap was.
|
|
19
|
+
*
|
|
20
|
+
* WHICH TIME IS MISSING. Two cases, and they never overlap:
|
|
21
|
+
* the audio clock ran but no sound came (an input that ended, a context that kept time while it was interrupted): the
|
|
22
|
+
* block's own audio-thread time (`stamp`, the end of the block) is later than the end of the block before it plus this
|
|
23
|
+
* block's length;
|
|
24
|
+
* the audio clock stopped (an interrupted context that keeps no time): the wall clock moved further than the context's
|
|
25
|
+
* clock (`ctxSec`, read on the page when the block arrives) between two blocks.
|
|
26
|
+
* A page that was only late (a busy main thread that the audio thread did not wait for) gets a backlog of blocks with
|
|
27
|
+
* steady stamps, and both clocks move together, so it is not a gap. Under gapMs nothing is counted: that is jitter.
|
|
28
|
+
*/
|
|
29
|
+
export const GAP_MS = 2000;
|
|
30
|
+
|
|
31
|
+
export function makeGapClock({ gapMs = GAP_MS } = {}) {
|
|
32
|
+
let prev = null; // { now, ctx, stamp } of the block before, in ms
|
|
33
|
+
return {
|
|
34
|
+
block(n, rate, { nowMs, ctxSec, stamp } = {}) {
|
|
35
|
+
const len = (n / rate) * 1000;
|
|
36
|
+
const cur = { now: nowMs, ctx: Number.isFinite(ctxSec) ? ctxSec * 1000 : null, stamp: Number.isFinite(stamp) ? stamp * 1000 : null };
|
|
37
|
+
const p = prev; prev = cur;
|
|
38
|
+
if (!p) return 0;
|
|
39
|
+
const silent = cur.stamp !== null && p.stamp !== null ? cur.stamp - p.stamp - len : 0;
|
|
40
|
+
const stalled = cur.ctx !== null && p.ctx !== null ? (cur.now - p.now) - (cur.ctx - p.ctx) : 0;
|
|
41
|
+
const gap = (silent > gapMs ? silent : 0) + (stalled > gapMs ? stalled : 0);
|
|
42
|
+
return Math.round(gap);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function makeWakeLock(nav = typeof navigator !== 'undefined' ? navigator : null, doc = typeof document !== 'undefined' ? document : null) {
|
|
48
|
+
let want = false; let lock = null; let asking = null;
|
|
49
|
+
async function ask() {
|
|
50
|
+
if (!want || lock || asking || !nav || !nav.wakeLock || (doc && doc.visibilityState !== 'visible')) return;
|
|
51
|
+
asking = nav.wakeLock.request('screen').then((l) => {
|
|
52
|
+
if (!want) { l.release().catch(() => {}); return; }
|
|
53
|
+
lock = l;
|
|
54
|
+
l.addEventListener('release', () => { if (lock === l) lock = null; });
|
|
55
|
+
}).catch(() => { /* refused (battery saver, no permission): the screen may lock, and the page says what then happens */ })
|
|
56
|
+
.finally(() => { asking = null; });
|
|
57
|
+
await asking;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
hold() { want = true; return ask(); },
|
|
61
|
+
again() { return ask(); },
|
|
62
|
+
release() { want = false; const l = lock; lock = null; if (l) l.release().catch(() => {}); },
|
|
63
|
+
held: () => !!lock,
|
|
64
|
+
supported: () => !!(nav && nav.wakeLock),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -211,19 +211,22 @@ function setupRow(s) {
|
|
|
211
211
|
* on the Insight page"): its name, the opening sentence of its latest cycle, and how many cycles are draft, issued and archived. The row opens the
|
|
212
212
|
* latest cycle in the reader, whose cycle chip lists the others. */
|
|
213
213
|
function repRow(g) {
|
|
214
|
-
const
|
|
215
|
-
const pills = [d ? `<span class="s draft">${d} draft</span>` : '', i ? `<span class="s issued">${i} issued</span>` : ''
|
|
214
|
+
const live = g.files.filter((x) => !x.archived), L = live[0], n = (f) => live.filter(f).length, d = n((x) => x.state !== 'issued'), i = n((x) => x.state === 'issued'), s = g.setup;
|
|
215
|
+
const pills = [d ? `<span class="s draft">${d} draft</span>` : '', i ? `<span class="s issued">${i} issued</span>` : ''].join('');
|
|
216
216
|
const st = s ? (s.paused ? '<span>Paused</span>' : s.drafting ? '<span>Drafting</span>' : s.next ? `<span>Next draft ${esc(s.next)}</span>` : '') : '<span>No template</span>';
|
|
217
217
|
return `<div class="dmr" role="listitem"><button class="dmo" data-rpt="${esc(g.id)}" aria-haspopup="dialog"><span class="dmi c-Board">${ICO(DOCI)}</span><span class="dmn"><b>${esc(g.name)}</b>${L.lead ? insLine('“' + L.lead + '”', true) : ''}<small>${esc('Latest: ' + (L.date || L.slot) + (s && s.label ? ' · ' + s.label : '') + (s && s.audience ? ' · for ' + s.audience : ''))}</small><span class="dmm"><span class="t">Report</span>${pills}${st}</span></span></button></div>`;
|
|
218
218
|
}
|
|
219
219
|
/** The report files grouped by report: a set-up report with files is one report row, one with none keeps its set-up row, and a cadence with
|
|
220
|
-
* files and no template is a report row of its own. Files keep their order (newest first, archived last).
|
|
220
|
+
* files and no template is a report row of its own. Files keep their order (newest first, archived last). Archived cycles are hidden (PM
|
|
221
|
+
* 2026-10-22: "Archived report should be hidden"): a report whose cycles are all archived has no row (a set-up one keeps its set-up row), and
|
|
222
|
+
* its archived cycles stay reachable from the reader's cycle chip. */
|
|
221
223
|
function reportGroups() {
|
|
222
224
|
const R = M.reports, by = new Map();
|
|
223
225
|
for (const f of R.missing ? [] : R.rows) { if (!by.has(f.cadence)) by.set(f.cadence, []); by.get(f.cadence).push(f); }
|
|
224
226
|
const out = [];
|
|
225
|
-
|
|
226
|
-
for (const [
|
|
227
|
+
const shown = (fs) => fs && fs.some((x) => !x.archived);
|
|
228
|
+
for (const s of R.setupsOk === false ? [] : (R.setups || [])) { const fs = by.get(s.id); by.delete(s.id); out.push(shown(fs) ? { kind: 'file', x: { id: s.id, name: s.name, setup: s, files: fs } } : { kind: 'setup', x: s }); }
|
|
229
|
+
for (const [id, fs] of by) if (shown(fs)) out.push({ kind: 'file', x: { id, name: id, setup: null, files: fs } });
|
|
227
230
|
return out;
|
|
228
231
|
}
|
|
229
232
|
const foundRow = (f) => `<div class="dmr" role="listitem"><button class="dmo" data-found="${esc(f.id)}" aria-haspopup="dialog"><span class="dmi c-Board">${ICO(AIC)}</span><span class="dmn"><b>${esc(f.name)}</b><small>${esc(f.why)}</small><span class="dmm">${f.confidence ? `<span>${esc(f.confidence)}</span>` : ''}<span>${f.evidence.length} ${f.evidence.length === 1 ? 'sign' : 'signs'} in your work</span></span></span></button></div>`;
|
|
@@ -275,7 +278,7 @@ $('#repBody').addEventListener('click', (e) => {
|
|
|
275
278
|
const d = e.target.closest('[data-d]');
|
|
276
279
|
if (d) { dash = d.dataset.d; drawDash(); drawList(); try { $('#cDash').scrollIntoView({ behavior: 'smooth', block: 'start' }); } catch { /* no scroll */ } return; }
|
|
277
280
|
const rp = e.target.closest('[data-rpt]');
|
|
278
|
-
if (rp) { const g = reportGroups().find((x) => x.kind === 'file' && x.x.id === rp.dataset.rpt); if (g) openReport(g.x.files
|
|
281
|
+
if (rp) { const g = reportGroups().find((x) => x.kind === 'file' && x.x.id === rp.dataset.rpt); if (g) openReport(g.x.files.find((x) => !x.archived), { ws: M.board.ws, name: g.x.setup ? g.x.setup.name : null, cycles: g.x.files, onIssue: () => load(), onChange: () => load() }); return; }
|
|
279
282
|
const f = e.target.closest('[data-found]'), a = e.target.closest('[data-ask]'), s = e.target.closest('[data-setup]');
|
|
280
283
|
if (f) openFound((M.reports.found || []).find((x) => x.id === f.dataset.found));
|
|
281
284
|
else if (a) openAsk((M.reports.asks || []).find((x) => x.id === a.dataset.ask));
|
|
@@ -460,7 +460,8 @@ export function mountMeeting(d) {
|
|
|
460
460
|
note: (id) => NR.find((n) => n.id === id) || null, refresh: readNotes, open: (id) => openNote(id) };
|
|
461
461
|
/* Leaving the Briefing while it holds the recorder: the browser asks first, and if the PM leaves, the meeting is paused (it stays open for an hour) so the record never says "recording" for audio nobody is capturing. */
|
|
462
462
|
addEventListener('beforeunload', (e) => { if (HOLD) { e.preventDefault(); e.returnValue = ''; } });
|
|
463
|
-
|
|
463
|
+
// a page kept for Back (persisted) is not left: a phone that locks or switches apps can hide the page this way, and comes back to it
|
|
464
|
+
addEventListener('pagehide', (e) => { if (HOLD && !(e && e.persisted)) d.pmPost('/api/notes/pause', { id: HOLD.id }, { keepalive: true }); });
|
|
464
465
|
setInterval(() => { readNotes(); }, 20000);
|
|
465
466
|
addEventListener('premium-rec', () => { if (cur && cur.alive()) cur.repaint(); mark(); });
|
|
466
467
|
|
|
@@ -51,6 +51,7 @@ import { startScreen } from './notes-screen-capture.js';
|
|
|
51
51
|
import { screenStrip } from './notes-screen-view.js';
|
|
52
52
|
import { planListen, surfaceOf } from './listen-sources.js';
|
|
53
53
|
import { agendaHeard, peopleOf as contextPeople } from './notes-context.js';
|
|
54
|
+
import { makeGapClock, makeWakeLock } from './notes-lock.js';
|
|
54
55
|
|
|
55
56
|
const SAVE_MS = 700; // a pause this long in typing saves the note
|
|
56
57
|
const POLL_MS = 1500; // while listening, and until the last line is labelled, the note is read this often
|
|
@@ -63,6 +64,7 @@ const SILENCE_PEAK = 1e-4; // the loudest sample of a source below this count
|
|
|
63
64
|
const HEARD_PEAK = 0.005; // the microphone has been heard once it reaches this
|
|
64
65
|
const SEND_TRIES = 3; // a chunk that the server did not take is sent again this many times in all …
|
|
65
66
|
const SEND_BACKOFF_MS = 400; // … after 400 ms, then 1200 ms
|
|
67
|
+
const REVIVE_MS = 5000; // a microphone that ends this soon after the page is shown again was taken away by the lock (notes-lock.js)
|
|
66
68
|
const SECTIONS = [['decision', 'Decisions'], ['action', 'Next steps'], ['question', 'Open questions']];
|
|
67
69
|
|
|
68
70
|
/* ── module state: survives the redraw every setState causes ─────────────────────────────── */
|
|
@@ -75,6 +77,7 @@ let banner = null; // { tone, text }
|
|
|
75
77
|
let speech = null; // the browser recogniser: { mode: 'dictate'|'record', id, state, rec, interim, lang, msg, last }
|
|
76
78
|
let audio = null; // local Whisper capture: { id, state, sources, ctx, streams, started, clock, msg }
|
|
77
79
|
let engine = null; // { ws, whisper, jev, at }
|
|
80
|
+
const wake = makeWakeLock(); // the screen stays on while a meeting is recorded, so the phone does not lock by itself (notes-lock.js)
|
|
78
81
|
/** Capture the shared screen (notes-screen-capture): on unless the PM switched it off on this machine. */
|
|
79
82
|
const screenOn = () => !(engine && engine.whisper && engine.whisper.screen === false);
|
|
80
83
|
let showList = false;
|
|
@@ -697,7 +700,7 @@ function checkSilence(ctx, a) {
|
|
|
697
700
|
ctx.setState({});
|
|
698
701
|
}
|
|
699
702
|
async function startAudio(ctx, n, want, plan = null) {
|
|
700
|
-
const a = { id: n.id, state: 'starting', sources: [], streams: [], ctx: null, started: Date.now(), clock: null, msg: null, queue: {}, buf: {}, rs: {}, rs24: {}, buf24: {}, peak: {}, began: Date.now(), lost: 0, ended: 0, cap: null, seq: {}, off: {} };
|
|
703
|
+
const a = { id: n.id, state: 'starting', sources: [], streams: [], ctx: null, started: Date.now(), clock: null, msg: null, queue: {}, buf: {}, rs: {}, rs24: {}, buf24: {}, peak: {}, began: Date.now(), lost: 0, ended: 0, cap: null, seq: {}, off: {}, gaps: {}, nodes: {}, hiddenAt: 0, shownAt: 0, lastGapAt: 0, missed: 0 };
|
|
701
704
|
const opened = [];
|
|
702
705
|
// the meeting first, straight from the press: the browser lets a page share a screen only right after a click
|
|
703
706
|
for (const kind of want.slice().sort((x, y) => (x === 'meeting' ? -1 : y === 'meeting' ? 1 : 0))) {
|
|
@@ -725,9 +728,12 @@ async function startAudio(ctx, n, want, plan = null) {
|
|
|
725
728
|
const rs = a.rs[kind] = makeResampler(ac.sampleRate);
|
|
726
729
|
// a device slower than 24 kHz has nothing above 12 kHz to keep, so it sends 16 kHz audio only and the replay stays 16 kHz
|
|
727
730
|
const rs24 = ac.sampleRate >= HI_RATE ? (a.rs24[kind] = makeResampler(ac.sampleRate, HI_RATE)) : null;
|
|
728
|
-
a.buf24[kind] = []; a.peak[kind] = 0;
|
|
729
|
-
await openCapture(ac, src, sink, (block) => {
|
|
731
|
+
a.buf24[kind] = []; a.peak[kind] = 0; a.gaps[kind] = makeGapClock();
|
|
732
|
+
const cap = await openCapture(ac, src, sink, (block, stamp) => {
|
|
730
733
|
if (audio !== a) return;
|
|
734
|
+
// the phone locked, or the page was in the background, and this source sent no sound for a while: jump over that time
|
|
735
|
+
const missed = a.gaps[kind].block(block.length, ac.sampleRate, { nowMs: Date.now(), ctxSec: ac.currentTime, stamp });
|
|
736
|
+
if (missed) skipGap(ctx, a, kind, missed);
|
|
731
737
|
let pk = a.peak[kind]; for (let i = 0; i < block.length; i++) { const v = block[i] < 0 ? -block[i] : block[i]; if (v > pk) pk = v; }
|
|
732
738
|
a.peak[kind] = pk;
|
|
733
739
|
const s = rs.push(block);
|
|
@@ -735,7 +741,8 @@ async function startAudio(ctx, n, want, plan = null) {
|
|
|
735
741
|
if (rs24) { const h = rs24.push(block); const b24 = a.buf24[kind]; for (let i = 0; i < h.length; i++) b24.push(h[i]); }
|
|
736
742
|
if (b.length >= CHUNK_SAMPLES) sendChunk(ctx, a, kind, false);
|
|
737
743
|
});
|
|
738
|
-
|
|
744
|
+
a.nodes[kind] = cap.node;
|
|
745
|
+
watchEnded(ctx, a, stream, kind);
|
|
739
746
|
}
|
|
740
747
|
// screenshots of the shared screen, on the meeting clock, while this capture lasts (notes-screen-capture)
|
|
741
748
|
const shared = opened.find(([kind, s]) => kind === 'meeting' && s.screenTrack);
|
|
@@ -747,10 +754,80 @@ async function startAudio(ctx, n, want, plan = null) {
|
|
|
747
754
|
} else if (shared) shared[1].screenTrack.stop();
|
|
748
755
|
a.state = 'on';
|
|
749
756
|
a.clock = setInterval(() => { tickClocks(a.started); checkSilence(ctx, a); }, 1000);
|
|
757
|
+
a.onVis = () => onVisibility(ctx, a);
|
|
758
|
+
if (typeof document !== 'undefined') document.addEventListener('visibilitychange', a.onVis);
|
|
759
|
+
wake.hold();
|
|
750
760
|
ctx.setState({});
|
|
751
761
|
poll(ctx, n.id);
|
|
752
762
|
import('./notes-links.js').then((m) => m.refreshNotes()).catch(() => {});
|
|
753
763
|
}
|
|
764
|
+
/* ── the phone locks (notes-lock.js) ─────────────────────────────────────────────────────────────────────── */
|
|
765
|
+
/** The page was locked or in the background while this capture ran: the microphone may be gone and the context interrupted. */
|
|
766
|
+
const interrupted = (a) => (typeof document !== 'undefined' && document.visibilityState === 'hidden')
|
|
767
|
+
|| (a.hiddenAt > 0 && (!(a.shownAt >= a.hiddenAt) || Date.now() - a.shownAt < REVIVE_MS));
|
|
768
|
+
function watchEnded(ctx, a, stream, kind) {
|
|
769
|
+
for (const t of stream.getTracks()) t.addEventListener('ended', () => {
|
|
770
|
+
if (audio !== a) return;
|
|
771
|
+
// a microphone the phone took away while it was locked is opened again when the page is shown; any other end is the end
|
|
772
|
+
if (kind === 'mic' && interrupted(a)) { if (document.visibilityState === 'visible') revive(ctx, a); return; }
|
|
773
|
+
a.ended++; if (a.ended >= a.streams.length) stopAudio(ctx);
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
function onVisibility(ctx, a) {
|
|
777
|
+
if (audio !== a) return;
|
|
778
|
+
if (document.visibilityState === 'hidden') {
|
|
779
|
+
// what was heard up to now is sent at once: a page that is frozen next sends nothing more
|
|
780
|
+
a.hiddenAt = Date.now();
|
|
781
|
+
for (const k of a.sources) if ((a.buf[k] || []).length) sendChunk(ctx, a, k, false);
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
a.shownAt = Date.now();
|
|
785
|
+
wake.again();
|
|
786
|
+
revive(ctx, a);
|
|
787
|
+
}
|
|
788
|
+
const micLive = (s) => s.getAudioTracks().some((t) => t.readyState === 'live');
|
|
789
|
+
/** Shown again: resume the context and open an ended microphone again. When the browser wants a tap first, the next tap does it. */
|
|
790
|
+
async function revive(ctx, a) {
|
|
791
|
+
if (audio !== a || a.reviving) return;
|
|
792
|
+
a.reviving = true;
|
|
793
|
+
try {
|
|
794
|
+
// called straight from the tap, so resume() is still inside the gesture that iOS asks for
|
|
795
|
+
if (a.ctx && a.ctx.state !== 'running' && a.ctx.state !== 'closed') { try { await a.ctx.resume(); } catch { /* it wants a tap */ } }
|
|
796
|
+
for (let i = 0; i < a.sources.length; i++) {
|
|
797
|
+
if (a.sources[i] !== 'mic' || micLive(a.streams[i]) || !a.nodes.mic) continue;
|
|
798
|
+
let fresh = null;
|
|
799
|
+
try { fresh = await openSource('mic'); } catch { continue; }
|
|
800
|
+
if (audio !== a) { for (const t of fresh.getTracks()) t.stop(); return; }
|
|
801
|
+
a.ctx.createMediaStreamSource(fresh).connect(a.nodes.mic);
|
|
802
|
+
a.streams[i] = fresh;
|
|
803
|
+
watchEnded(ctx, a, fresh, 'mic');
|
|
804
|
+
}
|
|
805
|
+
if (audio !== a) return;
|
|
806
|
+
const stuck = (a.ctx && a.ctx.state !== 'running') || a.sources.some((k, i) => k === 'mic' && !micLive(a.streams[i]));
|
|
807
|
+
if (stuck) {
|
|
808
|
+
banner = { tone: 'bad', audioMsg: true, tap: true, text: 'Recording is paused because the phone locked. Tap anywhere on the page to go on recording.' };
|
|
809
|
+
if (!a.tapArmed) {
|
|
810
|
+
a.tapArmed = true;
|
|
811
|
+
toast({ text: banner.text, tone: 'destructive', timeout: 15000 });
|
|
812
|
+
document.addEventListener('pointerdown', () => { a.tapArmed = false; revive(ctx, a); }, { once: true, capture: true });
|
|
813
|
+
}
|
|
814
|
+
ctx.setState({});
|
|
815
|
+
} else if (banner && banner.tap) { banner = null; ctx.setState({}); }
|
|
816
|
+
} finally { a.reviving = false; }
|
|
817
|
+
}
|
|
818
|
+
const spoken = (ms) => (ms >= 90000 ? Math.round(ms / 60000) + ' minutes' : Math.max(1, Math.round(ms / 1000)) + ' seconds');
|
|
819
|
+
/** `ms` of this source never arrived: what came before is sent, and the offset jumps, so the audio after it keeps its place on the
|
|
820
|
+
* meeting clock and the replay has silence there. The PM is told once for each gap, however many sources it touched. */
|
|
821
|
+
function skipGap(ctx, a, kind, ms) {
|
|
822
|
+
if ((a.buf[kind] || []).length) sendChunk(ctx, a, kind, false);
|
|
823
|
+
a.off[kind] = (a.off[kind] || 0) + Math.round(ms * RATE / 1000);
|
|
824
|
+
if (Date.now() - a.lastGapAt < REVIVE_MS) return;
|
|
825
|
+
a.lastGapAt = Date.now(); a.missed += ms;
|
|
826
|
+
banner = { tone: 'bad', audioMsg: true, text: 'About ' + spoken(ms) + ' of the meeting were not recorded, because the phone was locked or PMOS was in the background. '
|
|
827
|
+
+ 'Recording goes on. A web page cannot record while the phone is locked, so keep this screen on during a meeting.' };
|
|
828
|
+
toast({ text: banner.text, tone: 'destructive', timeout: 12000 });
|
|
829
|
+
ctx.setState({});
|
|
830
|
+
}
|
|
754
831
|
function sendChunk(ctx, a, kind, final) {
|
|
755
832
|
const b = a.buf[kind] || []; a.buf[kind] = [];
|
|
756
833
|
const pcm = b64(Int16Array.from(b));
|
|
@@ -783,8 +860,10 @@ async function stopAudio(ctx, { discard = false, resumable = true } = {}) {
|
|
|
783
860
|
const a = audio;
|
|
784
861
|
if (!a) return;
|
|
785
862
|
audio = null;
|
|
786
|
-
if (banner && banner.silent) banner = null;
|
|
863
|
+
if (banner && (banner.silent || banner.tap)) banner = null;
|
|
787
864
|
clearInterval(a.clock);
|
|
865
|
+
if (a.onVis && typeof document !== 'undefined') document.removeEventListener('visibilitychange', a.onVis);
|
|
866
|
+
wake.release();
|
|
788
867
|
if (a.screen) a.screen.stop();
|
|
789
868
|
for (const s of a.streams) for (const t of s.getTracks()) { try { t.stop(); } catch { /* stopped */ } }
|
|
790
869
|
try { if (a.ctx) await a.ctx.close(); } catch { /* closed */ }
|
|
@@ -818,6 +897,8 @@ function stopSpeech() {
|
|
|
818
897
|
if (!speech) return;
|
|
819
898
|
const s = speech; speech = null;
|
|
820
899
|
clearInterval(s.clock);
|
|
900
|
+
if (s.mode === 'record') wake.release();
|
|
901
|
+
if (s.onVis && typeof document !== 'undefined') document.removeEventListener('visibilitychange', s.onVis);
|
|
821
902
|
if (s.rec) { s.rec.onend = null; try { s.rec.stop(); } catch { /* already stopped */ } }
|
|
822
903
|
}
|
|
823
904
|
async function onFinal(ctx, s, text) {
|
|
@@ -891,6 +972,12 @@ async function startSpeech(ctx, n, mode, install = false) {
|
|
|
891
972
|
rec.onend = () => { if (speech === s && s.state === 'on') { try { rec.start(); } catch { /* it is starting */ } } };
|
|
892
973
|
s.rec = rec;
|
|
893
974
|
try { rec.start(); s.state = 'on'; } catch (e) { s.state = 'error'; s.msg = 'Listening did not start: ' + ((e && e.message) || e); }
|
|
975
|
+
if (mode === 'record' && s.state === 'on') {
|
|
976
|
+
wake.hold();
|
|
977
|
+
// a recognition the lock ended does not start again while the page is hidden: start it when the page is shown
|
|
978
|
+
s.onVis = () => { if (speech === s && s.state === 'on' && document.visibilityState === 'visible') { wake.again(); try { rec.start(); } catch { /* it is running */ } } };
|
|
979
|
+
document.addEventListener('visibilitychange', s.onVis);
|
|
980
|
+
}
|
|
894
981
|
if (mode === 'record') { s.clock = setInterval(() => tickClocks(s.started), 1000); poll(ctx, n.id); import('./notes-links.js').then((m) => m.refreshNotes()).catch(() => {}); }
|
|
895
982
|
ctx.setState({});
|
|
896
983
|
}
|
package/workspace/server.js
CHANGED
|
@@ -663,6 +663,26 @@ function homeWorkspace() {
|
|
|
663
663
|
return HOME_ENABLED ? workspaces.get(wsId(SELF_ROOT)) : [...workspaces.values()][0];
|
|
664
664
|
}
|
|
665
665
|
function getWs(id) { return (id && workspaces.get(id)) || homeWorkspace(); }
|
|
666
|
+
// The folders an agent writes in that are not served workspaces: the git worktrees of a served repository and live session folders
|
|
667
|
+
// (lib/chat-file-locate.js extraRoots). A file there opens in the viewer read-only under the same root guard as a workspace. Memoised: it shells git.
|
|
668
|
+
const DOC_EXTRA_TTL_MS = 15000;
|
|
669
|
+
let docExtra = { at: 0, list: [] };
|
|
670
|
+
function docExtraRoots() {
|
|
671
|
+
if (Date.now() - docExtra.at < DOC_EXTRA_TTL_MS) return docExtra.list;
|
|
672
|
+
const list = chatFileLocate.extraRoots({
|
|
673
|
+
workspaces: [...workspaces.values()],
|
|
674
|
+
worktreesOf: (root) => gitInfo.worktrees(root).map((t) => t.dir),
|
|
675
|
+
sessionDirs: [...sessions.values()].map((s) => s && s.cwd),
|
|
676
|
+
home: os.homedir(),
|
|
677
|
+
});
|
|
678
|
+
docExtra = { at: Date.now(), list };
|
|
679
|
+
return list;
|
|
680
|
+
}
|
|
681
|
+
/** The root a document read uses: a served workspace, or a `wt-` id from docExtraRoots (an unknown `wt-` id is null, never the home workspace). */
|
|
682
|
+
function docRootOf(id) {
|
|
683
|
+
if (id && /^wt-[0-9a-f]{12}$/.test(id)) return docExtraRoots().find((r) => r.id === id) || null;
|
|
684
|
+
return getWs(id);
|
|
685
|
+
}
|
|
666
686
|
/** The registered workspace whose root is this path exactly, or null. Never the home workspace by default. */
|
|
667
687
|
function wsByRoot(root) {
|
|
668
688
|
const want = path.resolve(String(root));
|
|
@@ -7548,11 +7568,11 @@ async function handleRequest(req, res) {
|
|
|
7548
7568
|
}
|
|
7549
7569
|
if (p === '/api/doc/locate' && req.method === 'GET') {
|
|
7550
7570
|
// A file path Claude wrote in a premium chat panel: which served workspace holds it (lib/chat-file-locate.js). The panel then reads it read-only
|
|
7551
|
-
// through GET /api/doc. A path in no served workspace answers `outside`, and nothing is read.
|
|
7571
|
+
// through GET /api/doc. A path in no served workspace, no git worktree of one and no session folder answers `outside`, and nothing is read.
|
|
7552
7572
|
// a relative path is the session's own: it resolves against the folder the chat's session runs in, else the page's workspace
|
|
7553
7573
|
const sess = sessions.get(url.searchParams.get('session') || '');
|
|
7554
7574
|
const base = (sess && workspaces.get(sess.ws)) || getWs(url.searchParams.get('ws'));
|
|
7555
|
-
const r = chatFileLocate.locate({ path: url.searchParams.get('path') || '', roots: [...workspaces.values()].map((w) => ({ id: w.id, root: w.root })), base: base ? base.id : null, home: os.homedir() });
|
|
7575
|
+
const r = chatFileLocate.locate({ path: url.searchParams.get('path') || '', roots: [...[...workspaces.values()].map((w) => ({ id: w.id, root: w.root })), ...docExtraRoots()], base: base ? base.id : null, home: os.homedir() });
|
|
7556
7576
|
return json(res, r);
|
|
7557
7577
|
}
|
|
7558
7578
|
/* ── premium-viewer-share (D97): share links. Listing is a read; making and turning off a link is a page press, never an agent session. ── */
|
|
@@ -7575,7 +7595,7 @@ async function handleRequest(req, res) {
|
|
|
7575
7595
|
}
|
|
7576
7596
|
const host = shareHost();
|
|
7577
7597
|
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);
|
|
7578
|
-
const w =
|
|
7598
|
+
const w = docRootOf(body.ws);
|
|
7579
7599
|
const rel = String(body.path || '');
|
|
7580
7600
|
const got = w ? readTextDocWhy(w.root, rel) : { ok: false, reason: 'no such workspace' };
|
|
7581
7601
|
if (!got.ok) return json(res, { ok: false, error: got.reason }, 404);
|
|
@@ -7596,7 +7616,7 @@ async function handleRequest(req, res) {
|
|
|
7596
7616
|
// A markdown file from the viewer's download menu as Word (premium-viewer-share D4). The same guard as GET /api/doc
|
|
7597
7617
|
// (readTextDocWhy: inside the workspace, text only), built in memory by lib/report-export.js. It writes nothing and is never cached.
|
|
7598
7618
|
if (req.method !== 'GET') { res.writeHead(405, { 'Content-Type': 'text/plain; charset=utf-8' }); return res.end('GET only'); }
|
|
7599
|
-
const w =
|
|
7619
|
+
const w = docRootOf(url.searchParams.get('ws'));
|
|
7600
7620
|
const fmt = url.searchParams.get('fmt') || '';
|
|
7601
7621
|
if (fmt !== 'docx') { res.writeHead(400, { 'Content-Type': 'text/plain; charset=utf-8' }); return res.end('fmt must be docx'); }
|
|
7602
7622
|
const rel = url.searchParams.get('path') || '';
|
|
@@ -7610,7 +7630,7 @@ async function handleRequest(req, res) {
|
|
|
7610
7630
|
return res.end(out.buffer);
|
|
7611
7631
|
}
|
|
7612
7632
|
if (p === '/api/doc') {
|
|
7613
|
-
const w =
|
|
7633
|
+
const w = docRootOf(url.searchParams.get('ws'));
|
|
7614
7634
|
// `ref` — a file that exists only on an initiative's own branch (status-clarity R5). Read through git, never the
|
|
7615
7635
|
// working tree, and only from an initiative branch; the reason for a refusal travels in the body.
|
|
7616
7636
|
const ref = url.searchParams.get('ref');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_comment": "meeting-notes Runs 1 to 10: the Notes engine and routes (notes.test.js), local Whisper, line labels and repository checks (notes-listen.test.js), the final pass after Stop and the Wispr Flow fetch (notes-final.test.js), Qwen3-ASR kept loaded (notes-qwen.test.js), and the Notes view in a browser (pm-notes-test.js), the echo canceller for the replay (notes-echo.test.js, notes-audio-quality Run 2) and the optional cleaned copy of the replay (notes-polish.test.js, Run 3) and the 24 kHz replay (notes-hires.test.js, Run 4), plus the note pop-up patched in place while it listens (pm-note-dock-test.js). notes-recording-reliability adds the duplication fixture (notes-duplication.test.js): duplicated audio and transcript across retry, restart, two tabs and a late chunk, and the live guards. notes-screen-capture adds the screenshots a note keeps of the shared screen (notes-screen.test.js): who may leave a shot, which pictures, listing and serving, deleting, and the optional on-screen text. notes-live-settle adds the replay of a kept meeting and its report (notes-replay.test.js): lines said twice, the live lines' lag, and the settle tier's busy share. notes-screen-capture also adds the screenshots of the shared screen in a browser (pm-notes-screen-test.js).",
|
|
2
|
+
"_comment": "meeting-notes Runs 1 to 10: the Notes engine and routes (notes.test.js), local Whisper, line labels and repository checks (notes-listen.test.js), the final pass after Stop and the Wispr Flow fetch (notes-final.test.js), Qwen3-ASR kept loaded (notes-qwen.test.js), and the Notes view in a browser (pm-notes-test.js), the echo canceller for the replay (notes-echo.test.js, notes-audio-quality Run 2) and the optional cleaned copy of the replay (notes-polish.test.js, Run 3) and the 24 kHz replay (notes-hires.test.js, Run 4), plus the note pop-up patched in place while it listens (pm-note-dock-test.js). notes-recording-reliability adds the duplication fixture (notes-duplication.test.js): duplicated audio and transcript across retry, restart, two tabs and a late chunk, and the live guards. notes-screen-capture adds the screenshots a note keeps of the shared screen (notes-screen.test.js): who may leave a shot, which pictures, listing and serving, deleting, and the optional on-screen text. notes-live-settle adds the replay of a kept meeting and its report (notes-replay.test.js): lines said twice, the live lines' lag, and the settle tier's busy share. notes-screen-capture also adds the screenshots of the shared screen in a browser (pm-notes-screen-test.js). notes-lock-recovery adds the phone lock: the gap clock and the wake lock (notes-lock.test.js), and a lock and unlock in a browser (pm-notes-lock-test.js).",
|
|
3
3
|
"modules": [
|
|
4
4
|
"notes.test.js",
|
|
5
5
|
"notes-listen.test.js",
|
|
@@ -10,12 +10,14 @@
|
|
|
10
10
|
"notes-hires.test.js",
|
|
11
11
|
"notes-duplication.test.js",
|
|
12
12
|
"notes-screen.test.js",
|
|
13
|
-
"notes-replay.test.js"
|
|
13
|
+
"notes-replay.test.js",
|
|
14
|
+
"notes-lock.test.js"
|
|
14
15
|
],
|
|
15
16
|
"panels": [
|
|
16
17
|
"pm-notes-test.js",
|
|
17
18
|
"pm-note-dock-test.js",
|
|
18
|
-
"pm-notes-screen-test.js"
|
|
19
|
+
"pm-notes-screen-test.js",
|
|
20
|
+
"pm-notes-lock-test.js"
|
|
19
21
|
],
|
|
20
22
|
"seconds": {
|
|
21
23
|
"notes.test.js": 12,
|
|
@@ -30,6 +32,8 @@
|
|
|
30
32
|
"notes-duplication.test.js": 25,
|
|
31
33
|
"pm-notes-screen-test.js": 60,
|
|
32
34
|
"notes-screen.test.js": 6,
|
|
33
|
-
"notes-replay.test.js": 20
|
|
35
|
+
"notes-replay.test.js": 20,
|
|
36
|
+
"notes-lock.test.js": 1,
|
|
37
|
+
"pm-notes-lock-test.js": 30
|
|
34
38
|
}
|
|
35
39
|
}
|