create-pmos 0.859.0 → 0.861.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.859.0",
3
+ "version": "0.861.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": {
@@ -34,8 +34,22 @@
34
34
  ],
35
35
  "pmosChanges": [
36
36
  {
37
- "v": "0.859.0",
38
- "at": "2026-11-26T00:00:04.789Z",
37
+ "v": "0.861.0",
38
+ "at": "2026-11-26T00:54:33.021Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 2072,
43
+ "t": "A stage's dates follow its tasks' earliest start and latest end, the stage in progress too",
44
+ "s": "A stage's dates follow its tasks' earliest start and latest end, the stage in progress too",
45
+ "k": "fix",
46
+ "i": "stage-dates-from-tasks"
47
+ }
48
+ ]
49
+ },
50
+ {
51
+ "v": "0.860.0",
52
+ "at": "2026-11-26T00:07:19.305Z",
39
53
  "f": 4,
40
54
  "prs": [
41
55
  {
@@ -44,6 +58,13 @@
44
58
  "s": "Reference cards hidden behind one icon on Work and the initiative page",
45
59
  "k": "new",
46
60
  "i": "fold-by-default"
61
+ },
62
+ {
63
+ "n": 2071,
64
+ "t": "Huddle slices 2 and 3: Huddle icon, say an idea, missing angles, Doc/Slides/Report/Design outputs",
65
+ "s": "Huddle slices 2 and 3: Huddle icon, say an idea, missing angles, Doc/Slides/Report/Design outputs",
66
+ "k": "new",
67
+ "i": "huddle-brainstorm"
47
68
  }
48
69
  ]
49
70
  },
@@ -682,45 +703,6 @@
682
703
  }
683
704
  }
684
705
  ]
685
- },
686
- {
687
- "v": "0.835.0",
688
- "at": "2026-11-25T15:25:47.605Z",
689
- "f": 4,
690
- "prs": [
691
- {
692
- "n": 2043,
693
- "t": "Drag the split between the work and the chat, remembered (job #2019)",
694
- "s": "Drag the split between the work and the chat, remembered (job #2019)",
695
- "k": "new",
696
- "i": "tb-chat-split-handle",
697
- "h": "Drag the split between the work and the chat, remembered (job #2019)",
698
- "try": {
699
- "steps": [
700
- "From Work, open an initiative",
701
- "Show the chat with the round chat button at the top right of the popup, then drag the handle between the work and the chat",
702
- "Close and open the initiative again: the split stays; double-click the handle to put it back"
703
- ],
704
- "see": "The handle moves the split, the work never gets narrower than 640 px and the chat never narrower than 320 px, the split comes back the same next time, and a double-click returns it to the default",
705
- "open": "/premium-board.html"
706
- }
707
- },
708
- {
709
- "n": 2040,
710
- "t": "Work's Print or PDF is a view control on the read-only copy",
711
- "s": "Work's Print or PDF is a view control on the read-only copy",
712
- "k": "fix",
713
- "i": "print-pdf",
714
- "h": "Work's Print or PDF is a view control on the read-only copy",
715
- "try": {
716
- "steps": [
717
- "Open a shared read-only copy of Work and press the print icon beside Choose columns"
718
- ],
719
- "see": "The roadmap prints as a clean page, and the read-only copy still shows no write control",
720
- "open": "/premium-board.html"
721
- }
722
- }
723
- ]
724
706
  }
725
707
  ]
726
708
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@642e72f70
1
+ kernel-source: pmos@afb12ac4b
2
2
  assembled: 2026-11-26
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-26T00:00:01Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-26T00:54:30Z"}
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-26T00:00:01Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-26T00:54:30Z"}
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-26T00:00:01Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-26T00:54:30Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,7 +1,21 @@
1
1
  [
2
2
  {
3
- "v": "0.859.0",
4
- "at": "2026-11-26T00:00:04.789Z",
3
+ "v": "0.861.0",
4
+ "at": "2026-11-26T00:54:33.021Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 2072,
9
+ "t": "A stage's dates follow its tasks' earliest start and latest end, the stage in progress too",
10
+ "s": "A stage's dates follow its tasks' earliest start and latest end, the stage in progress too",
11
+ "k": "fix",
12
+ "i": "stage-dates-from-tasks"
13
+ }
14
+ ]
15
+ },
16
+ {
17
+ "v": "0.860.0",
18
+ "at": "2026-11-26T00:07:19.305Z",
5
19
  "f": 4,
6
20
  "prs": [
7
21
  {
@@ -10,6 +24,13 @@
10
24
  "s": "Reference cards hidden behind one icon on Work and the initiative page",
11
25
  "k": "new",
12
26
  "i": "fold-by-default"
27
+ },
28
+ {
29
+ "n": 2071,
30
+ "t": "Huddle slices 2 and 3: Huddle icon, say an idea, missing angles, Doc/Slides/Report/Design outputs",
31
+ "s": "Huddle slices 2 and 3: Huddle icon, say an idea, missing angles, Doc/Slides/Report/Design outputs",
32
+ "k": "new",
33
+ "i": "huddle-brainstorm"
13
34
  }
14
35
  ]
15
36
  },
@@ -2,13 +2,17 @@
2
2
  type: Guide
3
3
  title: "An initiative's tasks"
4
4
  description: "Where an initiative's tasks show in the workspace, how an agent adds tasks, and who made a change."
5
- timestamp: 2026-11-24
5
+ timestamp: 2026-11-26
6
6
  ---
7
7
 
8
8
  # An initiative's tasks
9
9
 
10
10
  An initiative owns its task breakdown. In the workspace, its tasks show under the initiative in Today's list (the 3 most urgent, then **Show N more tasks**) and on the initiative's page in the Viewer. Press **+** at the top of Today's list, then **Task**, to add one. A check box is a task: amber when it is late. [Today](home.md) explains the list.
11
11
 
12
+ ## A stage's dates
13
+
14
+ A stage's dates come from its tasks: it starts on the earliest task start and ends on the latest task end. A task with no start counts from its due date. A Won't do task does not count. This is true for every stage, also the stage in progress, in the Work breakdown and on the initiative's page. A stage with no dated task uses the dates it moved through the workflow, and the stage in progress then ends on the initiative's end date. To move a stage's dates, change its tasks' dates.
15
+
12
16
  ## Changes show at once
13
17
 
14
18
  A change you make shows right away, on every page that shows the task: its status, dates, owner, priority, sprint, name, stage or parent, a new task, a deleted task, and a move of several tasks. The case lines and the summary of an initiative show right away too. You do not have to wait for the save, and you do not have to open the popup again.
@@ -381,14 +381,20 @@ The [Horizon scan](intelligence-okr-goals.md) is the part of the agent that look
381
381
 
382
382
  ## A Huddle: brainstorm with the team in 15 minutes
383
383
 
384
- When an initiative is in Triage, Discover or Plan, its popup on Work shows the ✦ row "Huddle on it with the team?". ✕ hides the row for that initiative.
384
+ To start a Huddle on any initiative, press the Huddle icon (three people) at the top of its popup, beside the chat. When an initiative is in Triage, Discover or Plan, its popup on Work also shows the ✦ row "Huddle on it with the team?". ✕ hides the row for that initiative.
385
385
 
386
- 1. Press ✓. The Huddle opens beside the item. It shows the question and up to three facts that PMOS found in the product's own records: customer signals, an earlier out-of-scope decision with the same words, and loose notes about it. If PMOS finds nothing, no fact shows.
387
- 2. Type each idea and press +. Each idea becomes a card.
386
+ 1. Press the Huddle icon, or ✓ on the row. The Huddle opens beside the item. It shows the question and up to three facts that PMOS found in the product's own records: customer signals, an earlier out-of-scope decision with the same words, and loose notes about it. If PMOS finds nothing, no fact shows.
387
+ 2. Type each idea and press +, or press the mic and say it. Press the mic again to stop: what you said becomes a card. If you said more than a card holds, PMOS makes one small call to shorten it, and the card keeps your words under "As said". When the team has three cards or more, PMOS can show up to two dashed "missing angle" cards from the records (a customer's words, an earlier decision, a loose note). Press + to add one as a card, or ✕ to hide it.
388
388
  3. Press the dot on the cards you like. Each person has one dot per card. Press the dot again to take it back. The card with the most dots has a blue ring.
389
- 4. On a card with a dot, press **Decision** or **Task**. Decision writes one line to the decision journal (`pmos decisions`). Task adds a task to the initiative. Press Undo, on the toast or on the card, to take the output back.
389
+ 4. On a card with a dot, press what it should become:
390
+ - **Decision** writes one line to the decision journal (`pmos decisions`).
391
+ - **Task** adds a task to the initiative.
392
+ - **Doc**, **Slides** or **Report** writes a short outline now (a Doc is 3 to 5 headings, Slides are 4 to 6 slide titles, a Report is one section with 3 points) to `huddles/` in the product's state folder. PMOS writes the full draft into the same file later, when deep work may run (at night, or when you step away). The card says "outline · full draft tonight", then "drafted".
393
+ - **Design** starts a live round: three versions of the idea, in the Lab.
390
394
 
391
- PMOS calls no AI model in a Huddle and sends nothing outside PMOS. The Huddle is kept in `huddles.jsonl` in the runs folder, and the popup opens the newest Huddle of the initiative again.
395
+ Press Undo, on the toast or on the card, to take the output back. Undo deletes an outline file and stops a design round that still runs.
396
+
397
+ The AI calls in a Huddle are small: one to shorten a long spoken idea, and one for each Doc, Slides or Report outline. The page counts these calls. The full drafts run later, not in the meeting, and are never issued or sent. The question, the facts, the missing angles and the dots use no AI. Nothing is sent outside PMOS, and the mic keeps no audio, only the text. The Huddle is kept in `huddles.jsonl` in the runs folder, and the popup opens the newest Huddle of the initiative again.
392
398
 
393
399
  ## Integrated work: from a merged commit to Done
394
400
 
@@ -88,6 +88,7 @@ const JOBS = Object.freeze([
88
88
  { id: 'report-design', step: 4, label: 'Report design' },
89
89
  { id: 'report-structure', step: 4, label: 'Report structure' },
90
90
  { id: 'team', step: 4, label: 'Role agents' },
91
+ { id: 'huddle-drafts', step: 4, label: 'Huddle drafts' }, // huddle-brainstorm slice 3: the full drafts of a Huddle's outlines (lib/huddle-drafts.js)
91
92
  { id: 'owner', step: 4, label: 'Unit owners', ai: false }, // chief-unit-owners: one brief a day per program, product and project (lib/unit-owner.js); no model
92
93
  { id: 'scan', step: 5, label: 'Horizon scan' },
93
94
  { id: 'improve', step: 5, label: 'Improvement loop' }, // improve-loop-engine: lessons from repeated problems (lib/improve-runs.js)
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+ /* huddle-drafts.js — the full drafts of a Huddle's outlines (initiative huddle-brainstorm, slice 3). In the room a Doc, Slides or Report
3
+ * output is only a short outline (one small call, lib/routes-huddle.js); the full draft is written later, when deep work may run (at night,
4
+ * or when the PM has stepped away: lib/driver-run.js deepOpen), so the meeting stays fast and the tokens go where the room is not waiting.
5
+ *
6
+ * create({ workspaces, stateDir, open, ask, warn }) → { tick(now?) }
7
+ * workspaces() → [{ id, root }]
8
+ * stateDir(w) → the product's state folder (lib/routes-capture.js captureStateDir): the outline files are under huddles/
9
+ * open(now) → true when deep work may run now
10
+ * ask(prompt, key) → Promise<text | null> ONE run (the PM's own session, an ask job); null when it gave nothing
11
+ * draftPrompt(kind, outline) · draftOf(text) · withDraft(doc, draft) PURE
12
+ *
13
+ * ONE PER TICK, oldest first, over every product. A run that gives nothing appends `draft-failed` with the reason and is not tried again
14
+ * (a failure is never retried in a loop). An undone output is never drafted. Nothing is issued, sent or shared: the draft stays in the file.
15
+ * Every log line carries [huddle]. */
16
+ const fs = require('fs');
17
+ const path = require('path');
18
+ const H = require('./huddle.js');
19
+
20
+ const SHAPE = Object.freeze({
21
+ doc: 'Write the full document under the outline\'s headings: 2 to 4 short paragraphs per heading.',
22
+ slides: 'Write each slide: its title as a "## " line, then 3 to 5 short bullet lines, then one line starting "Notes: ".',
23
+ report: 'Write the report section: the heading, one short paragraph, then the 3 points each with one sentence of evidence or "(no data yet)".',
24
+ });
25
+ function draftPrompt(kind, outlineDoc) {
26
+ return 'Below is an outline a team made in a brainstorm (a Huddle). ' + (SHAPE[kind] || SHAPE.doc) + '\n'
27
+ + 'Plain words. Do not invent numbers, names or facts the outline does not give; write "(to confirm)" where a fact is needed.\n'
28
+ + 'Reply with the draft only, in Markdown, starting with a "## " heading.\n\n' + String(outlineDoc || '').slice(0, 6000);
29
+ }
30
+ /** The draft a reply holds, or '' when it holds none. PURE. */
31
+ function draftOf(text) {
32
+ const t = String(text || '').trim();
33
+ return /^##\s+\S/m.test(t) && t.length >= 80 ? t.slice(0, 20000) : '';
34
+ }
35
+ /** The file with its "## Draft" part replaced. PURE. */
36
+ function withDraft(doc, draft) {
37
+ const s = String(doc || ''), i = s.indexOf('\n## Draft\n');
38
+ const head = i >= 0 ? s.slice(0, i) : s.replace(/\s+$/, '');
39
+ return head + '\n## Draft\n\n' + draft.replace(/^##\s/gm, '### ') + '\n';
40
+ }
41
+
42
+ function create(deps = {}) {
43
+ let busy = false;
44
+ async function tick(now = new Date()) {
45
+ if (busy) return { ok: true, why: 'a draft is running' };
46
+ try { if (deps.open && !deps.open(now)) return { ok: true, why: 'deep work waits' }; } catch { return { ok: true, why: 'deep work waits' }; }
47
+ let pick = null;
48
+ for (const w of (deps.workspaces ? deps.workspaces() : []) || []) {
49
+ let due = [];
50
+ try { due = H.dueDrafts(H.readLines(w.root)); } catch { due = []; }
51
+ if (due.length && (!pick || String(due[0].at) < String(pick.d.at))) pick = { w, d: due[0] };
52
+ }
53
+ if (!pick) return { ok: true, why: 'nothing to draft' };
54
+ const { w, d } = pick, abs = path.join(deps.stateDir(w), d.file);
55
+ busy = true;
56
+ try {
57
+ let doc = '';
58
+ try { doc = fs.readFileSync(abs, 'utf8'); } catch { H.append(w.root, { ev: 'draft-failed', hid: d.hid, mid: d.mid, why: 'the outline file is gone', by: 'pmos' }); return { ok: false, why: 'gone' }; }
59
+ const text = await Promise.resolve(deps.ask ? deps.ask(draftPrompt(d.kind, doc), d.mid) : null).catch(() => null);
60
+ const draft = draftOf(text);
61
+ if (!draft) { H.append(w.root, { ev: 'draft-failed', hid: d.hid, mid: d.mid, why: 'the run gave no draft', by: 'pmos' }); return { ok: false, why: 'no draft' }; }
62
+ fs.writeFileSync(abs, withDraft(doc, draft));
63
+ H.append(w.root, { ev: 'drafted', hid: d.hid, mid: d.mid, by: 'pmos' });
64
+ return { ok: true, drafted: d.mid };
65
+ } catch (e) { if (deps.warn) deps.warn('huddle draft', e); return { ok: false, why: String((e && e.message) || e) }; } finally { busy = false; }
66
+ }
67
+ return { tick };
68
+ }
69
+
70
+ module.exports = { create, draftPrompt, draftOf, withDraft };
@@ -4,20 +4,29 @@
4
4
  * lib/routes-huddle.js does the I/O; pm/huddle.js draws it; pm/pop-work-model.js offers it as a ✦ row on the Work popup.
5
5
  *
6
6
  * A Huddle is four steps on one initiative: Frame (the question and up to 3 facts from the product's own records), Go wide (each typed idea
7
- * is a card), Pick (dots: one per person per card) and Make (a picked card becomes a Decision in the decision journal or a Task on the
8
- * initiative, each with Undo). It calls no model and sends nothing: the frame facts are read from files the product already keeps.
7
+ * is a card; slice 2: a spoken idea is shortened by one small call, and PMOS shows up to 2 missing angles from the records), Pick (dots: one per person per card) and Make (a picked card becomes a Decision in the decision journal or a Task on the
8
+ * initiative, each with Undo). Frame and Pick call no model and nothing is sent: the frame facts are read from files the product already keeps.
9
9
  *
10
10
  * THE LEDGER: huddles.jsonl in the runs folder (planning/runs/ for PMOS itself, pmos/state/ in a kit repository; lib/plan-ledgers.js
11
11
  * runsDir). Append-only JSON lines, each { v: 1, ev, hid, at, by, ... }:
12
- * start ini, title, question, facts: [{ text, source }]
13
- * idea cid, text a card
12
+ * start ini, title, question, facts: [{ text, source }], angles: [{ aid, text, source }] (angles: slice 2, the record lines a card may miss)
13
+ * idea cid, text [, said, calls, aid] a card; said: the words as spoken (slice 2), calls: the small calls PMOS made for it (0 or 1),
14
+ * aid: the missing angle the card was made from
15
+ * angle-drop aid ✕ on a missing angle: it is not shown again in this Huddle
14
16
  * dot cid a dot from `by`; a second dot from the same person on the same card takes it back
15
17
  * make cid, mid, kind (decision | task), out ({ id } a decision id | { ws, board, task, ini } the filed task)
16
18
  * unmake mid the output was undone
19
+ * drafted mid slice 3: the full draft of an outline is written (lib/huddle-drafts.js)
20
+ * draft-failed mid, why the draft run gave nothing; it is not tried again
21
+ * make kinds (slice 3): doc | slides | report → out { file, calls, cut? } an outline file in <state>/huddles/; design → out { round } a live round
17
22
  *
18
23
  * fold(lines, hid) → { hid, ini, title, question, facts, at, ideas: [{ cid, text, by, dots, mine?, made: [make] }], made } | null PURE
19
24
  * latestOf(lines, ini) → the newest Huddle id of an initiative, or '' PURE
20
25
  * factsOf({ title, signals, rejections, captures }) → [{ text, source }] at most 3 PURE
26
+ * anglesOf({ title, signals, rejections, captures }) → [{ aid, text, source }] at most 4 candidate missing angles PURE
27
+ * shownAngles(h) → the angles to show: once 3 or more cards, at most 2, none a card covers, none dropped or added PURE
28
+ * cardOf(said) → the fallback card of spoken words: the first sentence, at most 12 words PURE
29
+ * shortenPrompt(said, question) · parseShort(text) → the one small call that shortens spoken words to a card (lib/routes-huddle.js) PURE
21
30
  * readLines(root) · append(root, line)
22
31
  * Every log line carries [huddle]. */
23
32
  const fs = require('fs');
@@ -26,7 +35,9 @@ const crypto = require('crypto');
26
35
 
27
36
  const TAG = '[huddle]';
28
37
  const FILE = 'huddles.jsonl';
29
- const KINDS = Object.freeze(['decision', 'task']);
38
+ const KINDS = Object.freeze(['decision', 'task', 'doc', 'slides', 'report', 'design']);
39
+ const OUTLINE_KINDS = Object.freeze(['doc', 'slides', 'report']); // slice 3: one small call in the room, the full draft later (huddle-drafts)
40
+ const KIND_WORDS = Object.freeze({ doc: 'Doc', slides: 'Slides', report: 'Report' });
30
41
  const MAX_TEXT = 200;
31
42
  const MAX_FACTS = 3;
32
43
  const MIN_SHARED = 2;
@@ -60,29 +71,125 @@ function factsOf({ title = '', signals = [], rejections = [], captures = [] } =
60
71
  return out.slice(0, MAX_FACTS);
61
72
  }
62
73
 
74
+ const MAX_ANGLES = 4;
75
+ const SHOWN_ANGLES = 2;
76
+ const ANGLE_AFTER = 3;
77
+ const CARD_WORDS = 12;
78
+ const AID_RE = /^a[0-9]$/;
79
+
80
+ /** Candidate missing angles from the product's own records, each with its source (no model). PURE. */
81
+ function anglesOf({ title = '', signals = [], rejections = [], captures = [] } = {}) {
82
+ const out = [], tw = wordsOf(title);
83
+ for (const s of (signals || []).filter((x) => x && one(x.note))) out.push({ text: one(s.who, 40) + ' said: ' + one(s.note, 140), source: 'customer signal · ' + one(s.who, 40) });
84
+ const rej = (rejections || []).map((r) => ({ r, n: shared(tw, r.words instanceof Set ? r.words : wordsOf(r.title)) })).filter((x) => x.n >= MIN_SHARED).sort((a, b) => b.n - a.n)[0];
85
+ if (rej) out.push({ text: 'Why was "' + one(rej.r.title, 80) + '" ruled out, and does that still hold?', source: one(rej.r.path, 120) });
86
+ for (const c of (captures || []).filter((x) => x && shared(tw, wordsOf(x.text)) >= MIN_SHARED)) out.push({ text: one(c.text, 160), source: 'captured note · ' + one(c.id, 60) });
87
+ return out.slice(0, MAX_ANGLES).map((a, i) => ({ aid: 'a' + i, ...a }));
88
+ }
89
+
90
+ /** The angles to show beside the cards. PURE. */
91
+ function shownAngles(h) {
92
+ if (!h || (h.ideas || []).length < ANGLE_AFTER) return [];
93
+ const used = new Set((h.ideas || []).map((i) => i.aid).filter(Boolean)), dropped = h.dropped || new Set();
94
+ const cards = (h.ideas || []).map((i) => wordsOf(i.text + ' ' + (i.said || '')));
95
+ return (h.angles || []).filter((a) => !used.has(a.aid) && !dropped.has(a.aid) && !cards.some((w) => shared(w, wordsOf(a.text)) >= MIN_SHARED)).slice(0, SHOWN_ANGLES);
96
+ }
97
+
98
+ /** The card of spoken words when no call answers: the first sentence, at most 12 words. PURE. */
99
+ function cardOf(said) {
100
+ const first = one(said).split(/(?<=[.!?])\s+/)[0] || '';
101
+ const w = first.replace(/[.!?]+$/, '').split(' ').filter(Boolean);
102
+ return w.slice(0, CARD_WORDS).join(' ') + (w.length > CARD_WORDS ? '…' : '');
103
+ }
104
+
105
+ /** The one small call: spoken words in, one card line out. PURE. */
106
+ function shortenPrompt(said, question) {
107
+ return 'A team is brainstorming on this question: ' + one(question, 160) + '\n'
108
+ + 'Someone said the idea below out loud. Write it as one idea card: at most 12 words, plain words, the idea itself, no quotes, no preamble.\n'
109
+ + 'Reply with the card line only.\n\nWhat was said: ' + one(said, 600);
110
+ }
111
+ function parseShort(text) {
112
+ const line = String(text || '').split('\n').map((x) => x.replace(/^[-*•>\s"']+|["'\s]+$/g, '').trim()).find(Boolean) || '';
113
+ const w = line.split(/\s+/).filter(Boolean);
114
+ if (!w.length || w.length > CARD_WORDS + 4) return '';
115
+ return one(w.slice(0, CARD_WORDS).join(' '), MAX_TEXT);
116
+ }
117
+
118
+ /* ── slice 3: outlines in the room, drafts later ── */
119
+ const OUTLINE_SHAPE = Object.freeze({
120
+ doc: 'a document outline: 3 to 5 headings, each a line starting with "## ", each followed by one plain sentence of what it says',
121
+ slides: 'a slide storyline: 4 to 6 slide titles, one per line, each starting with "## "',
122
+ report: 'one report section: one heading line starting with "## ", then 3 points, each a line starting with "- "',
123
+ });
124
+ function outlinePrompt(kind, { idea = '', question = '', title = '' } = {}) {
125
+ return 'A team picked this idea in a brainstorm on ' + one(title, 120) + ' (question: ' + one(question, 160) + ').\n'
126
+ + 'Idea: ' + one(idea) + '\n'
127
+ + 'Write ' + OUTLINE_SHAPE[kind] + '. Plain words. Do not invent numbers or facts. Reply with the outline only.';
128
+ }
129
+ /** The outline lines a reply holds, in the kind's shape; [] when it does not hold one. PURE. */
130
+ function parseOutline(kind, text) {
131
+ const L = String(text || '').split('\n').map((x) => x.replace(/\s+$/, '')).filter((x) => x.trim());
132
+ const heads = L.filter((x) => /^##\s+\S/.test(x)).length, points = L.filter((x) => /^[-*]\s+\S/.test(x)).length;
133
+ const fits = kind === 'doc' ? heads >= 3 && heads <= 5 : kind === 'slides' ? heads >= 4 && heads <= 6 : heads === 1 && points >= 3;
134
+ return fits ? L.filter((x) => /^(##\s|[-*]\s)/.test(x) || (kind === 'doc' && !/^#/.test(x))).map((x) => one(x, 240)).slice(0, 14) : [];
135
+ }
136
+ function fileOf(hid, mid) { return 'huddles/' + hid + '-' + mid + '.md'; }
137
+ /** The outline file's text: frontmatter (D63), the card, the outline (or the card's words, said plainly), and the draft to come. PURE. */
138
+ function outlineDoc(kind, { title = '', idea = '', lines = [], at = '' } = {}) {
139
+ const name = KIND_WORDS[kind] + ': ' + one(idea, 100);
140
+ const body = lines.length ? lines.join('\n') : '## ' + one(idea) + '\n\nPMOS could not outline it in the room. The full draft is written later from the card.';
141
+ return '---\ntype: Brief\ntitle: "' + name.replace(/"/g, "'") + '"\ntimestamp: ' + (at || new Date().toISOString()) + '\nhuddle_kind: ' + kind + '\n---\n\n'
142
+ + '# ' + name + '\n\nFrom a Huddle on ' + one(title, 120) + '.\n\n## Outline\n\n' + body + '\n\n## Draft\n\nPMOS writes the full draft later, when deep work may run.\n';
143
+ }
144
+ /** The outlines that wait for their draft, oldest first. PURE. */
145
+ function dueDrafts(lines) {
146
+ const outs = new Map(), done = new Set();
147
+ for (const l of lines || []) {
148
+ if (!isObj(l)) continue;
149
+ if (l.ev === 'make' && OUTLINE_KINDS.includes(l.kind) && MID_RE.test(String(l.mid || '')) && isObj(l.out) && l.out.file) outs.set(l.mid, { hid: l.hid, mid: l.mid, cid: l.cid, kind: l.kind, file: l.out.file, at: l.at || '' });
150
+ else if ((l.ev === 'unmake' || l.ev === 'drafted' || l.ev === 'draft-failed') && l.mid) done.add(l.mid);
151
+ }
152
+ return [...outs.values()].filter((o) => !done.has(o.mid)).sort((a, b) => String(a.at).localeCompare(String(b.at)));
153
+ }
154
+ /** What the card says about an output. PURE. */
155
+ function stateOf(m) {
156
+ if (!m) return '';
157
+ if (m.kind === 'design') return 'Design · 3 versions in the Lab';
158
+ if (!OUTLINE_KINDS.includes(m.kind)) return '';
159
+ const k = KIND_WORDS[m.kind];
160
+ return m.drafted ? k + ' · drafted' : m.failed ? k + ' · the draft did not come: ' + m.failed : k + ' outline · full draft tonight';
161
+ }
162
+
63
163
  /** One Huddle from every line. PURE. */
64
164
  function fold(lines, hid, { me = '' } = {}) {
65
165
  let h = null;
66
- const ideas = new Map(), dots = new Map(), makes = new Map(), undone = new Set();
166
+ const ideas = new Map(), dots = new Map(), makes = new Map(), undone = new Set(), dropped = new Set(), drafted = new Set(), failed = new Map();
67
167
  for (const l of lines || []) {
68
168
  if (!isObj(l) || l.hid !== hid) continue;
69
- if (l.ev === 'start' && !h) h = { hid, ini: one(l.ini, 120), title: one(l.title, 120), question: one(l.question) || questionOf(l.title), facts: Array.isArray(l.facts) ? l.facts.filter(isObj).slice(0, MAX_FACTS) : [], at: l.at || '', by: l.by || null };
169
+ if (l.ev === 'start' && !h) h = { hid, ini: one(l.ini, 120), title: one(l.title, 120), question: one(l.question) || questionOf(l.title), facts: Array.isArray(l.facts) ? l.facts.filter(isObj).slice(0, MAX_FACTS) : [], angles: Array.isArray(l.angles) ? l.angles.filter((a) => isObj(a) && AID_RE.test(String(a.aid || '')) && one(a.text)).slice(0, MAX_ANGLES) : [], at: l.at || '', by: l.by || null };
70
170
  else if (l.ev === 'question' && h) h.question = one(l.question) || h.question;
71
- else if (l.ev === 'idea' && CID_RE.test(String(l.cid || '')) && one(l.text) && !ideas.has(l.cid)) ideas.set(l.cid, { cid: l.cid, text: one(l.text), by: l.by || null, at: l.at || '' });
171
+ else if (l.ev === 'idea' && CID_RE.test(String(l.cid || '')) && one(l.text) && !ideas.has(l.cid)) ideas.set(l.cid, { cid: l.cid, text: one(l.text), by: l.by || null, at: l.at || '', ...(one(l.said, 600) ? { said: one(l.said, 600) } : {}), ...(AID_RE.test(String(l.aid || '')) ? { aid: l.aid } : {}), calls: l.calls === 1 ? 1 : 0 });
72
172
  else if (l.ev === 'dot' && CID_RE.test(String(l.cid || ''))) {
73
173
  const k = l.cid + '|' + (l.by || ''), s = dots.get(l.cid) || new Set();
74
174
  if (s.has(k)) s.delete(k); else s.add(k);
75
175
  dots.set(l.cid, s);
76
176
  } else if (l.ev === 'make' && MID_RE.test(String(l.mid || '')) && KINDS.includes(l.kind)) makes.set(l.mid, { mid: l.mid, cid: l.cid, kind: l.kind, out: isObj(l.out) ? l.out : {}, at: l.at || '' });
77
177
  else if (l.ev === 'unmake' && MID_RE.test(String(l.mid || ''))) undone.add(l.mid);
178
+ else if (l.ev === 'angle-drop' && AID_RE.test(String(l.aid || ''))) dropped.add(l.aid);
179
+ else if (l.ev === 'drafted' && l.mid) drafted.add(l.mid);
180
+ else if (l.ev === 'draft-failed' && l.mid) failed.set(l.mid, one(l.why, 120) || 'no reason given');
78
181
  }
79
182
  if (!h) return null;
80
- const made = [...makes.values()].filter((m) => !undone.has(m.mid));
183
+ const made = [...makes.values()].filter((m) => !undone.has(m.mid)).map((m) => { const x = { ...m, ...(drafted.has(m.mid) ? { drafted: true } : {}), ...(failed.has(m.mid) ? { failed: failed.get(m.mid) } : {}) }; x.state = stateOf(x); return x; });
81
184
  h.ideas = [...ideas.values()].map((i) => {
82
185
  const s = dots.get(i.cid) || new Set();
83
186
  return { ...i, dots: s.size, mine: me ? s.has(i.cid + '|' + me) : false, made: made.filter((m) => m.cid === i.cid) };
84
187
  });
85
188
  h.made = made;
189
+ h.calls = h.ideas.reduce((n, i) => n + (i.calls || 0), 0) + made.reduce((n, m) => n + (m.out && m.out.calls === 1 ? 1 : 0), 0);
190
+ h.dropped = dropped;
191
+ h.shownAngles = shownAngles(h);
192
+ delete h.dropped;
86
193
  return h;
87
194
  }
88
195
 
@@ -111,4 +218,4 @@ function append(root, line) {
111
218
  return full;
112
219
  }
113
220
 
114
- module.exports = { TAG, FILE, KINDS, MAX_TEXT, MAX_FACTS, HID_RE, CID_RE, MID_RE, newId, questionOf, wordsOf, factsOf, fold, latestOf, ledgerFile, readLines, append, one };
221
+ module.exports = { TAG, FILE, KINDS, OUTLINE_KINDS, KIND_WORDS, outlinePrompt, parseOutline, fileOf, outlineDoc, dueDrafts, stateOf, MAX_TEXT, MAX_FACTS, HID_RE, CID_RE, MID_RE, AID_RE, CARD_WORDS, newId, questionOf, wordsOf, factsOf, anglesOf, shownAngles, cardOf, shortenPrompt, parseShort, fold, latestOf, ledgerFile, readLines, append, one };
@@ -93,6 +93,9 @@ const LEDGERS = Object.freeze({
93
93
  '<state>/team.jsonl': { concept: 'role-team', owner: 'lib/team-runs.js', readers: [
94
94
  r('lib/team-cli.js', 'R.status', '`pmos team status`: who works on what, and the inbox entry of each ended dispatch'),
95
95
  r('lib/team-runs.js', 'function advance', 'the next role of a dispatch, and the Evaluator woken by another role\'s write')] },
96
+ 'repo:planning/runs/huddles.jsonl': { concept: 'huddles', owner: 'lib/huddle.js', readers: [
97
+ r('lib/routes-huddle.js', 'H.readLines', 'the Huddle page: cards, dots, angles and what it made'),
98
+ r('lib/huddle-drafts.js', 'H.dueDrafts', 'the outlines that wait for their full draft')] },
96
99
  '<state>/structure.jsonl': { concept: 'report-structure', owner: 'lib/report-structure.js', readers: [
97
100
  r('lib/routes-report-structure.js', null, 'the report structure step')] },
98
101
  '<state>/milestone-reviews.jsonl': { concept: 'milestone-reviews', owner: 'lib/milestone-suggest.js', readers: [
@@ -161,6 +164,7 @@ const JOBS = Object.freeze([
161
164
  q('forecast', 'lib/forecast-tick.js', ['<state>/forecast.jsonl'], ['<state>/boards.jsonl']),
162
165
  q('report-design', 'lib/routes-report-design.js', ['<state>/design.jsonl']),
163
166
  q('report-structure', 'lib/routes-report-structure.js', ['<state>/structure.jsonl']),
167
+ q('huddle-drafts', 'lib/huddle-drafts.js', ['repo:planning/runs/huddles.jsonl'], ['repo:planning/runs/huddles.jsonl'], 'one full draft per tick, when deep work may run'),
164
168
  q('team', 'lib/team-runs.js', ['<state>/team.jsonl'], ['<state>/team.jsonl', 'initiative records']),
165
169
  q('owner', 'lib/unit-owner.js', ['<state>/units.jsonl'], ['<state>/team.jsonl', '<state>/driver.jsonl', '<runtime>/goal-loops.jsonl', 'memory'], 'chief-unit-owners: one brief a day per unit, a fold of the workers\' ledgers; no model, no session'),
166
170
  q('improve', 'lib/improve-runs.js', ['<state>/improve.jsonl', '<state>/autonomy.jsonl', props], ['<state>/improve-signals.jsonl', '<state>/improve.jsonl', 'repo:planning/improve/loop.jsonl'],
@@ -4,18 +4,26 @@
4
4
  * GET /api/huddle?ws=&ini=[&hid=] → { ok, huddle | null } the newest Huddle of the initiative (or the one named)
5
5
  * POST /api/huddle/start { ws, ini } → { ok, huddle } the question and the facts from the product's records
6
6
  * POST /api/huddle/question { ws, hid, question } → { ok, huddle }
7
- * POST /api/huddle/idea { ws, hid, text } → { ok, huddle }
7
+ * POST /api/huddle/idea { ws, hid, text[, said, aid] } → { ok, huddle } said: true when the mic filled the box (slice 2): words longer
8
+ * than a card are shortened by ONE small call (ideaOf); aid: a missing
9
+ * angle added as a card
10
+ * POST /api/huddle/angle-drop { ws, hid, aid } → { ok, huddle } ✕ on a missing angle
8
11
  * POST /api/huddle/dot { ws, hid, cid } → { ok, huddle } a second dot from the same person takes it back
9
12
  * POST /api/huddle/make { ws, hid, cid, kind } → { ok, huddle, mid } kind decision: one decision-journal line (from huddle);
10
13
  * kind task: one task on the initiative's board
14
+ * slice 3, kind doc | slides | report: ONE small call writes an
15
+ * outline file (full draft later); kind design: a live round
11
16
  * POST /api/huddle/unmake { ws, hid, mid } → { ok, huddle } the decision line is undone, the task deleted
12
17
  * Every POST is a page press (pm-guard requirePagePress): the writer is the actor it returns, never a field of the body. A `ws` the server
13
- * does not know is 404. Nothing here calls a model or sends anything outside PMOS. */
18
+ * does not know is 404. Nothing is sent outside PMOS. The one model call is ideaOf: a spoken idea longer than a card, one small call each
19
+ * (the PM's own normal session, `claude -p` as an ask job; tests inject ctx.askClaude). Start, question and dot call no model. */
20
+ const fs = require('fs');
21
+ const path = require('path');
14
22
  const guard = require('./pm-guard.js');
15
23
  const H = require('./huddle.js');
16
24
 
17
25
  const prefixes = ['/api/huddle'];
18
- const ACTS = new Set(['start', 'question', 'idea', 'dot', 'make', 'unmake']);
26
+ const ACTS = new Set(['start', 'question', 'idea', 'dot', 'make', 'unmake', 'angle-drop']);
19
27
 
20
28
  /** The initiative's title: the open list first, then the record's own title line, then its id. '' when there is no such record. */
21
29
  function titleOf(ctx, root, ini) {
@@ -29,7 +37,14 @@ function titleOf(ctx, root, ini) {
29
37
  } catch { return ''; }
30
38
  }
31
39
 
32
- /** The frame facts from the product's own records. Never throws: a source it cannot read gives no fact. */
40
+ /** The frame facts and the candidate missing angles from the product's own records. Never throws: a source it cannot read gives none. */
41
+ function frameOf(ctx, w, ini, title) {
42
+ let signals = [], rejections = [], captures = [];
43
+ try { signals = require('./customer-signals.js').byInitiative(w.root).get(ini) || []; } catch { /* no ledger */ }
44
+ try { rejections = require('./triage.js').rejections(w.root); } catch { /* no out-of-scope folder */ }
45
+ try { captures = require('./capture.js').list(require('./routes-capture.js').captureStateDir(ctx, w.root)); } catch { /* no notes */ }
46
+ return { facts: H.factsOf({ title, signals, rejections, captures }), angles: H.anglesOf({ title, signals, rejections, captures }) };
47
+ }
33
48
  function frameFacts(ctx, w, ini, title) {
34
49
  let signals = [], rejections = [], captures = [];
35
50
  try { signals = require('./customer-signals.js').byInitiative(w.root).get(ini) || []; } catch { /* no ledger */ }
@@ -38,7 +53,23 @@ function frameFacts(ctx, w, ini, title) {
38
53
  return H.factsOf({ title, signals, rejections, captures });
39
54
  }
40
55
 
41
- function made(ctx, w, h, idea, kind, g) {
56
+ const stateDir = (ctx, w) => require('./routes-capture.js').captureStateDir(ctx, w.root);
57
+ async function made(ctx, w, h, idea, kind, g) {
58
+ if (H.OUTLINE_KINDS.includes(kind)) {
59
+ // slice 3: ONE small call for the outline; the full draft comes later (lib/huddle-drafts.js)
60
+ const mid = H.newId('m'), rel = H.fileOf(h.hid, mid), abs = path.join(stateDir(ctx, w), rel);
61
+ const key = require('crypto').createHash('sha1').update(kind + '\n' + idea.text).digest('hex').slice(0, 12);
62
+ const lines = H.parseOutline(kind, await viaSession(ctx || {}, H.outlinePrompt(kind, { idea: idea.text, question: h.question, title: h.title }), key, { job: 'huddle-outline', name: 'huddle: outline a ' + kind }));
63
+ fs.mkdirSync(path.dirname(abs), { recursive: true });
64
+ fs.writeFileSync(abs, H.outlineDoc(kind, { title: h.title, idea: idea.text, lines }));
65
+ console.info(H.TAG + ' outline ' + kind + ' ' + h.hid + ' ' + (lines.length ? 'outlined' : 'cut'));
66
+ return { ok: true, mid, out: { file: rel, calls: 1, ...(lines.length ? {} : { cut: true }) } };
67
+ }
68
+ if (kind === 'design') {
69
+ const r = require('./live-round.js').startNow({ ws: w.id, ini: h.ini, brief: idea.text + ' (from a Huddle on: ' + h.question + ')', from: 'chat', by: g.actor && g.actor.by });
70
+ if (!r || !r.ok) return { ok: false, status: 409, error: (r && r.error) || 'The design round did not start.' };
71
+ return { ok: true, out: { round: (r.round && r.round.id) || '' } };
72
+ }
42
73
  if (kind === 'decision') {
43
74
  const r = require('./decision-journal.js').logFrom(w.root, { from: 'huddle', decided: idea.text, ref: 'huddle:' + h.hid + ':' + idea.cid, initiative: h.ini, why: 'Picked in a Huddle: ' + h.question },
44
75
  { by: g.actor && g.actor.by, via: 'ui' });
@@ -51,10 +82,46 @@ function made(ctx, w, h, idea, kind, g) {
51
82
  }
52
83
 
53
84
  function unmade(ctx, w, m, g) {
85
+ if (H.OUTLINE_KINDS.includes(m.kind)) { try { fs.unlinkSync(path.join(stateDir(ctx, w), m.out.file)); } catch { /* already gone */ } return; }
86
+ if (m.kind === 'design') { if (m.out.round) try { require('./live-round.js').stopRound(m.out.round); } catch { /* it ended */ } return; }
54
87
  if (m.kind === 'decision') { require('./decision-journal.js').undo(w.root, { id: m.out.id }, { by: g.actor && g.actor.by, via: 'ui' }); return; }
55
88
  require('./capture-file.js').unfile(ctx, { ws: m.out.ws, board: m.out.board, task: m.out.task, ini: m.out.ini }, g);
56
89
  }
57
90
 
91
+ /* ── the one small call: spoken words to a card (slice 2) ── */
92
+ const MODEL = 'claude-sonnet-5-5';
93
+ const LEAN = Object.freeze([{ flag: '--strict-mcp-config' }, { flag: '--disable-slash-commands' }, { flag: '--setting-sources', value: 'user' }, { flag: '--tools', value: 'Read' }]);
94
+ const TIMEOUT_MS = 20000; // in the room: a card that waits longer is written from the words themselves
95
+ function viaSession(ctx, prompt, key, o = {}) {
96
+ const job = o.job || 'huddle-card';
97
+ if (typeof ctx.askClaude === 'function') return Promise.resolve(ctx.askClaude(prompt, { job, key })).catch(() => null);
98
+ let headless = null; try { headless = require('./headless.js'); } catch { headless = null; }
99
+ const origin = 'briefing-ask:' + job + ':' + key;
100
+ if (typeof ctx.spawnSession !== 'function' || !headless || headless.kindFor({ agent: 'claude', origin }) !== 'ask') return Promise.resolve(null);
101
+ return new Promise((resolve) => {
102
+ let settled = false; const done = (v) => { if (settled) return; settled = true; clearTimeout(t); resolve(v); };
103
+ const t = setTimeout(() => done(null), o.timeoutMs || TIMEOUT_MS);
104
+ let s = null;
105
+ try {
106
+ s = ctx.spawnSession({ name: o.name || 'huddle: shorten a spoken idea', agent: 'claude', origin, initialInput: prompt,
107
+ modelAsk: { explicit: { model: MODEL, effort: 'low' } }, launchFlags: LEAN.map((f) => ({ ...f })),
108
+ onDone: (d) => { const r = d && d.result; done(r && r.ok && !r.isError ? String(r.text || '') : null); } });
109
+ } catch { s = null; }
110
+ if (!s || s.state === 'exited') done(null);
111
+ });
112
+ }
113
+ /** A card from what was typed or said. Typed, or said in a card's words or fewer: no call. Said longer: ONE small call, and the words as
114
+ * said are kept with the card; no answer in time: the first sentence, cut to a card. → { text, said?, calls } */
115
+ async function ideaOf(ctx, { text, said = false, question = '' }) {
116
+ const t = H.one(text, 600);
117
+ if (!said) return { text: H.one(t), calls: 0 };
118
+ if (t.split(' ').length <= H.CARD_WORDS) return { text: H.one(t), said: t, calls: 0 };
119
+ const key = require('crypto').createHash('sha1').update(t).digest('hex').slice(0, 12);
120
+ const got = H.parseShort(await viaSession(ctx || {}, H.shortenPrompt(t, question), key));
121
+ console.info(H.TAG + ' card from speech ' + (got ? 'shortened' : 'cut') + ' words=' + t.split(' ').length);
122
+ return { text: got || H.cardOf(t), said: t, calls: 1 };
123
+ }
124
+
58
125
  async function handle(req, res, url, ctx) {
59
126
  if (url.pathname !== '/api/huddle' && !url.pathname.startsWith('/api/huddle/')) return false;
60
127
  const act = url.pathname.slice('/api/huddle/'.length);
@@ -81,7 +148,8 @@ async function handle(req, res, url, ctx) {
81
148
  const ini = H.one(body.ini, 120), title = titleOf(ctx, w.root, ini);
82
149
  if (!ini || !title) return send({ ok: false, error: 'No such initiative in this product.' }, 404);
83
150
  const hid = H.newId('hd');
84
- H.append(w.root, { ev: 'start', hid, ini, title, question: H.questionOf(title), facts: frameFacts(ctx, w, ini, title), by: me });
151
+ const F = frameOf(ctx, w, ini, title);
152
+ H.append(w.root, { ev: 'start', hid, ini, title, question: H.questionOf(title), facts: F.facts, angles: F.angles, by: me });
85
153
  return send({ ok: true, huddle: H.fold(H.readLines(w.root), hid, { me }) });
86
154
  }
87
155
  const hid = String(body.hid || '');
@@ -93,20 +161,25 @@ async function handle(req, res, url, ctx) {
93
161
  if (q.length < 3) return send({ ok: false, error: 'Type the question.' }, 400);
94
162
  H.append(w.root, { ev: 'question', hid, question: q, by: me });
95
163
  } else if (act === 'idea') {
96
- const t = H.one(body.text);
97
- if (t.length < 2) return send({ ok: false, error: 'Type the idea.' }, 400);
98
- H.append(w.root, { ev: 'idea', hid, cid: H.newId('c'), text: t, by: me });
164
+ const t = H.one(body.text, 600);
165
+ if (t.length < 2) return send({ ok: false, error: body.said ? 'Nothing was heard. Say it again or type it.' : 'Type the idea.' }, 400);
166
+ const aid = H.AID_RE.test(String(body.aid || '')) && h.angles.some((a) => a.aid === body.aid) ? body.aid : '';
167
+ const c = aid ? { text: H.one(t), calls: 0 } : await ideaOf(ctx, { text: t, said: body.said === true, question: h.question });
168
+ H.append(w.root, { ev: 'idea', hid, cid: H.newId('c'), text: c.text, ...(c.said ? { said: c.said } : {}), ...(c.calls ? { calls: c.calls } : {}), ...(aid ? { aid, from: 'angle' } : {}), by: aid ? 'pmos' : me });
169
+ } else if (act === 'angle-drop') {
170
+ if (!h.angles.some((a) => a.aid === body.aid)) return send({ ok: false, error: 'No such angle.' }, 404);
171
+ H.append(w.root, { ev: 'angle-drop', hid, aid: body.aid, by: me });
99
172
  } else if (act === 'dot') {
100
173
  if (!h.ideas.some((i) => i.cid === body.cid)) return send({ ok: false, error: 'No such card.' }, 404);
101
174
  H.append(w.root, { ev: 'dot', hid, cid: body.cid, by: me });
102
175
  } else if (act === 'make') {
103
176
  const idea = h.ideas.find((i) => i.cid === body.cid);
104
177
  if (!idea) return send({ ok: false, error: 'No such card.' }, 404);
105
- if (!H.KINDS.includes(body.kind)) return send({ ok: false, error: 'Make a decision or a task.' }, 400);
178
+ if (!H.KINDS.includes(body.kind)) return send({ ok: false, error: 'Make a decision, a task, a doc, slides, a report or a design.' }, 400);
106
179
  if (idea.made.some((m) => m.kind === body.kind)) return send({ ok: false, error: 'This card is already a ' + body.kind + '.' }, 409);
107
- const r = made(ctx, w, h, idea, body.kind, g);
180
+ const r = await made(ctx, w, h, idea, body.kind, g);
108
181
  if (!r.ok) return send({ ok: false, error: r.error }, r.status);
109
- const mid = H.newId('m');
182
+ const mid = r.mid || H.newId('m');
110
183
  H.append(w.root, { ev: 'make', hid, cid: idea.cid, mid, kind: body.kind, out: r.out, by: me });
111
184
  return send({ ok: true, mid, huddle: H.fold(H.readLines(w.root), hid, { me }) });
112
185
  } else if (act === 'unmake') {
@@ -119,4 +192,4 @@ async function handle(req, res, url, ctx) {
119
192
  return send({ ok: true, huddle: h });
120
193
  }
121
194
 
122
- module.exports = { prefixes, handle, frameFacts };
195
+ module.exports = { prefixes, handle, frameFacts, frameOf, ideaOf, made, unmade, viaSession };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.859.0",
3
+ "version": "0.861.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.859.0",
9
+ "version": "0.861.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.859.0",
3
+ "version": "0.861.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",
@@ -25,6 +25,7 @@
25
25
  import * as TL from './ini-tail.js'; // the parts under Linked, Home's page draws them too (UI grill U1): drafted tickets, the PRD drift, Your impact
26
26
  import * as WK from './work-kind.js'; // the kind of work in the header (batch 29 item 11, KdV1-3)
27
27
  import * as VW from './cozy-viewer.js';
28
+ import * as HU from './huddle.js'; // the Huddle's own icon beside the chat (huddle-brainstorm slice 2)
28
29
  import * as SV from './small-vw.js'; // the one stakeholder form, Home's too (batch 18 item 2-C)
29
30
  import { esc } from './premium-shell.js';
30
31
  import { copyText } from './cozy-xv.js';
@@ -341,6 +342,8 @@ export function metaOf(r) {
341
342
  const d = /^(\d{4})-(\d{2})-(\d{2})/.exec(String((r && r.start) || ''));
342
343
  return [r && r.stage, r && r.kr ? 'anchored to ' + r.kr : '', d ? 'opened ' + +d[3] + ' ' + MON3[+d[2] - 1] : '', r && r.owner ? 'owner ' + r.owner : ''].filter(Boolean).join(' · ');
343
344
  }
345
+ /** The Huddle: its own icon beside the chat, in sight in the popup too (keep), so starting a Huddle is one press and not a chat. */
346
+ const HUDDLE_PRESS = Object.freeze({ act: 'huddle', label: 'Huddle with the team', icon: HU.HUDDLE_ICON, keep: true });
344
347
  export function openIni(r, from, o = {}) {
345
348
  if (!O || !r || !r.track) return;
346
349
  adding = o.addTo != null ? r.key : null; addTo = o.addTo || ''; addDates = o.addDates || null;
@@ -355,12 +358,13 @@ export function openIni(r, from, o = {}) {
355
358
  discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: () => { const x = O.rowOf(r.key) || r, b = VW.bodyOf(vidOf(x)); return (PW.on(b) ? PW.moreItems(null, popExtra(x), b) : []).concat(iniMore(x)); }, rename: O.rename ? O.rename(r) : null,
356
359
  // the kind of work (batch 29 item 11, KdV1-3): its glyph stands before Discuss; a tap opens the three kinds. A published copy
357
360
  // (pm/readonly.js) cannot change it, so it has no press: the Board's icon still names the kind
358
- presses: (window.PMOS_READONLY ? [] : [WK.pressOf(r.kind)]).concat(dashFor(r) ? dashFor(r).presses() : []), onPress: (a, b) => {
361
+ presses: (window.PMOS_READONLY ? [] : [WK.pressOf(r.kind)].concat(r.id ? [HUDDLE_PRESS] : [])).concat(dashFor(r) ? dashFor(r).presses() : []), onPress: (a, b) => {
359
362
  const x = O.rowOf(r.key) || r, h = dashFor(x);
363
+ if (a === 'huddle' && x.id) { HU.openHuddle({ VW, ws: where(x).ws, ini: x.id, title: x.title, toast: (t) => O.toast(t) }); return; }
360
364
  if (a === 'dash' && h) h.toggle();
361
365
  else if (a === 'kind' && x.id) WK.pick(b, x.kind, (to) => WK.change({ pmPost, ws: where(x).ws, id: x.id, from: x.kind, to, toast: (t, u) => O.toast(t, u),
362
366
  // the row shows the new kind at once (its icon, the Next words, the Experiment); the Board's read catches up in the background
363
- apply: (k) => { const y = O.rowOf(r.key) || x; y.kind = k; VW.setPresses(vidOf(y), [WK.pressOf(k)].concat(dashFor(y) ? dashFor(y).presses() : [])); if (O.redraw) O.redraw(); refresh(true); },
367
+ apply: (k) => { const y = O.rowOf(r.key) || x; y.kind = k; VW.setPresses(vidOf(y), [WK.pressOf(k)].concat(y.id ? [HUDDLE_PRESS] : []).concat(dashFor(y) ? dashFor(y).presses() : [])); if (O.redraw) O.redraw(); refresh(true); },
364
368
  reload: async () => { if (O.reload) await O.reload(); } }), !!((O.M() || {}).board || {}).factory);
365
369
  },
366
370
  render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null, vid: vidOf(x) }; O.onShow(x.key, from); body.innerHTML = iniBody(x, body); wire(body, x.key); { const h = dashFor(x); if (h) h.wire(body); } if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
@@ -189,7 +189,8 @@ export function headHtml(it) {
189
189
  const disc = o.discuss && !o.pop && (!o.home || o.discussHome) ? ib('discuss', 'Discuss in chat', P.chat) : ''; // in the popup the chat is beside it
190
190
  // a press marked menu (the initiative's Dashboard, batch 18 item 1) goes into ⋯ on a phone, so the title keeps the room
191
191
  // in the popup the work side's header is the title and ⋯ only (board 20): its quiet icon presses go into ⋯; a solid primary stays
192
- const toMenu = (x) => (phone && x.menu) || (o.pop && !x.solid);
192
+ // keep: a quiet press that stays in sight in the popup too (the Huddle, Wawan 2026-11-26: "huddle icon to start huddling, so the chat and huddle is slightly different")
193
+ const toMenu = (x) => (phone && x.menu) || (o.pop && !x.solid && !x.keep);
193
194
  const inMenu = (o.presses || []).some((x) => x && x.act && x.label && toMenu(x));
194
195
  const more = inMenu || typeof o.more === 'function' || (Array.isArray(o.more) && o.more.some((m) => m && !m.sep)) || o.url || linkOf(o) ? ib('more', 'More', P.more, ' aria-haspopup="menu" aria-expanded="false"') : '';
195
196
  const add = o.add && o.add.label && !phone ? ib('add', o.add.label, P.add) : '';
@@ -19,3 +19,5 @@
19
19
  .hu-add { display: flex; gap: 8px; }
20
20
  .hu-add label { align-self: center; }
21
21
  .hu-add input { flex: 1; height: 36px; border: 1px solid var(--cz-hair); border-radius: 6px; padding: 0 10px; font: inherit; background: var(--cz-card); color: var(--cz-ink); }
22
+ .hu-angle { border-style: dashed; background: var(--cz-well); }
23
+ .hu-said { margin: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@@ -9,11 +9,14 @@
9
9
  import { pmGet, pmPost } from './http.js';
10
10
  import { undoToast } from './hi-pop.js';
11
11
  import { noteUse } from './use-log.js';
12
+ import { canDictate, dictate } from './home-dictate.js'; // the browser's own speech to text: nothing is recorded as audio (slice 2)
12
13
 
13
14
  const escDefault = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
14
- const ICON = { check: 'M5 12l5 5 9-10', undo: 'M4 12a8 8 0 1 0 3-6.2M4 4v4h4', dot: 'M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8z', plus: 'M12 5v14M5 12h14' };
15
+ const ICON = { check: 'M5 12l5 5 9-10', undo: 'M4 12a8 8 0 1 0 3-6.2M4 4v4h4', dot: 'M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8z', plus: 'M12 5v14M5 12h14', mic: 'M9 6a3 3 0 0 1 6 0v5a3 3 0 0 1-6 0zM5 11a7 7 0 0 0 14 0M12 18v3', x: 'M6 6l12 12M18 6L6 18' };
15
16
  const svg = (d) => '<svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="' + d + '"/></svg>';
16
- const KIND = { decision: 'Decision', task: 'Task' };
17
+ const KIND = { decision: 'Decision', task: 'Task', doc: 'Doc', slides: 'Slides', report: 'Report', design: 'Design' }; // slice 3: Doc, Slides, Report (an outline now, the draft later), Design (a live round)
18
+ /** The Huddle's icon: three people around one table, on the 24 px grid. The initiative header shows it beside the chat. */
19
+ export const HUDDLE_ICON = 'M10 6a2 2 0 1 0 4 0a2 2 0 1 0-4 0M3 10a2 2 0 1 0 4 0a2 2 0 1 0-4 0M17 10a2 2 0 1 0 4 0a2 2 0 1 0-4 0M8 18a4 4 0 0 1 8 0M2 19a3 3 0 0 1 6-1M16 18a3 3 0 0 1 6 1';
17
20
 
18
21
  function ensureCss() {
19
22
  if (typeof document === 'undefined') return;
@@ -22,25 +25,31 @@ function ensureCss() {
22
25
  }
23
26
 
24
27
  /** The page. PURE. */
25
- export function pageHtml(h, { esc = escDefault } = {}) {
28
+ export function pageHtml(h, { esc = escDefault, mic = false, listening = false } = {}) {
26
29
  if (!h) return '<div class="hu"><p class="hu-meta">No Huddle yet.</p></div>';
27
30
  const facts = (h.facts || []).map((f) => '<li>' + esc(f.text) + ' <span class="hu-meta">' + esc(f.source) + '</span></li>').join('');
28
31
  const most = Math.max(0, ...(h.ideas || []).map((i) => i.dots));
29
32
  const cards = (h.ideas || []).map((i) => {
30
- const made = (i.made || []).map((m) => '<span class="hu-tag">' + svg(ICON.check) + esc(KIND[m.kind]) + '</span><button type="button" class="hu-btn" data-hu-unmake="' + esc(m.mid) + '" aria-label="Undo the ' + esc(KIND[m.kind].toLowerCase()) + '" title="Undo">' + svg(ICON.undo) + '</button>').join('');
33
+ const made = (i.made || []).map((m) => '<span class="hu-tag"' + (m.out && m.out.file ? ' title="' + esc(m.out.file) + '"' : '') + '>' + svg(ICON.check) + esc(m.state || KIND[m.kind]) + '</span><button type="button" class="hu-btn" data-hu-unmake="' + esc(m.mid) + '" aria-label="Undo the ' + esc(KIND[m.kind].toLowerCase()) + '" title="Undo">' + svg(ICON.undo) + '</button>').join('');
31
34
  const can = Object.keys(KIND).filter((k) => !(i.made || []).some((m) => m.kind === k));
32
35
  const make = i.dots ? can.map((k) => '<button type="button" class="hu-btn" data-hu-make="' + k + '" data-hu-cid="' + esc(i.cid) + '">' + KIND[k] + '</button>').join('') : '';
33
- return '<article class="hu-card' + (most && i.dots === most ? ' top' : '') + '"><p>' + esc(i.text) + '</p><div class="hu-row">'
36
+ const said = i.said && i.said !== i.text ? '<p class="hu-meta hu-said" title="' + esc(i.said) + '">As said: ' + esc(i.said) + '</p>' : '';
37
+ const from = i.aid ? '<p class="hu-meta">Added by PMOS from the records</p>' : '';
38
+ return '<article class="hu-card' + (most && i.dots === most ? ' top' : '') + '"><p>' + esc(i.text) + '</p>' + said + from + '<div class="hu-row">'
34
39
  + '<button type="button" class="hu-btn" data-hu-dot="' + esc(i.cid) + '" aria-pressed="' + (i.mine ? 'true' : 'false') + '" aria-label="Dot, ' + i.dots + ' so far" title="Dot">' + svg(ICON.dot) + i.dots + '</button>'
35
40
  + '<span class="hu-sp"></span>' + make + made + '</div></article>';
36
41
  }).join('');
37
- const n = (h.made || []).length;
42
+ const angles = (h.shownAngles || []).map((a) => '<article class="hu-card hu-angle"><p>' + esc(a.text) + '</p><p class="hu-meta">Missing angle · ' + esc(a.source) + '</p><div class="hu-row"><span class="hu-sp"></span>'
43
+ + '<button type="button" class="hu-btn" data-hu-angle="' + esc(a.aid) + '" aria-label="Add it as a card" title="Add it as a card">' + svg(ICON.plus) + '</button>'
44
+ + '<button type="button" class="hu-btn" data-hu-adrop="' + esc(a.aid) + '" aria-label="Not this one" title="Not this one">' + svg(ICON.x) + '</button></div></article>').join('');
45
+ const n = (h.made || []).length, calls = h.calls || 0;
38
46
  return '<div class="hu">'
39
47
  + '<section class="hu-sec" aria-label="The question"><p class="hu-q">' + esc(h.question) + '</p>' + (facts ? '<ul class="hu-meta hu-facts">' + facts + '</ul>' : '') + '</section>'
40
48
  + '<section class="hu-sec" aria-label="Ideas"><div class="hu-row"><h3>Ideas</h3><span class="hu-meta">type one, then put your dots · a card with a dot can become a decision or a task</span></div>'
41
- + (cards ? '<div class="hu-cards">' + cards + '</div>' : '')
42
- + '<form class="hu-add" data-hu-add><label class="hu-meta" for="huIdea">Idea</label><input id="huIdea" name="idea" maxlength="200" autocomplete="off"><button type="submit" class="hu-btn" aria-label="Add the idea" title="Add">' + svg(ICON.plus) + '</button></form></section>'
49
+ + (cards || angles ? '<div class="hu-cards">' + cards + angles + '</div>' : '')
50
+ + '<form class="hu-add" data-hu-add><label class="hu-meta" for="huIdea">Idea</label><input id="huIdea" name="idea" maxlength="600" autocomplete="off">' + (mic ? '<button type="button" class="hu-btn" data-hu-mic aria-pressed="' + (listening ? 'true' : 'false') + '" aria-label="' + (listening ? 'Stop and add what was said' : 'Say the idea') + '" title="' + (listening ? 'Stop' : 'Say the idea') + '">' + svg(ICON.mic) + '</button>' : '') + '<button type="submit" class="hu-btn" aria-label="Add the idea" title="Add">' + svg(ICON.plus) + '</button></form></section>'
43
51
  + (n ? '<p class="hu-meta">This Huddle made ' + n + ' ' + (n === 1 ? 'output' : 'outputs') + '. Nothing was sent outside PMOS.</p>' : '')
52
+ + (calls ? '<p class="hu-meta">PMOS made ' + calls + ' small ' + (calls === 1 ? 'call' : 'calls') + ' to turn spoken ideas into cards.</p>' : '')
44
53
  + '</div>';
45
54
  }
46
55
 
@@ -63,22 +72,36 @@ export async function openHuddle({ VW, ws, ini, title = '', toast = () => {} } =
63
72
  VW.drill();
64
73
  VW.open({ kind: 'Huddle', title: 'Huddle · ' + (title || h.title), icon: 'spark', id: 'huddle:' + h.hid, back: true,
65
74
  render: (b) => {
66
- const draw = () => { b.innerHTML = pageHtml(h); const f = b.querySelector('#huIdea'); if (f) f.focus(); };
75
+ let rec = null, spoken = false;
76
+ const draw = () => { b.innerHTML = pageHtml(h, { mic: canDictate(), listening: !!rec }); const f = b.querySelector('#huIdea'); if (f) f.focus(); };
77
+ const sendIdea = async (text, said) => { if (!text) return; if (await post('idea', { text, said })) { if (said) noteUse('huddleSaid'); draw(); } };
67
78
  draw();
68
79
  b.onsubmit = async (e) => {
69
80
  const f = e.target.closest('[data-hu-add]'); if (!f) return;
70
81
  e.preventDefault();
71
82
  const text = (f.idea.value || '').trim(); if (!text) return;
72
- if (await post('idea', { text })) draw();
83
+ if (rec) { rec.stop(); rec = null; }
84
+ const said = spoken; spoken = false;
85
+ await sendIdea(text, said);
73
86
  };
74
87
  b.onclick = async (e) => {
75
88
  const t = e.target.closest('button'); if (!t || t.type === 'submit') return;
76
89
  const d = t.dataset;
77
90
  if (d.huDot) { if (await post('dot', { cid: d.huDot })) draw(); return; }
91
+ if (t.hasAttribute('data-hu-mic')) {
92
+ if (rec) { rec.stop(); rec = null; const f = b.querySelector('#huIdea'), text = ((f && f.value) || '').trim(); spoken = false; await sendIdea(text, true); return; }
93
+ spoken = true;
94
+ rec = dictate(() => b.querySelector('#huIdea'), { onState: (st) => { if (st.error) { toast(st.error); rec = null; spoken = false; } } });
95
+ const m = b.querySelector('[data-hu-mic]'); if (m) { m.setAttribute('aria-pressed', 'true'); m.setAttribute('aria-label', 'Stop and add what was said'); m.title = 'Stop'; }
96
+ return;
97
+ }
98
+ if (d.huAngle) { if (await post('idea', { text: ((h.angles || []).find((a) => a.aid === d.huAngle) || {}).text || '', aid: d.huAngle })) draw(); return; }
99
+ if (d.huAdrop) { if (await post('angle-drop', { aid: d.huAdrop })) draw(); return; }
78
100
  if (d.huMake) {
79
101
  t.disabled = true;
102
+ if (/^(doc|slides|report)$/.test(d.huMake)) t.textContent = 'Outlining…';
80
103
  const r = await post('make', { cid: d.huCid, kind: d.huMake });
81
- if (!r) { t.disabled = false; return; }
104
+ if (!r) { t.disabled = false; t.textContent = KIND[d.huMake]; return; }
82
105
  noteUse('huddleMake'); draw();
83
106
  undoToast(KIND[d.huMake] + ' made.', async () => { if (await post('unmake', { mid: r.mid })) draw(); });
84
107
  return;
@@ -32,7 +32,8 @@
32
32
  * 11 the stage whose output is Jira tickets (Build; a workflow's own Jira stage): the open tickets are its section, by epic, with "N of M done
33
33
  * in Jira" and how fresh (batch 20 item 3: by the output, never by the name build or deliver).
34
34
  * 12 over the plan: the dates line turns amber with the days over; a skipped stage keeps its place, with its reason.
35
- * 18 each section carries its dates: done stages when they ran, now from when to the plan end, later ones "Plan <date>", amber when missed.
35
+ * 18 each section carries its dates: its tasks' earliest start to their latest end (Wawan, 2026-11-26); a stage with no dated task falls back
36
+ * to when it ran (done) or from when to the plan end (now); later ones "Plan <date>", amber when missed.
36
37
  * 19 a big section shows the 3 most urgent first, then folds the rest by the next WBS level, each with its count; done folds last. */
37
38
  import { ticketGroups } from './tk-model.js';
38
39
  import { isTime, withTime } from './day-time.js'; // a task's optional time on its start and due (task-time-optional) // the drafted Jira tickets by epic (kit 2, T1): By epic's groups
@@ -298,12 +299,15 @@ export function iniView(r, ctx = {}) {
298
299
  const sections = [];
299
300
  const secOf = (s, i) => rows.filter((x) => x.sec === s.key);
300
301
  const planOf = (rs) => { const ds = rs.map((x) => x.end).filter(Boolean).sort(); return ds.length ? ds[ds.length - 1] : ''; };
302
+ // a stage's dates are its tasks' days: the earliest start (or due) to the latest due (or start); Won't do counts for nothing
303
+ const daysOf = (rs) => { const d = rs.filter((x) => !x.wont), a = d.map((x) => x.start || x.end).filter(Boolean).sort(), b = d.map((x) => x.end || x.start).filter(Boolean).sort(); return [a[0] ? String(a[0]).slice(0, 10) : '', b.length ? String(b[b.length - 1]).slice(0, 10) : '']; };
301
304
  const headOf = (rs) => { const tops = [...new Set(rs.map((x) => x.wbs && x.wbs.top).filter(Boolean))]; if (tops.length !== 1) return ''; const h = rs.find((x) => x.wbs && x.wbs.head && x.wbs.top === tops[0]); return h ? h.title : ''; };
302
305
  const one = (s, i, why) => {
303
306
  const rs = secOf(s, i), op = rs.filter((x) => !x.closed), lt = op.filter((x) => x.late), dn = rs.length - op.length;
304
307
  let sub = '', subWarn = false;
305
- if (s.status === 'now') sub = 'Now' + (ran[i].from || r.end ? ' · ' + (ran[i].from && r.end ? span(ran[i].from, String(r.end).slice(0, 10), today) : ran[i].from ? 'since ' + dateY(ran[i].from, today) : 'to ' + dateY(r.end, today)) : '');
306
- else if (s.status === 'done' || s.status === 'skip') sub = s.status === 'skip' ? 'Skipped' + (s.why ? ': ' + s.why : '') : span(ran[i].from, ran[i].to, today);
308
+ const [ta, tb] = daysOf(rs), from = ta || ran[i].from, to = tb || (r.end ? String(r.end).slice(0, 10) : '');
309
+ if (s.status === 'now') sub = 'Now' + (from || to ? ' · ' + (from && to ? span(from, to, today) : from ? 'since ' + dateY(from, today) : 'to ' + dateY(to, today)) : '');
310
+ else if (s.status === 'done' || s.status === 'skip') sub = s.status === 'skip' ? 'Skipped' + (s.why ? ': ' + s.why : '') : span(ta || ran[i].from, tb || ran[i].to, today);
307
311
  else { const p = planOf(rs); if (p) { sub = 'Plan ' + dateY(p, today); if (dayOf(p) < today && op.length) { sub += ', missed'; subWarn = true; } } }
308
312
  const h = headOf(rs); if (h) sub = [sub, h].filter(Boolean).join(' · ');
309
313
  return { kind: 'stage', key: s.key, n: i + 1, name: s.name, ms: s.ms, status: s.status, sub, subWarn, count: countOf(op.length, lt.length, dn), warn: lt.length > 0, openN: op.length,
@@ -393,14 +393,15 @@ export function breakdownOf(r, v, o = {}) {
393
393
  const leaves = (x) => { const nd = TR.node(x); return nd && nd.kids.length ? WT.rollup(nd) : { n: 1, nDone: x.closed ? 1 : 0 }; };
394
394
  const nDone = all.reduce((k, x) => k + leaves(x).nDone, 0), n = all.reduce((k, x) => k + leaves(x).n, 0);
395
395
  const deep = all.concat(...all.map((x) => WT.under(TR.node(x))));
396
- const [ta, tb] = taskSpan(all);
396
+ const [ta, tb] = taskSpan(all.filter((x) => !x.wont));
397
397
  const rn = ran[i] || {};
398
398
  let a = '', b = '';
399
- // a stage's bar runs from its tasks' earliest start to their latest end (a task with no start counts from its due date). Wawan,
400
- // 2026-11-20: "just apply the start and end date" — the recorded stage moves are when someone pressed through the workflow, not when
401
- // the work ran, so they are used only for a stage with no dated task
399
+ // a stage's dates run from its tasks' earliest start to their latest end (a task with no start counts from its due date; Won't do
400
+ // counts for nothing). Wawan, 2026-11-20: "just apply the start and end date", and 2026-11-26: the stage in progress too, not the
401
+ // plan end. The recorded stage moves and the plan end are when someone pressed through the workflow, not when the work ran, so they
402
+ // are used only for a stage with no dated task
402
403
  if (s.status === 'done') { a = ta || isoOf(rn.from); b = tb || isoOf(rn.to); }
403
- else if (s.status === 'now') { const pv = ran.slice(0, i).reverse().find((q) => q.to || q.from) || {}; a = ta || isoOf(rn.from) || isoOf(pv.to) || isoOf(pv.from); b = isoOf(r.end) || tb; } // no dated task: since the last date the record holds before it // the stage in progress runs to the plan end: late is said against the plan
404
+ else if (s.status === 'now') { const pv = ran.slice(0, i).reverse().find((q) => q.to || q.from) || {}; a = ta || isoOf(rn.from) || isoOf(pv.to) || isoOf(pv.from); b = tb || isoOf(r.end); } // no dated task: since the last date the record holds before it, to the plan end
404
405
  else if (s.status !== 'skip') { a = ta; b = tb; }
405
406
  if (a && b && b < a) b = a;
406
407
  const live = s.status === 'now' && r.status !== 'done' && !r.ended;
@@ -122,6 +122,8 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
122
122
  await Promise.all([p.waitForURL(/\/today\.html\?/, { timeout: 15000 }).catch(() => null), p.click('#czViewer .cz-vw-sv')]);
123
123
  p.off('framenavigated', onNav);
124
124
  const u = new URL(navs.find((x) => /\/today\.html\?/.test(x)) || p.url());
125
+ // leave Today: its live reads (unmocked) keep the test server busy, and on a loaded runner the next page's load then waits past 30 s
126
+ await p.goto('about:blank');
125
127
  ok('I with the Jira box ticked, Today opens the initiative\'s chat with the request typed, not sent', u.pathname === '/today.html' && u.searchParams.get('about') === 'init:descope-parity'
126
128
  && u.searchParams.get('say') === 'Rename the Jira epic IDPF-12 to "Descope parity".', u.href);
127
129
  ok('I a row with no Jira epic has no Jira box', await (async () => {
@@ -3186,6 +3186,14 @@ const impactRuns = require('./lib/impact-runs.js').create({
3186
3186
  warn: (what, e) => warnWriteFail(what, e),
3187
3187
  });
3188
3188
  const impactTick = () => { try { impactRuns.tick({}); } catch (e) { warnWriteFail('impact tick', e); } };
3189
+ // huddle-brainstorm slice 3: the full drafts of a Huddle's Doc, Slides and Report outlines, one per tick when deep work may run
3190
+ const huddleDrafts = require('./lib/huddle-drafts.js').create({
3191
+ workspaces: () => [...workspaces.values()],
3192
+ stateDir: (w) => require('./lib/routes-capture.js').captureStateDir({ consoleState }, w.root),
3193
+ open: deepOpenNow,
3194
+ ask: (prompt, key) => require('./lib/routes-huddle.js').viaSession({ spawnSession: (spec) => orchSpawn.spawn(spec) }, prompt, key, { job: 'huddle-draft', name: 'huddle: draft an outline', timeoutMs: 10 * 60000 }),
3195
+ warn: (what, e) => warnWriteFail(what, e),
3196
+ });
3189
3197
  // loop-telemetry: the verifier after merge (Wawan, 2026-11-08: "Run the verifier on merged PRs"). One fresh headless evaluator at a time grades
3190
3198
  // the newest merged run that owes a verdict in an open PMOS checkout (lib/verify-runs.js); its only write is `node scripts/verifier.js record`,
3191
3199
  // pinned to that run. It also marks merged work items integrated (scripts/verify-work.js, no model). Nothing gates a merge.
@@ -3448,6 +3456,7 @@ bgQueue.register('propose', gated('propose', proposalTick));
3448
3456
  bgQueue.register('grill', () => grillTick());
3449
3457
  bgQueue.register('metric-drafts', () => metricDraftTick());
3450
3458
  bgQueue.register('impact', () => impactTick());
3459
+ bgQueue.register('huddle-drafts', () => { huddleDrafts.tick().catch((e) => warnWriteFail('huddle draft tick', e)); });
3451
3460
  bgQueue.register('verify', () => verifyTick());
3452
3461
  bgQueue.register('improve', () => improveTick());
3453
3462
  bgQueue.register('metric-reads', () => metricReadTick());