create-pmos 0.456.0 → 0.457.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.
@@ -142,10 +142,33 @@ const put = (root, rel, text) => { fs.mkdirSync(path.dirname(path.join(root, rel
142
142
  await until(() => pg.evaluate(() => !document.querySelector('#evSettings:not([hidden])')));
143
143
  await menu(pg); await pg.click('#czMenu [data-cz-settings]');
144
144
  const st = await until(() => pg.evaluate(() => { const d = document.querySelector('#evSettings:not([hidden])'); return d ? { nav: [...d.querySelectorAll('[data-ev-sec]')].map((a) => a.textContent.replace(/\d+$/, '').trim()), h: (d.querySelector('#evStTitle') || {}).textContent, t: d.textContent } : null; }));
145
- ok('R2 Settings opens on General (or Connectors while a source is stale), with Connectors, Workspaces, Updates and What\'s new', !!st && st.h === (stale ? 'Connectors' : 'General') && ['General', 'Connectors', 'Workspaces', 'Updates', 'What\'s new'].every((k) => st.nav.some((n) => n.startsWith(k))) && (stale || /Theme/.test(st.t)), JSON.stringify(st && { nav: st.nav, h: st.h }));
145
+ ok('R2 Settings opens on General (or Connectors while a source is stale), with Connectors, Workspaces and Updates, and no What\'s new of its own', !!st && st.h === (stale ? 'Connectors' : 'General') && ['General', 'Connectors', 'Workspaces', 'Updates'].every((k) => st.nav.some((n) => n.startsWith(k))) && !st.nav.some((n) => /What/.test(n)) && (stale || /Theme/.test(st.t)), JSON.stringify(st && { nav: st.nav, h: st.h }));
146
146
  await snap(pg, 'settings-1440-light');
147
147
  await pg.click('#evSettings [data-ev-sec="workspaces"]');
148
148
  ok('R2 Workspaces lists the product', !!(await until(() => pg.evaluate(() => /EVPROD/.test(document.querySelector('#evSettings').textContent)))));
149
+ /* W2: Settings › Updates checks on open, shows what's new by week, and installs without a second question (stubbed kit routes; nothing reaches npm) */
150
+ const hits = { check: 0, update: 0, upgrade: 0 };
151
+ const day = (n) => new Date(Date.now() - n * 864e5).toISOString();
152
+ await pg.route('**/api/kit/status*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, app: { version: '0.442.0' }, kit: { present: true, version: '0.442.0' }, latest: '0.451.0', appBehind: true, kitBehind: true, checkDaily: true,
153
+ changes: [{ v: '0.451.0', at: day(0), prs: [{ n: 1098, t: 'Claude settings', s: 'Settings has a Claude section.', k: 'new' }, { n: 1100, t: 'Hide linked worktrees', s: 'They no longer show as repositories.', k: 'fix' }] }, { v: '0.441.0', at: day(8), prs: [{ n: 1078, t: 'Ready-made dashboards', s: 'Every program has one.', k: 'new' }] }] }) }));
154
+ await pg.route('**/api/kit/check', (r) => { hits.check++; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, latest: '0.451.0', appBehind: true, kitBehind: true, latestChanges: [] }) }); });
155
+ await pg.route('**/api/kit/update', (r) => { hits.update++; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true }) }); });
156
+ await pg.route('**/api/kit/upgrade-app', (r) => { hits.upgrade++; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: false, error: 'stubbed: not installing' }) }); });
157
+ await pg.keyboard.press('Escape'); await until(() => pg.evaluate(() => !document.querySelector('#evSettings:not([hidden])')));
158
+ await menu(pg); await pg.click('#czMenu [data-cz-settings]'); await pg.waitForSelector('#evSettings:not([hidden])'); // reopen: the routes above answer the status read
159
+ await pg.click('#evSettings [data-ev-sec="updates"]');
160
+ const wk = await until(() => pg.evaluate(() => { const d = document.querySelector('#evSettings'); const h = d.querySelector('.ev-wkh'); return h ? { head: h.textContent, groups: [...d.querySelectorAll('.ev-wk > .ev-wkm .ev-wgl')].map((x) => x.textContent), t: d.querySelector('.ev-wk > .ev-wkm').textContent, arc: !!d.querySelector('[data-ev-arc][aria-expanded="false"]'), rows: d.querySelectorAll('[data-ev-wk]').length } : null; }), 20000);
161
+ const first = await (async () => { await sleep(800); return hits.check; })();
162
+ await pg.click('#evSettings [data-ev-sec="general"]'); await pg.click('#evSettings [data-ev-sec="updates"]'); await sleep(500);
163
+ ok('W2 opening Updates asks for the latest kit by itself (one read for each workspace), and only once while Settings stays open', first >= 1 && hits.check === first, JSON.stringify(hits));
164
+ ok('W2 what\'s new shows this week open: New and Fixed groups, no empty Improved group, the earlier week folded in a closed Archive', !!wk && /^This week/.test(wk.head) && wk.groups.join() === 'New,Fixed' && /Claude settings\./.test(wk.t) && /#1100/.test(wk.t) && wk.arc && wk.rows === 0, JSON.stringify(wk));
165
+ await pg.click('#evSettings [data-ev-arc]'); await pg.click('#evSettings [data-ev-wk]');
166
+ ok('W2 the Archive opens to the earlier weeks, and a week opens on press', !!(await until(() => pg.evaluate(() => /Ready-made dashboards\./.test(document.querySelector('#evSettings').textContent)))));
167
+ await snap(pg, 'updates-1440-light');
168
+ await pg.click('#evSettings [data-ev-upd="update"]');
169
+ await until(() => hits.upgrade > 0, 8000);
170
+ ok('W2 Update installs at once: the kit and the app are posted with no Restart and update step', hits.update >= 1 && hits.upgrade === 1 && !(await pg.evaluate(() => /Restart and update/.test(document.querySelector('#evSettings').textContent))), JSON.stringify(hits));
171
+ await pg.unroute('**/api/kit/status*'); await pg.unroute('**/api/kit/check'); await pg.unroute('**/api/kit/update'); await pg.unroute('**/api/kit/upgrade-app');
149
172
  await pg.keyboard.press('Escape');
150
173
  ok('R2 Escape closes Settings', !!(await until(() => pg.evaluate(() => !document.querySelector('#evSettings:not([hidden])')))));
151
174
 
@@ -36,7 +36,7 @@ Settings is not a tab. While it is open, no tab is selected. Press a tab to go b
36
36
  | Privacy and data | A list of what leaves this computer and when. Whether a TypeSafe key is saved, the local model that answers when there is no key (Off, Winnow or Laya), and the data folder. |
37
37
  | Appearance | The theme (Same as system, Light or Dark) and the page that opens first. |
38
38
  | Claude | The Claude profile that new Claude sessions start with, and the Anthropic API key for Claude's own runs on the API (see below). |
39
- | Updates | The version of the app and of each workspace's kit. Check for updates, and how updates are found and applied. |
39
+ | Updates | The version of the app and of each workspace's kit, the check for updates, and what changed in each week's kits (what's new). See below. |
40
40
 
41
41
  Type in **Search settings** to find a setting in any section. Press **Open section** to go to its section.
42
42
 
@@ -58,12 +58,22 @@ Some rows show a feature that PMOS does not have yet, such as choosing calendars
58
58
 
59
59
  ## Update PMOS and the kit
60
60
 
61
- Open **Updates** and press **Check now**. PMOS asks the npm registry for the latest version only when you press it.
61
+ Open **Updates**. PMOS asks the npm registry for the latest version at once, and the card says if a newer one is ready. **Check now** asks again. PMOS also checks once a day while a page is open. To check only when you press **Check now**, set the update check to press (the `upd.check` setting, or `PMOS_UPDATE_CHECK=press`).
62
62
 
63
- - **Update to** a version on the **PMOS app** row updates the app. The row asks first: press **Restart and update**, or **Cancel**. PMOS stops, installs the new version, and starts again. Open terminals keep running. The page that you are on reloads when the new version starts. PMOS does not open a new tab. If the update is refused, or PMOS starts again on the old version, or PMOS does not come back, the row says so and names the update log.
63
+ - **Update to** a version on the **PMOS app** row updates the app. Press **Update** (or **Restart to update**) and PMOS starts at once, with no second question. PMOS stops, installs the new version, and starts again. Open terminals keep running. The page that you are on reloads when the new version starts. PMOS does not open a new tab. If the update is refused, or PMOS starts again on the old version, or PMOS does not come back, the row says so and names the update log.
64
64
  - When PMOS runs from a PMOS checkout, the row says to update it with `git pull`. There is no Update button.
65
65
  - **Update** on a workspace row updates the kit in that repository. It replaces the kit files in its `pmos/` folder (AGENTS.md, skills, scripts, templates, `okf/core`, the mod and KIT-VERSION). It does not change `state/`, `planning/` or `okf/product/`, and it does not commit. Review the change in the repository as a normal pull request.
66
66
 
67
+ ### What's new
68
+
69
+ Under the update card, **Updates** shows what changed in the published kits. **This week** is open: it is the one you need. A week runs Monday to Sunday. Every earlier week, last week included, is folded into **Archive**. Press **Archive** to list the earlier weeks (**Week of** a date), each with its counts, and press a week to read it. When there is nothing for this week yet, the newest week with changes is the open one.
70
+
71
+ - Each week has up to three groups: **New** (a feature), **Improved** (a faster or better thing that already existed) and **Fixed** (a problem that is gone). A group with nothing in it is not shown, and a week with nothing to show is not listed.
72
+ - Each line is a bold name and one sentence, copied from the pull request that made the change, with its number at the end. Work that you cannot see in PMOS (notes, tests, run logs) is left out.
73
+ - A week shows **Ready to install** when one of its kits is newer than the version you run.
74
+ - A kit published before PMOS kept the kind of each change has no kind. Its title decides: a word such as "fix" or "no longer" puts it under **Fixed**, and anything else under **Improved**.
75
+ - **What's new** is not a section of its own any more. The button on the update card in **General** opens **Updates**.
76
+
67
77
  ## Claude: the profile and the API key
68
78
 
69
79
  **Claude profile.** Pick one of the profiles on this computer, or **No profile**. New Claude sessions start with it. The list comes from the profile files in `~/.claude/profiles/`.
@@ -30,7 +30,7 @@
30
30
  * newer kits' entries in the same `npm view` call, so the page can say what an update brings before it runs.
31
31
  *
32
32
  * NETWORK. These are the workspace's only egress to the npm registry. No HTTP client is opened here: npm and npx open
33
- * their own. Every call is reached only from a POST the page sends when the PM presses a button (server.js
33
+ * their own. Every call is reached only from a POST the page sends: when the PM presses a button, or when the PM opens Updates (unless upd.check is press) (server.js
34
34
  * /api/kit/check, /api/kit/update, /api/kit/upgrade-app); no timer and no GET reaches them. no-network.test.js holds
35
35
  * that.
36
36
  */
@@ -107,7 +107,7 @@ const DEFS = Object.freeze({
107
107
  * shows; `off` is the value that turns the thing off, or null when any value wins. */
108
108
  const ENV = Object.freeze([
109
109
  { key: 'notes.language', env: 'PMOS_WHISPER_LANG', off: null, effect: 'Every line is transcribed in this language, whatever the picker says.' },
110
- { key: 'upd.check', env: 'PMOS_UPDATE_CHECK', off: 'press', effect: 'Updates are checked only when you press Check on this computer.' },
110
+ { key: 'upd.check', env: 'PMOS_UPDATE_CHECK', off: 'press', effect: 'Updates are checked only when you press Check now on this computer, not when you open Updates.' },
111
111
  { key: 'rec.echo', env: 'PMOS_NOTES_ECHO', off: 'off', effect: 'Echo removal is off on this computer.' },
112
112
  { key: 'rec.final', env: 'PMOS_NOTES_FINAL', off: 'off', effect: 'The pass after Stop is off on this computer.' },
113
113
  { key: 'notes.wispr', env: 'PMOS_NOTES_WISPR', off: 'off', effect: 'Wispr Flow notes are not fetched on this computer.' },
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.456.0",
3
+ "version": "0.457.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.456.0",
9
+ "version": "0.457.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.456.0",
3
+ "version": "0.457.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",
@@ -217,14 +217,30 @@
217
217
  .ev-st .ev-ad { display: inline-flex; align-items: center; flex: none; }
218
218
  .ev-st .ev-say.honest { display: flex; align-items: center; gap: 8px; }
219
219
  .ev-st .ev-upd p { flex: 1; margin: 0; }
220
+ .ev-st .ev-upd.first { margin-top: 0; }
220
221
  .ev-st .ev-sw { height: 28px; min-width: 52px; border-radius: 999px; border: 0; background: var(--cz-well2); color: var(--cz-ink3); font: inherit; font-size: var(--fs-2); font-weight: 700; cursor: pointer; }
221
222
  .ev-st .ev-sw[aria-checked="true"] { background: var(--cz-bluebg); color: var(--cz-blueink); }
222
223
  .ev-st .ev-add { display: flex; gap: 8px; margin-top: 8px; }
223
- .ev-st .ev-kv { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
224
- .ev-st .ev-kv li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--cz-hair); }
225
- .ev-st .ev-kv li b { width: 64px; flex: none; }
226
- .ev-st .ev-kv li .ev-tx p { margin: 0 0 2px; font-size: var(--fs-2); color: var(--cz-ink2); }
227
224
  .ev-st [role="status"] { min-height: 1.2em; margin: 0; font-size: var(--fs-2); color: var(--cz-ink3); }
225
+ /* Updates › what's new: this week open, the earlier weeks folded into an Archive */
226
+ .ev-st .ev-wk { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--cz-hair); }
227
+ .ev-st .ev-wkh { display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
228
+ .ev-st .ev-wkh b { font-size: var(--fs-4); font-weight: 800; }
229
+ .ev-st .ev-wkm { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
230
+ .ev-st .ev-wg { display: flex; flex-direction: column; gap: 6px; }
231
+ .ev-st .ev-wgl { display: flex; align-items: center; gap: 8px; font-size: var(--fs-1); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--cz-ink2); }
232
+ .ev-st .ev-wi { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
233
+ .ev-st .ev-wi li { font-size: var(--fs-3); line-height: 1.5; color: var(--cz-ink2); max-width: 68ch; overflow-wrap: anywhere; }
234
+ .ev-st .ev-wi li b { color: var(--cz-ink); font-weight: 700; }
235
+ .ev-st .ev-pr { font-size: var(--fs-1); font-variant-numeric: tabular-nums; }
236
+ .ev-st .ev-arc { display: flex; flex-direction: column; border-top: 1px solid var(--cz-hair); }
237
+ .ev-st .ev-arcb, .ev-st .ev-wkt { display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; width: 100%; min-height: 44px; padding: 10px 0; border: 0; background: none; font: inherit; color: var(--cz-ink); text-align: left; cursor: pointer; }
238
+ .ev-st .ev-arcb svg, .ev-st .ev-wkt svg { margin-left: auto; align-self: center; fill: none; stroke: currentColor; stroke-width: 2; color: var(--cz-ink3); transition: transform .15s; }
239
+ .ev-st .ev-arcb[aria-expanded="true"] svg, .ev-st .ev-wkt[aria-expanded="true"] svg { transform: rotate(180deg); }
240
+ .ev-st .ev-wkr { display: flex; flex-direction: column; gap: 12px; padding-bottom: 12px; border-top: 1px solid var(--cz-hair); }
241
+ .ev-st .ev-wkr .ev-wkm { padding: 0 0 4px; }
242
+ .ev-st .ev-wkt .ev-tl { margin-right: 8px; }
243
+ @media (prefers-reduced-motion: reduce) { .ev-st .ev-arcb svg, .ev-st .ev-wkt svg { transition: none; } }
228
244
  @media (max-width: 760px) {
229
245
  .ev-st { left: 0; top: 0; transform: none; width: 100vw; height: 100%; border-radius: 0; flex-direction: column; }
230
246
  .ev-st-nav { width: auto; flex-direction: row; overflow-x: auto; padding: 14px 12px 8px; gap: 4px; scrollbar-width: none; }
@@ -233,6 +249,7 @@
233
249
  .ev-st-main { padding: 16px 16px 32px; }
234
250
  .ev-st .ev-trow { flex-wrap: wrap; }
235
251
  .ev-st .ev-upd { flex-wrap: wrap; }
252
+ .ev-st .ev-upd .ev-tx { flex: 1 1 180px; }
236
253
  .ev-st .ev-sw, .ev-st .ev-pick, .ev-st select.ev-inp, .ev-st input.ev-inp { min-height: 44px; font-size: var(--fs-4); }
237
254
  .ev-st .ev-seg button { min-height: 40px; }
238
255
  }
@@ -13,8 +13,9 @@
13
13
  * /api/proactive/settings)
14
14
  * Workspaces the repositories PMOS works in (GET and POST /api/workspaces, POST /api/workspaces/forget; the folder is never touched)
15
15
  * Workflows a link to its own page, /premium-workflows.html (pm/wf-page.js, D99): the stages each kind of initiative goes through
16
- * Updates the versions and Check now, Update, Restart to update (GET /api/kit/status, POST /api/kit/check | update | upgrade-app)
17
- * What's new what each published kit changed, newest first (the kit status's changelog lines)
16
+ * Updates the versions and Check now, Update, Restart to update (GET /api/kit/status, POST /api/kit/check | update | upgrade-app); opening it
17
+ * asks for the latest kit. Under it, what's new: the published kits grouped by week as New, Improved and Fixed, this week open and every earlier
18
+ * week folded into an Archive (pm/upd-weeks.js). It was a section of its own, What's new.
18
19
  * Adler's moments (batch 17 item 4-B, AdM4): one face per section, where Claude speaks. Updates: glasses while it checks or installs,
19
20
  * holding the card when a version is ready, calm when up to date. General: holding the update card, else the Jira promise (only after
20
21
  * Commit). A failure in the status line takes the honest face, and then the section's face steps back (one Adler per screen).
@@ -27,17 +28,18 @@ import { esc, svg, ICON, toast, wsParam, wsQ } from './cozy-evui.js';
27
28
  import { sourceRows, staleOf, partsOf } from './cozy-evmodel.js';
28
29
  import * as AD from './cozy-adler.js';
29
30
  import * as SE from './cozy-seasons.js';
31
+ import { weeksOf, lineOf, KINDS } from './upd-weeks.js';
30
32
 
31
33
  /** PUT or DELETE with the page's launch nonce (pressFetch). Only the key row needs them. */
32
34
  async function pmSend(method, path, body) {
33
35
  try { const res = await pressFetch(path, { method, ...(body === undefined ? {} : { body: JSON.stringify(body) }) }); const out = await res.json(); if (out && typeof out === 'object' && !res.ok) out.status = res.status; return out; }
34
36
  catch (e) { return { ok: false, error: 'could not reach the workspace server — ' + ((e && e.message) || String(e)) }; }
35
37
  }
36
- const SECTIONS = [['general', 'General'], ['claude', 'Claude'], ['adler', 'Adler'], ['connectors', 'Connectors'], ['workspaces', 'Workspaces'], ['workflows', 'Workflows'], ['updates', 'Updates'], ['whatsnew', "What's new"]];
38
+ const SECTIONS = [['general', 'General'], ['claude', 'Claude'], ['adler', 'Adler'], ['connectors', 'Connectors'], ['workspaces', 'Workspaces'], ['workflows', 'Workflows'], ['updates', 'Updates']];
37
39
  const PAGE_LINKS = { workflows: '/premium-workflows.html' }; // a section that is a page of its own: the row goes there
38
40
  const SRC = { calendar: 'Calendar', wispr: 'Wispr Flow', mail: 'Mail', slack: 'Slack', jira: 'Jira', confluence: 'Confluence', github: 'GitHub', drive: 'Google Drive', figma: 'Figma', website: 'Your websites' };
39
41
  const VIEWER_KEY = 'pmos.cz.viewer';
40
- const T = { el: null, sec: 'general', ws: null, st: {}, src: null, con: {}, conn: [], set: null, prods: null, msg: '', busy: false, phase: '', say: '', back: null, fresh: null, reading: '', note: {}, lines: null, dress: false, more: false, bday: false, dset: {} };
42
+ const T = { el: null, sec: 'general', ws: null, st: {}, src: null, con: {}, conn: [], set: null, prods: null, msg: '', busy: false, phase: '', say: '', back: null, fresh: null, reading: '', note: {}, lines: null, dress: false, more: false, bday: false, dset: {}, wkOpen: new Set(), arc: false };
41
43
  const cmpVer = (a, b) => { const x = String(a || '0').split('-')[0].split('.').map(Number), y = String(b || '0').split('-')[0].split('.').map(Number); for (let i = 0; i < 3; i++) if ((x[i] || 0) !== (y[i] || 0)) return (x[i] || 0) < (y[i] || 0) ? -1 : 1; return 0; };
42
44
  const home = () => (T.ws && T.ws[0] ? T.st[T.ws[0].id] : null);
43
45
  const latest = () => { const s = home(); return (s && (s.latest || (s.lastCheck && s.lastCheck.latest))) || null; };
@@ -67,7 +69,7 @@ function general() {
67
69
  const pname = !P ? 'Reading' : !P.length ? 'No product' : on.length === 1 ? on[0].name : on.length + ' of ' + P.length + ' products';
68
70
  const we = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((x) => x.key === 'time.workEnd') : null, end = we ? Number(we.value) : 18;
69
71
  const hours = []; for (let h = 13; h <= 23; h++) hours.push(h);
70
- const upd = ready() ? `<div class="ev-card ev-upd">${adFace('needs-you')}<span class="ev-pill y">Update</span><p><b>PMOS ${esc(latest())} is ready.</b> <span class="ev-mut">${esc(firstLine())}</span></p><button type="button" class="ev-btn sm" data-ev-go="whatsnew">What's new</button><button type="button" class="ev-btn sm dark" data-ev-upd="update">${appBehind() ? 'Restart to update' : 'Update'}</button></div>` : '';
72
+ const upd = ready() ? `<div class="ev-card ev-upd">${adFace('needs-you')}<span class="ev-pill y">Update</span><p><b>PMOS ${esc(latest())} is ready.</b> <span class="ev-mut">${esc(firstLine())}</span></p><button type="button" class="ev-btn sm" data-ev-go="updates">What's new</button><button type="button" class="ev-btn sm dark" data-ev-upd="update">${appBehind() ? 'Restart to update' : 'Update'}</button></div>` : '';
71
73
  return trow('Theme', 'Auto follows your computer', seg('Theme', 'theme', theme, [['light', 'Light'], ['dark', 'Dark'], ['auto', 'Auto']]))
72
74
  + trow('Viewer opens as', 'A column beside the chat, or a popup over it', seg('Viewer opens as', 'viewer', vw, [['column', 'Column'], ['popup', 'Popup']]))
73
75
  + trow('Product', 'Which products Home, Board and Intelligence read', `<button type="button" class="ev-pick" data-ev-products aria-haspopup="menu">${esc(pname)} ${svg(ICON.down, 14)}</button>`)
@@ -199,16 +201,29 @@ function updates() {
199
201
  : ready() ? `<b>PMOS ${esc(L)} is ready</b><p class="ev-small ev-mut">You have ${esc(app)}.${appBehind() ? ' PMOS stops for about a minute while it installs. Open terminals keep running.' : ''}</p>`
200
202
  : L ? `<b>PMOS ${esc(app)} is up to date</b><p class="ev-small ev-mut">${fromGit() && s.appBehind ? esc(L) + ' is published. This PMOS runs from a checkout: update it with git pull.' : 'The newest published kit is ' + esc(L) + '.'}</p>`
201
203
  : `<b>PMOS ${esc(app)}</b><p class="ev-small ev-mut">Press Check now to ask for the latest version.</p>`;
202
- const acts = T.phase === 'busy' ? '' : T.phase === 'confirm' ? '<button type="button" class="ev-btn sm" data-ev-upd="cancel">Cancel</button><button type="button" class="ev-btn sm dark" data-ev-upd="go">Restart and update</button>'
203
- : `<button type="button" class="ev-btn sm" data-ev-upd="check"${T.busy ? ' disabled' : ''}>Check now</button>${ready() ? `<button type="button" class="ev-btn sm dark" data-ev-upd="update">${appBehind() ? 'Restart to update' : 'Update'}</button>` : ''}`;
204
+ const acts = T.phase === 'busy' ? '' : `<button type="button" class="ev-btn sm" data-ev-upd="check"${T.busy ? ' disabled' : ''}>Check now</button>${ready() ? `<button type="button" class="ev-btn sm dark" data-ev-upd="update">${appBehind() ? 'Restart to update' : 'Update'}</button>` : ''}`;
204
205
  const kits = (T.ws || []).map((w) => { const k = T.st[w.id], kit = k && k.kit; return trow(w.label || w.name || w.id, kit && kit.present ? 'kit ' + (kit.version || 'vendored by hand') : 'no kit in this workspace', k && k.kitBehind && L ? `<span class="ev-pill y">${esc(L)} ready</span>` : kit && kit.present && (k.lastCheck || k.latest) ? '<span class="ev-pill ok">Up to date</span>' : ''); }).join('');
205
206
  const last = s.lastCheck ? 'Last checked ' + new Date(s.lastCheck.at).toLocaleString() + '. ' : '';
206
- return `<div class="ev-card ev-upd">${mood ? adFace(mood) : ''}<div class="ev-tx ev-grow">${head}</div>${acts}</div>${kits}<p class="ev-small ev-mut">${esc(last)}${s.checkDaily ? 'PMOS checks once a day while a page is open; Check now asks again.' : 'PMOS checks only when you press Check now.'}</p>`;
207
+ return `<div class="ev-card ev-upd first">${mood ? adFace(mood) : ''}<div class="ev-tx ev-grow">${head}</div>${acts}</div>${kits}<p class="ev-small ev-mut">${esc(last)}${s.checkDaily ? 'PMOS checks when you open Updates and once a day while a page is open; Check now asks again.' : 'PMOS checks only when you press Check now.'}</p>${weeks()}`;
207
208
  }
208
- function whatsnew() {
209
- const L = changes(), s = home(), mine = s && s.app && !fromGit() ? s.app.version : null;
210
- if (!L.length) return '<p class="ev-small ev-mut">No kit summaries yet. Each kit published from now on carries one, and Check now reads the newest ones.</p>';
211
- return `<ul class="ev-kv">${L.slice(0, 40).map((e) => `<li><b>${esc(e.v)}</b><div class="ev-tx">${mine && e.v === mine ? '<span class="ev-pill">Yours</span> ' : mine && cmpVer(e.v, mine) > 0 ? '<span class="ev-pill y">Newer</span> ' : ''}${(e.prs || []).map((p) => `<p>${esc(p.t && p.t !== p.s ? p.t + ': ' + p.s : p.s)}${p.n ? ' <span class="ev-mut">#' + esc(p.n) + '</span>' : ''}</p>`).join('') || '<p class="ev-mut">No summary was recorded for this kit.</p>'}</div></li>`).join('')}</ul>`;
209
+ /** One week: its name and dates, then New, Improved and Fixed with a line for each published PR. */
210
+ function weekBody(w) {
211
+ const dot = { new: 'you', imp: 'ok', fix: 'risk' };
212
+ const grp = KINDS.filter(([k]) => w.groups[k].length).map(([k, label]) => `<div class="ev-wg"><div class="ev-wgl"><i class="ev-dot ${dot[k]}"></i>${label}</div><ul class="ev-wi">${w.groups[k].map((p) => { const x = lineOf(p); return `<li>${x.b ? `<b>${esc(x.b)}${/[.!?]$/.test(x.b) ? '' : '.'}</b> ` : ''}${esc(x.s)}${p.n ? ` <span class="ev-mut ev-pr">#${esc(p.n)}</span>` : ''}</li>`; }).join('')}</ul></div>`).join('');
213
+ return `<div class="ev-wkm">${grp}</div>`;
214
+ }
215
+ const kitsOf = (w) => (w.kits[0] === w.kits[1] ? w.kits[0] : w.kits[0] + ' – ' + w.kits[1]);
216
+ /** What's new, under the update card: this week (the newest week) open, and every earlier week folded into the Archive. */
217
+ function weeks() {
218
+ const s = home(), mine = s && s.app && !fromGit() ? s.app.version : null;
219
+ const W = weeksOf(changes(), Date.now(), mine);
220
+ if (!W.length) return '<p class="ev-small ev-mut">No kit summaries yet. Each kit published from now on carries one, and Check now reads the newest ones.</p>';
221
+ const [w, ...old] = W.slice(0, 13);
222
+ const head = (x) => `<div class="ev-wkh"><b>${esc(x.name)}</b><span class="ev-small ev-mut">${esc(x.range)} · kits ${esc(kitsOf(x))}</span>${x.newer ? '<span class="ev-pill y">Ready to install</span>' : ''}</div>`;
223
+ const tally = (x) => [['new', 'new'], ['imp', 'improved'], ['fix', 'fixed']].filter(([k]) => x.groups[k].length).map(([k, l]) => x.groups[k].length + ' ' + l).join(' · ');
224
+ const rows = old.map((x) => { const on = T.wkOpen.has(x.key); return `<div class="ev-wkr"><button type="button" class="ev-wkt" data-ev-wk="${esc(x.key)}" aria-expanded="${on}"><b>${esc(x.name)}</b><span class="ev-small ev-mut">${esc(x.range)}</span><span class="ev-small ev-mut ev-tl">${esc(tally(x))}</span>${svg(ICON.down, 14)}</button>${on ? weekBody(x) : ''}</div>`; }).join('');
225
+ const arc = old.length ? `<div class="ev-arc"><button type="button" class="ev-arcb" data-ev-arc aria-expanded="${T.arc}"><b>Archive</b><span class="ev-small ev-mut">${old.length} earlier ${old.length === 1 ? 'week' : 'weeks'}</span>${svg(ICON.down, 14)}</button>${T.arc ? rows : ''}</div>` : '';
226
+ return `<div class="ev-wk">${head(w)}${weekBody(w)}${arc}</div>`;
212
227
  }
213
228
  /* Settings > Claude: which Claude profile PMOS starts Claude sessions with, and the API key for Claude's own runs (D101).
214
229
  * The key is typed here and goes to this computer only; the page never gets it back, only whether one is set and where from. */
@@ -226,7 +241,7 @@ function claudeSec() {
226
241
  + trow('API key', keySub, keyRight)
227
242
  + (k.present && C.off ? trow('Runs on the API', 'Off: PMOS_GRILL_API is off in the environment.', '<span class="ev-pill">Off</span>') : '');
228
243
  }
229
- const BODY = { general, claude: claudeSec, adler: adlerSec, connectors, workspaces, updates, whatsnew };
244
+ const BODY = { general, claude: claudeSec, adler: adlerSec, connectors, workspaces, updates };
230
245
  function draw() {
231
246
  const el = T.el; if (!el || el.hidden) return;
232
247
  // a redraw replaces the nodes: keep focus on the same control (by its data-ev-* key), else on the open section, never on the body
@@ -238,6 +253,7 @@ function draw() {
238
253
  const all = T.sec === 'connectors' ? `<button type="button" class="ev-ib" data-ev-readall aria-label="Read every source again" title="Read all again"${T.reading ? ' disabled' : ''}>${svg(RD, 18)}</button>` : '';
239
254
  el.querySelector('.ev-st-main').innerHTML = staleHtml() + `<div class="ev-top"><h3 class="ev-h2" id="evStTitle">${esc(label)}</h3>${all}<button type="button" class="ev-ib" data-ev-close aria-label="Close settings" title="Close settings">${svg(ICON.close, 18)}</button></div>`
240
255
  + BODY[T.sec]() + `<p role="status"${T.msg && AD.moodOfText(T.msg) === 'honest' ? ' class="ev-say honest"' : ''}>${T.msg && AD.moodOfText(T.msg) === 'honest' ? AD.adler('honest', 24, { label: false }) : ''}${esc(T.msg)}</p>`;
256
+ const cur = el.querySelector('.ev-st-nav [aria-current="page"]'); if (cur && cur.scrollIntoView) cur.scrollIntoView({ block: 'nearest', inline: 'nearest' }); // on a phone the section row scrolls: keep the open one in view
241
257
  if (had && !ae.isConnected) { const f = (key && el.querySelector(`[${key.name}="${CSS.escape(key.value)}"]`)) || el.querySelector('[aria-current="page"]'); if (f) f.focus(); }
242
258
  }
243
259
  function mount() {
@@ -272,8 +288,10 @@ function mount() {
272
288
  }
273
289
  async function press(e) {
274
290
  const t = e.target.closest('a[data-ev-sec], button'); if (!t) return;
275
- if (t.dataset.evSec) { e.preventDefault(); T.sec = t.dataset.evSec; T.msg = ''; T.dress = false; draw(); const f = T.el.querySelector(`[data-ev-sec="${T.sec}"]`); if (f) f.focus(); return; }
291
+ if (t.dataset.evSec) { e.preventDefault(); T.sec = t.dataset.evSec; T.msg = ''; T.dress = false; draw(); const f = T.el.querySelector(`[data-ev-sec="${T.sec}"]`); if (f) f.focus(); openCheck(); return; }
276
292
  if ('evClose' in t.dataset) { closeSettings(); return; }
293
+ if (t.dataset.evWk) { const k = t.dataset.evWk; if (T.wkOpen.has(k)) T.wkOpen.delete(k); else T.wkOpen.add(k); draw(); return; }
294
+ if ('evArc' in t.dataset) { T.arc = !T.arc; draw(); return; }
277
295
  if (t.dataset.evGo) { T.sec = t.dataset.evGo; draw(); return; }
278
296
  if (t.dataset.evSeg === 'theme') { const M = await import('./cozy-nav.js'); M.setTheme(t.dataset.v); draw(); return; }
279
297
  if (t.dataset.evSeg && t.dataset.evSeg.startsWith('adler.')) { const r = await AD.savePref(pmPost, t.dataset.evSeg, t.dataset.v); T.msg = r && r.ok ? 'Saved.' : (r && r.error) || 'Not saved.'; draw(); return; }
@@ -325,17 +343,22 @@ async function press(e) {
325
343
  } finally { T.busy = false; }
326
344
  draw();
327
345
  }
328
- async function upd(a) {
329
- if (a === 'cancel') { T.phase = ''; return; }
346
+ /** Opening Updates asks for the latest kit once per open, unless Settings turned the automatic check off (upd.check = press). */
347
+ async function openCheck() {
348
+ const s = home();
349
+ if (T.sec !== 'updates' || T.auto || !T.ws || !s || !s.checkDaily || T.checking || T.phase === 'busy') return;
350
+ T.auto = true;
351
+ await upd('check', true); draw();
352
+ }
353
+ async function upd(a, quiet) {
330
354
  if (a === 'check') {
331
355
  T.checking = true; T.msg = ''; draw();
332
356
  try {
333
357
  for (const w of T.ws || []) { const r = await pmPost('/api/kit/check', { ws: w.id }); if (r && r.ok) T.st[w.id] = { ...(T.st[w.id] || {}), ...r }; else T.msg = (r && r.error) || 'The check failed.'; }
334
358
  } finally { T.checking = false; }
335
- if (!T.msg) toast(ready() ? 'PMOS ' + latest() + ' is ready' : 'Checked. PMOS is up to date');
359
+ if (!T.msg && !quiet) toast(ready() ? 'PMOS ' + latest() + ' is ready' : 'Checked. PMOS is up to date');
336
360
  return;
337
361
  }
338
- if (a === 'update' && appBehind()) { T.sec = 'updates'; T.phase = 'confirm'; return; }
339
362
  const v = latest(); T.sec = 'updates'; T.phase = 'busy';
340
363
  for (const w of kitsBehind()) {
341
364
  T.say = 'Updating the kit in ' + (w.label || w.name || w.id) + '.'; draw();
@@ -397,11 +420,12 @@ async function load() {
397
420
  draw();
398
421
  await Promise.all(T.ws.map(async (x) => { const r = await pmGet('/api/kit/status?ws=' + encodeURIComponent(x.id)); if (r && r.ok) T.st[x.id] = r; }));
399
422
  draw();
423
+ openCheck();
400
424
  }
401
425
  export function openSettings(section) {
402
426
  const el = mount();
403
427
  if (section === 'dress') { T.sec = 'adler'; T.dress = true; } else if (section && BODY[section]) { T.sec = section; T.dress = false; }
404
- if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.fresh = null; T.note = {}; T.dset = {}; T.cl = null; }
428
+ if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.auto = false; T.wkOpen = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.dset = {}; T.cl = null; }
405
429
  el.hidden = false; document.getElementById('evStScrim').hidden = false; el.setAttribute('data-esc-layer', '');
406
430
  draw();
407
431
  const f = el.querySelector('[aria-current="page"]'); if (f) f.focus();
@@ -5,6 +5,7 @@ import { openChatFile, openWebLink } from './premium-vw-file.js';
5
5
  import { turnsOf } from './chat-context.js';
6
6
  import { chipsHtml, itemOf, openCtx } from './premium-vw-ctx.js';
7
7
  import { lineItems, behindOf, whenRead } from './freshness-words.js';
8
+ import { weeksOf, lineOf, KINDS } from './upd-weeks.js';
8
9
  import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, goalChipHtml, goalViewHtml, goalNow, slashMatches } from './goal-chat.js';
9
10
  import { mdHtml, userHtml, toolLine, webKind } from './chat-md.js';
10
11
  import { splitReport, reportChipHtml, blockSig } from './report-chat.js';
@@ -1126,22 +1127,21 @@ function updDay(iso) {
1126
1127
  return d.toDateString() === t.toDateString() ? 'Today, ' + dm : d.toDateString() === y.toDateString() ? 'Yesterday, ' + dm : DOW[d.getDay()] + ' ' + dm;
1127
1128
  }
1128
1129
  const updTime = (iso) => { const d = iso ? new Date(iso) : null; return d && !isNaN(d) ? pad2(d.getHours()) + ':' + pad2(d.getMinutes()) : ''; };
1130
+ /** One week: New, Improved and Fixed, a line for each published PR. */
1131
+ function updWeek(w) {
1132
+ const dot = { new: 'n', imp: 'i', fix: 'f' };
1133
+ return `<div class="wkm">${KINDS.filter(([k]) => w.groups[k].length).map(([k, label]) => `<div class="wkg"><div class="wkgl"><i class="${dot[k]}"></i>${label}</div><ul>${w.groups[k].map((p) => { const x = lineOf(p); return `<li>${x.b ? `<b>${esc(x.b)}${/[.!?]$/.test(x.b) ? '' : '.'}</b> ` : ''}${esc(x.s)}${p.n ? ` <em>#${esc(p.n)}</em>` : ''}</li>`; }).join('')}</ul></div>`).join('')}</div>`;
1134
+ }
1135
+ /** What's new: this week (the newest week) open, every earlier week folded into the Archive. */
1129
1136
  function updWhatsNew(U) {
1130
- const list = updList(), s = updHome(), mine = s && s.app && !updGit() ? s.app.version : null; // a checkout has no published version
1131
- if (!list.length) return '<p class="note">No kit summaries yet. Each kit published from now on carries one, and Check now reads the newest ones.</p>';
1132
- const days = []; for (const e of list) { const k = updDay(e.at); const g = days[days.length - 1]; if (g && g.k === k) g.e.push(e); else days.push({ k, e: [e] }); }
1133
- return days.map((g, i) => {
1134
- const open = U.open.has(g.k) || (i === 0 && !U.shut.has(g.k)), full = U.full.has(g.k);
1135
- const rows = open ? g.e.slice(0, full ? g.e.length : 5).map((e) => {
1136
- const newer = mine && cmpVer(e.v, mine) > 0, yours = mine && e.v === mine;
1137
- const lines = e.prs.length ? e.prs.map((p) => (p.t && p.t !== p.s
1138
- ? `<p><b>${esc(p.t)}</b>${p.n ? ` <em>#${esc(p.n)}</em>` : ''}<span class="ks">${esc(p.s)}</span></p>`
1139
- : `<p>${esc(p.s)}${p.n ? ` <em>#${esc(p.n)}</em>` : ''}</p>`)).join('') : '<p class="note">No summary was recorded for this kit.</p>';
1140
- return `<li class="kver${newer ? ' new' : ''}"><span class="kv"><b>${esc(e.v)}</b>${yours ? '<i>yours</i>' : newer ? '<i class="nw">newer</i>' : ''}<em>${esc(updTime(e.at))}</em></span><div class="kp">${lines}</div></li>`;
1141
- }).join('') : '';
1142
- const more = open && !full && g.e.length > 5 ? `<button type="button" class="kmore" data-kfull="${esc(g.k)}">Show ${g.e.length - 5} more from ${esc(g.k.split(',')[0])}</button>` : '';
1143
- return `<div class="kday"><button type="button" class="kdh" data-kday="${esc(g.k)}" aria-expanded="${open}"><span>${esc(g.k)}</span><em>${g.e.length} ${g.e.length === 1 ? 'kit' : 'kits'}</em></button>${open ? `<ul class="kvl">${rows}</ul>${more}` : ''}</div>`;
1144
- }).join('');
1137
+ const s = updHome(), mine = s && s.app && !updGit() ? s.app.version : null; // a checkout has no published version
1138
+ const W = weeksOf(updList(), Date.now(), mine);
1139
+ if (!W.length) return '<p class="note">No kit summaries yet. Each kit published from now on carries one, and Check now reads the newest ones.</p>';
1140
+ const [w, ...old] = W.slice(0, 13), kits = (x) => (x.kits[0] === x.kits[1] ? x.kits[0] : x.kits[0] + ' – ' + x.kits[1]);
1141
+ const tally = (x) => [['new', 'new'], ['imp', 'improved'], ['fix', 'fixed']].filter(([k]) => x.groups[k].length).map(([k, l]) => x.groups[k].length + ' ' + l).join(' · ');
1142
+ const rows = old.map((x) => { const on = U.wk.has(x.key); return `<div class="wkr"><button type="button" class="wkt" data-wk="${esc(x.key)}" aria-expanded="${on}"><b>${esc(x.name)}</b><span class="note">${esc(x.range)}</span><span class="note">${esc(tally(x))}</span></button>${on ? updWeek(x) : ''}</div>`; }).join('');
1143
+ const arc = old.length ? `<div class="wka"><button type="button" class="wkt" data-arc aria-expanded="${U.arc}"><b>Archive</b><span class="note">${old.length} earlier ${old.length === 1 ? 'week' : 'weeks'}</span></button>${U.arc ? rows : ''}</div>` : '';
1144
+ return `<div class="wk"><div class="wkh"><b>${esc(w.name)}</b><span class="note">${esc(w.range)} · kits ${esc(kits(w))}</span>${w.newer ? '<b class="updpill">Ready to install</b>' : ''}</div>${updWeek(w)}${arc}</div>`;
1145
1145
  }
1146
1146
  function updBlock(U) {
1147
1147
  const s = updHome();
@@ -1152,14 +1152,14 @@ function updBlock(U) {
1152
1152
  : latest ? `<b>PMOS ${esc(app)} is up to date</b><span class="note">${updGit() && s.appBehind ? esc(latest) + ' is published. This PMOS runs from a checkout: update it with git pull.' : 'The newest published kit is ' + esc(latest) + '.'}</span>`
1153
1153
  : `<b>PMOS ${esc(app)}</b><span class="note">Press Check now to ask for the latest version.</span>`;
1154
1154
  const acts = U.phase === 'busy' ? '' : U.phase === 'confirm'
1155
- ? '<button type="button" class="cta alt" data-upd="cancel">Cancel</button><button type="button" class="cta" data-upd="go">Restart and update</button>'
1155
+ ? ''
1156
1156
  : `<button type="button" class="cta alt" data-upd="check"${U.checking ? ' disabled' : ''}>${U.checking ? 'Checking…' : 'Check now'}</button>${ready ? '<button type="button" class="cta" data-upd="update">Update</button>' : ''}`;
1157
1157
  const rows = UPD.ws.map((w) => { const k = UPD.st[w.id], kit = k && k.kit;
1158
1158
  const tag = !k || !(kit && kit.present) ? '' : k.kitBehind && latest ? `<b class="updpill">${esc(latest)} ready</b>` : k.lastCheck || k.latest ? '<b class="updpill ok">Up to date</b>' : '';
1159
1159
  return `<div class="sr"><span class="sn"><b>${esc(w.label || w.name || w.id)}</b><em>${kit && kit.present ? 'kit ' + esc(kit.version || 'vendored by hand') : 'no kit in this workspace'}${w.root ? ' · ' + esc(w.root) : ''}</em></span>${tag}</div>`; }).join('');
1160
1160
  const last = s.lastCheck ? 'Last checked ' + updDay(s.lastCheck.at).replace(/^Today, .*/, 'today').replace(/^Yesterday, .*/, 'yesterday') + ' at ' + updTime(s.lastCheck.at) + '. ' : '';
1161
1161
  return `<div class="updb"><div class="t">${head}</div><div class="a">${acts}</div></div>${rows}
1162
- <p class="note">${esc(last)}${s.checkDaily ? 'PMOS checks once a day while a page is open; Check now asks again.' : 'PMOS checks only when you press Check now.'}</p>`;
1162
+ <p class="note">${esc(last)}${s.checkDaily ? 'PMOS checks when you open Settings and once a day while a page is open; Check now asks again.' : 'PMOS checks only when you press Check now.'}</p>`;
1163
1163
  }
1164
1164
  /** The app update stops this server and starts a new one: wait for it, then reload (the console's waitForRestart). */
1165
1165
  async function updWaitRestart(from, log, say) {
@@ -1176,7 +1176,7 @@ async function updWaitRestart(from, log, say) {
1176
1176
 
1177
1177
  export async function openSettings() {
1178
1178
  const M = { ws: null, src: null, conn: [], con: {}, err: '', busy: false };
1179
- const U = { phase: null, say: '', checking: false, open: new Set(), shut: new Set(), full: new Set() };
1179
+ const U = { phase: null, say: '', checking: false, wk: new Set(), arc: false };
1180
1180
  const draw = () => {
1181
1181
  const w = M.ws, s = M.src;
1182
1182
  const wsRows = w === null ? '<p class="note">Reading the repositories.</p>' : w.some((x) => !x.linked) ? w.filter((x) => !x.linked).map((x) => `<div class="sr"><span class="sn"><b>${esc(x.label || x.name || x.id)}</b><em>${esc(x.root || '')}${x.home ? ' · home' : ''}</em></span>${x.home ? '' : `<button type="button" class="cta alt" data-rm="${esc(x.id)}">Remove</button>`}</div>`).join('') : '<p class="note">No repository is registered yet.</p>';
@@ -1199,19 +1199,19 @@ export async function openSettings() {
1199
1199
  M.con = p && p.ok && p.settings ? { ...p.settings.connectors } : {}; M.conn = p && p.connectors && Array.isArray(p.connectors.list) ? p.connectors.list : [];
1200
1200
  if (!w || !Array.isArray(w.workspaces)) M.err = 'The repositories could not be read.'; else if (!p || !p.ok) M.err = 'The sources could not be read.';
1201
1201
  draw();
1202
+ const h = updHome();
1203
+ if (h && h.checkDaily && !U.checking) { U.checking = true; draw(); const err = await updCheck(); U.checking = false; if (err) M.err = err; draw(); } // opening Settings asks for the latest kit once
1202
1204
  };
1203
1205
  const say = (t) => { U.phase = null; M.err = t; draw(); };
1204
1206
  $('#oMain').onclick = async (e) => {
1205
1207
  if (M.busy) return;
1206
- const day = e.target.closest('[data-kday]'), full = e.target.closest('[data-kfull]'), up = e.target.closest('[data-upd]');
1207
- if (day) { const k = day.dataset.kday, was = day.getAttribute('aria-expanded') === 'true'; if (was) { U.open.delete(k); U.shut.add(k); } else { U.open.add(k); U.shut.delete(k); } draw(); const b = $(`#oMain [data-kday="${CSS.escape(k)}"]`); if (b) b.focus(); return; }
1208
- if (full) { U.full.add(full.dataset.kfull); draw(); return; }
1208
+ const wkb = e.target.closest('[data-wk]'), arcb = e.target.closest('[data-arc]'), up = e.target.closest('[data-upd]');
1209
+ if (wkb) { const k = wkb.dataset.wk; if (U.wk.has(k)) U.wk.delete(k); else U.wk.add(k); draw(); const b = $(`#oMain [data-wk="${CSS.escape(k)}"]`); if (b) b.focus(); return; }
1210
+ if (arcb) { U.arc = !U.arc; draw(); const b = $('#oMain [data-arc]'); if (b) b.focus(); return; }
1209
1211
  if (up) {
1210
1212
  const a = up.dataset.upd; M.err = '';
1211
1213
  if (a === 'check') { U.checking = true; draw(); const err = await updCheck(); U.checking = false; M.err = err; draw(); if (!err) toast(updReady() ? 'PMOS ' + updLatest() + ' is ready' : 'Checked. PMOS is up to date'); return; }
1212
- if (a === 'cancel') { U.phase = null; draw(); return; }
1213
- if (a === 'update' && updAppBehind()) { U.phase = 'confirm'; draw(); return; }
1214
- if (a === 'update' || a === 'go') {
1214
+ if (a === 'update') {
1215
1215
  const v = updLatest(), home = updHome(); U.phase = 'busy';
1216
1216
  for (const w of updKitsBehind()) {
1217
1217
  U.say = 'Updating the kit in ' + (w.label || w.name || w.id) + '.'; draw();
@@ -2187,20 +2187,17 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
2187
2187
  .updb{display:flex;flex-wrap:wrap;align-items:center;gap:12px 14px;padding:14px 16px;border-radius:18px;background:var(--spot);margin-bottom:6px}
2188
2188
  .updb .t{display:grid;gap:2px;flex:1 1 240px;min-width:0}.updb .t b{font-size:var(--fs-4)}
2189
2189
  .updb .a{display:flex;flex-wrap:wrap;gap:8px}.updb .cta{height:auto;min-height:44px;padding:0 18px}
2190
- .kday{border-top:1px solid var(--hair)}
2191
- .kdh{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:44px;font:600 var(--fs-2) var(--mono);color:var(--ink-2)}
2192
- .kdh em{font-style:normal;color:var(--ink-3)}
2193
- .kdh[aria-expanded="false"]::after{content:"Show";font:600 var(--fs-2) var(--sans);color:var(--ink-2)}
2194
- .doc .kvl{list-style:none;margin:0 0 6px;padding:0;display:grid;gap:2px;max-width:none}
2195
- .doc .kver{display:grid;grid-template-columns:110px minmax(0,1fr);gap:4px 14px;padding:10px 8px;margin:0;border-radius:14px;color:var(--ink)}
2196
- .doc .kver.new{background:linear-gradient(90deg,var(--spot),transparent)}
2197
- .kver .kv{display:grid;gap:2px;align-content:start}.kver .kv b{font:600 var(--fs-3) var(--mono)}
2198
- .kver .kv i{justify-self:start;font:600 var(--fs-1) var(--mono);font-style:normal;padding:0 7px;border-radius:999px;border:1px solid var(--hair);color:var(--ink-2)}
2199
- .kver .kv i.nw{border-color:transparent;background:var(--spot);color:var(--ember-ink)}
2200
- .kver .kv em{font:500 var(--fs-2) var(--mono);font-style:normal;color:var(--ink-3)}
2201
- .kp{display:grid;gap:6px;min-width:0;overflow-wrap:anywhere}.doc .kp p{margin:0;color:var(--ink);max-width:none;line-height:1.5}.kp p em{font:500 var(--fs-2) var(--mono);font-style:normal;color:var(--ink-3)}.kp p b{font-weight:600}.kp .ks{display:block;color:var(--ink-2)}
2202
- .kmore{min-height:44px;font-weight:600;color:var(--ink-2)}
2203
- @media (max-width:640px){.doc .kver{grid-template-columns:minmax(0,1fr)}.kver .kv{grid-auto-flow:column;justify-content:start;align-items:center;gap:8px}}
2190
+ .wk{display:grid;gap:14px}
2191
+ .wkh{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px}.wkh>b:first-child{font-size:var(--fs-4)}
2192
+ .wkm{display:grid;gap:16px;min-width:0}
2193
+ .wkg{display:grid;gap:6px}
2194
+ .wkgl{display:flex;align-items:center;gap:8px;font:600 var(--fs-1) var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--ink-2)}
2195
+ .wkgl i{width:8px;height:8px;border-radius:50%;background:var(--ink-3)}.wkgl i.n{background:var(--ember-ink)}.wkgl i.i{background:var(--ok)}.wkgl i.f{background:var(--bad)}
2196
+ .doc .wkg ul{list-style:none;margin:0;padding:0;display:grid;gap:8px;max-width:none}
2197
+ .doc .wkg li{color:var(--ink-2);line-height:1.5;overflow-wrap:anywhere}.wkg li b{color:var(--ink);font-weight:600}.wkg li em{font:500 var(--fs-1) var(--mono);font-style:normal;color:var(--ink-3)}
2198
+ .wka{border-top:1px solid var(--hair)}.wkr{display:grid;gap:12px;padding-bottom:12px;border-top:1px solid var(--hair)}
2199
+ .wkt{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px;width:100%;min-height:44px;padding:10px 0;color:var(--ink);text-align:left}
2200
+ .wkt::after{content:"Show";margin-left:auto;align-self:center;font:600 var(--fs-2) var(--sans);color:var(--ink-2)}.wkt[aria-expanded="true"]::after{content:"Hide"}
2204
2201
  /* premium-chat-session: the session's tool line, permission options and Stop in the conversation */
2205
2202
  .toolline{margin:2px 0 2px 42px;font:500 var(--fs-2) var(--mono);color:var(--ink-3)}
2206
2203
  .chatopts{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
@@ -0,0 +1,56 @@
1
+ /* pm/upd-weeks.js — the published kits' change log, grouped by calendar week (Settings › Updates; initiative premium-updates, the weekly log).
2
+ * Pure: no DOM, no network. The two Settings screens (cozy-settings.js, premium-shell.js) draw what it returns.
3
+ * weeksOf(entries, now, mine) → [{ key, name, range, kits: [oldest, newest], newer, groups: { new, imp, fix }, count }] newest week first
4
+ * lineOf(item) → { b, s } a bold name and the sentence under it (the PR's title and its summary), or just the sentence
5
+ * An entry is { v, at, prs: [{ n, t, s, k }] } as scripts/kit-changelog.js writes it. A week runs Monday to Sunday in this computer's time zone.
6
+ * Each PR becomes one line in New, Improved or Fixed by its kind k; chore, docs, test and CI PRs (k = x) are left out, and a week with no line
7
+ * is not listed (zero is silence). A kit published before kinds were kept has no k, so its title decides: a fix word means Fixed, else Improved. */
8
+ export const KINDS = [['new', 'New'], ['imp', 'Improved'], ['fix', 'Fixed']];
9
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
10
+ const cmpVer = (a, b) => { const x = String(a || '0').split('-')[0].split('.').map(Number), y = String(b || '0').split('-')[0].split('.').map(Number); for (let i = 0; i < 3; i++) if ((x[i] || 0) !== (y[i] || 0)) return (x[i] || 0) < (y[i] || 0) ? -1 : 1; return 0; };
11
+ const FIX = /\b(fix|fixes|fixed|hotfix|bug|no longer|sticks|stops?)\b/i;
12
+
13
+ /** 'new' | 'imp' | 'fix' | 'x' (left out). */
14
+ export function kindOf(p) {
15
+ if (p && (p.k === 'new' || p.k === 'imp' || p.k === 'fix' || p.k === 'x')) return p.k;
16
+ return FIX.test((p && (p.t || p.s)) || '') ? 'fix' : 'imp';
17
+ }
18
+ export function lineOf(p) {
19
+ const s = String((p && p.s) || ''), t = String((p && p.t) || '');
20
+ return t && t !== s ? { b: t, s } : { b: '', s };
21
+ }
22
+ const mondayOf = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate() - ((d.getDay() + 6) % 7));
23
+ const keyOf = (d) => d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0');
24
+ const dm = (d) => d.getDate() + ' ' + MON[d.getMonth()];
25
+ function rangeOf(mon) {
26
+ const sun = new Date(mon.getFullYear(), mon.getMonth(), mon.getDate() + 6);
27
+ return mon.getMonth() === sun.getMonth() ? mon.getDate() + ' – ' + dm(sun) : dm(mon) + ' – ' + dm(sun);
28
+ }
29
+
30
+ export function weeksOf(entries, now = Date.now(), mine = null) {
31
+ const thisMon = mondayOf(new Date(now)), lastMon = new Date(thisMon.getFullYear(), thisMon.getMonth(), thisMon.getDate() - 7);
32
+ const by = new Map();
33
+ for (const e of Array.isArray(entries) ? entries : []) {
34
+ if (!e || !e.v) continue;
35
+ const d = e.at ? new Date(e.at) : null, dated = d && !isNaN(d), mon = dated ? mondayOf(d) : null, key = dated ? keyOf(mon) : 'undated';
36
+ if (!by.has(key)) by.set(key, { key, mon, kits: [], newer: false, groups: { new: [], imp: [], fix: [] }, seen: new Set() });
37
+ const w = by.get(key);
38
+ w.kits.push(e.v);
39
+ if (mine && cmpVer(e.v, mine) > 0) w.newer = true;
40
+ for (const p of e.prs || []) {
41
+ const k = kindOf(p); if (k === 'x') continue;
42
+ if (p.n && w.seen.has(p.n)) continue;
43
+ if (p.n) w.seen.add(p.n);
44
+ w.groups[k].push({ n: p.n || null, t: p.t || '', s: p.s || '', v: e.v });
45
+ }
46
+ }
47
+ const out = [];
48
+ for (const w of by.values()) {
49
+ const count = w.groups.new.length + w.groups.imp.length + w.groups.fix.length;
50
+ if (!count) continue;
51
+ const sorted = [...w.kits].sort(cmpVer);
52
+ const name = !w.mon ? 'Date not recorded' : keyOf(w.mon) === keyOf(thisMon) ? 'This week' : keyOf(w.mon) === keyOf(lastMon) ? 'Last week' : 'Week of ' + dm(w.mon);
53
+ out.push({ key: w.key, name, range: w.mon ? rangeOf(w.mon) : '', kits: [sorted[0], sorted[sorted.length - 1]], newer: w.newer, groups: w.groups, count, mon: w.mon });
54
+ }
55
+ return out.sort((a, b) => (a.mon && b.mon ? b.mon - a.mon : a.mon ? -1 : b.mon ? 1 : 0)).map(({ mon, ...w }) => w);
56
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "_comment": "Settings › Updates with the weekly change log (What's new merged into Updates; layout C, the week picker). pm/upd-weeks.js groups the published kits by week and kind in node; the screens that draw it are checked by ev-everywhere-test.js. scripts/tests/kit-changelog.test.js covers the kind each PR keeps.",
3
+ "modules": ["upd-weeks.test.mjs"],
4
+ "seconds": { "upd-weeks.test.mjs": 1 }
5
+ }