create-pmos 0.581.0 → 0.582.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 +14 -14
- 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 +13 -0
- package/workspace/guide/agent-capabilities.md +2 -1
- package/workspace/guide/notes.md +4 -3
- package/workspace/lib/bg-queue.js +2 -1
- package/workspace/lib/idle-lab-engine.js +2 -1
- package/workspace/lib/job-graph.js +3 -0
- package/workspace/lib/live-round-meeting.js +167 -0
- package/workspace/lib/meeting-focus.js +42 -10
- package/workspace/lib/routes-meeting-focus.js +57 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-rec-now.css +2 -0
- package/workspace/public/pm/cozy-rec-now.js +27 -8
- package/workspace/server.js +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.582.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,19 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.582.0",
|
|
38
|
+
"at": "2026-11-17T02:50:44.770Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1313,
|
|
43
|
+
"t": "The meeting companion offers a live round (live round W2)",
|
|
44
|
+
"s": "The meeting companion offers a live round (live round W2)",
|
|
45
|
+
"k": "new"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
36
49
|
{
|
|
37
50
|
"v": "0.581.0",
|
|
38
51
|
"at": "2026-11-17T02:30:27.550Z",
|
|
@@ -285,19 +298,6 @@
|
|
|
285
298
|
"k": "new"
|
|
286
299
|
}
|
|
287
300
|
]
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
"v": "0.562.0",
|
|
291
|
-
"at": "2026-11-11T11:26:34.804Z",
|
|
292
|
-
"f": 4,
|
|
293
|
-
"prs": [
|
|
294
|
-
{
|
|
295
|
-
"n": 1293,
|
|
296
|
-
"t": "Keep keys out of backups, harden pm-os.app headers, cloud SSH and updates",
|
|
297
|
-
"s": "The PM's keys are no longer copied into the backup folder; pm-os.app tells browsers to stay on HTTPS and refuses framing by other sites; a new cloud server signs in by SSH key only and installs security updates itself.",
|
|
298
|
-
"k": "fix"
|
|
299
|
-
}
|
|
300
|
-
]
|
|
301
301
|
}
|
|
302
302
|
]
|
|
303
303
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-17T02:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-17T02:50:41Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-17T02:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-17T02:50:41Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-17T02:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-17T02:50:41Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.582.0",
|
|
4
|
+
"at": "2026-11-17T02:50:44.770Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1313,
|
|
9
|
+
"t": "The meeting companion offers a live round (live round W2)",
|
|
10
|
+
"s": "The meeting companion offers a live round (live round W2)",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.581.0",
|
|
4
17
|
"at": "2026-11-17T02:30:27.550Z",
|
|
@@ -102,6 +102,7 @@ A loop never sends a message, moves a Jira ticket, merges into a product reposit
|
|
|
102
102
|
| [Horizon scan](intelligence-okr-goals.md) | Daily by default, at most once a day, the first time you step away after 09:00. Scan now: at most 3 a day. | The public web for your kept watch list, and your repository | Report documents and proposals you approve | Cadence: Off. `PMOS_SCAN=off` |
|
|
103
103
|
| Live round | When you press ✓ on its ✦ ask, or run `pmos lab round`. Three runs at once, 2 minutes at most. | The initiative's name, the product's Intent and its token sheet; a feedback round also reads the last version. | "PMOS prototyped it" or "PMOS improved it" under the initiative's ✦, each version as soon as it renders. | ✕ on its ✦ ask; Undo after ✓ |
|
|
104
104
|
| Idle lab | When you have not used PMOS for 30 minutes. One run at a time, at most 3 results each time you step away. | Prototypes: the initiative's record, PRD and earlier specimens. Scans: public pages only, read through `pmos lab page`, and no repository. | "PMOS prototyped it", "PMOS improved it" and "PMOS scanned for it" under the initiative's ✦. A finding that fits no initiative: Intelligence › Lab. | `pmos ai off idle-lab` |
|
|
105
|
+
| [Prototypes before a meeting](notes.md) | A meeting starts in the next 60 minutes, and its title, agenda or material names an initiative in Triage or Discover with no prototype. One round at a time. An initiative is tried once a week at most, and never while a round waits for you. | The initiative, as a live round reads it | Round 1 under the initiative's ✦ at minute 0. In the meeting, ✓ on **✦ Show it?** starts the next round. | `pmos ai off meeting-prewarm` |
|
|
105
106
|
| [What you might have missed](claude-proposes.md) | Each Monday, for the week before. It uses no model. | Records only: tasks, dates, initiatives and Jira status | One ✦ in Home's chat, at most 3 items | `pmos ai off drift`. `PMOS_DRIFT=off` |
|
|
106
107
|
| [The story so far](home.md) | Once, when you open a product that has no story yet. At most once a day for each product. | The initiatives, their stages and dates, and the Intent and Goal | "The story so far" on the product page. After that, the weekly report keeps it current. | `pmos ai off story-seed`. `PMOS_STORY_SEED=off` |
|
|
107
108
|
| Change check | When no merged pull request waits for the verifier. At most 4 a day. | One change that PMOS made by itself, the record it changed, and its sources | Nothing when it passes. A FAIL removes the change from "did" and counts like an Undo. | `pmos ai off verify`. `PMOS_VERIFY_CHANGES=off` |
|
|
@@ -141,7 +142,7 @@ When you ask an agent session to do a piece of work, it can finish it, including
|
|
|
141
142
|
- `pmos ai log [<job>]`: the last audit lines. Each dropped proposal shows why.
|
|
142
143
|
- `pmos ai off [<job>]` and `pmos ai on [<job>]`: turn every AI job, or one job, off or on. `PMOS_AI=off` in the environment wins over the setting.
|
|
143
144
|
|
|
144
|
-
The AI jobs are `past-repeat`, `decision-memory`, `outcomes`, `descriptions`, `drift`, `rehearse`, `next-prompt`, `sharpen-prompt`, `idle-lab` and `live-round` (`pmos ai off live-round` stops new live rounds; one that runs ends by itself). The switch also covers each job in the queue by its queue name: `schedules`, `proactive`, `prepare`, `day`, `refresh`, `reports`, `driver`, `goal-loops`, `finder`, `coredocs`, `milestones`, `propose`, `grill`, `metric-drafts`, `impact`, `metric-reads`, `forecast`, `report-design`, `report-structure`, `team`, `scan` and `idle-lab`. `pmos ai off` with no job stops all of them. Git sync uses no model, so the switch does not stop it. A background run cannot change the switch.
|
|
145
|
+
The AI jobs are `past-repeat`, `decision-memory`, `outcomes`, `descriptions`, `drift`, `rehearse`, `next-prompt`, `sharpen-prompt`, `idle-lab` and `live-round` (`pmos ai off live-round` stops new live rounds; one that runs ends by itself). The switch also covers each job in the queue by its queue name: `schedules`, `proactive`, `prepare`, `day`, `refresh`, `reports`, `meeting-prewarm`, `driver`, `goal-loops`, `finder`, `coredocs`, `milestones`, `propose`, `grill`, `metric-drafts`, `impact`, `metric-reads`, `forecast`, `report-design`, `report-structure`, `team`, `scan` and `idle-lab`. `pmos ai off` with no job stops all of them. Git sync uses no model, so the switch does not stop it. A background run cannot change the switch.
|
|
145
146
|
|
|
146
147
|
## The team of role agents
|
|
147
148
|
|
package/workspace/guide/notes.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Notes: record a meeting, and present while it records"
|
|
4
4
|
description: "Record a meeting on this machine, the notes caught and checked, presenting while it records, and the Chrome extension over Google Meet."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-17
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Notes
|
|
@@ -323,11 +323,12 @@ While a meeting records, the recording tab shows the Now panel. With a shared sc
|
|
|
323
323
|
- **Check**: the shared screen and the talk do not agree, for example a date on a slide.
|
|
324
324
|
- **Follow-up**: an action from the last meeting is still open, and nobody raised it.
|
|
325
325
|
- **No owner yet**: the room agreed on something, and nobody owns it.
|
|
326
|
+
- **✦ Show it?**: the room talks about an idea that nobody can judge from words, for example a page or a flow. PMOS offers to make 3 quick ways to see it. PMOS offers once and never starts by itself. A Show it? offer counts as one of the 2 prompts.
|
|
326
327
|
|
|
327
|
-
Press ✓ when you raised it, or ✗ for not now. The prompt goes away and does not come back.
|
|
328
|
+
Press ✓ when you raised it, or ✗ for not now. The prompt goes away and does not come back. On **Show it?**, ✓ starts a live round on the meeting's initiative (or the initiative PMOS named). The 3 specimens show on the initiative one by one, each after PMOS proves that it opens. When the meeting names no initiative, PMOS says so and starts nothing: link the meeting to an initiative, or ask in the initiative's chat. ✗ on Show it? shows **Undo**, which brings the offer back.
|
|
328
329
|
|
|
329
330
|
- **The counts line** shows the decisions, next steps and highlights so far, for example "1 decision · 1 next step · 1 highlight".
|
|
330
|
-
- **The note box**: type a line and press Enter. A line that ends with "?" goes to PMOS as a question. Any other line is added to your notes. The answer shows above the box, with where it came from (the talk, the screen, the prep or last time). Press + to add the answer to your notes.
|
|
331
|
+
- **The note box**: type a line and press Enter. A line that ends with "?" goes to PMOS as a question. A line that starts with "show", "prototype", "mock up" or "sketch" (for example "show 3 ways to warn a partner") becomes a **✦ Show it?** offer at once. Any other line is added to your notes. The answer shows above the box, with where it came from (the talk, the screen, the prep or last time). Press + to add the answer to your notes.
|
|
331
332
|
|
|
332
333
|
To read what was said, press the transcript icon in the bar. The live transcript opens as a card beside the panel. A star shows a highlight and a diamond shows a decision. The card is closed when the recording starts.
|
|
333
334
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* 1 asked what the PM asked for: Scan now, "grill this", Prepare my day. A press starts at once through the route and is never
|
|
14
14
|
* held, so step 1 has no tick here. It is in the table so the Lab can list it.
|
|
15
15
|
* 2 due what is due at a set time: schedules, the morning brief and the day check, the day plan, the data refresh, report
|
|
16
|
-
* schedules, Git sync
|
|
16
|
+
* schedules, Git sync, round 1 of a prototype before a meeting that names an early initiative (lib/live-round-meeting.js)
|
|
17
17
|
* 3 driver the Initiative Driver, and the rounds of the long-running goals (D106, lib/goal-loop.js)
|
|
18
18
|
* 4 deep the deep drafts: core documents, Your impact, metric drafts and reads, proposals, grill, the report finder, the
|
|
19
19
|
* report design and structure checks, milestone reviews, the forecast, the role agents (lib/team-runs.js), the verifier after merge
|
|
@@ -70,6 +70,7 @@ const JOBS = Object.freeze([
|
|
|
70
70
|
{ id: 'refresh', step: 2, label: 'Data refresh' },
|
|
71
71
|
{ id: 'reports', step: 2, label: 'Report schedules' },
|
|
72
72
|
{ id: 'sync', step: 2, label: 'Git sync', ai: false },
|
|
73
|
+
{ id: 'meeting-prewarm', step: 2, label: 'Prototypes before a meeting' }, // lib/live-round-meeting.js: round 1 waits at minute 0
|
|
73
74
|
{ id: 'driver', step: 3, label: 'Initiative Driver' },
|
|
74
75
|
{ id: 'goal-loops', step: 3, label: 'Goal loops' }, // D106: the rounds of a long-running goal (lib/goal-loop.js)
|
|
75
76
|
{ id: 'finder', step: 4, label: 'Report finder' },
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* JOB · VERSION · MAX_RESULTS · candidates(input) PURE · nextOf(cands) PURE · promptOf(skill, c, o) PURE
|
|
42
42
|
* readRuns(rt) · appendRun(rt, line, now?) · spentIn(rt, month) · pagesDir(rt, run) · pendingFile(rt, run) · runSpecimenDir(rt, run)
|
|
43
43
|
* pageRef(run, n, line) · guardProposal(entry, { run }) PURE · renderCheck(abs, { phone? }) · ensureReplay(rt) (phone: also at 390 px, nothing wider)
|
|
44
|
-
* create(deps) → { tick(turn), finish(run, r), active(), status() }
|
|
44
|
+
* create(deps) → { tick(turn), finish(run, r), active(), status(), products(now) }
|
|
45
45
|
*/
|
|
46
46
|
const fs = require('fs');
|
|
47
47
|
const path = require('path');
|
|
@@ -531,6 +531,7 @@ function create(deps) {
|
|
|
531
531
|
return {
|
|
532
532
|
tick, finish,
|
|
533
533
|
active: () => (active ? { run: active.run, kind: active.c.kind, ini: active.c.ini, ws: active.c.ws } : null),
|
|
534
|
+
products: (now) => products(now || Date.now()), // what the lab reads, for lib/live-round-meeting.js (the meeting pre-warm)
|
|
534
535
|
status: () => ({ active: active ? active.run : null, stretch: stretch ? { since: new Date(stretch.since).toISOString(), filed: stretch.filed } : null }),
|
|
535
536
|
};
|
|
536
537
|
}
|
|
@@ -103,6 +103,8 @@ const LEDGERS = Object.freeze({
|
|
|
103
103
|
r('lib/improve-runs.js', 'L.LEDGER', "products start learning only once PMOS's own loop passed stage 2 (selfStage)")] },
|
|
104
104
|
'repo:planning/runs/verify-queue.jsonl': { concept: 'verify-requests', owner: 'repo:scripts/verify-queue.js', readers: [
|
|
105
105
|
r('repo:scripts/verifier.js', 'deriveQueue', 'the verifier after merge: the next merged run to grade')] },
|
|
106
|
+
'<runtime>/idle-lab/meeting-prewarm.jsonl': { concept: 'meeting-prewarm-tries', owner: 'lib/live-round-meeting.js', readers: [
|
|
107
|
+
r('lib/live-round-meeting.js', 'meeting-prewarm.jsonl', 'the 7-day retry: an initiative tried before a meeting waits a week')] },
|
|
106
108
|
'repo:planning/runs/evals.jsonl': { concept: 'review-verdicts', owner: 'repo:scripts/record-eval.js', readers: [
|
|
107
109
|
r('repo:scripts/check-calibration.js', 'evals.jsonl', 'κ per evaluator model against the PM\'s labels'),
|
|
108
110
|
r('repo:scripts/verifier.js', 'verdictOracle', 'a verdict closes its queue entry')] },
|
|
@@ -154,6 +156,7 @@ const JOBS = Object.freeze([
|
|
|
154
156
|
q('scan', 'lib/scan-run.js', ['<state>/scan.jsonl'], ['public web']),
|
|
155
157
|
q('idle-lab', 'lib/idle-lab-engine.js', ['<runtime>/idle-lab.jsonl', props], [props]),
|
|
156
158
|
q('live-round', 'lib/live-round.js', [props], [props], 'step 1: the PM\'s ✓ or `pmos lab round` starts it at once; three runs, each file proven before it shows; it also adds Specimens and Lessons lines (lib/artefacts.js)'),
|
|
159
|
+
q('meeting-prewarm', 'lib/live-round-meeting.js', ['<runtime>/idle-lab/meeting-prewarm.jsonl'], [props, 'calendar', '<runtime>/meeting-material.jsonl'], 'round 1 itself is filed by lib/live-round.js (W1)'),
|
|
157
160
|
ai('past-repeat', 'lib/past-repeat.js', [props], ['repo:DECISIONS.md']),
|
|
158
161
|
ai('decision-memory', 'lib/decision-memory.js', [props], ['repo:DECISIONS.md']),
|
|
159
162
|
ai('outcomes', 'lib/outcome-props.js', [props], ['initiative records']),
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* live-round-meeting.js — round 1 is ready before the meeting (initiative live-round-meeting, part 2; brief /mnt/project-files/live-round/briefs.md W2).
|
|
3
|
+
*
|
|
4
|
+
* WHEN. Job `meeting-prewarm`, step 2 of the shared queue (lib/bg-queue.js, "due at a set time"): it looks once a minute and does not wait
|
|
5
|
+
* for the idle clock. The off switch is `pmos ai off meeting-prewarm`.
|
|
6
|
+
*
|
|
7
|
+
* WHAT. Candidate kind `prototype-meeting`: a meeting that starts in the next 60 minutes whose agenda (the invite's lines, lib/meeting-focus.js
|
|
8
|
+
* topicsFrom), its title or its material (lib/meeting-material.js) names an initiative that is
|
|
9
|
+
* - open and in Triage or Discover (or with no stage yet),
|
|
10
|
+
* - with no prototype yet (no `prototyped` or `improved` proposal on it, in any state),
|
|
11
|
+
* - with no round waiting for the PM (lib/live-round.js waiting) and none running (running), and
|
|
12
|
+
* - not tried in the last 7 days (the same retry as the idle lab).
|
|
13
|
+
* An initiative is named by its id, by the meeting's own initiative, or by its title (two words or more) inside one of those lines.
|
|
14
|
+
*
|
|
15
|
+
* HOW. One round at a time: lib/live-round.js round({ ws, board, ini, brief, from: 'meeting', step: 2 }) — three directions, each specimen
|
|
16
|
+
* proved before it shows. So round 1 waits under the initiative's ✦ at minute 0. In the meeting, ✓ on a Show it? offer starts the next round
|
|
17
|
+
* (lib/routes-meeting-focus.js). Nothing is written to a product repository; the specimens stay in the runtime folder (D60, D65).
|
|
18
|
+
*
|
|
19
|
+
* LEDGER <runtime>/idle-lab/meeting-prewarm.jsonl, append-only:
|
|
20
|
+
* { at, kind: 'start', key, ws, ini, event, round } a round started for a meeting
|
|
21
|
+
* { at, kind: 'fail', key, ws, ini, event, error } it could not start (it counts as tried, so it waits 7 days)
|
|
22
|
+
*
|
|
23
|
+
* KIND · JOB · AHEAD_MS · RETRY_MS
|
|
24
|
+
* namesOf(event, material) PURE → [text] the lines that can name an initiative
|
|
25
|
+
* named(texts, ini, event) PURE → boolean
|
|
26
|
+
* candidates({ events, products, material, now, tried, waiting, running }) PURE → [{ kind, ws, board, ini, title, event, key, why, brief }]
|
|
27
|
+
* read(rt) · tried(rt) → Map key → ms of its last try
|
|
28
|
+
* create(deps) → { tick(turn), status() }
|
|
29
|
+
*/
|
|
30
|
+
const fs = require('fs');
|
|
31
|
+
const path = require('path');
|
|
32
|
+
const F = require('./meeting-focus.js');
|
|
33
|
+
|
|
34
|
+
const KIND = 'prototype-meeting';
|
|
35
|
+
const JOB = 'meeting-prewarm';
|
|
36
|
+
const AHEAD_MS = 60 * 60000; // a meeting in the next hour
|
|
37
|
+
const RETRY_MS = 7 * 864e5; // the idle lab's retry: a key that was tried waits a week
|
|
38
|
+
const EARLY = /triage|discover|intake|idea/i;
|
|
39
|
+
const CLOSED = /^(done|stopped|archived|won't do|closed)$/i;
|
|
40
|
+
const PROTO_GROUPS = new Set(['prototyped', 'improved']);
|
|
41
|
+
|
|
42
|
+
const str = (v) => (typeof v === 'string' ? v : '');
|
|
43
|
+
const one = (v, n) => String(v == null ? '' : v).replace(/\s+/g, ' ').trim().slice(0, n);
|
|
44
|
+
const fileOf = (rt) => path.join(rt, 'idle-lab', 'meeting-prewarm.jsonl');
|
|
45
|
+
const clock = (ms) => { const d = new Date(ms); return String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0'); };
|
|
46
|
+
|
|
47
|
+
/** PURE. The lines of a meeting that can name an initiative: its title, purpose, invite lines, and its material's titles and paths. */
|
|
48
|
+
function namesOf(event, material) {
|
|
49
|
+
const e = event || {};
|
|
50
|
+
const out = [str(e.title), str(e.purpose), str(e.description).slice(0, 2000)];
|
|
51
|
+
for (const t of F.topicsFrom(e, null)) out.push(t.text);
|
|
52
|
+
for (const m of Array.isArray(material) ? material : []) {
|
|
53
|
+
const it = (m && m.item) || m || {};
|
|
54
|
+
out.push(str(it.title), str(it.ref), str(m && m.topic));
|
|
55
|
+
}
|
|
56
|
+
return out.filter(Boolean);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** PURE. Does one of the lines name the initiative? By id (as a whole word), by the meeting's own initiative, or by a title of two words or more. */
|
|
60
|
+
function named(texts, ini, event) {
|
|
61
|
+
const e = event || {};
|
|
62
|
+
const own = e.initiative && typeof e.initiative === 'object' ? e.initiative.id : e.initiative;
|
|
63
|
+
if (own && String(own) === ini.ini) return true;
|
|
64
|
+
const hay = (texts || []).map((t) => ' ' + F.norm(t) + ' ');
|
|
65
|
+
const id = F.norm(ini.ini);
|
|
66
|
+
if (id && hay.some((h) => h.includes(' ' + id + ' '))) return true;
|
|
67
|
+
const title = F.norm(ini.title);
|
|
68
|
+
if (title && title !== id && title.split(' ').length >= 2 && hay.some((h) => h.includes(' ' + title + ' '))) return true;
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** PURE. The prototype-meeting candidates, soonest meeting first, at most one per initiative.
|
|
73
|
+
* events: calendar events [{ id, title, at, end, initiative?, steps?, purpose? }]; products: as the idle lab reads them
|
|
74
|
+
* [{ ws, inis: [{ ini, board, title, stage, closed }], P (lib/proposals.js fold) }]; material(event) → its items;
|
|
75
|
+
* waiting(P, ini) → the open round or null; running(ini) → boolean; tried: Map key → ms. */
|
|
76
|
+
function candidates({ events = [], products = [], material = () => [], now = Date.now(), tried = new Map(), waiting = () => null, running = () => false } = {}) {
|
|
77
|
+
const soon = (events || []).filter((e) => { const s = Date.parse(e && e.at); return e && e.id && Number.isFinite(s) && s > now && s - now <= AHEAD_MS && !e.declined && !e.cancelled; })
|
|
78
|
+
.sort((a, b) => Date.parse(a.at) - Date.parse(b.at));
|
|
79
|
+
const out = []; const seen = new Set();
|
|
80
|
+
for (const ev of soon) {
|
|
81
|
+
let mat = []; try { mat = material(ev) || []; } catch { mat = []; }
|
|
82
|
+
const texts = namesOf(ev, mat);
|
|
83
|
+
for (const pr of products || []) {
|
|
84
|
+
if (!pr || !pr.ws) continue;
|
|
85
|
+
const props = pr.P && pr.P.props ? [...pr.P.props.values()] : [];
|
|
86
|
+
for (const i of pr.inis || []) {
|
|
87
|
+
if (!i || !i.ini || i.closed || CLOSED.test(str(i.stage)) || (i.stage && !EARLY.test(i.stage))) continue;
|
|
88
|
+
const key = `proto-meeting:${pr.ws}:${i.ini}`;
|
|
89
|
+
if (seen.has(key)) continue;
|
|
90
|
+
if (!named(texts, i, ev)) continue;
|
|
91
|
+
if (props.some((p) => p && p.ini === i.ini && PROTO_GROUPS.has(p.group))) continue; // it has a prototype already
|
|
92
|
+
let w = null; try { w = waiting(pr.P, i.ini); } catch { w = null; }
|
|
93
|
+
if (w) continue; // no second round while one waits
|
|
94
|
+
let r = false; try { r = !!running(i.ini); } catch { r = false; }
|
|
95
|
+
if (r) continue;
|
|
96
|
+
if (tried.has(key) && now - tried.get(key) < RETRY_MS) continue;
|
|
97
|
+
seen.add(key);
|
|
98
|
+
const at = Date.parse(ev.at);
|
|
99
|
+
const title = one(i.title || i.ini, 120);
|
|
100
|
+
out.push({ kind: KIND, ws: pr.ws, board: i.board || '', ini: i.ini, title, key,
|
|
101
|
+
event: { id: String(ev.id), title: one(ev.title, 160), at: ev.at },
|
|
102
|
+
why: `"${one(ev.title, 80)}" at ${clock(at)} names it, and it has no prototype yet.`,
|
|
103
|
+
brief: `Round 1 for the meeting "${one(ev.title, 120)}": show 3 different ways ${title} could look and work, so the room can react to something real.` });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function read(rt) {
|
|
111
|
+
let raw = ''; try { raw = fs.readFileSync(fileOf(rt), 'utf8'); } catch { return []; }
|
|
112
|
+
const out = [];
|
|
113
|
+
for (const l of raw.split('\n')) { if (!l.trim()) continue; try { out.push(JSON.parse(l)); } catch { /* a torn line */ } }
|
|
114
|
+
return out;
|
|
115
|
+
}
|
|
116
|
+
function tried(rt) {
|
|
117
|
+
const m = new Map();
|
|
118
|
+
for (const l of read(rt)) if (l && l.key) m.set(l.key, Math.max(m.get(l.key) || 0, Number(l.at) || 0));
|
|
119
|
+
return m;
|
|
120
|
+
}
|
|
121
|
+
function append(rt, row) {
|
|
122
|
+
fs.mkdirSync(path.dirname(fileOf(rt)), { recursive: true });
|
|
123
|
+
fs.appendFileSync(fileOf(rt), JSON.stringify(row) + '\n');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** deps: { runtimeDir(), events(now), products(), material(event)?, round?, waiting?, running?, off?(), warn?, queue? }
|
|
127
|
+
* round / waiting / running default to lib/live-round.js. */
|
|
128
|
+
function create(deps = {}) {
|
|
129
|
+
const warn = deps.warn || (() => {});
|
|
130
|
+
const LR = () => { try { return require('./live-round.js'); } catch { return null; } };
|
|
131
|
+
const roundOf = () => deps.round || (LR() && LR().round) || null;
|
|
132
|
+
let busy = false; let last = null; let cache = { at: 0, p: null };
|
|
133
|
+
|
|
134
|
+
async function tick(turn = {}) {
|
|
135
|
+
const now = turn.now || Date.now();
|
|
136
|
+
const rt = deps.runtimeDir ? deps.runtimeDir() : null;
|
|
137
|
+
if (!rt || busy) return { started: null, busy };
|
|
138
|
+
if (deps.off) { let o = null; try { o = deps.off(); } catch { o = null; } if (o) return (last = { started: null, off: o }); }
|
|
139
|
+
const round = roundOf();
|
|
140
|
+
if (typeof round !== 'function') return (last = { started: null, why: 'live rounds are not in this version' });
|
|
141
|
+
let events = []; try { events = deps.events(now) || []; } catch (e) { warn('meeting prewarm events', e); events = []; }
|
|
142
|
+
if (!events.some((e) => { const t = Date.parse(e && e.at); return Number.isFinite(t) && t > now && t - now <= AHEAD_MS; })) return (last = { started: null });
|
|
143
|
+
// the products are read at most every 5 minutes, and only when a meeting is in the next hour
|
|
144
|
+
if (!cache.p || now - cache.at > 5 * 60000) { try { cache = { at: now, p: deps.products() || [] }; } catch (e) { warn('meeting prewarm products', e); cache = { at: now, p: [] }; } }
|
|
145
|
+
const products = cache.p;
|
|
146
|
+
const lr = LR();
|
|
147
|
+
const cands = candidates({ events, products, now, tried: tried(rt),
|
|
148
|
+
material: deps.material || ((ev) => require('./meeting-material.js').forMeeting(rt, ev)),
|
|
149
|
+
waiting: deps.waiting || (lr && lr.waiting) || (() => null),
|
|
150
|
+
running: deps.running || (lr && lr.running) || (() => false) });
|
|
151
|
+
const c = cands[0];
|
|
152
|
+
if (!c) return (last = { started: null });
|
|
153
|
+
busy = true;
|
|
154
|
+
try {
|
|
155
|
+
let r;
|
|
156
|
+
try { r = await round({ ws: c.ws, board: c.board || undefined, ini: c.ini, brief: c.brief, from: 'meeting', step: 2, by: null }); } catch (e) { r = { ok: false, error: (e && e.message) || 'the round did not start' }; }
|
|
157
|
+
const base = { at: now, key: c.key, ws: c.ws, ini: c.ini, event: c.event };
|
|
158
|
+
if (r && r.ok) { append(rt, { ...base, kind: 'start', round: r.round && r.round.id ? String(r.round.id) : null }); return (last = { started: c.ini, kind: KIND, round: r.round || null }); }
|
|
159
|
+
append(rt, { ...base, kind: 'fail', error: one(r && r.error, 200) || 'no answer' });
|
|
160
|
+
return (last = { started: null, failed: c.ini, error: r && r.error });
|
|
161
|
+
} finally { busy = false; }
|
|
162
|
+
}
|
|
163
|
+
if (deps.queue && typeof deps.queue.register === 'function') deps.queue.register(JOB, (turn) => { tick(turn).catch((e) => warn('meeting prewarm tick', e)); });
|
|
164
|
+
return { tick, status: () => last };
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
module.exports = { KIND, JOB, AHEAD_MS, RETRY_MS, namesOf, named, candidates, read, tried, create, fileOf };
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* companionPrompt(input) → string what the read-only agent is asked; its answer is ONE JSON object
|
|
8
8
|
* screenOf(frames, { minutes?, now_t? }) → [{ t, text }] the latest shots of the shared screen that have text (recording tab, batch 12 item 1)
|
|
9
9
|
* parseCompanion(text) → { gist, chips, topic, notes, raise } | null a malformed answer is null, a malformed part is dropped
|
|
10
|
+
* showIntent(question) → { title, brief } | null a sentence the PM typed that asks PMOS to show an idea ("show 3 ways to …")
|
|
11
|
+
* showLine(item, at) → the raise line of a Show it? offer the PM asked for themselves (no companion run)
|
|
10
12
|
* foldState(lines, { topics, startMs, nowMs }) → the page's state the append-only focus/<id>.jsonl folded
|
|
11
13
|
* outLine(parsed, at) · moveLine(...) → the lines the state file takes
|
|
12
14
|
* shouldRun(now, state, note, opts) → { run, reason } the rules of when the companion may run
|
|
@@ -17,7 +19,9 @@
|
|
|
17
19
|
* The state file holds lines of these kinds (every `at` is epoch ms):
|
|
18
20
|
* { k: 'run', at, lines } a companion run started; `lines` is how many transcript lines it could see
|
|
19
21
|
* { k: 'out', at, gist, chips, topic, notes, raise } its parsed answer
|
|
20
|
-
* { k: 'raise', at, id, action: 'raised'|'skip' }
|
|
22
|
+
* { k: 'raise', at, id, action: 'raised'|'skip'|'undo', round? } the PM's answer to a Raise now item (✓ raised it, ✗ not now, Undo:
|
|
23
|
+
* open again). For a "show" item ✓ starts a live round (lib/live-round.js); round = its id
|
|
24
|
+
* { k: 'offer', at, raise: [item] } a Show it? offer filed without a companion run (the PM typed "show 3 ways to …")
|
|
21
25
|
* { k: 'fail', at, error } the run ended without a usable answer
|
|
22
26
|
* { k: 'move', at, action: 'set'|'add'|'park'|'back', topic } the PM's correction; back = "Not this one": the line before it is on again
|
|
23
27
|
* { k: 'ask', id, at, question } a private question
|
|
@@ -32,8 +36,9 @@ const TAIL_MAX = 40; // and at most this many lines
|
|
|
32
36
|
const TOPICS_MAX = 30; // every invite line is kept; lib/agenda-topics.js shows them under 3 to 5 topics
|
|
33
37
|
const NOTES_MAX = 5;
|
|
34
38
|
const CHIPS_MAX = 4;
|
|
35
|
-
const RAISE_KINDS = Object.freeze(['check', 'follow-up', 'no-owner']);
|
|
36
|
-
const RAISE_MAX = 2; // the Now panel shows at most this many prompts
|
|
39
|
+
const RAISE_KINDS = Object.freeze(['check', 'follow-up', 'no-owner', 'show']);
|
|
40
|
+
const RAISE_MAX = 2; // the Now panel shows at most this many prompts; a Show it? offer counts as one
|
|
41
|
+
const INI_ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/;
|
|
37
42
|
const FROM = Object.freeze(['talk', 'screen', 'prep', 'last']); // where an answer came from: the talk, the shared screen, the prep, last time
|
|
38
43
|
const SCREEN_MAX = 3; // how many recent shots of the shared screen the companion reads
|
|
39
44
|
const SCREEN_CHARS = 700;
|
|
@@ -185,6 +190,7 @@ function companionPrompt(input) {
|
|
|
185
190
|
} else {
|
|
186
191
|
L.push('Say what is being discussed, which topic the room is on, and add a note only when it helps the PM right now: an answer to a question the room asked, a fact to check, a decision forming, a time warning, a topic that came up, context behind a name that was said, or a follow-up. Stay quiet when nothing helps: an empty "notes" list is a good answer.');
|
|
187
192
|
L.push('In "raise", give at most ' + RAISE_MAX + ' things the PM should raise in the room now, each one short line: "check" when the screen and the talk differ (a date, a number, a name), "follow-up" when an action from last time is still open and nobody raised it, "no-owner" when the room agreed something and nobody owns it. An empty "raise" list is a good answer.');
|
|
193
|
+
L.push('Also in "raise", at most one "show": when the room names an idea that nobody can judge from words alone (a screen, a flow, a layout, a page, how something looks or moves), PMOS can make 3 quick specimens of it while the meeting goes on. Then "text" is one sentence of what to show, "title" names the idea in a few words, and "initiative" is the id of the initiative it belongs to when the brief or a reference above names it. Only offer it for an idea that is new in the talk and not offered before. Never for a decision, a number or a date.');
|
|
188
194
|
}
|
|
189
195
|
L.push('');
|
|
190
196
|
L.push('## Your answer');
|
|
@@ -193,7 +199,7 @@ function companionPrompt(input) {
|
|
|
193
199
|
L.push(' "chips":[{"label":"a name or thing said","sub":"what PMOS holds on it","ref":{"type":"initiative|plan-item|release|item|jira|ask|report|note|decision","id":"..."}} or {"label":"...","sub":"...","url":"https://..."}],');
|
|
194
200
|
L.push(' "topic":{"current":"the exact text of a line above, or a new line","add":["new lines that came up"],"under":"the name of the topic (### above) a new line belongs to"},');
|
|
195
201
|
L.push(' "notes":[{"cat":"' + CATS.join('|') + '","heard":"the line it answers","body":"the answer","why":"why now","src":"where it came from","from":["' + FROM.join('","') + '"],"acts":[{"label":"Open the record","ref":{"type":"...","id":"..."}}],"show":"now|hold","when":"when to show a held note"}],');
|
|
196
|
-
L.push(' "raise":[{"kind":"' + RAISE_KINDS.join('|') + '","text":"one short line to raise","from":"the screen, or the date of the last meeting"}]}');
|
|
202
|
+
L.push(' "raise":[{"kind":"' + RAISE_KINDS.join('|') + '","text":"one short line to raise","from":"the screen, or the date of the last meeting","title":"show only: the idea in a few words","initiative":"show only: an initiative id, or leave it out"}]}');
|
|
197
203
|
L.push('Prefer a line that is already above. Add a line only for a subject no line covers, and never one that says the same as a line above. A new line always goes under one of the topics: name it in "under".');
|
|
198
204
|
L.push('At most ' + CHIPS_MAX + ' chips and ' + NOTES_MAX + ' notes. Keep each body to two sentences. Name your source in "src". Use only references and links that you read in this repository or in the brief above; never invent one.');
|
|
199
205
|
return L.join('\n');
|
|
@@ -245,9 +251,27 @@ function raiseOf(r) {
|
|
|
245
251
|
if (!r || typeof r !== 'object' || Array.isArray(r)) return null;
|
|
246
252
|
const kind = str(r.kind, 12).toLowerCase(); const text = str(r.text, 200);
|
|
247
253
|
if (!RAISE_KINDS.includes(kind) || !text) return null;
|
|
248
|
-
|
|
254
|
+
const out = { id: raiseKey(kind, text), kind, text, from: str(r.from, 60) };
|
|
255
|
+
if (kind === 'show') {
|
|
256
|
+
out.title = str(r.title, 80) || str(text, 60);
|
|
257
|
+
const ini = str(r.initiative, 80);
|
|
258
|
+
if (ini && INI_ID.test(ini)) out.initiative = ini;
|
|
259
|
+
}
|
|
260
|
+
return out;
|
|
249
261
|
}
|
|
250
262
|
|
|
263
|
+
/* A sentence the PM typed in the meeting that asks PMOS to show an idea: "show 3 ways to …", "show it", "prototype the …",
|
|
264
|
+
* "mock up …", "can PMOS sketch …". → { title, brief } (brief = the sentence) or null. A plain question is null. */
|
|
265
|
+
const SHOW_ASK = /^(?:(?:can|could|would)\s+(?:you|pmos)\s+|please\s+|pmos[,:]?\s+)?(show(?:\s+(?:me|us))?|prototype|mock(?:\s*-?\s*up)?|sketch|draw)\b\s*(.*)$/i;
|
|
266
|
+
function showIntent(question) {
|
|
267
|
+
const q = str(question, 400).replace(/[?.!]+$/, '');
|
|
268
|
+
const m = SHOW_ASK.exec(q);
|
|
269
|
+
if (!m) return null;
|
|
270
|
+
const rest = m[2].replace(/^(?:\d+|two|three|a few)\s+(?:ways|options|versions|takes)\s+(?:of|to|for)?\s*/i, '').replace(/^(?:it|this|that)\s*$/i, '').trim();
|
|
271
|
+
return { title: str(rest || 'what the room is talking about', 80), brief: q };
|
|
272
|
+
}
|
|
273
|
+
const showLine = (item, at) => ({ k: 'offer', at, raise: [raiseOf({ kind: 'show', text: item.brief, title: item.title, initiative: item.initiative })].filter(Boolean) });
|
|
274
|
+
|
|
251
275
|
/** The companion's answer as { gist, chips, topic: { current, add }, notes, raise }. null when the text holds no JSON object or nothing
|
|
252
276
|
* in it can be shown; a part that is malformed (an unknown category, an empty body, a link that is not http) is dropped alone. */
|
|
253
277
|
function parseCompanion(text) {
|
|
@@ -259,7 +283,8 @@ function parseCompanion(text) {
|
|
|
259
283
|
const topic = { current: str(t.current, 120) || null, add: (Array.isArray(t.add) ? t.add : []).map((x) => str(x, 120)).filter(Boolean).slice(0, 3) };
|
|
260
284
|
if (str(t.under, 80)) topic.under = str(t.under, 80);
|
|
261
285
|
const notes = (Array.isArray(o.notes) ? o.notes : []).map(noteOf).filter(Boolean).slice(0, NOTES_MAX);
|
|
262
|
-
|
|
286
|
+
let shows = 0; // one Show it? offer an answer, at most
|
|
287
|
+
const raise = (Array.isArray(o.raise) ? o.raise : []).map(raiseOf).filter(Boolean).filter((r) => r.kind !== 'show' || shows++ === 0).slice(0, RAISE_MAX);
|
|
263
288
|
if (!gist && !chips.length && !topic.current && !topic.add.length && !notes.length && !raise.length) return null;
|
|
264
289
|
return { gist, chips, topic, notes, raise };
|
|
265
290
|
}
|
|
@@ -268,7 +293,7 @@ function parseCompanion(text) {
|
|
|
268
293
|
|
|
269
294
|
const outLine = (parsed, at) => ({ k: 'out', at, gist: parsed.gist, chips: parsed.chips, topic: parsed.topic, notes: parsed.notes, raise: parsed.raise || [] });
|
|
270
295
|
const moveLine = (action, topic, at) => ({ k: 'move', at, action, topic: str(topic, 120) });
|
|
271
|
-
const raiseLine = (id, action, at) => ({ k: 'raise', at, id: str(id, 80), action: action === 'raised'
|
|
296
|
+
const raiseLine = (id, action, at, round) => ({ k: 'raise', at, id: str(id, 80), action: action === 'raised' || action === 'undo' ? action : 'skip', ...(round ? { round: str(round, 120) } : {}) });
|
|
272
297
|
|
|
273
298
|
/** The page's state from the state file's lines. topics = topicsFrom(...) (the starting topics); startMs = the meeting's start; nowMs = now.
|
|
274
299
|
* → { gist, chips, current, topics: [{ id, text, src, state: now|discussed|notyet|parked, minutes, at?, by? }], runs: [{ topic, from_min, to_min }],
|
|
@@ -284,6 +309,10 @@ function foldState(lines, { topics = [], startMs = null, nowMs = Date.now() } =
|
|
|
284
309
|
for (const t of topics) addTopic(t.text || t, t.src || 'steps');
|
|
285
310
|
let current = null; const runs = []; let veto = null; let gist = ''; let chips = []; const notes = []; let seen = 0; let lastRunAt = 0; let pending = false; let error = null; let authAt = 0;
|
|
286
311
|
const asks = new Map(); const raises = new Map(); // veto: the line the PM said "Not this one" to, kept off for 5 min
|
|
312
|
+
const addRaise = (r, at) => {
|
|
313
|
+
if (!r || !r.id || raises.has(r.id)) return;
|
|
314
|
+
raises.set(r.id, { id: r.id, kind: r.kind, text: r.text, from: r.from || '', ...(r.kind === 'show' ? { title: r.title || '', ...(r.initiative ? { initiative: r.initiative } : {}) } : {}), at, state: 'open' });
|
|
315
|
+
};
|
|
287
316
|
const close = (at) => { const r = runs[runs.length - 1]; if (r && r.to == null) r.to = at; };
|
|
288
317
|
const switchTo = (row, at, by) => { if (!row || (current && current.id === row.id && runs.length && runs[runs.length - 1].to == null)) return; close(at); row.parked = false; current = row; runs.push({ topic: row.id, from: at, to: null, by: by || 'PMOS' }); };
|
|
289
318
|
const nextOpen = () => order.find((r) => r !== current && !r.parked && !runs.some((x) => x.topic === r.id));
|
|
@@ -301,9 +330,12 @@ function foldState(lines, { topics = [], startMs = null, nowMs = Date.now() } =
|
|
|
301
330
|
for (const a of tp.add || []) addTopic(a, 'added', { at, by: 'PMOS', ...under });
|
|
302
331
|
if (tp.current) { const row = addTopic(tp.current, 'added', { at, by: 'PMOS', ...under }); if (!(veto && row && row.id === veto.id && at < veto.until)) switchTo(row, at, 'PMOS'); }
|
|
303
332
|
for (const n of l.notes || []) notes.push({ ...n, id: 'n' + notes.length, at });
|
|
304
|
-
for (const r of Array.isArray(l.raise) ? l.raise : [])
|
|
333
|
+
for (const r of Array.isArray(l.raise) ? l.raise : []) addRaise(r, at);
|
|
334
|
+
} else if (l.k === 'offer') {
|
|
335
|
+
for (const r of Array.isArray(l.raise) ? l.raise : []) addRaise(r, at);
|
|
305
336
|
} else if (l.k === 'raise') {
|
|
306
|
-
const r = raises.get(l.id);
|
|
337
|
+
const r = raises.get(l.id);
|
|
338
|
+
if (r) { r.state = l.action === 'undo' ? 'open' : l.action === 'raised' ? 'raised' : 'skipped'; if (l.round) r.round = l.round; else if (l.action === 'undo') delete r.round; }
|
|
307
339
|
} else if (l.k === 'move' && l.action === 'back') {
|
|
308
340
|
// "Not this one": the line before the one PMOS moved to is on again; PMOS does not move back to it for 5 minutes
|
|
309
341
|
if (!current) continue;
|
|
@@ -401,4 +433,4 @@ function pickNow(events, { now = Date.now(), meet = '', title = '' } = {}) {
|
|
|
401
433
|
return { ok: false, status: 404, error: 'No meeting on the calendar fits this call.', choices };
|
|
402
434
|
}
|
|
403
435
|
|
|
404
|
-
module.exports = { CATS, REF_TYPES, RAISE_KINDS, RAISE_MAX, FROM, MIN_GAP_MS, TAIL_MINUTES, TAIL_MAX, topicsFrom, tailOf, capturedFrom, screenOf, companionPrompt, parseCompanion, foldState, outLine, moveLine, raiseLine, shouldRun, pickNow, meetTitle, norm, str, off };
|
|
436
|
+
module.exports = { CATS, REF_TYPES, RAISE_KINDS, RAISE_MAX, FROM, MIN_GAP_MS, TAIL_MINUTES, TAIL_MAX, topicsFrom, tailOf, capturedFrom, screenOf, companionPrompt, parseCompanion, showIntent, showLine, foldState, outLine, moveLine, raiseLine, shouldRun, pickNow, meetTitle, norm, str, off };
|
|
@@ -18,8 +18,13 @@
|
|
|
18
18
|
* POST /api/meeting-focus/topic { event | note, date?, action: 'set'|'add'|'park'|'back', topic } page press; the PM's correction, appended to the state
|
|
19
19
|
* back = "Not this one": the line before is on again
|
|
20
20
|
* POST /api/meeting-focus/agenda { sig, action: 'undo' } page press; Undo the merge for that invite (every line is its topic again)
|
|
21
|
-
* POST /api/meeting-focus/ask { event, note?, date?, question } page press; one headless read-only run with the PM's question
|
|
22
|
-
*
|
|
21
|
+
* POST /api/meeting-focus/ask { event, note?, date?, question } page press; one headless read-only run with the PM's question.
|
|
22
|
+
* A sentence that asks PMOS to show an idea ("show 3 ways to …", lib/meeting-focus.js showIntent) files a ✦ Show it? offer at once
|
|
23
|
+
* instead, with no run → { ok, offer: id, state: 'offered' }
|
|
24
|
+
* POST /api/meeting-focus/raise { event | note, date?, id, action: 'raised'|'skip'|'undo' } page press; the PM's ✓ or ✗ on a Raise now item (the recording tab's Now panel),
|
|
25
|
+
* or Undo (the item is open again). ✓ on a ✦ Show it? offer (kind "show") starts a live round (lib/live-round.js round(), from 'meeting',
|
|
26
|
+
* queue step 1) on the offer's initiative, else the meeting's initiative (with neither, a 409 that says so); → { ok, round }. The companion
|
|
27
|
+
* only OFFERS: nothing starts a round but this press. A started round has no Undo here: it is dropped with ✕ in the compare view.
|
|
23
28
|
* GET /api/meeting-focus/ask?id= → { ok, id, state: working | answered | failed, error? } the answer itself comes back as a note in GET /api/meeting-focus
|
|
24
29
|
*
|
|
25
30
|
* The companion runs as origin `focus-companion:<key>` (lib/headless.js 'ask': Read, Glob and Grep only). It sends nothing to anyone and
|
|
@@ -314,14 +319,54 @@ async function agendaPress(req, body, ctx) {
|
|
|
314
319
|
}
|
|
315
320
|
/* ── POST /api/meeting-focus/raise ────────────────────────────────────────────────────────────────────────────────── */
|
|
316
321
|
|
|
322
|
+
/** lib/live-round.js round() (W1). A test hands its own in ctx.round. */
|
|
323
|
+
function roundFn(ctx) {
|
|
324
|
+
if (typeof ctx.round === 'function') return ctx.round;
|
|
325
|
+
try { const LR = require('./live-round.js'); return typeof LR.round === 'function' ? LR.round : null; } catch { return null; }
|
|
326
|
+
}
|
|
327
|
+
/** The initiative a Show it? offer belongs to: the one the companion named, else the meeting's (its event, else its brief). */
|
|
328
|
+
async function showIni(ctx, item, k) {
|
|
329
|
+
if (item.initiative) return item.initiative;
|
|
330
|
+
const ev = k.ev || (k.note && k.note.meeting && k.note.meeting.kind === 'event' ? { id: k.note.meeting.event_id, title: k.note.meeting.title || k.note.title, at: k.note.meeting.start } : null);
|
|
331
|
+
if (!ev) return null;
|
|
332
|
+
if (ev.initiative) return F.str(typeof ev.initiative === 'object' ? ev.initiative.id : ev.initiative, 80) || null;
|
|
333
|
+
try {
|
|
334
|
+
const day = String(ev.at || '').slice(0, 10);
|
|
335
|
+
const b = typeof ctx.briefFor === 'function' ? await ctx.briefFor(ev, day) : await realBrief(ctx, ev, day);
|
|
336
|
+
return b && b.initiative && b.initiative.id ? F.str(b.initiative.id, 80) : null;
|
|
337
|
+
} catch { return null; }
|
|
338
|
+
}
|
|
339
|
+
/** The brief a round takes: the offer's sentence, and what the room is on when the sentence alone says little ("show it"). */
|
|
340
|
+
function showBrief(item, gist) {
|
|
341
|
+
const s = F.str(item.text, 200);
|
|
342
|
+
return s.split(' ').length < 4 && gist ? s + ': ' + F.str(gist, 300) : s;
|
|
343
|
+
}
|
|
344
|
+
|
|
317
345
|
async function raise(req, body, ctx) {
|
|
318
346
|
const g = guard.requirePagePress(req, body); if (!g.ok) return fail(g.status, g.error);
|
|
319
347
|
const action = String(body.action || '');
|
|
320
|
-
if (!['raised', 'skip'].includes(action)) return fail(400, 'action must be raised or
|
|
348
|
+
if (!['raised', 'skip', 'undo'].includes(action)) return fail(400, 'action must be raised, skip or undo');
|
|
321
349
|
const id = F.str(body.id, 80);
|
|
322
350
|
if (!id) return fail(400, 'id is required');
|
|
323
351
|
const key = await keyFromBody(body, ctx); if (key.error) return key.error;
|
|
324
352
|
const now = typeof ctx.now === 'function' ? ctx.now() : Date.now();
|
|
353
|
+
const keys = [key.key, key.ev ? keyOf(key.ev.id) : null, key.note && key.note.meeting && key.note.meeting.event_id ? keyOf(key.note.meeting.event_id) : null];
|
|
354
|
+
const state = F.foldState(linesOf(ctx.runtimeDir, keys), { nowMs: now });
|
|
355
|
+
const item = (state.raised || []).find((r) => r.id === id) || null;
|
|
356
|
+
if (action === 'undo' && item && item.round) return fail(409, 'The round has started. Drop it with ✕ where its specimens show.');
|
|
357
|
+
if (action === 'raised' && item && item.kind === 'show') {
|
|
358
|
+
if (item.state !== 'open') return fail(409, 'This offer was answered already.');
|
|
359
|
+
const round = roundFn(ctx);
|
|
360
|
+
if (!round) return fail(409, 'Live rounds are not ready in this version of PMOS.');
|
|
361
|
+
const ini = await showIni(ctx, item, key);
|
|
362
|
+
if (!ini) return fail(409, 'This meeting names no initiative, so PMOS cannot tell where the round goes. Link the meeting to an initiative, or ask in the initiative chat.');
|
|
363
|
+
let r;
|
|
364
|
+
try { r = await round({ ws: ctx.w ? ctx.w.id : undefined, board: F.str(body.board, 80) || undefined, ini, brief: showBrief(item, state.gist), from: 'meeting', step: 1, by: 'you' }); } catch (e) { r = { ok: false, error: (e && e.message) || 'the round did not start' }; }
|
|
365
|
+
if (!r || !r.ok) return fail(409, 'PMOS could not start the round: ' + ((r && r.error) || 'no answer') + '.');
|
|
366
|
+
const roundId = r.round && r.round.id ? String(r.round.id) : '';
|
|
367
|
+
append(ctx.runtimeDir, key.key + '.jsonl', F.raiseLine(id, action, now, roundId || 'started'));
|
|
368
|
+
return { status: 200, body: { ok: true, key: key.key, ini: ini || null, round: r.round || null } };
|
|
369
|
+
}
|
|
325
370
|
append(ctx.runtimeDir, key.key + '.jsonl', F.raiseLine(id, action, now));
|
|
326
371
|
return { status: 200, body: { ok: true, key: key.key } };
|
|
327
372
|
}
|
|
@@ -369,6 +414,15 @@ async function ask(req, body, ctx) {
|
|
|
369
414
|
const g = guard.requirePagePress(req, body); if (!g.ok) return fail(g.status, g.error);
|
|
370
415
|
const question = F.str(body.question, 1000);
|
|
371
416
|
if (!question) return fail(400, 'Type your question.');
|
|
417
|
+
const show = F.showIntent(question);
|
|
418
|
+
if (show) {
|
|
419
|
+
// "show 3 ways to …": a ✦ Show it? offer, with no run; ✓ on it starts the round (POST /raise)
|
|
420
|
+
const k = await keyFromBody(body, ctx); if (k.error) return k.error;
|
|
421
|
+
const line = F.showLine(show, typeof ctx.now === 'function' ? ctx.now() : Date.now());
|
|
422
|
+
if (!line.raise.length) return fail(400, 'Say what to show.');
|
|
423
|
+
append(ctx.runtimeDir, k.key + '.jsonl', line);
|
|
424
|
+
return { status: 200, body: { ok: true, offer: line.raise[0].id, state: 'offered' } };
|
|
425
|
+
}
|
|
372
426
|
if (typeof ctx.spawnSession !== 'function') return fail(409, 'this workspace cannot start sessions');
|
|
373
427
|
if (!kindOk()) return fail(409, 'Background runs are switched off here (PMOS_HEADLESS=off), so PMOS cannot answer from this page.');
|
|
374
428
|
const k = await keyFromBody({ ...body, note: body.note }, ctx); if (k.error) return k.error;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.582.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.582.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -55,6 +55,8 @@
|
|
|
55
55
|
/* the note box */
|
|
56
56
|
.rn-err { margin: 0 16px 6px; font-size: var(--fs-body); color: var(--cz-late); line-height: var(--lh-body); }
|
|
57
57
|
.rn-err[hidden] { display: none; }
|
|
58
|
+
.rn-err.ok { color: var(--cz-ink2); }
|
|
59
|
+
.rn-undo { border: 0; background: none; padding: 0; font: inherit; font-weight: var(--fw-strong); color: var(--cz-blueink); cursor: pointer; }
|
|
58
60
|
.rn-mine { margin: 0 12px 12px; border-radius: 18px; background: var(--cz-well); padding: 8px 8px 8px 14px; display: flex; align-items: flex-end; gap: 8px; }
|
|
59
61
|
.rn-mine textarea { flex: 1; min-width: 0; min-height: 36px; max-height: 120px; resize: none; border: 0; outline: 0; background: none; font: inherit; font-size: var(--fs-body); line-height: 1.45; color: var(--cz-ink); padding: 8px 0; }
|
|
60
62
|
.rn-mine textarea::placeholder { color: var(--cz-ink3); }
|
|
@@ -6,14 +6,15 @@
|
|
|
6
6
|
* To cover is the meeting's agenda in 3 to 5 topics (pm/agenda-live.js), the same as the Viewer's Agenda.
|
|
7
7
|
* transcriptModel(one, { max? }) → [Line] pure: the live transcript, oldest first, with the highlight and decision marks
|
|
8
8
|
* transcriptHtml(lines) → string the 420px card's feed
|
|
9
|
-
* kindOf(text) → 'ask' | 'note' a line that ends with "?" asks
|
|
9
|
+
* kindOf(text) → 'ask' | 'note' a line that ends with "?", or asks PMOS to show something ("show 3 ways to …"), asks PMOS;
|
|
10
|
+
* anything else is kept as a note
|
|
10
11
|
* fromLine(note) → string "From the talk and last time": where an answer came from
|
|
11
12
|
* mountNow(slots, ctx) → { stop, refresh, toggleTranscript } pm/cozy-rec-tab.js mounts it: with a screen the panel fills `side`, in the room
|
|
12
13
|
* it fills the light `stage`; the side-panel toggle and the transcript icon go in the bar's [data-slot="now"]; the transcript card sits beside.
|
|
13
14
|
*
|
|
14
15
|
* The panel has no tabs and no header. Every part is silent at zero: no topics, no prompts, no counts, no answer → no line.
|
|
15
16
|
* Reads: the tab's own reads (ctx.note(): GET /api/notes/one, for the highlights and the transcript; ctx.focus(): GET /api/meeting-focus, every 15 s),
|
|
16
|
-
* redrawn on the tab's 'note', 'mode' and 'tick'. After a press, and every 3 s while Claude answers a question, it reads GET /api/meeting-focus itself. Writes, each on a press: POST /api/meeting-focus/raise (✓ raised, ✗ not now), POST /api/notes/save
|
|
17
|
+
* redrawn on the tab's 'note', 'mode' and 'tick'. After a press, and every 3 s while Claude answers a question, it reads GET /api/meeting-focus itself. Writes, each on a press: POST /api/meeting-focus/raise (✓ raised, ✗ not now, Undo; ✓ on a ✦ Show it? offer starts a live round), POST /api/notes/save
|
|
17
18
|
* (a note, or an answer kept with +), POST /api/meeting-focus/ask (a question; the answer comes back on the next read). */
|
|
18
19
|
import { pmGet, pmPost } from './http.js';
|
|
19
20
|
import { agendaHtml, ensureCss as agendaCss, press as agendaPress } from './agenda-live.js';
|
|
@@ -32,10 +33,11 @@ const svg = (d, n = 17, w = 1.8, fill = false) => `<svg width="${n}" height="${n
|
|
|
32
33
|
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
33
34
|
const mmss = (ms) => { const s = Math.max(0, Math.floor((Number(ms) || 0) / 1000)); return Math.floor(s / 60) + ':' + String(s % 60).padStart(2, '0'); };
|
|
34
35
|
const FROM_WORDS = { talk: 'the talk', screen: 'the screen', prep: 'the prep', last: 'last time' };
|
|
35
|
-
const RAISE_LABEL = { check: 'Check', 'follow-up': 'Follow-up', 'no-owner': 'No owner yet' };
|
|
36
|
+
const RAISE_LABEL = { check: 'Check', 'follow-up': 'Follow-up', 'no-owner': 'No owner yet', show: 'Show it?' };
|
|
37
|
+
const SHOW_ASK = /^(?:(?:can|could|would)\s+(?:you|pmos)\s+|please\s+|pmos[,:]?\s+)?(?:show|prototype|mock|sketch|draw)\b/i; // lib/meeting-focus.js showIntent
|
|
36
38
|
export const BOX_HINT = 'Note, or ask PMOS…';
|
|
37
39
|
|
|
38
|
-
export const kindOf = (text) =>
|
|
40
|
+
export const kindOf = (text) => { const t = String(text || '').trim(); return /\?\s*$/.test(t) || SHOW_ASK.test(t) ? 'ask' : 'note'; };
|
|
39
41
|
|
|
40
42
|
/** "From the talk and last time" from an answer note's `from` list; its free `src` when it names none. */
|
|
41
43
|
export function fromLine(note) {
|
|
@@ -47,6 +49,7 @@ export function fromLine(note) {
|
|
|
47
49
|
/** The small line over a Raise now prompt: "Check · from the screen", "Follow-up · from Oct 19", "No owner yet". */
|
|
48
50
|
export function raiseLabel(r) {
|
|
49
51
|
const head = RAISE_LABEL[r && r.kind] || 'Raise';
|
|
52
|
+
if (r && r.kind === 'show') return head;
|
|
50
53
|
return r && r.from && r.kind !== 'no-owner' ? head + ' · from ' + String(r.from).replace(/^from\s+/i, '') : head;
|
|
51
54
|
}
|
|
52
55
|
|
|
@@ -135,8 +138,9 @@ export function nowHtml(m, { room = false } = {}) {
|
|
|
135
138
|
}
|
|
136
139
|
if (m.raise.length) {
|
|
137
140
|
h += `<section class="rn-sec" aria-label="Raise now">${room ? '' : '<h5>Raise now</h5>'}<div class="rn-rz">`
|
|
138
|
-
+ m.raise.map((r) => `<div class="rn-rq" data-raise="${esc(r.id)}"><span class="w"><small>${esc(r.label)}</small>${esc(r.text)}</span>`
|
|
139
|
-
+ `<button type="button" class="rn-ib" data-rn="raised" aria-label="
|
|
141
|
+
+ m.raise.map((r) => `<div class="rn-rq" data-raise="${esc(r.id)}"${r.kind === 'show' ? ' data-show="1"' : ''}><span class="w"><small>${r.kind === 'show' ? '✦ ' : ''}${esc(r.label)}</small>${esc(r.text)}</span>`
|
|
142
|
+
+ (r.kind === 'show' ? `<button type="button" class="rn-ib" data-rn="raised" aria-label="Show it" title="Show it">${svg(P.check)}</button>`
|
|
143
|
+
: `<button type="button" class="rn-ib" data-rn="raised" aria-label="Raised" title="Raised">${svg(P.check)}</button>`)
|
|
140
144
|
+ `<button type="button" class="rn-ib" data-rn="skip" aria-label="Not now" title="Not now">${svg(P.x)}</button></div>`).join('')
|
|
141
145
|
+ '</div></section>';
|
|
142
146
|
}
|
|
@@ -254,7 +258,18 @@ export function mountNow(slots, ctx) {
|
|
|
254
258
|
if (own && (!f || !f.ok || !(f.now_ms > own.now_ms))) return own;
|
|
255
259
|
own = null; return f;
|
|
256
260
|
};
|
|
257
|
-
const say = (msg) => { err.textContent = msg || ''; err.hidden = !msg; };
|
|
261
|
+
const say = (msg, ok) => { err.textContent = msg || ''; err.hidden = !msg; err.classList.toggle('ok', !!ok); };
|
|
262
|
+
// ✕ on a ✦ Show it? offer: "Not now" with Undo (the offer is open again)
|
|
263
|
+
const undoable = (id) => {
|
|
264
|
+
say('Not now. ', true);
|
|
265
|
+
const u = document.createElement('button'); u.type = 'button'; u.className = 'rn-undo'; u.textContent = 'Undo';
|
|
266
|
+
u.addEventListener('click', async () => {
|
|
267
|
+
u.disabled = true;
|
|
268
|
+
const r = await pmPost('/api/meeting-focus/raise', { note: noteId(), id, action: 'undo', ws: ctx.ws });
|
|
269
|
+
say(r && r.ok ? '' : 'Not undone: ' + ((r && r.error) || 'no answer')); read();
|
|
270
|
+
});
|
|
271
|
+
err.appendChild(u);
|
|
272
|
+
};
|
|
258
273
|
const draw = () => {
|
|
259
274
|
if (stopped) return;
|
|
260
275
|
place();
|
|
@@ -322,6 +337,7 @@ export function mountNow(slots, ctx) {
|
|
|
322
337
|
if (kindOf(text) === 'ask') {
|
|
323
338
|
const r = await pmPost('/api/meeting-focus/ask', { note: noteId(), question: text, ws: ctx.ws });
|
|
324
339
|
if (!r || !r.ok) { say('PMOS could not take the question: ' + ((r && r.error) || 'no answer')); return; }
|
|
340
|
+
if (r.state === 'offered') { ta.value = ''; ta.dispatchEvent(new Event('input')); say(''); read(); return; } // a ✦ Show it? offer: it shows on the read
|
|
325
341
|
// the question shows at once; the answer arrives on a later read
|
|
326
342
|
const f = focusNow() || { ok: true };
|
|
327
343
|
own = { ...f, now_ms: Number(f.now_ms) || 0, asks: [...(f.asks || []), { id: r.id, question: text, state: 'working' }] };
|
|
@@ -342,12 +358,15 @@ export function mountNow(slots, ctx) {
|
|
|
342
358
|
const act = b.getAttribute('data-rn');
|
|
343
359
|
if (act === 'raised' || act === 'skip') {
|
|
344
360
|
const row = b.closest('[data-raise]'); const id = row && row.getAttribute('data-raise'); if (!id) return;
|
|
361
|
+
const show = row.hasAttribute('data-show');
|
|
345
362
|
b.disabled = true;
|
|
346
363
|
const r = await pmPost('/api/meeting-focus/raise', { note: noteId(), id, action: act, ws: ctx.ws });
|
|
347
364
|
if (!r || !r.ok) { b.disabled = false; say('Not saved: ' + ((r && r.error) || 'no answer')); return; }
|
|
348
365
|
const f = focusNow();
|
|
349
366
|
if (f) own = { ...f, now_ms: Number(f.now_ms) || 0, raise: (f.raise || []).filter((x) => x.id !== id) };
|
|
350
|
-
|
|
367
|
+
draw(); read();
|
|
368
|
+
if (show && act === 'raised') say('PMOS is making 3 ways. Each one shows on the initiative as it lands.', true);
|
|
369
|
+
else if (show) undoable(id); else say('');
|
|
351
370
|
} else if (act === 'keep') {
|
|
352
371
|
const m = nowModel(focusNow(), oneNow());
|
|
353
372
|
if (!m.answer || !m.answer.body) return;
|
package/workspace/server.js
CHANGED
|
@@ -3424,6 +3424,15 @@ const liveRound = require('./lib/live-round.js').install({
|
|
|
3424
3424
|
artefact: (dir, line, by) => { const AF = require('./lib/artefacts.js'); return AF.set(AF.file(dir), line, { by }); },
|
|
3425
3425
|
warn: (what, e) => warnWriteFail(what, e),
|
|
3426
3426
|
});
|
|
3427
|
+
// live round before a meeting (lib/live-round-meeting.js, initiative live-round-meeting): step 2 of the queue. A meeting in the next hour
|
|
3428
|
+
// whose agenda or material names an early initiative with no prototype gets round 1 (lib/live-round.js), so it waits under ✦ at minute 0.
|
|
3429
|
+
const meetingPrewarm = require('./lib/live-round-meeting.js').create({
|
|
3430
|
+
runtimeDir: () => STATE,
|
|
3431
|
+
queue: bgQueue, // it registers itself as the queue's step-2 job `meeting-prewarm`
|
|
3432
|
+
events: (now) => require('./lib/calendar-events.js').readAll(STATE, { now }),
|
|
3433
|
+
products: () => idleLab.products(Date.now()), // the products the idle lab reads (its 10-minute cache)
|
|
3434
|
+
warn: (what, e) => warnWriteFail(what, e),
|
|
3435
|
+
});
|
|
3427
3436
|
try { const _tick = setInterval(() => { try { if (!scheduleOwner.mayRun()) return; } catch { /* no lock: run as before */ } try { refreshRun.settings(); } catch { /* the refresh tick tries again */ } try { healthTick(); } catch (e) { warnWriteFail('health tick', e); } orchTick(); bgQueue.tick(); }, TICK_MS); if (_tick.unref) _tick.unref(); } catch {}
|
|
3428
3437
|
|
|
3429
3438
|
// ── Sessions: real PTYs, owned by the server, with disk-backed scrollback + metadata. ──
|