create-pmos 0.610.0 → 0.611.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/package.json +50 -14
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/board-columns-test.js +2 -1
  7. package/workspace/board-deliveries-test.js +2 -1
  8. package/workspace/board-programs-test.js +7 -3
  9. package/workspace/board-publish-ui-test.js +2 -1
  10. package/workspace/board-shared-ui-test.js +2 -1
  11. package/workspace/board-workflows-test.js +2 -1
  12. package/workspace/briefing-premium-board-test.js +3 -2
  13. package/workspace/briefing-premium-doc-edit-test.js +2 -1
  14. package/workspace/briefing-premium-insights-test.js +4 -3
  15. package/workspace/briefing-premium-test.js +3 -2
  16. package/workspace/calm-timeline-test.js +2 -1
  17. package/workspace/changelog.json +49 -0
  18. package/workspace/core-docs-workflow-test.js +2 -1
  19. package/workspace/ev-everywhere-test.js +3 -2
  20. package/workspace/guide/home.md +2 -2
  21. package/workspace/guide/index.md +4 -0
  22. package/workspace/guide/layout.md +62 -2
  23. package/workspace/guide/programs.md +16 -2
  24. package/workspace/guide/routine.md +50 -0
  25. package/workspace/guide/scheduled-tasks-and-cli.md +1 -1
  26. package/workspace/guide/settings-and-switches.md +1 -1
  27. package/workspace/impact-screens-test.js +3 -1
  28. package/workspace/ini-workflow-test.js +2 -1
  29. package/workspace/lib/classic-board.js +15 -0
  30. package/workspace/lib/events-place.js +216 -0
  31. package/workspace/lib/library-items.js +78 -0
  32. package/workspace/lib/notes.js +6 -1
  33. package/workspace/lib/route-modules.js +4 -0
  34. package/workspace/lib/routes-events-place.js +166 -0
  35. package/workspace/lib/routes-library.js +89 -0
  36. package/workspace/lib/routes-pop-work.js +39 -0
  37. package/workspace/lib/routes-report-setups.js +20 -0
  38. package/workspace/lib/routes-today-log.js +48 -0
  39. package/workspace/lib/routine-reports.js +52 -0
  40. package/workspace/lib/today-log.js +131 -0
  41. package/workspace/live-pill-round-test.js +10 -7
  42. package/workspace/metric-drafts-ui-test.js +3 -1
  43. package/workspace/milestone-pins-test.js +2 -1
  44. package/workspace/milestone-suggest-test.js +3 -1
  45. package/workspace/package-lock.json +2 -2
  46. package/workspace/package.json +1 -1
  47. package/workspace/panels-test.js +2 -1
  48. package/workspace/premium-board-actions-test.js +3 -1
  49. package/workspace/premium-rec-tab-test.js +2 -1
  50. package/workspace/premium-vw-backlog-test.js +3 -1
  51. package/workspace/premium-vw-item-test.js +3 -1
  52. package/workspace/premium-vw-jira-test.js +3 -1
  53. package/workspace/product-lane-test.js +2 -1
  54. package/workspace/program-charter-test.js +3 -1
  55. package/workspace/program-leave-test.js +2 -1
  56. package/workspace/program-order-test.js +2 -1
  57. package/workspace/program-panel-test.js +3 -1
  58. package/workspace/public/pm/bd-ini-panel.js +72 -7
  59. package/workspace/public/pm/bd-prog-panel.js +55 -8
  60. package/workspace/public/pm/bd-work.css +130 -0
  61. package/workspace/public/pm/bd-work.js +356 -0
  62. package/workspace/public/pm/cozy-ev.css +2 -1
  63. package/workspace/public/pm/cozy-events-view.js +142 -0
  64. package/workspace/public/pm/cozy-events.css +107 -0
  65. package/workspace/public/pm/cozy-events.js +210 -0
  66. package/workspace/public/pm/cozy-evmodel.js +1 -1
  67. package/workspace/public/pm/cozy-library.css +36 -0
  68. package/workspace/public/pm/cozy-live-pill.js +1 -0
  69. package/workspace/public/pm/cozy-nav.js +5 -5
  70. package/workspace/public/pm/cozy-pop-work.css +165 -0
  71. package/workspace/public/pm/cozy-pop-work.js +427 -0
  72. package/workspace/public/pm/cozy-routine-model.js +111 -0
  73. package/workspace/public/pm/cozy-routine-pop.js +196 -0
  74. package/workspace/public/pm/cozy-routine.css +102 -0
  75. package/workspace/public/pm/cozy-routine.js +156 -0
  76. package/workspace/public/pm/cozy-schedwork.js +6 -5
  77. package/workspace/public/pm/cozy-today-app.js +236 -0
  78. package/workspace/public/pm/cozy-today-model.js +176 -0
  79. package/workspace/public/pm/cozy-today-page.css +100 -0
  80. package/workspace/public/pm/cozy-today-view.js +76 -0
  81. package/workspace/public/pm/home-app.js +18 -3
  82. package/workspace/public/pm/home-ini.js +36 -5
  83. package/workspace/public/pm/library-model.js +69 -0
  84. package/workspace/public/pm/library-open.js +34 -0
  85. package/workspace/public/pm/pop-work-model.js +335 -0
  86. package/workspace/public/pm/premium-board.js +130 -8
  87. package/workspace/public/pm/premium-library.js +122 -0
  88. package/workspace/public/premium-board.html +1 -0
  89. package/workspace/public/premium-events.html +42 -0
  90. package/workspace/public/premium-library.html +31 -0
  91. package/workspace/public/premium-routine.html +31 -0
  92. package/workspace/public/today.html +50 -0
  93. package/workspace/ready-dash-ui-test.js +3 -1
  94. package/workspace/rename-test.js +2 -1
  95. package/workspace/run-tests.js +4 -1
  96. package/workspace/server.js +3 -2
  97. package/workspace/sort-order-test.js +2 -1
  98. package/workspace/split-merge-ui-test.js +3 -1
  99. package/workspace/stage-card-tasks-test.js +3 -1
  100. package/workspace/stage-card-test.js +2 -1
  101. package/workspace/task-delete-test.js +2 -1
  102. package/workspace/task-links-test.js +2 -1
  103. package/workspace/task-milestones-test.js +4 -2
  104. package/workspace/task-plans-test.js +3 -1
  105. package/workspace/task-press-test.js +3 -1
  106. package/workspace/task-views-test.js +3 -1
  107. package/workspace/test-lists/events-place.json +11 -0
  108. package/workspace/test-lists/library-place.json +9 -0
  109. package/workspace/test-lists/pop-work.json +9 -0
  110. package/workspace/test-lists/routine-place.json +9 -0
  111. package/workspace/test-lists/today-log.json +9 -0
  112. package/workspace/test-lists/work-view.json +9 -0
  113. package/workspace/timeline-holds-test.js +3 -1
  114. package/workspace/tk-tasks-test.js +2 -1
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "The Board: programs, views, published boards and core documents"
4
4
  description: "The Board's views and programs, milestones, a read-only published copy of a Board, and the core documents of each level."
5
- timestamp: 2026-11-17
5
+ timestamp: 2026-11-19
6
6
  ---
7
7
 
8
8
  # The Board
@@ -15,9 +15,23 @@ Programs do not change how Insights, the weekly update or sprints count initiati
15
15
 
16
16
  A cancelled or archived initiative leaves its program's views: the band, the program panel and the timeline show only live initiatives. It stays in **Cancelled and archived** on its product's Board.
17
17
 
18
+ ## Work on a computer
19
+
20
+ On a computer the Board place is **Work**: one list of initiatives with the timeline on its right. There are no List, By stage, Track or Timeline views to choose.
21
+
22
+ - **The columns.** Initiative, Product, Stage, Next milestone and Date, in this order. **Next milestone** is the name of the milestone. When an initiative has no milestone, it says **Plan end** in grey and the date is the end of its plan. Only a late or at-risk date has colour, for example "4 Nov · 14 days late". The Product column does not show when you pick one product.
23
+ - **The groups.** The rows are under their goals. An initiative with no goal is under **No goal yet**.
24
+ - **The timeline.** Light grey is the plan, dark grey is the part that has passed, a diamond is the next milestone, and a red line goes from a missed date to today. Point at a row to see its stages on its bar and in a small card with each stage and its date ("no date" when there is none). The span chooser at the top left of the timeline has **Quarter**, **Half**, **Year**, **2 yr**, **5 yr** and **Full**. **Full** shows every bar from the earliest start to the latest end. The button beside it hides the timeline. The key is under the list.
25
+ - **The view menu.** Press the tune button. **Group by**: Goal, Product, Stage, Status, Program or No groups. **Timeline**: on or off. **Columns**: a switch for each column. Status, Program, Goal and Workflow are off at first. Drag a column to change the order (or use Alt+↑ and Alt+↓). PMOS remembers the view in this browser. **Reset** goes back to the usual view. The last part of the menu has **Sort and filter**, **New asks**, **Only what waits on you**, **Sprints and releases**, **Shared with me** and **Read Jira again**.
26
+ - **Sort.** Press a column title to sort by it. Press it again to go back to your usual order.
27
+ - **Edit in place.** Press the Stage of a row to move the initiative to another stage. The toast has **Undo**.
28
+ - **Open.** Press a row to open the initiative in the popup, with the chat beside it.
29
+
30
+ A phone, a narrow Board beside another panel and a published read-only copy keep the views below.
31
+
18
32
  ## The top row
19
33
 
20
- The Board has one row of seven controls at the top, the same on a phone and on a computer. The pieces are in this order:
34
+ The Board has one row of seven controls at the top, the same on a phone and on a computer. On a computer Work leaves out the view button and the Needs a look pill (see above). The pieces are in this order:
21
35
 
22
36
  - **The product picker.** Pick the products that the Board shows.
23
37
  - **The view.** Press the view button. Its menu has **List**, **By stage**, **Track** and **Timeline**. When the timeline shows, the menu also has the span (for example **Quarter**) and, on a computer, the **Columns** beside the names. **Shared with me** is the last item.
@@ -0,0 +1,50 @@
1
+ ---
2
+ type: Guide
3
+ title: "Routine: everything that repeats"
4
+ timestamp: 2026-11-18
5
+ ---
6
+
7
+ # Routine: everything that repeats
8
+
9
+ Routine is the place for everything PMOS does by itself on a schedule, and for your own scheduled tasks. To open it, press **Routine** in the rail on the left of the page.
10
+
11
+ ## The table
12
+
13
+ Routine is one table. Each row has these columns:
14
+
15
+ | Column | What it shows |
16
+ |---|---|
17
+ | Routine | The name of the report, the source, the job or the task. |
18
+ | What it does | For a report, who it tells. For a read or a job, what it does. |
19
+ | When | How often it repeats. |
20
+ | Next | When it runs next. "Paused" when it is off. "A draft waits" when a report has a draft to issue. |
21
+ | (switch) | Pauses the routine, or starts it again. |
22
+
23
+ The rows are in these groups, in this order:
24
+
25
+ 1. **Waits for you.** A report whose definition waits for your word, or a report that is about another product. Press ✓ to start it, or to move it to that product.
26
+ 2. **Reports.** Every report that is set up or that has issues.
27
+ 3. **PMOS reads.** The sources PMOS reads. Each service of Your tools is a row of its own. It follows the switch of Your tools, so it has no switch.
28
+ 4. **PMOS jobs.** The jobs PMOS runs by itself, such as the day check and the initiative driver.
29
+ 5. **Your tasks.** Your own scheduled tasks.
30
+
31
+ A group with no rows does not show. Use the kinds at the top (All, Reports, Reads, PMOS jobs, Your tasks) to show one kind. PMOS remembers the kind you chose on this computer.
32
+
33
+ ## PMOS did
34
+
35
+ The line at the top says how many things PMOS did since yesterday, and how many of them it showed you. Press the line to see the full log of the last 14 days. Each line in the log has **Undo**.
36
+
37
+ ## Open a routine
38
+
39
+ Press a row. The routine opens in the popup, and Ask PMOS is on the right.
40
+
41
+ - **A report.** The newest issue is on the left. When it is a draft, PMOS asks **Issue this draft?** Press ✓ to issue it, or ✕ to stop PMOS from asking about that draft. Issuing freezes the issue. PMOS sends nothing, so you send it from your own mail. Use the chooser to read an older issue. Press the pencil to open the full reader, where you can edit, present, share and download the report. The grey box beside the issue is the setup: On, Repeats, Next, Tells, After the run, Built from, and the issues. Press a value to change it, or tell PMOS in the chat, for example "send it on Thursdays".
42
+ - **A read, a job or a task.** Its setup: Active, Next run, Repeats, PMOS's proposed rhythm, History, and ▶ to run it now.
43
+
44
+ ## Add a routine
45
+
46
+ Press **+** at the top right. Ask PMOS opens. Tell PMOS what to do and how often.
47
+
48
+ ## Settings
49
+
50
+ Scheduled work used to be in Settings › Connectors. It is in Routine now. Settings › Connectors has one line, **Scheduled work is in Routine**, that opens this page. Each source row in Connectors still opens its own setup.
@@ -9,7 +9,7 @@ timestamp: 2026-11-18
9
9
 
10
10
  A scheduled task runs a skill at a set time. The workspace starts a terminal session in the repository and types the skill into it.
11
11
 
12
- A task repeats every hour (at the minute of its time), every day, every week, every 2 weeks or every month, or runs once. Settings › Connectors › **Scheduled work** lists your tasks with their next run, and each task's page turns it on or off, changes how often it repeats and runs it now.
12
+ A task repeats every hour (at the minute of its time), every day, every week, every 2 weeks or every month, or runs once. [Routine](routine.md) lists your tasks under **Your tasks**, with their next run, and each task's page turns it on or off, changes how often it repeats and runs it now.
13
13
 
14
14
  ## Limits
15
15
 
@@ -370,7 +370,7 @@ Press › on a row to open its page. A change you make there shows on the Connec
370
370
 
371
371
  On a day with 3 or more meetings, PMOS proposes ✦ **Read it more often on meeting days**: Calendar every 15 min on such days, other days as set. Nothing changes until you press ✓. **Undo** puts the old rhythm back, and ✕ hides the proposal for today.
372
372
 
373
- The **Scheduled work** row under the sources lists everything that runs on a schedule: what PMOS reads, PMOS's own jobs (the day check, the initiative driver, signals) and your own scheduled tasks, each with its next run. Your own tasks can repeat every hour, every day, every week, every 2 weeks or every month.
373
+ The line **Scheduled work is in Routine** under the sources opens [Routine](routine.md). Routine lists everything that runs on a schedule: what PMOS reads, PMOS's own jobs (the day check, the initiative driver, signals), your reports and your own scheduled tasks, each with its next run. Your own tasks can repeat every hour, every day, every week, every 2 weeks or every month.
374
374
 
375
375
  When all is well, there is no other line. ↻ in the Connectors header is **Refresh all**. The (i) button says what PMOS reads and that it never posts. Under the list is the connectors directory:
376
376
 
@@ -12,6 +12,8 @@
12
12
  * N every POST went to /api/impact/seen, and no page error
13
13
  * PMOS_SHOTS=<dir> also saves the screenshots. */
14
14
  const path = require('path');
15
+ const { besidePage } = require('./lib/beside-page'); // these checks read the full page beside the page; in the popup work shows its three parts (nav slice 3)
16
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
15
17
  const fs = require('fs');
16
18
  const { spawn } = require('child_process');
17
19
  const { findBrowser } = require('./lib/find-browser');
@@ -58,7 +60,7 @@ const WEEKS = { ok: true, on: true, live: true, weeks: [
58
60
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
59
61
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
60
62
  await T.waitForServer(BASE);
61
- browser = await chromium.launch({ executablePath: exe });
63
+ browser = besidePage(classicBoard(await chromium.launch({ executablePath: exe })));
62
64
  if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
63
65
  const shot = async (p, name) => { if (SHOTS) { await sleep(500); await p.screenshot({ path: path.join(SHOTS, name + '.png') }); } };
64
66
  const BRIEF = BRP.build(BRF.facts());
@@ -7,6 +7,7 @@
7
7
  * W1 the kind line and the card count its own workflow · W2 "Set to Tender from the BRD · Undo" · W3 the Change picker · W4 Switch ·
8
8
  * W5 the ⋯ menu · W6 Won't do · W7 back to Triage · W8 phone and dark. SHOTS=<dir> also writes the screenshots at 1440 and 390. */
9
9
  const fs = require('fs');
10
+ const { besidePage } = require('./lib/beside-page'); // these checks read the full page beside the page; in the popup work shows its three parts (nav slice 3)
10
11
  const path = require('path');
11
12
  const { spawn } = require('child_process');
12
13
  const { findBrowser } = require('./lib/find-browser');
@@ -67,7 +68,7 @@ const BRIEF = BRP.build(BRF.facts());
67
68
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
68
69
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT), PMOS_SELF_ROOT: path.resolve(__dirname, '..') }) });
69
70
  await T.waitForServer(BASE);
70
- browser = await chromium.launch({ executablePath: exe });
71
+ browser = besidePage(await chromium.launch({ executablePath: exe }));
71
72
  if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
72
73
  const shot = async (p, name) => { if (SHOTS) await p.screenshot({ path: path.join(SHOTS, name + '.png') }); };
73
74
 
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+ /* classic-board: a browser-test helper. On a desk the Board page draws Work, one list with its timeline (public/pm/bd-work.js, initiative
3
+ * work-one-view), in place of the four views (List, By stage, Track, Timeline). A suite written for the four views wraps its browser with
4
+ * this: every context it makes starts with localStorage pmos.work.classic = 1, which keeps the four views on a desk, unless the suite set the
5
+ * key itself. It is a test seam, not a choice in the product: the phone and the narrow form keep the four views anyway. */
6
+ function classicBoard(browser) {
7
+ const make = browser.newContext.bind(browser);
8
+ browser.newContext = async (...a) => {
9
+ const ctx = await make(...a);
10
+ await ctx.addInitScript(() => { try { if (localStorage.getItem('pmos.work.classic') == null) localStorage.setItem('pmos.work.classic', '1'); } catch { /* no storage */ } });
11
+ return ctx;
12
+ };
13
+ return browser;
14
+ }
15
+ module.exports = { classicBoard };
@@ -0,0 +1,216 @@
1
+ 'use strict';
2
+ /* lib/events-place.js — Events, the place for everything with a date (slice 6 of the six-place navigation, initiative events-place; board 2,
3
+ * StEvPlan, on Exploring 2, page "Navigation: Today, Work, Goals, Events, Library, Routine").
4
+ *
5
+ * build(input) → { today, items, later } PURE. No I/O and no clock: `today` comes in as 'YYYY-MM-DD'.
6
+ * shortDay(day, today) · daysBetween(a, b) · KINDS · DROP_DAYS · WINDOW_DAYS · MEET_DAYS
7
+ *
8
+ * INPUT (plain data that lib/routes-events-place.js reads from the routes and files that already exist):
9
+ * boards [{ ws, id, name, rows }] every product's Board model (lib/board-premium.js): the open rows, each with `milestones` (◇ tasks with a
10
+ * due day, PMOS and Jira), `tasks` (the PMOS tasks), `end` (the plan end), `stage`, `status`, `forecast`
11
+ * meetings [{ id, at, end, title, initiative }] lib/calendar-events.js readAll
12
+ * schedules [{ id, name, cadence, next }] the enabled report schedules, with the day each fires next ('YYYY-MM-DD')
13
+ * drafts [{ ws, cadence, slot, title? }] report drafts that wait to be issued (lib/report-needs.js reportsOf: a draft, not issued)
14
+ * own [{ id, title, due, done }] the PM's own items (lib/pm-items.js)
15
+ * marks { fixed: Set<key>, declined: Set<sig> } the PM's fixed dates and the suggestions they said no to (lib/routes-events-place.js)
16
+ *
17
+ * AN ITEM: { key, kind, date, time, until, title, line, product, work, task, own, jira, fixed, canFix, editable, tone, days, group, suggest, act }
18
+ * kind milestone (a ◇ task, or the plan end of an initiative that has no open milestone) · task · report · meeting
19
+ * line the second line, which names the kind: "Delivery milestone: Deliver · Tender new CIAM", "Task due · …", "Report goes out", …
20
+ * group late (before today, not done) · today · coming (the next WINDOW_DAYS days; a meeting the next MEET_DAYS) · later
21
+ * tone late · risk (a milestone of an initiative at risk, or whose Jira forecast says it will miss) · ''
22
+ * suggest { op: done | move | drop, to?, with?, text, why, sig } or null. What PMOS suggests; the PM says yes (✓) or no (✕).
23
+ *
24
+ * THE RULES OF A SUGGESTION. A suggestion is made only from a record; PMOS does not invent a date.
25
+ * done a late PMOS item whose stage is behind the stage its initiative is in now: "It looks done. Mark it done".
26
+ * drop a late task, not a milestone, DROP_DAYS days late or more: "Drop it".
27
+ * move a late PMOS item: to the day the Jira forecast gives (a milestone), else to the plan end when that is later than today.
28
+ * A milestone whose stage has a task that moves later moves with it: "Moves with <task>, to <day>".
29
+ * Coming up: only a milestone at risk, to the day the Jira forecast gives.
30
+ * never a fixed date is never offered a new date (done and drop still are). A Jira item and a plan end get no suggestion: no route here writes
31
+ * them, and pressing the row opens the work. A suggestion the PM said no to (its sig is in marks.declined) does not come back. */
32
+ const BP = require('./board-premium.js');
33
+
34
+ const KINDS = Object.freeze(['milestone', 'task', 'report', 'meeting']);
35
+ const DROP_DAYS = 28;
36
+ const WINDOW_DAYS = 30;
37
+ const MEET_DAYS = 7;
38
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
39
+ const CLOSED = /^(done|won't do|archived|cancelled)$/i;
40
+ const MINE = /^(pm|me|you)$/i;
41
+
42
+ const isDay = (s) => typeof s === 'string' && /^\d{4}-\d{2}-\d{2}/.test(s) && !Number.isNaN(Date.parse(s.slice(0, 10) + 'T00:00:00Z'));
43
+ const day10 = (s) => String(s).slice(0, 10);
44
+ const ms = (d) => Date.parse(day10(d) + 'T00:00:00Z');
45
+ /** Days from a to b (b later: positive). */
46
+ const daysBetween = (a, b) => Math.round((ms(b) - ms(a)) / 86400000);
47
+ /** '25 Nov', or '3 Mar 2027' outside the year of today. */
48
+ function shortDay(d, today) {
49
+ if (!isDay(d)) return '';
50
+ const [y, m, dd] = day10(d).split('-').map(Number);
51
+ return dd + ' ' + MON[m - 1] + (today && String(y) !== String(today).slice(0, 4) ? ' ' + y : '');
52
+ }
53
+ const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
54
+ const cap = (s) => String(s || '').replace(/[-_]+/g, ' ').replace(/^./, (c) => c.toUpperCase());
55
+
56
+ /** The name of a stage key or name, from the row's own workflow when it has one. */
57
+ function stageName(r, sec) {
58
+ if (!sec) return '';
59
+ const own = (r.wfStages || []).find((s) => s && (s.key === sec || s.name === sec));
60
+ if (own && own.name) return own.name;
61
+ const k = BP.stepIndex(sec);
62
+ return k >= 0 ? BP.STEPS[k].label : cap(sec);
63
+ }
64
+ /** Is the stage `sec` behind the stage the initiative is in now? Only when both are known. */
65
+ function stagePast(r, sec) {
66
+ if (!sec || !r.stage) return false;
67
+ const own = (r.wfStages || []).map((s) => s && s.key);
68
+ const ownNames = (r.wfStages || []).map((s) => s && s.name);
69
+ const i = own.indexOf(sec) >= 0 ? own.indexOf(sec) : ownNames.indexOf(sec);
70
+ const j = own.indexOf(r.stage) >= 0 ? own.indexOf(r.stage) : ownNames.indexOf(r.stage);
71
+ if (i >= 0 && j >= 0) return i < j;
72
+ const a = BP.stepIndex(sec), b = BP.stepIndex(r.stage, r.cat);
73
+ return a >= 0 && b >= 0 && a < b;
74
+ }
75
+ const atRisk = (r) => r.status === 'at risk' || r.status === 'late' || !!(r.forecast && (r.forecast.state === 'at-risk' || r.forecast.state === 'will-miss'));
76
+
77
+ function groupOf(kind, date, today) {
78
+ const d = daysBetween(today, date);
79
+ if (d < 0) return 'late';
80
+ if (d === 0) return 'today';
81
+ return d <= (kind === 'meeting' ? MEET_DAYS : WINDOW_DAYS) ? 'coming' : 'later';
82
+ }
83
+
84
+ function build(input = {}) {
85
+ const today = isDay(input.today) ? day10(input.today) : null;
86
+ if (!today) return { today: null, items: [], later: { count: 0, next: null } };
87
+ const marks = input.marks || {};
88
+ const fixedSet = marks.fixed instanceof Set ? marks.fixed : new Set(marks.fixed || []);
89
+ const declined = marks.declined instanceof Set ? marks.declined : new Set(marks.declined || []);
90
+ const items = [];
91
+ const put = (x) => {
92
+ if (!isDay(x.date)) return;
93
+ x.date = day10(x.date);
94
+ x.days = daysBetween(today, x.date);
95
+ x.group = groupOf(x.kind, x.date, today);
96
+ if (x.kind === 'meeting' && x.group === 'late') return; // a meeting that has passed is not late
97
+ if (x.kind === 'report' && x.group === 'late' && !x.draft) return;
98
+ x.fixed = !!(x.canFix && fixedSet.has(x.key));
99
+ x.tone = x.group === 'late' ? 'late' : x.tone || '';
100
+ items.push(x);
101
+ };
102
+
103
+ for (const b of input.boards || []) {
104
+ const product = clip(b.name || b.ws || '', 80);
105
+ for (const r of b.rows || []) {
106
+ if (!r || !r.id || r.closed || r.status === 'done' || r.status === 'cancelled' || r.status === 'on hold') continue;
107
+ const work = { id: r.id, title: clip(r.title || r.id, 140), ws: b.ws || '', board: b.id || '' };
108
+ const risk = atRisk(r);
109
+ const open = (r.milestones || []).filter((m) => m && !m.done && isDay(m.date));
110
+ for (const m of open) {
111
+ const st = stageName(r, m.sec);
112
+ put({ key: 'ms:' + work.ws + '|' + work.board + '|' + m.id, kind: 'milestone', date: m.date, time: null, until: null, title: clip(m.name, 140),
113
+ line: 'Delivery milestone' + (st ? ': ' + st : '') + ' · ' + work.title, product, work, task: m.jira ? null : { uid: m.id, ws: work.ws, board: work.board },
114
+ own: null, jira: !!m.jira, canFix: true, editable: !m.jira, tone: risk ? 'risk' : '', sec: m.sec || '', row: r, act: null });
115
+ }
116
+ // the plan end stands for the delivery when the initiative names no open milestone (as Work's "Plan end")
117
+ if (!open.length && isDay(r.end)) {
118
+ put({ key: 'end:' + work.ws + '|' + work.board + '|' + r.id, kind: 'milestone', date: r.end, time: null, until: null, title: work.title,
119
+ line: 'Delivery milestone: Plan end · ' + product, product, work, task: null, own: null, jira: false, canFix: true, editable: false, planEnd: true,
120
+ tone: risk ? 'risk' : '', sec: '', row: r, act: null });
121
+ }
122
+ for (const t of r.tasks || []) {
123
+ if (!t || !t.uid || t.milestone || CLOSED.test(String(t.status || '')) || !isDay(t.end)) continue;
124
+ if (t.owner && !MINE.test(String(t.owner).trim())) continue; // the PM's tasks: no owner, or the PM
125
+ const sec = typeof t.section === 'string' && t.section ? t.section : t.from && t.from.stage ? t.from.stage : '';
126
+ put({ key: 'task:' + work.ws + '|' + work.board + '|' + t.uid, kind: 'task', date: t.end, time: null, until: null, title: clip(t.title, 140),
127
+ line: 'Task due · ' + work.title, product, work, task: { uid: t.uid, ws: work.ws, board: work.board, status: t.status || 'To do' }, own: null, jira: false,
128
+ canFix: true, editable: true, sec, row: r, act: null });
129
+ }
130
+ }
131
+ }
132
+
133
+ for (const o of input.own || []) {
134
+ if (!o || !o.id || o.done || !isDay(o.due)) continue;
135
+ put({ key: 'own:' + o.id, kind: 'task', date: o.due, time: null, until: null, title: clip(o.title, 140), line: 'Your task', product: '', work: null, task: null,
136
+ own: String(o.id), jira: false, canFix: true, editable: true, sec: '', row: null, act: null });
137
+ }
138
+
139
+ const draftOf = new Map();
140
+ for (const d of input.drafts || []) if (d && d.cadence && !draftOf.has(d.cadence)) draftOf.set(d.cadence, d);
141
+ // a draft whose report goes out today is said on that report's row, not on a row of its own
142
+ const outToday = new Set((input.schedules || []).filter((s) => s && isDay(s.next) && day10(s.next) === today).map((s) => s.cadence));
143
+ for (const d of draftOf.values()) {
144
+ if (outToday.has(d.cadence)) continue;
145
+ put({ key: 'draft:' + (d.ws || '') + '|' + d.cadence + '|' + (d.slot || ''), kind: 'report', date: today, time: null, until: null, title: clip(d.title || cap(d.cadence) + ' report', 120),
146
+ line: 'Report draft' + (isDay(d.slot) && day10(d.slot) !== today ? ' of ' + shortDay(d.slot, today) : '') + ' waits for you to issue it', product: '', work: null, task: null, own: null, jira: false, canFix: false, editable: false, draft: true,
147
+ act: { label: 'Read the draft', href: '/premium-intelligence.html?tab=library' } });
148
+ }
149
+ for (const s of input.schedules || []) {
150
+ if (!s || !isDay(s.next)) continue;
151
+ const name = clip(s.name || cap(s.cadence) + ' report', 120);
152
+ const d = draftOf.get(s.cadence);
153
+ put({ key: 'rep:' + (s.id || s.cadence) + ':' + day10(s.next), kind: 'report', date: s.next, time: null, until: null, title: name,
154
+ line: 'Report goes out' + (s.cadence ? ' · ' + cap(s.cadence) : '') + (d && daysBetween(today, s.next) === 0 ? ' · the draft waits for you' : ''), product: '', work: null, task: null, own: null, jira: false, canFix: false, editable: false,
155
+ act: d && daysBetween(today, s.next) === 0 ? { label: 'Read the draft', href: '/premium-intelligence.html?tab=library' } : null });
156
+ }
157
+
158
+ for (const e of input.meetings || []) {
159
+ if (!e || !e.title || typeof e.at !== 'string' || !isDay(e.at)) continue;
160
+ const time = /T(\d{2}:\d{2})/.exec(e.at);
161
+ const until = typeof e.end === 'string' && e.end.slice(0, 10) === e.at.slice(0, 10) ? /T(\d{2}:\d{2})/.exec(e.end) : null;
162
+ const work = e.initiative ? { id: String(e.initiative), title: '', ws: '', board: '' } : null;
163
+ put({ key: 'mtg:' + (e.id || e.at + '|' + e.title), kind: 'meeting', date: e.at, time: time ? time[1] : null, until: until ? until[1] : null, title: clip(e.title, 140),
164
+ line: time ? 'Meeting' : 'All day', product: '', work, task: null, own: null, jira: false, canFix: false, editable: false, act: null });
165
+ }
166
+
167
+ // the work a meeting is about, named from the Board rows
168
+ const names = new Map();
169
+ for (const x of items) if (x.work && x.work.title) names.set(x.work.id, x.work);
170
+ for (const x of items) if (x.kind === 'meeting' && x.work) { const w = names.get(x.work.id); if (w) { x.work = { ...w }; x.line = (x.time ? 'Meeting' : 'All day') + ' · ' + w.title; } }
171
+
172
+ // suggestions, first from the item's own record
173
+ const say = (x, s) => {
174
+ const sig = x.key + '|' + s.op + '|' + (s.to || '');
175
+ return declined.has(sig) ? null : { ...s, sig };
176
+ };
177
+ for (const x of items) {
178
+ x.suggest = null;
179
+ if (x.kind !== 'milestone' && x.kind !== 'task') continue;
180
+ if (x.jira || x.planEnd) continue;
181
+ const r = x.row;
182
+ if (x.group === 'late') {
183
+ if (r && x.sec && stagePast(r, x.sec)) { x.suggest = say(x, { op: 'done', text: 'It looks done. Mark it done', why: 'Its stage, ' + stageName(r, x.sec) + ', is behind the stage the work is in now, ' + (r.stage || '') + '.' }); continue; }
184
+ if (x.kind === 'task' && -x.days >= DROP_DAYS) { x.suggest = say(x, { op: 'drop', text: 'Drop it', why: 'It is ' + (-x.days) + ' days late.' }); continue; }
185
+ if (x.fixed || !r) continue;
186
+ const fc = x.kind === 'milestone' && r.forecast && isDay(r.forecast.likely) && daysBetween(today, r.forecast.likely) > 0 ? day10(r.forecast.likely) : null;
187
+ if (fc) { x.suggest = say(x, { op: 'move', to: fc, text: 'Move to ' + shortDay(fc, today), why: 'The Jira forecast says the work lands about ' + shortDay(fc, today) + '.' }); continue; }
188
+ if (isDay(r.end) && daysBetween(today, r.end) > 0) x.suggest = say(x, { op: 'move', to: day10(r.end), text: 'Move to ' + shortDay(r.end, today) + ', the plan end', why: 'The plan of ' + x.work.title + ' ends ' + shortDay(r.end, today) + '.' });
189
+ } else if (x.group === 'coming' && x.kind === 'milestone' && x.tone === 'risk' && !x.fixed && r && r.forecast && isDay(r.forecast.likely) && daysBetween(x.date, r.forecast.likely) > 0) {
190
+ const fc = day10(r.forecast.likely);
191
+ x.suggest = say(x, { op: 'move', to: fc, text: 'Move to ' + shortDay(fc, today), why: 'The Jira forecast says the work lands about ' + shortDay(fc, today) + ', after this date.' });
192
+ }
193
+ }
194
+ // then a milestone moves with a task of its stage that moves later
195
+ for (const x of items) {
196
+ if (x.kind !== 'milestone' || x.jira || x.planEnd || x.fixed || !x.sec || (x.group !== 'late' && x.tone !== 'risk')) continue;
197
+ if (x.suggest && x.suggest.op === 'done') continue;
198
+ let best = null;
199
+ for (const t of items) {
200
+ if (t.kind !== 'task' || !t.work || !x.work || t.work.id !== x.work.id || t.work.ws !== x.work.ws || t.sec !== x.sec) continue;
201
+ if (!t.suggest || t.suggest.op !== 'move' || daysBetween(x.date, t.suggest.to) <= 0) continue;
202
+ if (!best || t.suggest.to > best.suggest.to) best = t;
203
+ }
204
+ if (!best || (x.suggest && x.suggest.to && x.suggest.to > best.suggest.to)) continue;
205
+ const s = say(x, { op: 'move', to: best.suggest.to, with: best.title, text: 'Moves with ' + best.title + ', to ' + shortDay(best.suggest.to, today), why: best.title + ' is a task of the same stage, and it moves to ' + shortDay(best.suggest.to, today) + '.' });
206
+ if (s) x.suggest = s;
207
+ }
208
+
209
+ const ORDER = { late: 0, today: 1, coming: 2, later: 3 };
210
+ items.sort((a, b) => ORDER[a.group] - ORDER[b.group] || a.date.localeCompare(b.date) || String(a.time || '').localeCompare(String(b.time || '')) || a.title.localeCompare(b.title));
211
+ for (const x of items) { delete x.row; }
212
+ const ahead = items.filter((x) => x.group === 'later' && x.kind === 'milestone');
213
+ return { today, items, later: { count: ahead.length, next: ahead[0] ? { date: ahead[0].date, title: ahead[0].title, key: ahead[0].key } : null } };
214
+ }
215
+
216
+ module.exports = { build, shortDay, daysBetween, KINDS, DROP_DAYS, WINDOW_DAYS, MEET_DAYS };
@@ -0,0 +1,78 @@
1
+ 'use strict';
2
+ /* library-items.js — what was made, as one list (initiative library-place, slice 7 of the six-place navigation; boards StLibrary,
3
+ * StLibMeetings, StLibDocs on Exploring 2). PURE: no file, no clock, no network.
4
+ *
5
+ * build({ products, notes }) → [item] newest first
6
+ * products: [{ ws, name, titles: Map|{} initiative id → title, files, links, rounds }]
7
+ * files lib/doc-library.js library().files that an initiative owns: [{ path, title, category, date, initiative }]
8
+ * links lib/custom-docs.js rows with a link: [{ id, scope, title, link: { kind, url }, at }]
9
+ * rounds prototype rounds: [{ id, ini, name, at, made, board }] (lib/idle-lab.js roundsOf, named by the round's brief)
10
+ * notes: lib/notes.js list().notes, with `came` (rowOf)
11
+ * ITEM { id, kind, name, sub, kindText, type, came, about: { ws, product, ini, title }, updated, held, open }
12
+ * kind 'doc' | 'link' | 'meeting' | 'proto'
13
+ * kindText the Kind column: Document · Link · Confluence · Meeting notes · Prototype
14
+ * type the Type column when only documents show (Spec, Done test, Research …; a link says where it lives)
15
+ * came the "Came out of it" column of a meeting: '2 decisions · 3 tasks' ('' for a private note)
16
+ * updated ISO date or time of the last change; held: the meeting's start
17
+ * open what the page's opener needs: { doc: { ws, path } } | { url } | { note, ws } | { proto: { ws, board, id } }
18
+ * narrow(items, { ws, initiative }) → the items of one product or one initiative (slice 3's Artefacts table reads ?initiative=)
19
+ * Reports are not here (they repeat, so they live in Routine); Lab findings are not here (they go to Today as suggestions). */
20
+
21
+ /* the Type of a document, from the category doc-library gives it */
22
+ const TYPE = { spec: 'Spec', eval: 'Done test', res: 'Research', exp: 'Explainer', dec: 'Decision', know: 'Knowledge', guide: 'Guide', proto: 'Prototype brief' };
23
+ const { shortTitle: short } = require('./doc-library.js'); // a pure function of that module
24
+ const plural = (n, one, many) => (n === 1 ? '1 ' + one : n + ' ' + many);
25
+
26
+ /** "2 decisions · 3 tasks", "No decision · 2 tasks", '' when nothing came out of it (or the note is private). */
27
+ function cameText(c) {
28
+ if (!c) return '';
29
+ const d = Number(c.decisions) || 0, t = Number(c.tasks) || 0;
30
+ if (!d && !t) return '';
31
+ return (d ? plural(d, 'decision', 'decisions') : 'No decision') + ' · ' + (t ? plural(t, 'task', 'tasks') : 'no task');
32
+ }
33
+ const get = (m, k) => (!k ? '' : m instanceof Map ? m.get(k) || '' : (m && m[k]) || '');
34
+ const iniOfScope = (scope) => { const m = /^initiative:(.+)$/.exec(String(scope || '')); return m ? m[1] : null; };
35
+
36
+ function build({ products = [], notes = [] } = {}) {
37
+ const out = [];
38
+ const byWs = new Map(products.map((p) => [p.ws, p]));
39
+ // About names the initiative short, as the Board does ("Tender new CIAM", not the PRD's full title); no initiative: the product
40
+ const about = (p, ini, title) => ({ ws: p ? p.ws : null, product: p ? p.name : '', ini: ini || null, title: (ini && (short(title || get(p && p.titles, ini)) || ini)) || (p ? p.name : '') });
41
+ for (const p of products) {
42
+ for (const f of p.files || []) {
43
+ if (!f || !f.path || !f.initiative || f.category === 'ini') continue; // the initiative record is the work itself, not a thing made for it
44
+ const proto = f.category === 'proto';
45
+ out.push({ id: 'doc:' + p.ws + ':' + f.path, kind: proto ? 'proto' : 'doc', name: f.title || f.path.split('/').pop(), sub: '',
46
+ kindText: proto ? 'Prototype' : 'Document', type: /(^|\/)done-tests\//.test(f.path) ? 'Done test' : TYPE[f.category] || 'Document', came: '', about: about(p, f.initiative), updated: f.date || null,
47
+ held: null, open: { doc: { ws: p.ws, path: f.path } } });
48
+ }
49
+ for (const l of p.links || []) {
50
+ if (!l || !l.link || !l.link.url) continue;
51
+ const ini = iniOfScope(l.scope);
52
+ out.push({ id: 'link:' + p.ws + ':' + l.id, kind: 'link', name: l.title, sub: '', kindText: 'Link · ' + l.link.kind, type: 'Link · ' + l.link.kind, came: '',
53
+ about: about(p, ini), updated: l.at || null, held: null, open: { url: l.link.url } });
54
+ }
55
+ for (const r of p.rounds || []) {
56
+ if (!r || !r.id) continue;
57
+ out.push({ id: 'proto:' + p.ws + ':' + r.id, kind: 'proto', name: r.name || 'Prototype', sub: '', kindText: 'Prototype', type: 'Prototype',
58
+ came: r.made ? plural(r.made, 'version', 'versions') : '', about: about(p, r.ini), updated: r.at || null, held: null,
59
+ open: { proto: { ws: p.ws, board: r.board || '', id: r.id } } });
60
+ }
61
+ }
62
+ for (const n of notes) {
63
+ if (!n || !n.id) continue;
64
+ const ini = n.initiative && n.initiative.id ? n.initiative : null;
65
+ const p = byWs.get((ini && ini.ws) || n.ws) || null;
66
+ const held = (n.meeting && n.meeting.start) || n.created_at || null;
67
+ out.push({ id: 'meeting:' + n.id, kind: 'meeting', name: n.title || 'Untitled note', sub: '', kindText: 'Meeting notes', type: 'Meeting notes',
68
+ came: n.private ? '' : cameText(n.came), about: ini ? about(p, ini.id, ini.title) : about(p, null), updated: n.updated_at || held, held,
69
+ open: { note: n.id, ws: (p && p.ws) || n.ws || '' } });
70
+ }
71
+ return out.sort((a, b) => String(b.updated || '').localeCompare(String(a.updated || '')) || a.name.localeCompare(b.name));
72
+ }
73
+
74
+ function narrow(items, { ws, initiative } = {}) {
75
+ return items.filter((x) => (!ws || x.about.ws === ws) && (!initiative || x.about.ini === initiative));
76
+ }
77
+
78
+ module.exports = { build, narrow, cameText, TYPE };
@@ -203,7 +203,12 @@ function rowOf(n, now = Date.now(), resumeMs = RESUME_MS) {
203
203
  // the meeting time so far (a paused note's clock) and how many statements differ from a repository file (the Notes menu)
204
204
  meeting_ms: n.recorded_from ? heardMs(n, now) : 0, conflicts: n.private ? 0 : conflictsOf(n).length,
205
205
  // a private note shows its title on the calendar and the initiative, never its summary
206
- summary_lines: n.private ? [] : summaryLines(n), ...stateFields(n, now, resumeMs) };
206
+ summary_lines: n.private ? [] : summaryLines(n), came: n.private ? null : cameOf(n), ...stateFields(n, now, resumeMs) };
207
+ }
208
+ /** What came out of a meeting (Library's "Came out of it", initiative library-place): the decisions and tasks among the agent's bullets. */
209
+ function cameOf(n) {
210
+ const b = (n.bullets || []).filter((x) => x && !x.dropped);
211
+ return { decisions: b.filter((x) => x.cat === 'decision').length, tasks: b.filter((x) => x.cat === 'action').length };
207
212
  }
208
213
  /** The statements of a note that a repository file says otherwise: transcript lines, the agent's bullets and the PM's
209
214
  * highlights whose check verdict is 'differs'. → [{ text, doc, line, t, from }] */
@@ -45,11 +45,13 @@ const MODULES = Object.freeze([
45
45
  'routes-my-work', // initiative my-work: the ranked list of work assigned to the PM, the brief, Read again
46
46
  'routes-intake', // planning-flows run 4: one-line intake draft (drafts only)
47
47
  'routes-pm-items', // planning-flows runs 1-2: the PM's own items and jobs to be done (add, edit, remove, undo)
48
+ 'routes-today-log', // six-place navigation slice 5: Today's log, the PM's own entries and marks (today-log/log.jsonl; page-press POST)
48
49
  'routes-runs', // console3 agent surfaces: runs grouped for the sessions panel, PM answers, corrections
49
50
  'routes-doc-health', // console3 B2: the six document health checks, recomputed from text
50
51
  'routes-outbox', // console3 B3: the outbox queue, hash-bound confirm (no channel connected)
51
52
  'routes-waiting', // home-your-move-waiting: Waiting on others, derived from records, with its exit rule
52
53
  'routes-calendar-views', // console3 C2: Day/Week/Month/Quarter/Year cells, Gantt and the strategy lens (read-only)
54
+ 'routes-events-place', // events-place (nav slice 6): every date PMOS holds, grouped Late / Today / Coming up, and the PM's fixed marks and noes (events/marks.jsonl; page-press POST)
53
55
  'routes-briefing', // console3 C1: the day-part Briefing cards from the signal engine (read-only)
54
56
  'routes-briefing-premium', // briefing-premium: the premium Briefing's page model from repository state (read-only)
55
57
  'routes-my-work-premium', // briefing-premium-work: the premium My work page's model from the Work page's own list (read-only)
@@ -110,7 +112,9 @@ const MODULES = Object.freeze([
110
112
  'routes-report-setups', // report-workspace: recurring reports, the Ask box, the finder, the report documents and their export (report-setups.jsonl)
111
113
  'routes-artefacts', // R18 (D107): the seven artefacts, read-only, and the lossless carry of the older records (artefacts.jsonl)
112
114
  'routes-core-docs', // core-documents: the core documents of each level, Draft it (a core-doc run), Issue it and Drop (core-docs.jsonl)
115
+ 'routes-pop-work', // popup-work-contents (slice 3): the summary of an initiative changed or confirmed in place (initiative-writer setDescription; page-press POST)
113
116
  'routes-custom-docs', // briefing-premium-adddoc: the documents the PM adds beyond the core set, Add a document (custom-docs.jsonl)
117
+ 'routes-library', // library-place (slice 7 of the six-place navigation): GET /api/library-items, what was made, every product (read only)
114
118
  'routes-premium-dashboards', // briefing-premium-reports: the dashboards the PM makes on premium Insights (premium-dashboards.jsonl; page-press POST save)
115
119
  'routes-board-metric-targets', // briefing-premium-metrics option C: the targets of the Board's four measures, set on premium Insights (board-metric-targets.jsonl; page-press POST save)
116
120
  'routes-insights-records', // premium-agreed-design: Insights' New goal, steps, dashboards with their charts, Save chart, describe, verdicts, tile targets, Export (insights-records.jsonl, kr-metrics.jsonl)