create-pmos 0.438.0 → 0.440.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/bin/create-pmos.js +5 -2
  2. package/package.json +25 -25
  3. package/payload/KIT-VERSION +1 -1
  4. package/payload/planning/evals/eval-calibration.md +1 -1
  5. package/payload/planning/okrs/health-budgets.md +1 -1
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/briefing-premium-insights-test.js +1 -1
  8. package/workspace/changelog.json +24 -0
  9. package/workspace/guide/home.md +3 -0
  10. package/workspace/guide/notes.md +5 -2
  11. package/workspace/guide/settings.md +2 -2
  12. package/workspace/lib/goal-status.js +2 -1
  13. package/workspace/lib/headless.js +18 -1
  14. package/workspace/lib/kit-update.js +2 -2
  15. package/workspace/lib/metric-draft-runs.js +10 -4
  16. package/workspace/lib/notes-whisper.js +33 -11
  17. package/workspace/lib/notes.js +6 -4
  18. package/workspace/lib/routes-metric-drafts.js +2 -2
  19. package/workspace/lib/routes-notes.js +94 -13
  20. package/workspace/package-lock.json +2 -2
  21. package/workspace/package.json +1 -1
  22. package/workspace/premium-phone-card-test.js +9 -6
  23. package/workspace/public/pm/cozy-live-pill.css +6 -0
  24. package/workspace/public/pm/cozy-rec-now.js +3 -1
  25. package/workspace/public/pm/home-app.js +3 -3
  26. package/workspace/public/pm/home-day.js +5 -6
  27. package/workspace/public/pm/home-phone-card.js +4 -2
  28. package/workspace/public/pm/okr-list.js +8 -4
  29. package/workspace/public/pm/premium-insights.js +6 -5
  30. package/workspace/public/pm/premium-vw-mtg.js +3 -1
  31. package/workspace/public/premium-intelligence.html +1 -1
  32. package/workspace/server.js +10 -5
  33. package/workspace/test-lists/notes-transcript-recovery.json +9 -0
  34. package/workspace/test-run.js +3 -1
@@ -202,14 +202,17 @@ function launchStatus(r) {
202
202
  return r.status === null ? 1 : r.status;
203
203
  }
204
204
 
205
+ // --no-open: the in-app update (Settings > Updates) reinstalls through here while the PM's tab waits and reloads itself;
206
+ // the restarted server then opens no second tab (batch 18 item 5). It is pmos's own flag, so the server does not inherit it.
205
207
  function launchWorkspace(targetDir, viaGlobal) {
208
+ const NO_OPEN = process.argv.includes('--no-open') ? ['--no-open'] : [];
206
209
  if (viaGlobal && onPath('pmos')) {
207
210
  // `pmos` owns the whole lifecycle: start the server detached, open the browser on this repo.
208
- return launchStatus(spawnSync('pmos', [targetDir], { stdio: 'inherit', shell: process.platform === 'win32' }));
211
+ return launchStatus(spawnSync('pmos', [targetDir, ...NO_OPEN], { stdio: 'inherit', shell: process.platform === 'win32' }));
209
212
  }
210
213
  // Fallback: run the bundled launcher directly. Its ensureInstalled() pulls runtime deps on first run.
211
214
  console.log('Launching from the bundled copy (the `pmos` command is not on PATH).');
212
- return launchStatus(spawnSync(process.execPath, [path.join(WORKSPACE, 'bin', 'pmos.js'), targetDir],
215
+ return launchStatus(spawnSync(process.execPath, [path.join(WORKSPACE, 'bin', 'pmos.js'), targetDir, ...NO_OPEN],
213
216
  { stdio: 'inherit', env: process.env }));
214
217
  }
215
218
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.438.0",
3
+ "version": "0.440.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,30 @@
32
32
  "audit"
33
33
  ],
34
34
  "pmosChanges": [
35
+ {
36
+ "v": "0.440.0",
37
+ "at": "2026-10-28T10:01:00.680Z",
38
+ "f": 2,
39
+ "prs": [
40
+ {
41
+ "n": 1084,
42
+ "t": "Your day rows open, honest Intelligence drafting, update reloads in place, Live pill clear of the chat (feedback batch 18 items 3–6)",
43
+ "s": "Your day rows open, honest Intelligence drafting, update reloads in place, Live pill clear of the chat (feedback batch 18 items 3–6)"
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "v": "0.439.0",
49
+ "at": "2026-10-28T08:30:50.008Z",
50
+ "f": 2,
51
+ "prs": [
52
+ {
53
+ "n": 1083,
54
+ "t": "Meeting notes cover the whole meeting when the live transcript stops early",
55
+ "s": "Meeting notes cover the whole meeting when the live transcript stops early"
56
+ }
57
+ ]
58
+ },
35
59
  {
36
60
  "v": "0.438.0",
37
61
  "at": "2026-10-28T06:29:09.651Z",
@@ -247,30 +271,6 @@
247
271
  "s": "Tenth testing feedback batch"
248
272
  }
249
273
  ]
250
- },
251
- {
252
- "v": "0.420.0",
253
- "at": "2026-10-26T05:26:08.144Z",
254
- "f": 2,
255
- "prs": [
256
- {
257
- "n": 1057,
258
- "t": "Ninth testing feedback batch",
259
- "s": "Ninth testing feedback batch"
260
- }
261
- ]
262
- },
263
- {
264
- "v": "0.419.0",
265
- "at": "2026-10-26T03:21:59.105Z",
266
- "f": 2,
267
- "prs": [
268
- {
269
- "n": 1055,
270
- "t": "Eighth testing feedback batch",
271
- "s": "Eighth testing feedback batch"
272
- }
273
- ]
274
274
  }
275
275
  ]
276
276
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@83a39666
1
+ kernel-source: pmos@d02bb6e8
2
2
  assembled: 2026-10-28
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-10-28T06:29:06Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-28T10:00:57Z"}
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-28T06:29:06Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-28T10:00:57Z"}
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-28T06:29:06Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-28T10:00:57Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -459,7 +459,7 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
459
459
  {
460
460
  const R = await open({ model: mk({ outcomes: [] }) });
461
461
  /* re-pointed (batch 16 item 6): the ✦ line never says "no insight"; with no goal it says what Claude drafts, with ✦ to start it */
462
- ok('I10 with no KR metric the ✦ line says no goal is set and offers to draft them, and the page draws no goal; Library still holds the report files', await R.page.evaluate(() => /has no goal yet/.test(document.querySelector('#brief').textContent) && !/no insight/i.test(document.querySelector('#brief').textContent) && !!document.querySelector('#insAct [data-okl="start"]') && /No key result is recorded for this workspace/.test(document.querySelector('#goalTbl').textContent) && document.querySelectorAll('#goalTbl [data-goal]').length === 0 && document.querySelectorAll('#listRows [data-rpt]').length === 2 && /North Star and key results/.test(document.querySelector('#insWhy').textContent) && !document.querySelector('#goalTbl .ins-th')));
462
+ ok('I10 with no KR metric the ✦ line says no goal is set and offers to draft them, and the page draws no goal; Library still holds the report files', await R.page.evaluate(() => /has no goal yet/.test(document.querySelector('#brief').textContent) && !/no insight/i.test(document.querySelector('#brief').textContent) && !!document.querySelector('#insAct [data-okl="start"]') && /No key result is recorded for this workspace/.test(document.querySelector('#goalTbl').textContent) && document.querySelectorAll('#goalTbl [data-goal]').length === 0 && document.querySelectorAll('#listRows [data-rpt]').length === 2 && /draft the North Star/.test(document.querySelector("#insWhy").textContent) && !document.querySelector('#goalTbl .ins-th')));
463
463
  await R.ctx.close();
464
464
  const R2 = await open({ model: mk({ reportsOk: false, reports: [], missing: ['reports'] }) });
465
465
  await R2.page.click('#moreB'); await R2.page.click('#moreMenu [data-more=\"library\"]');
@@ -1,4 +1,28 @@
1
1
  [
2
+ {
3
+ "v": "0.440.0",
4
+ "at": "2026-10-28T10:01:00.680Z",
5
+ "f": 2,
6
+ "prs": [
7
+ {
8
+ "n": 1084,
9
+ "t": "Your day rows open, honest Intelligence drafting, update reloads in place, Live pill clear of the chat (feedback batch 18 items 3–6)",
10
+ "s": "Your day rows open, honest Intelligence drafting, update reloads in place, Live pill clear of the chat (feedback batch 18 items 3–6)"
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ "v": "0.439.0",
16
+ "at": "2026-10-28T08:30:50.008Z",
17
+ "f": 2,
18
+ "prs": [
19
+ {
20
+ "n": 1083,
21
+ "t": "Meeting notes cover the whole meeting when the live transcript stops early",
22
+ "s": "Meeting notes cover the whole meeting when the live transcript stops early"
23
+ }
24
+ ]
25
+ },
2
26
  {
3
27
  "v": "0.438.0",
4
28
  "at": "2026-10-28T06:29:09.651Z",
@@ -17,6 +17,8 @@ Home, the Board, Insights and the Viewer use one type scale: 11, 12, 14, 16, 20
17
17
  - Press **Good morning** to open **Your day** in the Viewer. This is the same on a computer and on a phone. To open the calendar, press the calendar icon in Your day's header. A program's milestone changes that wait on you are the first line of the program's card.
18
18
  - A blue dot after **Good morning** means that something is new for you. It is in the **New for you** fold of Your day.
19
19
  - Your day shows the date, the meetings of the day, **Your move** (the items that wait on you, with their count), **New for you**, and **This week** (the Weekly review).
20
+ - **Drafted for you** lists what Claude drafted today and the weekly update. Press a row to open it: a finished draft opens what Claude wrote, and the weekly update opens the update.
21
+ - Your day does not show the meeting on now or the next meeting. Home's meeting line shows them. On a phone, the **Now** card does not show while a meeting is in progress.
20
22
  - When a conversation in Mentions waits on your answer, Your day names the oldest one under its first line: who asked, where, how many more wait, and what they asked. Press its icon to open that conversation in Mentions.
21
23
  - **New for you** shows only when something is new: tasks given to you, and work that finished while you were away. It shows the 3 newest items, then **N more**. Press an item to open it in the Viewer. Press **N more** to see all of them. Press ✓✓ in the fold's header to mark all of them seen. An item leaves when you open it or mark it seen. Mentions are not here: **Mentions** shows each one once.
22
24
  - After 17:00, Your day is the end of the day. It shows what moved today, then a **Tomorrow** fold with tomorrow's meetings. When tomorrow has no meetings, there is no Tomorrow fold.
@@ -151,6 +153,7 @@ Press the round button at the bottom of the page (bottom left on a desktop, bott
151
153
  - The button has a blue dot when something is new for you, and an amber dot when a source is old. The dots show on every page. When the menu is open, the blue dot is on **Home** (New for you is in Your day) and the amber dot is on **Settings**.
152
154
  - When a source is old, **Settings** opens at **Connectors**, with the old source first.
153
155
  - A screen reader reads both dots in the button's name, for example "Open the menu. 3 new for you. Jira 3 hours old".
156
+ - On Home on a computer, the **Live pill** (the running sessions and a recording) is above the menu button, so it does not cover the chat's **+**.
154
157
  - There is no **More** menu. The end of the day is Your day after 17:00. The calendar is the icon in Your day's header. To record a note, press **+** at the top of the list, then **Recording**.
155
158
 
156
159
  ## The list, and what it does not show
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Guide: notes"
4
4
  description: "How to take notes in a meeting: one note top to bottom, typed notes as timed lines, key points written each minute and labelled by Jev, delete a note; final notes written after Stop from the whole recording, with speakers and a quote for each item, decisions with their why and who, next steps with an open question, a discussion paragraph, and Wispr Flow's notes merged in and fetched by hand when the fetch fails; listen to your microphone and the meeting on this machine, see decisions, actions and questions caught as they are said, check them against the repository for conflicts, capture highlights during the meeting, create tasks from next steps, correct and tag lines, see what changed in your notes, replay the meeting, see screenshots of the shared screen beside the transcript, link a note to its meeting and its initiative, and get a summary."
5
- timestamp: 2026-10-26
5
+ timestamp: 2026-10-28
6
6
  ---
7
7
 
8
8
  # Guide: notes
@@ -37,6 +37,8 @@ The live transcript keeps each sentence once:
37
37
  - A line that only repeats the line before it is left out. A sentence said twice in a row in one line is kept once.
38
38
  - If the meeting language is English (the default), a line that comes back in another language, for example Hindi, Indonesian or Chinese, is transcribed again in English. The first text stays with the line.
39
39
  - If the workspace restarts during a meeting, the recording continues where it was. Nothing is written twice.
40
+ - When the live transcript falls behind, or the engine stops for a moment, the audio is still kept. When the engine answers again, the stretches it missed are transcribed from the kept audio and appear at their own time in the transcript.
41
+ - When Qwen3-ASR fails three lines in a row, the live transcript uses Whisper for five minutes (when Whisper is set up), then tries Qwen3-ASR again.
40
42
 
41
43
  ## Pause, resume and stop
42
44
 
@@ -123,7 +125,7 @@ After **Stop**, the final notes replace this live draft. See [Final notes after
123
125
 
124
126
  ## Final notes after Stop
125
127
 
126
- The notes taken live are a draft. After **Stop**, the workspace transcribes the whole recording again on this machine, with more time for each sentence, and then your agent session writes the final notes from that transcript and your typed lines.
128
+ The notes taken live are a draft. After **Stop**, from any page (the recording tab, the meeting in the Viewer or your phone), the workspace transcribes the whole recording again on this machine, with more time for each sentence, and then your agent session writes the final notes from that transcript and your typed lines.
127
129
 
128
130
  1. The workspace transcribes your microphone and the meeting apart. It uses **Qwen3-ASR** when it is set up, in any of the languages. Else it uses **Parakeet** when it is set up and the meeting is in English, else Whisper with beam search, speech detection and the names of this meeting. When one engine fails, the next one set up is used.
129
131
  2. It tells the speakers apart. Your microphone is you. The meeting's voices are **Speaker 1**, **Speaker 2** and so on. When no meeting audio was captured, the voices on your microphone are told apart instead.
@@ -146,6 +148,7 @@ When PMOS restarts (for example after you install a new version) while a note wa
146
148
 
147
149
  - A final pass that was queued or running is queued again. When it can no longer run, for example because the audio is gone, the note says why, and your agent session writes the notes from the live transcript.
148
150
  - A summary that was started and never written is started again.
151
+ - A meeting that ended in the last two weeks with no final pass gets one, from its kept audio, and your agent session writes its notes again from the whole meeting. At most 10 meetings, the most recent first.
149
152
  - A Wispr Flow fetch continues on its own schedule. When its 20 minutes have passed, it stops and says so. Press **Fetch Wispr Flow notes now** to try again.
150
153
 
151
154
  ## Wispr Flow notes
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Settings in console3: one home for each setting"
4
4
  description: "How to open Settings in console3, what each section holds, what the scope tags and the environment notes mean, and where the settings are kept."
5
- timestamp: 2026-10-12
5
+ timestamp: 2026-10-28
6
6
  ---
7
7
 
8
8
  # Settings in console3: one home for each setting
@@ -59,7 +59,7 @@ Some rows show a feature that PMOS does not have yet, such as choosing calendars
59
59
 
60
60
  Open **Updates** and press **Check now**. PMOS asks the npm registry for the latest version only when you press it.
61
61
 
62
- - **Update to** a version on the **PMOS app** row updates the app. The row asks first: press **Restart and update**, or **Cancel**. PMOS stops, installs the new version, and starts again. Open terminals keep running. The page reloads when the new version starts. If the update is refused, or PMOS starts again on the old version, or PMOS does not come back, the row says so and names the update log.
62
+ - **Update to** a version on the **PMOS app** row updates the app. The row asks first: press **Restart and update**, or **Cancel**. PMOS stops, installs the new version, and starts again. Open terminals keep running. The page that you are on reloads when the new version starts. PMOS does not open a new tab. If the update is refused, or PMOS starts again on the old version, or PMOS does not come back, the row says so and names the update log.
63
63
  - When PMOS runs from a PMOS checkout, the row says to update it with `git pull`. There is no Update button.
64
64
  - **Update** on a workspace row updates the kit in that repository. It replaces the kit files in its `pmos/` folder (AGENTS.md, skills, scripts, templates, `okf/core`, the mod and KIT-VERSION). It does not change `state/`, `planning/` or `okf/product/`, and it does not commit. Review the change in the repository as a normal pull request.
65
65
 
@@ -122,7 +122,8 @@ function lineOf(o = {}) {
122
122
  const read = G.filter((g) => g.reading.dot !== 'none');
123
123
  if (!read.length) {
124
124
  if (drafts) return { head: 'I drafted ' + noun(drafts, 'fix', 'fixes') + ' so every goal can be read.', sub: 'Keep them all at once, or one by one. I test-read each one first.', tone: 'drafts', keepAll };
125
- return { head: G.length ? 'I have not read a goal yet. I read each one when it has a way to be read.' : 'This product has no goal yet. I draft a North Star when the next check runs.', sub: '', tone: 'drafts', keepAll: 0 };
125
+ // batch 18 item 4: no promise of "the next check". The page offers ✦ Draft them now (public/pm/okr-list.js lineOf).
126
+ return { head: G.length ? 'I have not read a goal yet. I read each one when it has a way to be read.' : 'This product has no goal yet.', sub: '', tone: 'drafts', keepAll: 0 };
126
127
  }
127
128
  if (drafts) return { head: 'I drafted ' + noun(drafts, 'fix', 'fixes') + ' for your goals.', sub: 'Keep them all at once, or one by one.', tone: 'drafts', keepAll };
128
129
  const close = G.filter((g) => g.reading.dot === 'close');
@@ -11,6 +11,7 @@
11
11
  * streamLines(line) → { log: [lines], result: object|null } one stream-json event, for the live log
12
12
  * logLines(result, exitCode) → the lines the read-only log pane shows at the end
13
13
  * outcomeOf(result, { code, signal, timedOut, stopped, timeoutMin }) → { ok, headline, why, turns, durationMs, denied } what the run card says
14
+ * runEnvOf(extra) → the variables of a run's spawn spec (spec.env) that reach its process: only RUN_ENV, only strings
14
15
  *
15
16
  * Pure: no I/O, no process. server.js spawnSession starts the child and keeps the session row.
16
17
  *
@@ -387,4 +388,20 @@ function logLines(r, exitCode) {
387
388
  return out;
388
389
  }
389
390
 
390
- module.exports = { HEADLESS_SKILLS, HEADLESS_ORIGINS, ASK_ORIGINS, DRIVE_ORIGINS, SCAN_WEB_ORIGINS, SCAN_REPO_ORIGINS, SCAN_RESEARCH_WEB_ORIGINS, SCAN_RESEARCH_REPO_ORIGINS, WEB_KINDS, REPORT_SETUP_ORIGINS, REPORT_FIND_ORIGINS, CORE_DOC_ORIGINS, REPORT_DESIGN_ORIGINS, REPORT_SAMPLE_FETCH_ORIGINS, REPORT_STRUCTURE_ORIGINS, REPORT_STRUCTURE_DRY_ORIGINS, METRIC_DRAFT_ORIGINS, IMPACT_ORIGINS, TOOLS, SKILL_WRITE_DIRS, DEFAULT_TIMEOUT_MS, kindFor, argsFor, skillWriteDirs, timeoutMs, parseResult, streamLines, outcomeOf, signedOut, SIGNED_OUT_WHY, logLines, switchedOff };
391
+ // The variables a background run's spawn spec may set (spec.env, server.js spawnSession extraEnv). Each one pins the run's one write to its
392
+ // ledger, its scope and its run id; its CLI refuses without them. Batch 18 item 4: the metric-draft, propose, impact, metric-read and
393
+ // ms-review keys were missing here, so those runs started, could file nothing, and ended "ok" with no draft. A key a lib/*.js spec sets
394
+ // that is not on this list fails headless.test.js.
395
+ const RUN_ENV = Object.freeze(['PMOS_SCAN_FILE', 'PMOS_SCAN_ORIGIN', 'PMOS_SCAN_RUN', 'PMOS_REPORT_FILE', 'PMOS_REPORT_RUN',
396
+ 'PMOS_CORE_DOC_SCOPE', 'PMOS_CORE_DOC_KEY', 'PMOS_CORE_DOC_KEYS',
397
+ 'PMOS_METRIC_DRAFT_FILE', 'PMOS_METRIC_DRAFT_WS', 'PMOS_METRIC_DRAFT_SCOPE', 'PMOS_METRIC_DRAFT_ID', 'PMOS_METRIC_DRAFT_RUN',
398
+ 'PMOS_METRIC_READ_FILE', 'PMOS_METRIC_READ_RECORDS', 'PMOS_METRIC_READ_DRAFTS', 'PMOS_METRIC_READ_WS', 'PMOS_METRIC_READ_RUN', 'PMOS_METRIC_READ_RIDS', 'PMOS_METRIC_READ_TEST',
399
+ 'PMOS_PROPOSE_FILE', 'PMOS_PROPOSE_WS', 'PMOS_PROPOSE_BOARD', 'PMOS_PROPOSE_INI', 'PMOS_PROPOSE_RUN',
400
+ 'PMOS_IMPACT_FILE', 'PMOS_IMPACT_RUN', 'PMOS_MS_REVIEW_FILE', 'PMOS_MS_REVIEW_RUN', 'PMOS_MS_REVIEW_PROGRAM']);
401
+ function runEnvOf(extra) {
402
+ const out = {};
403
+ if (extra && typeof extra === 'object') for (const k of RUN_ENV) if (typeof extra[k] === 'string') out[k] = extra[k];
404
+ return out;
405
+ }
406
+
407
+ module.exports = { HEADLESS_SKILLS, HEADLESS_ORIGINS, ASK_ORIGINS, DRIVE_ORIGINS, SCAN_WEB_ORIGINS, SCAN_REPO_ORIGINS, SCAN_RESEARCH_WEB_ORIGINS, SCAN_RESEARCH_REPO_ORIGINS, WEB_KINDS, REPORT_SETUP_ORIGINS, REPORT_FIND_ORIGINS, CORE_DOC_ORIGINS, REPORT_DESIGN_ORIGINS, REPORT_SAMPLE_FETCH_ORIGINS, REPORT_STRUCTURE_ORIGINS, REPORT_STRUCTURE_DRY_ORIGINS, METRIC_DRAFT_ORIGINS, IMPACT_ORIGINS, TOOLS, SKILL_WRITE_DIRS, DEFAULT_TIMEOUT_MS, kindFor, argsFor, skillWriteDirs, timeoutMs, parseResult, streamLines, outcomeOf, signedOut, SIGNED_OUT_WHY, logLines, switchedOff, RUN_ENV, runEnvOf };
@@ -276,7 +276,7 @@ function upgradeApp(root, { version, logFile, spawn = cp.spawn, env = updateEnv(
276
276
  fd = fs.openSync(logFile, 'w');
277
277
  fs.writeSync(fd, `${new Date().toISOString()} clearing npm cache…\n`);
278
278
  fs.writeSync(fd, `${new Date().toISOString()} ${NPM} cache clean --force\n`);
279
- fs.writeSync(fd, `${new Date().toISOString()} ${NPX} ${npxArgs(src, version, ['workspace', '--reinstall', String(root)]).join(' ')}\n`);
279
+ fs.writeSync(fd, `${new Date().toISOString()} ${NPX} ${npxArgs(src, version, ['workspace', '--reinstall', '--no-open', String(root)]).join(' ')}\n`);
280
280
  } catch (e) { return { ok: false, error: `Could not write the log file: ${e.message}` }; }
281
281
  try {
282
282
  // Clear npm cache synchronously before spawning the update, so npx downloads the fresh version
@@ -285,7 +285,7 @@ function upgradeApp(root, { version, logFile, spawn = cp.spawn, env = updateEnv(
285
285
  try { fs.appendFileSync(logFile, `Note: cache clear had an issue, but continuing: ${e.message}\n`); } catch { /* silent */ }
286
286
  }
287
287
  try {
288
- const child = spawn(NPX, npxArgs(src, version, ['workspace', '--reinstall', String(root)]),
288
+ const child = spawn(NPX, npxArgs(src, version, ['workspace', '--reinstall', '--no-open', String(root)]),
289
289
  { cwd: String(root), env, detached: true, stdio: ['ignore', fd, fd], windowsHide: true, shell: IS_WIN });
290
290
  // A child that could not start writes nothing itself: say why in the log, which the page names when it gives up.
291
291
  if (child && typeof child.on === 'function') {
@@ -38,6 +38,7 @@ const flagOff = (v) => /^(off|0|false|no)$/i.test(String(v || '').trim());
38
38
  const off = (env) => flagOff((env || process.env).PMOS_METRIC_DRAFT);
39
39
  const one = (s, n) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, n);
40
40
  const MAX = 2;
41
+ const NOTHING = 'The run ended without drafting anything.';
41
42
  const SCAN_MS = 10 * 60e3;
42
43
  const QUARTER_DAYS = 14;
43
44
  const localDay = (ms) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
@@ -133,8 +134,13 @@ function create(deps) {
133
134
  const s = MD.read(a.dir).scopes.get(MD.keyOf(a.scope, a.id));
134
135
  if (!s || !s.run || s.run.run !== run || s.run.ended) return; // `pmos metrics draft end` or ■ Stop wrote it already
135
136
  const res = (r && r.result) || {};
136
- const ok = !!(r && !r.timedOut && !r.stopped && r.code === 0 && res.ok !== false && !res.isError);
137
- try { MD.append(a.dir, null, { kind: 'end', scope: a.scope, id: a.id, run, ok, ...(ok ? {} : { error: one((r && r.note) || res.text || 'the run failed', 200) }) }, new Date(now).toISOString()); } catch (e) { warn('metric draft end', e); }
137
+ const exitOk = !!(r && !r.timedOut && !r.stopped && r.code === 0 && res.ok !== false && !res.isError);
138
+ // batch 18 item 4: a run that ended well but filed no row drafted nothing. It is not "ready": the page says so and offers Draft again.
139
+ const filed = [...s.rows.values()].some((x) => x.run === run);
140
+ const ok = exitOk && filed;
141
+ const error = ok ? '' : exitOk ? NOTHING : one((r && r.note) || res.text || 'the run failed', 200);
142
+ try { MD.append(a.dir, null, { kind: 'end', scope: a.scope, id: a.id, run, ok, ...(ok ? {} : { error }) }, new Date(now).toISOString()); } catch (e) { warn('metric draft end', e); }
143
+ return ok || (r && r.stopped) ? undefined : { failed: error };
138
144
  }
139
145
 
140
146
  /** Start one run now. → { ok, run } | { ok: false, error, held? } */
@@ -162,7 +168,7 @@ function create(deps) {
162
168
  active.set(run, { ws, scope, id, dir, session: null });
163
169
  let session = null;
164
170
  try {
165
- session = go({ name: 'Drafting metrics · ' + one(title, 60), ws, origin: `metric-draft:${ws}:${scope}:${id}:${run}`, initialInput: prompt + '\r', ...(scope === 'initiative' ? { initiative: id } : {}),
171
+ session = go({ name: 'Drafting metrics · ' + one(title, 60), ws, ...(press ? { byPm: true } : {}), origin: `metric-draft:${ws}:${scope}:${id}:${run}`, initialInput: prompt + '\r', ...(scope === 'initiative' ? { initiative: id } : {}),
166
172
  env: { PMOS_METRIC_DRAFT_FILE: MD.ledgerFile(dir), PMOS_METRIC_DRAFT_WS: ws, PMOS_METRIC_DRAFT_SCOPE: scope, PMOS_METRIC_DRAFT_ID: id, PMOS_METRIC_DRAFT_RUN: run }, onDone: (r) => ended(run, r) });
167
173
  } catch (e) { warn('metric draft run', e); }
168
174
  if (session && session.held) { active.delete(run); return { ok: false, held: true, error: 'Claude is busy with other runs. It tries again in a minute.' }; }
@@ -213,4 +219,4 @@ function create(deps) {
213
219
  return { tick, start, stop, active: () => [...active.keys()], runOf: (ws, scope, id) => { for (const [r, a] of active) if (a.ws === ws && a.scope === scope && a.id === id) return r; return null; } };
214
220
  }
215
221
 
216
- module.exports = { off, quarterOf, dueOf, gapsOf, promptOf, create, MAX, SCAN_MS, QUARTER_DAYS };
222
+ module.exports = { off, quarterOf, dueOf, gapsOf, promptOf, create, MAX, SCAN_MS, QUARTER_DAYS, NOTHING };
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * detect(runtimeDir, { env }) → { ready, bin, model, missing, setup, model_dir }
5
5
  * setupCommand(runtimeDir) → the shell commands the PM runs once: install whisper.cpp and download its model
6
- * createTranscriber({ runtimeDir, onText, run?, detect?, vocab?, prompt? }) → { push, flush, drop, pending, idle }
6
+ * createTranscriber({ runtimeDir, onText, onSkip?, run?, detect?, vocab?, prompt? }) → { push, fill, flush, drop, pending, idle }
7
7
  * wav(pcm, rate) · levels(pcm, rate) · cleanText(text, { voicedRatio }) · promptFor(vocab, previous)
8
8
  * getLanguage(runtimeDir) · setLanguage(runtimeDir, code) the spoken language Whisper writes in (LANGUAGES)
9
9
  * getModel(runtimeDir) · setModel(runtimeDir, id) the model: accurate (1.6 GB) or faster (about 550 MB) (MODELS)
@@ -60,6 +60,7 @@ const MIN_VOICED_MS = 300;
60
60
  const LEAD_MS = 300; // speech that starts a cut keeps this much of the quiet before it
61
61
  const MIN_RMS = 180; // in 16-bit units; below this a frame is quiet whatever the room
62
62
  const MAX_QUEUE = 24;
63
+ const FILL_ROOM = 2; // a skipped stretch is filled in only while fewer cuts than this wait
63
64
  const RUN_TIMEOUT_MS = 120000;
64
65
  const HOLD_MS = 12000; // a microphone line waits at most this long for the meeting's line of the same time
65
66
  const MEETING_LIVE_MS = 30000; // meeting audio this recent means the meeting is being captured
@@ -264,7 +265,7 @@ function runWhisper({ bin, model, file, lang = DEFAULT_LANGUAGE, accuracy = DEFA
264
265
  * @param {Function} [a.run] runWhisper, replaceable in the suites
265
266
  * @param {Function} [a.detect] detect, replaceable in the suites
266
267
  */
267
- function createTranscriber({ runtimeDir, onText, onError = () => {}, onCut = () => {}, run = runWhisper, detect: det = () => detect(runtimeDir), vocab = null, prompt = '',
268
+ function createTranscriber({ runtimeDir, onText, onError = () => {}, onCut = () => {}, onSkip = () => {}, run = runWhisper, detect: det = () => detect(runtimeDir), vocab = null, prompt = '',
268
269
  echo = true, holdMs = HOLD_MS, recent = null, lastLine = null }) {
269
270
  const bufs = new Map(); // `${id}|${source}` → { id, source, chunks, ms, voicedMs, quietMs, t, noise }
270
271
  const lastText = new Map(); // `${id}|${source}` → { text, t }: the last line heard there, for the repetition guard
@@ -373,27 +374,48 @@ function createTranscriber({ runtimeDir, onText, onError = () => {}, onCut = ()
373
374
  try { onCut({ id: b.id, source: b.source, until: Math.min(b.t + b.ms, ...waitFor) }); } catch { /* the caller's bookkeeping */ }
374
375
  };
375
376
  if (b.voicedMs < MIN_VOICED_MS || !b.chunks.length) { queue = queue.then(done).catch(() => {}); if (held.length) release(); return false; }
376
- if (waiting >= MAX_QUEUE) { onError({ id: b.id, source: b.source, error: 'transcription is falling behind, so a few seconds were skipped' }); return false; }
377
- const pcm = Buffer.concat(b.chunks);
378
377
  const job = { id: b.id, source: b.source, t: b.t, ms: b.ms, ...(b.ts ? { exact: true } : {}) };
379
- const voicedRatio = b.ms > 0 ? b.voicedMs / b.ms : 1;
378
+ if (waiting >= MAX_QUEUE) { skipped(job, 'transcription is falling behind, so a few seconds were skipped'); return false; }
379
+ enqueue(job, Buffer.concat(b.chunks), b.ms > 0 ? b.voicedMs / b.ms : 1, done);
380
+ return true;
381
+ }
382
+ /* CATCHING UP (notes-transcript-recovery). A cut that was skipped (falling behind) or failed (the engine stopped, timed out or
383
+ * was not ready) is not lost: the caller hears of it through onSkip({ id, source, t, ms, tries }) and, once the queue is short
384
+ * again, hands the same stretch back from the kept audio through fill(). So the live transcript fills its own gaps. */
385
+ function skipped(job, error) {
386
+ onError({ ...job, error });
387
+ try { onSkip({ id: job.id, source: job.source, t: job.t, ms: job.ms, tries: job.tries || 0 }); } catch { /* the caller's bookkeeping */ }
388
+ }
389
+ function enqueue(job, pcm, voicedRatio, done = () => {}) {
380
390
  const q = { id: job.id, source: job.source, t: job.t };
381
391
  inQueue.push(q);
382
392
  waiting++;
383
393
  queue = queue.then(async () => {
384
394
  const d = det();
385
- if (!d.ready) { onError({ ...job, error: 'local transcription is not set up' }); return; }
395
+ if (!d.ready) { skipped(job, 'local transcription is not set up'); return; }
386
396
  fs.mkdirSync(tmpDir, { recursive: true });
387
397
  const file = path.join(tmpDir, 'cut-' + crypto.randomBytes(6).toString('hex') + '.wav');
388
398
  try {
389
399
  fs.writeFileSync(file, wav(pcm), { mode: 0o600 });
390
400
  // `engine` is 'qwen' when the caller's detect chose Qwen3-ASR (lib/notes-qwen.js); `run` then sends the cut there
391
401
  const r = await transcribe(d, job, file, voicedRatio);
392
- if (!r.ok) { onError({ ...job, error: r.error }); return; }
393
- if (r.text) await deliver(job, r.text, r.extra);
394
- } catch (e) { onError({ ...job, error: String((e && e.message) || e) }); }
402
+ engineOk = !!r.ok;
403
+ if (!r.ok) { skipped(job, r.error); return; }
404
+ if (r.text) await deliver(job, r.text, job.fill ? { ...(r.extra || {}), fill: true } : r.extra);
405
+ } catch (e) { engineOk = false; skipped(job, String((e && e.message) || e)); }
395
406
  finally { try { fs.unlinkSync(file); } catch { /* already gone */ } }
396
407
  }).catch(() => {}).finally(() => { waiting--; done(); const i = inQueue.indexOf(q); if (i >= 0) inQueue.splice(i, 1); if (held.length) release(); });
408
+ }
409
+ /** A stretch skipped earlier, read back from the kept audio. Queued only once the engine has answered again (a stretch tried
410
+ * while it is still down would only fail again) and while the queue has room for the live cuts too. → true when it was queued. */
411
+ let engineOk = true;
412
+ function fill({ id, source, pcm, t, tries = 0 }) {
413
+ if (!pcm || pcm.length < 2 || waiting >= FILL_ROOM || !engineOk) return false;
414
+ const ms = (pcm.length / 2 / RATE) * 1000;
415
+ let voiced = 0; let noise = noiseOf.has(source) ? noiseOf.get(source) : null;
416
+ for (const v of levels(pcm)) { if (v > Math.max(MIN_RMS, (noise == null ? 0 : noise) * 3)) voiced += FRAME_MS; else noise = noise == null ? v : noise * 0.9 + v * 0.1; }
417
+ if (voiced < MIN_VOICED_MS) return true; // nothing was said there: nothing to fill
418
+ enqueue({ id, source, t, ms, exact: true, fill: true, tries: tries + 1 }, pcm, ms > 0 ? voiced / ms : 1);
397
419
  return true;
398
420
  }
399
421
 
@@ -460,9 +482,9 @@ function createTranscriber({ runtimeDir, onText, onError = () => {}, onCut = ()
460
482
  if (q === queue) return;
461
483
  }
462
484
  }
463
- return { push, flush, drop, has, pending: () => waiting + held.length, idle };
485
+ return { push, fill, flush, drop, has, pending: () => waiting + held.length, idle };
464
486
  }
465
487
 
466
488
  module.exports = { detect, setupCommand, getLanguage, setLanguage, LANGUAGES, DEFAULT_LANGUAGE, getModel, setModel, MODELS, DEFAULT_MODEL,
467
489
  getAccuracy, setAccuracy, ACCURACIES, DEFAULT_ACCURACY, createTranscriber, runWhisper, wav, levels, cleanText, promptFor, modelDir, RATE, MODEL_FILE, MODEL_URL,
468
- MIN_CUT_MS, MAX_CUT_MS, PAUSE_MS, LONG_PAUSE_MS, PROMPT_MAX, LOW_VOICED_RATIO, NO_SPEECH_THOLD };
490
+ MIN_CUT_MS, MAX_CUT_MS, MAX_QUEUE, FILL_ROOM, PAUSE_MS, LONG_PAUSE_MS, PROMPT_MAX, LOW_VOICED_RATIO, NO_SPEECH_THOLD };
@@ -587,7 +587,7 @@ function joinText(prev, next, names) {
587
587
  const tail = KEEP_CAP.test(next) || (names && names.has(word)) || PROPER_DAYS.test(word) ? next : next.charAt(0).toLowerCase() + next.slice(1);
588
588
  return askMark(head.replace(/[,\s]+$/, '') + ' ' + tail);
589
589
  }
590
- function appendTranscript(dir, { id, text, source = 'speech', t: at = null, ms = null, heard_as = null, now = Date.now() } = {}) {
590
+ function appendTranscript(dir, { id, text, source = 'speech', t: at = null, ms = null, heard_as = null, fill = false, now = Date.now() } = {}) {
591
591
  const note = load(dir, id);
592
592
  if (!note) return err(404, 'no such note');
593
593
  if (note.private) return err(409, 'this note is marked private, so nothing more is recorded in it');
@@ -602,12 +602,14 @@ function appendTranscript(dir, { id, text, source = 'speech', t: at = null, ms =
602
602
  const names = namesIn((note.transcript || []).map((x) => x.text).concat(sentences, [note.body || '']));
603
603
  const tr = note.transcript || (note.transcript = []);
604
604
  const tEnd = Number.isFinite(ms) && ms > 0 ? t + Math.round(ms) : null;
605
- const open = JOINS.has(src) && endsOpen(raw);
605
+ // a stretch filled in after the engine caught up (notes-transcript-recovery) belongs earlier than the last line: it is never
606
+ // joined to that line, and it is never left open for the next line to join
607
+ const open = !fill && JOINS.has(src) && endsOpen(raw);
606
608
  // the first text of a line that came back in another language and was run again in English (notes-recording-reliability, D8)
607
609
  const heardAs = heard_as && typeof heard_as.text === 'string' && heard_as.text ? { text: heard_as.text.slice(0, MAX_PHRASE), language: String(heard_as.language || '').slice(0, 40) } : null;
608
610
  const out = [];
609
611
  // the first sentence may finish the line before it, from the same source
610
- if (JOINS.has(src)) {
612
+ if (JOINS.has(src) && !fill) {
611
613
  let pi = -1;
612
614
  for (let k = tr.length - 1; k >= 0; k--) if (tr[k] && tr[k].source === src) { pi = k; break; }
613
615
  const prev = pi >= 0 ? tr[pi] : null;
@@ -627,7 +629,7 @@ function appendTranscript(dir, { id, text, source = 'speech', t: at = null, ms =
627
629
  const base = tr.length;
628
630
  const added = sentences.map((s, k) => { const isOpen = open && k === sentences.length - 1;
629
631
  return { at: iso(now), t, ...(tEnd != null ? { t_end: tEnd } : {}), text: s, source: src, cat: isOpen ? null : categoryOf(s, names), cat_by: 'local',
630
- ...(isOpen ? { open: true } : {}), ...(heardAs ? { heard_as: heardAs } : {}), index: base + k }; });
632
+ ...(isOpen ? { open: true } : {}), ...(heardAs ? { heard_as: heardAs } : {}), ...(fill ? { filled: true } : {}), index: base + k }; });
631
633
  note.transcript = tr.concat(added.map(({ index, ...x }) => x));
632
634
  note.updated_at = iso(now);
633
635
  store(dir, note);
@@ -13,7 +13,7 @@
13
13
  * POST /api/metric-drafts/drop { ws, scope, id, row } → { ok } ✕
14
14
  * POST /api/metric-drafts/edit { ws, scope, id, row, name?, target?, source? } → { ok, row } the inline edit of an open row (batch 16 item 1)
15
15
  * POST /api/metric-drafts/undo { ws, scope, id, row } → { ok } kept → open (its record edited { retired: true }); dropped → open
16
- * POST /api/metric-drafts/start { ws, scope, id } → { ok, run } Draft again
16
+ * POST /api/metric-drafts/start { ws, scope, id } → { ok, run, already? } Draft again (already: a run for it was going)
17
17
  * POST /api/metric-drafts/stop { ws, scope, id } → { ok } ■ Stop: the run ends; what it filed stays a draft
18
18
  *
19
19
  * WHICH LEDGER. A product's and an initiative's drafts are in the state folder of `ws`. A program's are in its charter's workspace (its home,
@@ -91,7 +91,7 @@ async function handle(req, res, url, ctx) {
91
91
  if (!ctx.metricDraftRuns) return send(bad(503, 'Claude\'s runs are off on this server.'));
92
92
  const r = ctx.metricDraftRuns.start({ ws: w.id, scope, id, why: 'press' });
93
93
  if (!r || !r.ok) return send(bad(409, (r && r.error) || 'Claude could not start drafting.'));
94
- return send({ status: 200, body: { ok: true, run: r.run } });
94
+ return send({ status: 200, body: { ok: true, run: r.run, ...(r.already ? { already: true } : {}) } });
95
95
  }
96
96
  if (what === 'stop') {
97
97
  const s = S();
@@ -396,16 +396,55 @@ function vocabFor(ctx, id) {
396
396
  /* ── local transcription: one transcriber for the process ─────────────────────────────────────── */
397
397
  /* THE LIVE ENGINE (Run 10). Qwen3-ASR when it is set up (lib/notes-qwen.js: more accurate, Chinese and Indonesian too, kept
398
398
  * loaded so each cut is quick), else whisper.cpp. ctx.notesQwenDetect and ctx.notesQwenRun replace them in the suites. */
399
+ /* RECOVERY (notes-transcript-recovery). When Qwen3-ASR fails QWEN_FAILS cuts in a row (it stopped, timed out, or the machine
400
+ * is short of memory), the live transcript goes on with whisper.cpp for QWEN_REST_MS when whisper.cpp is set up, and then tries
401
+ * Qwen3-ASR again. Without whisper.cpp, Qwen3-ASR is started again on the next cut, as before. */
402
+ const QWEN_FAILS = 3;
403
+ const QWEN_REST_MS = 5 * 60 * 1000;
404
+ let qwenFails = 0; let qwenRestUntil = 0;
399
405
  function qwenDetect(ctx) { return ctx.notesQwenDetect ? ctx.notesQwenDetect() : notesQwen.detect(ctx.runtimeDir); }
406
+ function whisperDetect(ctx) { return ctx.notesWhisperDetect ? ctx.notesWhisperDetect() : whisper.detect(ctx.runtimeDir); }
400
407
  function liveDetect(ctx) {
401
408
  const q = qwenDetect(ctx);
409
+ if (q.ready && Date.now() < qwenRestUntil) { const w = whisperDetect(ctx); if (w.ready) return { ...w, engine: 'whisper' }; }
402
410
  if (q.ready) return { ready: true, engine: 'qwen', model: q.live, bin: null };
403
- return { ...whisper.detect(ctx.runtimeDir), engine: 'whisper' };
411
+ return { ...whisperDetect(ctx), engine: 'whisper' };
404
412
  }
405
- function liveRun(ctx, args) {
406
- if (args.engine !== 'qwen') return whisper.runWhisper(args);
407
- if (ctx.notesQwenRun) return ctx.notesQwenRun(args);
408
- return notesQwen.runQwen(notesQwen.workerFor(ctx.runtimeDir), args);
413
+ async function liveRun(ctx, args) {
414
+ if (args.engine !== 'qwen') return ctx.notesWhisperRun ? ctx.notesWhisperRun(args) : whisper.runWhisper(args);
415
+ const r = await (ctx.notesQwenRun ? ctx.notesQwenRun(args) : notesQwen.runQwen(notesQwen.workerFor(ctx.runtimeDir), args));
416
+ if (r && r.ok) qwenFails = 0;
417
+ else if (++qwenFails >= QWEN_FAILS) { qwenFails = 0; qwenRestUntil = Date.now() + QWEN_REST_MS; }
418
+ return r;
419
+ }
420
+ /* GAPS (notes-transcript-recovery). A cut the transcriber skipped or could not transcribe is kept here as a stretch of the
421
+ * meeting clock; when the transcriber has caught up, the next audio chunk of the note hands the oldest stretch back from the
422
+ * kept audio (transcriber.fill), FILL_PIECE_MS at a time, at most FILL_TRIES times. The lines land in the transcript at their
423
+ * own time, marked filled. What still fails is covered by the final pass after Stop, which reads the whole kept audio. */
424
+ const FILL_PIECE_MS = 25000;
425
+ const FILL_TRIES = 3;
426
+ const MAX_GAPS = 200;
427
+ const gaps = new Map(); // note id → [{ source, t, ms, tries }], oldest first
428
+ function addGap(c) {
429
+ if (!c || !c.id || !(c.ms > 0) || (c.tries || 0) >= FILL_TRIES) return;
430
+ const xs = gaps.get(c.id) || [];
431
+ const last = xs.length ? xs[xs.length - 1] : null;
432
+ // a stretch straight after the last one of its source, at the same try, is the same gap
433
+ if (last && last.source === c.source && last.tries === (c.tries || 0) && Math.abs(last.t + last.ms - c.t) <= 1500) last.ms = c.t + c.ms - last.t;
434
+ else xs.push({ source: c.source, t: c.t, ms: c.ms, tries: c.tries || 0 });
435
+ if (xs.length > MAX_GAPS) xs.shift();
436
+ gaps.set(c.id, xs);
437
+ }
438
+ function fillGaps(ctx, id, tr) {
439
+ const xs = gaps.get(id);
440
+ if (!xs || !xs.length || !tr.fill) return;
441
+ const g = xs[0];
442
+ const ms = Math.min(g.ms, FILL_PIECE_MS);
443
+ const from = Math.round(g.t * whisper.RATE / 1000); const to = Math.round((g.t + ms) * whisper.RATE / 1000);
444
+ const back = notesAudio.readSource(ctx.runtimeDir, id, g.source, from, to);
445
+ if (back && back.pcm.length && !tr.fill({ id, source: g.source, pcm: back.pcm, t: (back.from / whisper.RATE) * 1000, tries: g.tries })) return;
446
+ if (g.ms - ms > 500) { g.t += ms; g.ms -= ms; } else xs.shift();
447
+ if (!xs.length) gaps.delete(id);
409
448
  }
410
449
  let transcriber = null; let transcriberDir = null;
411
450
  const audioErrors = new Map(); // note id → the last thing that went wrong, for the page
@@ -433,10 +472,11 @@ function transcriberFor(ctx) {
433
472
  return null;
434
473
  },
435
474
  onText: async (c) => {
436
- const r = notes.appendTranscript(ctx.runtimeDir, { id: c.id, text: c.text, source: c.source, t: c.t, ms: c.ms, heard_as: c.heard_as });
475
+ const r = notes.appendTranscript(ctx.runtimeDir, { id: c.id, text: c.text, source: c.source, t: c.t, ms: c.ms, heard_as: c.heard_as, fill: c.fill === true });
437
476
  if (r.ok) { audioErrors.delete(c.id); arm(ctx, c.id); }
438
477
  },
439
478
  onError: (c) => { audioErrors.set(c.id, { at: new Date().toISOString(), error: c.error }); },
479
+ onSkip: (c) => addGap(c),
440
480
  // how far the live transcription has cut each source, kept with the capture so a restart picks up what it had buffered
441
481
  onCut: (c) => { try { notesCapture.setCut(ctx.runtimeDir, c.id, { source: c.source, sample: Math.round(c.until * whisper.RATE / 1000) }); } catch { /* best effort */ } },
442
482
  });
@@ -501,11 +541,14 @@ function finalInfo(ctx) {
501
541
  const d = ctx.notesFinalDetect ? ctx.notesFinalDetect() : notesFinal.detect(ctx.runtimeDir);
502
542
  return { ready: !!d.ready && !finalOff(ctx), transcriber: d.transcriber || null, vad: !!d.vad, speakers: !!d.diarize, missing: d.missing || [], setup: d.setup || '' };
503
543
  }
504
- /** Queue the final pass of a note when it can run. → { queued, reason } */
505
- function queueFinal(ctx, id) {
544
+ /** Queue the final pass of a note when it can run. A pass already queued or running in this process is kept, unless `force`
545
+ * (the PM asks for it again). → { queued, reason } */
546
+ function queueFinal(ctx, id, { force = false } = {}) {
506
547
  const dir = ctx.runtimeDir;
507
548
  const cur = notes.read(dir, id);
508
549
  if (!cur.ok || cur.note.private) return { queued: false, reason: 'this note is marked private' };
550
+ const now = !force && finalRunner && finalRunner.state(id);
551
+ if (now && (now.state === 'queued' || now.state === 'running')) return { queued: true, reason: '' };
509
552
  if (finalOff(ctx)) return { queued: false, reason: 'the final pass is switched off on this machine' };
510
553
  const info = finalInfo(ctx);
511
554
  if (!info.ready) return { queued: false, reason: 'local transcription is not set up' };
@@ -516,6 +559,30 @@ function queueFinal(ctx, id) {
516
559
  return { queued: true, reason: '' };
517
560
  }
518
561
  function cancelFinal(ctx, id) { if (finalRunner) finalRunner.cancel(id); }
562
+ /* STOP WRITES THE NOTES (notes-transcript-recovery). The page used to ask for the final pass after Stop (summarize with
563
+ * prefer 'agent'), and a Stop that did not come from the page that listened (the recording tab after Pause, the Viewer, a phone)
564
+ * never asked, so the notes were written from the live transcript alone, and a live transcript with gaps gave notes with gaps.
565
+ * Stop now queues the final pass itself: the whole kept audio is transcribed again, and the agent writes the notes from that.
566
+ * Without an engine or audio, the agent writes them from the live transcript at once. A later summarize from the page finds
567
+ * the pass queued (queueFinal keeps it) or the agent already asked (agentAsked), and starts nothing twice. */
568
+ function agentAsked(note) {
569
+ const a = note && note.agent;
570
+ if (!a || !a.started || a.imported_at) return false;
571
+ const asked = Date.parse(a.requested_at) || 0; const ended = Date.parse(note.ended_at) || 0;
572
+ return asked >= ended - 1000;
573
+ }
574
+ function finishAfterStop(ctx, id, ws) {
575
+ const dir = ctx.runtimeDir;
576
+ const cur = notes.read(dir, id);
577
+ if (!cur.ok || cur.note.private) return;
578
+ const q = queueFinal(ctx, id);
579
+ if (q.queued) return;
580
+ const n = cur.note;
581
+ if (!(n.transcript || []).length && !String(n.body || '').trim()) return;
582
+ if (agentAsked(n)) return;
583
+ const w = ws && ws.ok && ws.w ? ws.w : (n.ws ? ctx.getWs(n.ws) : null);
584
+ startAgent(ctx, dir, id, w && (!n.ws || w.id === n.ws) ? w : null);
585
+ }
519
586
 
520
587
  const WISPR_DELAY_MS = 5 * 60 * 1000;
521
588
  const WISPR_RETRY_MS = 2 * 60 * 1000;
@@ -627,7 +694,11 @@ function mergeWispr(ctx, id) {
627
694
  * reason, and the agent writes the notes from the live transcript, as Stop does without an engine;
628
695
  * - a summary run that was started, wrote nothing and is no longer a session is started again;
629
696
  * - a Wispr Flow check that was waiting or asking carries on from its own clock, or ends as failed once its deadline
630
- * after Stop is past (the PM can press Fetch to try again). */
697
+ * after Stop is past (the PM can press Fetch to try again);
698
+ * - a meeting that ended in the last BACKFILL_MS with no final pass at all (its Stop never asked for one) gets it now, from
699
+ * its kept audio, at most BACKFILL_MAX of them; the agent then writes its notes again from the whole meeting. */
700
+ const BACKFILL_MS = 14 * 24 * 60 * 60 * 1000;
701
+ const BACKFILL_MAX = 10;
631
702
  let resumedFor = null;
632
703
  function resumeStuck(ctx) {
633
704
  const dir = ctx.runtimeDir;
@@ -643,6 +714,7 @@ function resumeStuck(ctx) {
643
714
  return live;
644
715
  };
645
716
  const wsFor = (n) => { const w = n.ws ? ctx.getWs(n.ws) : null; return w && w.id === n.ws ? w : null; };
717
+ let backfill = BACKFILL_MAX;
646
718
  for (const row of l.notes) {
647
719
  const cur = notes.read(dir, row.id);
648
720
  if (!cur.ok || cur.note.private || listening(cur.note)) continue;
@@ -657,6 +729,11 @@ function resumeStuck(ctx) {
657
729
  if (!a || (!a.imported_at && !a.started)) { startAgent(ctx, dir, n.id, wsFor(n)); done.push({ id: n.id, final: 'failed', agent: 'started' }); }
658
730
  else done.push({ id: n.id, final: 'failed' });
659
731
  }
732
+ } else if (!fst && backfill > 0 && n.ended_at && Date.now() - (Date.parse(n.ended_at) || 0) <= BACKFILL_MS && n.recorded_from
733
+ && !(n.final && (n.final.segments || []).length) && !(finalRunner && finalRunner.state(n.id))) {
734
+ // ended without a final pass (a Stop that did not ask for it, before notes-transcript-recovery): it runs now, from the kept audio
735
+ const q = queueFinal(ctx, n.id);
736
+ if (q.queued) { backfill--; done.push({ id: n.id, final: 'queued', backfill: true }); }
660
737
  } else if (n.agent && n.agent.started && !n.agent.imported_at && !(n.agent.out && fs.existsSync(n.agent.out)) && n.agent.session && !liveIds().has(n.agent.session)) {
661
738
  startAgent(ctx, dir, n.id, wsFor(n));
662
739
  done.push({ id: n.id, agent: 'started' });
@@ -845,7 +922,7 @@ async function handle(req, res, url, ctx) {
845
922
  if (p === '/api/notes/stop') {
846
923
  const r = notes.stop(dir, { id, resumeMs: resumeMsOf(ctx) });
847
924
  notesCapture.close(dir, id);
848
- if (r.ok) { clearExpiry(id); swept.add(id); disarm(id); runMinute(ctx, id, { final: true }); scheduleWispr(ctx, id); }
925
+ if (r.ok) { clearExpiry(id); swept.add(id); disarm(id); runMinute(ctx, id, { final: true }); scheduleWispr(ctx, id); gaps.delete(id); finishAfterStop(ctx, id, wsOf()); }
849
926
  return done(r);
850
927
  }
851
928
  if (p === '/api/notes/transcript') {
@@ -905,6 +982,8 @@ async function handle(req, res, url, ctx) {
905
982
  }
906
983
  const pushed = tr.push({ id, source, pcm, t, final: body.final === true, exact: !!cap });
907
984
  if (cap) notesCapture.mark(dir, id, { source, seq: body.seq, end: sample + pcm.length / 2 });
985
+ // the transcriber has caught up: a stretch it skipped earlier is read back from the kept audio and transcribed now
986
+ if (gaps.has(id) && tr.pending() < whisper.FILL_ROOM) fillGaps(ctx, id, tr);
908
987
  return done(pushed);
909
988
  }
910
989
  if (p === '/api/notes/label') return done(notes.setLabel(dir, { id, index: Number(body.index), cat: body.cat, drop: body.drop === true }));
@@ -915,7 +994,7 @@ async function handle(req, res, url, ctx) {
915
994
  if (p === '/api/notes/final') {
916
995
  // the PM asks for the final pass again, for example after setting up a better engine
917
996
  if (!notes.read(dir, id).ok) return done(notes.read(dir, id));
918
- const q = queueFinal(ctx, id);
997
+ const q = queueFinal(ctx, id, { force: true });
919
998
  return done(q.queued ? { ok: true, queued: true } : { ok: false, status: 409, error: q.reason });
920
999
  }
921
1000
  if (p === '/api/notes/bullet') return done(notes.editBullet(dir, { id, bid: body.bullet, cat: body.cat, drop: body.drop, text: body.text, owner: body.owner, due: body.due }));
@@ -1023,7 +1102,7 @@ async function handle(req, res, url, ctx) {
1023
1102
  if (p === '/api/notes/private') {
1024
1103
  vocabCache.delete(id);
1025
1104
  const r = notes.setPrivate(dir, { id, private: body.private });
1026
- if (r.ok && r.private) { clearExpiry(id); disarm(id); unwatchLate(id); cancelFinal(ctx, id); unwatchWispr(id); if (transcriber) transcriber.drop(id); notesAudio.remove(dir, id); notesCapture.remove(dir, id); notesScreen.remove(dir, id); }
1105
+ if (r.ok && r.private) { gaps.delete(id); clearExpiry(id); disarm(id); unwatchLate(id); cancelFinal(ctx, id); unwatchWispr(id); if (transcriber) transcriber.drop(id); notesAudio.remove(dir, id); notesCapture.remove(dir, id); notesScreen.remove(dir, id); }
1027
1106
  return done(r);
1028
1107
  }
1029
1108
  if (p === '/api/notes/summarize') {
@@ -1045,6 +1124,8 @@ async function handle(req, res, url, ctx) {
1045
1124
  // with kept audio and an engine, the final pass runs first and the agent writes the notes from it (Run 9)
1046
1125
  const q = cur.ok && !cur.note.private ? queueFinal(ctx, id) : { queued: false };
1047
1126
  if (q.queued) { r.final = { state: 'queued' }; r.agent = { started: false, waiting: 'final', reason: '' }; r.source = 'agent'; return done(r); }
1127
+ // Stop already asked the agent (finishAfterStop): the same run is answered, not a second one started
1128
+ if (cur.ok && agentAsked(cur.note)) { const a = cur.note.agent; r.agent = { started: true, session: a.session || null, withheld: a.withheld, out: a.out, reason: '' }; r.source = 'agent'; return done(r); }
1048
1129
  const ag = cur.ok && cur.note.private ? { ok: false, error: 'this note is marked private, so it is not handed to any agent or service' }
1049
1130
  : startAgent(ctx, dir, id, ws.ok ? ws.w : null);
1050
1131
  r.agent = ag.ok ? (({ ok, ...x }) => x)(ag) : { started: false, reason: ag.error || 'the agent could not be asked' };
@@ -1052,7 +1133,7 @@ async function handle(req, res, url, ctx) {
1052
1133
  }
1053
1134
  return done(r);
1054
1135
  }
1055
- if (p === '/api/notes/delete') { clearExpiry(id); swept.delete(id); disarm(id); unwatchLate(id); cancelFinal(ctx, id); unwatchWispr(id); if (transcriber) transcriber.drop(id); const r = notes.remove(dir, id); if (r.ok) { notesAudio.remove(dir, id); notesCapture.remove(dir, id); notesScreen.remove(dir, id); } return done(r); }
1136
+ if (p === '/api/notes/delete') { gaps.delete(id); clearExpiry(id); swept.delete(id); disarm(id); unwatchLate(id); cancelFinal(ctx, id); unwatchWispr(id); if (transcriber) transcriber.drop(id); const r = notes.remove(dir, id); if (r.ok) { notesAudio.remove(dir, id); notesCapture.remove(dir, id); notesScreen.remove(dir, id); } return done(r); }
1056
1137
  if (p === '/api/notes/highlight') {
1057
1138
  // the PM's highlight: the transcript of the window, then Jev's label and the repository check of its text
1058
1139
  const r = notes.addHighlight(dir, { id, from: body.from, to: body.to });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.438.0",
3
+ "version": "0.440.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.438.0",
9
+ "version": "0.440.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.438.0",
3
+ "version": "0.440.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -80,8 +80,11 @@ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'applicati
80
80
 
81
81
  /* M: the eight moments */
82
82
  let p = await scene({ time: at(10, 20), today: [A, MT('mB', 'Quota review', 14, 0, 15, 0)], name: 'meeting' });
83
- let c = await wait(p, /Under way/);
84
- ok('M1 a meeting under way: says when it ends and names it', c && c.kind === 'meeting' && /Under way · ends in 40 min/.test(c.text) && /Partner sync/.test(c.text) && /Dana, Priya/.test(c.text), c && c.text);
83
+ // batch 18 item 3: the meeting under way is Home's own meeting line, so Your day says nothing of it (say it once): no card, no Now fold
84
+ const m1 = await until(() => p.evaluate(() => { const c = document.querySelector('#phoneCard'); const s = c && c.closest('.czs-sec'); return c && c.dataset.moment === 'meeting' && c.hidden && s && s.hidden ? { card: !c.hidden, fold: !s.hidden, text: c.textContent } : null; }))
85
+ || await p.evaluate(() => { const c = document.querySelector('#phoneCard'); const s = c && c.closest('.czs-sec'); return c ? { moment: c.dataset.moment, card: !c.hidden, fold: !!s && !s.hidden, text: c.textContent } : null; });
86
+ let c = null;
87
+ ok('M1 a meeting under way is left to Home: Your day shows no Now card and no Now fold', !!m1 && !m1.card && !m1.fold && !/Under way/.test(m1.text), JSON.stringify(m1));
85
88
  if (p.__shot) await p.__shot('light');
86
89
  await p.__ctx.close();
87
90
 
@@ -125,13 +128,13 @@ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'applicati
125
128
 
126
129
  /* O: Open the meeting */
127
130
  const hit = { ok: true, range: { start: DATE, end: DATE }, cells: [{ key: DATE, end: DATE, events: [{ id: 'ev1', title: A.title, at: A.start, end: A.end, attendees: A.people }] }], context: {} };
128
- p = await scene({ time: at(10, 20), today: [A], week: hit });
129
- await wait(p, /Under way/);
131
+ p = await scene({ time: at(9, 45), today: [A], week: hit }); // a meeting under way is Home's (M1): Open the meeting is pressed before it
132
+ await wait(p, /Starts/);
130
133
  await p.click('#phoneCard [data-pha="phopen"]');
131
134
  ok('O1 Open the meeting opens the meeting in the Viewer', await until(() => p.evaluate(() => { const v = document.querySelector('#czViewer:not([hidden])'); return !!v && /Partner sync/.test(v.textContent); })));
132
135
  await p.__ctx.close();
133
- p = await scene({ time: at(10, 20), today: [A], week: { ok: true, range: { start: DATE, end: DATE }, cells: [], context: {} } });
134
- await wait(p, /Under way/);
136
+ p = await scene({ time: at(9, 45), today: [A], week: { ok: true, range: { start: DATE, end: DATE }, cells: [], context: {} } });
137
+ await wait(p, /Starts/);
135
138
  await p.click('#phoneCard [data-pha="phopen"]');
136
139
  await sleep(800);
137
140
  ok('O2 when the calendar does not list it, the meeting still opens from the day\'s record, never in the old dialog and never the console', await p.evaluate(() => !document.querySelector('#dlg.on') && !!document.querySelector('#czViewer:not([hidden])') && /\/premium\.html$/.test(location.pathname)));
@@ -40,6 +40,12 @@
40
40
  .lv-tm.rec { color: var(--cz-red); }
41
41
  .lv-tm.stop { color: var(--cz-late); }
42
42
 
43
+ /* Home on a desktop (batch 18 item 6): beside the menu button the pill reached into the chat card and covered its +, whenever the list
44
+ is narrow or folded; it sits above the menu button instead, and its list opens above it */
45
+ @media (min-width: 761px) {
46
+ body.cz-home .cz-live { left: 8px; bottom: 68px; }
47
+ body.cz-home .lv-tray { bottom: 116px; }
48
+ }
43
49
  /* a phone: the menu button is bottom right, so the pill sits to its left, and the list is a short sheet */
44
50
  @media (max-width: 760px) {
45
51
  .cz-live { left: auto; right: 68px; }
@@ -133,7 +133,9 @@ export function transcriptModel(one, { max = 80 } = {}) {
133
133
  if (!n || n.private) return [];
134
134
  const names = n.speakers || {};
135
135
  const who = (src) => names[src] || { mic: 'You', meeting: 'Meeting', speech: 'You', typed: 'You (typed)' }[src] || 'You';
136
- const tr = (Array.isArray(n.transcript) ? n.transcript : []).filter((x) => x && !x.dropped && typeof x.text === 'string' && x.text.trim());
136
+ // in meeting-time order: a stretch filled in after the engine caught up is stored after the lines heard later
137
+ const tr = (Array.isArray(n.transcript) ? n.transcript : []).filter((x) => x && !x.dropped && typeof x.text === 'string' && x.text.trim())
138
+ .sort((a, b) => (Number.isFinite(a.t) ? a.t : 0) - (Number.isFinite(b.t) ? b.t : 0));
137
139
  const rows = tr.slice(-max).map((x) => ({ t: Number.isFinite(x.t) ? x.t : null, who: who(x.source), text: x.text.trim(), hl: false, dec: x.cat === 'decision', now: false }));
138
140
  for (const h of Array.isArray(n.highlights) ? n.highlights : []) {
139
141
  const ht = Number(h && (h.t != null ? h.t : h.from));
@@ -358,7 +358,8 @@ function day(on) {
358
358
  if (isPhone()) mountPull(body, { read: rereadDay, label: 'Reading your day again' });
359
359
  body.onclick = (e) => { // the rows are the list's own rows: the same presses open them
360
360
  const b = e.target.closest('button'); if (!b) return;
361
- if (b.dataset.hmSel) { select(b.dataset.hmSel); return; }
361
+ if (b.dataset.hmSel) { if (b.dataset.hmSel === 'n:update' && !rowById('n:update')) openUpdateViewer(); else select(b.dataset.hmSel); return; }
362
+ if (b.dataset.yd === 'fin') { const d = (dayParts().Y.drafts || [])[+b.dataset.i]; if (d && d.fin) { VW.drill(); openFinished(d.fin); } return; }
362
363
  if (b.dataset.yd === 'sel') { const c = b.closest('.yd-call'); if (c) select(c.dataset.id); return; }
363
364
  if (b.dataset.yd === 'retry' || b.dataset.yd === 'prep') { dayAct(b); return; }
364
365
  if (b.dataset.yd === 'sync') { syncAgain(b); return; }
@@ -366,7 +367,6 @@ function day(on) {
366
367
  if (b.dataset.yd === 'news' || b.dataset.yd === 'news-all') { VW.drill(); MORE.openInbox(searchGo, b.dataset.yd === 'news' ? b.dataset.id : ''); return; }
367
368
  if (b.dataset.yd === 'seen') { daySeen(b); return; }
368
369
  if ('hmReview' in b.dataset) { openReviewVw(); return; }
369
- if ('hdMeet' in b.dataset && S.Y && S.Y.next) openMeeting(S.Y.next.meeting);
370
370
  };
371
371
  } });
372
372
  readNews();
@@ -1807,7 +1807,7 @@ mountLivePill(document, {
1807
1807
  return true;
1808
1808
  },
1809
1809
  });
1810
- PHC = mountPhoneCard({ pmGet, pmPost, toast, ws: () => WS || null, openMeeting: (m) => openMeeting(m) }); drawList();
1810
+ PHC = mountPhoneCard({ pmGet, pmPost, toast, ws: () => WS || null, openMeeting: (m) => openMeeting(m), skip: ['meeting'] }); drawList();
1811
1811
  drawList(); drawTop();
1812
1812
  { // a conversation the address names opens at once, before the lists are read, so nothing typed or attached lands in the Home chat
1813
1813
  const a = P.get('about') || '', early = /^(decision|blocked|waited|src|ev|work|board|doc|ins|chat|pop):[A-Za-z0-9][A-Za-z0-9._:-]{0,100}$/.test(a) && !P.get('open') && !P.get('session') ? a : null;
@@ -198,10 +198,11 @@ function waitRow(r) {
198
198
  return `<div class="hm-r hv-r two" data-id="${esc(r.id)}"><button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}"><span class="hv-mk">${mark}</span><span class="hm-rt"><b>${esc(r.name)}</b>${sub}</span></button></div>`;
199
199
  }
200
200
  const DSTATE = { review: 'Ready for you at your desk', done: 'Finished', sent: 'Sent' };
201
- function draftRow(d) {
201
+ /* a draft row opens what it is (batch 18 item 3: both rows were dead on a phone): a finished draft opens what Claude wrote, the weekly update opens the update */
202
+ function draftRow(d, i) {
202
203
  if (d.row) return waitRow({ ...d.row, sub: d.row.sub || 'Drafted for you' });
203
204
  const f = d.fin;
204
- return `<div class="hm-r hv-r two yd-fin"><div class="hm-rm"><span class="hv-mk"><span class="yd-tick">${svg(CHECK, 13, 2.6)}</span></span><span class="hm-rt"><b>${esc(f.title)}</b><em>${esc(DSTATE[f.status] || 'Finished')}${f.summary ? ' · ' + esc(f.summary) : ''}</em></span></div></div>`;
205
+ return `<div class="hm-r hv-r two yd-fin"><button type="button" class="hm-rm" data-yd="fin" data-i="${i}" aria-label="${esc(f.title)}. Open"><span class="hv-mk"><span class="yd-tick">${svg(CHECK, 13, 2.6)}</span></span><span class="hm-rt"><b>${esc(f.title)}</b><em>${esc(DSTATE[f.status] || 'Finished')}${f.summary ? ' · ' + esc(f.summary) : ''}</em></span></button></div>`;
205
206
  }
206
207
 
207
208
  /* the L figure in Your move when nothing needs the PM: his tea on a quiet day (AdB2), celebrating on an earned one (AdB3) */
@@ -256,12 +257,10 @@ export function dayParts(Y, o = {}) {
256
257
  if (Y.calls.length) sections.push({ id: 'move', title: 'Your move', count: Y.calls.length, open: true, html: Y.calls.map(callHtml).join('') });
257
258
  else if (big) sections.push({ id: 'move', title: 'Your move', open: true, html: bigHtml(big) });
258
259
  { const nw = newsSection(Y.news || [], o.now, Y.digests || 0); if (nw) sections.push(nw); }
259
- if (Y.drafts.length) sections.push({ id: 'drafts', title: 'Drafted for you', count: Y.drafts.length, html: `<div class="hv-card">${Y.drafts.map(draftRow).join('')}</div>` });
260
+ if (Y.drafts.length) sections.push({ id: 'drafts', title: 'Drafted for you', count: Y.drafts.length, html: `<div class="hv-card">${Y.drafts.map((d, i) => draftRow(d, i)).join('')}</div>` });
260
261
  if (Y.wait.length) sections.push({ id: 'wait', title: 'Can wait', count: Y.wait.length, html: `<div class="hv-card hd-move">${Y.wait.map(waitRow).join('')}</div>` });
262
+ // the meeting on now or next is Home's own meeting line (say it once, batch 18 item 3); a phone's moment card shows only what Home does not
261
263
  if (o.moment) sections.push({ id: 'now', title: 'Now', open: true, html: '<div class="hd-now"></div>' }); // drawDay puts the moment card in
262
- else if (Y.next) {
263
- sections.push({ id: 'next', title: Y.next.now ? 'On now' : 'Next meeting', count: Y.next.now ? '' : Y.next.time, html: `<div class="hv-card"><div class="hm-r hv-r two"><button type="button" class="hm-rm" data-hd-meet><span class="hv-mk">${svg(CLOCK, 15)}</span><span class="hm-rt"><b>${esc(Y.next.title)}</b><em>${esc(Y.next.now ? 'On now' : Y.next.time)}</em></span><span class="hv-cv">${svg(CHEV, 16)}</span></button></div></div>` });
264
- }
265
264
  if (Y.tomorrow && !o.moment) sections.push(tomorrowSection(Y.tomorrow)); // a phone's moment card already shows tomorrow at the end of the day (say it once)
266
265
  sections.push({ id: 'week', title: 'This week', count: Y.week.sub, html: `<div class="hv-card"><div class="hm-r hv-r two" data-id="review"><button type="button" class="hm-rm" data-hm-review aria-label="Weekly review: ${esc(Y.week.sub)}. Open"><span class="hv-mk">${svg(CAL, 16)}</span><span class="hm-rt"><b>Weekly review</b><em>${esc(Y.week.sub)}</em></span><span class="hv-cv">${svg(CHEV, 16)}</span></button></div></div>` });
267
266
  const scene = !big && o.first && Y.mood !== 'concerned' && new Date(now).getHours() < 12;
@@ -3,7 +3,7 @@
3
3
  * the moment of the day, in the card's shape. At 640 px and narrower only; a desktop never reads /api/phone-day.
4
4
  * The moment comes from momentOf (c3-phone-model.js) over the /api/brief-page day and the clock; every line comes from /api/brief-page or
5
5
  * /api/phone-day. Done and Undo press /api/pm-items/done and /reopen on the PM's own item; nothing is written on load.
6
- * mountPhoneCard({ pmGet, pmPost, toast, ws, openMeeting }) → { el, read } */
6
+ * mountPhoneCard({ pmGet, pmPost, toast, ws, openMeeting, skip }) → { el, read }; skip: moment kinds left to Home (say it once) */
7
7
  import { momentOf, inText } from './phone-moment.js';
8
8
 
9
9
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
@@ -76,8 +76,10 @@ export function mountPhoneCard(o) {
76
76
  let h;
77
77
  if (!P.page) h = '<span class="label">Now</span><p class="phl">Reading your day.</p>';
78
78
  else if (!P.page.ok) h = `<span class="label">Now</span><p class="pherr" role="alert">Your day could not be read: ${esc(P.page.error || 'the workspace server did not answer')}.</p>`;
79
- else { const mo = momentNow(); el.dataset.moment = mo.kind; h = moment(mo); }
79
+ else { const mo = momentNow(); el.dataset.moment = mo.kind; h = (o.skip || []).includes(mo.kind) ? '' : moment(mo); }
80
80
  el.innerHTML = h;
81
+ // a moment Home already shows (batch 18 item 3: the live meeting is Home's own row) is said once: the card and its Now fold go quiet
82
+ el.hidden = !h; { const sec = el.closest('.czs-sec'); if (sec) { sec.hidden = !h; sec.style.display = h ? '' : 'none'; } }
81
83
  if (focus) { const f = el.querySelector(focus); if (f) f.focus(); }
82
84
  }
83
85
  async function read(force) {
@@ -109,7 +109,7 @@ export function budgetMeta(b, today) {
109
109
  const R = b.reading || {};
110
110
  if (R.txt) return [R.txt, ageOf(R.at, today, R.ageDays)].filter(Boolean).join(' · ');
111
111
  if (R.share != null) return Math.round(R.share * 100) + '% of open initiatives' + (b.cap != null ? ' · cap ' + Math.round(b.cap * 100) + '%' : '');
112
- return b.declared === false ? 'Not in the budget registry' : 'No reading yet';
112
+ return b.declared === false ? 'No limit set yet' : 'No reading yet'; // batch 18 item 4: plain words; the Viewer says what to do
113
113
  }
114
114
  /** The owner on the avatar: the server's who (from Jira or the PM), else today's owner string. */
115
115
  export function whoOf(g) {
@@ -163,10 +163,15 @@ export function draftRowHtml(r) {
163
163
  const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
164
164
  /** The ✦ line: the one thing that matters this week (GsM1–M5). The server's okr.line wins. Before it: a broken limit (red, the one time); else
165
165
  * the drafts waiting (✓✓ keeps them all); else the goal furthest behind with why; else a stale reading; else all on their line. It never says
166
- * "no insight": with nothing read it says what Claude does next. o = { okr, goals, budgets, drafts, running, product } */
166
+ * "no insight": with nothing read it says what Claude does next. o = { okr, goals, budgets, drafts, running, failed, product } */
167
167
  export function lineOf(o) {
168
168
  const L = o.okr && o.okr.line;
169
169
  const G = (o.goals || []).concat(o.budgets || []), open = (o.drafts || []).filter((r) => r.state === 'open'), name = o.product || 'this product';
170
+ // batch 18 item 4: what the drafting run does now wins over the server's line (it is older than the run), except a broken limit. While it
171
+ // runs, say so; when it failed or drafted nothing, say that plainly and offer ✦ again. o.failed: the run's error.
172
+ const loud = !!(L && L.tone === 'crit');
173
+ if (o.running && !loud) return { head: 'I am drafting the goals for ' + name + '.', sub: o.runningSay || 'I read the PRDs and the sources first, then I propose each goal with how I will read it. You can follow it in Sessions.', tone: 'drafts', keepAll: 0 };
174
+ if (o.failed && !open.length && !loud) return { head: 'I could not draft the goals for ' + name + '.', sub: String(o.failed).replace(/\.?$/, '.') + ' Press ✦ to try again.', tone: 'drafts', keepAll: 0, start: true, retry: true };
170
175
  // The server's line leads (lib/goal-status.js lineOf: one status everywhere). The drafts the page just loaded are fresher than the model, so
171
176
  // they set ✓✓ and the drafted sub; with none left, a sub about drafts is stale and goes.
172
177
  if (L && L.head && !(L.tone === 'calm' && open.length)) {
@@ -176,10 +181,9 @@ export function lineOf(o) {
176
181
  if (open.length && out.tone !== 'drafts') out.sub = open.length === 1 ? 'I drafted one fix under it.' : 'I drafted ' + open.length + ' fixes. Keep them all at once, or one by one.';
177
182
  else if (!open.length && L.keepAll) out.sub = '';
178
183
  }
179
- if (!(o.goals || []).length && !open.length && !o.running) { out.start = true; out.sub = out.sub || 'Or press ✦ and I draft the North Star and key results from your PRDs now, each with how I will read it.'; }
184
+ if (!(o.goals || []).length && !open.length && !o.running) { out.start = true; out.sub = out.sub || 'Press ✦ and I draft the North Star from your PRDs now, with how I will read it.'; }
180
185
  return out;
181
186
  }
182
- if (o.running) return { head: 'I am drafting the goals for ' + name + '.', sub: o.runningSay || 'I read the PRDs and the sources first, then I propose each goal with how I will read it.', tone: 'drafts', keepAll: 0 };
183
187
  const broken = G.filter((g) => dotOf(g) === 'broken');
184
188
  if (broken.length) {
185
189
  const b = broken[0], fix = open.find((r) => r.goal === b.id);
@@ -387,13 +387,13 @@ const listGoals = () => (PF ? [] : M.goals.filter((g) => isOwnKr(g) && (g.role =
387
387
  * the strip's first item; the findings and the reports Claude proposes follow it. It never says "There is no insight yet". */
388
388
  function okrLine() {
389
389
  const run = DR && DR.run;
390
- return OK.lineOf({ okr: M.okr, goals: listGoals(), budgets: M.budgets || [], drafts: drAll(), running: !!(run && run.state === 'running'), product: M.board.name });
390
+ return OK.lineOf({ okr: M.okr, goals: listGoals(), budgets: M.budgets || [], drafts: drAll(), running: !!(run && run.state === 'running'), failed: run && run.state === 'failed' ? (run.error || 'The run failed') : null, product: M.board.name });
391
391
  }
392
392
  function stripList() {
393
393
  const I0 = M.insight || { none: true, text: '' };
394
394
  // Your impact (batch 16 item 7, GmA4Moments): a key result that moved after your work, as one more ✦ line, with its source to open
395
395
  const im = PF ? null : IM.intelItem(), mine = im ? [im] : [];
396
- const ok = PF ? [] : [Object.assign({ okr: true, text: '', why: '' }, (() => { const L = okrLine(); return { text: L.head, why: L.sub, tone: L.tone, keepAll: L.keepAll, start: !!L.start }; })())];
396
+ const ok = PF ? [] : [Object.assign({ okr: true, text: '', why: '' }, (() => { const L = okrLine(); return { text: L.head, why: L.sub, tone: L.tone, keepAll: L.keepAll, start: !!L.start, retry: !!L.retry }; })())];
397
397
  if (I0.none) return ok.concat(PF ? [] : RI.stripItems(), mine);
398
398
  const finds = [{ text: I0.text, why: I0.why || '', chart: I0.chart, move: I0.move || null, calm: !!I0.calm }].concat((I0.more || []).map((x) => ({ text: x.text, why: x.why || '', chart: x.chart, move: x.move || null })));
399
399
  // a calm finding ("Nothing stands out") says what the ✦ line already says: it is left out
@@ -426,7 +426,7 @@ function drawStrip() {
426
426
  : `<button type="button" class="cz-ib sm solid" data-mv="apply" aria-label="${esc(mv.label)}" title="${esc(mv.label)}">${SV(I.chk)}</button>`;
427
427
  // the ✦ line's own press: ✓✓ keeps every draft (GsM1, GsM5); with nothing to read, ✦ asks Claude to draft the goals
428
428
  const okAct = !f.okr ? '' : f.keepAll ? `<button type="button" class="cz-ib sm solid" data-okl="keep-all" aria-label="Keep all ${f.keepAll}" title="Keep all ${f.keepAll}">${OK.SV(OK.P.checks)}</button>`
429
- : f.start && M.board.ws ? `<button type="button" class="cz-ib sm solid" data-okl="start" aria-label="Draft them" title="Draft them">${SV(I.spark)}</button>` : '';
429
+ : f.start && M.board.ws ? `<button type="button" class="cz-ib sm solid" data-okl="start" aria-label="${f.retry ? 'Try drafting again' : 'Draft them'}" title="${f.retry ? 'Try again' : 'Draft them'}">${SV(I.spark)}</button>` : '';
430
430
  if (!f.report) $('#insAct').innerHTML = mvAct + okAct;
431
431
  if (open.length > 1) {
432
432
  if (!f.report) $('#insAct').innerHTML = `<button type="button" class="cz-ib sm" id="insNo" aria-label="Not now" title="Not now">${SV(I.x)}</button>` + mvAct + okAct;
@@ -547,7 +547,8 @@ async function draftPress(k, row, b) {
547
547
  const res = await pmPost('/api/metric-drafts/' + k, Object.assign({}, base, row ? { row } : {}));
548
548
  if (!res || res.ok !== true) { if (b) b.disabled = false; toast((res && res.error) || 'It could not be done. Nothing changed.'); return; }
549
549
  const name = r0 ? r0.text : 'it';
550
- const said = k === 'start' ? 'I am drafting them. They appear under each goal.'
550
+ // batch 18 item 4: say only what the server started. The run is in Sessions; the ✦ line follows it and says when it ends, or why it failed.
551
+ const said = k === 'start' ? (res.already ? 'I am already drafting them. The drafts show here when I finish.' : 'Drafting now. Follow it in Sessions; the drafts show here when I finish.')
551
552
  : k === 'keep-all' ? 'Kept ' + (res.kept || 'them all') + '. I read them from now on.'
552
553
  : k === 'keep' ? (res.outbox ? (r0 && r0.kind === 'ticket' ? 'In the outbox for Jira.' : 'In the outbox. It goes as you.') : res.open === 'settings:connectors' ? 'Opening Connectors.' : 'Kept. I read it from now on.')
553
554
  : k === 'drop' ? 'Not now: ' + name + '.' : k === 'undo' ? 'Undone.' : 'Done.';
@@ -894,7 +895,7 @@ function openBudget(id) {
894
895
  const b = (M.budgets || []).find((x) => x.id === id); if (!b) return;
895
896
  const R = b.reading, has = R && R.share !== null;
896
897
  const sum = { line: [has ? pct(R.share) + ' now' : 'No reading yet', b.cap !== null ? 'cap ' + pct(b.cap) + ' of a quarter’s initiatives' : 'no cap declared'].join(' · '), tone: has && R.over ? 'warn' : '',
897
- text: has ? (R.over ? 'Over its cap.' : 'Within its cap.') + ' ' + R.n + ' of ' + R.total + ' open on the Board.' : 'It has no reading: ' + (b.declared ? 'no open initiative to share.' : 'it is not in the budget registry.'),
898
+ text: has ? (R.over ? 'Over its cap.' : 'Within its cap.') + ' ' + R.n + ' of ' + R.total + ' open on the Board.' : b.declared ? 'It has no reading: no open initiative to share.' : 'Initiatives use it, but no limit is set for it yet. Discuss it in Home and I set one up.',
898
899
  meta: [b.anchor, 'always on', 'judged every week'].join(' · ') };
899
900
  const text = [b.title, sum.line, sum.text].join('\n');
900
901
  vwOpen({ kind: 'Health budget', title: b.title, icon: 'goal', id: 'budget:' + id, more: [{ label: 'Copy as text', on: () => copyText(text, 'Copied as text.') }],
@@ -85,6 +85,7 @@ const norm = (t) => String(t || '').toLowerCase().replace(/\s+/g, ' ').trim();
85
85
  export const stepNorm = (s) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, 400).toLowerCase().replace(/[^a-z0-9 ]+/g, ' ').replace(/\s+/g, ' ').trim();
86
86
 
87
87
  /** The transcript as lines with who said each, and the key that names a speaker: `source` for live lines, `key` for the final segments. */
88
+ const byTime = (xs) => xs.slice().sort((a, b) => (Number.isFinite(a.t) ? a.t : 0) - (Number.isFinite(b.t) ? b.t : 0));
88
89
  export function linesOf(n) {
89
90
  if (!n || n.private) return [];
90
91
  const sp = n.speakers || {}, DEF = { mic: 'You', meeting: 'Meeting', speech: 'You' };
@@ -92,7 +93,8 @@ export function linesOf(n) {
92
93
  const names = (n.final && n.final.speakers) || {};
93
94
  return n.final.segments.filter((g) => g && String(g.text || '').trim()).map((g) => ({ t: g.t, text: String(g.text), who: names[g.spk] || sp[g.spk] || DEF[g.spk] || String(g.spk || 'Speaker'), key: g.spk == null ? '' : String(g.spk), source: '' }));
94
95
  }
95
- return (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' }));
96
+ // a stretch filled in after the engine caught up is stored after the lines heard later; the lines read in meeting-time order
97
+ 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' }));
96
98
  }
97
99
  /** 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. */
98
100
  export function factsOf(n) {
@@ -50,7 +50,7 @@
50
50
  </div>
51
51
 
52
52
  <!-- the ✦ strip (Iq8Overview): one finding at a time, its drafted move when it has one, Ask why, Not now and the dots that page through them -->
53
- <div class="ins-strip ins-hero" id="insHero"><span class="sp" aria-hidden="true"><svg viewBox="0 0 24 24"><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></span><p class="t" id="insText" aria-live="polite"><b id="insEye"></b> <span id="brief">Reading the records.</span> <span id="insWhy"></span><span class="ins-mv" id="insMv" hidden></span></p><span class="ins-hact" id="insAct"></span><a class="cz-chip gh" id="askWhy" href="/premium.html?ask=insights"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z"/></svg>Ask why</a><span class="ins-pg" id="insPg"></span></div>
53
+ <div class="ins-strip ins-hero" id="insHero"><span class="sp" aria-hidden="true"><svg viewBox="0 0 24 24"><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></span><p class="t" id="insText" aria-live="polite"><b id="insEye"></b> <span id="brief">Reading the records.</span> <span id="insWhy"></span><span class="ins-mv" id="insMv" hidden></span></p><span class="ins-hact" id="insAct"></span><a class="cz-chip gh" id="askWhy" href="/premium.html?ask=insights"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 5h16v11H9l-5 4z"/></svg>Ask why</a><span class="ins-pg" id="insPg"></span></div>
54
54
  <!-- the North Star and its inputs (Iq8Overview): drawn only when a KR metric record has role north-star -->
55
55
  <section class="ins-ns" id="nsRow" aria-label="North Star" hidden></section>
56
56
  <!-- what Claude drafted for this product (Iq8Suggest, Iq9Draft): shown only while a draft is running or waits for your ✓ -->
@@ -2934,7 +2934,7 @@ const metricDraftRuns = require('./lib/metric-draft-runs.js').create({
2934
2934
  env: process.env,
2935
2935
  promptFor: (skillId) => { const h = homeWorkspace(); const t = taskById(skillId, h ? h.root : SELF_ROOT); return t && t.prompt ? t.prompt : null; },
2936
2936
  spawn: (spec) => orchSpawn.spawn({ name: spec.name, agent: 'claude', ws: spec.ws, origin: spec.origin, initialInput: spec.initialInput, initiative: spec.initiative, extraEnv: spec.env, autoDelete: undefined, onDone: spec.onDone }),
2937
- spawnNow: (spec) => spawnSession({ name: spec.name, agent: 'claude', ws: spec.ws, origin: spec.origin, initialInput: spec.initialInput, initiative: spec.initiative, extraEnv: spec.env, autoDelete: undefined, onDone: spec.onDone }),
2937
+ spawnNow: (spec) => spawnSession({ name: spec.name, agent: 'claude', ws: spec.ws, origin: spec.origin, initialInput: spec.initialInput, initiative: spec.initiative, extraEnv: spec.env, autoDelete: undefined, onDone: spec.onDone, byPm: spec.byPm === true }),
2938
2938
  stop: (s) => { if (s && s.child) stopHeadless(s); },
2939
2939
  warn: (what, e) => warnWriteFail(what, e),
2940
2940
  });
@@ -3129,6 +3129,7 @@ function persist(s) {
3129
3129
  state: s.state, note: s.note || '', created: s.created, tmux: s.tmux || null, origin: s.origin || null };
3130
3130
  if (s.autoDelete) meta.autoDelete = s.autoDelete;
3131
3131
  if (s.autoEnded) meta.autoEnded = true;
3132
+ if (s.byPm) meta.byPm = true;
3132
3133
  if (s.headless) meta.headless = s.headless;
3133
3134
  if (s.outcome) meta.outcome = s.outcome; // a background run's end, for its card (initiative background-run-outcome)
3134
3135
  if (s.exitedAt) meta.exitedAt = s.exitedAt;
@@ -3581,7 +3582,7 @@ function sessionList() {
3581
3582
  auto_name: s.autoName ? s.autoName.text : null, name_by: s.nameBy || null,
3582
3583
  model: 'model' in s ? s.model : null, model_line: modelLib.line('model' in s ? s.model : null),
3583
3584
  cwd: path.relative(s.root, s.cwd) || '.', note: s.note || '', origin: s.origin || null,
3584
- automatic: sessionOrigin.isAutomatic(s.origin), // the workspace started it, not the PM: the dock hides these by default
3585
+ automatic: sessionOrigin.isAutomatic(s.origin) && !s.byPm, // the workspace started it, not the PM: the dock hides these by default
3585
3586
  auto_delete: s.autoDelete || null,
3586
3587
  auto_ended: !!s.autoEnded, // PMOS ended it (idle, or room for a newer chat), not the PM: a chat's row stays on Home and resumes (batch 7)
3587
3588
  headless: s.headless || null, // workspace-headless-jobs: a background run with no terminal ('notes' or 'skill')
@@ -4369,7 +4370,7 @@ function spawnSession(opts) {
4369
4370
  return s;
4370
4371
  }
4371
4372
  function noteSessionEnd(s) { try { if (refreshRun) refreshRun.ended(s); } catch (e) { warnWriteFail('refresh log (end)', e); } }
4372
- function spawnSessionInner({ name, agent, cwd, ws, origin, initialInput, profile, initiative, modelAsk, planItem, workType, autoDelete, launchFlags, addDirs, onDone, scratch, extraEnv, writePaths, chatClaude }) {
4373
+ function spawnSessionInner({ name, agent, cwd, ws, origin, initialInput, profile, initiative, modelAsk, planItem, workType, autoDelete, launchFlags, addDirs, onDone, scratch, extraEnv, writePaths, chatClaude, byPm }) {
4373
4374
  const id = nextSessionId();
4374
4375
  /* pm-os-absorb Run 1 — every AGENT session gets a token, `<id>.<8 hex>`, in its environment as PMOS_SESSION, and
4375
4376
  * PMOS_BIN, this workspace's own bin/pmos.js. `pmos item` run inside it is then attributed `agent:<token>` (the token
@@ -4426,9 +4427,10 @@ function spawnSessionInner({ name, agent, cwd, ws, origin, initialInput, profile
4426
4427
  itemEnv.PMOS_WS_PORT = String(PORT);
4427
4428
  Object.assign(penv, itemEnv);
4428
4429
  // horizon-scan: the scan runs set PMOS_SCAN_FILE, PMOS_SCAN_ORIGIN and PMOS_SCAN_RUN for `pmos scan file`; the report-setup and report-find runs
4429
- // (report-workspace) set PMOS_REPORT_FILE and PMOS_REPORT_RUN for `pmos report propose`; nothing else is added.
4430
+ // (report-workspace) set PMOS_REPORT_FILE and PMOS_REPORT_RUN for `pmos report propose`.
4430
4431
  // core-documents: a core-doc run sets PMOS_CORE_DOC_SCOPE and PMOS_CORE_DOC_KEY, the one entry `pmos coredoc write` may write.
4431
- if (extraEnv && typeof extraEnv === 'object') for (const k of ['PMOS_SCAN_FILE', 'PMOS_SCAN_ORIGIN', 'PMOS_SCAN_RUN', 'PMOS_REPORT_FILE', 'PMOS_REPORT_RUN', 'PMOS_CORE_DOC_SCOPE', 'PMOS_CORE_DOC_KEY', 'PMOS_CORE_DOC_KEYS']) if (typeof extraEnv[k] === 'string') penv[k] = extraEnv[k];
4432
+ // A metric-draft, propose, impact, metric-read or ms-review run sets its own pins too (lib/headless.js RUN_ENV).
4433
+ Object.assign(penv, headlessLib.runEnvOf(extraEnv));
4432
4434
  const base = { id, ws: w ? w.id : wsId(SELF_ROOT), root, name: (name && String(name).trim()) || agent, agent, origin: tag,
4433
4435
  profile: pres.id, profileRefusal: pres.ok ? null : pres.error };
4434
4436
  // Hand to agent: the breakdown item this session was started for, or null. Set only by /api/plan-items/handoff/go.
@@ -4437,6 +4439,9 @@ function spawnSessionInner({ name, agent, cwd, ws, origin, initialInput, profile
4437
4439
  if (scratch) base.scratchDir = workdir; // removed when the web run ends (startHeadless)
4438
4440
  // 'never' opts this one job out of the automatic clean-up (lib/session-origin.js); anything else is the workspace policy.
4439
4441
  if (autoDelete === 'never') base.autoDelete = 'never';
4442
+ // batch 18 item 4: a background run the PM's own press started (✦ Draft them on Intelligence) is listed with the PM's sessions while it runs,
4443
+ // not folded into "Started by PMOS", so the press shows a session at once
4444
+ if (byPm === true) base.byPm = true;
4440
4445
  const wt = workTypeOrNull(workType);
4441
4446
  if (wt) base.workType = wt;
4442
4447
  // session names A: a chat that resumes its own Claude conversation keeps the name it had (the PM's, or Claude's)
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "notes-transcript-recovery (Wawan, 2026-10-28): the live transcript fills the stretches it skipped, Qwen3-ASR failing hands over to whisper.cpp, Stop runs the final pass itself, and ended meetings with no final pass get one after a restart.",
3
+ "modules": [
4
+ "notes-transcript-recovery.test.js"
5
+ ],
6
+ "seconds": {
7
+ "notes-transcript-recovery.test.js": 3
8
+ }
9
+ }
@@ -116,7 +116,9 @@ function configure({ name = 'run', port = null } = {}) {
116
116
  PORT: chosen, HOST, BASE: `http://${HOST}:${chosen}`, STATE_DIR: stateDir,
117
117
  /** Environment for a spawned server/launcher: this run's state dir and tmux socket. */
118
118
  env(extra = {}) {
119
- return { ...process.env, PMOS_STATE_DIR: stateDir, ...extra };
119
+ // PMOS_IMPACT=off: the daily Your impact run starts on the first tick inside working hours and would take a background slot (and a
120
+ // session row) in whatever suite happens to run then; a suite about it passes PMOS_IMPACT itself (feedback batch 18, CI)
121
+ return { ...process.env, PMOS_STATE_DIR: stateDir, PMOS_IMPACT: 'off', ...extra };
120
122
  },
121
123
  /** A port nobody else holds, for a suite that needs a second server. */
122
124
  port: claimEphemeralPort,