create-pmos 0.403.0 → 0.405.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.403.0",
3
+ "version": "0.405.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -32,6 +32,30 @@
32
32
  "audit"
33
33
  ],
34
34
  "pmosChanges": [
35
+ {
36
+ "v": "0.405.0",
37
+ "at": "2026-10-24T09:32:24.061Z",
38
+ "f": 2,
39
+ "prs": [
40
+ {
41
+ "n": 1035,
42
+ "t": "Home session list, program chat, and new initiative sessions",
43
+ "s": "Home session list, program chat, and new initiative sessions"
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "v": "0.404.0",
49
+ "at": "2026-10-24T05:07:12.902Z",
50
+ "f": 2,
51
+ "prs": [
52
+ {
53
+ "n": 1034,
54
+ "t": "Chat names the real program press; add Turn into a program to the initiative ⋯",
55
+ "s": "Chat names the real program press; add Turn into a program to the initiative ⋯"
56
+ }
57
+ ]
58
+ },
35
59
  {
36
60
  "v": "0.403.0",
37
61
  "at": "2026-10-24T03:40:15.576Z",
@@ -262,35 +286,6 @@
262
286
  "s": "Board measure popup reads its numbers and the trunk fetch time"
263
287
  }
264
288
  ]
265
- },
266
- {
267
- "v": "0.385.0",
268
- "at": "2026-10-21T14:04:22.922Z",
269
- "f": 2,
270
- "prs": [
271
- {
272
- "n": 996,
273
- "t": "A task's Jira ticket from the stored reads, with Read it now",
274
- "s": "A task's Jira ticket from the stored reads, with Read it now"
275
- }
276
- ]
277
- },
278
- {
279
- "v": "0.384.0",
280
- "at": "2026-10-21T13:39:28.616Z",
281
- "f": 2,
282
- "prs": [
283
- {
284
- "n": 993,
285
- "t": "A Work item from the brief opens on its source",
286
- "s": "A Work item from the brief opens on its source"
287
- },
288
- {
289
- "n": 995,
290
- "t": "Claude's stored lead shows first in a popup, with Refresh",
291
- "s": "Claude's stored lead shows first in a popup, with Refresh"
292
- }
293
- ]
294
289
  }
295
290
  ]
296
291
  }
package/payload/AGENTS.md CHANGED
@@ -48,6 +48,8 @@ It refuses frontmatter, fenced and indented code, table rows, headings, delibera
48
48
  | `log_friction` / `log_discovery` | append to `pmos/state/discoveries.md` (ISO date, `#friction` tag where applicable) |
49
49
  | `get_agent_runs` / `get_friction` | read those same files (your episodic memory — consult before contracting) |
50
50
 
51
+ **Programs** (the level above initiatives, across products) are not an initiative key. A program is a line in `pmos/state/programs.jsonl`: `{"kind":"program",…}` is the charter and `{"kind":"member","program":"<id>","initiative":"<id>"}` puts an initiative in it. Never add `kind`, `program`, `programme`, `parent_program` or `parent_programme` to an initiative record: nothing reads them. You do not write `programs.jsonl`: the PM makes a program on the Board (an initiative's ⋯ → **Turn into a program**, or + → **New program**).
52
+
51
53
  State files are **append-only**: never rewrite or delete an existing line or initiative record; correct by appending. When a vendored skill names a hosted tool, apply this table — the skill bodies are single-sourced from the PMOS kernel and are not forked for file mode.
52
54
 
53
55
  ## Work-type lanes (D56)
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@1a2052c2
1
+ kernel-source: pmos@cf53bf2f
2
2
  assembled: 2026-10-24
3
3
  mode: vendor
@@ -18,7 +18,7 @@ export const PRODUCT_STEPS = ['route', 'anchor', 'prototype', 'understand', 'spe
18
18
  export const PM_ARTIFACT_STEPS = ['route', 'brief', 'draft', 'review', 'approved', 'handoff'];
19
19
  export const KNOWN_STEPS = new Set([...PRODUCT_STEPS, ...PM_ARTIFACT_STEPS]);
20
20
  export const STEP_STATUSES = ['done', 'na', 'unknown', 'pending', 'blocked'];
21
- export const STAGES = ['intake', 'spec', 'contract', 'build', 'eval', 'accepted', 'brief', 'draft', 'review'];
21
+ export const STAGES = ['intake', 'spec', 'contract', 'build', 'eval', 'accepted', 'brief', 'draft', 'review', 'handoff'];
22
22
  export const LANES = ['feature', 'discovery', 'chore', 'incident', 'content', 'prototype'];
23
23
  export const PROFILES = ['product-code', 'pm-artifacts'];
24
24
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-10-24T03:40:12Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-24T09:32:21Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-10-24T03:40:12Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-24T09:32:21Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-10-24T03:40:12Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-24T09:32:21Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -223,5 +223,31 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
223
223
  ok('Z on a phone the program is a head card with its next milestone, and nothing scrolls sideways', await R.page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1 && !!document.querySelector('#ibBody .bt-pg .bd-pm') && getComputedStyle(document.querySelector('#ibBody .bt-pg .bt-spread')).display === 'none'));
224
224
  await R.ctx.close();
225
225
  }
226
+
227
+ /* P7 Turn into a program: the initiative's ⋯ offers it when the initiative is in no program, presses POST /api/programs/turn and opens
228
+ * the new program (bug 2026-10-24: the press was never on the page, so "Set Project Ascent as Program" had nowhere to go) */
229
+ {
230
+ const { ctx, page: p, errors } = await open({ programs: [] });
231
+ let sent = null;
232
+ await p.route('**/api/programs/turn', (r) => { sent = JSON.parse(r.request().postData() || '{}'); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, program: { id: 'legacy-idp-sunset' } }) }); });
233
+ const menu = async () => { await p.click('#czViewer [data-cz-vw="more"]'); await p.waitForTimeout(80); return p.evaluate(() => [...document.querySelectorAll('.cz-vw-menu [role="menuitem"]')].map((b) => b.textContent.trim())); };
234
+ await p.click('#ibBody .bt-nm >> text=Legacy IdP sunset');
235
+ await p.waitForSelector('#czViewer:not([hidden])');
236
+ const m = await menu();
237
+ ok('P7 an initiative in no program: ⋯ offers Turn into a program, after the plan dates', m.indexOf('Turn into a program') === m.indexOf('Change the plan dates') + 1, JSON.stringify(m));
238
+ await p.click('.cz-vw-menu [role="menuitem"] >> text=Turn into a program');
239
+ await p.waitForTimeout(400);
240
+ const ev = await events(p);
241
+ ok('P7 the press sends the initiative and its title, then opens the new program', sent && sent.initiative && sent.title === 'Legacy IdP sunset' && ev.includes('legacy-idp-sunset'), JSON.stringify({ sent, ev }));
242
+ ok('P7 the page threw nothing', !errors.length, errors.join('\n'));
243
+ await ctx.close();
244
+ const R = await open();
245
+ await R.page.click('#ibBody .bt-kid .bt-nm >> text=Legacy IdP sunset');
246
+ await R.page.waitForSelector('#czViewer:not([hidden])');
247
+ await R.page.click('#czViewer [data-cz-vw="more"]'); await R.page.waitForTimeout(80);
248
+ const m2 = await R.page.evaluate(() => [...document.querySelectorAll('.cz-vw-menu [role="menuitem"]')].map((b) => b.textContent.trim()));
249
+ ok('P7 an initiative that is in a program has no Turn into a program', m2.length > 0 && !m2.includes('Turn into a program'), JSON.stringify(m2));
250
+ await R.ctx.close();
251
+ }
226
252
  finish();
227
253
  })();
@@ -1,4 +1,28 @@
1
1
  [
2
+ {
3
+ "v": "0.405.0",
4
+ "at": "2026-10-24T09:32:24.061Z",
5
+ "f": 2,
6
+ "prs": [
7
+ {
8
+ "n": 1035,
9
+ "t": "Home session list, program chat, and new initiative sessions",
10
+ "s": "Home session list, program chat, and new initiative sessions"
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ "v": "0.404.0",
16
+ "at": "2026-10-24T05:07:12.902Z",
17
+ "f": 2,
18
+ "prs": [
19
+ {
20
+ "n": 1034,
21
+ "t": "Chat names the real program press; add Turn into a program to the initiative ⋯",
22
+ "s": "Chat names the real program press; add Turn into a program to the initiative ⋯"
23
+ }
24
+ ]
25
+ },
2
26
  {
3
27
  "v": "0.403.0",
4
28
  "at": "2026-10-24T03:40:15.576Z",
@@ -21,7 +21,7 @@ Home is the page at `/premium.html`. It follows the Agreed design and the "Uncov
21
21
  - Every group stays open or closed after you reload the page.
22
22
  - On a desktop, the chat has a header line with the open item's name and where it sits (its initiative, product or program).
23
23
  - The microphone in the chat box turns what you say into text. Nothing is sent until you press send.
24
- - A link can open Home at one item: `?item=pt:<program>:<key>` selects a program task, and `?ask=program:<id>` opens the chat about that program.
24
+ - A link can open Home at one item: `?item=pt:<program>:<key>` selects a program task, and `?ask=program:<id>` opens the chat about that program. **Discuss in chat** on a program in the Board opens the same program chat. **New session** on an initiative starts a new chat about that initiative.
25
25
 
26
26
  ## An initiative
27
27
 
@@ -62,7 +62,7 @@ There is no My work page. The list on Home is your list:
62
62
  - **Tasks.** An initiative shows its 3 most urgent tasks: yours first, then due today, late, and due this week. **Show N more tasks** shows the rest.
63
63
  - **Your items.** A PM item opens alone, as its own card. There is no Focus chip. Items that nobody touched are in the Weekly review.
64
64
  - **Add a task.** Press **New**, then **A task**, then choose the initiative, or **Not in an initiative**. Home has no add box that is always open.
65
- - **Sessions.** A session row names its agent. The coloured dot beside it is its state: blue waits on you, amber may be blocked, green is running. A session PMOS started itself (a skill or a background job) shows on Home only while it works or asks you something. Once it finishes its prompt, it leaves the list.
65
+ - **Sessions.** A session row names its agent. The coloured dot beside it is its state: blue waits on you, amber may be blocked, green is running. A session PMOS started itself (a skill or a background job) shows on Home only while it works or asks you something. Once it finishes its prompt, it leaves the list. On an initiative's page, a session that waits on you shows once, under **Needs you**, not again under **Sessions**. **Finished sessions** does not list an old run of a chat that is open again.
66
66
  - **One chat box.** Every conversation has the same box: **+** (attach a file, notes, the terminal, and **Link to an initiative** for a loose chat), **/** for commands, **@** inside an initiative, the To or In chip, the mic, and Send. A chat opens at its newest message.
67
67
  - **Documents not written yet.** A document that does not exist yet shows **Draft it**, in its stage or ahead of it. The agent writes a draft. Nothing is issued until you read it.
68
68
  - **Meeting notes.** A decision, to-do or question that the notes caught is not a fact until you confirm it in the meeting's Replay. Home, End of the day and the evening recap do not count unconfirmed points.
@@ -20,6 +20,8 @@ Programs do not change how Insights, the weekly update or sprints count initiati
20
20
  - The **timeline** draws a program row that brackets its initiatives' bars, on every span. Program milestones are diamonds. Milestones that are close together merge into one diamond with a count.
21
21
  - **List** has a Product column and a Program column. Press a column header to sort by it.
22
22
  - **New** opens a menu: **New initiative** or **New program**.
23
+ - To make an initiative a program, open the initiative, press **⋯**, then **Turn into a program**. The initiative joins the new program, and the program panel opens. **Turn into a program** shows only for an initiative that is in no program.
24
+ - The chat cannot make or change a program. Every program change is a press on the Board. When you ask the chat about a program, it tells you which press to use.
23
25
 
24
26
  ## The program panel
25
27
 
@@ -16,6 +16,7 @@ const crypto = require('crypto');
16
16
  const headless = require('./headless.js');
17
17
  const Goal = require('./goal-chat.js');
18
18
  const ReportChat = require('./report-chat.js');
19
+ const ProgramChat = require('./program-chat.js');
19
20
 
20
21
  const THREADS = 'briefing-premium-threads.jsonl';
21
22
  const KEY_RE = /^(decision|blocked|waited|src|ev|work|board|init|doc|ins|chat|pop):[A-Za-z0-9][A-Za-z0-9._:-]{0,100}$/; // chat: the PM's own chat on the Chat page (premium-chat-page); pop: a popup with no row of its own (premium-popup-context P1)
@@ -59,7 +60,9 @@ function rowFor(model, key, context) {
59
60
  return { title: key === 'work:this-page' ? 'The My work page' : 'The Briefing page', subject: clip(model.header && model.header.text, 240), say: clip(say, 600), facts: rows.slice(0, 12).map((r) => clip(r.kind || r.list || 'item', 40) + ': ' + clip(r.title, 240)), files: [] };
60
61
  }
61
62
  if (/^(work|board|init|doc|ins):/.test(key)) { // a My work item, a Board initiative, an Insights measure, an initiative page or one of its documents: the item's own record is the context
62
- const w = (model.rows || []).find((r) => r.key === key); if (!w) return null;
63
+ // a second session on an initiative (Home's New session: init:<id>:<n>) reads the initiative's own row
64
+ const base = /^init:[^:]+:/.test(key) ? key.replace(/^(init:[^:]+):.*$/, '$1') : key;
65
+ const w = (model.rows || []).find((r) => r.key === key) || (base !== key ? (model.rows || []).find((r) => r.key === base) : null); if (!w) return null;
63
66
  const d = w.dialog || {};
64
67
  return { title: clip(w.title, 160), subject: clip(w.sub, 240), say: clip(d.say, 600), facts: (d.facts || []).slice(0, 12).map(([a, b]) => clip(a, 40) + ': ' + clip(b, 240)), files: (d.files || []).filter((f) => SAFE_PATH.test(f) && !f.includes('..')).slice(0, 4) };
65
68
  }
@@ -94,6 +97,15 @@ function popRow(c) {
94
97
  return { title: str(c.title, 160), subject: str(c.subject, 240), say: str(c.say, 600), facts, files };
95
98
  }
96
99
 
100
+ /** The opening's row of an initiative's chat when the page model holds no row for it (bug 2026-10-24: Home's New session on an
101
+ * initiative other than the one the initiative model last read). The chat is the PM's own Claude Code session, so it starts with
102
+ * the initiative's id and what the page sent instead of refusing. A row of another kind that is not on the page is still refused. */
103
+ function contextRow(key, context) {
104
+ const say = typeof context === 'string' ? clip(context, 600) : '';
105
+ const id = String(key).replace(/^[a-z]+:/, '').replace(/:\d+$/, '');
106
+ return { title: clip(id, 160), subject: '', say, facts: [], files: [] };
107
+ }
108
+
97
109
  function promptFor(row, turns, question) {
98
110
  const prior = turns.filter((t) => t.state === 'answered').slice(-PROMPT_TURNS);
99
111
  return [
@@ -188,7 +200,7 @@ function chat({ runtimeDir, key, text, model, context, sessions, wsId, now = new
188
200
  // slice 4 (PRD L2): an ended chat resumes its own Claude Code conversation when the file for it is still there
189
201
  const prev = alive ? null : chatRecordOf(runtimeDir, key);
190
202
  const resume = !!(prev && prev.claude && typeof sessions.hasConversation === 'function' && sessions.hasConversation(prev.claude));
191
- const row = alive ? null : rowFor(model, key, context);
203
+ const row = alive ? null : rowFor(model, key, context) || (/^init:/.test(key) ? contextRow(key, context) : null);
192
204
  if (!alive && !row && !resume) return fail(404, /^pop:/.test(key) ? 'the popup did not say what it shows' : model ? 'that row is not on the page' : 'the page has not read the repository yet');
193
205
  // slice 2 (PRD G2): `/goal <text>` becomes the PMOS grilling prompt, on record before it reaches the session
194
206
  let msg = q, goal = null;
@@ -196,6 +208,8 @@ function chat({ runtimeDir, key, text, model, context, sessions, wsId, now = new
196
208
  if (cmd) { const b = Goal.begin({ runtimeDir, key, text: cmd.text, now }); if (b.error) return fail(400, b.error); msg = b.prompt; goal = b.id; }
197
209
  // premium-reports-from-chat R1: a message about a report, a chart or a dashboard carries the pmos-report rule (lib/report-chat.js)
198
210
  else if (ReportChat.isAsk(q)) msg = ReportChat.wrap(q);
211
+ // bug 2026-10-24: a message about a program carries the program rule (lib/program-chat.js), so the chat names the real press
212
+ else if (ProgramChat.isAsk(q)) msg = ProgramChat.wrap(q);
199
213
  const extra = goal ? { goal } : {};
200
214
  if (alive) {
201
215
  if (!sessions.type(live, msg)) return fail(409, 'The message did not reach the session. Open it in Sessions.');
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+ /* program-chat — what a chat knows about programs (bug 2026-10-24: "Set Project Ascent as Program" in Home chat).
3
+ * A program is the level above initiatives, across products (initiative program-hierarchy). It is a PMOS record in each workspace's
4
+ * <state>/programs.jsonl (lib/programs.js), not a key on an initiative record. Without this rule a chat looked for "a program marker", found
5
+ * none, and invented one (`kind: programme` in the initiative's front matter, children linked by `parent_programme`). Nothing reads those keys.
6
+ * When a message is about a program, the chat route types it into the session with this rule first, as lib/report-chat.js does for reports.
7
+ * Every program write is a page press (lib/routes-programs.js, pm-guard requirePagePress): the chat points the PM at the press and makes none. */
8
+
9
+ // The first line of every message PMOS wraps. The page reads it to show the PM's turn as typed (public/pm/goal-chat.js shownUser).
10
+ const MARK = '[PMOS program]';
11
+ const SAYS = 'The PM says: ';
12
+ // A message about a program (or programme). Other messages go to the session as typed.
13
+ const ASK_RE = /\bprogram(me)?s?\b/i;
14
+
15
+ const isAsk = (text) => ASK_RE.test(String(text == null ? '' : text)) && !String(text).trim().startsWith('/');
16
+
17
+ const RULE = [
18
+ 'PMOS has programs. A program is the level above initiatives (Program > Initiative > Epic) and can span products. It has no stages of its own: its state, products and stage spread come from its initiatives.',
19
+ 'A program is a record in programs.jsonl in a workspace state folder (pmos/state/ or the workspace state folder), one JSON line each: {"kind":"program",…} is the charter, {"kind":"member","program":"<id>","initiative":"<id>"} puts an initiative in it, and "leave", "task", "check" and "archive" lines follow the same pattern. A program id is its title in lower case with dashes, for example project-ascent.',
20
+ 'A program is NOT a key on an initiative. Never add kind, program, programme, parent_program or parent_programme to an initiative record or any front matter: nothing reads them.',
21
+ 'You never make, change, join, leave or archive a program yourself, and you never write programs.jsonl: the routes refuse an agent session, and the PM presses on the Board.',
22
+ 'Tell the PM which press does what they asked:',
23
+ '- An initiative becomes a program (for example "set X as a program"): on the Board, open the initiative, press ⋯, then Turn into a program. The initiative joins the new program, and the program panel opens with a card to sort its tasks.',
24
+ '- A new, empty program: on the Board, press + (New), then New program.',
25
+ '- To see a program: press its name on the Board, or open /premium-board.html?program=<id>.',
26
+ 'You can read programs.jsonl to answer a question about a program. If the PM asks you to sort a turned program\'s tasks into program, initiative or epic, propose a level for each task in a list and let the PM decide.',
27
+ ].join('\n');
28
+
29
+ /** The message as PMOS types it into the session: the rule, then the PM's words. */
30
+ function wrap(text) { return MARK + ' ' + RULE + '\n\n' + SAYS + String(text == null ? '' : text); }
31
+
32
+ module.exports = { MARK, isAsk, wrap, RULE };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.403.0",
3
+ "version": "0.405.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.403.0",
9
+ "version": "0.405.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.403.0",
3
+ "version": "0.405.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",
@@ -78,6 +78,14 @@ const json = (r, body, status = 200) => r.fulfill({ status, contentType: 'applic
78
78
  ok('D1 a kind Home has no key for is a chat key: about=chat:<id>', u.searchParams.get('about') === 'chat:ana', u.search);
79
79
  await sleep(2500); s = await state();
80
80
  ok('D4 a kind Home has no view for is the chat alone, named by its label', s.top === 'Ana Lim' && !s.vw, JSON.stringify(s));
81
+ // bug 2026-10-24: the Board's program panel Discuss named board:program:<id>, which Home sent as a Board row it does not have
82
+ // ("that row is not on the page"); it lands on the program's own conversation, the one its tasks open
83
+ await ctx.route(/\/api\/programs(\?.*)?$/, (r) => json(r, { ok: true, programs: [{ id: 'project-ascent', title: 'Project Ascent', members: [], tasks: [], milestones: [] }] }));
84
+ u = await discussFrom({ kind: 'Program', id: 'program:project-ascent', title: 'Project Ascent' });
85
+ ok('D6 a program\'s Discuss names it: about=board:program:<id>', u.searchParams.get('about') === 'board:program:project-ascent', u.search);
86
+ s = await until(async () => { const v = await page.evaluate(() => { const c = document.querySelector('[data-hm-scope]'); return { top: document.querySelector('#hmTopTitle').textContent, scope: c ? c.textContent.trim() : '' }; }); return /Project Ascent/.test(v.scope) ? v : null; }, 15000)
87
+ || await page.evaluate(() => ({ top: document.querySelector('#hmTopTitle').textContent, scope: ((document.querySelector('[data-hm-scope]') || {}).textContent || '').trim() }));
88
+ ok('D6 a program lands on its own conversation: the chat goes in the program, not All work', s.top === 'Project Ascent' && s.scope === 'In: Project Ascent', JSON.stringify(s));
81
89
  ok('D5 no page error', errors.length === 0, errors.join(' | '));
82
90
  finish();
83
91
  })();
@@ -4,7 +4,8 @@
4
4
  *
5
5
  * mount(o) once, from premium-board.js. o: { M() the model, statusOf(r), fmt(iso), md(date), ago(iso), segHtml(r), barHtml(o),
6
6
  * grill(id) the open first questions, dayTitle(track) the current step's tooltip, rowOf(key), pageHref(r), askHref(r, q), refreshJira(), send(r) the Send to Jira sheet, acts(r, btn) the row
7
- * actions popover, grillOpen(r, btn), onShow(key, from) / onHide() so the page marks the row the item came from }
7
+ * actions popover, grillOpen(r, btn), onShow(key, from) / onHide() so the page marks the row the item came from,
8
+ * programOf(r) the program it is in or null, turnProgram(r) "Turn into a program" (POST /api/programs/turn) }
8
9
  * openIni(r, from) the initiative: the shell's header (icon, the title once, Discuss in chat, ⋯, open wide, close), the summary card with
9
10
  * its one primary, the stage bar, then the folding rows: the current output, drafted tickets, Jira against the PRD,
10
11
  * linked, and dates and trend
@@ -125,6 +126,8 @@ function iniMore(r) {
125
126
  const more = [];
126
127
  if (r.acts) more.push({ label: 'Move, hold, cancel or archive', on: (b) => O.acts(r, b) });
127
128
  if (r.id) more.push({ label: 'Change the plan dates', on: () => location.assign(O.askHref(r, 'Propose new start and end dates for ' + r.title)) });
129
+ // P7 (program-hierarchy PRD): an initiative in no program can become one; the chat cannot, because every program write is a page press
130
+ if (r.id && O.turnProgram && !(O.programOf && O.programOf(r))) more.push({ label: 'Turn into a program', on: () => O.turnProgram(r) });
128
131
  if ((O.M() || {}).jira) more.push({ sep: true }, { label: 'Read Jira again', on: () => O.refreshJira() });
129
132
  more.push({ sep: true });
130
133
  if (r.id) more.push({ label: 'Copy link', on: () => copyText(new URL(O.pageHref(r), location.href).href, 'Link copied.') });
@@ -39,7 +39,7 @@ export function shownUser(text) {
39
39
  const g = t.indexOf(MARK.grill + ' The PM set a goal: ');
40
40
  if (g >= 0) return '/goal ' + t.slice(g + (MARK.grill + ' The PM set a goal: ').length).split('\n')[0];
41
41
  if (t.startsWith(OPENING)) { const i = t.lastIndexOf('\nThe PM says: '); if (i >= 0) return t.slice(i + '\nThe PM says: '.length); }
42
- if (t.startsWith('[PMOS report]')) { const i = t.lastIndexOf('\nThe PM says: '); if (i >= 0) return t.slice(i + '\nThe PM says: '.length); } // premium-reports-from-chat: lib/report-chat.js wrap
42
+ if (t.startsWith('[PMOS report]') || t.startsWith('[PMOS program]')) { const i = t.lastIndexOf('\nThe PM says: '); if (i >= 0) return t.slice(i + '\nThe PM says: '.length); } // premium-reports-from-chat: lib/report-chat.js wrap; lib/program-chat.js wrap
43
43
  return t;
44
44
  }
45
45
 
@@ -1313,6 +1313,8 @@ load().then(() => {
1313
1313
  else if (sid) { const s = S.D.sessions.find((x) => x.id === sid); if (s) { S.sel = 's:' + s.id; openTarget(sessionTarget(s)); drawList(); } else { openTarget(homeTarget()); toast('That session is not on this machine.'); } }
1314
1314
  else if (/^program:[A-Za-z0-9][A-Za-z0-9._-]{0,100}$/.test(ask)) openTarget(programTarget(ask.slice(8))); // Ask in Home from the program panel
1315
1315
  else if (about && /^init:/.test(about) && iniRowOf(P.get('vid') || about.slice(5))) { const id = iniRowOf(P.get('vid')) ? P.get('vid') : about.slice(5); goIni(id).then(() => { if (P.get('vk') && S.ini === id && !isPhone()) iniOverview(); }); }
1316
+ // the Board's program panel Discuss in chat names board:program:<id>: the program's own conversation, the one its tasks open (bug 2026-10-24)
1317
+ else if (about && /^board:program:[A-Za-z0-9][A-Za-z0-9._-]{0,100}$/.test(about)) openTarget(programTarget(about.slice(14)));
1316
1318
  else if (about) { openTarget({ ...homeTarget(), key: about, title: (P.get('label') || '').slice(0, 80) || about }); discussed(about, P.get('vid'), P.get('label')); }
1317
1319
  else if (S.ini && P.get('view') === 'metrics') goIni(S.ini).then(() => openMetrics()); // ?view=metrics: the metrics review, as its Open in a new tab names it
1318
1320
  else if (S.ini) goIni(S.ini);
@@ -58,7 +58,8 @@ const stateOf = (s) => (s.shown === 'needs' ? 'needs' : s.shown === 'blocked' ?
58
58
  export function sessionRow(s, roles) {
59
59
  const role = roleOf(s, roles);
60
60
  const st = stateOf(s);
61
- const name = s.hx && s.hx.title ? s.hx.title : s.name || 'Session';
61
+ // a chat's tmux name carries a 'chat: ' prefix (lib/briefing-premium-agent.js); the row shows its title only (testing fixes)
62
+ const name = s.hx && s.hx.title ? s.hx.title : String(s.name || '').replace(/^chat:\s*/, '') || 'Session';
62
63
  return { id: 's:' + s.id, kind: 'session', sid: s.id, key: keyOfSession(s), ini: iniOfSession(s), name, state: st, initial: role.initial, role,
63
64
  hint: role.name, icon: 'chat', created: s.created || '' }; // the state is the dot beside the row, not a word (testing fixes)
64
65
  }
@@ -236,7 +237,9 @@ function productRow(D) {
236
237
  export function iniLayout(D, id) {
237
238
  const needs = needsOf(D);
238
239
  const mine = needs.filter((r) => r.ini === id);
239
- const ses = (D.sessions || []).filter((s) => iniOfSession(s) === id).map((s) => sessionRow(s, D.desk && D.desk.roles));
240
+ // a session that waits on the PM shows once, under Needs you, never again under Sessions (say it once; the Home list does the same)
241
+ const ses = (D.sessions || []).filter((s) => iniOfSession(s) === id && s.shown !== 'needs' && s.shown !== 'blocked').map((s) => sessionRow(s, D.desk && D.desk.roles));
242
+ const liveKeys = new Set((D.sessions || []).filter((s) => iniOfSession(s) === id && live(s)).map(keyOfSession).filter(Boolean));
240
243
  const people = (((D.desk && D.desk.stakeholders) || {})[id] || []).map((p) => ({ id: 'k:' + p.name, kind: 'person', name: p.name + (p.role ? ' · ' + p.role : ''), hint: p.note || 'Stakeholder', initial: initials(p.name), state: 'quiet', person: p }));
241
244
  const meet = todayOf(D).filter((m) => meetIni(m) === id).map((m) => ({ id: 'm:' + (m.id || m.title), kind: 'meeting', name: m.title, hint: (m.state === 'now' ? 'Now' : hm(m.start)) + ' meeting' + (m.state === 'past' ? ' · done' : ''), state: m.state === 'now' ? 'working' : 'quiet', icon: 'clock', meeting: m }));
242
245
  const routines = ((D.schedules && D.schedules.schedules) || []).filter((s) => s.initiative === id || new RegExp('\\b' + id.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '\\b').test(String(s.name || s.label || ''))).map((s) => ({ id: 'r:' + (s.id || s.name), kind: 'routine', name: cap1(String(s.name || s.task || s.skill || 'Routine').replace(/[-_]/g, ' ')), hint: s.next ? 'Next ' + DOW[new Date(s.next).getDay()] + ' ' + hm(s.next) : 'Not scheduled', state: 'quiet', icon: 'routine', schedule: s }));
@@ -248,7 +251,8 @@ export function iniLayout(D, id) {
248
251
  ['meetings', 'Meetings', meet],
249
252
  ['routines', 'Routines', routines],
250
253
  ['files', 'Files', files],
251
- ['done', 'Finished sessions', ses.filter((s) => s.state === 'exited')],
254
+ // a finished run of a conversation that is open again (the same chat key, live or waiting on the PM) is not listed a second time
255
+ ['done', 'Finished sessions', ses.filter((s) => s.state === 'exited' && !(s.key && liveKeys.has(s.key)))],
252
256
  ].map(([key, title, rows]) => ({ key, title, rows })).filter((g) => g.rows.length);
253
257
  const other = needs.filter((r) => r.ini !== id);
254
258
  const byIni = new Map(); for (const r of other) { const k = r.ini || ''; byIni.set(k, (byIni.get(k) || 0) + 1); }
@@ -459,6 +459,15 @@ const pageHref = (r) => { const ws = r.ws || M.board.ws, b = r.boardId || M.boar
459
459
  const TI = (r) => (r && r.trail) || null;
460
460
  /** The programs (GET /api/programs), then the rows of their initiatives in this board's other products, read once each, so a program's
461
461
  * readiness and its products count every product (its other products' initiatives are not drawn here: PRD decision 5). */
462
+ /** "Turn into a program" (P7): a charter named after the initiative, which joins it; then the program's panel opens, with its sort card. */
463
+ async function turnProgram(r) {
464
+ const res = await pmPost('/api/programs/turn', { ws: r.ws || M.board.ws || null, initiative: r.id, title: r.title }).catch(() => null);
465
+ if (!res || !res.ok || !res.program) { say((res && res.error) || 'The program was not made. Try again.'); return; }
466
+ closePanel();
467
+ await loadPrograms();
468
+ say('Now a program · ' + r.title + '.');
469
+ PG.openProgram(res.program.id);
470
+ }
462
471
  async function loadPrograms() {
463
472
  let r = null; try { r = await (await fetch('/api/programs', { credentials: 'same-origin' })).json(); } catch { r = null; }
464
473
  if (!r || !r.ok) return;
@@ -715,7 +724,8 @@ Acts.init({ M: () => M, load, say, panel: actsPanel, close: closePanel, redraw:
715
724
  grouping: () => ({ on: groupingOn(), byProduct }), setGrouping });
716
725
  BI.mount({ M: () => M, statusOf, dayTitle, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
717
726
  send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
718
- acts: (r, b) => Acts.open.row(r, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden });
727
+ acts: (r, b) => Acts.open.row(r, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden,
728
+ programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), turnProgram });
719
729
  setSay(say);
720
730
  PP.mount({ M: () => M, programs: () => PGS, openIni: (id, from) => openIni((M.rows || []).find((x) => x.id === id && x.track), from), close: closePanel, reload: loadPrograms, say }); // the program panel (PgProgram)
721
731
  setTab('ini');
@@ -0,0 +1,6 @@
1
+ {
2
+ "_comment": "Bug 2026-10-24 (Set Project Ascent as Program): the program rule a chat carries, and Turn into a program in the initiative's ⋯ (program-hierarchy P7).",
3
+ "modules": [
4
+ "program-chat.test.js"
5
+ ]
6
+ }