create-pmos 0.762.0 → 0.763.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.762.0",
3
+ "version": "0.763.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -33,6 +33,19 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.763.0",
38
+ "at": "2026-11-24T05:36:34.102Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1719,
43
+ "t": "Tracker sync on Today below 95%, take Jira's value with Undo",
44
+ "s": "Tracker sync on Today below 95%, take Jira's value with Undo",
45
+ "k": "new"
46
+ }
47
+ ]
48
+ },
36
49
  {
37
50
  "v": "0.762.0",
38
51
  "at": "2026-11-24T05:23:23.423Z",
@@ -357,37 +370,6 @@
357
370
  "k": "fix"
358
371
  }
359
372
  ]
360
- },
361
- {
362
- "v": "0.742.0",
363
- "at": "2026-11-23T09:41:15.063Z",
364
- "f": 4,
365
- "prs": [
366
- {
367
- "n": 1656,
368
- "t": "Try what shipped, each update asks beta users to try its changes and say if they work",
369
- "s": "Every user-facing change carries 1 to 3 try steps, what you should see and the page to open, and a beta computer asks its user to try each one and say Works or Didn't work.",
370
- "k": "new",
371
- "h": "Try what each update brought",
372
- "d": "Updates shipped many changes a day, and nobody was told how to use or check them. On the beta line, Home shows one row with the new things to try. Each has its steps, Show me, Works and Didn't work. Your answers go back to the team that fixes them.",
373
- "top": "Every update now asks you to try what it changed, one card per change.",
374
- "try": {
375
- "steps": [
376
- "Open Home.",
377
- "Press the row that says new things to try.",
378
- "Follow one card's steps and press Works or Didn't work."
379
- ],
380
- "see": "the card says Thanks and the Home row counts one less.",
381
- "open": "/today.html"
382
- }
383
- },
384
- {
385
- "n": 1667,
386
- "t": "Pmos signal adds and removes the customer signals the roadmap shows (A157)",
387
- "s": "Pmos signal adds and removes the customer signals the roadmap shows (A157)",
388
- "k": "new"
389
- }
390
- ]
391
373
  }
392
374
  ]
393
375
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@4b157acc
1
+ kernel-source: pmos@ba67a30c
2
2
  assembled: 2026-11-24
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-24T05:23:19Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T05:36:30Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-11-24T05:23:19Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T05:36:30Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-11-24T05:23:19Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T05:36:30Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,17 @@
1
1
  [
2
+ {
3
+ "v": "0.763.0",
4
+ "at": "2026-11-24T05:36:34.102Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1719,
9
+ "t": "Tracker sync on Today below 95%, take Jira's value with Undo",
10
+ "s": "Tracker sync on Today below 95%, take Jira's value with Undo",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
2
15
  {
3
16
  "v": "0.762.0",
4
17
  "at": "2026-11-24T05:23:23.423Z",
@@ -51,6 +51,7 @@ Home, the Board, Insights and the Viewer use one typeface, Plus Jakarta Sans, wi
51
51
  - **Today's batch.** Everything other people will see (a review request, Jira tickets, a follow-up, a closed ask) is one row: "Today's batch: 5 to send". Press it to open the batch full size. **Back** returns to Today. The drafts are in groups by kind, and each one says who will see it. ✎ **Change it first** opens the draft, ✕ **Skip** drops it (with Undo), and ✓ **Approve** sends it. When more than one draft waits, PMOS suggests **Approve and send all**. Nothing is sent until you press. If no channel is connected yet, the draft stays in the batch and says so. A draft you leave for 7 days lapses and is not sent. On a phone the batch shows one draft at a time, full text first: swipe right to approve, left to skip.
52
52
  - **The dashed line.** Your move ends with one dashed line, for example "9 more move in the line by themselves · none stuck" (or "· 1 stuck"). It counts the live initiatives of your products that do not wait on you. Press it to open the Line on Work. With nothing on the line there is no dashed line.
53
53
  - **The weekly digest.** On a Monday the Overview sentence ends with "Last week's digest is ready to read." Press it to read last week in the Viewer: one sentence on the line, What moved (each initiative that reached a new station, and what put it there), What PMOS did by itself (with what you undid and what the Checker sampled), Not sent (drafts that lapsed after 7 days) and Next week (initiatives that reach their station's limit). A section with nothing is left out. The digest is only to read: anything that needs you is already in Your move. The switch in its header, or **Weekly digest** in Settings › General, turns it off; off means PMOS does not make it.
54
+ - **When a product drifts from Jira.** When fewer than 95% of a product's tasks that name a Jira ticket match the last Jira read, the Overview says so in one ✦ row: "idpf differs from Jira on 7 of 128 tasks (94%). Take Jira's value on all 7". What differs is a value someone set by hand in PMOS: an owner, a done day or a state. Press ✓ to make PMOS say what Jira says for all of them, or press the arrow to see each difference and ✓ only the ones you want. The message that shows has Undo, which puts back what PMOS said. Press ✕ to keep what PMOS says; the row comes back only when the number changes. A product at 95% or more shows no row. PMOS changes nothing in Jira.
54
55
  - **One press per initiative.** An initiative's proposals are one row, for example "Checkout: 6 changes to keep" with "3 dates, 2 names, 1 link" under it. Press it to see them grouped as Dates, Names, Done and Links. ✓ keeps all of them, with one Undo for the batch. ✕ drops them, then offers three reasons and **Say why**. A proposal that needs your own check keeps its own ✓ and ✕. **See every change** opens the full list on the initiative.
55
56
  - **An ask expires after 14 days with no answer.** PMOS leaves it as it was and writes why in the initiative's History. Your move says it once: "2 asks expired after 14 days with no answer." Dates computed from your tasks never expire: PMOS reads them again each time.
56
57
  - **Done** lists what PMOS finished by itself in the last 14 days, one line each with Undo.
@@ -98,6 +98,7 @@ const MODULES = Object.freeze([
98
98
  'routes-proposals', // batch 12 items 2, 3 and 4: everything Claude proposes on an initiative, under its one ✦ (proposals.jsonl; page-press POST)
99
99
  'routes-autonomy', // D106: what agents did by themselves (the Done group, 14 days), its Undo, and the demotions Home says once (autonomy.jsonl)
100
100
  'routes-your-move', // workspace grill W3: Your move's overdue outcome verdicts (drafted from Jira) and the first key result with no reading (GET)
101
+ 'routes-tracker-sync', // tracker-sync-on-today: the sync with Jira of a product, the PM's ✓ that takes Jira's value, and its Undo (task ledger; page-press POST)
101
102
  'routes-standing-rules', // standing-rules-list (A470): the standing rules PMOS keeps, with edit, retire and bring back (memory + standing-rules.jsonl)
102
103
  'routes-lab', // idle lab (build U): Intelligence › Lab, the compare view, the specimen files and the Lab's own ✦ (idle-lab.jsonl; page-press POST)
103
104
  'routes-loose', // batch 13 item 3: Claude's clean-up of Home's "Not in an initiative" under the group's ✦ (loose-props/; page-press POST)
@@ -0,0 +1,64 @@
1
+ 'use strict';
2
+ /* routes-tracker-sync.js — the tracker sync of a product on Today, and the PM's ✓ that takes Jira's value, with Undo
3
+ * (initiative tracker-sync-on-today; board TrackerSyncDesk on Exploring 3).
4
+ *
5
+ * GET /api/tracker-sync?ws=<id> → { ok, ws, read, inSync, unread, pct, quiet, readAt, rows, more } lib/task-jira.js syncOf (reads only)
6
+ * POST /api/tracker-sync/take { ws, rows? } → { ok, batch, n } rows: [{ task, field }] or none for every difference (page press)
7
+ * POST /api/tracker-sync/undo { ws, batch } → { ok, batch, n } puts the batch's old values back (page press)
8
+ *
9
+ * The rows are capped at ROWS (Today lists the first ones; take without rows still takes all). Jira is only read: its stored snapshots
10
+ * (lib/jira-status.js readSnapshot). The writes go to the task ledger (lib/tracker-sync-take.js), one [tracker-sync-take] line each. */
11
+ const guard = require('./pm-guard.js');
12
+ const TJ = require('./task-jira.js');
13
+ const TK = require('./tracker-sync-take.js');
14
+
15
+ const ROWS = 50;
16
+ const text = (v) => (typeof v === 'string' ? v.trim() : '');
17
+ const snapOf = (root) => (ini) => require('./jira-status.js').readSnapshot(root, ini);
18
+
19
+ function wsOf(ctx, id) {
20
+ let w = null;
21
+ try { w = ctx.getWs(id || null); } catch { w = null; }
22
+ return w && w.root ? w : null;
23
+ }
24
+
25
+ async function handle(req, res, url, ctx) {
26
+ const p = url.pathname;
27
+ if (p !== '/api/tracker-sync' && p !== '/api/tracker-sync/take' && p !== '/api/tracker-sync/undo') return false;
28
+ if (p === '/api/tracker-sync') {
29
+ if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
30
+ const w = wsOf(ctx, url.searchParams.get('ws'));
31
+ if (!w) { ctx.json(res, { ok: false, error: 'no such workspace' }, 404); return true; }
32
+ let S;
33
+ try { S = TJ.syncOf(TJ.readLines(w.root), snapOf(w.root)); } catch (e) { ctx.json(res, { ok: false, error: 'the sync could not be read: ' + (e && e.message) }, 500); return true; }
34
+ // readAt: the newest Jira read the product's keyed tasks rest on (the ✦ row says "as of"), null with none
35
+ let readAt = null;
36
+ try { const so = snapOf(w.root); for (const ini of TJ.readKeys(w.root).keys()) { const s = so(ini); if (s && s.fetchedAt && (!readAt || s.fetchedAt > readAt)) readAt = s.fetchedAt; } } catch { readAt = null; }
37
+ ctx.json(res, { ok: true, ws: w.id, ...S, readAt, rows: S.rows.slice(0, ROWS), more: Math.max(0, S.rows.length - ROWS) });
38
+ return true;
39
+ }
40
+ if (req.method !== 'POST') { ctx.json(res, { ok: false, error: 'POST only' }, 405); return true; }
41
+ const read = await ctx.readJson(req);
42
+ if (!read.ok) { ctx.json(res, { ok: false, error: 'the body is not JSON' }, 400); return true; }
43
+ const body = read.body || {};
44
+ const g = guard.requirePagePress(req, body);
45
+ if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
46
+ const w = wsOf(ctx, text(body.ws));
47
+ if (!w) { ctx.json(res, { ok: false, error: 'no such workspace' }, 404); return true; }
48
+ const by = (g.actor && g.actor.by) || 'pm';
49
+ let r;
50
+ if (p.endsWith('/take')) {
51
+ const pick = Array.isArray(body.rows) ? body.rows.filter((x) => x && text(x.task) && text(x.field)).map((x) => ({ task: text(x.task), field: text(x.field) })) : null;
52
+ if (Array.isArray(body.rows) && !pick.length) { ctx.json(res, { ok: false, error: 'no row named' }, 400); return true; }
53
+ r = TK.take(w.root, snapOf(w.root), { pick, by });
54
+ } else {
55
+ const batch = text(body.batch);
56
+ if (!batch) { ctx.json(res, { ok: false, error: 'no batch named' }, 400); return true; }
57
+ r = TK.undo(w.root, batch, { by });
58
+ }
59
+ try { if (r.ok && ctx.invalidateNeedsAgg) ctx.invalidateNeedsAgg(w.id); } catch { /* the next poll recounts */ }
60
+ ctx.json(res, r, r.ok ? 200 : 409);
61
+ return true;
62
+ }
63
+
64
+ module.exports = { prefixes: ['/api/tracker-sync'], handle };
@@ -31,6 +31,8 @@
31
31
  * SPRINT DATES (product line slice 3, "Discovery reads tracker assignees and sprints"). An open task whose ticket is in an active or planned
32
32
  * sprint with a start and an end takes those days as its start and due, unless someone set the task's dates by hand after it was made.
33
33
  * A closed sprint, a backlog ticket or a sprint with no dates changes nothing. The task's own dates stay in the ledger; the read is in memory.
34
+ * FOLLOW (tracker-sync-on-today). A line by the tracker with `follow: true` (the PM took Jira's value on Today, lib/tracker-sync-take.js) hands the
35
+ * owner back to the tracker: its by-hand mark is cleared, so a later Jira move is followed again. A done day by the tracker is never by hand.
34
36
  * SYNC (A439). After the read is applied, a task the read returned is in sync when its state, done day and owner match the reading.
35
37
  * pct = in sync ÷ read; the tasks the read did not return are counted apart (unread). quiet at 95% or more (zero is silence).
36
38
  * STALE. The Jira read is due every day: a read older than 26 hours (lib/freshness.js, jira stale_after_ms) is stale, and so is a task
@@ -76,7 +78,7 @@ function keyedTasks(lines) {
76
78
  t.since = typeof e.happened === 'string' ? e.happened : String(e.at || '').slice(0, 10) || null;
77
79
  t.dayByHand = typeof e.happened === 'string' && e.by !== BY;
78
80
  }
79
- if (typeof e.owner === 'string') { t.owner = e.owner.trim() || null; if (e.by !== BY) t.ownerAt = e.at || t.ownerAt || 'by-hand'; }
81
+ if (typeof e.owner === 'string') { t.owner = e.owner.trim() || null; if (e.by !== BY) t.ownerAt = e.at || t.ownerAt || 'by-hand'; else if (e.follow) t.ownerAt = null; }
80
82
  // SPRINT DATES: a start or due someone wrote after the task was made is theirs; the tracker's own lines are not
81
83
  for (const k of ['start', 'due']) if (k in e && e.kind === 'task-update') { t[k] = DAY_RE.test(String(e[k] || '')) ? e[k] : null; if (e.by !== BY) t.datesByHand = true; }
82
84
  } else if (e.kind === 'task-remove') {
@@ -195,7 +197,7 @@ function samePerson(a, b) {
195
197
  /**
196
198
  * How much of PMOS matches the last Jira read (A439). The read is applied first (trackerLines), so what is left is what PMOS keeps on
197
199
  * purpose: a state changed after Jira's last move, a done day or an owner set by hand. Each row is
198
- * { task, key, title, initiative, field: 'state' | 'done day' | 'owner', pmos, tracker }.
200
+ * { task, key, title, initiative, field: 'state' | 'done day' | 'owner', pmos, tracker, pmosAt, trackerAt } (the days each side set it, or null).
199
201
  */
200
202
  function syncOf(lines, snapOf) {
201
203
  const snap = snapMemo(snapOf);
@@ -215,7 +217,11 @@ function syncOf(lines, snapOf) {
215
217
  const who = humanAssignee(rd.assignee);
216
218
  if (who && !samePerson(who, t.owner)) diff.push(['owner', t.owner, who]);
217
219
  if (!diff.length) { inSync++; continue; }
218
- for (const [field, pmos, tracker] of diff) rows.push({ task: t.task, key: t.key, title: t.title, initiative: t.initiative, field, pmos: pmos || null, tracker });
220
+ // when each side last set it (tracker-sync-on-today: the list shows which value is newer); a done day is a day itself
221
+ const day10 = (v) => (DAY_RE.test(String(v || '').slice(0, 10)) ? String(v).slice(0, 10) : null);
222
+ const jAt = day10(rd.updated) || day10(rd.resolved);
223
+ const atOf = { state: [day10(t.stateAt), jAt], 'done day': [null, null], owner: [day10(t.ownerAt), jAt] };
224
+ for (const [field, pmos, tracker] of diff) rows.push({ task: t.task, key: t.key, title: t.title, initiative: t.initiative, field, pmos: pmos || null, tracker, pmosAt: atOf[field][0], trackerAt: atOf[field][1] });
219
225
  }
220
226
  const pct = read ? Math.floor((inSync / read) * 100) : null;
221
227
  return { read, inSync, unread, pct, quiet: pct === null || pct >= 95, rows };
@@ -0,0 +1,92 @@
1
+ 'use strict';
2
+ /* tracker-sync-take.js — take the tracker's value for the tasks where PMOS and the last Jira read differ, with Undo
3
+ * (initiative tracker-sync-on-today; follow-up of tracker-dates-owners-sync, bets A439 and A440; board TrackerSyncDesk on Exploring 3).
4
+ *
5
+ * takeLines(lines, snapOf, { pick, batch, at, by }) PURE → [task-update line] one line per task that differs (or per picked row)
6
+ * undoLines(lines, batch, { at, by }) PURE → [task-update line] the old values of one batch, by hand again
7
+ * batchesOf(lines) PURE → Map batch → { at, n, undone }
8
+ * take(root, snapOf, o) · undo(root, batch, o) write those lines to the initiative ledger (lib/task-store.js write)
9
+ *
10
+ * WHY. After the read (lib/task-jira.js trackerLines) the differences that stay are values someone set by hand in PMOS: an owner, a done
11
+ * day, a state changed after Jira's last move. PMOS never overwrites them alone. The PM's ✓ on Today takes Jira's value.
12
+ * TAKE. Each line is { kind: 'task-update', by: 'tracker:jira', follow: true, take: <batch>, approved: <by>, task, owner?, happened?, state?,
13
+ * was: { owner?, happened?, state? } }. `by` is the tracker and `follow` hands the field back to it: lib/task-jira.js keyedTasks clears the
14
+ * by-hand mark, so a later Jira move is followed again. A done day is written with the state it belongs to.
15
+ * UNDO. One line per task of the batch with the `was` values, by the PM (by hand again: the next read keeps them), and `undo: <batch>`.
16
+ * A batch undone once is not undone twice.
17
+ * BOUNDARY. No network: Jira is only read (its stored snapshots). Writes go to the task ledger only. */
18
+ const TJ = require('./task-jira.js');
19
+
20
+ const FIELD = { owner: 'owner', 'done day': 'happened', state: 'state' };
21
+
22
+ function takeLines(lines, snapOf, o = {}) {
23
+ const S = TJ.syncOf(lines, snapOf);
24
+ const pick = Array.isArray(o.pick) && o.pick.length ? new Set(o.pick.map((p) => p.task + '|' + p.field)) : null;
25
+ const tasks = TJ.keyedTasks((lines || []).concat(TJ.trackerLines(lines, snapOf)));
26
+ const by = new Map();
27
+ for (const r of S.rows) {
28
+ if (pick && !pick.has(r.task + '|' + r.field)) continue;
29
+ const k = FIELD[r.field]; if (!k) continue;
30
+ if (!by.has(r.task)) by.set(r.task, { row: r, set: {}, was: {} });
31
+ const x = by.get(r.task), t = tasks.get(r.task) || {};
32
+ x.set[k] = r.tracker;
33
+ x.was[k] = k === 'happened' ? (t.since || null) : (r.pmos || null);
34
+ if (k === 'happened' && !x.set.state) x.set.state = t.state; // a done day is written with its state, as the board folds it
35
+ }
36
+ const at = o.at || new Date().toISOString();
37
+ return [...by.values()].map(({ row, set, was }) => ({ at, by: TJ.BY, kind: 'task-update', task: row.task, ...set, follow: true, take: o.batch, approved: o.by || 'pm',
38
+ was, why: `took Jira's ${Object.keys(was).map((k) => (k === 'happened' ? 'done day' : k)).join(', ')} (${row.key})` }));
39
+ }
40
+
41
+ function batchesOf(lines) {
42
+ const out = new Map();
43
+ for (const e of lines || []) {
44
+ if (!e || e.kind !== 'task-update') continue;
45
+ if (e.take) { const b = out.get(e.take) || { at: e.at, n: 0, undone: false }; b.n++; out.set(e.take, b); }
46
+ if (e.undo && out.has(e.undo)) out.get(e.undo).undone = true;
47
+ }
48
+ return out;
49
+ }
50
+
51
+ function undoLines(lines, batch, o = {}) {
52
+ const B = batchesOf(lines).get(batch);
53
+ if (!B || B.undone) return [];
54
+ const at = o.at || new Date().toISOString();
55
+ return (lines || []).filter((e) => e && e.kind === 'task-update' && e.take === batch && e.was).map((e) => {
56
+ const back = {};
57
+ if ('owner' in e.was) back.owner = e.was.owner || '';
58
+ if ('state' in e.was && e.was.state) back.state = e.was.state;
59
+ if ('happened' in e.was && e.was.happened) { back.happened = e.was.happened; if (!back.state) back.state = e.state; }
60
+ return { at, by: o.by || 'pm', kind: 'task-update', task: e.task, ...back, undo: batch, why: 'undo: took Jira\'s value' };
61
+ });
62
+ }
63
+
64
+ const newBatch = () => 'ts-' + Date.now().toString(36) + '-' + Math.random().toString(36).slice(2, 6);
65
+
66
+ function writeAll(root, out) {
67
+ const TS = require('./task-store.js');
68
+ let n = 0;
69
+ for (const l of out) { if (!TS.write(root, l)) break; n++; }
70
+ return n;
71
+ }
72
+
73
+ /** Take Jira's value: all differences, or o.pick [{ task, field }]. → { ok, batch, n, fields } | { ok: false, error } */
74
+ function take(root, snapOf, o = {}) {
75
+ const batch = newBatch();
76
+ const out = takeLines(TJ.readLines(root), snapOf, { ...o, batch });
77
+ if (!out.length) return { ok: false, error: 'Nothing differs from Jira now. Nothing changed.' };
78
+ const n = writeAll(root, out);
79
+ if (!n) return { ok: false, error: 'The tasks could not be saved. Nothing changed.' };
80
+ console.log(`[tracker-sync-take] root=${root} act=take batch=${batch} tasks=${n}`);
81
+ return { ok: true, batch, n };
82
+ }
83
+ /** Undo one batch. → { ok, batch, n } | { ok: false, error } */
84
+ function undo(root, batch, o = {}) {
85
+ const out = undoLines(TJ.readLines(root), batch, o);
86
+ if (!out.length) return { ok: false, error: 'There is nothing to undo for this change.' };
87
+ const n = writeAll(root, out);
88
+ console.log(`[tracker-sync-take] root=${root} act=undo batch=${batch} tasks=${n}`);
89
+ return n ? { ok: true, batch, n } : { ok: false, error: 'The tasks could not be saved. Nothing changed.' };
90
+ }
91
+
92
+ module.exports = { takeLines, undoLines, batchesOf, take, undo };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.762.0",
3
+ "version": "0.763.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.762.0",
9
+ "version": "0.763.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.762.0",
3
+ "version": "0.763.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",
@@ -43,6 +43,7 @@ export function mountToday(ctx) {
43
43
  readQuestions();
44
44
  readLine();
45
45
  readDigest();
46
+ readSync();
46
47
  }
47
48
  /* open-questions-today (A420, board QuestionsA): every product's register (GET /api/open-questions), one list for the Decide tab. A product
48
49
  * that does not answer is left out; nothing is guessed. Read-only: taking a default and putting it off a week are slice 2. */
@@ -58,6 +59,25 @@ export function mountToday(ctx) {
58
59
  X.questions = lines;
59
60
  draw();
60
61
  }
62
+ /* tracker-sync-on-today (board TrackerSyncDesk): each product's sync with its tracker (GET /api/tracker-sync). Only a product below 95%
63
+ * gets a ✦ row (TM.syncSuggest); ✕ hides it until its number changes (kept in this browser). */
64
+ const SYNC_NO = 'pmos.today.syncNo';
65
+ function syncHidden() { try { return new Map(Object.entries(JSON.parse(localStorage.getItem(SYNC_NO) || '{}'))); } catch { return new Map(); } }
66
+ async function readSync() {
67
+ const P = ((ctx.S.M && ctx.S.M.products) || []).filter((p) => p && p.model);
68
+ const W = [...new Set((P.length ? P.map((p) => p.ws || ctx.boardWs() || '') : [ctx.boardWs() || '']))];
69
+ const got = await Promise.all(W.map((ws) => ctx.pmGet('/api/tracker-sync' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)));
70
+ X.sync = got.filter((r) => r && r.ok);
71
+ const low = X.sync.filter((r) => r.pct != null && r.pct < TM.SYNC_QUIET);
72
+ if (low.length) console.info('[tracker-sync-take] shown=' + low.map((r) => r.ws + ':' + r.pct).join(','));
73
+ X.html = ''; draw();
74
+ }
75
+ async function syncTake(ws, rows, said) {
76
+ const res = await ctx.pmPost('/api/tracker-sync/take', { ws, ...(rows ? { rows } : {}) }).catch(() => null);
77
+ if (!res || !res.ok) { ctx.toast((res && res.error) || 'Jira’s value was not taken. Nothing changed.'); return readSync(); }
78
+ ctx.toastUndo(said(res.n), async () => { const u = await ctx.pmPost('/api/tracker-sync/undo', { ws, batch: res.batch }).catch(() => null); await readSync(); ctx.reload && ctx.reload(); return u || { ok: false }; });
79
+ await readSync(); if (ctx.reload) ctx.reload();
80
+ }
61
81
  /* quiet-rows-digest (board QuietDigest): on a Monday, each product's part of last week's digest (GET /api/digest); off means none is made */
62
82
  async function readDigest() {
63
83
  if (new Date(ctx.now()).getDay() !== 1) return;
@@ -139,7 +159,7 @@ export function mountToday(ctx) {
139
159
  const A = TM.agendaModel({ meetings: ctx.meetings(), own: X.log.entries, reports: X.reports || [], focus: lead ? { key: lead.key, title: lead.title } : null, now,
140
160
  iniOf: (m) => (m && (m.initiative || (m.level && m.level.kind === 'initiative' && m.level.id) || (m.about && m.about.kind === 'initiative' && m.about.id))) || null });
141
161
  const O = DG && X.digest ? DG.withDigest(TM.overviewModel(L, A), X.digest, now) : TM.overviewModel(L, A);
142
- O.suggest = O.suggest.filter((x) => !X.hide.has(x.key));
162
+ O.suggest = O.suggest.filter((x) => !X.hide.has(x.key)).concat(TM.syncSuggest(X.sync || [], { nameOf: (ws) => productOf(ws), hidden: syncHidden(), open: X.syncOpen || new Set(), now }));
143
163
  return { L, A, O };
144
164
  }
145
165
  function draw() {
@@ -478,8 +498,27 @@ export function mountToday(ctx) {
478
498
  if (act === 'job') { X.job = key; draw(); return; }
479
499
  // the recorded meeting: ✓ keeps it filed where PMOS put it, and the block leaves Today
480
500
  if (act === 'filed-ok') { X.filedOk.add(key); draw(); return; }
501
+ if (act === 'sync-open') { X.syncOpen = X.syncOpen || new Set(); if (X.syncOpen.has(key)) X.syncOpen.delete(key); else X.syncOpen.add(key); X.html = ''; draw(); return; }
502
+ if (act === 'sync-take') {
503
+ const [ws, task, field] = String(key).split('|'); if (X.busy.has(key)) return;
504
+ X.busy.add(key); b.disabled = true;
505
+ try { await syncTake(ws, [{ task, field }], () => 'PMOS now says what Jira says for this task.'); } finally { X.busy.delete(key); }
506
+ return;
507
+ }
481
508
  if (act === 'ov-yes' || act === 'ov-no') {
482
509
  const sg = X.overview && X.overview.suggest.find((x) => x.key === key); if (!sg || X.busy.has(key)) return;
510
+ if (sg.act === 'sync') {
511
+ X.sheet = '';
512
+ if (act === 'ov-no') {
513
+ const h = syncHidden(); h.set(sg.ws, sg.sig);
514
+ try { localStorage.setItem(SYNC_NO, JSON.stringify(Object.fromEntries(h))); } catch { /* a private window: it shows again on the next read */ }
515
+ console.info('[tracker-sync-take] act=no ws=' + sg.ws);
516
+ ctx.toast('Kept what PMOS says. PMOS asks again when the number changes.'); X.html = ''; draw(); return;
517
+ }
518
+ X.busy.add(key); b.disabled = true;
519
+ try { await syncTake(sg.ws, null, (n) => 'Took Jira’s value on ' + n + (n === 1 ? ' task.' : ' tasks.')); } finally { X.busy.delete(key); }
520
+ return;
521
+ }
483
522
  X.busy.add(key); b.disabled = true; X.sheet = '';
484
523
  try {
485
524
  if (act === 'ov-no') { for (const k of sg.keys) await mark1(k, 'keep', {}); X.hide.add(key); ctx.toast('Kept. PMOS will not suggest it again for a month.'); return after(false); }
@@ -594,3 +594,30 @@ export function headModel(now = Date.now()) {
594
594
  const d = new Date(now), h = d.getHours();
595
595
  return { when: DOW_LONG[d.getDay()] + ' ' + d.getDate() + ' ' + MON_LONG[d.getMonth()] + ' · ' + hm(now), hello: h < 5 || h >= 18 ? 'Good evening' : h < 12 ? 'Good morning' : 'Good afternoon' };
596
596
  }
597
+
598
+ /* ── Tracker sync (initiative tracker-sync-on-today; board TrackerSyncDesk on Exploring 3) ──
599
+ * One ✦ Suggestion per product below SYNC_QUIET percent in sync with its tracker (GET /api/tracker-sync, lib/task-jira.js syncOf). At
600
+ * SYNC_QUIET or more, or with no read, the product says nothing (zero is silence). ✓ takes Jira's value on every difference, ✕ hides the
601
+ * row until the number changes (hidden: Map ws → the sig it was hidden at), and the list under it takes one difference at a time.
602
+ * syncSuggest(parts, { nameOf, hidden, open, now }) → [{ key, act: 'sync', ws, text, keys: [], items, why, rows, n, sig, open }] */
603
+ export const SYNC_QUIET = 95;
604
+ const FIELD_WORD = { owner: 'Owner', 'done day': 'Done day', state: 'State' };
605
+ const MON3 = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
606
+ const dayWord = (d) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(d || '')); return m ? +m[3] + ' ' + MON3[+m[2] - 1] : ''; };
607
+ /** "06:10" for a read today (local time), else "23 Nov"; '' with none. */
608
+ const readWord = (iso, now) => { const t = Date.parse(String(iso || '')); if (!Number.isFinite(t)) return ''; const d = new Date(t), n = new Date(now || Date.now());
609
+ return d.toDateString() === n.toDateString() ? String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0') : d.getDate() + ' ' + MON3[d.getMonth()]; };
610
+ export const syncSig = (p) => (p ? p.pct + '|' + (p.read - p.inSync) + '|' + (p.rows || []).length : '');
611
+ export function syncSuggest(parts, o = {}) {
612
+ const nameOf = o.nameOf || ((ws) => ws || 'This product');
613
+ const hidden = o.hidden || new Map(), open = o.open || new Set();
614
+ return (parts || []).filter((p) => p && p.ok && p.pct != null && p.pct < SYNC_QUIET && (p.rows || []).length && hidden.get(p.ws || '') !== syncSig(p)).map((p) => {
615
+ const ws = p.ws || '', n = p.read - p.inSync, name = nameOf(ws) || 'This product';
616
+ const rows = p.rows.map((r) => ({ ...r, ws, label: FIELD_WORD[r.field] || r.field }));
617
+ const at = readWord(p.readAt, o.now);
618
+ return { key: 'sync:' + ws, act: 'sync', ws, n, sig: syncSig(p), keys: [], rows, open: open.has('sync:' + ws),
619
+ text: name + ': ' + n + ' of ' + p.read + ' tasks differ from Jira, each set by hand in PMOS' + (at ? ' (Jira read ' + at + ')' : '') + '. Take Jira’s value on ' + (n === 1 ? 'it' : 'all ' + n),
620
+ items: rows.map((r) => r.key + ' ' + r.label.toLowerCase() + ': PMOS ' + (r.pmos || 'none') + (r.pmosAt ? ' (set ' + dayWord(r.pmosAt) + ')' : '') + ', Jira ' + r.tracker + (r.trackerAt ? ' (' + dayWord(r.trackerAt) + ')' : '')),
621
+ why: 'Someone set these in PMOS by hand, and Jira says otherwise. PMOS changes nothing in Jira. Undo puts back what PMOS said.' + (p.unread ? ' ' + p.unread + (p.unread === 1 ? ' task' : ' tasks') + ' could not be read and are not counted.' : '') };
622
+ });
623
+ }
@@ -94,6 +94,18 @@ export function rowHtml(r, o = {}) {
94
94
  return row + sug + sj + lk + lab;
95
95
  }
96
96
 
97
+ /** A tracker sync Suggestion (tracker-sync-on-today, board TrackerSyncDesk): ✓ takes Jira's value on all, ✕ keeps PMOS's, the arrow opens
98
+ * the differences, each with its own ✓. x: cozy-today-model.js syncSuggest()[i]. */
99
+ function syncHtml(x) {
100
+ const sg = sugHtml(x.text, ['ov-yes', x.text], ['ov-no', 'Keep what PMOS says: ' + x.text], x.key, 'td-ovs');
101
+ const more = ib('sync-open', (x.open ? 'Hide the ' : 'See the ') + plural(x.rows.length, 'difference', 'differences'), x.open ? 'M7 14l5-5 5 5' : I.more, x.key, ` aria-expanded="${x.open ? 'true' : 'false'}"`);
102
+ const head = sg.replace(/<\/div>$/, more + '</div>');
103
+ if (!x.open) return head;
104
+ const rows = x.rows.map((r) => `<div class="pm-li td-sync"><span class="txt"><span class="t">${esc(r.key)} · ${esc(r.title.replace(/^\s*\[?[A-Z][A-Z0-9_]*-\d+\]?\s*[·:\-–]?\s*/, ''))}</span>`
105
+ + `<span class="w">${esc(r.label)}: PMOS says ${esc(r.pmos || 'none')}${r.pmosAt ? ', set by hand ' + esc(r.pmosAt) : ''} · Jira says ${esc(r.tracker)}${r.trackerAt ? ', ' + esc(r.trackerAt) : ''}</span></span>`
106
+ + ib('sync-take', 'Take Jira’s ' + r.label.toLowerCase() + ' for ' + r.key, I.yes, x.ws + '|' + r.task + '|' + r.field, '', 'outline') + '</div>').join('');
107
+ return head + `<div class="td-syncl" role="group" aria-label="${esc('Differs from Jira')}">${rows}</div>`;
108
+ }
97
109
  /** The Overview, a Summary block written by PMOS (✦): one sentence whose item names open the item, then PMOS's Suggestions.
98
110
  * O: overviewModel(). */
99
111
  export function overviewHtml(O) {
@@ -103,7 +115,7 @@ export function overviewHtml(O) {
103
115
  const t = esc(x.text), at = said.indexOf(t);
104
116
  if (at >= 0) said = said.slice(0, at) + `<button type="button" class="td-ln" data-td="open" data-key="${esc(x.key)}">${t}</button>` + said.slice(at + t.length);
105
117
  }
106
- const sug = (O.suggest || []).map((x) => sugHtml(x.text, ['ov-yes', x.text], ['ov-no', 'Keep them: ' + x.text], x.key, 'td-ovs')).join('');
118
+ const sug = (O.suggest || []).map((x) => (x.act === 'sync' ? syncHtml(x) : sugHtml(x.text, ['ov-yes', x.text], ['ov-no', 'Keep them: ' + x.text], x.key, 'td-ovs'))).join('');
107
119
  return `<section class="td-ov pm-block" aria-label="Overview"><h2 class="pm-h-sm pm-row">${ic(I.spark, 16, 'pm-star')}Overview</h2>${said ? `<p>${said}</p>` : ''}${sug}</section>`;
108
120
  }
109
121
  /* ── Your move (your-move, bet A468; board YourMoveDS, agreed 2026-11-23) ──
@@ -335,7 +347,7 @@ const clipT = (s, n) => { const t = String(s || '').replace(/\s+/g, ' ').trim();
335
347
  * with what changes, why, and Yes or No. sg: overviewModel().suggest[i]. '' with none. */
336
348
  export function phoneSheetHtml(sg) {
337
349
  if (!sg) return '';
338
- const items = (sg.items || []).slice(0, 5);
350
+ const items = (sg.items || []).slice(0, sg.act === 'sync' ? 50 : 5); // tracker sync: every difference (critic, 24 Nov)
339
351
  const more = (sg.keys || []).length - items.length;
340
352
  const what = items.length ? `<dt>What changes</dt><dd><ul>${items.map((t) => `<li>${esc(t)}</li>`).join('')}${more > 0 ? `<li>${esc(plural(more, 'more line', 'more lines'))}</li>` : ''}</ul></dd>` : '';
341
353
  return `<div class="tdp-sheet" role="dialog" aria-modal="true" aria-label="PMOS suggests"><button type="button" class="tdp-scrim" data-td="sheet-x" aria-label="Close"></button>`
@@ -744,3 +744,5 @@ body.cz-home .hm-hd.hv-bar > .hv-hi { flex: 1 0 auto; max-width: 100%; }
744
744
  .hy-lk { border: 0; background: none; padding: 0; font: inherit; color: var(--cz-blueink); font-weight: var(--fw-strong); cursor: pointer; }
745
745
  .ob-edit { width: 100%; box-sizing: border-box; font: inherit; line-height: 1.5; padding: var(--space-12) 14px; border-radius: 14px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink); resize: vertical; }
746
746
  .ob-nc { display: flex; align-items: center; gap: var(--space-8); flex-wrap: wrap; }
747
+ /* tracker-sync-on-today (board TrackerSyncDesk): the differences under the ✦ row, each a List item with its own ✓ */
748
+ .td-syncl { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-4); }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Tracker sync on Today (initiative tracker-sync-on-today, done test T1-T9): the ✦ row below 95% in sync with Jira, the PM's ✓ that takes Jira's value with Undo, and the route. Pure checks and a scratch repository. No connector, model or network.",
3
+ "modules": [
4
+ "tracker-sync-take.test.js"
5
+ ],
6
+ "seconds": {
7
+ "tracker-sync-take.test.js": 5
8
+ }
9
+ }